@vexcms/core 0.1.0-alpha.2 → 0.1.0-alpha.4
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/dist/.build +1 -1
- package/dist/api/client.js +1 -1
- package/dist/api/convex.d.ts +1 -0
- package/dist/api/convex.d.ts.map +1 -1
- package/dist/{chunk-2IB2DCN7.js → chunk-CQUP27YP.js} +1 -1
- package/dist/chunk-CQUP27YP.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2IB2DCN7.js.map +0 -1
package/dist/.build
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1788303128097
|
package/dist/api/client.js
CHANGED
package/dist/api/convex.d.ts
CHANGED
|
@@ -140,6 +140,7 @@ export interface VexRemoveArgs {
|
|
|
140
140
|
export interface VexMediaGenerateUploadUrlArgs {
|
|
141
141
|
[key: string]: unknown;
|
|
142
142
|
adapter: string;
|
|
143
|
+
collection: string;
|
|
143
144
|
}
|
|
144
145
|
/** Return for `api.vex.media.generateUploadUrl`. */
|
|
145
146
|
export interface VexMediaGenerateUploadUrlReturn {
|
package/dist/api/convex.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convex.d.ts","sourceRoot":"","sources":["../../src/api/convex.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,mEAAmE;IACnE,aAAa,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,CAAC,GAAG,EAAE,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,+BAA+B,CAChC;QAED;;;WAGG;sCAC0D,iBAAiB,CAC5E,UAAU,EACV,QAAQ,EACR,+BAA+B,EAC/B,iCAAiC,CAClC;QAED;;;WAGG;8BAC0C,iBAAiB,CAC5D,UAAU,EACV,QAAQ,EACR,uBAAuB,EACvB,yBAAyB,CAC1B;QAED;;;WAGG;yBACgC,iBAAiB,CAClD,OAAO,EACP,QAAQ,EACR,kBAAkB,EAClB,oBAAoB,CACrB;;;sBAI8B,iBAAiB,CAC9C,OAAO,EACP,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,GAAG,IAAI,CACzB;uBACgC,iBAAiB,CAChD,OAAO,EACP,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EAAE,CACpB;yBACoC,iBAAiB,CACpD,UAAU,EACV,QAAQ,EACR,oBAAoB,EACpB,MAAM,CACP;;CAEK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/convex.ts"],"sourcesContent":["import { anyApi } from \"convex/server\";\nimport type { FunctionReference } from \"convex/server\";\nimport type { PaginationOptions, PaginationResult, VexApiAuth } from \"./types\";\nimport { CollectionSlug, VexDocumentGlobal } from \"../types\";\n\n/**\n * Base type for all VexCMS documents as returned from Convex queries.\n *\n * All documents include the Convex system fields `_id` and `_creationTime`,\n * plus whatever field values are defined in the collection's schema.\n *\n * Framework adapters use this as the `initialData` type in view component\n * props — the actual field values are accessed via string keys.\n *\n * @example\n * ```ts\n * const title = typeof doc.title === \"string\" ? doc.title : \"\";\n * ```\n *\n * @see {@link vexConvexApi} for the query functions that return this type\n */\nexport interface VexDocument {\n /** Convex document ID string. */\n _id: string;\n /** Unix timestamp (milliseconds) when the document was created. */\n _creationTime: number;\n /** Field values defined by the collection schema. */\n [key: string]: unknown;\n}\n\n/**\n * Alias for `VexDocument` that also satisfies `Record<string, unknown>`.\n *\n * Use this type when a generic `Record` index signature is required alongside\n * the Convex system fields — for example, as the `data` type in TanStack Table\n * or as the form `defaultValues` record.\n *\n * @see {@link VexDocument} for the base type\n */\nexport type TDocument<TShape = {}> = Record<string, unknown> & TShape & VexDocument;\n\n/**\n * Type for media documents returned from Convex queries.\n *\n * Extends `VexDocument` with all required media fields: alt, filename,\n * mimeType, size, storageId, deleted, src (the file URL), and optional\n * width/height. Use this instead of `TDocument` in media collection views to\n * avoid casting fields like `row.original.src as string`.\n *\n * @example\n * ```ts\n * const src = doc.src; // string | undefined, no cast needed\n * const alt = doc.alt ?? \"\";\n * ```\n *\n * @see {@link TDocument} for the base document type with custom shape support\n */\nexport interface VexMediaDocument extends VexDocument {\n /** Alt text for accessibility and SEO. */\n alt: string;\n /** Original filename of the uploaded file. */\n filename: string;\n /** MIME type (e.g., \"image/jpeg\", \"application/pdf\"). */\n mimeType: string;\n /** File size in bytes. */\n size: number;\n /** Storage adapter ID for the uploaded file. */\n storageId: string;\n /** Whether this media item has been soft-deleted. */\n deleted: boolean;\n /** URL to the file. */\n src: string;\n /** Image width in pixels (if applicable). */\n width?: number;\n /** Image height in pixels (if applicable). */\n height?: number;\n}\n\n// ── Collection API types ───────────────────────────────────────\n//\n// Extracted arg/return shapes for the generic Vex API collection endpoints.\n// Used by `vexConvexApi` below and re-exported for user-side `vex.ts` casts\n// to avoid TS2589 from the deep conditional types in `queryApi()`.\n\n/** Args for `api.vex.find`. */\nexport interface VexFindArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n collection: CollectionSlug;\n populate?: unknown;\n depth?: number;\n limit?: number;\n paginationOpts?: PaginationOptions;\n}\n\n/** Args for `api.vex.find`. */\nexport interface VexFindPaginatedArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n collection: CollectionSlug;\n populate?: unknown;\n depth?: number;\n limit?: number;\n paginationOpts: PaginationOptions;\n}\n\n/** Args for `api.vex.get`. */\nexport interface VexGetArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n collection: string;\n id: string;\n populate?: unknown;\n depth?: number;\n}\n\n/** Args for `api.vex.search`. */\nexport interface VexSearchArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n collection: string;\n searchIndexName: string;\n searchField: string;\n query: string;\n limit?: number;\n populate?: unknown;\n depth?: number;\n paginationOpts?: PaginationOptions;\n}\n\n/** Args for `api.vex.create`. */\nexport interface VexCreateArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n collection: string;\n data: Record<string, unknown>;\n}\n\n/** Args for `api.vex.update`. */\nexport interface VexUpdateArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n collection: string;\n id: string;\n data: Record<string, unknown>;\n}\n\n/** Args for `api.vex.remove`. */\nexport interface VexRemoveArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n collection: string;\n ids: string[];\n softDelete?: string;\n}\n\n// ── Media API shallow types ──────────────────────────────────────────────\n//\n// Arg and return shapes for the generic media endpoints. These mirror the\n// `VexStorageAdapter` method signatures so the types stay in one place.\n\n/** Args for `api.vex.media.generateUploadUrl`. */\nexport interface VexMediaGenerateUploadUrlArgs {\n [key: string]: unknown;\n adapter: string;\n collection: string;\n}\n\n/** Return for `api.vex.media.generateUploadUrl`. */\nexport interface VexMediaGenerateUploadUrlReturn {\n [key: string]: unknown;\n url: string;\n}\n\n/** Args for `api.vex.media.createMediaDocument`. */\nexport interface VexMediaCreateMediaDocumentArgs {\n [key: string]: unknown;\n adapter: string;\n collectionSlug: string;\n storageId: string;\n filename: string;\n mimeType: string;\n size: number;\n alt?: string;\n adapterFields?: Record<string, unknown>;\n}\n\n/** Return for `api.vex.media.createMediaDocument`. */\nexport type VexMediaCreateMediaDocumentReturn = string;\n\n/** Args for `api.vex.media.deleteMedia`. */\nexport interface VexMediaDeleteMediaArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n adapter: string;\n mediaId: string;\n softDelete?: boolean;\n}\n\n/** Return for `api.vex.media.deleteMedia`. */\nexport type VexMediaDeleteMediaReturn = boolean;\n\n/** Args for `api.vex.media.getUrl`. */\nexport interface VexMediaGetUrlArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n adapter: string;\n mediaId: string;\n}\n\n/** Return for `api.vex.media.getUrl`. */\nexport interface VexMediaGetUrlReturn {\n [key: string]: unknown;\n url?: string;\n error?: string;\n}\n\n// ── Media API shallow types ──────────────────────────────────────────────\n\n/** Args for `api.vex.globals.get`. */\nexport interface VexGlobalsGetArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n slug: string;\n populate?: Record<string, unknown>;\n}\n\n/** Args for `api.vex.globals.find`. */\nexport interface VexGlobalsFindArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n}\n\n/** Args for `api.vex.globals.update`. */\nexport interface VexGlobalsUpdateArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n slug: string;\n data: Record<string, unknown>;\n}\n\n/**\n * Typed `anyApi` references to the VexCMS generic Convex collection functions.\n *\n * These point to functions that users copy into `convex/vex/collections.ts`\n * in their project. All paths are fixed under `vex.collections.*`.\n *\n * **Required:** copy `convex/vex/collections.ts` from the VexCMS template\n * into your project before these references will resolve at runtime.\n *\n * Used internally by view components in `@vexcms/react`. Framework adapter\n * authors do not need to import this directly unless building custom views.\n *\n * @example\n * ```ts\n * import { convexQuery } from \"@convex-dev/react-query\";\n * import { useQuery } from \"@tanstack/react-query\";\n * import { vexConvexApi } from \"@vexcms/core\";\n *\n * const { data } = useQuery({\n * ...convexQuery(vexConvexApi.list, { collection: \"posts\" }),\n * });\n * ```\n */\nexport const vexConvexApi = {\n /**\n * Finds documents in a collection.\n * Called by {@link react/src!CollectionListView} in `@vexcms/react`.\n */\n find: anyApi.vex.find as FunctionReference<\n \"query\",\n \"public\",\n VexFindArgs,\n VexDocument[] | PaginationResult<VexDocument>\n >,\n /**\n * Finds documents in a collection with cursor pagination.\n * Called by {@link react/src!CollectionListView} in `@vexcms/react`.\n */\n findPaginated: anyApi.vex.find as FunctionReference<\n \"query\",\n \"public\",\n VexFindPaginatedArgs,\n PaginationResult<VexDocument>\n >,\n\n /**\n * Fetches a single document by ID.\n * Called by {@link react/src!CollectionEditView} in `@vexcms/react` when editing.\n */\n get: anyApi.vex.get as FunctionReference<\"query\", \"public\", VexGetArgs, VexDocument | null>,\n\n /**\n * Creates a new document. Returns the new document's ID as a string.\n */\n create: anyApi.vex.create as FunctionReference<\"mutation\", \"public\", VexCreateArgs, string>,\n\n /**\n * Searches documents in a collection by a search index.\n *\n * Used by `RelationshipFieldInput` in `@vexcms/react` to populate the\n * relationship picker combobox. The `searchIndexName` must match the\n * `.searchIndex()` name in the Convex schema — VexCMS auto-generates\n * `search_<useAsTitle>` when another collection has a relationship here.\n * Pass `query: \"\"` to list recent documents when no search term is entered.\n *\n * @see {@link https://docs.convex.dev/text-search} for Convex search docs\n */\n search: anyApi.vex.search as FunctionReference<\n \"query\",\n \"public\",\n VexSearchArgs,\n VexDocument[] | PaginationResult<VexDocument>\n >,\n\n /**\n * Patches an existing document — unspecified fields are left unchanged.\n */\n update: anyApi.vex.update as FunctionReference<\"mutation\", \"public\", VexUpdateArgs, void>,\n\n /**\n * Permanently deletes a document.\n */\n remove: anyApi.vex.remove as FunctionReference<\"mutation\", \"public\", VexRemoveArgs, void>,\n\n media: {\n /**\n * Generates a URL to upload a file to.\n * Called by `MediaUploadDropzone` in `@vexcms/react`.\n */\n generateUploadUrl: anyApi.vex.media.generateUploadUrl as FunctionReference<\n \"mutation\",\n \"public\",\n VexMediaGenerateUploadUrlArgs,\n VexMediaGenerateUploadUrlReturn\n >,\n\n /**\n * Creates a media document in Convex after the file is uploaded.\n * Called by `MediaUploadDropzone` in `@vexcms/react`.\n */\n createMediaDocument: anyApi.vex.media.createMediaDocument as FunctionReference<\n \"mutation\",\n \"public\",\n VexMediaCreateMediaDocumentArgs,\n VexMediaCreateMediaDocumentReturn\n >,\n\n /**\n * Deletes a media document and its file from storage.\n * Called by `MediaLibrary` in `@vexcms/react`.\n */\n deleteMedia: anyApi.vex.media.deleteMedia as FunctionReference<\n \"mutation\",\n \"public\",\n VexMediaDeleteMediaArgs,\n VexMediaDeleteMediaReturn\n >,\n\n /**\n * Returns a URL for a media file.\n * Called by `UploadFieldCell` in `@vexcms/react`.\n */\n getUrl: anyApi.vex.media.getUrl as FunctionReference<\n \"query\",\n \"public\",\n VexMediaGetUrlArgs,\n VexMediaGetUrlReturn\n >,\n },\n\n globals: {\n get: anyApi.vex.globals.get as FunctionReference<\n \"query\",\n \"public\",\n VexGlobalsGetArgs,\n VexDocumentGlobal | null\n >,\n find: anyApi.vex.globals.find as FunctionReference<\n \"query\",\n \"public\",\n VexGlobalsFindArgs,\n VexDocumentGlobal[]\n >,\n upsert: anyApi.vex.globals.upsert as FunctionReference<\n \"mutation\",\n \"public\",\n VexGlobalsUpdateArgs,\n string\n >,\n },\n} as const;\n"],"mappings":";AAAA,SAAS,cAAc;AAwQhB,IAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA,EAK1B,MAAM,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,EAUjB,eAAe,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,EAW1B,KAAK,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA,EAKhB,QAAQ,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAanB,QAAQ,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA,EAUnB,QAAQ,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA,EAKnB,QAAQ,OAAO,IAAI;AAAA,EAEnB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,mBAAmB,OAAO,IAAI,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,IAWpC,qBAAqB,OAAO,IAAI,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,IAWtC,aAAa,OAAO,IAAI,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,IAW9B,QAAQ,OAAO,IAAI,MAAM;AAAA,EAM3B;AAAA,EAEA,SAAS;AAAA,IACP,KAAK,OAAO,IAAI,QAAQ;AAAA,IAMxB,MAAM,OAAO,IAAI,QAAQ;AAAA,IAMzB,QAAQ,OAAO,IAAI,QAAQ;AAAA,EAM7B;AACF;","names":[]}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/convex.ts"],"sourcesContent":["import { anyApi } from \"convex/server\";\nimport type { FunctionReference } from \"convex/server\";\nimport type { PaginationOptions, PaginationResult, VexApiAuth } from \"./types\";\nimport { CollectionSlug, VexDocumentGlobal } from \"../types\";\n\n/**\n * Base type for all VexCMS documents as returned from Convex queries.\n *\n * All documents include the Convex system fields `_id` and `_creationTime`,\n * plus whatever field values are defined in the collection's schema.\n *\n * Framework adapters use this as the `initialData` type in view component\n * props — the actual field values are accessed via string keys.\n *\n * @example\n * ```ts\n * const title = typeof doc.title === \"string\" ? doc.title : \"\";\n * ```\n *\n * @see {@link vexConvexApi} for the query functions that return this type\n */\nexport interface VexDocument {\n /** Convex document ID string. */\n _id: string;\n /** Unix timestamp (milliseconds) when the document was created. */\n _creationTime: number;\n /** Field values defined by the collection schema. */\n [key: string]: unknown;\n}\n\n/**\n * Alias for `VexDocument` that also satisfies `Record<string, unknown>`.\n *\n * Use this type when a generic `Record` index signature is required alongside\n * the Convex system fields — for example, as the `data` type in TanStack Table\n * or as the form `defaultValues` record.\n *\n * @see {@link VexDocument} for the base type\n */\nexport type TDocument<TShape = {}> = Record<string, unknown> & TShape & VexDocument;\n\n/**\n * Type for media documents returned from Convex queries.\n *\n * Extends `VexDocument` with all required media fields: alt, filename,\n * mimeType, size, storageId, deleted, src (the file URL), and optional\n * width/height. Use this instead of `TDocument` in media collection views to\n * avoid casting fields like `row.original.src as string`.\n *\n * @example\n * ```ts\n * const src = doc.src; // string | undefined, no cast needed\n * const alt = doc.alt ?? \"\";\n * ```\n *\n * @see {@link TDocument} for the base document type with custom shape support\n */\nexport interface VexMediaDocument extends VexDocument {\n /** Alt text for accessibility and SEO. */\n alt: string;\n /** Original filename of the uploaded file. */\n filename: string;\n /** MIME type (e.g., \"image/jpeg\", \"application/pdf\"). */\n mimeType: string;\n /** File size in bytes. */\n size: number;\n /** Storage adapter ID for the uploaded file. */\n storageId: string;\n /** Whether this media item has been soft-deleted. */\n deleted: boolean;\n /** URL to the file. */\n src: string;\n /** Image width in pixels (if applicable). */\n width?: number;\n /** Image height in pixels (if applicable). */\n height?: number;\n}\n\n// ── Collection API types ───────────────────────────────────────\n//\n// Extracted arg/return shapes for the generic Vex API collection endpoints.\n// Used by `vexConvexApi` below and re-exported for user-side `vex.ts` casts\n// to avoid TS2589 from the deep conditional types in `queryApi()`.\n\n/** Args for `api.vex.find`. */\nexport interface VexFindArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n collection: CollectionSlug;\n populate?: unknown;\n depth?: number;\n limit?: number;\n paginationOpts?: PaginationOptions;\n}\n\n/** Args for `api.vex.find`. */\nexport interface VexFindPaginatedArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n collection: CollectionSlug;\n populate?: unknown;\n depth?: number;\n limit?: number;\n paginationOpts: PaginationOptions;\n}\n\n/** Args for `api.vex.get`. */\nexport interface VexGetArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n collection: string;\n id: string;\n populate?: unknown;\n depth?: number;\n}\n\n/** Args for `api.vex.search`. */\nexport interface VexSearchArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n collection: string;\n searchIndexName: string;\n searchField: string;\n query: string;\n limit?: number;\n populate?: unknown;\n depth?: number;\n paginationOpts?: PaginationOptions;\n}\n\n/** Args for `api.vex.create`. */\nexport interface VexCreateArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n collection: string;\n data: Record<string, unknown>;\n}\n\n/** Args for `api.vex.update`. */\nexport interface VexUpdateArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n collection: string;\n id: string;\n data: Record<string, unknown>;\n}\n\n/** Args for `api.vex.remove`. */\nexport interface VexRemoveArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n collection: string;\n ids: string[];\n softDelete?: string;\n}\n\n// ── Media API shallow types ──────────────────────────────────────────────\n//\n// Arg and return shapes for the generic media endpoints. These mirror the\n// `VexStorageAdapter` method signatures so the types stay in one place.\n\n/** Args for `api.vex.media.generateUploadUrl`. */\nexport interface VexMediaGenerateUploadUrlArgs {\n [key: string]: unknown;\n adapter: string;\n}\n\n/** Return for `api.vex.media.generateUploadUrl`. */\nexport interface VexMediaGenerateUploadUrlReturn {\n [key: string]: unknown;\n url: string;\n}\n\n/** Args for `api.vex.media.createMediaDocument`. */\nexport interface VexMediaCreateMediaDocumentArgs {\n [key: string]: unknown;\n adapter: string;\n collectionSlug: string;\n storageId: string;\n filename: string;\n mimeType: string;\n size: number;\n alt?: string;\n adapterFields?: Record<string, unknown>;\n}\n\n/** Return for `api.vex.media.createMediaDocument`. */\nexport type VexMediaCreateMediaDocumentReturn = string;\n\n/** Args for `api.vex.media.deleteMedia`. */\nexport interface VexMediaDeleteMediaArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n adapter: string;\n mediaId: string;\n softDelete?: boolean;\n}\n\n/** Return for `api.vex.media.deleteMedia`. */\nexport type VexMediaDeleteMediaReturn = boolean;\n\n/** Args for `api.vex.media.getUrl`. */\nexport interface VexMediaGetUrlArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n adapter: string;\n mediaId: string;\n}\n\n/** Return for `api.vex.media.getUrl`. */\nexport interface VexMediaGetUrlReturn {\n [key: string]: unknown;\n url?: string;\n error?: string;\n}\n\n// ── Media API shallow types ──────────────────────────────────────────────\n\n/** Args for `api.vex.globals.get`. */\nexport interface VexGlobalsGetArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n slug: string;\n populate?: Record<string, unknown>;\n}\n\n/** Args for `api.vex.globals.find`. */\nexport interface VexGlobalsFindArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n}\n\n/** Args for `api.vex.globals.update`. */\nexport interface VexGlobalsUpdateArgs {\n [key: string]: unknown;\n auth?: VexApiAuth;\n slug: string;\n data: Record<string, unknown>;\n}\n\n/**\n * Typed `anyApi` references to the VexCMS generic Convex collection functions.\n *\n * These point to functions that users copy into `convex/vex/collections.ts`\n * in their project. All paths are fixed under `vex.collections.*`.\n *\n * **Required:** copy `convex/vex/collections.ts` from the VexCMS template\n * into your project before these references will resolve at runtime.\n *\n * Used internally by view components in `@vexcms/react`. Framework adapter\n * authors do not need to import this directly unless building custom views.\n *\n * @example\n * ```ts\n * import { convexQuery } from \"@convex-dev/react-query\";\n * import { useQuery } from \"@tanstack/react-query\";\n * import { vexConvexApi } from \"@vexcms/core\";\n *\n * const { data } = useQuery({\n * ...convexQuery(vexConvexApi.list, { collection: \"posts\" }),\n * });\n * ```\n */\nexport const vexConvexApi = {\n /**\n * Finds documents in a collection.\n * Called by {@link react/src!CollectionListView} in `@vexcms/react`.\n */\n find: anyApi.vex.find as FunctionReference<\n \"query\",\n \"public\",\n VexFindArgs,\n VexDocument[] | PaginationResult<VexDocument>\n >,\n /**\n * Finds documents in a collection with cursor pagination.\n * Called by {@link react/src!CollectionListView} in `@vexcms/react`.\n */\n findPaginated: anyApi.vex.find as FunctionReference<\n \"query\",\n \"public\",\n VexFindPaginatedArgs,\n PaginationResult<VexDocument>\n >,\n\n /**\n * Fetches a single document by ID.\n * Called by {@link react/src!CollectionEditView} in `@vexcms/react` when editing.\n */\n get: anyApi.vex.get as FunctionReference<\"query\", \"public\", VexGetArgs, VexDocument | null>,\n\n /**\n * Creates a new document. Returns the new document's ID as a string.\n */\n create: anyApi.vex.create as FunctionReference<\"mutation\", \"public\", VexCreateArgs, string>,\n\n /**\n * Searches documents in a collection by a search index.\n *\n * Used by `RelationshipFieldInput` in `@vexcms/react` to populate the\n * relationship picker combobox. The `searchIndexName` must match the\n * `.searchIndex()` name in the Convex schema — VexCMS auto-generates\n * `search_<useAsTitle>` when another collection has a relationship here.\n * Pass `query: \"\"` to list recent documents when no search term is entered.\n *\n * @see {@link https://docs.convex.dev/text-search} for Convex search docs\n */\n search: anyApi.vex.search as FunctionReference<\n \"query\",\n \"public\",\n VexSearchArgs,\n VexDocument[] | PaginationResult<VexDocument>\n >,\n\n /**\n * Patches an existing document — unspecified fields are left unchanged.\n */\n update: anyApi.vex.update as FunctionReference<\"mutation\", \"public\", VexUpdateArgs, void>,\n\n /**\n * Permanently deletes a document.\n */\n remove: anyApi.vex.remove as FunctionReference<\"mutation\", \"public\", VexRemoveArgs, void>,\n\n media: {\n /**\n * Generates a URL to upload a file to.\n * Called by `MediaUploadDropzone` in `@vexcms/react`.\n */\n generateUploadUrl: anyApi.vex.media.generateUploadUrl as FunctionReference<\n \"mutation\",\n \"public\",\n VexMediaGenerateUploadUrlArgs,\n VexMediaGenerateUploadUrlReturn\n >,\n\n /**\n * Creates a media document in Convex after the file is uploaded.\n * Called by `MediaUploadDropzone` in `@vexcms/react`.\n */\n createMediaDocument: anyApi.vex.media.createMediaDocument as FunctionReference<\n \"mutation\",\n \"public\",\n VexMediaCreateMediaDocumentArgs,\n VexMediaCreateMediaDocumentReturn\n >,\n\n /**\n * Deletes a media document and its file from storage.\n * Called by `MediaLibrary` in `@vexcms/react`.\n */\n deleteMedia: anyApi.vex.media.deleteMedia as FunctionReference<\n \"mutation\",\n \"public\",\n VexMediaDeleteMediaArgs,\n VexMediaDeleteMediaReturn\n >,\n\n /**\n * Returns a URL for a media file.\n * Called by `UploadFieldCell` in `@vexcms/react`.\n */\n getUrl: anyApi.vex.media.getUrl as FunctionReference<\n \"query\",\n \"public\",\n VexMediaGetUrlArgs,\n VexMediaGetUrlReturn\n >,\n },\n\n globals: {\n get: anyApi.vex.globals.get as FunctionReference<\n \"query\",\n \"public\",\n VexGlobalsGetArgs,\n VexDocumentGlobal | null\n >,\n find: anyApi.vex.globals.find as FunctionReference<\n \"query\",\n \"public\",\n VexGlobalsFindArgs,\n VexDocumentGlobal[]\n >,\n upsert: anyApi.vex.globals.upsert as FunctionReference<\n \"mutation\",\n \"public\",\n VexGlobalsUpdateArgs,\n string\n >,\n },\n} as const;\n"],"mappings":";AAAA,SAAS,cAAc;AAuQhB,IAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA,EAK1B,MAAM,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,EAUjB,eAAe,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,EAW1B,KAAK,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA,EAKhB,QAAQ,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAanB,QAAQ,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA,EAUnB,QAAQ,OAAO,IAAI;AAAA;AAAA;AAAA;AAAA,EAKnB,QAAQ,OAAO,IAAI;AAAA,EAEnB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,mBAAmB,OAAO,IAAI,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,IAWpC,qBAAqB,OAAO,IAAI,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,IAWtC,aAAa,OAAO,IAAI,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,IAW9B,QAAQ,OAAO,IAAI,MAAM;AAAA,EAM3B;AAAA,EAEA,SAAS;AAAA,IACP,KAAK,OAAO,IAAI,QAAQ;AAAA,IAMxB,MAAM,OAAO,IAAI,QAAQ;AAAA,IAMzB,QAAQ,OAAO,IAAI,QAAQ;AAAA,EAM7B;AACF;","names":[]}
|