@andesine/sdk 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/{index-moj3WP71.d.ts → client-C8wt7f3o.d.ts} +59 -445
- package/dist/client-DioqVOxl.js +1424 -0
- package/dist/client-DioqVOxl.js.map +1 -0
- package/dist/extensions.d.ts +87 -0
- package/dist/extensions.js +220 -0
- package/dist/extensions.js.map +1 -0
- package/dist/index-B5qefVRv.d.ts +473 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -1325
- package/dist/index.js.map +1 -1
- package/dist/{schema-BcVop8NH.d.ts → schema-CrquN_J6.d.ts} +2830 -2
- package/dist/streaming.d.ts +1 -1
- package/dist/webhooks.d.ts +1 -1
- package/openapi.json +4316 -0
- package/package.json +5 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-DioqVOxl.js","names":[],"sources":["../src/paginate.ts","../src/content-client.ts","../src/query.ts","../src/operation.ts","../src/generated/resources.ts","../src/retry.ts","../src/client.ts"],"sourcesContent":["interface Page<T> {\n data: T[];\n pagination: { nextCursor: string | null; hasMore: boolean };\n}\ninterface PaginateOptions {\n /** Start after a saved cursor. The callback must retain its original scope and snapshot. */\n cursor?: string;\n}\n\n/**\n * Iterate cursor-paginated pages, retaining their metadata.\n *\n * @param getPage - Fetch one page for the supplied cursor. The first cursor is undefined unless supplied.\n * Keep filters stable. This generic helper does not bind snapshots; use content.paginateEntryPages()\n * or content.paginateCollectionPages() for automatic published snapshot handling.\n * @param options - Optional cursor from an earlier page to resume processing.\n * @returns A lazy iterator that requests the next page only after the previous page is consumed.\n * Save pagination.nextCursor after processing a page. Break the loop to stop further requests.\n * @throws Error for a missing or repeated next cursor. Callback failures pass through unchanged.\n */\nconst paginatePages = async function* <P extends Page<unknown>>(\n getPage: (cursor?: string) => Promise<P>,\n options: PaginateOptions = {}\n): AsyncGenerator<P> {\n const seen = new Set<string>(options.cursor ? [options.cursor] : []);\n\n let cursor = options.cursor;\n\n do {\n const page = await getPage(cursor);\n const next = page.pagination.nextCursor;\n\n if (page.pagination.hasMore && (!next || seen.has(next))) {\n throw new Error(\"Pagination returned a missing or repeated cursor\");\n }\n\n yield page;\n\n if (!page.pagination.hasMore) return;\n\n seen.add(next!);\n cursor = next!;\n } while (cursor);\n};\n\n/**\n * Iterate items across cursor-paginated pages without collecting them in memory.\n *\n * @param getPage - Fetch one page using the cursor. Keep scope and filters stable in this callback.\n * This generic helper does not bind snapshots; content.paginateEntries() and\n * content.paginateCollections() do that automatically for published content.\n * @param options - Optional starting cursor; retain its matching scope and snapshot yourself.\n * @returns Items in API order. Break the loop to prevent further page requests.\n * @throws Pagination errors from paginatePages(), or the original callback error.\n */\nconst paginate = async function* <T>(\n getPage: (cursor?: string) => Promise<Page<T>>,\n options: PaginateOptions = {}\n): AsyncGenerator<T> {\n for await (const page of paginatePages(getPage, options)) {\n yield* page.data;\n }\n};\n\nexport { paginate, paginatePages };\nexport type { Page, PaginateOptions };\n","import type { APIResources } from \"./generated/resources\";\nimport type { ContentListOutput } from \"./content-list\";\nimport type { OperationInput, OperationOutput, RequestOptions } from \"./operation\";\nimport { paginatePages, type Page } from \"./paginate\";\nimport type { WorkspaceTypeMap } from \"./workspace\";\n\ninterface ContentClient<\n Workspace extends WorkspaceTypeMap = WorkspaceTypeMap\n> extends ContentResources<Workspace> {\n /**\n * Iterate published entries, automatically keeping the first page's snapshot.\n *\n * @param input - List scope, filters, and page size. Set includeContent to true for full entries.\n * To resume, supply both cursor and snapshotID, or use a client from atSnapshot().\n * @param options - Options for each request. The timeout applies to each page separately.\n * @returns A lazy iterator in API order. Breaking the loop prevents further requests.\n * @throws API errors without switching to a newer snapshot, including expired snapshots.\n * @example\n * for await (const entry of client.content.paginateEntries({\n * collectionPath: \"/Tutorials\", includeContent: true\n * })) console.log(entry.properties);\n */\n paginateEntries<const Input extends EntryListInput = Record<string, never>>(\n input?: Input,\n options?: ContentPaginationOptions\n ): AsyncGenerator<ContentListOutput<Input, Workspace>[\"data\"][number]>;\n /**\n * Iterate entry pages while retaining snapshot metadata and resume cursors.\n *\n * The first response selects the snapshot; later requests omit channel and reuse that snapshot.\n * Scope and filters are reused for every page. An existing atSnapshot() binding is respected.\n * @param input - List options. Resuming requires cursor and its snapshot, with the same filters.\n * @param options - Per-page request options, including cancellation and timeout.\n * @returns Lazy pages with includeContent-dependent item types and snapshot metadata.\n * @throws API errors or an error for a missing/repeated cursor or changed response snapshot.\n */\n paginateEntryPages<const Input extends EntryListInput = Record<string, never>>(\n input?: Input,\n options?: ContentPaginationOptions\n ): AsyncGenerator<ContentListOutput<Input, Workspace>>;\n /**\n * Iterate published collections using the first page's snapshot for all later pages.\n *\n * @param input - Collection scope and page size. To resume, supply cursor and its snapshot.\n * @param options - Per-page request options. Break the loop to stop requesting pages.\n * @returns A lazy iterator of collection summaries in API order.\n * @throws API and pagination errors; unavailable snapshots are never replaced automatically.\n */\n paginateCollections(\n input?: OperationInput<\"content.listCollections\">,\n options?: ContentPaginationOptions\n ): AsyncGenerator<OperationOutput<\"content.listCollections\">[\"data\"][number]>;\n /**\n * Iterate collection pages with snapshot metadata and resume cursors.\n *\n * @param input - List options. Use the same scope and snapshot when resuming a cursor.\n * @param options - Options applied to each request, including cancellation and timeout.\n * @returns Lazy pages pinned to the first response's snapshot or the atSnapshot() binding.\n * @throws API errors or an error for a missing/repeated cursor or changed response snapshot.\n */\n paginateCollectionPages(\n input?: OperationInput<\"content.listCollections\">,\n options?: ContentPaginationOptions\n ): AsyncGenerator<OperationOutput<\"content.listCollections\">>;\n}\ninterface SnapshotListInput {\n channel?: string;\n snapshotID?: string;\n cursor?: string;\n}\ninterface SnapshotPage extends Page<unknown> {\n snapshotID: string;\n}\n\ntype ContentResources<Workspace extends WorkspaceTypeMap = WorkspaceTypeMap> =\n APIResources<Workspace>[\"content\"];\ntype EntryListInput = OperationInput<\"content.listEntries\">;\ntype ContentPaginationOptions = RequestOptions & { response?: \"data\" };\n\nconst paginateSnapshotPages = async function* <\n Input extends SnapshotListInput,\n P extends SnapshotPage\n>(\n list: (input: Input, options: ContentPaginationOptions) => Promise<P>,\n input: Input,\n options: ContentPaginationOptions = {}\n): AsyncGenerator<P> {\n let query = { ...input };\n\n yield* paginatePages(\n async (cursor) => {\n const page = await list({ ...query, cursor }, { ...options, response: \"data\" });\n const snapshotChanged =\n query.snapshotID !== undefined && page.snapshotID !== query.snapshotID;\n\n if (snapshotChanged) throw new Error(\"Pagination returned a different snapshot\");\n\n query = { ...query, channel: undefined, snapshotID: page.snapshotID };\n\n return page;\n },\n { cursor: input.cursor }\n );\n};\n\nconst createContentClient = <Workspace extends WorkspaceTypeMap = WorkspaceTypeMap>(\n content: ContentResources<Workspace>\n): ContentClient<Workspace> => {\n const paginateEntryPages = <const Input extends EntryListInput = Record<string, never>>(\n input: Input = {} as Input,\n options?: ContentPaginationOptions\n ) =>\n paginateSnapshotPages<Input, ContentListOutput<Input, Workspace>>(\n (query, requestOptions) => content.listEntries(query, requestOptions),\n input,\n options\n );\n const paginateCollectionPages = (\n input: OperationInput<\"content.listCollections\"> = {},\n options?: ContentPaginationOptions\n ) =>\n paginateSnapshotPages(\n (query, requestOptions) => content.listCollections(query, requestOptions),\n input,\n options\n );\n\n return {\n ...content,\n paginateEntryPages,\n async *paginateEntries(input, options) {\n for await (const page of paginateEntryPages(input, options)) yield* page.data;\n },\n paginateCollectionPages,\n async *paginateCollections(input, options) {\n for await (const page of paginateCollectionPages(input, options)) yield* page.data;\n }\n };\n};\n\nexport { createContentClient };\nexport type { ContentClient, ContentPaginationOptions };\n","// oRPC represents nested query values with indexed bracket notation.\nconst serializeQuery = (query: Record<string, unknown>): string => {\n const parameters = new URLSearchParams();\n const escapeKey = (key: string) => key.replace(/[\\\\[\\]]/g, (character) => `\\\\${character}`);\n const append = (path: string, value: unknown): void => {\n if (value === undefined || value === null) return;\n\n if (Array.isArray(value)) {\n value.forEach((item, index) => append(`${path}[${index}]`, item));\n } else if (typeof value === \"object\") {\n for (const [key, item] of Object.entries(value)) append(`${path}[${escapeKey(key)}]`, item);\n } else {\n parameters.append(path, String(value));\n }\n };\n\n for (const [key, value] of Object.entries(query)) append(escapeKey(key), value);\n\n return parameters.toString();\n};\n\nexport { serializeQuery };\n","import type { ContentListOperation, ContentListOutput } from \"./content-list\";\nimport type { WithSelectors } from \"./selectors\";\nimport type { operations } from \"./generated/schema\";\nimport type { WorkspaceTypeMap } from \"./workspace\";\nimport type { WorkspaceOperationOutput } from \"./workspace-output\";\n\ninterface RequestOptions {\n /** Cancel the request or stream, preserving the signal's abort reason. */\n signal?: AbortSignal;\n /** Override the client timeout in milliseconds; 0 disables it. Includes stream consumption. */\n timeout?: number;\n /** Override GET retry attempts. Defaults to the client setting; other methods never retry. */\n retries?: number;\n /** Headers merged over client headers. The configured credential supplies Authorization. */\n headers?: HeadersInit;\n /** Return data by default, or status/headers/data with \"full\". Required for possible 304s. */\n response?: \"data\" | \"full\";\n}\ninterface APIResponse<T> {\n status: number;\n headers: Headers;\n data: T;\n notModified: false;\n}\ninterface NotModifiedResponse {\n status: 304;\n headers: Headers;\n data: undefined;\n notModified: true;\n}\ninterface OperationDefinition {\n streaming?: boolean;\n method: string;\n path: string;\n pathParams: string[];\n queryParams: string[];\n body: boolean;\n multipart: boolean;\n binary: boolean;\n anonymous: boolean;\n}\ninterface Requester {\n (\n definition: OperationDefinition,\n input: Record<string, unknown>,\n options?: RequestOptions\n ): Promise<unknown>;\n}\ninterface StandardOperation<K extends keyof operations, Workspace extends WorkspaceTypeMap> {\n <const Input extends OperationInput<K>>(\n input: Input,\n options: RequestOptions & { response: \"full\" }\n ): Promise<APIResponse<OperationOutput<K, Workspace, Input>> | NotModifiedResponse>;\n <const Input extends OperationInput<K> = OperationInput<K>>(\n ...args: Record<string, never> extends OperationInput<K>\n ? [input?: Input, options?: RequestOptions & { response?: \"data\" }]\n : [input: Input, options?: RequestOptions & { response?: \"data\" }]\n ): Promise<OperationOutput<K, Workspace, Input>>;\n}\n\ninterface StreamOperation<K extends keyof operations> {\n (\n input: OperationInput<K>,\n options: RequestOptions & { response: \"full\" }\n ): Promise<APIResponse<OperationOutput<K>>>;\n (\n input: OperationInput<K>,\n options?: RequestOptions & { response?: \"data\" }\n ): Promise<OperationOutput<K>>;\n}\n\ntype StreamContent<K extends keyof operations> = Responses<K>[Extract<\n keyof Responses<K>,\n 200\n>] extends { content: { \"text/event-stream\": infer Frames } }\n ? Frames\n : never;\ntype StreamEvent<K extends keyof operations> =\n Extract<StreamContent<K>, { event: \"message\" }> extends { data: infer Event } ? Event : never;\ntype Operation<\n K extends keyof operations,\n Workspace extends WorkspaceTypeMap = WorkspaceTypeMap\n> = [StreamContent<K>] extends [never]\n ? K extends \"content.listEntries\"\n ? ContentListOperation<Workspace>\n : StandardOperation<K, Workspace>\n : StreamOperation<K>;\n\ntype Content<T> = T extends { content: infer C } ? C[keyof C] : never;\ntype Parameters<T, K extends string> = T extends { parameters: infer P }\n ? K extends keyof P\n ? [NonNullable<P[K]>] extends [never]\n ? unknown\n : NonNullable<P[K]>\n : unknown\n : unknown;\ntype Body<T> = T extends { requestBody?: infer B }\n ? [Content<NonNullable<B>>] extends [never]\n ? unknown\n : Content<NonNullable<B>>\n : unknown;\ntype OperationInput<K extends keyof operations> = WithSelectors<\n K,\n Parameters<operations[K], \"path\"> & Parameters<operations[K], \"query\"> & Body<operations[K]>\n>;\ntype Responses<K extends keyof operations> = operations[K][\"responses\"];\ntype SuccessContent<K extends keyof operations> = Content<\n Responses<K>[Extract<keyof Responses<K>, 200 | 201 | 202 | 203 | 206>]\n>;\ntype OperationError<K extends keyof operations> = K extends keyof operations\n ? Extract<Content<Responses<K>[keyof Responses<K>]>, { defined: true; code: string }>\n : never;\ntype APIErrorBody = OperationError<keyof operations>;\ntype APIErrorCode = APIErrorBody[\"code\"];\ntype APIErrorData<C extends APIErrorCode> = Extract<APIErrorBody, { code: C }>[\"data\"];\ntype RawOperationOutput<K extends keyof operations> = [StreamContent<K>] extends [never]\n ? [SuccessContent<K>] extends [never]\n ? void\n : SuccessContent<K>\n : AsyncIterableIterator<StreamEvent<K>>;\ntype OperationOutput<\n K extends keyof operations,\n Workspace extends WorkspaceTypeMap = WorkspaceTypeMap,\n Input = OperationInput<K>\n> = K extends \"content.listEntries\"\n ? ContentListOutput<Input, Workspace>\n : WorkspaceOperationOutput<K, RawOperationOutput<K>, Workspace, Input>;\n\nconst operation = <\n K extends keyof operations,\n Workspace extends WorkspaceTypeMap = WorkspaceTypeMap\n>(\n request: Requester,\n definition: OperationDefinition\n): Operation<K, Workspace> => {\n return ((input: Record<string, unknown>, options?: RequestOptions) => {\n return request(definition, input || {}, options);\n }) as Operation<K, Workspace>;\n};\n\nexport { operation };\nexport type {\n APIResponse,\n APIErrorBody,\n APIErrorCode,\n APIErrorData,\n OperationError,\n NotModifiedResponse,\n Operation,\n OperationDefinition,\n OperationInput,\n OperationOutput,\n RawOperationOutput,\n Requester,\n RequestOptions\n};\n","/* eslint-disable max-lines */\n// Generated from openapi.json. Do not edit.\nimport { operation, type Operation, type Requester } from \"../operation\";\nimport type { WorkspaceTypeMap } from \"../workspace\";\n\ninterface APIResources<Workspace extends WorkspaceTypeMap = WorkspaceTypeMap> {\n assets: {\n /**\n * Search assets\n *\n * Finds workspace images by text or SHA-256 checksum. Semantic search defaults to true and uses 1 AI credit for a text query. Returns up to 50 results.\n *\n * Required API key permissions: read:entries, read:collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.assets.search({\n * \"query\": \"mountains\",\n * \"limit\": 10\n * });\n */\n search: Operation<\"assets.search\", Workspace>;\n /**\n * Import an image URL\n *\n * Downloads a remote image and starts processing it for the entry. With checkDuplicates, can return an existing image instead. Use assets.get to check processing status.\n *\n * Required API key permissions: entries. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.assets.importURL({\n * \"assetID\": \"ast_example\",\n * \"entryID\": \"ent_example\",\n * \"url\": \"https://example.com/image.png\",\n * \"checkDuplicates\": true\n * });\n */\n importURL: Operation<\"assets.importURL\", Workspace>;\n /**\n * Attach an asset\n *\n * Attaches a ready image to an entry. This does not insert an image node into the document.\n *\n * Required API key permissions: entries. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.assets.attach({\n * \"assetID\": \"ast_example\",\n * \"entryID\": \"ent_example\"\n * });\n */\n attach: Operation<\"assets.attach\", Workspace>;\n /**\n * Register an image upload\n *\n * Reserves an image upload for an entry. Supply the byte count and lowercase SHA-256 checksum of the file. Call assets.upload before expiresAt, then use assets.get to check processing status.\n *\n * Required API key permissions: entries. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.assets.register({\n * \"assetID\": \"ast_example\",\n * \"entryID\": \"ent_example\",\n * \"filename\": \"image.png\",\n * \"byteSize\": 1024,\n * \"checksum\": \"0000000000000000000000000000000000000000000000000000000000000000\"\n * });\n */\n register: Operation<\"assets.register\", Workspace>;\n /**\n * Upload registered image bytes\n *\n * Uploads a file for a registered asset with multipart/form-data. The bytes must match the registered size and checksum. Processing continues after the upload; use assets.get to check status.\n *\n * Required API key permissions: entries. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.assets.upload({\n * \"assetID\": \"ast_example\",\n * \"file\": new Blob([imageBytes], { type: \"image/png\" })\n * });\n */\n upload: Operation<\"assets.upload\", Workspace>;\n /**\n * Get asset status and details\n *\n * Returns image metadata, processing status, and available files. Supply entryID when checking access through an entry.\n *\n * @example\n * await client.assets.get({\n * \"assetID\": \"ast_example\",\n * \"entryID\": \"ent_example\"\n * });\n */\n get: Operation<\"assets.get\", Workspace>;\n };\n auth: {\n /**\n * Get credential identity\n *\n * Returns the authenticated user for OAuth or browser credentials, or the key and workspace IDs for an API key. Does not require a workspace selection and does not count toward API usage.\n */\n getIdentity: Operation<\"auth.getIdentity\", Workspace>;\n };\n instance: {\n /**\n * Get instance capabilities and limits\n *\n * Returns configured features and effective limits for the authenticated workspace. These values do not grant permissions or report live service health. No discovery request is made automatically by the SDK.\n *\n * @example\n * await client.instance.get({});\n */\n get: Operation<\"instance.get\", Workspace>;\n };\n entries: {\n /**\n * Create an entry\n *\n * Creates an entry and its initial document. The name defaults to Untitled. Creation selects an available sibling name with a numeric suffix when needed. Names are trimmed and NFC-normalized. Derived URL slugs must be unique across sibling entries and collections, including case and punctuation variants. Names cannot contain a slash or equal a single dot or two dots. A collection schema can set the initial content.\n *\n * Required API key permissions: entries. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.entries.create({\n * \"name\": \"Getting started\",\n * \"collectionID\": \"coll_example\"\n * });\n */\n create: Operation<\"entries.create\", Workspace>;\n /**\n * Delete entries\n *\n * Soft-deletes the selected entries and clears current-entry selections for affected members. An active schema migration can block this action.\n *\n * Required API key permissions: entries. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.entries.bulkDelete({\n * \"ids\": [\n * \"ent_example\"\n * ]\n * });\n */\n bulkDelete: Operation<\"entries.bulkDelete\", Workspace>;\n /**\n * Delete an entry\n *\n * Soft-deletes the entry and clears current-entry selections for affected members. An active schema migration can block this action.\n *\n * Required API key permissions: entries. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.entries.delete({\n * \"id\": \"ent_example\"\n * });\n */\n delete: Operation<\"entries.delete\", Workspace>;\n /**\n * Rename an entry\n *\n * Updates the entry name. Rejects names already used by a sibling entry or collection. An active schema migration can block this action.\n *\n * Required API key permissions: entries. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.entries.update({\n * \"id\": \"ent_example\",\n * \"name\": \"Installation\"\n * });\n */\n update: Operation<\"entries.update\", Workspace>;\n /**\n * Get an entry\n *\n * Returns current entry details, fragments, properties, and recorded schema metadata. Validates content without changing it. expectedSchemaHash must match the recorded schema; schema-less content cannot match it. Use content.get to read published content.\n *\n * Required API key permissions: read:entries. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.entries.get({\n * \"id\": \"ent_example\"\n * });\n */\n get: Operation<\"entries.get\", Workspace>;\n /**\n * List entries\n *\n * Lists entries in the selected collection, or all accessible entries when collectionID is omitted. Pass pagination.nextCursor to the next request while pagination.hasMore is true. The limit is 1 to 100 and defaults to 50.\n *\n * Required API key permissions: read:entries. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.entries.list({\n * \"collectionID\": \"coll_example\",\n * \"limit\": 20\n * });\n */\n list: Operation<\"entries.list\", Workspace>;\n };\n extensions: {\n /**\n * Get the extension\n *\n * Returns the installed extension that the token's subject names, including disabled and uninstalled extensions.\n */\n getSelf: Operation<\"extensions.getSelf\", Workspace>;\n /**\n * Verify a session token\n *\n * Verifies a session token from the extension frontend and returns its member. Tokens of other extensions, expired tokens, and tokens of an earlier extension generation fail with NOT_FOUND.\n */\n verifySession: Operation<\"extensions.verifySession\", Workspace>;\n /**\n * List installations\n *\n * Lists the installations of the extension on this instance. Requires an app-level token: an extension JWT without a subject.\n */\n listInstallations: Operation<\"extensions.listInstallations\", Workspace>;\n /**\n * Get a delivery\n *\n * Returns the event of a delivery to one of the extension's webhooks. Disabled and uninstalled extensions can read only lifecycle deliveries.\n */\n getSelfDelivery: Operation<\"extensions.getSelfDelivery\", Workspace>;\n /**\n * Get the configuration\n *\n * Returns the extension's configuration, including secret fields, and its revision. Unset fields use their defaults.\n */\n getSelfConfiguration: Operation<\"extensions.getSelfConfiguration\", Workspace>;\n /**\n * Get a storage entry\n *\n * Returns an entry of the extension's storage, or NOT_FOUND.\n */\n getSelfStorageEntry: Operation<\"extensions.getSelfStorageEntry\", Workspace>;\n /**\n * Set a storage entry\n *\n * Creates or replaces an entry of the extension's storage. Values are JSON up to 128 KiB; the storage holds up to 10,000 entries and 10 MiB.\n */\n setSelfStorageEntry: Operation<\"extensions.setSelfStorageEntry\", Workspace>;\n /**\n * Delete a storage entry\n *\n * Deletes an entry of the extension's storage, if it exists.\n */\n deleteSelfStorageEntry: Operation<\"extensions.deleteSelfStorageEntry\", Workspace>;\n /**\n * List storage entries\n *\n * Lists the extension's storage entries in key order, optionally with a key prefix. A page ends early when its values reach 192 KiB.\n */\n listSelfStorageEntries: Operation<\"extensions.listSelfStorageEntries\", Workspace>;\n };\n collections: {\n /**\n * Create a collection\n *\n * Creates a child collection. Without parentID, uses the workspace root. The name defaults to Untitled. Creation selects an available sibling name with a numeric suffix when needed. Names are trimmed and NFC-normalized. Derived URL slugs must be unique across sibling entries and collections, including case and punctuation variants. Names cannot contain a slash or equal a single dot or two dots. Restricted collections require a session with restricted_collections permission and the Pro plan; API keys cannot create them.\n *\n * Required API key permissions: collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.collections.create({\n * \"name\": \"Documentation\",\n * \"parentID\": \"coll_example\"\n * });\n */\n create: Operation<\"collections.create\", Workspace>;\n /**\n * Delete collection trees\n *\n * Soft-deletes the selected collections, their descendants, and their entries. The workspace root cannot be deleted. An active schema migration can block this action.\n *\n * Required API key permissions: collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.collections.bulkDelete({\n * \"ids\": [\n * \"coll_example\"\n * ]\n * });\n */\n bulkDelete: Operation<\"collections.bulkDelete\", Workspace>;\n /**\n * Delete a collection tree\n *\n * Soft-deletes the collection, its descendants, and their entries. The workspace root cannot be deleted. An active schema migration can block this action.\n *\n * Required API key permissions: collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.collections.delete({\n * \"id\": \"coll_example\"\n * });\n */\n delete: Operation<\"collections.delete\", Workspace>;\n /**\n * Rename a collection\n *\n * Updates the collection name. Rejects names already used by a sibling entry or collection. An active schema migration can block this action.\n *\n * Required API key permissions: collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.collections.update({\n * \"id\": \"coll_example\",\n * \"name\": \"Guides\"\n * });\n */\n update: Operation<\"collections.update\", Workspace>;\n /**\n * List collections\n *\n * Lists collections under the selected ancestor. Pass pagination.nextCursor to the next request while pagination.hasMore is true. The limit is 1 to 100.\n *\n * Required API key permissions: read:collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.collections.list({\n * \"collectionID\": \"coll_example\",\n * \"limit\": 20\n * });\n */\n list: Operation<\"collections.list\", Workspace>;\n };\n content: {\n /**\n * List published collections\n *\n * Returns a flat page of collections from a publication snapshot. The default channel is published. On later pages, pass the returned snapshotID and pagination.nextCursor, and omit channel. Optionally select direct children using collectionID, collectionPath, or collectionSlugPath. Results are ordered by ID, not display order.\n *\n * Required API key permissions: read:publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.content.listCollections({\n * \"channel\": \"published\",\n * \"limit\": 20\n * });\n */\n listCollections: Operation<\"content.listCollections\", Workspace>;\n /**\n * List published entries\n *\n * Returns a flat page of entries from a publication snapshot. The default channel is published. On later pages, pass the returned snapshotID and pagination.nextCursor, and omit channel. Select direct children using collectionID, collectionPath, or collectionSlugPath, or include nested entries with descendants: true. descendants requires a collection scope. All property filters must match the assigned version. includeContent: true returns validated full content, properties, fragments, assets, and recorded schema metadata. An invalid full item fails the page. Keep the same scope and filters across pages. Results are ordered by ID, not display order.\n *\n * Required API key permissions: read:publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.content.listEntries({\n * \"channel\": \"published\",\n * \"limit\": 20\n * });\n */\n listEntries: Operation<\"content.listEntries\", Workspace>;\n /**\n * Get a published entry schema\n *\n * Returns the exact recorded effective schema, or null for schema-less content. Uses the same publication access as content.get. Pass its snapshotID for a consistent read; use channel or snapshotID, not both.\n *\n * Required API key permissions: read:publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.content.getSchema({\n * \"entryID\": \"ent_example\",\n * \"channel\": \"published\"\n * });\n */\n getSchema: Operation<\"content.getSchema\", Workspace>;\n /**\n * Download a published asset\n *\n * Returns binary image data from a publication snapshot. No API key is required. The asset must belong to the entry in that available snapshot. Use the asset URLs returned with published content.\n *\n * @example\n * await client.content.getAsset({\n * \"workspaceID\": \"ws_example\",\n * \"snapshotID\": \"snp_example\",\n * \"entryID\": \"ent_example\",\n * \"assetID\": \"ast_example\",\n * \"variant\": \"display\"\n * });\n */\n getAsset: Operation<\"content.getAsset\", Workspace>;\n /**\n * Get published entry content\n *\n * Returns content from a publishing channel or a specific available snapshot. Use channel or snapshotID, never both. The default channel is published. Validates saved content against its recorded schema and returns schema metadata. expectedSchemaHash must match that revision; schema-less content cannot match it. Validation and hash checks run before ETag handling. Supports ETag and If-None-Match; a match returns 304 without a body.\n *\n * Required API key permissions: read:publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.content.get({\n * \"entryID\": \"ent_example\",\n * \"channel\": \"published\"\n * });\n */\n get: Operation<\"content.get\", Workspace>;\n /**\n * Get a published collection tree\n *\n * Returns a published collection tree and its snapshot ID. Use channel or snapshotID, never both. The default channel is published. Reuse the snapshot ID for consistent content reads. Supports ETag and If-None-Match; a match returns 304 without a body.\n *\n * Required API key permissions: read:publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.content.getTree({\n * \"collectionID\": \"coll_example\",\n * \"channel\": \"published\"\n * });\n */\n getTree: Operation<\"content.getTree\", Workspace>;\n };\n webhooks: {\n /**\n * List webhooks\n *\n * Required API key permissions: read:webhooks. Write permissions also grant read access for the same resource.\n */\n list: Operation<\"webhooks.list\", Workspace>;\n /**\n * Create a webhook\n *\n * Creates an enabled webhook unless `enabled` is false and returns the signing secret once. The caller must be able to read every resource type its events send, and restricted content when included.\n *\n * Required API key permissions: webhooks. Write permissions also grant read access for the same resource.\n */\n create: Operation<\"webhooks.create\", Workspace>;\n /**\n * Get a webhook\n *\n * Required API key permissions: read:webhooks. Write permissions also grant read access for the same resource.\n */\n get: Operation<\"webhooks.get\", Workspace>;\n /**\n * Update a webhook\n *\n * Checks expectedRevision and validates the merged configuration. A URL change cancels pending deliveries and returns a replacement secret once. Scope changes require authority over the previous and new scope.\n *\n * Required API key permissions: webhooks. Write permissions also grant read access for the same resource.\n */\n update: Operation<\"webhooks.update\", Workspace>;\n /**\n * Delete a webhook\n *\n * Cancels pending deliveries and destroys signing keys. Retains history until its original expiry; a deleted endpoint cannot be replayed.\n *\n * Required API key permissions: webhooks. Write permissions also grant read access for the same resource.\n */\n delete: Operation<\"webhooks.delete\", Workspace>;\n /**\n * Enable or disable webhooks\n *\n * Applies the state to every listed webhook in one transaction, checking each expectedRevision. Enabling checks the scope authority and destination of each webhook. Webhooks already in the state are unchanged.\n *\n * Required API key permissions: webhooks. Write permissions also grant read access for the same resource.\n */\n bulkSetEnabled: Operation<\"webhooks.bulkSetEnabled\", Workspace>;\n /**\n * Delete webhooks\n *\n * Deletes every listed webhook in one transaction, checking each expectedRevision. Each deletion cancels pending deliveries and destroys signing keys; history stays until its original expiry.\n *\n * Required API key permissions: webhooks. Write permissions also grant read access for the same resource.\n */\n bulkDelete: Operation<\"webhooks.bulkDelete\", Workspace>;\n /**\n * Rotate a webhook secret\n *\n * Returns a new secret once. Overlap keeps the old secret valid for 24 hours. Immediate rotation retires it at once. Normal rotation conflicts while a previous overlap remains active.\n *\n * Required API key permissions: webhooks. Write permissions also grant read access for the same resource.\n */\n rotateSecret: Operation<\"webhooks.rotateSecret\", Workspace>;\n /**\n * Send a webhook test\n *\n * Schedules one signed synthetic attempt for this endpoint, including when disabled. The event must be selected by the endpoint. It does not enable the endpoint or change content.\n *\n * Required API key permissions: webhooks. Write permissions also grant read access for the same resource.\n */\n sendTest: Operation<\"webhooks.sendTest\", Workspace>;\n /**\n * List webhook deliveries\n *\n * Returns unexpired history, including for a deleted endpoint. Metadata does not include event payloads.\n *\n * Required API key permissions: read:webhooks. Write permissions also grant read access for the same resource.\n */\n listDeliveries: Operation<\"webhooks.listDeliveries\", Workspace>;\n /**\n * Get a webhook delivery\n *\n * Returns retained delivery metadata and, with content authority, the immutable event payload. Expired deliveries return not found even before physical cleanup.\n *\n * Required API key permissions: read:webhooks. Write permissions also grant read access for the same resource.\n */\n getDelivery: Operation<\"webhooks.getDelivery\", Workspace>;\n /**\n * List delivery runs\n *\n * Required API key permissions: read:webhooks. Write permissions also grant read access for the same resource.\n */\n listRuns: Operation<\"webhooks.listRuns\", Workspace>;\n /**\n * List delivery attempts\n *\n * Required API key permissions: read:webhooks. Write permissions also grant read access for the same resource.\n */\n listAttempts: Operation<\"webhooks.listAttempts\", Workspace>;\n /**\n * Redeliver a webhook event\n *\n * Checks the reviewed destination revision and current scope authority. Reuses the original event ID, payload, and expiry. Returns a conflict if a run is active, or the endpoint is disabled or deleted.\n *\n * Required API key permissions: webhooks. Write permissions also grant read access for the same resource.\n */\n redeliver: Operation<\"webhooks.redeliver\", Workspace>;\n /**\n * Redeliver webhook events\n *\n * Replays every listed delivery in one transaction with the same checks as a single redelivery. Any ineligible delivery fails the whole request. Counts as one request for rate limiting.\n *\n * Required API key permissions: webhooks. Write permissions also grant read access for the same resource.\n */\n bulkRedeliver: Operation<\"webhooks.bulkRedeliver\", Workspace>;\n };\n roles: {\n /**\n * List roles\n *\n * Returns workspace roles and their permissions.\n *\n * Required API key permissions: read:roles. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.roles.list({});\n */\n list: Operation<\"roles.list\", Workspace>;\n /**\n * Create a role\n *\n * Creates a workspace role. Names are unique without regard to case and must contain 1 to 50 characters after trimming. Requires the Pro plan and permission to delegate the selected permissions.\n *\n * Required API key permissions: roles. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.roles.create({\n * \"name\": \"Editor\",\n * \"permissions\": [\n * \"content\"\n * ]\n * });\n */\n create: Operation<\"roles.create\", Workspace>;\n /**\n * Update a role\n *\n * Changes a role name or permissions. Names are unique without regard to case. Requires the Pro plan and permission to delegate the selected permissions. Built-in roles have additional restrictions.\n *\n * Required API key permissions: roles. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.roles.update({\n * \"id\": \"rl_example\",\n * \"name\": \"Content editor\"\n * });\n */\n update: Operation<\"roles.update\", Workspace>;\n /**\n * Delete a role\n *\n * Deletes a custom role and updates its assignments. Built-in roles cannot be deleted. Requires the Pro plan.\n *\n * Required API key permissions: roles. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.roles.delete({\n * \"id\": \"rl_example\"\n * });\n */\n delete: Operation<\"roles.delete\", Workspace>;\n };\n search: {\n /**\n * Search current content\n *\n * Searches current entry content by text and optional property filters. Up to 20 filters and 50 results are allowed. Semantic search is optional, uses 1 AI credit, and has a separate rate limit.\n *\n * Required API key permissions: read:entries, read:collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.search.current({\n * \"query\": \"installation\",\n * \"limit\": 10\n * });\n */\n current: Operation<\"search.current\", Workspace>;\n /**\n * Search published content\n *\n * Searches content published to the required channel. Up to 20 filters and 50 results are allowed. Semantic search is optional, uses 1 AI credit, and has a separate rate limit.\n *\n * Required API key permissions: read:publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.search.published({\n * \"query\": \"installation\",\n * \"channel\": \"published\",\n * \"limit\": 10\n * });\n */\n published: Operation<\"search.published\", Workspace>;\n /**\n * Ask AI about current content\n *\n * Returns a complete answer with numbered sources. Requires explicit ai-answers permission in addition to content read permissions. Accepts up to 1,000 question characters, 10 history messages of up to 4,000 characters each, and 20 property filters. Uses 3 AI credits and the Ask AI rate limit. Use a secret key on your server, or a publishable key for published content.\n *\n * Required API key permissions: ai-answers, read:entries, read:collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.search.askCurrent({\n * \"question\": \"How do I install Andesine?\"\n * });\n */\n askCurrent: Operation<\"search.askCurrent\", Workspace>;\n /**\n * Ask AI about published content\n *\n * Returns a complete answer with numbered sources. Requires explicit ai-answers permission in addition to content read permissions. Accepts up to 1,000 question characters, 10 history messages of up to 4,000 characters each, and 20 property filters. Uses 3 AI credits and the Ask AI rate limit. Use a secret key on your server, or a publishable key for published content.\n *\n * Required API key permissions: ai-answers, read:publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.search.askPublished({\n * \"question\": \"How do I install Andesine?\",\n * \"channel\": \"published\"\n * });\n */\n askPublished: Operation<\"search.askPublished\", Workspace>;\n /**\n * Stream an AI answer about current content\n *\n * Emits sources, textDelta, and completed events over SSE. Uses the same inputs, permissions, AI credits, and rate limit as complete answers. Stream errors use SSE error frames. Never reconnect automatically.\n *\n * Required API key permissions: ai-answers, read:entries, read:collections. Write permissions also grant read access for the same resource.\n */\n askCurrentStream: Operation<\"search.askCurrentStream\", Workspace>;\n /**\n * Stream an AI answer about published content\n *\n * Emits sources, textDelta, and completed events over SSE. Uses the same inputs, permissions, AI credits, and rate limit as complete answers. Stream errors use SSE error frames. Never reconnect automatically.\n *\n * Required API key permissions: ai-answers, read:publishing. Write permissions also grant read access for the same resource.\n */\n askPublishedStream: Operation<\"search.askPublishedStream\", Workspace>;\n };\n schemas: {\n /**\n * Create a local collection schema\n *\n * Creates a local schema draft for the collection. Use schemas.get to inspect local and effective schemas.\n *\n * Required API key permissions: collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.schemas.create({\n * \"collectionID\": \"coll_example\"\n * });\n */\n create: Operation<\"schemas.create\", Workspace>;\n /**\n * Delete a local schema\n *\n * Removes the local schema and recalculates inherited schemas. This can start a content migration. Review possible content removal before setting confirmedDataLoss. Use schemaMigrations.get with a returned migrationID.\n *\n * Required API key permissions: collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.schemas.delete({\n * \"schemaID\": \"sch_example\",\n * \"confirmedDataLoss\": false\n * });\n */\n delete: Operation<\"schemas.delete\", Workspace>;\n /**\n * Get an exact schema revision\n *\n * Returns the recorded effective definition, including inherited fields. Requires read access to the revision's collection. The definition is independent of the currently active schema.\n *\n * Required API key permissions: read:collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.schemas.getRevision({\n * \"revisionID\": \"schr_example\"\n * });\n */\n getRevision: Operation<\"schemas.getRevision\", Workspace>;\n /**\n * Get collection schemas\n *\n * Returns local and effective schema details for the collection, including inheritance.\n *\n * Required API key permissions: read:collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.schemas.get({\n * \"collectionID\": \"coll_example\"\n * });\n */\n get: Operation<\"schemas.get\", Workspace>;\n /**\n * Apply a schema draft\n *\n * Creates a schema version from the draft and starts any required migration of affected entry content. Review possible content removal before calling: confirmedDataLoss must be true. Use schemaMigrations.get to follow a returned migrationID.\n *\n * Required API key permissions: collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.schemas.apply({\n * \"schemaID\": \"sch_example\",\n * \"confirmedDataLoss\": true,\n * \"name\": \"Reviewed schema\"\n * });\n */\n apply: Operation<\"schemas.apply\", Workspace>;\n };\n schemaMigrations: {\n /**\n * List entries with migration content loss\n *\n * Lists accessible, non-deleted entries that lost content in a completed migration. Returns an empty page until completion. Use pagination.nextCursor to continue.\n *\n * Required API key permissions: read:collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.schemaMigrations.listContentLossEntries({\n * \"id\": \"smg_example\",\n * \"limit\": 20\n * });\n */\n listContentLossEntries: Operation<\"schemaMigrations.listContentLossEntries\", Workspace>;\n /**\n * Get the active schema migration\n *\n * Returns the active migration for a collection, or null when none is active.\n *\n * Required API key permissions: read:collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.schemaMigrations.getActive({\n * \"collectionID\": \"coll_example\"\n * });\n */\n getActive: Operation<\"schemaMigrations.getActive\", Workspace>;\n /**\n * Get schema migration status\n *\n * Returns bounded migration progress and status. Use schemaMigrations.listContentLossEntries for per-entry content loss details. Check status before repeating an operation blocked by this migration.\n *\n * Required API key permissions: read:collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.schemaMigrations.get({\n * \"id\": \"smg_example\"\n * });\n */\n get: Operation<\"schemaMigrations.get\", Workspace>;\n };\n schemaVersions: {\n /**\n * List schema versions\n *\n * Lists versions of a local collection schema. Pass pagination.nextCursor to the next request while pagination.hasMore is true. The limit is 1 to 100.\n *\n * Required API key permissions: read:collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.schemaVersions.list({\n * \"schemaID\": \"sch_example\",\n * \"limit\": 20\n * });\n */\n list: Operation<\"schemaVersions.list\", Workspace>;\n /**\n * Get a schema version\n *\n * Returns a saved schema version and its definition.\n *\n * Required API key permissions: read:collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.schemaVersions.get({\n * \"id\": \"schv_example\"\n * });\n */\n get: Operation<\"schemaVersions.get\", Workspace>;\n /**\n * Rename a schema version\n *\n * Changes the saved version name. Set name to null to remove the name.\n *\n * Required API key permissions: collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.schemaVersions.update({\n * \"id\": \"schv_example\",\n * \"name\": \"Reviewed schema\"\n * });\n */\n update: Operation<\"schemaVersions.update\", Workspace>;\n /**\n * Restore a schema version\n *\n * Restores the selected definition and starts any required content migration. Review possible content removal before calling: confirmedDataLoss must be true. Use schemaMigrations.get to follow a returned migrationID.\n *\n * Required API key permissions: collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.schemaVersions.revert({\n * \"id\": \"schv_example\",\n * \"confirmedDataLoss\": true\n * });\n */\n revert: Operation<\"schemaVersions.revert\", Workspace>;\n };\n memberships: {\n /**\n * List workspace members\n *\n * Lists workspace memberships with role and user details. Use pagination.nextCursor to continue with the same filters; concurrent changes can affect later pages.\n *\n * Required API key permissions: read:memberships. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.memberships.list({});\n */\n list: Operation<\"memberships.list\", Workspace>;\n /**\n * Invite a workspace member\n *\n * Creates an invitation and attempts email delivery. Check emailDelivery in the result. Requires the Pro plan and permission to delegate the selected role. Existing membership or pending invitation returns a conflict.\n *\n * Required API key permissions: memberships. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.memberships.invite({\n * \"email\": \"editor@example.com\",\n * \"roleID\": \"rl_example\"\n * });\n */\n invite: Operation<\"memberships.invite\", Workspace>;\n /**\n * Change a member role\n *\n * Assigns a new role to a member. Requires the Pro plan and permission to delegate that role. Administrator assignments have additional restrictions.\n *\n * Required API key permissions: memberships. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.memberships.update({\n * \"id\": \"ms_example\",\n * \"roleID\": \"rl_example\"\n * });\n */\n update: Operation<\"memberships.update\", Workspace>;\n /**\n * Remove a workspace member\n *\n * Removes the membership and its workspace access. Administrator memberships have additional restrictions.\n *\n * Required API key permissions: memberships. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.memberships.remove({\n * \"id\": \"ms_example\"\n * });\n */\n remove: Operation<\"memberships.remove\", Workspace>;\n /**\n * List invitations\n *\n * Lists pending, unexpired workspace invitations. Use pagination.nextCursor to continue. Requires the Pro plan.\n *\n * Required API key permissions: memberships. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.memberships.listInvites({});\n */\n listInvites: Operation<\"memberships.listInvites\", Workspace>;\n /**\n * Resend an invitation\n *\n * Attempts email delivery again for a pending invitation. Check emailDelivery in the result. Requires the Pro plan.\n *\n * Required API key permissions: memberships. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.memberships.resendInvite({\n * \"id\": \"inv_example\"\n * });\n */\n resendInvite: Operation<\"memberships.resendInvite\", Workspace>;\n /**\n * Revoke an invitation\n *\n * Revokes a pending invitation so it can no longer be accepted. Requires the Pro plan.\n *\n * Required API key permissions: memberships. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.memberships.revokeInvite({\n * \"id\": \"inv_example\"\n * });\n */\n revokeInvite: Operation<\"memberships.revokeInvite\", Workspace>;\n };\n publishing: {\n /**\n * Configure collection publishing\n *\n * Enables publishing for a collection, or disables it and unpublishes its tree from all channels. When enabling, publish can also publish the latest entry versions.\n *\n * Required API key permissions: publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.setCollection({\n * \"collectionID\": \"coll_example\",\n * \"enabled\": true,\n * \"publish\": false\n * });\n */\n setCollection: Operation<\"publishing.setCollection\", Workspace>;\n /**\n * Publish a collection tree\n *\n * Publishes the latest entry versions in a publishing-enabled collection tree to the channel. The default channel is published. Supply expectedSnapshotID from a prior channel read to reject concurrent publication changes.\n *\n * Required API key permissions: publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.publishCollection({\n * \"collectionID\": \"coll_example\",\n * \"channel\": \"published\"\n * });\n */\n publishCollection: Operation<\"publishing.publishCollection\", Workspace>;\n /**\n * Unpublish a collection tree\n *\n * Removes publication assignments for a collection tree from the channel. The default channel is published. Supply expectedSnapshotID from a prior channel read to reject concurrent publication changes.\n *\n * Required API key permissions: publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.unpublishCollection({\n * \"collectionID\": \"coll_example\",\n * \"channel\": \"published\"\n * });\n */\n unpublishCollection: Operation<\"publishing.unpublishCollection\", Workspace>;\n /**\n * Configure publishing for collections\n *\n * Enables publishing for the selected collections, or disables it and unpublishes their trees from all channels. When enabling, publish can also publish the latest entry versions.\n *\n * Required API key permissions: publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.bulkSetCollections({\n * \"ids\": [\n * \"coll_example\"\n * ],\n * \"enabled\": true,\n * \"publish\": false\n * });\n */\n bulkSetCollections: Operation<\"publishing.bulkSetCollections\", Workspace>;\n /**\n * Publish collection trees\n *\n * Publishes the latest entry versions in the selected publishing-enabled collection trees. At least one ID is required. The default channel is published. Supply expectedSnapshotID from a prior channel read to reject concurrent publication changes.\n *\n * Required API key permissions: publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.bulkPublishCollections({\n * \"ids\": [\n * \"coll_example\"\n * ],\n * \"channel\": \"published\"\n * });\n */\n bulkPublishCollections: Operation<\"publishing.bulkPublishCollections\", Workspace>;\n /**\n * Unpublish collection trees\n *\n * Removes publication assignments for the selected collection trees from the channel. At least one ID is required. The default channel is published. Supply expectedSnapshotID from a prior channel read to reject concurrent publication changes.\n *\n * Required API key permissions: publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.bulkUnpublishCollections({\n * \"ids\": [\n * \"coll_example\"\n * ],\n * \"channel\": \"published\"\n * });\n */\n bulkUnpublishCollections: Operation<\"publishing.bulkUnpublishCollections\", Workspace>;\n /**\n * Publish an entry\n *\n * Publishes an existing version, or the latest entry content if versionID is omitted. The entry must be in a publishing-enabled collection. The default channel is published. Supply expectedSnapshotID from a prior channel read to reject concurrent publication changes.\n *\n * Required API key permissions: publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.publishEntry({\n * \"entryID\": \"ent_example\",\n * \"channel\": \"published\"\n * });\n */\n publishEntry: Operation<\"publishing.publishEntry\", Workspace>;\n /**\n * Unpublish an entry\n *\n * Removes the entry publication from the channel. Supply versionID to require that version to be assigned; a changed assignment returns a conflict. The default channel is published. Supply expectedSnapshotID from a prior channel read to reject concurrent publication changes.\n *\n * Required API key permissions: publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.unpublishEntry({\n * \"entryID\": \"ent_example\",\n * \"channel\": \"published\",\n * \"versionID\": \"ver_example\"\n * });\n */\n unpublishEntry: Operation<\"publishing.unpublishEntry\", Workspace>;\n /**\n * Publish entries\n *\n * Publishes the selected entries with optional version IDs. Entries must be in publishing-enabled collections. At least one entry is required. The default channel is published. Supply expectedSnapshotID from a prior channel read to reject concurrent publication changes.\n *\n * Required API key permissions: publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.bulkPublishEntries({\n * \"entries\": [\n * {\n * \"entryID\": \"ent_example\"\n * }\n * ],\n * \"channel\": \"published\"\n * });\n */\n bulkPublishEntries: Operation<\"publishing.bulkPublishEntries\", Workspace>;\n /**\n * Unpublish entries\n *\n * Removes publication assignments for the selected entries from the channel. At least one ID is required. The default channel is published. Supply expectedSnapshotID from a prior channel read to reject concurrent publication changes.\n *\n * Required API key permissions: publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.bulkUnpublishEntries({\n * \"ids\": [\n * \"ent_example\"\n * ],\n * \"channel\": \"published\"\n * });\n */\n bulkUnpublishEntries: Operation<\"publishing.bulkUnpublishEntries\", Workspace>;\n /**\n * Revert pending publishing changes\n *\n * Restores selected drafts to the reviewed publication snapshot. This can remove unpublished items and replace draft content. First review publishing.getChannelContent and pass its snapshotID. Use all: true or specific collectionIDs/entryIDs, never both. Requires write access to affected resources in addition to read:publishing.\n *\n * Required API key permissions: read:publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.revertChanges({\n * \"collectionID\": \"coll_example\",\n * \"snapshotID\": \"snp_example\",\n * \"entryIDs\": [\n * \"ent_example\"\n * ],\n * \"channel\": \"published\"\n * });\n */\n revertChanges: Operation<\"publishing.revertChanges\", Workspace>;\n /**\n * Get a published entry version\n *\n * Returns the entry version assigned to a channel, or to an explicit available snapshot, with its recorded schema metadata. Validates content against that revision. expectedSchemaHash must match it; schema-less content cannot match it. The default channel is published.\n *\n * Required API key permissions: read:publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.getEntryVersion({\n * \"entryID\": \"ent_example\",\n * \"channel\": \"published\"\n * });\n */\n getEntryVersion: Operation<\"publishing.getEntryVersion\", Workspace>;\n /**\n * List entry publications\n *\n * Returns the entry publication assignments across channels.\n *\n * Required API key permissions: read:publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.listEntryPublications({\n * \"entryID\": \"ent_example\"\n * });\n */\n listEntryPublications: Operation<\"publishing.listEntryPublications\", Workspace>;\n /**\n * List publishing channels\n *\n * Returns workspace publishing channels. Set includeAssignmentCount to include entry assignment counts.\n *\n * Required API key permissions: read:publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.listChannels({\n * \"includeAssignmentCount\": true\n * });\n */\n listChannels: Operation<\"publishing.listChannels\", Workspace>;\n /**\n * Create a publishing channel\n *\n * Creates a publishing channel from its display name and returns the generated channel code.\n *\n * Required API key permissions: publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.createChannel({\n * \"name\": \"Preview\"\n * });\n */\n createChannel: Operation<\"publishing.createChannel\", Workspace>;\n /**\n * Get channel content and pending changes\n *\n * Returns publication state and pending changes for a publishing root, with the snapshot ID needed to review and revert changes.\n *\n * Required API key permissions: read:publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.getChannelContent({\n * \"channel\": \"published\",\n * \"collectionID\": \"coll_example\"\n * });\n */\n getChannelContent: Operation<\"publishing.getChannelContent\", Workspace>;\n /**\n * Delete a publishing channel\n *\n * Deletes a custom channel and its publication assignments. The default published channel cannot be deleted.\n *\n * Required API key permissions: publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.publishing.deleteChannel({\n * \"code\": \"preview\"\n * });\n */\n deleteChannel: Operation<\"publishing.deleteChannel\", Workspace>;\n };\n workspaces: {\n /**\n * List available workspaces\n *\n * Lists workspaces available to the OAuth user, with current role permissions and plan access. Browser sessions can list workspaces across signed-in accounts. Does not require workspace selection and does not count toward API usage.\n */\n list: Operation<\"workspaces.list\", Workspace>;\n };\n versions: {\n /**\n * Create an entry version\n *\n * Saves a version of the current entry content. Optionally assigns a name.\n *\n * Required API key permissions: versions. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.versions.create({\n * \"entryID\": \"ent_example\",\n * \"name\": \"Before release\"\n * });\n */\n create: Operation<\"versions.create\", Workspace>;\n /**\n * List entry versions\n *\n * Lists saved entry versions. Pass pagination.nextCursor to the next request while pagination.hasMore is true. The limit is 1 to 100.\n *\n * Required API key permissions: read:versions. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.versions.list({\n * \"entryID\": \"ent_example\",\n * \"limit\": 20\n * });\n */\n list: Operation<\"versions.list\", Workspace>;\n /**\n * Get an entry version\n *\n * Returns the saved content and recorded schema metadata of an entry version. Validates against its recorded revision, including historical versions. expectedSchemaHash must match that revision; schema-less content cannot match it.\n *\n * Required API key permissions: read:versions. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.versions.get({\n * \"id\": \"ver_example\"\n * });\n */\n get: Operation<\"versions.get\", Workspace>;\n /**\n * Rename an entry version\n *\n * Changes the saved version name. Set name to null to remove the name.\n *\n * Required API key permissions: versions. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.versions.update({\n * \"id\": \"ver_example\",\n * \"name\": \"Release candidate\"\n * });\n */\n update: Operation<\"versions.update\", Workspace>;\n /**\n * Restore an entry version\n *\n * Restores saved content to the current entry and returns the resulting version. An active schema migration can block this action.\n *\n * Required API key permissions: versions. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.versions.revert({\n * \"id\": \"ver_example\"\n * });\n */\n revert: Operation<\"versions.revert\", Workspace>;\n };\n typeMetadata: {\n /**\n * Get current content type metadata\n *\n * Read-only bulk metadata for type generation. Returns one consistent database snapshot of accessible collections and their active effective schemas, including inheritance. Optional entry/tree data requires read:entries in addition to read:collections. Explicit unavailable collection selectors fail. Active schema migrations in the selected collections return a conflict. No entry content is loaded. Schema-free collections use general types without warnings.\n *\n * Required API key permissions: read:collections. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.typeMetadata.getCurrent({\n * \"collections\": [\n * \"/Tutorials\"\n * ],\n * \"includeEntries\": false\n * });\n */\n getCurrent: Operation<\"typeMetadata.getCurrent\", Workspace>;\n /**\n * Get published content type metadata\n *\n * Read-only bulk metadata for type generation. Resolves a channel once (published by default), or reads a retained snapshot. Uses publication paths, names, and exact entry-version schema revisions; never substitutes current schemas. Supports mixed revisions and schema-free entries. Empty collections use general types without warnings. Includes selected subtrees; no selectors means all published collections and root entries. Publication-access rules match content.get. No entry content is loaded. Reuse source.snapshotID for related reads. The fingerprint changes only when returned type metadata changes, not when content-only publication creates a new snapshot.\n *\n * Required API key permissions: read:publishing. Write permissions also grant read access for the same resource.\n *\n * @example\n * await client.typeMetadata.getPublished({\n * \"channel\": \"published\",\n * \"collections\": [\n * \"/Tutorials\"\n * ]\n * });\n */\n getPublished: Operation<\"typeMetadata.getPublished\", Workspace>;\n };\n}\n\nconst createResources = <Workspace extends WorkspaceTypeMap = WorkspaceTypeMap>(\n request: Requester\n): APIResources<Workspace> => ({\n assets: {\n search: operation<\"assets.search\", Workspace>(request, {\n method: \"get\",\n path: \"/assets/search\",\n pathParams: [],\n queryParams: [\"query\", \"checksum\", \"semantic\", \"limit\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n importURL: operation<\"assets.importURL\", Workspace>(request, {\n method: \"post\",\n path: \"/assets/imports\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n attach: operation<\"assets.attach\", Workspace>(request, {\n method: \"post\",\n path: \"/assets/{assetID}/attachments\",\n pathParams: [\"assetID\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n register: operation<\"assets.register\", Workspace>(request, {\n method: \"post\",\n path: \"/assets/uploads\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n upload: operation<\"assets.upload\", Workspace>(request, {\n method: \"put\",\n path: \"/assets/{assetID}/upload\",\n pathParams: [\"assetID\"],\n queryParams: [],\n body: true,\n multipart: true,\n binary: false,\n anonymous: false\n }),\n get: operation<\"assets.get\", Workspace>(request, {\n method: \"get\",\n path: \"/assets/{assetID}\",\n pathParams: [\"assetID\"],\n queryParams: [\"entryID\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n auth: {\n getIdentity: operation<\"auth.getIdentity\", Workspace>(request, {\n method: \"get\",\n path: \"/identity\",\n pathParams: [],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n instance: {\n get: operation<\"instance.get\", Workspace>(request, {\n method: \"get\",\n path: \"/instance\",\n pathParams: [],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n entries: {\n create: operation<\"entries.create\", Workspace>(request, {\n method: \"post\",\n path: \"/entries\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n bulkDelete: operation<\"entries.bulkDelete\", Workspace>(request, {\n method: \"post\",\n path: \"/entries/bulk/delete\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n delete: operation<\"entries.delete\", Workspace>(request, {\n method: \"delete\",\n path: \"/entries/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n update: operation<\"entries.update\", Workspace>(request, {\n method: \"put\",\n path: \"/entries/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n get: operation<\"entries.get\", Workspace>(request, {\n method: \"get\",\n path: \"/entries/get\",\n pathParams: [],\n queryParams: [\"id\", \"path\", \"slugPath\", \"expectedSchemaHash\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n list: operation<\"entries.list\", Workspace>(request, {\n method: \"get\",\n path: \"/entries/list\",\n pathParams: [],\n queryParams: [\"collectionID\", \"collectionPath\", \"collectionSlugPath\", \"cursor\", \"limit\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n extensions: {\n getSelf: operation<\"extensions.getSelf\", Workspace>(request, {\n method: \"get\",\n path: \"/extensions/self\",\n pathParams: [],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n verifySession: operation<\"extensions.verifySession\", Workspace>(request, {\n method: \"post\",\n path: \"/extensions/self/sessions/verify\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n listInstallations: operation<\"extensions.listInstallations\", Workspace>(request, {\n method: \"get\",\n path: \"/extensions/self/installations\",\n pathParams: [],\n queryParams: [\"after\", \"limit\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n getSelfDelivery: operation<\"extensions.getSelfDelivery\", Workspace>(request, {\n method: \"get\",\n path: \"/extensions/self/deliveries/{deliveryID}\",\n pathParams: [\"deliveryID\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n getSelfConfiguration: operation<\"extensions.getSelfConfiguration\", Workspace>(request, {\n method: \"get\",\n path: \"/extensions/self/configuration\",\n pathParams: [],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n getSelfStorageEntry: operation<\"extensions.getSelfStorageEntry\", Workspace>(request, {\n method: \"get\",\n path: \"/extensions/self/storage/entry\",\n pathParams: [],\n queryParams: [\"key\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n setSelfStorageEntry: operation<\"extensions.setSelfStorageEntry\", Workspace>(request, {\n method: \"put\",\n path: \"/extensions/self/storage/entry\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n deleteSelfStorageEntry: operation<\"extensions.deleteSelfStorageEntry\", Workspace>(request, {\n method: \"delete\",\n path: \"/extensions/self/storage/entry\",\n pathParams: [],\n queryParams: [\"key\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n listSelfStorageEntries: operation<\"extensions.listSelfStorageEntries\", Workspace>(request, {\n method: \"get\",\n path: \"/extensions/self/storage\",\n pathParams: [],\n queryParams: [\"prefix\", \"after\", \"limit\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n collections: {\n create: operation<\"collections.create\", Workspace>(request, {\n method: \"post\",\n path: \"/collections\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n bulkDelete: operation<\"collections.bulkDelete\", Workspace>(request, {\n method: \"post\",\n path: \"/collections/bulk/delete\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n delete: operation<\"collections.delete\", Workspace>(request, {\n method: \"delete\",\n path: \"/collections/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n update: operation<\"collections.update\", Workspace>(request, {\n method: \"put\",\n path: \"/collections/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n list: operation<\"collections.list\", Workspace>(request, {\n method: \"get\",\n path: \"/collections/list\",\n pathParams: [],\n queryParams: [\"collectionID\", \"collectionPath\", \"collectionSlugPath\", \"cursor\", \"limit\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n content: {\n listCollections: operation<\"content.listCollections\", Workspace>(request, {\n method: \"get\",\n path: \"/content/collections\",\n pathParams: [],\n queryParams: [\n \"cursor\",\n \"limit\",\n \"collectionID\",\n \"collectionPath\",\n \"collectionSlugPath\",\n \"channel\",\n \"snapshotID\"\n ],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n listEntries: operation<\"content.listEntries\", Workspace>(request, {\n method: \"get\",\n path: \"/content/entries\",\n pathParams: [],\n queryParams: [\n \"cursor\",\n \"limit\",\n \"collectionID\",\n \"collectionPath\",\n \"collectionSlugPath\",\n \"channel\",\n \"snapshotID\",\n \"descendants\",\n \"includeContent\",\n \"filters\"\n ],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n getSchema: operation<\"content.getSchema\", Workspace>(request, {\n method: \"get\",\n path: \"/content/entries/schema\",\n pathParams: [],\n queryParams: [\"entryID\", \"path\", \"slugPath\", \"channel\", \"snapshotID\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n getAsset: operation<\"content.getAsset\", Workspace>(request, {\n method: \"get\",\n path: \"/content/assets/{workspaceID}/{snapshotID}/{entryID}/{assetID}/{variant}\",\n pathParams: [\"workspaceID\", \"snapshotID\", \"entryID\", \"assetID\", \"variant\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: true,\n anonymous: true\n }),\n get: operation<\"content.get\", Workspace>(request, {\n method: \"get\",\n path: \"/content/entries/get\",\n pathParams: [],\n queryParams: [\"entryID\", \"path\", \"slugPath\", \"expectedSchemaHash\", \"channel\", \"snapshotID\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n getTree: operation<\"content.getTree\", Workspace>(request, {\n method: \"get\",\n path: \"/content/tree\",\n pathParams: [],\n queryParams: [\n \"collectionID\",\n \"collectionPath\",\n \"collectionSlugPath\",\n \"channel\",\n \"snapshotID\"\n ],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n webhooks: {\n list: operation<\"webhooks.list\", Workspace>(request, {\n method: \"get\",\n path: \"/webhooks\",\n pathParams: [],\n queryParams: [\"cursor\", \"limit\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n create: operation<\"webhooks.create\", Workspace>(request, {\n method: \"post\",\n path: \"/webhooks\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n get: operation<\"webhooks.get\", Workspace>(request, {\n method: \"get\",\n path: \"/webhooks/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n update: operation<\"webhooks.update\", Workspace>(request, {\n method: \"put\",\n path: \"/webhooks/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n delete: operation<\"webhooks.delete\", Workspace>(request, {\n method: \"delete\",\n path: \"/webhooks/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n bulkSetEnabled: operation<\"webhooks.bulkSetEnabled\", Workspace>(request, {\n method: \"post\",\n path: \"/webhooks/bulk/set-enabled\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n bulkDelete: operation<\"webhooks.bulkDelete\", Workspace>(request, {\n method: \"post\",\n path: \"/webhooks/bulk/delete\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n rotateSecret: operation<\"webhooks.rotateSecret\", Workspace>(request, {\n method: \"post\",\n path: \"/webhooks/{id}/rotate-secret\",\n pathParams: [\"id\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n sendTest: operation<\"webhooks.sendTest\", Workspace>(request, {\n method: \"post\",\n path: \"/webhooks/{id}/test\",\n pathParams: [\"id\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n listDeliveries: operation<\"webhooks.listDeliveries\", Workspace>(request, {\n method: \"get\",\n path: \"/webhooks/{id}/deliveries\",\n pathParams: [\"id\"],\n queryParams: [\"cursor\", \"limit\", \"type\", \"state\", \"createdAfter\", \"createdBefore\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n getDelivery: operation<\"webhooks.getDelivery\", Workspace>(request, {\n method: \"get\",\n path: \"/webhooks/{id}/deliveries/{deliveryID}\",\n pathParams: [\"id\", \"deliveryID\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n listRuns: operation<\"webhooks.listRuns\", Workspace>(request, {\n method: \"get\",\n path: \"/webhooks/{id}/deliveries/{deliveryID}/runs\",\n pathParams: [\"id\", \"deliveryID\"],\n queryParams: [\"cursor\", \"limit\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n listAttempts: operation<\"webhooks.listAttempts\", Workspace>(request, {\n method: \"get\",\n path: \"/webhooks/{id}/deliveries/{deliveryID}/runs/{runID}/attempts\",\n pathParams: [\"id\", \"deliveryID\", \"runID\"],\n queryParams: [\"cursor\", \"limit\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n redeliver: operation<\"webhooks.redeliver\", Workspace>(request, {\n method: \"post\",\n path: \"/webhooks/{id}/deliveries/{deliveryID}/redeliver\",\n pathParams: [\"id\", \"deliveryID\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n bulkRedeliver: operation<\"webhooks.bulkRedeliver\", Workspace>(request, {\n method: \"post\",\n path: \"/webhooks/{id}/deliveries/bulk/redeliver\",\n pathParams: [\"id\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n roles: {\n list: operation<\"roles.list\", Workspace>(request, {\n method: \"get\",\n path: \"/roles\",\n pathParams: [],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n create: operation<\"roles.create\", Workspace>(request, {\n method: \"post\",\n path: \"/roles\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n update: operation<\"roles.update\", Workspace>(request, {\n method: \"put\",\n path: \"/roles/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n delete: operation<\"roles.delete\", Workspace>(request, {\n method: \"delete\",\n path: \"/roles/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n search: {\n current: operation<\"search.current\", Workspace>(request, {\n method: \"post\",\n path: \"/search/current\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n published: operation<\"search.published\", Workspace>(request, {\n method: \"post\",\n path: \"/search/published\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n askCurrent: operation<\"search.askCurrent\", Workspace>(request, {\n method: \"post\",\n path: \"/search/current/ask\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n askPublished: operation<\"search.askPublished\", Workspace>(request, {\n method: \"post\",\n path: \"/search/published/ask\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n askCurrentStream: operation<\"search.askCurrentStream\", Workspace>(request, {\n streaming: true,\n method: \"post\",\n path: \"/search/current/ask/stream\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n askPublishedStream: operation<\"search.askPublishedStream\", Workspace>(request, {\n streaming: true,\n method: \"post\",\n path: \"/search/published/ask/stream\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n schemas: {\n create: operation<\"schemas.create\", Workspace>(request, {\n method: \"post\",\n path: \"/collections/{collectionID}/schema\",\n pathParams: [\"collectionID\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n delete: operation<\"schemas.delete\", Workspace>(request, {\n method: \"delete\",\n path: \"/schemas/{schemaID}\",\n pathParams: [\"schemaID\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n getRevision: operation<\"schemas.getRevision\", Workspace>(request, {\n method: \"get\",\n path: \"/schema-revisions/{revisionID}\",\n pathParams: [\"revisionID\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n get: operation<\"schemas.get\", Workspace>(request, {\n method: \"get\",\n path: \"/schemas/collection\",\n pathParams: [],\n queryParams: [\"collectionID\", \"collectionPath\", \"collectionSlugPath\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n apply: operation<\"schemas.apply\", Workspace>(request, {\n method: \"post\",\n path: \"/schemas/{schemaID}/apply\",\n pathParams: [\"schemaID\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n schemaMigrations: {\n listContentLossEntries: operation<\"schemaMigrations.listContentLossEntries\", Workspace>(\n request,\n {\n method: \"get\",\n path: \"/schema-migrations/{id}/content-loss-entries\",\n pathParams: [\"id\"],\n queryParams: [\"cursor\", \"limit\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }\n ),\n getActive: operation<\"schemaMigrations.getActive\", Workspace>(request, {\n method: \"get\",\n path: \"/collections/{collectionID}/schema-migration\",\n pathParams: [\"collectionID\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n get: operation<\"schemaMigrations.get\", Workspace>(request, {\n method: \"get\",\n path: \"/schema-migrations/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n schemaVersions: {\n list: operation<\"schemaVersions.list\", Workspace>(request, {\n method: \"get\",\n path: \"/schemas/{schemaID}/versions\",\n pathParams: [\"schemaID\"],\n queryParams: [\"cursor\", \"limit\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n get: operation<\"schemaVersions.get\", Workspace>(request, {\n method: \"get\",\n path: \"/schema-versions/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n update: operation<\"schemaVersions.update\", Workspace>(request, {\n method: \"patch\",\n path: \"/schema-versions/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n revert: operation<\"schemaVersions.revert\", Workspace>(request, {\n method: \"post\",\n path: \"/schema-versions/{id}/revert\",\n pathParams: [\"id\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n memberships: {\n list: operation<\"memberships.list\", Workspace>(request, {\n method: \"get\",\n path: \"/memberships\",\n pathParams: [],\n queryParams: [\"cursor\", \"limit\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n invite: operation<\"memberships.invite\", Workspace>(request, {\n method: \"post\",\n path: \"/memberships\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n update: operation<\"memberships.update\", Workspace>(request, {\n method: \"patch\",\n path: \"/memberships/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n remove: operation<\"memberships.remove\", Workspace>(request, {\n method: \"delete\",\n path: \"/memberships/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n listInvites: operation<\"memberships.listInvites\", Workspace>(request, {\n method: \"get\",\n path: \"/memberships/invites\",\n pathParams: [],\n queryParams: [\"cursor\", \"limit\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n resendInvite: operation<\"memberships.resendInvite\", Workspace>(request, {\n method: \"post\",\n path: \"/memberships/invites/{id}/resend\",\n pathParams: [\"id\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n revokeInvite: operation<\"memberships.revokeInvite\", Workspace>(request, {\n method: \"delete\",\n path: \"/memberships/invites/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n publishing: {\n setCollection: operation<\"publishing.setCollection\", Workspace>(request, {\n method: \"put\",\n path: \"/publishing/collections/{collectionID}\",\n pathParams: [\"collectionID\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n publishCollection: operation<\"publishing.publishCollection\", Workspace>(request, {\n method: \"post\",\n path: \"/publishing/collections/{collectionID}\",\n pathParams: [\"collectionID\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n unpublishCollection: operation<\"publishing.unpublishCollection\", Workspace>(request, {\n method: \"delete\",\n path: \"/publishing/collections/{collectionID}\",\n pathParams: [\"collectionID\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n bulkSetCollections: operation<\"publishing.bulkSetCollections\", Workspace>(request, {\n method: \"post\",\n path: \"/publishing/collections/bulk/set\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n bulkPublishCollections: operation<\"publishing.bulkPublishCollections\", Workspace>(request, {\n method: \"post\",\n path: \"/publishing/collections/bulk/publish\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n bulkUnpublishCollections: operation<\"publishing.bulkUnpublishCollections\", Workspace>(request, {\n method: \"post\",\n path: \"/publishing/collections/bulk/unpublish\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n publishEntry: operation<\"publishing.publishEntry\", Workspace>(request, {\n method: \"post\",\n path: \"/publishing/entries/{entryID}\",\n pathParams: [\"entryID\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n unpublishEntry: operation<\"publishing.unpublishEntry\", Workspace>(request, {\n method: \"delete\",\n path: \"/publishing/entries/{entryID}\",\n pathParams: [\"entryID\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n bulkPublishEntries: operation<\"publishing.bulkPublishEntries\", Workspace>(request, {\n method: \"post\",\n path: \"/publishing/entries/bulk/publish\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n bulkUnpublishEntries: operation<\"publishing.bulkUnpublishEntries\", Workspace>(request, {\n method: \"post\",\n path: \"/publishing/entries/bulk/unpublish\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n revertChanges: operation<\"publishing.revertChanges\", Workspace>(request, {\n method: \"post\",\n path: \"/publishing/changes/revert\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n getEntryVersion: operation<\"publishing.getEntryVersion\", Workspace>(request, {\n method: \"get\",\n path: \"/publishing/entries/{entryID}/version\",\n pathParams: [\"entryID\"],\n queryParams: [\"channel\", \"expectedSchemaHash\", \"snapshotID\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n listEntryPublications: operation<\"publishing.listEntryPublications\", Workspace>(request, {\n method: \"get\",\n path: \"/publishing/entries/{entryID}/publications\",\n pathParams: [\"entryID\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n listChannels: operation<\"publishing.listChannels\", Workspace>(request, {\n method: \"get\",\n path: \"/publishing/channels\",\n pathParams: [],\n queryParams: [\"includeAssignmentCount\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n createChannel: operation<\"publishing.createChannel\", Workspace>(request, {\n method: \"post\",\n path: \"/publishing/channels\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n getChannelContent: operation<\"publishing.getChannelContent\", Workspace>(request, {\n method: \"get\",\n path: \"/publishing/channels/{channel}/content\",\n pathParams: [\"channel\"],\n queryParams: [\"collectionID\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n deleteChannel: operation<\"publishing.deleteChannel\", Workspace>(request, {\n method: \"delete\",\n path: \"/publishing/channels/{code}\",\n pathParams: [\"code\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n workspaces: {\n list: operation<\"workspaces.list\", Workspace>(request, {\n method: \"get\",\n path: \"/workspaces\",\n pathParams: [],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n versions: {\n create: operation<\"versions.create\", Workspace>(request, {\n method: \"post\",\n path: \"/entries/{entryID}/versions\",\n pathParams: [\"entryID\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n list: operation<\"versions.list\", Workspace>(request, {\n method: \"get\",\n path: \"/entries/{entryID}/versions\",\n pathParams: [\"entryID\"],\n queryParams: [\"cursor\", \"limit\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n get: operation<\"versions.get\", Workspace>(request, {\n method: \"get\",\n path: \"/versions/{id}\",\n pathParams: [\"id\"],\n queryParams: [\"expectedSchemaHash\"],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n update: operation<\"versions.update\", Workspace>(request, {\n method: \"patch\",\n path: \"/versions/{id}\",\n pathParams: [\"id\"],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n revert: operation<\"versions.revert\", Workspace>(request, {\n method: \"post\",\n path: \"/versions/{id}/revert\",\n pathParams: [\"id\"],\n queryParams: [],\n body: false,\n multipart: false,\n binary: false,\n anonymous: false\n })\n },\n typeMetadata: {\n getCurrent: operation<\"typeMetadata.getCurrent\", Workspace>(request, {\n method: \"post\",\n path: \"/type-metadata/current\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n }),\n getPublished: operation<\"typeMetadata.getPublished\", Workspace>(request, {\n method: \"post\",\n path: \"/type-metadata/published\",\n pathParams: [],\n queryParams: [],\n body: true,\n multipart: false,\n binary: false,\n anonymous: false\n })\n }\n});\n\nexport { createResources };\nexport type { APIResources };\n","const wait = (delay: number, signal: AbortSignal): Promise<void> => {\n signal.throwIfAborted();\n\n return new Promise((resolve, reject) => {\n const abort = () => {\n clearTimeout(timer);\n reject(signal.reason);\n };\n const timer = setTimeout(() => {\n signal.removeEventListener(\"abort\", abort);\n resolve();\n }, delay);\n\n signal.addEventListener(\"abort\", abort, { once: true });\n });\n};\nconst retryDelay = (attempt: number, response?: Response): number => {\n const value = response?.headers.get(\"Retry-After\");\n const seconds = value === null || value === undefined ? NaN : Number(value);\n const date = value ? Date.parse(value) : NaN;\n\n if (Number.isFinite(seconds)) return Math.max(0, seconds * 1000);\n if (Number.isFinite(date)) return Math.max(0, date - Date.now());\n\n return Math.min(1000 * 2 ** attempt, 30_000) + Math.random() * 250;\n};\nconst fetchWithRetries = async (\n fetcher: typeof fetch,\n request: Request,\n retries: number\n): Promise<Response> => {\n const signal = request.signal;\n\n for (let attempt = 0; ; attempt += 1) {\n let response: Response;\n\n signal.throwIfAborted();\n\n try {\n response = await fetcher(request.clone());\n } catch (error) {\n if (signal.aborted || attempt >= retries || !(error instanceof TypeError)) {\n throw error;\n }\n\n await wait(retryDelay(attempt), signal);\n continue;\n }\n\n if (attempt >= retries || ![429, 500, 502, 503, 504].includes(response.status)) {\n return response;\n }\n\n const delay = retryDelay(attempt, response);\n\n await response.body?.cancel();\n await wait(delay, signal);\n }\n};\n\nexport { fetchWithRetries };\n","import { createAnswerStream } from \"./answer-stream\";\nimport { createContentClient, type ContentClient } from \"./content-client\";\nimport { serializeQuery } from \"./query\";\nimport createFetchClient from \"openapi-fetch\";\nimport { AndesineAPIError } from \"./error\";\nimport { createResources, type APIResources } from \"./generated/resources\";\nimport { fetchWithRetries } from \"./retry\";\nimport type { OperationDefinition, RequestOptions } from \"./operation\";\nimport type { WorkspaceTypeMap } from \"./workspace\";\n\ninterface AndesineClient<\n Workspace extends WorkspaceTypeMap = WorkspaceTypeMap\n> extends APIResources<Workspace> {\n content: ContentClient<Workspace>;\n /**\n * Bind published-content reads and pagination to an existing snapshot.\n * @param snapshotID - Snapshot ID returned by a published-content response.\n * @returns Content methods, including snapshot-aware entry and collection iterators.\n * No request is made until a method is called or an iterator is consumed.\n * @throws TypeError if a later request supplies a channel or a different snapshot ID.\n */\n atSnapshot(snapshotID: string): ContentClient<Workspace>;\n}\ninterface ClientOptions {\n /** HTTP(S) API root, including any deployment prefix. Defaults to https://api.andesine.app. */\n baseURL?: string;\n /**\n * Bearer API key. Defaults to process.env.ANDESINE_API_KEY when available, read at creation.\n * Pass an empty string to disable this fallback. Keep private keys on your server;\n * the key is omitted on anonymous operations.\n */\n apiKey?: string;\n /** OAuth access token. Disables the API-key environment fallback. Cannot be combined with apiKey.\n * Supply x-workspace-id through headers for workspace operations. The SDK does not refresh tokens.\n */\n accessToken?: string;\n /** Fetch implementation to use instead of globalThis.fetch. */\n fetch?: typeof fetch;\n /** Default headers. Request headers override these; the configured credential supplies Authorization. */\n headers?: HeadersInit;\n /** Timeout in milliseconds, including stream consumption. Defaults to 30,000; 0 disables it. */\n timeout?: number;\n /** Extra attempts for eligible GET failures. Defaults to 0. Other methods are never retried. */\n retries?: number;\n}\ninterface RuntimeEnvironment {\n process?: { env?: { ANDESINE_API_KEY?: string } };\n}\ninterface RuntimeOperation {\n parameters: { path: Record<string, unknown>; query: Record<string, unknown> };\n requestBody?: { content: { \"application/json\": unknown } };\n responses: { 200: { content: { \"application/json\": unknown } } };\n}\n\ntype RuntimePaths = Record<\n string,\n Record<\"get\" | \"post\" | \"put\" | \"patch\" | \"delete\", RuntimeOperation>\n>;\n\n/**\n * Create a typed API client for a hosted or self-hosted Andesine instance.\n *\n * Methods return response data by default. Use response: \"full\" for status and headers,\n * including conditional reads that can return 304. Creation does not make a request.\n * An optional Workspace type map narrows known content selectors at compile time only.\n * It does not choose credentials, a workspace, a channel, or a snapshot, or check response schemas.\n * @param config - Optional API root, credentials, transport, and request defaults.\n * Defaults to https://api.andesine.app and process.env.ANDESINE_API_KEY when available.\n * Runtimes without process.env use no default key. No environment files are loaded.\n * @returns API resources and helpers for published-content snapshots and pagination.\n * @throws TypeError if both credential options are set, or if baseURL is not HTTP(S) or includes credentials, a query, or a fragment.\n * Request failures throw AndesineAPIError; abort and timeout reasons are preserved.\n * @example\n * const client = createClient();\n * const page = await client.content.get({ path: \"/Docs/Welcome\" });\n */\nconst createClient = <Workspace extends WorkspaceTypeMap = WorkspaceTypeMap>(\n config: ClientOptions = {}\n): AndesineClient<Workspace> => {\n const baseURL = (config.baseURL ?? \"https://api.andesine.app\").replace(/\\/+$/, \"\");\n const credential =\n config.accessToken ??\n config.apiKey ??\n (globalThis as RuntimeEnvironment).process?.env?.ANDESINE_API_KEY;\n const url = new URL(baseURL);\n const fetcher = config.fetch ?? globalThis.fetch;\n\n if (config.accessToken !== undefined && config.apiKey !== undefined) {\n throw new TypeError(\"Use either accessToken or apiKey, not both\");\n }\n\n if (\n ![\"http:\", \"https:\"].includes(url.protocol) ||\n url.search ||\n url.hash ||\n url.username ||\n url.password\n ) {\n throw new TypeError(\"baseURL must be an HTTP(S) URL without credentials, query, or fragment\");\n }\n\n const request = async (\n definition: OperationDefinition,\n input: Record<string, unknown>,\n options: RequestOptions = {}\n ) => {\n const controller = new AbortController();\n const signal = options.signal\n ? AbortSignal.any([controller.signal, options.signal])\n : controller.signal;\n const timeout = options.timeout ?? config.timeout ?? 30_000;\n const retries = options.retries ?? config.retries ?? 0;\n const headers = new Headers(config.headers);\n const path = Object.fromEntries(definition.pathParams.map((key) => [key, input[key]]));\n const query = Object.fromEntries(definition.queryParams.map((key) => [key, input[key]]));\n const body = Object.fromEntries(\n Object.entries(input).filter(\n ([key]) => !definition.pathParams.includes(key) && !definition.queryParams.includes(key)\n )\n );\n const client = createFetchClient<RuntimePaths>({\n baseUrl: baseURL,\n querySerializer: serializeQuery\n });\n\n if (!Number.isFinite(timeout) || timeout < 0 || !Number.isInteger(retries) || retries < 0) {\n throw new TypeError(\"timeout and retries must be nonnegative; retries must be an integer\");\n }\n if (query.channel !== undefined && query.snapshotID !== undefined) {\n throw new TypeError(\"Use either channel or snapshotID, not both\");\n }\n\n for (const key of definition.pathParams) {\n if (input[key] === undefined || input[key] === null) {\n throw new TypeError(`Missing path parameter: ${key}`);\n }\n }\n\n new Headers(options.headers).forEach((value, key) => headers.set(key, value));\n\n if (definition.streaming && !headers.has(\"Accept\")) {\n headers.set(\"Accept\", \"text/event-stream\");\n }\n\n if (credential && !definition.anonymous) {\n headers.set(\"Authorization\", `Bearer ${credential}`);\n }\n\n const timer =\n timeout > 0\n ? setTimeout(\n () => controller.abort(new DOMException(\"Request timed out\", \"TimeoutError\")),\n timeout\n )\n : undefined;\n\n let streamOwnsRequest = false;\n\n try {\n const result = await client.request(\n definition.method as keyof RuntimePaths[string],\n definition.path,\n {\n params: { path, query },\n headers,\n signal,\n body: definition.body ? body : undefined,\n parseAs: \"stream\",\n bodySerializer: definition.multipart\n ? (value) => {\n const form = new FormData();\n\n for (const [key, item] of Object.entries(value as Record<string, unknown>)) {\n if (item instanceof Blob) {\n form.append(key, item);\n } else if (item !== undefined) {\n form.append(key, typeof item === \"string\" ? item : JSON.stringify(item));\n }\n }\n\n return form;\n }\n : undefined,\n fetch: (request) =>\n fetchWithRetries(fetcher, request, definition.method === \"get\" ? retries : 0)\n }\n );\n\n const response = result.response;\n\n if (response.status === 304) {\n if (options.response !== \"full\") {\n throw new TypeError(\"Use response: 'full' for conditional requests that can return 304\");\n }\n\n return { status: 304, headers: response.headers, data: undefined, notModified: true };\n }\n if (!response.ok) throw new AndesineAPIError(response, result.error);\n\n if (definition.streaming) {\n const data = createAnswerStream(response, {\n signal,\n cancel: () => controller.abort(),\n cleanup: () => {\n if (timer !== undefined) clearTimeout(timer);\n }\n });\n\n streamOwnsRequest = true;\n\n return options.response === \"full\"\n ? { status: response.status, headers: response.headers, data, notModified: false }\n : data;\n }\n\n const text = definition.binary || response.status === 204 ? undefined : await response.text();\n const data = definition.binary ? await response.blob() : text ? JSON.parse(text) : undefined;\n\n return options.response === \"full\"\n ? { status: response.status, headers: response.headers, data, notModified: false }\n : data;\n } finally {\n if (!streamOwnsRequest && timer !== undefined) clearTimeout(timer);\n }\n };\n const resources = createResources<Workspace>(request);\n\n return {\n ...resources,\n content: createContentClient<Workspace>(resources.content),\n atSnapshot(snapshotID: string) {\n return createContentClient<Workspace>(\n createResources<Workspace>((definition, input, options) => {\n const pinned =\n definition.path.startsWith(\"/content/\") &&\n definition.queryParams.includes(\"snapshotID\");\n\n if (\n pinned &&\n (input.channel !== undefined ||\n (input.snapshotID !== undefined && input.snapshotID !== snapshotID))\n ) {\n throw new TypeError(\"Cannot override a pinned snapshot\");\n }\n\n return request(definition, pinned ? { ...input, snapshotID } : input, options);\n }).content\n );\n }\n };\n};\n\nexport { createClient };\nexport type { AndesineClient, ClientOptions };\n"],"mappings":";;;;;;;;;;;;;;AAoBA,MAAM,gBAAgB,iBACpB,SACA,UAA2B,CAAC,GACT;CACnB,MAAM,OAAO,IAAI,IAAY,QAAQ,SAAS,CAAC,QAAQ,MAAM,IAAI,CAAC,CAAC;CAEnE,IAAI,SAAS,QAAQ;CAErB,GAAG;EACD,MAAM,OAAO,MAAM,QAAQ,MAAM;EACjC,MAAM,OAAO,KAAK,WAAW;EAE7B,IAAI,KAAK,WAAW,YAAY,CAAC,QAAQ,KAAK,IAAI,IAAI,IACpD,MAAM,IAAI,MAAM,kDAAkD;EAGpE,MAAM;EAEN,IAAI,CAAC,KAAK,WAAW,SAAS;EAE9B,KAAK,IAAI,IAAK;EACd,SAAS;CACX,SAAS;AACX;;;;;;;;;;;AAYA,MAAM,WAAW,iBACf,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Y,OAAO,YAAY;IACzD,MAAM,SACJ,WAAW,KAAK,WAAW,WAAW,KACtC,WAAW,YAAY,SAAS,YAAY;IAE9C,IACE,WACC,MAAM,YAAY,KAAA,KAChB,MAAM,eAAe,KAAA,KAAa,MAAM,eAAe,aAE1D,MAAM,IAAI,UAAU,mCAAmC;IAGzD,OAAO,QAAQ,YAAY,SAAS;KAAE,GAAG;KAAO;IAAW,IAAI,OAAO,OAAO;GAC/E,CAAC,CAAC,CAAC,OACL;EACF;CACF;AACF"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { n as ClientOptions, t as AndesineClient } from "./client-C8wt7f3o.js";
|
|
2
|
+
//#region src/extensions/jwt.d.ts
|
|
3
|
+
interface ExtensionPrivateKey extends JsonWebKey {
|
|
4
|
+
kid?: string;
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/extensions.d.ts
|
|
8
|
+
interface ExtensionBackendOptions {
|
|
9
|
+
/** The extension's registry name, e.g. `acme/publish`. */
|
|
10
|
+
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* The private JSON Web Key (a JSON string or an object) whose public key is in the registry:
|
|
13
|
+
* Ed25519 (EdDSA) or P-256 (ES256), with the registry key ID in `kid`. Keep it on the server.
|
|
14
|
+
*/
|
|
15
|
+
privateKey: string | ExtensionPrivateKey;
|
|
16
|
+
/** API URLs of the Andesine instances that the backend works with, e.g. `https://api.andesine.app`. */
|
|
17
|
+
trustedInstances: string[];
|
|
18
|
+
/** Options for the API clients; the backend sets the base URL and the credential. */
|
|
19
|
+
client?: Omit<ClientOptions, "baseURL" | "apiKey" | "accessToken">;
|
|
20
|
+
}
|
|
21
|
+
interface ExtensionSessionContext extends VerifiedSession {
|
|
22
|
+
/** The installation's `ext_` ID. */
|
|
23
|
+
extensionID: string;
|
|
24
|
+
/** The instance API URL. */
|
|
25
|
+
instance: string;
|
|
26
|
+
/** An API client for the installation, with the extension's permissions. */
|
|
27
|
+
client: AndesineClient;
|
|
28
|
+
}
|
|
29
|
+
interface ExtensionDeliveryContext extends ReceivedDelivery {
|
|
30
|
+
/** The installation's `ext_` ID. */
|
|
31
|
+
extensionID: string;
|
|
32
|
+
/** The instance API URL. */
|
|
33
|
+
instance: string;
|
|
34
|
+
/** An API client for the installation, with the extension's permissions. */
|
|
35
|
+
client: AndesineClient;
|
|
36
|
+
}
|
|
37
|
+
interface ExtensionBackend {
|
|
38
|
+
/**
|
|
39
|
+
* An API client for an installation on a trusted instance, authenticated with extension JWTs.
|
|
40
|
+
* Without `extensionID`, the client is app-level: it can only list installations.
|
|
41
|
+
* @throws TypeError if the instance is not trusted.
|
|
42
|
+
*/
|
|
43
|
+
createClient(instance: string, extensionID?: string): AndesineClient;
|
|
44
|
+
/**
|
|
45
|
+
* Verifies a session token from the extension frontend (`backend.fetch` sends the
|
|
46
|
+
* `Authorization`, `Andesine-Extension`, and `Andesine-Instance` headers).
|
|
47
|
+
* @throws ExtensionSessionError if the headers are missing, the instance is not trusted, or
|
|
48
|
+
* the token is invalid or expired. Other API failures throw AndesineAPIError.
|
|
49
|
+
*/
|
|
50
|
+
verifySession(headers: HeaderSource): Promise<ExtensionSessionContext>;
|
|
51
|
+
/**
|
|
52
|
+
* Handles the body of an extension webhook request: checks the instance allowlist and fetches
|
|
53
|
+
* the delivery with the installation's JWT, which confirms the notification. Respond with a
|
|
54
|
+
* 2xx status once the event is handled; other responses are retried.
|
|
55
|
+
* @throws ExtensionNotificationError if the body is invalid, the instance is not trusted, or
|
|
56
|
+
* the delivery does not exist for the installation. Other API failures throw AndesineAPIError.
|
|
57
|
+
*/
|
|
58
|
+
receive(body: unknown): Promise<ExtensionDeliveryContext>;
|
|
59
|
+
}
|
|
60
|
+
type VerifiedSession = Awaited<ReturnType<AndesineClient["extensions"]["verifySession"]>>;
|
|
61
|
+
type ReceivedDelivery = Awaited<ReturnType<AndesineClient["extensions"]["getSelfDelivery"]>>;
|
|
62
|
+
type HeaderSource = Headers | Record<string, string | string[] | undefined>;
|
|
63
|
+
type ExtensionSessionErrorCode = "MISSING_SESSION" | "UNTRUSTED_INSTANCE" | "INVALID_SESSION";
|
|
64
|
+
type ExtensionNotificationErrorCode = "INVALID_NOTIFICATION" | "UNTRUSTED_INSTANCE" | "UNKNOWN_DELIVERY";
|
|
65
|
+
declare class ExtensionSessionError extends Error {
|
|
66
|
+
readonly code: ExtensionSessionErrorCode;
|
|
67
|
+
constructor(code: ExtensionSessionErrorCode);
|
|
68
|
+
}
|
|
69
|
+
declare class ExtensionNotificationError extends Error {
|
|
70
|
+
readonly code: ExtensionNotificationErrorCode;
|
|
71
|
+
constructor(code: ExtensionNotificationErrorCode);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Creates the helpers of an extension backend. They sign and cache extension JWTs, and accept
|
|
75
|
+
* only the trusted instances; the backend stores no per-installation state.
|
|
76
|
+
* @example
|
|
77
|
+
* const extension = createExtensionBackend({
|
|
78
|
+
* name: "acme/publish",
|
|
79
|
+
* privateKey: process.env.ANDESINE_EXTENSION_KEY!,
|
|
80
|
+
* trustedInstances: ["https://api.andesine.app"]
|
|
81
|
+
* });
|
|
82
|
+
* const session = await extension.verifySession(request.headers);
|
|
83
|
+
*/
|
|
84
|
+
declare const createExtensionBackend: (options: ExtensionBackendOptions) => ExtensionBackend;
|
|
85
|
+
//#endregion
|
|
86
|
+
export { type ExtensionBackend, type ExtensionBackendOptions, type ExtensionDeliveryContext, ExtensionNotificationError, type ExtensionNotificationErrorCode, type ExtensionPrivateKey, type ExtensionSessionContext, ExtensionSessionError, type ExtensionSessionErrorCode, createExtensionBackend };
|
|
87
|
+
//# sourceMappingURL=extensions.d.ts.map
|