UNPKG

@prismicio/client

Version:

The official JavaScript + TypeScript client library for Prismic

1 lines 21.3 kB
{"version":3,"file":"Migration.cjs","sources":["../../src/Migration.ts"],"sourcesContent":["import * as is from \"./lib/isValue\"\nimport { getOptionalLinkProperties } from \"./lib/getOptionalLinkProperties\"\nimport { validateAssetMetadata } from \"./lib/validateAssetMetadata\"\n\nimport type { Asset } from \"./types/api/asset/asset\"\nimport type {\n\tMigrationAssetConfig,\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"./types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"./types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"./types/migration/ContentRelationship\"\nimport { PrismicMigrationDocument } from \"./types/migration/Document\"\nimport type {\n\tExistingPrismicDocument,\n\tPendingPrismicDocument,\n} from \"./types/migration/Document\"\nimport type { PrismicDocument } from \"./types/value/document\"\nimport type { FilledImageFieldImage } from \"./types/value/image\"\nimport { type FilledLinkToWebField, LinkType } from \"./types/value/link\"\nimport type { FilledLinkToMediaField } from \"./types/value/linkToMedia\"\nimport { RichTextNodeType } from \"./types/value/richText\"\n\n/**\n * Extracts one or more Prismic document types that match a given Prismic\n * document type. If no matches are found, no extraction is performed and the\n * union of all provided Prismic document types are returned.\n *\n * @typeParam TDocuments - Prismic document types from which to extract.\n * @typeParam TDocumentType - Type(s) to match `TDocuments` against.\n */\ntype ExtractDocumentType<\n\tTDocuments extends { type: string },\n\tTDocumentType extends TDocuments[\"type\"],\n> =\n\tExtract<TDocuments, { type: TDocumentType }> extends never\n\t\t? TDocuments\n\t\t: Extract<TDocuments, { type: TDocumentType }>\n\n/**\n * A helper that allows preparing your migration to Prismic.\n *\n * @typeParam TDocuments - Document types that are registered for the Prismic\n * repository. Query methods will automatically be typed based on this type.\n */\nexport class Migration<TDocuments extends PrismicDocument = PrismicDocument> {\n\t/**\n\t * Assets registered in the migration.\n\t *\n\t * @internal\n\t */\n\t_assets: Map<MigrationAssetConfig[\"file\"], PrismicMigrationAsset> = new Map()\n\n\t/**\n\t * Documents registered in the migration.\n\t *\n\t * @internal\n\t */\n\t_documents: PrismicMigrationDocument<TDocuments>[] = []\n\n\t/**\n\t * Registers an asset to be created in the migration from an asset object.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away.\n\t * Instead, it registers it in your migration. The asset will be created when\n\t * the migration is executed through the `writeClient.migrate()` method.\n\t *\n\t * @param asset - An asset object from Prismic Asset API.\n\t *\n\t * @returns A migration asset field instance.\n\t *\n\t * @internal\n\t */\n\tcreateAsset(asset: Asset): PrismicMigrationAsset\n\n\t/**\n\t * Registers an asset to be created in the migration from an image or link to\n\t * media field.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away.\n\t * Instead, it registers it in your migration. The asset will be created when\n\t * the migration is executed through the `writeClient.migrate()` method.\n\t *\n\t * @param imageOrLinkToMediaField - An image or link to media field from\n\t * Prismic Document API.\n\t *\n\t * @returns A migration asset field instance.\n\t *\n\t * @internal\n\t */\n\tcreateAsset(\n\t\timageOrLinkToMediaField: FilledImageFieldImage | FilledLinkToMediaField,\n\t): PrismicMigrationAsset\n\n\t/**\n\t * Registers an asset to be created in the migration from a file.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away.\n\t * Instead, it registers it in your migration. The asset will be created when\n\t * the migration is executed through the `writeClient.migrate()` method.\n\t *\n\t * @param file - The URL or content of the file to be created.\n\t * @param filename - The filename of the asset.\n\t * @param params - Additional asset data.\n\t *\n\t * @returns A migration asset field instance.\n\t */\n\tcreateAsset(\n\t\tfile: MigrationAssetConfig[\"file\"],\n\t\tfilename: MigrationAssetConfig[\"filename\"],\n\t\tparams?: {\n\t\t\tnotes?: string\n\t\t\tcredits?: string\n\t\t\talt?: string\n\t\t\ttags?: string[]\n\t\t},\n\t): PrismicMigrationAsset\n\n\t/**\n\t * Registers an asset to be created in the migration from a file, an asset\n\t * object, or an image or link to media field.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away.\n\t * Instead, it registers it in your migration. The asset will be created when\n\t * the migration is executed through the `writeClient.migrate()` method.\n\t *\n\t * @returns A migration asset field instance.\n\t */\n\tcreateAsset(\n\t\tfileOrAssetOrField:\n\t\t\t| MigrationAssetConfig[\"file\"]\n\t\t\t| Asset\n\t\t\t| FilledImageFieldImage\n\t\t\t| FilledLinkToMediaField,\n\t\tfilename?: MigrationAssetConfig[\"filename\"],\n\t\t{\n\t\t\tnotes,\n\t\t\tcredits,\n\t\t\talt,\n\t\t\ttags,\n\t\t}: {\n\t\t\tnotes?: string\n\t\t\tcredits?: string\n\t\t\talt?: string\n\t\t\ttags?: string[]\n\t\t} = {},\n\t): PrismicMigrationAsset {\n\t\tlet config: MigrationAssetConfig\n\t\tlet maybeInitialField: FilledImageFieldImage | undefined\n\t\tif (typeof fileOrAssetOrField === \"object\" && \"url\" in fileOrAssetOrField) {\n\t\t\tif (\n\t\t\t\t\"dimensions\" in fileOrAssetOrField ||\n\t\t\t\t\"link_type\" in fileOrAssetOrField\n\t\t\t) {\n\t\t\t\tconst url = fileOrAssetOrField.url.split(\"?\")[0]\n\t\t\t\tconst filename =\n\t\t\t\t\t\"name\" in fileOrAssetOrField\n\t\t\t\t\t\t? fileOrAssetOrField.name\n\t\t\t\t\t\t: url.split(\"/\").pop()!.split(\"_\").pop()!\n\t\t\t\tconst credits =\n\t\t\t\t\t\"copyright\" in fileOrAssetOrField && fileOrAssetOrField.copyright\n\t\t\t\t\t\t? fileOrAssetOrField.copyright\n\t\t\t\t\t\t: undefined\n\t\t\t\tconst alt =\n\t\t\t\t\t\"alt\" in fileOrAssetOrField && fileOrAssetOrField.alt\n\t\t\t\t\t\t? fileOrAssetOrField.alt\n\t\t\t\t\t\t: undefined\n\n\t\t\t\tif (\"dimensions\" in fileOrAssetOrField) {\n\t\t\t\t\tmaybeInitialField = fileOrAssetOrField\n\t\t\t\t}\n\n\t\t\t\tconfig = {\n\t\t\t\t\tid: fileOrAssetOrField.id,\n\t\t\t\t\tfile: url,\n\t\t\t\t\tfilename,\n\t\t\t\t\tnotes: undefined,\n\t\t\t\t\tcredits,\n\t\t\t\t\talt,\n\t\t\t\t\ttags: undefined,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconfig = {\n\t\t\t\t\tid: fileOrAssetOrField.id,\n\t\t\t\t\tfile: fileOrAssetOrField.url,\n\t\t\t\t\tfilename: fileOrAssetOrField.filename,\n\t\t\t\t\tnotes: fileOrAssetOrField.notes,\n\t\t\t\t\tcredits: fileOrAssetOrField.credits,\n\t\t\t\t\talt: fileOrAssetOrField.alt,\n\t\t\t\t\ttags: fileOrAssetOrField.tags?.map(({ name }) => name),\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconfig = {\n\t\t\t\tid: fileOrAssetOrField,\n\t\t\t\tfile: fileOrAssetOrField,\n\t\t\t\tfilename: filename!,\n\t\t\t\tnotes,\n\t\t\t\tcredits,\n\t\t\t\talt,\n\t\t\t\ttags,\n\t\t\t}\n\t\t}\n\n\t\tvalidateAssetMetadata(config)\n\n\t\t// We create a detached instance of the asset each time to serialize it properly\n\t\tconst migrationAsset = new PrismicMigrationAsset(config, maybeInitialField)\n\n\t\tconst maybeAsset = this._assets.get(config.id)\n\t\tif (maybeAsset) {\n\t\t\t// Consolidate existing asset with new asset value if possible\n\t\t\tmaybeAsset.config.notes = maybeAsset.config.notes || config.notes\n\t\t\tmaybeAsset.config.credits = maybeAsset.config.credits || config.credits\n\t\t\tmaybeAsset.config.alt = maybeAsset.config.alt || config.alt\n\t\t\tmaybeAsset.config.tags = Array.from(\n\t\t\t\tnew Set([...(maybeAsset.config.tags || []), ...(config.tags || [])]),\n\t\t\t)\n\t\t} else {\n\t\t\tthis._assets.set(config.id, migrationAsset)\n\t\t}\n\n\t\treturn migrationAsset\n\t}\n\n\t/**\n\t * Registers a document to be created in the migration.\n\t *\n\t * @remarks\n\t * This method does not create the document in Prismic right away. Instead, it\n\t * registers it in your migration. The document will be created when the\n\t * migration is executed through the `writeClient.migrate()` method.\n\t *\n\t * @typeParam TType - Type of the Prismic document to create.\n\t *\n\t * @param document - The document to create.\n\t * @param title - The title of the document to create which will be displayed\n\t * in the editor.\n\t * @param params - Document master language document ID.\n\t *\n\t * @returns A migration document instance.\n\t */\n\tcreateDocument<TType extends TDocuments[\"type\"]>(\n\t\tdocument: ExtractDocumentType<PendingPrismicDocument<TDocuments>, TType>,\n\t\ttitle: string,\n\t\tparams?: {\n\t\t\tmasterLanguageDocument?: MigrationContentRelationship\n\t\t},\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> {\n\t\tconst doc = new PrismicMigrationDocument<\n\t\t\tExtractDocumentType<TDocuments, TType>\n\t\t>(document, title, params)\n\n\t\tthis._documents.push(doc)\n\n\t\treturn doc\n\t}\n\n\t/**\n\t * Registers an existing document to be updated in the migration.\n\t *\n\t * @remarks\n\t * This method does not update the document in Prismic right away. Instead, it\n\t * registers it in your migration. The document will be updated when the\n\t * migration is executed through the `writeClient.migrate()` method.\n\t *\n\t * @typeParam TType - Type of Prismic documents to update.\n\t *\n\t * @param document - The document to update.\n\t * @param title - The title of the document to update which will be displayed\n\t * in the editor.\n\t *\n\t * @returns A migration document instance.\n\t */\n\tupdateDocument<TType extends TDocuments[\"type\"]>(\n\t\tdocument: ExtractDocumentType<ExistingPrismicDocument<TDocuments>, TType>,\n\t\t// Title is optional for existing documents as we might not want to update it.\n\t\ttitle?: string,\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> {\n\t\tconst doc = new PrismicMigrationDocument<\n\t\t\tExtractDocumentType<TDocuments, TType>\n\t\t>(document, title)\n\n\t\tthis._documents.push(doc)\n\n\t\treturn doc\n\t}\n\n\t/**\n\t * Registers a document from another Prismic repository to be created in the\n\t * migration.\n\t *\n\t * @remarks\n\t * This method does not create the document in Prismic right away. Instead, it\n\t * registers it in your migration. The document will be created when the\n\t * migration is executed through the `writeClient.migrate()` method.\n\t *\n\t * @param document - The document from Prismic to create.\n\t * @param title - The title of the document to create which will be displayed\n\t * in the editor.\n\t *\n\t * @returns A migration document instance.\n\t */\n\tcreateDocumentFromPrismic<TType extends TDocuments[\"type\"]>(\n\t\tdocument: ExtractDocumentType<ExistingPrismicDocument<TDocuments>, TType>,\n\t\ttitle: string,\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> {\n\t\tconst doc = new PrismicMigrationDocument(\n\t\t\tthis.#migratePrismicDocumentData({\n\t\t\t\ttype: document.type,\n\t\t\t\tlang: document.lang,\n\t\t\t\tuid: document.uid,\n\t\t\t\ttags: document.tags,\n\t\t\t\tdata: document.data,\n\t\t\t}) as PendingPrismicDocument<ExtractDocumentType<TDocuments, TType>>,\n\t\t\ttitle,\n\t\t\t{ originalPrismicDocument: document },\n\t\t)\n\n\t\tthis._documents.push(doc)\n\n\t\treturn doc\n\t}\n\n\t/**\n\t * Queries a document from the migration instance with a specific UID and\n\t * custom type.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const contentRelationship = migration.createContentRelationship(() =>\n\t * \tmigration.getByUID(\"blog_post\", \"my-first-post\"),\n\t * )\n\t * ```\n\t *\n\t * @typeParam TType - Type of the Prismic document returned.\n\t *\n\t * @param type - The API ID of the document's custom type.\n\t * @param uid - The UID of the document.\n\t *\n\t * @returns The migration document instance with a UID matching the `uid`\n\t * parameter, if a matching document is found.\n\t */\n\tgetByUID<TType extends TDocuments[\"type\"]>(\n\t\ttype: TType,\n\t\tuid: string,\n\t):\n\t\t| PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>\n\t\t| undefined {\n\t\treturn this._documents.find(\n\t\t\t(\n\t\t\t\tdoc,\n\t\t\t): doc is PrismicMigrationDocument<\n\t\t\t\tExtractDocumentType<TDocuments, TType>\n\t\t\t> => doc.document.type === type && doc.document.uid === uid,\n\t\t)\n\t}\n\n\t/**\n\t * Queries a singleton document from the migration instance for a specific\n\t * custom type.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const contentRelationship = migration.createContentRelationship(() =>\n\t * \tmigration.getSingle(\"settings\"),\n\t * )\n\t * ```\n\t *\n\t * @typeParam TType - Type of the Prismic document returned.\n\t *\n\t * @param type - The API ID of the singleton custom type.\n\t *\n\t * @returns The migration document instance for the custom type, if a matching\n\t * document is found.\n\t */\n\tgetSingle<TType extends TDocuments[\"type\"]>(\n\t\ttype: TType,\n\t):\n\t\t| PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>\n\t\t| undefined {\n\t\treturn this._documents.find(\n\t\t\t(\n\t\t\t\tdoc,\n\t\t\t): doc is PrismicMigrationDocument<\n\t\t\t\tExtractDocumentType<TDocuments, TType>\n\t\t\t> => doc.document.type === type,\n\t\t)\n\t}\n\n\t/**\n\t * Migrates a Prismic document data from another repository so that it can be\n\t * created through the current repository's Migration API.\n\t *\n\t * @param input - The Prismic document data to migrate.\n\t *\n\t * @returns The migrated Prismic document data.\n\t */\n\t#migratePrismicDocumentData(input: unknown): unknown {\n\t\tif (is.filledContentRelationship(input)) {\n\t\t\tconst optionalLinkProperties = getOptionalLinkProperties(input)\n\n\t\t\tif (input.isBroken) {\n\t\t\t\treturn {\n\t\t\t\t\t...optionalLinkProperties,\n\t\t\t\t\tlink_type: LinkType.Document,\n\t\t\t\t\t// ID needs to be 16 characters long to be considered valid by the API\n\t\t\t\t\tid: \"_____broken_____\",\n\t\t\t\t\tisBroken: true,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...optionalLinkProperties,\n\t\t\t\tlink_type: LinkType.Document,\n\t\t\t\tid: () => this._getByOriginalID(input.id),\n\t\t\t}\n\t\t}\n\n\t\tif (is.filledLinkToMedia(input)) {\n\t\t\tconst optionalLinkProperties = getOptionalLinkProperties(input)\n\n\t\t\treturn {\n\t\t\t\t...optionalLinkProperties,\n\t\t\t\tlink_type: LinkType.Media,\n\t\t\t\tid: this.createAsset(input),\n\t\t\t}\n\t\t}\n\n\t\tif (is.rtImageNode(input)) {\n\t\t\t// Rich text image nodes\n\t\t\tconst rtImageNode: MigrationRTImageNode = {\n\t\t\t\ttype: RichTextNodeType.image,\n\t\t\t\tid: this.createAsset(input),\n\t\t\t}\n\n\t\t\tif (input.linkTo) {\n\t\t\t\trtImageNode.linkTo = this.#migratePrismicDocumentData(input.linkTo) as\n\t\t\t\t\t| MigrationContentRelationship\n\t\t\t\t\t| MigrationLinkToMedia\n\t\t\t\t\t| FilledLinkToWebField\n\t\t\t}\n\n\t\t\treturn rtImageNode\n\t\t}\n\n\t\tif (is.filledImage(input)) {\n\t\t\tconst image: MigrationImage = {\n\t\t\t\tid: this.createAsset(input),\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tid: _id,\n\t\t\t\turl: _url,\n\t\t\t\tdimensions: _dimensions,\n\t\t\t\tedit: _edit,\n\t\t\t\talt: _alt,\n\t\t\t\tcopyright: _copyright,\n\t\t\t\t...thumbnails\n\t\t\t} = input\n\n\t\t\tfor (const name in thumbnails) {\n\t\t\t\tif (is.filledImage(thumbnails[name])) {\n\t\t\t\t\timage[name] = this.createAsset(thumbnails[name])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn image\n\t\t}\n\n\t\tif (Array.isArray(input)) {\n\t\t\treturn input.map((element) => this.#migratePrismicDocumentData(element))\n\t\t}\n\n\t\tif (input && typeof input === \"object\") {\n\t\t\tconst res: Record<PropertyKey, unknown> = {}\n\n\t\t\tfor (const key in input) {\n\t\t\t\tres[key] = this.#migratePrismicDocumentData(\n\t\t\t\t\tinput[key as keyof typeof input],\n\t\t\t\t)\n\t\t\t}\n\n\t\t\treturn res\n\t\t}\n\n\t\treturn input\n\t}\n\n\t/**\n\t * Queries a document from the migration instance for a specific original ID.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const contentRelationship = migration.createContentRelationship(() =>\n\t * \tmigration._getByOriginalID(\"YhdrDxIAACgAcp_b\"),\n\t * )\n\t * ```\n\t *\n\t * @typeParam TType - Type of the Prismic document returned.\n\t *\n\t * @param id - The original ID of the Prismic document.\n\t *\n\t * @returns The migration document instance for the original ID, if a matching\n\t * document is found.\n\t *\n\t * @internal\n\t */\n\t_getByOriginalID<TType extends TDocuments[\"type\"]>(\n\t\tid: string,\n\t):\n\t\t| PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>\n\t\t| undefined {\n\t\treturn this._documents.find(\n\t\t\t(\n\t\t\t\tdoc,\n\t\t\t): doc is PrismicMigrationDocument<\n\t\t\t\tExtractDocumentType<TDocuments, TType>\n\t\t\t> => doc.originalPrismicDocument?.id === id,\n\t\t)\n\t}\n}\n"],"names":["filename","credits","alt","validateAssetMetadata","PrismicMigrationAsset","PrismicMigrationDocument","is.filledContentRelationship","getOptionalLinkProperties","LinkType","is.filledLinkToMedia","is.rtImageNode","RichTextNodeType","is.filledImage"],"mappings":";;;;;;;;;;;;;;;;;;;MA8Ca,UAAS;AAAA;;AAMrB;AAAA;AAAA;AAAA;AAAA;AAAA,uDAAwE,IAAG;AAO3E;AAAA;AAAA;AAAA;AAAA;AAAA,sCAAqD;;;;;;;;;;;;;EA0ErD,YACC,oBAKA,UACA,EACC,OACA,SACA,KACA,KAMG,IAAA,IAAE;;AAEF,QAAA;AACA,QAAA;AACJ,QAAI,OAAO,uBAAuB,YAAY,SAAS,oBAAoB;AAEzE,UAAA,gBAAgB,sBAChB,eAAe,oBACd;AACD,cAAM,MAAM,mBAAmB,IAAI,MAAM,GAAG,EAAE,CAAC;AAC/C,cAAMA,YACL,UAAU,qBACP,mBAAmB,OACnB,IAAI,MAAM,GAAG,EAAE,IAAM,EAAC,MAAM,GAAG,EAAE;AACrC,cAAMC,WACL,eAAe,sBAAsB,mBAAmB,YACrD,mBAAmB,YACnB;AACJ,cAAMC,OACL,SAAS,sBAAsB,mBAAmB,MAC/C,mBAAmB,MACnB;AAEJ,YAAI,gBAAgB,oBAAoB;AACnB,8BAAA;AAAA,QAAA;AAGZ,iBAAA;AAAA,UACR,IAAI,mBAAmB;AAAA,UACvB,MAAM;AAAA,UACN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