Files
contentstack-imagevault/types/contentstack.ts
2024-03-26 13:12:21 +01:00

61 lines
1.3 KiB
TypeScript

import { Lang } from "./lang"
// This type is only a partial of the data available.
export type ContentstackPluginDefinition = {
type: "field" | "rte_plugin"
title: string
src: string
}
// This type is only a partial of the data available.
// Check console when editing an entry for all the data available.
// The data comes from Contentstack, we have no control.
// Extend this if needed.
export type ContentstackEmbeddedData = {
entryMetadata: {
contentTypeUid: string
entryUid: string
locale: Lang
}
utilis: {
content_type: {
schema: Array<
| {
uid: string
data_type: "text"
value: string
}
| {
uid: string
data_type: "json"
value: unknown
}
>
}
extensions: ContentstackPluginDefinition[]
}
requestProps: {
stack: {
api_key: string
}
branch: string
}
}
// This is our version of the required fields we need that are available in ContentstackEmbeddedData
export type ExtractedContentstackEmbeddedData = {
contentType: {
uid: string
}
entry: {
locale: Lang
title: string
uid: string
}
plugin: ContentstackPluginDefinition
stack: {
apiKey: string
}
branch: string
}