UNPKG

@prismicio/client

Version:

The official JavaScript + TypeScript client library for Prismic

1 lines 1.66 kB
{"version":3,"file":"createClient.cjs","names":["createClient: CreateClient","Client"],"sources":["../src/createClient.ts"],"sourcesContent":["import type { PrismicDocument } from \"./types/value/document\"\n\nimport type { ClientConfig } from \"./Client\"\nimport { Client } from \"./Client\"\n\n/**\n * Type definitions for the `createClient()` function. May be augmented by\n * third-party libraries.\n */\nexport interface CreateClient {\n\t<TDocuments extends PrismicDocument>(\n\t\t...args: ConstructorParameters<typeof Client>\n\t): Client<TDocuments>\n}\n\n/**\n * Creates a Prismic client that can be used to query content from a repository.\n *\n * @example\n *\n * ```ts\n * // With a repository name\n * createClient(\"my-repo\")\n *\n * // With a full Prismic Content API endpoint\n * createClient(\"https://my-repo.cdn.prismic.io/api/v2\")\n * ```\n *\n * @typeParam TDocuments - A union of Prismic page and custom types for the\n * repository.\n *\n * @param repositoryNameOrEndpoint - The Prismic repository name or full Content\n * API endpoint for the repository.\n * @param options - Configuration that determines how content will be queried\n * from the Prismic repository.\n *\n * @returns A client that can query content from the repository.\n *\n * @see https://prismic.io/docs/technical-reference/prismicio-client/v7\n */\nexport const createClient: CreateClient = <TDocuments extends PrismicDocument>(\n\trepositoryNameOrEndpoint: string,\n\toptions?: ClientConfig,\n) => new Client<TDocuments>(repositoryNameOrEndpoint, options)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAaA,gBACZ,0BACA,YACI,IAAIC,sBAAmB,0BAA0B,QAAQ"}