@prismicio/client
Version:
The official JavaScript + TypeScript client library for Prismic
1 lines • 34.8 kB
Source Map (JSON)
{"version":3,"file":"WriteClient.cjs","names":["name","version","Client","devMsg","resolvedFile: PostAssetParams[\"file\"] | File","url: URL | undefined","documentsToCreate: PrismicMigrationDocument<TDocuments>[]","masterLanguageDocumentID: string | undefined","resolveMigrationContentRelationship","resolveMigrationDocumentData","#request","#handleAssetAPIError","PrismicError","pLimit","existingTagMap: Record<string, AssetTag>","#handleMigrationAPIError","request","ForbiddenError","NotFoundError","InvalidDataError"],"sources":["../src/WriteClient.ts"],"sourcesContent":["import { devMsg } from \"./lib/devMsg\"\nimport { pLimit } from \"./lib/pLimit\"\nimport type { ResponseLike } from \"./lib/request\"\nimport { type RequestInitLike, request } from \"./lib/request\"\nimport {\n\tresolveMigrationContentRelationship,\n\tresolveMigrationDocumentData,\n} from \"./lib/resolveMigrationDocumentData\"\n\nimport type {\n\tAsset,\n\tPatchAssetParams,\n\tPostAssetParams,\n\tPostAssetResult,\n} from \"./types/api/asset/asset\"\nimport type {\n\tAssetTag,\n\tGetAssetTagsResult,\n\tPostAssetTagResult,\n} from \"./types/api/asset/tag\"\nimport { type PostDocumentResult } from \"./types/api/migration/document\"\nimport type { PrismicMigrationAsset } from \"./types/migration/Asset\"\nimport type {\n\tMigrationDocument,\n\tPendingPrismicDocument,\n\tPrismicMigrationDocument,\n} from \"./types/migration/Document\"\nimport type { PrismicDocument } from \"./types/value/document\"\n\nimport {\n\tForbiddenError,\n\tInvalidDataError,\n\tNotFoundError,\n\tPrismicError,\n} from \"./errors\"\n\nimport { name, version } from \"../package.json\"\n\nimport { Client } from \"./Client\"\nimport type { ClientConfig, FetchParams } from \"./Client\"\nimport type { Migration } from \"./Migration\"\n// oxlint-disable-next-line no-unused-vars\nimport type { createMigration } from \"./createMigration\"\n\nconst CLIENT_IDENTIFIER = `${name.replace(\"@\", \"\").replace(\"/\", \"-\")}/${version}`\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 * Utility type to construct events reported by the migration process.\n */\ntype MigrateReporterEvent<\n\tTType extends string,\n\tTData = never,\n> = TData extends never\n\t? { type: TType }\n\t: {\n\t\t\ttype: TType\n\t\t\tdata: TData\n\t\t}\n\n/**\n * A map of event types and their data reported by the migration process.\n */\ntype MigrateReporterEventMap = {\n\tstart: {\n\t\tpending: {\n\t\t\tdocuments: number\n\t\t\tassets: number\n\t\t}\n\t}\n\tend: {\n\t\tmigrated: {\n\t\t\tdocuments: number\n\t\t\tassets: number\n\t\t}\n\t}\n\t\"assets:creating\": {\n\t\tcurrent: number\n\t\tremaining: number\n\t\ttotal: number\n\t\tasset: PrismicMigrationAsset\n\t}\n\t\"assets:created\": {\n\t\tcreated: number\n\t}\n\t\"documents:masterLocale\": {\n\t\tmasterLocale: string\n\t}\n\t\"documents:creating\": {\n\t\tcurrent: number\n\t\tremaining: number\n\t\ttotal: number\n\t\tdocument: PrismicMigrationDocument\n\t}\n\t\"documents:created\": {\n\t\tcreated: number\n\t}\n\t\"documents:updating\": {\n\t\tcurrent: number\n\t\tremaining: number\n\t\ttotal: number\n\t\tdocument: PrismicMigrationDocument\n\t}\n\t\"documents:updated\": {\n\t\tupdated: number\n\t}\n}\n\n/**\n * Available event types reported by the migration process.\n */\ntype MigrateReporterEventTypes = keyof MigrateReporterEventMap\n\n/**\n * All events reported by the migration process. Events can be listened to by\n * providing a `reporter` function to the `migrate` method.\n */\nexport type MigrateReporterEvents = {\n\t[K in MigrateReporterEventTypes]: MigrateReporterEvent<\n\t\tK,\n\t\tMigrateReporterEventMap[K]\n\t>\n}[MigrateReporterEventTypes]\n\n/**\n * Additional parameters for creating an asset in the Prismic media library.\n */\nexport type CreateAssetParams = {\n\t/**\n\t * Asset notes.\n\t */\n\tnotes?: string\n\n\t/**\n\t * Asset credits.\n\t */\n\tcredits?: string\n\n\t/**\n\t * Asset alt text.\n\t */\n\talt?: string\n\n\t/**\n\t * Asset tags.\n\t */\n\ttags?: string[]\n}\n\n/**\n * Configuration for clients that determine how content is queried.\n */\nexport type WriteClientConfig = {\n\t/**\n\t * A Prismic write token that allows writing content to the repository.\n\t */\n\twriteToken: string\n\n\t/**\n\t * The Prismic Asset API endpoint.\n\t *\n\t * @defaultValue `\"https://asset-api.prismic.io/\"`\n\t *\n\t * @see Prismic Asset API technical reference: {@link https://prismic.io/docs/asset-api-technical-reference}\n\t */\n\tassetAPIEndpoint?: string\n\n\t/**\n\t * The Prismic Migration API endpoint.\n\t *\n\t * @defaultValue `\"https://migration.prismic.io/\"`\n\t *\n\t * @see Prismic Migration API technical reference: {@link https://prismic.io/docs/migration-api-technical-reference}\n\t */\n\tmigrationAPIEndpoint?: string\n} & ClientConfig\n\n/**\n * A client that allows querying and writing content to a Prismic repository.\n *\n * If used in an environment where a global `fetch` function is unavailable,\n * such as Node.js, the `fetch` option must be provided as part of the `options`\n * parameter.\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 WriteClient<\n\tTDocuments extends PrismicDocument = PrismicDocument,\n> extends Client<TDocuments> {\n\twriteToken: string\n\n\tassetAPIEndpoint = \"https://asset-api.prismic.io/\"\n\tmigrationAPIEndpoint = \"https://migration.prismic.io/\"\n\n\t/**\n\t * Creates a Prismic client that can be used to query and write content to a\n\t * repository.\n\t *\n\t * If used in an environment where a global `fetch` function is unavailable,\n\t * such as in some Node.js versions, the `fetch` option must be provided as\n\t * part of the `options` parameter.\n\t *\n\t * @param repositoryName - The Prismic repository name for the repository.\n\t * @param options - Configuration that determines how content will be queried\n\t * from and written to the Prismic repository.\n\t *\n\t * @returns A client that can query and write content to the repository.\n\t */\n\tconstructor(repositoryName: string, options: WriteClientConfig) {\n\t\tsuper(repositoryName, options)\n\n\t\tif (typeof globalThis.window !== \"undefined\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[@prismicio/client] Prismic write client appears to be running in a browser environment. This is not recommended as it exposes your write token. Consider using Prismic write client in a server environment only, preferring the regular client for browser environment. For more details, see ${devMsg(\"avoid-write-client-in-browser\")}`,\n\t\t\t)\n\t\t}\n\n\t\tthis.writeToken = options.writeToken\n\n\t\tif (options.assetAPIEndpoint) {\n\t\t\tthis.assetAPIEndpoint = `${options.assetAPIEndpoint}/`\n\t\t}\n\n\t\tif (options.migrationAPIEndpoint) {\n\t\t\tthis.migrationAPIEndpoint = `${options.migrationAPIEndpoint}/`\n\t\t}\n\t}\n\n\t/**\n\t * Creates a migration release on the Prismic repository based on the provided\n\t * prepared migration.\n\t *\n\t * @param migration - A migration prepared with {@link createMigration}.\n\t * @param params - An event listener and additional fetch parameters.\n\t *\n\t * @see Prismic Migration API technical reference: {@link https://prismic.io/docs/migration-api-technical-reference}\n\t */\n\tasync migrate(\n\t\tmigration: Migration<TDocuments>,\n\t\tparams: {\n\t\t\treporter?: (event: MigrateReporterEvents) => void\n\t\t} & FetchParams = {},\n\t): Promise<void> {\n\t\tparams.reporter?.({\n\t\t\ttype: \"start\",\n\t\t\tdata: {\n\t\t\t\tpending: {\n\t\t\t\t\tdocuments: migration._documents.length,\n\t\t\t\t\tassets: migration._assets.size,\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\n\t\tawait this.migrateCreateAssets(migration, params)\n\t\tawait this.migrateCreateDocuments(migration, params)\n\t\tawait this.migrateUpdateDocuments(migration, params)\n\n\t\tparams.reporter?.({\n\t\t\ttype: \"end\",\n\t\t\tdata: {\n\t\t\t\tmigrated: {\n\t\t\t\t\tdocuments: migration._documents.length,\n\t\t\t\t\tassets: migration._assets.size,\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n\n\t/**\n\t * Creates assets in the Prismic repository's media library.\n\t *\n\t * @param migration - A migration prepared with {@link createMigration}.\n\t * @param params - An event listener and additional fetch parameters.\n\t *\n\t * @internal This method is one of the step performed by the {@link migrate} method.\n\t */\n\tprivate async migrateCreateAssets(\n\t\tmigration: Migration<TDocuments>,\n\t\t{\n\t\t\treporter,\n\t\t\t...fetchParams\n\t\t}: { reporter?: (event: MigrateReporterEvents) => void } & FetchParams = {},\n\t): Promise<void> {\n\t\tlet created = 0\n\t\tfor (const [_, migrationAsset] of migration._assets) {\n\t\t\treporter?.({\n\t\t\t\ttype: \"assets:creating\",\n\t\t\t\tdata: {\n\t\t\t\t\tcurrent: ++created,\n\t\t\t\t\tremaining: migration._assets.size - created,\n\t\t\t\t\ttotal: migration._assets.size,\n\t\t\t\t\tasset: migrationAsset,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst { file, filename, notes, credits, alt, tags } =\n\t\t\t\tmigrationAsset.config\n\n\t\t\tlet resolvedFile: PostAssetParams[\"file\"] | File\n\t\t\tif (typeof file === \"string\") {\n\t\t\t\tlet url: URL | undefined\n\t\t\t\ttry {\n\t\t\t\t\turl = new URL(file)\n\t\t\t\t} catch {\n\t\t\t\t\t// noop only on invalid URL, fetch errors will throw in the next if statement\n\t\t\t\t}\n\n\t\t\t\tif (url) {\n\t\t\t\t\t// File is a URL, fetch it\n\t\t\t\t\tresolvedFile = await this.fetchForeignAsset(\n\t\t\t\t\t\turl.toString(),\n\t\t\t\t\t\tfetchParams,\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\t// File is actual file content, use it as-is\n\t\t\t\t\tresolvedFile = file\n\t\t\t\t}\n\t\t\t} else if (file instanceof URL) {\n\t\t\t\t// File is a URL instance, fetch it\n\t\t\t\tresolvedFile = await this.fetchForeignAsset(\n\t\t\t\t\tfile.toString(),\n\t\t\t\t\tfetchParams,\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tresolvedFile = file\n\t\t\t}\n\n\t\t\tconst asset = await this.createAsset(resolvedFile, 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\t...fetchParams,\n\t\t\t})\n\n\t\t\tmigrationAsset.asset = asset\n\t\t}\n\n\t\treporter?.({\n\t\t\ttype: \"assets:created\",\n\t\t\tdata: {\n\t\t\t\tcreated,\n\t\t\t},\n\t\t})\n\t}\n\n\t/**\n\t * Creates documents in the Prismic repository's migration release.\n\t *\n\t * @param migration - A migration prepared with {@link createMigration}.\n\t * @param params - An event listener and additional fetch parameters.\n\t *\n\t * @internal This method is one of the step performed by the {@link migrate} method.\n\t */\n\tprivate async migrateCreateDocuments(\n\t\tmigration: Migration<TDocuments>,\n\t\t{\n\t\t\treporter,\n\t\t\t...fetchParams\n\t\t}: { reporter?: (event: MigrateReporterEvents) => void } & FetchParams = {},\n\t): Promise<void> {\n\t\t// Resolve master locale\n\t\tconst repository = await this.getRepository(fetchParams)\n\t\tconst masterLocale = repository.languages[0].id\n\t\treporter?.({\n\t\t\ttype: \"documents:masterLocale\",\n\t\t\tdata: {\n\t\t\t\tmasterLocale,\n\t\t\t},\n\t\t})\n\n\t\tconst documentsToCreate: PrismicMigrationDocument<TDocuments>[] = []\n\t\t// We create an array with non-master locale documents last because\n\t\t// we need their master locale document to be created first.\n\t\tfor (const doc of migration._documents) {\n\t\t\tif (!doc.document.id) {\n\t\t\t\tif (doc.document.lang === masterLocale) {\n\t\t\t\t\tdocumentsToCreate.unshift(doc)\n\t\t\t\t} else {\n\t\t\t\t\tdocumentsToCreate.push(doc)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet created = 0\n\t\tfor (const doc of documentsToCreate) {\n\t\t\treporter?.({\n\t\t\t\ttype: \"documents:creating\",\n\t\t\t\tdata: {\n\t\t\t\t\tcurrent: ++created,\n\t\t\t\t\tremaining: documentsToCreate.length - created,\n\t\t\t\t\ttotal: documentsToCreate.length,\n\t\t\t\t\tdocument: doc,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\t// Resolve master language document ID for non-master locale documents\n\t\t\tlet masterLanguageDocumentID: string | undefined\n\t\t\tif (doc.masterLanguageDocument) {\n\t\t\t\tconst masterLanguageDocument =\n\t\t\t\t\tawait resolveMigrationContentRelationship(doc.masterLanguageDocument)\n\n\t\t\t\tmasterLanguageDocumentID =\n\t\t\t\t\t\"id\" in masterLanguageDocument ? masterLanguageDocument.id : undefined\n\t\t\t} else if (doc.originalPrismicDocument) {\n\t\t\t\tconst maybeOriginalID =\n\t\t\t\t\tdoc.originalPrismicDocument.alternate_languages.find(\n\t\t\t\t\t\t({ lang }) => lang === masterLocale,\n\t\t\t\t\t)?.id\n\n\t\t\t\tif (maybeOriginalID) {\n\t\t\t\t\tmasterLanguageDocumentID =\n\t\t\t\t\t\tmigration._getByOriginalID(maybeOriginalID)?.document.id\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst { id } = await this.createDocument(\n\t\t\t\t// We'll upload documents data later on.\n\t\t\t\t{ ...doc.document, data: {} },\n\t\t\t\tdoc.title!,\n\t\t\t\t{\n\t\t\t\t\tmasterLanguageDocumentID,\n\t\t\t\t\t...fetchParams,\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tdoc.document.id = id\n\t\t}\n\n\t\treporter?.({\n\t\t\ttype: \"documents:created\",\n\t\t\tdata: { created },\n\t\t})\n\t}\n\n\t/**\n\t * Updates documents in the Prismic repository's migration release with their\n\t * patched data.\n\t *\n\t * @param migration - A migration prepared with {@link createMigration}.\n\t * @param params - An event listener and additional fetch parameters.\n\t *\n\t * @internal This method is one of the step performed by the {@link migrate} method.\n\t */\n\tprivate async migrateUpdateDocuments(\n\t\tmigration: Migration<TDocuments>,\n\t\t{\n\t\t\treporter,\n\t\t\t...fetchParams\n\t\t}: { reporter?: (event: MigrateReporterEvents) => void } & FetchParams = {},\n\t): Promise<void> {\n\t\tlet i = 0\n\t\tfor (const doc of migration._documents) {\n\t\t\treporter?.({\n\t\t\t\ttype: \"documents:updating\",\n\t\t\t\tdata: {\n\t\t\t\t\tcurrent: ++i,\n\t\t\t\t\tremaining: migration._documents.length - i,\n\t\t\t\t\ttotal: migration._documents.length,\n\t\t\t\t\tdocument: doc,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tawait this.updateDocument(\n\t\t\t\tdoc.document.id!,\n\t\t\t\t// We need to forward again document name and tags to update them\n\t\t\t\t// in case the document already existed during the previous step.\n\t\t\t\t{\n\t\t\t\t\t...doc.document,\n\t\t\t\t\tdocumentTitle: doc.title,\n\t\t\t\t\tdata: await resolveMigrationDocumentData(\n\t\t\t\t\t\tdoc.document.data,\n\t\t\t\t\t\tmigration,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\tfetchParams,\n\t\t\t)\n\t\t}\n\n\t\treporter?.({\n\t\t\ttype: \"documents:updated\",\n\t\t\tdata: {\n\t\t\t\tupdated: migration._documents.length,\n\t\t\t},\n\t\t})\n\t}\n\n\t/**\n\t * Creates an asset in the Prismic media library.\n\t *\n\t * @param file - The file to upload as an asset.\n\t * @param filename - The filename of the asset.\n\t * @param params - Additional asset data and fetch parameters.\n\t *\n\t * @returns The created asset.\n\t */\n\tprivate async createAsset(\n\t\tfile: PostAssetParams[\"file\"] | File,\n\t\tfilename: string,\n\t\t{\n\t\t\tnotes,\n\t\t\tcredits,\n\t\t\talt,\n\t\t\ttags,\n\t\t\t...params\n\t\t}: CreateAssetParams & FetchParams = {},\n\t): Promise<Asset> {\n\t\tconst url = new URL(\"assets\", this.assetAPIEndpoint)\n\n\t\tconst formData = new FormData()\n\t\tformData.append(\n\t\t\t\"file\",\n\t\t\tnew File([file], filename, {\n\t\t\t\ttype: file instanceof File ? file.type : undefined,\n\t\t\t}),\n\t\t)\n\n\t\tif (notes) {\n\t\t\tformData.append(\"notes\", notes)\n\t\t}\n\n\t\tif (credits) {\n\t\t\tformData.append(\"credits\", credits)\n\t\t}\n\n\t\tif (alt) {\n\t\t\tformData.append(\"alt\", alt)\n\t\t}\n\n\t\tconst response = await this.#request(url, params, {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: formData,\n\t\t})\n\t\tswitch (response.status) {\n\t\t\tcase 200: {\n\t\t\t\tconst asset = (await response.json()) as PostAssetResult\n\n\t\t\t\tif (tags && tags.length) {\n\t\t\t\t\treturn this.updateAsset(asset.id, { tags })\n\t\t\t\t}\n\n\t\t\t\treturn asset\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\treturn await this.#handleAssetAPIError(response)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Updates an asset in the Prismic media library.\n\t *\n\t * @param id - The ID of the asset to update.\n\t * @param params - The asset data to update and additional fetch parameters.\n\t *\n\t * @returns The updated asset.\n\t */\n\tprivate async updateAsset(\n\t\tid: string,\n\t\t{\n\t\t\tnotes,\n\t\t\tcredits,\n\t\t\talt,\n\t\t\tfilename,\n\t\t\ttags,\n\t\t\t...params\n\t\t}: PatchAssetParams & FetchParams = {},\n\t): Promise<Asset> {\n\t\tconst url = new URL(`assets/${id}`, this.assetAPIEndpoint)\n\n\t\t// Resolve tags if any and create missing ones\n\t\tif (tags && tags.length) {\n\t\t\ttags = await this.resolveAssetTagIDs(tags, {\n\t\t\t\tcreateTags: true,\n\t\t\t\t...params,\n\t\t\t})\n\t\t}\n\n\t\tconst response = await this.#request(url, params, {\n\t\t\tmethod: \"PATCH\",\n\t\t\tbody: JSON.stringify({\n\t\t\t\tnotes,\n\t\t\t\tcredits,\n\t\t\t\talt,\n\t\t\t\tfilename,\n\t\t\t\ttags,\n\t\t\t}),\n\t\t\theaders: {\n\t\t\t\t\"content-type\": \"application/json\",\n\t\t\t},\n\t\t})\n\t\tswitch (response.status) {\n\t\t\tcase 200: {\n\t\t\t\treturn (await response.json()) as Asset\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\treturn await this.#handleAssetAPIError(response)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Fetches a foreign asset from a URL.\n\t *\n\t * @param url - The URL of the asset to fetch.\n\t * @param params - Additional fetch parameters.\n\t *\n\t * @returns A file representing the fetched asset.\n\t */\n\tprivate async fetchForeignAsset(\n\t\turl: string,\n\t\tparams: FetchParams = {},\n\t): Promise<Blob> {\n\t\tconst res = await this.#request(new URL(url), params)\n\n\t\tif (!res.ok) {\n\t\t\tthrow new PrismicError(\"Could not fetch foreign asset\", url, undefined)\n\t\t}\n\n\t\tconst blob = await res.blob()\n\n\t\t// Ensure a correct content type is attached to the blob.\n\t\treturn new File([blob], \"\", {\n\t\t\ttype: res.headers.get(\"content-type\") || undefined,\n\t\t})\n\t}\n\n\t/**\n\t * {@link resolveAssetTagIDs} rate limiter.\n\t */\n\tprivate _resolveAssetTagIDsLimit = pLimit()\n\n\t/**\n\t * Resolves asset tag IDs from tag names.\n\t *\n\t * @param tagNames - An array of tag names to resolve.\n\t * @param params - Whether or not missing tags should be created and\n\t * additional fetch parameters.\n\t *\n\t * @returns An array of resolved tag IDs.\n\t */\n\tprivate async resolveAssetTagIDs(\n\t\ttagNames: string[] = [],\n\t\t{ createTags, ...params }: { createTags?: boolean } & FetchParams = {},\n\t): Promise<string[]> {\n\t\treturn this._resolveAssetTagIDsLimit(async () => {\n\t\t\tconst existingTags = await this.getAssetTags(params)\n\t\t\tconst existingTagMap: Record<string, AssetTag> = {}\n\t\t\tfor (const tag of existingTags) {\n\t\t\t\texistingTagMap[tag.name] = tag\n\t\t\t}\n\n\t\t\tconst resolvedTagIDs = []\n\t\t\tfor (const tagName of tagNames) {\n\t\t\t\t// Tag does not exists yet, we create it if `createTags` is set\n\t\t\t\tif (!existingTagMap[tagName] && createTags) {\n\t\t\t\t\texistingTagMap[tagName] = await this.createAssetTag(tagName, params)\n\t\t\t\t}\n\n\t\t\t\t// Add tag if found\n\t\t\t\tif (existingTagMap[tagName]) {\n\t\t\t\t\tresolvedTagIDs.push(existingTagMap[tagName].id)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn resolvedTagIDs\n\t\t})\n\t}\n\n\t/**\n\t * Creates a tag in the Asset API.\n\t *\n\t * @remarks\n\t * Tags should be at least 3 characters long and 20 characters at most.\n\t *\n\t * @param name - The name of the tag to create.\n\t * @param params - Additional fetch parameters.\n\t *\n\t * @returns The created tag.\n\t */\n\tprivate async createAssetTag(\n\t\tname: string,\n\t\tparams?: FetchParams,\n\t): Promise<AssetTag> {\n\t\tconst url = new URL(\"tags\", this.assetAPIEndpoint)\n\n\t\tconst response = await this.#request(url, params, {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: JSON.stringify({ name }),\n\t\t\theaders: {\n\t\t\t\t\"content-type\": \"application/json\",\n\t\t\t},\n\t\t})\n\t\tswitch (response.status) {\n\t\t\tcase 201: {\n\t\t\t\treturn (await response.json()) as PostAssetTagResult\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\treturn await this.#handleAssetAPIError(response)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Queries existing tags from the Asset API.\n\t *\n\t * @param params - Additional fetch parameters.\n\t *\n\t * @returns An array of existing tags.\n\t */\n\tprivate async getAssetTags(params?: FetchParams): Promise<AssetTag[]> {\n\t\tconst url = new URL(\"tags\", this.assetAPIEndpoint)\n\n\t\tconst response = await this.#request(url, params)\n\t\tswitch (response.status) {\n\t\t\tcase 200: {\n\t\t\t\tconst json = (await response.json()) as GetAssetTagsResult\n\n\t\t\t\treturn json.items\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\treturn await this.#handleAssetAPIError(response)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Creates a document in the repository's migration release.\n\t *\n\t * @typeParam TType - Type of Prismic documents to create.\n\t *\n\t * @param document - The document to create.\n\t * @param documentTitle - The title of the document to create which will be\n\t * displayed in the editor.\n\t * @param params - Document master language document ID and additional fetch\n\t * parameters.\n\t *\n\t * @returns The ID of the created document.\n\t *\n\t * @see Prismic Migration API technical reference: {@link https://prismic.io/docs/migration-api-technical-reference}\n\t */\n\tprivate async createDocument<TType extends TDocuments[\"type\"]>(\n\t\tdocument: PendingPrismicDocument<ExtractDocumentType<TDocuments, TType>>,\n\t\tdocumentTitle: string,\n\t\t{\n\t\t\tmasterLanguageDocumentID,\n\t\t\t...params\n\t\t}: { masterLanguageDocumentID?: string } & FetchParams = {},\n\t): Promise<{ id: string }> {\n\t\tconst url = new URL(\"documents\", this.migrationAPIEndpoint)\n\n\t\tconst response = await this.#request(url, params, {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: JSON.stringify({\n\t\t\t\ttitle: documentTitle,\n\t\t\t\ttype: document.type,\n\t\t\t\tuid: document.uid || undefined,\n\t\t\t\tlang: document.lang,\n\t\t\t\talternate_language_id: masterLanguageDocumentID,\n\t\t\t\ttags: document.tags,\n\t\t\t\tdata: document.data,\n\t\t\t}),\n\t\t\theaders: {\n\t\t\t\t\"content-type\": \"application/json\",\n\t\t\t\t\"x-client\": CLIENT_IDENTIFIER,\n\t\t\t},\n\t\t})\n\t\tswitch (response.status) {\n\t\t\tcase 201: {\n\t\t\t\tconst json = (await response.json()) as PostDocumentResult\n\n\t\t\t\treturn { id: json.id }\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\treturn await this.#handleMigrationAPIError(response)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Updates an existing document in the repository's migration release.\n\t *\n\t * @typeParam TType - Type of Prismic documents to update.\n\t *\n\t * @param id - The ID of the document to update.\n\t * @param document - The document content to update.\n\t * @param params - Additional fetch parameters.\n\t *\n\t * @see Prismic Migration API technical reference: {@link https://prismic.io/docs/migration-api-technical-reference}\n\t */\n\tprivate async updateDocument<TType extends TDocuments[\"type\"]>(\n\t\tid: string,\n\t\tdocument: MigrationDocument<ExtractDocumentType<TDocuments, TType>> & {\n\t\t\tdocumentTitle?: string\n\t\t},\n\t\tparams?: FetchParams,\n\t): Promise<void> {\n\t\tconst url = new URL(`documents/${id}`, this.migrationAPIEndpoint)\n\n\t\tconst response = await this.#request(url, params, {\n\t\t\tmethod: \"PUT\",\n\t\t\tbody: JSON.stringify({\n\t\t\t\ttitle: document.documentTitle,\n\t\t\t\tuid: document.uid || undefined,\n\t\t\t\ttags: document.tags,\n\t\t\t\tdata: document.data,\n\t\t\t}),\n\t\t\theaders: {\n\t\t\t\t\"content-type\": \"application/json\",\n\t\t\t\t\"x-client\": CLIENT_IDENTIFIER,\n\t\t\t},\n\t\t})\n\t\tswitch (response.status) {\n\t\t\tcase 200: {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tawait this.#handleMigrationAPIError(response)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Makes an authenticated HTTP request for write operations using the client's\n\t * configured fetch function and options.\n\t *\n\t * @param url - The URL to request.\n\t * @param params - Fetch options from the user.\n\t * @param init - Additional fetch options to merge with the user-provided\n\t * options.\n\t *\n\t * @returns The response from the fetch request.\n\t */\n\tasync #request(\n\t\turl: URL,\n\t\tparams?: FetchParams,\n\t\tinit?: RequestInitLike,\n\t): Promise<ResponseLike> {\n\t\treturn await request(\n\t\t\turl,\n\t\t\t{\n\t\t\t\t...this.fetchOptions,\n\t\t\t\t...params?.fetchOptions,\n\t\t\t\t...init,\n\t\t\t\theaders: {\n\t\t\t\t\t...this.fetchOptions?.headers,\n\t\t\t\t\t...params?.fetchOptions?.headers,\n\t\t\t\t\t...init?.headers,\n\t\t\t\t\trepository: this.repositoryName,\n\t\t\t\t\tauthorization: `Bearer ${this.writeToken}`,\n\t\t\t\t},\n\t\t\t\tsignal:\n\t\t\t\t\tparams?.fetchOptions?.signal ||\n\t\t\t\t\tparams?.signal ||\n\t\t\t\t\tthis.fetchOptions?.signal,\n\t\t\t},\n\t\t\tthis.fetchFn,\n\t\t)\n\t}\n\n\t/**\n\t * Handles error responses from the Asset API with comprehensive error\n\t * parsing.\n\t *\n\t * @param response - The HTTP response from the Asset API.\n\t *\n\t * @throws {@link InvalidDataError} For 400 errors.\n\t * @throws {@link ForbiddenError} For 401 and 403 errors.\n\t * @throws {@link NotFoundError} For 404 errors.\n\t * @throws {@link PrismicError} For 500, 503, and other unexpected errors.\n\t */\n\tasync #handleAssetAPIError(response: ResponseLike): Promise<never> {\n\t\tconst json = await response.json()\n\t\tswitch (response.status) {\n\t\t\tcase 401:\n\t\t\tcase 403:\n\t\t\t\tthrow new ForbiddenError(json.error, response.url, json)\n\n\t\t\tcase 404:\n\t\t\t\tthrow new NotFoundError(json.error, response.url, json)\n\n\t\t\tcase 400:\n\t\t\t\tthrow new InvalidDataError(json.error, response.url, json)\n\n\t\t\tcase 500:\n\t\t\tcase 503:\n\t\t\tdefault:\n\t\t\t\tthrow new PrismicError(json.error, response.url, json)\n\t\t}\n\t}\n\n\t/**\n\t * Handles error responses from the Migration API with comprehensive error\n\t * parsing.\n\t *\n\t * @param response - The HTTP response from the Migration API.\n\t *\n\t * @throws {@link InvalidDataError} For 400 errors.\n\t * @throws {@link ForbiddenError} For 401 and 403 errors.\n\t * @throws {@link NotFoundError} For 404 errors.\n\t * @throws {@link PrismicError} For 500, and other unexpected errors.\n\t */\n\tasync #handleMigrationAPIError(response: ResponseLike): Promise<never> {\n\t\tconst payload = (await response.json()) as unknown\n\n\t\t// Common message across all branches\n\t\tconst message = (payload as { message?: string }).message\n\n\t\tswitch (response.status) {\n\t\t\tcase 400: {\n\t\t\t\tthrow new InvalidDataError(message, response.url, payload)\n\t\t\t}\n\n\t\t\tcase 401: {\n\t\t\t\tthrow new ForbiddenError(message, response.url, payload)\n\t\t\t}\n\n\t\t\tcase 403: {\n\t\t\t\t// The lambda authorizer uses an uppercase key, remove this once it is fixed\n\t\t\t\tconst msg = message ?? (payload as { Message?: string }).Message\n\t\t\t\tthrow new ForbiddenError(msg, response.url, payload)\n\t\t\t}\n\n\t\t\tcase 404: {\n\t\t\t\tthrow new NotFoundError(message, response.url, payload)\n\t\t\t}\n\n\t\t\tcase 500:\n\t\t\tdefault: {\n\t\t\t\tthrow new PrismicError(message, response.url, payload)\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