convex-cms 0.0.1
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/cli/commands/admin.d.ts +16 -0
- package/dist/cli/commands/admin.d.ts.map +1 -0
- package/dist/cli/commands/admin.js +88 -0
- package/dist/cli/commands/admin.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +18 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/utils/detectConvexUrl.d.ts +13 -0
- package/dist/cli/utils/detectConvexUrl.d.ts.map +1 -0
- package/dist/cli/utils/detectConvexUrl.js +48 -0
- package/dist/cli/utils/detectConvexUrl.js.map +1 -0
- package/dist/cli/utils/openBrowser.d.ts +7 -0
- package/dist/cli/utils/openBrowser.d.ts.map +1 -0
- package/dist/cli/utils/openBrowser.js +17 -0
- package/dist/cli/utils/openBrowser.js.map +1 -0
- package/dist/client/admin-config.d.ts +126 -0
- package/dist/client/admin-config.d.ts.map +1 -0
- package/dist/client/admin-config.js +117 -0
- package/dist/client/admin-config.js.map +1 -0
- package/dist/client/adminApi.d.ts +2273 -0
- package/dist/client/adminApi.d.ts.map +1 -0
- package/dist/client/adminApi.js +716 -0
- package/dist/client/adminApi.js.map +1 -0
- package/dist/client/agentTools.d.ts +933 -0
- package/dist/client/agentTools.d.ts.map +1 -0
- package/dist/client/agentTools.js +1004 -0
- package/dist/client/agentTools.js.map +1 -0
- package/dist/client/argTypes.d.ts +212 -0
- package/dist/client/argTypes.d.ts.map +1 -0
- package/dist/client/argTypes.js +5 -0
- package/dist/client/argTypes.js.map +1 -0
- package/dist/client/field-types.d.ts +55 -0
- package/dist/client/field-types.d.ts.map +1 -0
- package/dist/client/field-types.js +152 -0
- package/dist/client/field-types.js.map +1 -0
- package/dist/client/index.d.ts +189 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +668 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/queryBuilder.d.ts +765 -0
- package/dist/client/queryBuilder.d.ts.map +1 -0
- package/dist/client/queryBuilder.js +970 -0
- package/dist/client/queryBuilder.js.map +1 -0
- package/dist/client/schema/codegen.d.ts +128 -0
- package/dist/client/schema/codegen.d.ts.map +1 -0
- package/dist/client/schema/codegen.js +318 -0
- package/dist/client/schema/codegen.js.map +1 -0
- package/dist/client/schema/defineContentType.d.ts +221 -0
- package/dist/client/schema/defineContentType.d.ts.map +1 -0
- package/dist/client/schema/defineContentType.js +380 -0
- package/dist/client/schema/defineContentType.js.map +1 -0
- package/dist/client/schema/index.d.ts +85 -0
- package/dist/client/schema/index.d.ts.map +1 -0
- package/dist/client/schema/index.js +92 -0
- package/dist/client/schema/index.js.map +1 -0
- package/dist/client/schema/schemaDrift.d.ts +199 -0
- package/dist/client/schema/schemaDrift.d.ts.map +1 -0
- package/dist/client/schema/schemaDrift.js +340 -0
- package/dist/client/schema/schemaDrift.js.map +1 -0
- package/dist/client/schema/typedClient.d.ts +401 -0
- package/dist/client/schema/typedClient.d.ts.map +1 -0
- package/dist/client/schema/typedClient.js +269 -0
- package/dist/client/schema/typedClient.js.map +1 -0
- package/dist/client/schema/types.d.ts +477 -0
- package/dist/client/schema/types.d.ts.map +1 -0
- package/dist/client/schema/types.js +39 -0
- package/dist/client/schema/types.js.map +1 -0
- package/dist/client/types.d.ts +449 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +149 -0
- package/dist/client/types.js.map +1 -0
- package/dist/client/workflows.d.ts +51 -0
- package/dist/client/workflows.d.ts.map +1 -0
- package/dist/client/workflows.js +103 -0
- package/dist/client/workflows.js.map +1 -0
- package/dist/client/wrapper.d.ts +2198 -0
- package/dist/client/wrapper.d.ts.map +1 -0
- package/dist/client/wrapper.js +2651 -0
- package/dist/client/wrapper.js.map +1 -0
- package/dist/component/_generated/api.d.ts +124 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/dist/component/_generated/api.js +31 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +4321 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +46 -0
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +121 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +78 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/auditLog.d.ts +410 -0
- package/dist/component/auditLog.d.ts.map +1 -0
- package/dist/component/auditLog.js +607 -0
- package/dist/component/auditLog.js.map +1 -0
- package/dist/component/authorization.d.ts +323 -0
- package/dist/component/authorization.d.ts.map +1 -0
- package/dist/component/authorization.js +464 -0
- package/dist/component/authorization.js.map +1 -0
- package/dist/component/authorizationHooks.d.ts +184 -0
- package/dist/component/authorizationHooks.d.ts.map +1 -0
- package/dist/component/authorizationHooks.js +521 -0
- package/dist/component/authorizationHooks.js.map +1 -0
- package/dist/component/bulkOperations.d.ts +200 -0
- package/dist/component/bulkOperations.d.ts.map +1 -0
- package/dist/component/bulkOperations.js +568 -0
- package/dist/component/bulkOperations.js.map +1 -0
- package/dist/component/contentEntries.d.ts +719 -0
- package/dist/component/contentEntries.d.ts.map +1 -0
- package/dist/component/contentEntries.js +1617 -0
- package/dist/component/contentEntries.js.map +1 -0
- package/dist/component/contentEntryMutations.d.ts +505 -0
- package/dist/component/contentEntryMutations.d.ts.map +1 -0
- package/dist/component/contentEntryMutations.js +1009 -0
- package/dist/component/contentEntryMutations.js.map +1 -0
- package/dist/component/contentEntryValidation.d.ts +115 -0
- package/dist/component/contentEntryValidation.d.ts.map +1 -0
- package/dist/component/contentEntryValidation.js +546 -0
- package/dist/component/contentEntryValidation.js.map +1 -0
- package/dist/component/contentLock.d.ts +328 -0
- package/dist/component/contentLock.d.ts.map +1 -0
- package/dist/component/contentLock.js +471 -0
- package/dist/component/contentLock.js.map +1 -0
- package/dist/component/contentTypeMigration.d.ts +411 -0
- package/dist/component/contentTypeMigration.d.ts.map +1 -0
- package/dist/component/contentTypeMigration.js +805 -0
- package/dist/component/contentTypeMigration.js.map +1 -0
- package/dist/component/contentTypeMutations.d.ts +975 -0
- package/dist/component/contentTypeMutations.d.ts.map +1 -0
- package/dist/component/contentTypeMutations.js +768 -0
- package/dist/component/contentTypeMutations.js.map +1 -0
- package/dist/component/contentTypes.d.ts +538 -0
- package/dist/component/contentTypes.d.ts.map +1 -0
- package/dist/component/contentTypes.js +304 -0
- package/dist/component/contentTypes.js.map +1 -0
- package/dist/component/convex.config.d.ts +42 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +43 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/documentTypes.d.ts +186 -0
- package/dist/component/documentTypes.d.ts.map +1 -0
- package/dist/component/documentTypes.js +23 -0
- package/dist/component/documentTypes.js.map +1 -0
- package/dist/component/eventEmitter.d.ts +281 -0
- package/dist/component/eventEmitter.d.ts.map +1 -0
- package/dist/component/eventEmitter.js +300 -0
- package/dist/component/eventEmitter.js.map +1 -0
- package/dist/component/exportImport.d.ts +1120 -0
- package/dist/component/exportImport.d.ts.map +1 -0
- package/dist/component/exportImport.js +931 -0
- package/dist/component/exportImport.js.map +1 -0
- package/dist/component/index.d.ts +28 -0
- package/dist/component/index.d.ts.map +1 -0
- package/dist/component/index.js +142 -0
- package/dist/component/index.js.map +1 -0
- package/dist/component/lib/deepReferenceResolver.d.ts +252 -0
- package/dist/component/lib/deepReferenceResolver.d.ts.map +1 -0
- package/dist/component/lib/deepReferenceResolver.js +601 -0
- package/dist/component/lib/deepReferenceResolver.js.map +1 -0
- package/dist/component/lib/errors.d.ts +306 -0
- package/dist/component/lib/errors.d.ts.map +1 -0
- package/dist/component/lib/errors.js +407 -0
- package/dist/component/lib/errors.js.map +1 -0
- package/dist/component/lib/index.d.ts +10 -0
- package/dist/component/lib/index.d.ts.map +1 -0
- package/dist/component/lib/index.js +33 -0
- package/dist/component/lib/index.js.map +1 -0
- package/dist/component/lib/mediaReferenceResolver.d.ts +217 -0
- package/dist/component/lib/mediaReferenceResolver.d.ts.map +1 -0
- package/dist/component/lib/mediaReferenceResolver.js +326 -0
- package/dist/component/lib/mediaReferenceResolver.js.map +1 -0
- package/dist/component/lib/metadataExtractor.d.ts +245 -0
- package/dist/component/lib/metadataExtractor.d.ts.map +1 -0
- package/dist/component/lib/metadataExtractor.js +548 -0
- package/dist/component/lib/metadataExtractor.js.map +1 -0
- package/dist/component/lib/mutationAuth.d.ts +95 -0
- package/dist/component/lib/mutationAuth.d.ts.map +1 -0
- package/dist/component/lib/mutationAuth.js +146 -0
- package/dist/component/lib/mutationAuth.js.map +1 -0
- package/dist/component/lib/queries.d.ts +17 -0
- package/dist/component/lib/queries.d.ts.map +1 -0
- package/dist/component/lib/queries.js +49 -0
- package/dist/component/lib/queries.js.map +1 -0
- package/dist/component/lib/ragContentChunker.d.ts +423 -0
- package/dist/component/lib/ragContentChunker.d.ts.map +1 -0
- package/dist/component/lib/ragContentChunker.js +897 -0
- package/dist/component/lib/ragContentChunker.js.map +1 -0
- package/dist/component/lib/referenceResolver.d.ts +175 -0
- package/dist/component/lib/referenceResolver.d.ts.map +1 -0
- package/dist/component/lib/referenceResolver.js +293 -0
- package/dist/component/lib/referenceResolver.js.map +1 -0
- package/dist/component/lib/slugGenerator.d.ts +71 -0
- package/dist/component/lib/slugGenerator.d.ts.map +1 -0
- package/dist/component/lib/slugGenerator.js +207 -0
- package/dist/component/lib/slugGenerator.js.map +1 -0
- package/dist/component/lib/slugUniqueness.d.ts +131 -0
- package/dist/component/lib/slugUniqueness.d.ts.map +1 -0
- package/dist/component/lib/slugUniqueness.js +229 -0
- package/dist/component/lib/slugUniqueness.js.map +1 -0
- package/dist/component/lib/softDelete.d.ts +18 -0
- package/dist/component/lib/softDelete.d.ts.map +1 -0
- package/dist/component/lib/softDelete.js +29 -0
- package/dist/component/lib/softDelete.js.map +1 -0
- package/dist/component/localeFallbackChain.d.ts +410 -0
- package/dist/component/localeFallbackChain.d.ts.map +1 -0
- package/dist/component/localeFallbackChain.js +467 -0
- package/dist/component/localeFallbackChain.js.map +1 -0
- package/dist/component/localeFields.d.ts +508 -0
- package/dist/component/localeFields.d.ts.map +1 -0
- package/dist/component/localeFields.js +592 -0
- package/dist/component/localeFields.js.map +1 -0
- package/dist/component/mediaAssetMutations.d.ts +235 -0
- package/dist/component/mediaAssetMutations.d.ts.map +1 -0
- package/dist/component/mediaAssetMutations.js +558 -0
- package/dist/component/mediaAssetMutations.js.map +1 -0
- package/dist/component/mediaAssets.d.ts +168 -0
- package/dist/component/mediaAssets.d.ts.map +1 -0
- package/dist/component/mediaAssets.js +618 -0
- package/dist/component/mediaAssets.js.map +1 -0
- package/dist/component/mediaFolderMutations.d.ts +642 -0
- package/dist/component/mediaFolderMutations.d.ts.map +1 -0
- package/dist/component/mediaFolderMutations.js +849 -0
- package/dist/component/mediaFolderMutations.js.map +1 -0
- package/dist/component/mediaUploadMutations.d.ts +136 -0
- package/dist/component/mediaUploadMutations.d.ts.map +1 -0
- package/dist/component/mediaUploadMutations.js +205 -0
- package/dist/component/mediaUploadMutations.js.map +1 -0
- package/dist/component/mediaVariantMutations.d.ts +468 -0
- package/dist/component/mediaVariantMutations.d.ts.map +1 -0
- package/dist/component/mediaVariantMutations.js +737 -0
- package/dist/component/mediaVariantMutations.js.map +1 -0
- package/dist/component/mediaVariants.d.ts +525 -0
- package/dist/component/mediaVariants.d.ts.map +1 -0
- package/dist/component/mediaVariants.js +661 -0
- package/dist/component/mediaVariants.js.map +1 -0
- package/dist/component/ragContentIndexer.d.ts +595 -0
- package/dist/component/ragContentIndexer.d.ts.map +1 -0
- package/dist/component/ragContentIndexer.js +794 -0
- package/dist/component/ragContentIndexer.js.map +1 -0
- package/dist/component/rateLimitHooks.d.ts +266 -0
- package/dist/component/rateLimitHooks.d.ts.map +1 -0
- package/dist/component/rateLimitHooks.js +412 -0
- package/dist/component/rateLimitHooks.js.map +1 -0
- package/dist/component/roles.d.ts +649 -0
- package/dist/component/roles.d.ts.map +1 -0
- package/dist/component/roles.js +884 -0
- package/dist/component/roles.js.map +1 -0
- package/dist/component/scheduledPublish.d.ts +182 -0
- package/dist/component/scheduledPublish.d.ts.map +1 -0
- package/dist/component/scheduledPublish.js +304 -0
- package/dist/component/scheduledPublish.js.map +1 -0
- package/dist/component/schema.d.ts +4114 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +469 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/component/taxonomies.d.ts +476 -0
- package/dist/component/taxonomies.d.ts.map +1 -0
- package/dist/component/taxonomies.js +785 -0
- package/dist/component/taxonomies.js.map +1 -0
- package/dist/component/taxonomyMutations.d.ts +206 -0
- package/dist/component/taxonomyMutations.d.ts.map +1 -0
- package/dist/component/taxonomyMutations.js +1001 -0
- package/dist/component/taxonomyMutations.js.map +1 -0
- package/dist/component/trash.d.ts +265 -0
- package/dist/component/trash.d.ts.map +1 -0
- package/dist/component/trash.js +621 -0
- package/dist/component/trash.js.map +1 -0
- package/dist/component/types.d.ts +4 -0
- package/dist/component/types.d.ts.map +1 -0
- package/dist/component/types.js +2 -0
- package/dist/component/types.js.map +1 -0
- package/dist/component/userContext.d.ts +508 -0
- package/dist/component/userContext.d.ts.map +1 -0
- package/dist/component/userContext.js +615 -0
- package/dist/component/userContext.js.map +1 -0
- package/dist/component/validation.d.ts +387 -0
- package/dist/component/validation.d.ts.map +1 -0
- package/dist/component/validation.js +1052 -0
- package/dist/component/validation.js.map +1 -0
- package/dist/component/validators.d.ts +4645 -0
- package/dist/component/validators.d.ts.map +1 -0
- package/dist/component/validators.js +641 -0
- package/dist/component/validators.js.map +1 -0
- package/dist/component/versionMutations.d.ts +216 -0
- package/dist/component/versionMutations.d.ts.map +1 -0
- package/dist/component/versionMutations.js +321 -0
- package/dist/component/versionMutations.js.map +1 -0
- package/dist/component/webhookTrigger.d.ts +770 -0
- package/dist/component/webhookTrigger.d.ts.map +1 -0
- package/dist/component/webhookTrigger.js +1413 -0
- package/dist/component/webhookTrigger.js.map +1 -0
- package/dist/react/index.d.ts +316 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +558 -0
- package/dist/react/index.js.map +1 -0
- package/dist/test.d.ts +2230 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/test.js +1107 -0
- package/dist/test.js.map +1 -0
- package/package.json +95 -0
- package/src/cli/commands/admin.ts +104 -0
- package/src/cli/index.ts +21 -0
- package/src/cli/utils/detectConvexUrl.ts +54 -0
- package/src/cli/utils/openBrowser.ts +16 -0
- package/src/client/admin-config.ts +138 -0
- package/src/client/adminApi.ts +942 -0
- package/src/client/agentTools.ts +1311 -0
- package/src/client/argTypes.ts +316 -0
- package/src/client/field-types.ts +187 -0
- package/src/client/index.ts +1301 -0
- package/src/client/queryBuilder.ts +1100 -0
- package/src/client/schema/codegen.ts +500 -0
- package/src/client/schema/defineContentType.ts +501 -0
- package/src/client/schema/index.ts +169 -0
- package/src/client/schema/schemaDrift.ts +574 -0
- package/src/client/schema/typedClient.ts +688 -0
- package/src/client/schema/types.ts +666 -0
- package/src/client/types.ts +723 -0
- package/src/client/workflows.ts +141 -0
- package/src/client/wrapper.ts +4304 -0
- package/src/component/_generated/api.ts +140 -0
- package/src/component/_generated/component.ts +5029 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +156 -0
- package/src/component/authorization.ts +647 -0
- package/src/component/authorizationHooks.ts +668 -0
- package/src/component/bulkOperations.ts +687 -0
- package/src/component/contentEntries.ts +1976 -0
- package/src/component/contentEntryMutations.ts +1223 -0
- package/src/component/contentEntryValidation.ts +707 -0
- package/src/component/contentLock.ts +550 -0
- package/src/component/contentTypeMigration.ts +1064 -0
- package/src/component/contentTypeMutations.ts +969 -0
- package/src/component/contentTypes.ts +346 -0
- package/src/component/convex.config.ts +44 -0
- package/src/component/documentTypes.ts +240 -0
- package/src/component/eventEmitter.ts +485 -0
- package/src/component/exportImport.ts +1169 -0
- package/src/component/index.ts +491 -0
- package/src/component/lib/deepReferenceResolver.ts +999 -0
- package/src/component/lib/errors.ts +816 -0
- package/src/component/lib/index.ts +145 -0
- package/src/component/lib/mediaReferenceResolver.ts +495 -0
- package/src/component/lib/metadataExtractor.ts +792 -0
- package/src/component/lib/mutationAuth.ts +199 -0
- package/src/component/lib/queries.ts +79 -0
- package/src/component/lib/ragContentChunker.ts +1371 -0
- package/src/component/lib/referenceResolver.ts +430 -0
- package/src/component/lib/slugGenerator.ts +262 -0
- package/src/component/lib/slugUniqueness.ts +333 -0
- package/src/component/lib/softDelete.ts +44 -0
- package/src/component/localeFallbackChain.ts +673 -0
- package/src/component/localeFields.ts +896 -0
- package/src/component/mediaAssetMutations.ts +725 -0
- package/src/component/mediaAssets.ts +932 -0
- package/src/component/mediaFolderMutations.ts +1046 -0
- package/src/component/mediaUploadMutations.ts +224 -0
- package/src/component/mediaVariantMutations.ts +900 -0
- package/src/component/mediaVariants.ts +793 -0
- package/src/component/ragContentIndexer.ts +1067 -0
- package/src/component/rateLimitHooks.ts +572 -0
- package/src/component/roles.ts +1360 -0
- package/src/component/scheduledPublish.ts +358 -0
- package/src/component/schema.ts +617 -0
- package/src/component/taxonomies.ts +949 -0
- package/src/component/taxonomyMutations.ts +1210 -0
- package/src/component/trash.ts +724 -0
- package/src/component/userContext.ts +898 -0
- package/src/component/validation.ts +1388 -0
- package/src/component/validators.ts +949 -0
- package/src/component/versionMutations.ts +392 -0
- package/src/component/webhookTrigger.ts +1922 -0
- package/src/react/index.ts +898 -0
- package/src/test.ts +1580 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content Type Query Functions
|
|
3
|
+
*
|
|
4
|
+
* Provides query functions for retrieving content type definitions from the CMS.
|
|
5
|
+
* Content types are schema blueprints that define the structure of content entries.
|
|
6
|
+
*
|
|
7
|
+
* Available queries:
|
|
8
|
+
* - `get`: Retrieve a single content type by ID or name
|
|
9
|
+
* - `list`: List all content types with optional filtering, sorting, and pagination
|
|
10
|
+
*/
|
|
11
|
+
import { v } from "convex/values";
|
|
12
|
+
import { isDeleted } from "./lib/softDelete.js";
|
|
13
|
+
import { paginationOptsValidator } from "convex/server";
|
|
14
|
+
import { query } from "./_generated/server.js";
|
|
15
|
+
import { contentTypeDoc } from "./validators.js";
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// Constants
|
|
18
|
+
// =============================================================================
|
|
19
|
+
/**
|
|
20
|
+
* Default number of items per page when not specified.
|
|
21
|
+
*/
|
|
22
|
+
const DEFAULT_NUM_ITEMS = 50;
|
|
23
|
+
/**
|
|
24
|
+
* Maximum items per page to prevent excessive data fetching.
|
|
25
|
+
*/
|
|
26
|
+
const MAX_NUM_ITEMS = 250;
|
|
27
|
+
// =============================================================================
|
|
28
|
+
// Get Content Type Query
|
|
29
|
+
// =============================================================================
|
|
30
|
+
/**
|
|
31
|
+
* Arguments for retrieving a single content type.
|
|
32
|
+
*
|
|
33
|
+
* Either `id` or `name` must be provided, but not both.
|
|
34
|
+
* - Use `id` for direct document lookup (most efficient)
|
|
35
|
+
* - Use `name` for lookup by machine-readable name (uses by_name index)
|
|
36
|
+
*/
|
|
37
|
+
const getContentTypeArgs = v.object({
|
|
38
|
+
/** The ID of the content type to retrieve (direct lookup) */
|
|
39
|
+
id: v.optional(v.id("contentTypes")),
|
|
40
|
+
/** The machine-readable name of the content type (e.g., "blog_post") */
|
|
41
|
+
name: v.optional(v.string()),
|
|
42
|
+
/** Whether to include soft-deleted content types (default: false) */
|
|
43
|
+
includeDeleted: v.optional(v.boolean()),
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Query to retrieve a single content type by ID or name.
|
|
47
|
+
*
|
|
48
|
+
* Returns the full content type definition including all field configurations.
|
|
49
|
+
* This is useful for:
|
|
50
|
+
* - Loading a content type's schema before creating entries
|
|
51
|
+
* - Displaying content type information in admin interfaces
|
|
52
|
+
* - Validating content against the type's field definitions
|
|
53
|
+
*
|
|
54
|
+
* @param id - The content type ID for direct lookup (most efficient)
|
|
55
|
+
* @param name - The machine-readable name for index-based lookup
|
|
56
|
+
* @param includeDeleted - Whether to return soft-deleted types (default: false)
|
|
57
|
+
*
|
|
58
|
+
* @returns The content type document, or null if not found
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* // Get by ID (fastest - direct document lookup)
|
|
63
|
+
* const type = await ctx.runQuery(api.contentTypes.get, {
|
|
64
|
+
* id: contentTypeId,
|
|
65
|
+
* });
|
|
66
|
+
*
|
|
67
|
+
* // Get by name (uses by_name index)
|
|
68
|
+
* const blogType = await ctx.runQuery(api.contentTypes.get, {
|
|
69
|
+
* name: "blog_post",
|
|
70
|
+
* });
|
|
71
|
+
*
|
|
72
|
+
* // Access field definitions
|
|
73
|
+
* if (blogType) {
|
|
74
|
+
* console.log("Fields:", blogType.fields);
|
|
75
|
+
* console.log("Is singleton:", blogType.singleton);
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export const get = query({
|
|
80
|
+
args: getContentTypeArgs.fields,
|
|
81
|
+
returns: v.union(contentTypeDoc, v.null()),
|
|
82
|
+
handler: async (ctx, args) => {
|
|
83
|
+
const { id, name, includeDeleted = false } = args;
|
|
84
|
+
// Validate that at least one identifier is provided
|
|
85
|
+
if (!id && !name) {
|
|
86
|
+
// Return null if neither id nor name is provided
|
|
87
|
+
// This matches the pattern used in other get functions
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
let contentType;
|
|
91
|
+
// Lookup by ID (direct document access - O(1))
|
|
92
|
+
if (id) {
|
|
93
|
+
contentType = await ctx.db.get(id);
|
|
94
|
+
}
|
|
95
|
+
// Lookup by name using the by_name index
|
|
96
|
+
else if (name) {
|
|
97
|
+
contentType = await ctx.db
|
|
98
|
+
.query("contentTypes")
|
|
99
|
+
.withIndex("by_name", (q) => q.eq("name", name))
|
|
100
|
+
.first();
|
|
101
|
+
}
|
|
102
|
+
// Return null if not found
|
|
103
|
+
if (!contentType) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
// Filter out soft-deleted types unless explicitly requested
|
|
107
|
+
if (!includeDeleted && isDeleted(contentType)) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
return contentType;
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
// =============================================================================
|
|
114
|
+
// List Content Types Query
|
|
115
|
+
// =============================================================================
|
|
116
|
+
/**
|
|
117
|
+
* Sort field options for content type listing.
|
|
118
|
+
*/
|
|
119
|
+
const sortByValidator = v.optional(v.union(v.literal("name"), v.literal("createdAt")));
|
|
120
|
+
/**
|
|
121
|
+
* Sort direction options.
|
|
122
|
+
*/
|
|
123
|
+
const sortDirectionValidator = v.optional(v.union(v.literal("asc"), v.literal("desc")));
|
|
124
|
+
/**
|
|
125
|
+
* Arguments for listing content types with filtering and pagination.
|
|
126
|
+
*/
|
|
127
|
+
const listContentTypesArgs = v.object({
|
|
128
|
+
/** Filter by active status: true = active only, false = inactive only, undefined = all */
|
|
129
|
+
isActive: v.optional(v.boolean()),
|
|
130
|
+
/** Whether to include soft-deleted content types (default: false) */
|
|
131
|
+
includeDeleted: v.optional(v.boolean()),
|
|
132
|
+
/** Field to sort by: "name" (alphabetical) or "createdAt" (by creation date). Default: "name" */
|
|
133
|
+
sortBy: sortByValidator,
|
|
134
|
+
/** Sort direction: "asc" (ascending) or "desc" (descending). Default: "asc" for name, "desc" for createdAt */
|
|
135
|
+
sortDirection: sortDirectionValidator,
|
|
136
|
+
/**
|
|
137
|
+
* Pagination options using standard Convex pagination format.
|
|
138
|
+
* Compatible with usePaginatedQuery hook on the client.
|
|
139
|
+
* If not provided, returns all matching results (non-paginated).
|
|
140
|
+
*/
|
|
141
|
+
paginationOpts: v.optional(paginationOptsValidator),
|
|
142
|
+
});
|
|
143
|
+
/**
|
|
144
|
+
* Paginated response using standard Convex PaginationResult format.
|
|
145
|
+
*/
|
|
146
|
+
const paginatedContentTypesResponse = v.object({
|
|
147
|
+
/** Array of content type documents for this page */
|
|
148
|
+
page: v.array(contentTypeDoc),
|
|
149
|
+
/** Cursor for fetching the next page (pass to next query's paginationOpts.cursor) */
|
|
150
|
+
continueCursor: v.union(v.string(), v.null()),
|
|
151
|
+
/** Whether this is the last page (no more results) */
|
|
152
|
+
isDone: v.boolean(),
|
|
153
|
+
});
|
|
154
|
+
/**
|
|
155
|
+
* Query to list all defined content types with optional filtering and sorting.
|
|
156
|
+
*
|
|
157
|
+
* Returns content type definitions sorted by name (alphabetically) or creation date.
|
|
158
|
+
* Supports filtering by active status, soft-delete status, and cursor-based pagination.
|
|
159
|
+
*
|
|
160
|
+
* **Index Usage:**
|
|
161
|
+
* - When filtering by `isActive`: Uses the `by_active` index for efficient filtering
|
|
162
|
+
* - Without active filter: Performs a table scan (acceptable since content types are few)
|
|
163
|
+
*
|
|
164
|
+
* **Sorting Behavior:**
|
|
165
|
+
* - `sortBy: "name"` (default): Sorts alphabetically by the machine-readable name
|
|
166
|
+
* - `sortBy: "createdAt"`: Sorts by creation timestamp
|
|
167
|
+
* - Default sort direction is "asc" for name, "desc" for createdAt
|
|
168
|
+
*
|
|
169
|
+
* @param isActive - Optional filter: true = active only, false = inactive only, undefined = all
|
|
170
|
+
* @param includeDeleted - Whether to include soft-deleted types (default: false)
|
|
171
|
+
* @param sortBy - Sort field: "name" (default) or "createdAt"
|
|
172
|
+
* @param sortDirection - Sort direction: "asc" or "desc"
|
|
173
|
+
* @param paginationOpts - Optional Convex pagination options (numItems, cursor)
|
|
174
|
+
*
|
|
175
|
+
* @returns PaginationResult with page, continueCursor, and isDone
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```typescript
|
|
179
|
+
* // List all active content types sorted by name (most common use case)
|
|
180
|
+
* const { page, continueCursor, isDone } = await ctx.runQuery(
|
|
181
|
+
* components.convexCms.contentTypes.list,
|
|
182
|
+
* {
|
|
183
|
+
* isActive: true,
|
|
184
|
+
* paginationOpts: { numItems: 20 },
|
|
185
|
+
* }
|
|
186
|
+
* );
|
|
187
|
+
*
|
|
188
|
+
* // List all content types sorted by creation date (newest first)
|
|
189
|
+
* const newest = await ctx.runQuery(
|
|
190
|
+
* components.convexCms.contentTypes.list,
|
|
191
|
+
* {
|
|
192
|
+
* sortBy: "createdAt",
|
|
193
|
+
* sortDirection: "desc",
|
|
194
|
+
* paginationOpts: { numItems: 10 },
|
|
195
|
+
* }
|
|
196
|
+
* );
|
|
197
|
+
*
|
|
198
|
+
* // List inactive content types only (for admin cleanup views)
|
|
199
|
+
* const inactive = await ctx.runQuery(
|
|
200
|
+
* components.convexCms.contentTypes.list,
|
|
201
|
+
* {
|
|
202
|
+
* isActive: false,
|
|
203
|
+
* paginationOpts: { numItems: 50 },
|
|
204
|
+
* }
|
|
205
|
+
* );
|
|
206
|
+
*
|
|
207
|
+
* // Paginate through results using cursor
|
|
208
|
+
* const page2 = await ctx.runQuery(
|
|
209
|
+
* components.convexCms.contentTypes.list,
|
|
210
|
+
* {
|
|
211
|
+
* isActive: true,
|
|
212
|
+
* paginationOpts: {
|
|
213
|
+
* numItems: 20,
|
|
214
|
+
* cursor: previousResult.continueCursor,
|
|
215
|
+
* },
|
|
216
|
+
* }
|
|
217
|
+
* );
|
|
218
|
+
*
|
|
219
|
+
* // Use with usePaginatedQuery React hook
|
|
220
|
+
* const { results, status, loadMore } = usePaginatedQuery(
|
|
221
|
+
* api.contentTypes.list,
|
|
222
|
+
* { isActive: true, sortBy: "name" },
|
|
223
|
+
* { initialNumItems: 20 }
|
|
224
|
+
* );
|
|
225
|
+
*
|
|
226
|
+
* // Non-paginated mode (returns all matching content types)
|
|
227
|
+
* const allTypes = await ctx.runQuery(
|
|
228
|
+
* components.convexCms.contentTypes.list,
|
|
229
|
+
* { isActive: true }
|
|
230
|
+
* );
|
|
231
|
+
* console.log("Total types:", allTypes.page.length);
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
export const list = query({
|
|
235
|
+
args: listContentTypesArgs.fields,
|
|
236
|
+
returns: paginatedContentTypesResponse,
|
|
237
|
+
handler: async (ctx, args) => {
|
|
238
|
+
const { isActive, includeDeleted = false, sortBy = "name", sortDirection, paginationOpts, } = args;
|
|
239
|
+
// Determine default sort direction based on sortBy field
|
|
240
|
+
// For name sorting, ascending (A-Z) is most intuitive
|
|
241
|
+
// For date sorting, descending (newest first) is most intuitive
|
|
242
|
+
const resolvedSortDirection = sortDirection ?? (sortBy === "name" ? "asc" : "desc");
|
|
243
|
+
// Clamp numItems to valid range if pagination is requested
|
|
244
|
+
const numItems = paginationOpts
|
|
245
|
+
? Math.min(Math.max(1, paginationOpts.numItems ?? DEFAULT_NUM_ITEMS), MAX_NUM_ITEMS)
|
|
246
|
+
: MAX_NUM_ITEMS; // When not paginating, fetch up to max
|
|
247
|
+
// Build and execute query - choose strategy based on isActive filter
|
|
248
|
+
let results;
|
|
249
|
+
if (isActive !== undefined) {
|
|
250
|
+
// Use by_active index for efficient filtering by active status
|
|
251
|
+
results = await ctx.db
|
|
252
|
+
.query("contentTypes")
|
|
253
|
+
.withIndex("by_active", (q) => q.eq("isActive", isActive))
|
|
254
|
+
.collect();
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
// Fetch all content types (no filter)
|
|
258
|
+
results = await ctx.db.query("contentTypes").collect();
|
|
259
|
+
}
|
|
260
|
+
// Filter out soft-deleted types unless explicitly requested
|
|
261
|
+
if (!includeDeleted) {
|
|
262
|
+
results = results.filter((ct) => !isDeleted(ct));
|
|
263
|
+
}
|
|
264
|
+
// Apply sorting based on sortBy parameter
|
|
265
|
+
if (sortBy === "name") {
|
|
266
|
+
// Sort alphabetically by name (case-insensitive)
|
|
267
|
+
results.sort((a, b) => {
|
|
268
|
+
const nameA = a.name.toLowerCase();
|
|
269
|
+
const nameB = b.name.toLowerCase();
|
|
270
|
+
const comparison = nameA.localeCompare(nameB);
|
|
271
|
+
return resolvedSortDirection === "asc" ? comparison : -comparison;
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
// Sort by creation time
|
|
276
|
+
results.sort((a, b) => {
|
|
277
|
+
const comparison = a._creationTime - b._creationTime;
|
|
278
|
+
return resolvedSortDirection === "asc" ? comparison : -comparison;
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
// Handle cursor-based pagination
|
|
282
|
+
let startIndex = 0;
|
|
283
|
+
const cursor = paginationOpts?.cursor;
|
|
284
|
+
if (cursor) {
|
|
285
|
+
// Find the index of the cursor in results
|
|
286
|
+
const cursorIndex = results.findIndex((ct) => ct._id === cursor);
|
|
287
|
+
if (cursorIndex !== -1) {
|
|
288
|
+
startIndex = cursorIndex + 1;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
// Get the page of results (fetch one extra to determine if there's more)
|
|
292
|
+
const pageResults = results.slice(startIndex, startIndex + numItems + 1);
|
|
293
|
+
const isDone = pageResults.length <= numItems;
|
|
294
|
+
const page = isDone ? pageResults : pageResults.slice(0, numItems);
|
|
295
|
+
// Calculate continuation cursor
|
|
296
|
+
const continueCursor = !isDone && page.length > 0 ? page[page.length - 1]._id : null;
|
|
297
|
+
return {
|
|
298
|
+
page,
|
|
299
|
+
continueCursor,
|
|
300
|
+
isDone,
|
|
301
|
+
};
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
//# sourceMappingURL=contentTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentTypes.js","sourceRoot":"","sources":["../../src/component/contentTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,O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AC;IACH,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convex CMS Component
|
|
3
|
+
*
|
|
4
|
+
* A developer-first content management system component with:
|
|
5
|
+
* - Content type definitions with typed fields
|
|
6
|
+
* - Content versioning and publishing workflows
|
|
7
|
+
* - Media asset management
|
|
8
|
+
* - Flexible RBAC
|
|
9
|
+
* - Built-in AI tools for content management
|
|
10
|
+
*
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // In your app's convex/convex.config.ts:
|
|
15
|
+
* import { defineApp } from "convex/server";
|
|
16
|
+
* import convexCms from "@convex-cms/core/convex.config";
|
|
17
|
+
*
|
|
18
|
+
* const app = defineApp();
|
|
19
|
+
* app.use(convexCms);
|
|
20
|
+
*
|
|
21
|
+
* export default app;
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Using the component with configuration:
|
|
27
|
+
* import { createCmsClient, type ComponentConfig } from "@convex-cms/core";
|
|
28
|
+
*
|
|
29
|
+
* const config: ComponentConfig = {
|
|
30
|
+
* defaultLocale: "en-US",
|
|
31
|
+
* features: {
|
|
32
|
+
* versioning: true,
|
|
33
|
+
* localization: true,
|
|
34
|
+
* },
|
|
35
|
+
* };
|
|
36
|
+
*
|
|
37
|
+
* export const cms = createCmsClient(components.convexCms, config);
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare const component: import("convex/server").ComponentDefinition<any>;
|
|
41
|
+
export default component;
|
|
42
|
+
//# sourceMappingURL=convex.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,QAAA,MAAM,SAAS,kDAA+B,CAAC;AAE/C,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineComponent } from "convex/server";
|
|
2
|
+
/**
|
|
3
|
+
* Convex CMS Component
|
|
4
|
+
*
|
|
5
|
+
* A developer-first content management system component with:
|
|
6
|
+
* - Content type definitions with typed fields
|
|
7
|
+
* - Content versioning and publishing workflows
|
|
8
|
+
* - Media asset management
|
|
9
|
+
* - Flexible RBAC
|
|
10
|
+
* - Built-in AI tools for content management
|
|
11
|
+
*
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // In your app's convex/convex.config.ts:
|
|
16
|
+
* import { defineApp } from "convex/server";
|
|
17
|
+
* import convexCms from "@convex-cms/core/convex.config";
|
|
18
|
+
*
|
|
19
|
+
* const app = defineApp();
|
|
20
|
+
* app.use(convexCms);
|
|
21
|
+
*
|
|
22
|
+
* export default app;
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* // Using the component with configuration:
|
|
28
|
+
* import { createCmsClient, type ComponentConfig } from "@convex-cms/core";
|
|
29
|
+
*
|
|
30
|
+
* const config: ComponentConfig = {
|
|
31
|
+
* defaultLocale: "en-US",
|
|
32
|
+
* features: {
|
|
33
|
+
* versioning: true,
|
|
34
|
+
* localization: true,
|
|
35
|
+
* },
|
|
36
|
+
* };
|
|
37
|
+
*
|
|
38
|
+
* export const cms = createCmsClient(components.convexCms, config);
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
const component = defineComponent("convexCms");
|
|
42
|
+
export default component;
|
|
43
|
+
//# sourceMappingURL=convex.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convex.config.js","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,SAAS,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;AAE/C,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derived TypeScript Types for CMS Documents
|
|
3
|
+
*
|
|
4
|
+
* This module provides TypeScript types derived from validators using Convex's `Infer<>`.
|
|
5
|
+
* These types are the single source of truth for document shapes throughout the codebase.
|
|
6
|
+
*
|
|
7
|
+
* Two type variants are provided:
|
|
8
|
+
* 1. **Internal types** (with `Id<TableName>`) - For use within Convex functions
|
|
9
|
+
* 2. **Client types** (with `string` IDs) - For use at API boundaries where IDs are serialized
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Internal use (within Convex functions)
|
|
14
|
+
* import type { ContentTypeInternal } from "./documentTypes.js";
|
|
15
|
+
* const type: ContentTypeInternal = await ctx.db.get(id);
|
|
16
|
+
*
|
|
17
|
+
* // Client use (API boundary)
|
|
18
|
+
* import type { ContentType } from "./documentTypes.js";
|
|
19
|
+
* const type: ContentType = await cms.contentTypes.get(ctx, { id });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
import type { Infer } from "convex/values";
|
|
23
|
+
import type { GenericId } from "convex/values";
|
|
24
|
+
import * as validators from "./validators.js";
|
|
25
|
+
/**
|
|
26
|
+
* Recursively converts all `Id<T>` types to `string` for API boundary serialization.
|
|
27
|
+
* This is used when passing documents from Convex functions to client code,
|
|
28
|
+
* where Convex IDs are serialized as strings.
|
|
29
|
+
*/
|
|
30
|
+
export type StringifyIds<T> = T extends GenericId<infer _TableName> ? string : T extends (infer U)[] ? StringifyIds<U>[] : T extends Record<string, unknown> ? {
|
|
31
|
+
[K in keyof T]: StringifyIds<T[K]>;
|
|
32
|
+
} : T;
|
|
33
|
+
/**
|
|
34
|
+
* Content type document - internal use with typed IDs.
|
|
35
|
+
*/
|
|
36
|
+
export type ContentTypeInternal = Infer<typeof validators.contentTypeDoc>;
|
|
37
|
+
/**
|
|
38
|
+
* Content entry document - internal use with typed IDs.
|
|
39
|
+
*/
|
|
40
|
+
export type ContentEntryInternal = Infer<typeof validators.contentEntryDoc>;
|
|
41
|
+
/**
|
|
42
|
+
* Content version document - internal use with typed IDs.
|
|
43
|
+
*/
|
|
44
|
+
export type ContentVersionInternal = Infer<typeof validators.contentVersionDoc>;
|
|
45
|
+
/**
|
|
46
|
+
* Media item document (unified asset/folder) - internal use with typed IDs.
|
|
47
|
+
*/
|
|
48
|
+
export type MediaItemInternal = Infer<typeof validators.mediaItemDoc>;
|
|
49
|
+
/**
|
|
50
|
+
* Media asset document - internal use with typed IDs.
|
|
51
|
+
* Extracts only the asset variant from the MediaItem union.
|
|
52
|
+
*/
|
|
53
|
+
export type MediaAssetInternal = Extract<MediaItemInternal, {
|
|
54
|
+
kind: "asset";
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Media folder document - internal use with typed IDs.
|
|
58
|
+
* Extracts only the folder variant from the MediaItem union.
|
|
59
|
+
*/
|
|
60
|
+
export type MediaFolderInternal = Extract<MediaItemInternal, {
|
|
61
|
+
kind: "folder";
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* Media variant document - internal use with typed IDs.
|
|
65
|
+
*/
|
|
66
|
+
export type MediaVariantInternal = Infer<typeof validators.mediaVariantDoc>;
|
|
67
|
+
/**
|
|
68
|
+
* Taxonomy document - internal use with typed IDs.
|
|
69
|
+
*/
|
|
70
|
+
export type TaxonomyInternal = Infer<typeof validators.taxonomyDoc>;
|
|
71
|
+
/**
|
|
72
|
+
* Taxonomy term document - internal use with typed IDs.
|
|
73
|
+
*/
|
|
74
|
+
export type TaxonomyTermInternal = Infer<typeof validators.taxonomyTermDoc>;
|
|
75
|
+
/**
|
|
76
|
+
* Content entry tag junction - internal use with typed IDs.
|
|
77
|
+
*/
|
|
78
|
+
export type ContentEntryTagInternal = Infer<typeof validators.contentEntryTagDoc>;
|
|
79
|
+
/**
|
|
80
|
+
* CMS event document - internal use with typed IDs.
|
|
81
|
+
*/
|
|
82
|
+
export type CmsEventInternal = Infer<typeof validators.cmsEventDoc>;
|
|
83
|
+
/**
|
|
84
|
+
* Trash config document - internal use with typed IDs.
|
|
85
|
+
*/
|
|
86
|
+
export type TrashConfigInternal = Infer<typeof validators.trashConfigDoc>;
|
|
87
|
+
/**
|
|
88
|
+
* Webhook config document - internal use with typed IDs.
|
|
89
|
+
*/
|
|
90
|
+
export type WebhookConfigInternal = Infer<typeof validators.webhookConfigDoc>;
|
|
91
|
+
/**
|
|
92
|
+
* Webhook delivery document - internal use with typed IDs.
|
|
93
|
+
*/
|
|
94
|
+
export type WebhookDeliveryInternal = Infer<typeof validators.webhookDeliveryDoc>;
|
|
95
|
+
/**
|
|
96
|
+
* Content type - client-facing with string IDs.
|
|
97
|
+
*/
|
|
98
|
+
export type ContentType = StringifyIds<ContentTypeInternal>;
|
|
99
|
+
/**
|
|
100
|
+
* Content entry - client-facing with string IDs.
|
|
101
|
+
*/
|
|
102
|
+
export type ContentEntry = StringifyIds<ContentEntryInternal>;
|
|
103
|
+
/**
|
|
104
|
+
* Content version - client-facing with string IDs.
|
|
105
|
+
*/
|
|
106
|
+
export type ContentVersion = StringifyIds<ContentVersionInternal>;
|
|
107
|
+
/**
|
|
108
|
+
* Media item (unified asset/folder) - client-facing with string IDs.
|
|
109
|
+
*/
|
|
110
|
+
export type MediaItem = StringifyIds<MediaItemInternal>;
|
|
111
|
+
/**
|
|
112
|
+
* Media asset - client-facing with string IDs.
|
|
113
|
+
* Extracts only the asset variant from the MediaItem union.
|
|
114
|
+
*/
|
|
115
|
+
export type MediaAsset = Extract<MediaItem, {
|
|
116
|
+
kind: "asset";
|
|
117
|
+
}>;
|
|
118
|
+
/**
|
|
119
|
+
* Media folder - client-facing with string IDs.
|
|
120
|
+
* Extracts only the folder variant from the MediaItem union.
|
|
121
|
+
*/
|
|
122
|
+
export type MediaFolder = Extract<MediaItem, {
|
|
123
|
+
kind: "folder";
|
|
124
|
+
}>;
|
|
125
|
+
/**
|
|
126
|
+
* Media variant - client-facing with string IDs.
|
|
127
|
+
*/
|
|
128
|
+
export type MediaVariant = StringifyIds<MediaVariantInternal>;
|
|
129
|
+
/**
|
|
130
|
+
* Taxonomy - client-facing with string IDs.
|
|
131
|
+
*/
|
|
132
|
+
export type Taxonomy = StringifyIds<TaxonomyInternal>;
|
|
133
|
+
/**
|
|
134
|
+
* Taxonomy term - client-facing with string IDs.
|
|
135
|
+
*/
|
|
136
|
+
export type TaxonomyTerm = StringifyIds<TaxonomyTermInternal>;
|
|
137
|
+
/**
|
|
138
|
+
* Content entry tag - client-facing with string IDs.
|
|
139
|
+
*/
|
|
140
|
+
export type ContentEntryTag = StringifyIds<ContentEntryTagInternal>;
|
|
141
|
+
/**
|
|
142
|
+
* CMS event - client-facing with string IDs.
|
|
143
|
+
*/
|
|
144
|
+
export type CmsEvent = StringifyIds<CmsEventInternal>;
|
|
145
|
+
/**
|
|
146
|
+
* Trash config - client-facing with string IDs.
|
|
147
|
+
*/
|
|
148
|
+
export type TrashConfig = StringifyIds<TrashConfigInternal>;
|
|
149
|
+
/**
|
|
150
|
+
* Webhook config - client-facing with string IDs.
|
|
151
|
+
*/
|
|
152
|
+
export type WebhookConfig = StringifyIds<WebhookConfigInternal>;
|
|
153
|
+
/**
|
|
154
|
+
* Webhook delivery - client-facing with string IDs.
|
|
155
|
+
*/
|
|
156
|
+
export type WebhookDelivery = StringifyIds<WebhookDeliveryInternal>;
|
|
157
|
+
/**
|
|
158
|
+
* Internal field definition type (with typed IDs).
|
|
159
|
+
*/
|
|
160
|
+
export type FieldDefinitionInternal = Infer<typeof validators.fieldDefinitionValidator>;
|
|
161
|
+
/**
|
|
162
|
+
* Client-facing field definition type (IDs as strings).
|
|
163
|
+
* Used at the API boundary where Convex IDs are serialized as strings.
|
|
164
|
+
*/
|
|
165
|
+
export type FieldDefinition = StringifyIds<FieldDefinitionInternal>;
|
|
166
|
+
/**
|
|
167
|
+
* Media variant with resolved URL.
|
|
168
|
+
*/
|
|
169
|
+
export type MediaVariantWithUrl = MediaVariant & {
|
|
170
|
+
url: string | null;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Trash item with deletion metadata.
|
|
174
|
+
*/
|
|
175
|
+
export type TrashItem = ContentEntry & {
|
|
176
|
+
deletedDaysAgo: number;
|
|
177
|
+
expiresAt?: number;
|
|
178
|
+
contentTypeName?: string;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Taxonomy term with children (for hierarchical display).
|
|
182
|
+
*/
|
|
183
|
+
export type TaxonomyTermWithChildren = TaxonomyTerm & {
|
|
184
|
+
children: TaxonomyTermWithChildren[];
|
|
185
|
+
};
|
|
186
|
+
//# sourceMappingURL=documentTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentTypes.d.ts","sourceRoot":"","sources":["../../src/component/documentTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAM9C;;;;GAIG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,CAAC,MAAM,UAAU,CAAC,GAChE,MAAM,GACN,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACpB,YAAY,CAAC,CAAC,CAAC,EAAE,GACjB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACtC,CAAC,CAAC;AAMP;;GAEG;AACH,MAAM,MAA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AAY,CAAC,uBAAuB,CAAC,CAAC;AAMpE;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,wBAAwB,CAAC,CAAC;AAExF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,uBAAuB,CAAC,CAAC;AAMpE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG;IAChD,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG;IACrD,QAAQ,EAAE,wBAAwB,EAAE,CAAC;CACrC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derived TypeScript Types for CMS Documents
|
|
3
|
+
*
|
|
4
|
+
* This module provides TypeScript types derived from validators using Convex's `Infer<>`.
|
|
5
|
+
* These types are the single source of truth for document shapes throughout the codebase.
|
|
6
|
+
*
|
|
7
|
+
* Two type variants are provided:
|
|
8
|
+
* 1. **Internal types** (with `Id<TableName>`) - For use within Convex functions
|
|
9
|
+
* 2. **Client types** (with `string` IDs) - For use at API boundaries where IDs are serialized
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Internal use (within Convex functions)
|
|
14
|
+
* import type { ContentTypeInternal } from "./documentTypes.js";
|
|
15
|
+
* const type: ContentTypeInternal = await ctx.db.get(id);
|
|
16
|
+
*
|
|
17
|
+
* // Client use (API boundary)
|
|
18
|
+
* import type { ContentType } from "./documentTypes.js";
|
|
19
|
+
* const type: ContentType = await cms.contentTypes.get(ctx, { id });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=documentTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentTypes.js","sourceRoot":"","sources":["../../src/component/documentTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG"}
|