import { AssetSys, Asset as ContentfulAsset, Entry as ContentfulEntry, EntryCollection as ContentfulEntryCollection, EntrySys as ContentfulEntrySys, EntrySkeletonType } from 'contentful'; type ContentfulMetadata = { editorInterface: { widgetNamespace: string; widgetId: string; }; fieldType: string; }; export type SourceMapMetadata = { origin: string; } & ({ href: string; contentful?: ContentfulMetadata; } | { href?: string; contentful: ContentfulMetadata; }); export type CreateSourceMapParams = { entityId: string; entityType: 'Entry' | 'Asset'; space: string; environment: string; field: string; locale: string; editorInterface: EditorInterfaceSource; fieldType: string; targetOrigin?: 'https://app.contentful.com' | 'https://app.eu.contentful.com'; platform?: 'contentful' | 'vercel'; }; export type Source = { field: number; locale: number; fieldType: number; editorInterface: number; } & ({ entry: number; } | { asset: number; }); export type CPASource = Pick; export type GraphQLSource = Source; export interface EntitySource { space: number; environment: number; id: string; } export type CPAMappings = Record; export type GraphQLMappings = Record; export type FieldType = 'Symbol' | 'Text' | 'RichText' | 'Array'; export type WidgetId = 'multipleLine' | 'boolean' | 'objectEditor' | 'datePicker' | 'locationEditor' | 'checkbox' | 'listInput' | 'rating' | 'radio' | 'tagEditor' | 'numberEditor' | 'urlEditor' | 'slugEditor' | 'singleLine' | 'dropdown' | 'entryLinkEditor' | 'entryCardEditor' | 'entryLinksEditor' | 'entryCardsEditor' | 'assetLinkEditor' | 'assetLinksEditor' | 'assetGalleryEditor' | 'richTextEditor' | 'markdown' | string; export type WidgetNamespace = 'builtin' | 'extension' | 'sidebar-builtin' | 'app' | 'editor-builtin'; export interface EditorInterfaceSource { widgetId: WidgetId; widgetNamespace: WidgetNamespace; } interface ContentSourceMaps { sys: { type: 'ContentSourceMaps'; }; spaces: string[]; environments: string[]; fieldTypes: FieldType[]; editorInterfaces: EditorInterfaceSource[]; fields: string[]; locales: string[]; entries: EntitySource[]; assets: EntitySource[]; } export type CPAContentSourceMaps = Pick & { mappings: CPAMappings; }; type GraphQLContentSourceMaps = Omit & { mappings: GraphQLMappings; }; export interface ContentSourceMapsLookup { sys: { type: 'ContentSourceMapsLookup'; }; fieldTypes: FieldType[]; editorInterfaces: EditorInterfaceSource[]; } export interface GraphQLResponse { data: TData; extensions: { contentSourceMaps?: GraphQLContentSourceMaps; [key: string]: any; }; } export interface ExtendedSys extends ContentfulEntrySys { contentSourceMapsLookup?: ContentSourceMapsLookup; contentSourceMaps?: CPAContentSourceMaps; } export interface ExtendedAssetSys extends AssetSys { contentSourceMapsLookup?: ContentSourceMapsLookup; contentSourceMaps?: CPAContentSourceMaps; } export interface CPAEntry extends ContentfulEntry { sys: ExtendedSys; fields: TFields['fields']; } export interface CPAAsset extends ContentfulAsset { sys: ExtendedAssetSys; fields: ContentfulAsset['fields']; } export interface CPAEntryCollection extends ContentfulEntryCollection { items: CPAEntry[]; } export {};