@prismicio/client
Version:
The official JavaScript + TypeScript client library for Prismic
1 lines • 1.6 kB
Source Map (JSON)
{"version":3,"file":"createWriteClient.cjs","sources":["../../src/createWriteClient.ts"],"sourcesContent":["import type { PrismicDocument } from \"./types/value/document\"\n\nimport type { WriteClientConfig } from \"./WriteClient\"\nimport { WriteClient } from \"./WriteClient\"\n\n/**\n * Type definitions for the `createWriteClient()` function. May be augmented by\n * third-party libraries.\n */\nexport interface CreateWriteClient {\n\t<TDocuments extends PrismicDocument>(\n\t\t...args: ConstructorParameters<typeof WriteClient>\n\t): WriteClient<TDocuments>\n}\n\n/**\n * Creates a Prismic client that can be used to query and write content to a\n * repository.\n *\n * @remarks\n * This client works in environments supporting File, Blob, and FormData,\n * including Node.js 20 and later.\n *\n * @example\n *\n * ```ts\n * createWriteClient(\"qwerty\", { writeToken: \"***\" })\n * ```\n *\n * @typeParam TDocuments - A union of Prismic document types for the repository.\n *\n * @param repositoryName - The Prismic repository name for the repository.\n * @param options - Configuration that determines how content will be queried\n * from and written to the Prismic repository.\n *\n * @returns A client that can query and write content to the repository.\n */\nexport const createWriteClient: CreateWriteClient = <\n\tTDocuments extends PrismicDocument,\n>(\n\trepositoryName: string,\n\toptions: WriteClientConfig,\n) => new WriteClient<TDocuments>(repositoryName, options)\n"],"names":["WriteClient"],"mappings":";;;AAqCO,MAAM,oBAAuC,CAGnD,gBACA,YACI,IAAIA,YAAA,YAAwB,gBAAgB,OAAO;;"}