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,411 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content Type Migration Utility
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities to safely migrate content when content type schemas change.
|
|
5
|
+
* Handles field additions, removals, renames, and type changes with data
|
|
6
|
+
* transformation functions.
|
|
7
|
+
*
|
|
8
|
+
* Key features:
|
|
9
|
+
* - Dry-run mode to preview changes before committing
|
|
10
|
+
* - Custom transformation functions for type conversions
|
|
11
|
+
* - Field renaming support
|
|
12
|
+
* - Default value assignment for new fields
|
|
13
|
+
* - Version snapshot creation for rollback capability
|
|
14
|
+
* - Batch processing to respect Convex transaction limits
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Migrate content when changing a field from text to number
|
|
19
|
+
* const result = await ctx.runMutation(api.contentTypeMigration.migrateContentType, {
|
|
20
|
+
* contentTypeId: typeId,
|
|
21
|
+
* migrations: [
|
|
22
|
+
* {
|
|
23
|
+
* type: "TRANSFORM_FIELD",
|
|
24
|
+
* fieldName: "price",
|
|
25
|
+
* transformation: "TEXT_TO_NUMBER",
|
|
26
|
+
* },
|
|
27
|
+
* {
|
|
28
|
+
* type: "RENAME_FIELD",
|
|
29
|
+
* oldFieldName: "desc",
|
|
30
|
+
* newFieldName: "description",
|
|
31
|
+
* },
|
|
32
|
+
* {
|
|
33
|
+
* type: "ADD_FIELD",
|
|
34
|
+
* fieldName: "featured",
|
|
35
|
+
* defaultValue: false,
|
|
36
|
+
* },
|
|
37
|
+
* ],
|
|
38
|
+
* dryRun: true, // Preview changes first
|
|
39
|
+
* migratedBy: currentUserId,
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
import { Id } from "./_generated/dataModel.js";
|
|
44
|
+
/**
|
|
45
|
+
* Supported migration operation types.
|
|
46
|
+
*/
|
|
47
|
+
export type MigrationOperationType = "ADD_FIELD" | "REMOVE_FIELD" | "RENAME_FIELD" | "TRANSFORM_FIELD" | "SET_DEFAULT";
|
|
48
|
+
/**
|
|
49
|
+
* Built-in transformation types for common type conversions.
|
|
50
|
+
*/
|
|
51
|
+
export type BuiltInTransformation = "TEXT_TO_NUMBER" | "NUMBER_TO_TEXT" | "TEXT_TO_BOOLEAN" | "BOOLEAN_TO_TEXT" | "TEXT_TO_DATE" | "DATE_TO_TEXT" | "TEXT_TO_JSON" | "JSON_TO_TEXT" | "SINGLE_TO_ARRAY" | "ARRAY_TO_SINGLE" | "SELECT_VALUE_REMAP";
|
|
52
|
+
/**
|
|
53
|
+
* A migration operation to be applied to content entries.
|
|
54
|
+
*/
|
|
55
|
+
export interface MigrationOperation {
|
|
56
|
+
/** Type of migration operation */
|
|
57
|
+
type: MigrationOperationType;
|
|
58
|
+
/** Field name for ADD_FIELD, REMOVE_FIELD, TRANSFORM_FIELD, SET_DEFAULT */
|
|
59
|
+
fieldName?: string;
|
|
60
|
+
/** Old field name for RENAME_FIELD */
|
|
61
|
+
oldFieldName?: string;
|
|
62
|
+
/** New field name for RENAME_FIELD */
|
|
63
|
+
newFieldName?: string;
|
|
64
|
+
/** Default value for ADD_FIELD or SET_DEFAULT */
|
|
65
|
+
defaultValue?: unknown;
|
|
66
|
+
/** Built-in transformation type */
|
|
67
|
+
transformation?: BuiltInTransformation;
|
|
68
|
+
/** Custom transformation function as a string (for advanced use) */
|
|
69
|
+
customTransformation?: string;
|
|
70
|
+
/** Value mapping for SELECT_VALUE_REMAP transformation */
|
|
71
|
+
valueMap?: Record<string, unknown>;
|
|
72
|
+
/** Whether to preserve null/undefined values (don't apply default) */
|
|
73
|
+
preserveEmpty?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Result of migrating a single entry.
|
|
77
|
+
*/
|
|
78
|
+
export interface EntryMigrationResult {
|
|
79
|
+
/** Entry ID */
|
|
80
|
+
entryId: Id<"contentEntries">;
|
|
81
|
+
/** Entry slug for identification */
|
|
82
|
+
slug: string;
|
|
83
|
+
/** Whether migration succeeded */
|
|
84
|
+
success: boolean;
|
|
85
|
+
/** Error message if failed */
|
|
86
|
+
error?: string;
|
|
87
|
+
/** Changes made to this entry (for dry run preview) */
|
|
88
|
+
changes?: FieldChange[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Describes a change to a single field.
|
|
92
|
+
*/
|
|
93
|
+
export interface FieldChange {
|
|
94
|
+
/** Field name that was changed */
|
|
95
|
+
fieldName: string;
|
|
96
|
+
/** Operation that caused the change */
|
|
97
|
+
operation: MigrationOperationType;
|
|
98
|
+
/** Previous value (for preview) */
|
|
99
|
+
oldValue?: unknown;
|
|
100
|
+
/** New value (for preview) */
|
|
101
|
+
newValue?: unknown;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Result of the migration operation.
|
|
105
|
+
*/
|
|
106
|
+
export interface MigrationResult {
|
|
107
|
+
/** Whether this was a dry run */
|
|
108
|
+
dryRun: boolean;
|
|
109
|
+
/** Total entries processed */
|
|
110
|
+
totalEntries: number;
|
|
111
|
+
/** Entries successfully migrated */
|
|
112
|
+
successCount: number;
|
|
113
|
+
/** Entries that failed migration */
|
|
114
|
+
failureCount: number;
|
|
115
|
+
/** Entries skipped (no changes needed) */
|
|
116
|
+
skippedCount: number;
|
|
117
|
+
/** Detailed results per entry */
|
|
118
|
+
results: EntryMigrationResult[];
|
|
119
|
+
/** Version snapshots created (IDs) */
|
|
120
|
+
versionSnapshotsCreated: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Apply migration operations to a single entry's data.
|
|
124
|
+
*
|
|
125
|
+
* @param data - The current entry data
|
|
126
|
+
* @param operations - Migration operations to apply
|
|
127
|
+
* @param dryRun - If true, only compute changes without modifying
|
|
128
|
+
* @returns Object containing the migrated data and list of changes
|
|
129
|
+
*/
|
|
130
|
+
export declare function applyMigrations(data: Record<string, unknown>, operations: MigrationOperation[]): {
|
|
131
|
+
migratedData: Record<string, unknown>;
|
|
132
|
+
changes: FieldChange[];
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Validator for a migration operation.
|
|
136
|
+
*/
|
|
137
|
+
export declare const migrationOperationValidator: import("convex/values").VObject<{
|
|
138
|
+
defaultValue?: any;
|
|
139
|
+
fieldName?: string | undefined;
|
|
140
|
+
oldFieldName?: string | undefined;
|
|
141
|
+
newFieldName?: string | undefined;
|
|
142
|
+
transformation?: "TEXT_TO_NUMBER" | "NUMBER_TO_TEXT" | "TEXT_TO_BOOLEAN" | "BOOLEAN_TO_TEXT" | "TEXT_TO_DATE" | "DATE_TO_TEXT" | "TEXT_TO_JSON" | "JSON_TO_TEXT" | "SINGLE_TO_ARRAY" | "ARRAY_TO_SINGLE" | "SELECT_VALUE_REMAP" | undefined;
|
|
143
|
+
customTransformation?: string | undefined;
|
|
144
|
+
valueMap?: any;
|
|
145
|
+
preserveEmpty?: boolean | undefined;
|
|
146
|
+
type: "ADD_FIELD" | "REMOVE_FIELD" | "RENAME_FIELD" | "TRANSFORM_FIELD" | "SET_DEFAULT";
|
|
147
|
+
}, {
|
|
148
|
+
type: import("convex/values").VUnion<"ADD_FIELD" | "REMOVE_FIELD" | "RENAME_FIELD" | "TRANSFORM_FIELD" | "SET_DEFAULT", [import("convex/values").VLiteral<"ADD_FIELD", "required">, import("convex/values").VLiteral<"REMOVE_FIELD", "required">, import("convex/values").VLiteral<"RENAME_FIELD", "required">, import("convex/values").VLiteral<"TRANSFORM_FIELD", "required">, import("convex/values").VLiteral<"SET_DEFAULT", "required">], "required", never>;
|
|
149
|
+
fieldName: import("convex/values").VString<string | undefined, "optional">;
|
|
150
|
+
oldFieldName: import("convex/values").VString<string | undefined, "optional">;
|
|
151
|
+
newFieldName: import("convex/values").VString<string | undefined, "optional">;
|
|
152
|
+
defaultValue: import("convex/values").VAny<any, "optional", string>;
|
|
153
|
+
transformation: import("convex/values").VUnion<"TEXT_TO_NUMBER" | "NUMBER_TO_TEXT" | "TEXT_TO_BOOLEAN" | "BOOLEAN_TO_TEXT" | "TEXT_TO_DATE" | "DATE_TO_TEXT" | "TEXT_TO_JSON" | "JSON_TO_TEXT" | "SINGLE_TO_ARRAY" | "ARRAY_TO_SINGLE" | "SELECT_VALUE_REMAP" | undefined, [import("convex/values").VLiteral<"TEXT_TO_NUMBER", "required">, import("convex/values").VLiteral<"NUMBER_TO_TEXT", "required">, import("convex/values").VLiteral<"TEXT_TO_BOOLEAN", "required">, import("convex/values").VLiteral<"BOOLEAN_TO_TEXT", "required">, import("convex/values").VLiteral<"TEXT_TO_DATE", "required">, import("convex/values").VLiteral<"DATE_TO_TEXT", "required">, import("convex/values").VLiteral<"TEXT_TO_JSON", "required">, import("convex/values").VLiteral<"JSON_TO_TEXT", "required">, import("convex/values").VLiteral<"SINGLE_TO_ARRAY", "required">, import("convex/values").VLiteral<"ARRAY_TO_SINGLE", "required">, import("convex/values").VLiteral<"SELECT_VALUE_REMAP", "required">], "optional", never>;
|
|
154
|
+
customTransformation: import("convex/values").VString<string | undefined, "optional">;
|
|
155
|
+
valueMap: import("convex/values").VAny<any, "optional", string>;
|
|
156
|
+
preserveEmpty: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
157
|
+
}, "required", "type" | "defaultValue" | `defaultValue.${string}` | "fieldName" | "oldFieldName" | "newFieldName" | "transformation" | "customTransformation" | "valueMap" | "preserveEmpty" | `valueMap.${string}`>;
|
|
158
|
+
/**
|
|
159
|
+
* Validator for migrate content type arguments.
|
|
160
|
+
*/
|
|
161
|
+
export declare const migrateContentTypeArgs: import("convex/values").VObject<{
|
|
162
|
+
changeDescription?: string | undefined;
|
|
163
|
+
createVersionSnapshots?: boolean | undefined;
|
|
164
|
+
dryRun?: boolean | undefined;
|
|
165
|
+
entryIds?: import("convex/values").GenericId<"contentEntries">[] | undefined;
|
|
166
|
+
migratedBy?: string | undefined;
|
|
167
|
+
statusFilter?: ("draft" | "published" | "archived" | "scheduled")[] | undefined;
|
|
168
|
+
contentTypeId: import("convex/values").GenericId<"contentTypes">;
|
|
169
|
+
migrations: {
|
|
170
|
+
defaultValue?: any;
|
|
171
|
+
fieldName?: string | undefined;
|
|
172
|
+
oldFieldName?: string | undefined;
|
|
173
|
+
newFieldName?: string | undefined;
|
|
174
|
+
transformation?: "TEXT_TO_NUMBER" | "NUMBER_TO_TEXT" | "TEXT_TO_BOOLEAN" | "BOOLEAN_TO_TEXT" | "TEXT_TO_DATE" | "DATE_TO_TEXT" | "TEXT_TO_JSON" | "JSON_TO_TEXT" | "SINGLE_TO_ARRAY" | "ARRAY_TO_SINGLE" | "SELECT_VALUE_REMAP" | undefined;
|
|
175
|
+
customTransformation?: string | undefined;
|
|
176
|
+
valueMap?: any;
|
|
177
|
+
preserveEmpty?: boolean | undefined;
|
|
178
|
+
type: "ADD_FIELD" | "REMOVE_FIELD" | "RENAME_FIELD" | "TRANSFORM_FIELD" | "SET_DEFAULT";
|
|
179
|
+
}[];
|
|
180
|
+
}, {
|
|
181
|
+
/** Content type ID to migrate */
|
|
182
|
+
contentTypeId: import("convex/values").VId<import("convex/values").GenericId<"contentTypes">, "required">;
|
|
183
|
+
/** Array of migration operations to apply */
|
|
184
|
+
migrations: import("convex/values").VArray<{
|
|
185
|
+
defaultValue?: any;
|
|
186
|
+
fieldName?: string | undefined;
|
|
187
|
+
oldFieldName?: string | undefined;
|
|
188
|
+
newFieldName?: string | undefined;
|
|
189
|
+
transformation?: "TEXT_TO_NUMBER" | "NUMBER_TO_TEXT" | "TEXT_TO_BOOLEAN" | "BOOLEAN_TO_TEXT" | "TEXT_TO_DATE" | "DATE_TO_TEXT" | "TEXT_TO_JSON" | "JSON_TO_TEXT" | "SINGLE_TO_ARRAY" | "ARRAY_TO_SINGLE" | "SELECT_VALUE_REMAP" | undefined;
|
|
190
|
+
customTransformation?: string | undefined;
|
|
191
|
+
valueMap?: any;
|
|
192
|
+
preserveEmpty?: boolean | undefined;
|
|
193
|
+
type: "ADD_FIELD" | "REMOVE_FIELD" | "RENAME_FIELD" | "TRANSFORM_FIELD" | "SET_DEFAULT";
|
|
194
|
+
}[], import("convex/values").VObject<{
|
|
195
|
+
defaultValue?: any;
|
|
196
|
+
fieldName?: string | undefined;
|
|
197
|
+
oldFieldName?: string | undefined;
|
|
198
|
+
newFieldName?: string | undefined;
|
|
199
|
+
transformation?: "TEXT_TO_NUMBER" | "NUMBER_TO_TEXT" | "TEXT_TO_BOOLEAN" | "BOOLEAN_TO_TEXT" | "TEXT_TO_DATE" | "DATE_TO_TEXT" | "TEXT_TO_JSON" | "JSON_TO_TEXT" | "SINGLE_TO_ARRAY" | "ARRAY_TO_SINGLE" | "SELECT_VALUE_REMAP" | undefined;
|
|
200
|
+
customTransformation?: string | undefined;
|
|
201
|
+
valueMap?: any;
|
|
202
|
+
preserveEmpty?: boolean | undefined;
|
|
203
|
+
type: "ADD_FIELD" | "REMOVE_FIELD" | "RENAME_FIELD" | "TRANSFORM_FIELD" | "SET_DEFAULT";
|
|
204
|
+
}, {
|
|
205
|
+
type: import("convex/values").VUnion<"ADD_FIELD" | "REMOVE_FIELD" | "RENAME_FIELD" | "TRANSFORM_FIELD" | "SET_DEFAULT", [import("convex/values").VLiteral<"ADD_FIELD", "required">, import("convex/values").VLiteral<"REMOVE_FIELD", "required">, import("convex/values").VLiteral<"RENAME_FIELD", "required">, import("convex/values").VLiteral<"TRANSFORM_FIELD", "required">, import("convex/values").VLiteral<"SET_DEFAULT", "required">], "required", never>;
|
|
206
|
+
fieldName: import("convex/values").VString<string | undefined, "optional">;
|
|
207
|
+
oldFieldName: import("convex/values").VString<string | undefined, "optional">;
|
|
208
|
+
newFieldName: import("convex/values").VString<string | undefined, "optional">;
|
|
209
|
+
defaultValue: import("convex/values").VAny<any, "optional", string>;
|
|
210
|
+
transformation: import("convex/values").VUnion<"TEXT_TO_NUMBER" | "NUMBER_TO_TEXT" | "TEXT_TO_BOOLEAN" | "BOOLEAN_TO_TEXT" | "TEXT_TO_DATE" | "DATE_TO_TEXT" | "TEXT_TO_JSON" | "JSON_TO_TEXT" | "SINGLE_TO_ARRAY" | "ARRAY_TO_SINGLE" | "SELECT_VALUE_REMAP" | undefined, [import("convex/values").VLiteral<"TEXT_TO_NUMBER", "required">, import("convex/values").VLiteral<"NUMBER_TO_TEXT", "required">, import("convex/values").VLiteral<"TEXT_TO_BOOLEAN", "required">, import("convex/values").VLiteral<"BOOLEAN_TO_TEXT", "required">, import("convex/values").VLiteral<"TEXT_TO_DATE", "required">, import("convex/values").VLiteral<"DATE_TO_TEXT", "required">, import("convex/values").VLiteral<"TEXT_TO_JSON", "required">, import("convex/values").VLiteral<"JSON_TO_TEXT", "required">, import("convex/values").VLiteral<"SINGLE_TO_ARRAY", "required">, import("convex/values").VLiteral<"ARRAY_TO_SINGLE", "required">, import("convex/values").VLiteral<"SELECT_VALUE_REMAP", "required">], "optional", never>;
|
|
211
|
+
customTransformation: import("convex/values").VString<string | undefined, "optional">;
|
|
212
|
+
valueMap: import("convex/values").VAny<any, "optional", string>;
|
|
213
|
+
preserveEmpty: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
214
|
+
}, "required", "type" | "defaultValue" | `defaultValue.${string}` | "fieldName" | "oldFieldName" | "newFieldName" | "transformation" | "customTransformation" | "valueMap" | "preserveEmpty" | `valueMap.${string}`>, "required">;
|
|
215
|
+
/** If true, preview changes without applying them */
|
|
216
|
+
dryRun: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
217
|
+
/** Create version snapshots before migration (default: true) */
|
|
218
|
+
createVersionSnapshots: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
219
|
+
/** Filter entries by status (default: all statuses) */
|
|
220
|
+
statusFilter: import("convex/values").VArray<("draft" | "published" | "archived" | "scheduled")[] | undefined, import("convex/values").VUnion<"draft" | "published" | "archived" | "scheduled", [import("convex/values").VLiteral<"draft", "required">, import("convex/values").VLiteral<"published", "required">, import("convex/values").VLiteral<"archived", "required">, import("convex/values").VLiteral<"scheduled", "required">], "required", never>, "optional">;
|
|
221
|
+
/** Only migrate entries with IDs in this list */
|
|
222
|
+
entryIds: import("convex/values").VArray<import("convex/values").GenericId<"contentEntries">[] | undefined, import("convex/values").VId<import("convex/values").GenericId<"contentEntries">, "required">, "optional">;
|
|
223
|
+
/** User performing the migration */
|
|
224
|
+
migratedBy: import("convex/values").VString<string | undefined, "optional">;
|
|
225
|
+
/** Description of the migration for version history */
|
|
226
|
+
changeDescription: import("convex/values").VString<string | undefined, "optional">;
|
|
227
|
+
}, "required", "contentTypeId" | "changeDescription" | "createVersionSnapshots" | "dryRun" | "entryIds" | "migratedBy" | "migrations" | "statusFilter">;
|
|
228
|
+
/**
|
|
229
|
+
* Validator for migration result.
|
|
230
|
+
*/
|
|
231
|
+
export declare const migrationResultValidator: import("convex/values").VObject<{
|
|
232
|
+
results: {
|
|
233
|
+
error?: string | undefined;
|
|
234
|
+
changes?: {
|
|
235
|
+
newValue?: any;
|
|
236
|
+
oldValue?: any;
|
|
237
|
+
fieldName: string;
|
|
238
|
+
operation: "ADD_FIELD" | "REMOVE_FIELD" | "RENAME_FIELD" | "TRANSFORM_FIELD" | "SET_DEFAULT";
|
|
239
|
+
}[] | undefined;
|
|
240
|
+
slug: string;
|
|
241
|
+
entryId: import("convex/values").GenericId<"contentEntries">;
|
|
242
|
+
success: boolean;
|
|
243
|
+
}[];
|
|
244
|
+
dryRun: boolean;
|
|
245
|
+
totalEntries: number;
|
|
246
|
+
successCount: number;
|
|
247
|
+
failureCount: number;
|
|
248
|
+
skippedCount: number;
|
|
249
|
+
versionSnapshotsCreated: number;
|
|
250
|
+
}, {
|
|
251
|
+
dryRun: import("convex/values").VBoolean<boolean, "required">;
|
|
252
|
+
totalEntries: import("convex/values").VFloat64<number, "required">;
|
|
253
|
+
successCount: import("convex/values").VFloat64<number, "required">;
|
|
254
|
+
failureCount: import("convex/values").VFloat64<number, "required">;
|
|
255
|
+
skippedCount: import("convex/values").VFloat64<number, "required">;
|
|
256
|
+
results: import("convex/values").VArray<{
|
|
257
|
+
error?: string | undefined;
|
|
258
|
+
changes?: {
|
|
259
|
+
newValue?: any;
|
|
260
|
+
oldValue?: any;
|
|
261
|
+
fieldName: string;
|
|
262
|
+
operation: "ADD_FIELD" | "REMOVE_FIELD" | "RENAME_FIELD" | "TRANSFORM_FIELD" | "SET_DEFAULT";
|
|
263
|
+
}[] | undefined;
|
|
264
|
+
slug: string;
|
|
265
|
+
entryId: import("convex/values").GenericId<"contentEntries">;
|
|
266
|
+
success: boolean;
|
|
267
|
+
}[], import("convex/values").VObject<{
|
|
268
|
+
error?: string | undefined;
|
|
269
|
+
changes?: {
|
|
270
|
+
newValue?: any;
|
|
271
|
+
oldValue?: any;
|
|
272
|
+
fieldName: string;
|
|
273
|
+
operation: "ADD_FIELD" | "REMOVE_FIELD" | "RENAME_FIELD" | "TRANSFORM_FIELD" | "SET_DEFAULT";
|
|
274
|
+
}[] | undefined;
|
|
275
|
+
slug: string;
|
|
276
|
+
entryId: import("convex/values").GenericId<"contentEntries">;
|
|
277
|
+
success: boolean;
|
|
278
|
+
}, {
|
|
279
|
+
entryId: import("convex/values").VId<import("convex/values").GenericId<"contentEntries">, "required">;
|
|
280
|
+
slug: import("convex/values").VString<string, "required">;
|
|
281
|
+
success: import("convex/values").VBoolean<boolean, "required">;
|
|
282
|
+
error: import("convex/values").VString<string | undefined, "optional">;
|
|
283
|
+
changes: import("convex/values").VArray<{
|
|
284
|
+
newValue?: any;
|
|
285
|
+
oldValue?: any;
|
|
286
|
+
fieldName: string;
|
|
287
|
+
operation: "ADD_FIELD" | "REMOVE_FIELD" | "RENAME_FIELD" | "TRANSFORM_FIELD" | "SET_DEFAULT";
|
|
288
|
+
}[] | undefined, import("convex/values").VObject<{
|
|
289
|
+
newValue?: any;
|
|
290
|
+
oldValue?: any;
|
|
291
|
+
fieldName: string;
|
|
292
|
+
operation: "ADD_FIELD" | "REMOVE_FIELD" | "RENAME_FIELD" | "TRANSFORM_FIELD" | "SET_DEFAULT";
|
|
293
|
+
}, {
|
|
294
|
+
fieldName: import("convex/values").VString<string, "required">;
|
|
295
|
+
operation: import("convex/values").VUnion<"ADD_FIELD" | "REMOVE_FIELD" | "RENAME_FIELD" | "TRANSFORM_FIELD" | "SET_DEFAULT", [import("convex/values").VLiteral<"ADD_FIELD", "required">, import("convex/values").VLiteral<"REMOVE_FIELD", "required">, import("convex/values").VLiteral<"RENAME_FIELD", "required">, import("convex/values").VLiteral<"TRANSFORM_FIELD", "required">, import("convex/values").VLiteral<"SET_DEFAULT", "required">], "required", never>;
|
|
296
|
+
oldValue: import("convex/values").VAny<any, "optional", string>;
|
|
297
|
+
newValue: import("convex/values").VAny<any, "optional", string>;
|
|
298
|
+
}, "required", "fieldName" | "operation" | "newValue" | "oldValue" | `newValue.${string}` | `oldValue.${string}`>, "optional">;
|
|
299
|
+
}, "required", "slug" | "entryId" | "success" | "error" | "changes">, "required">;
|
|
300
|
+
versionSnapshotsCreated: import("convex/values").VFloat64<number, "required">;
|
|
301
|
+
}, "required", "results" | "dryRun" | "totalEntries" | "successCount" | "failureCount" | "skippedCount" | "versionSnapshotsCreated">;
|
|
302
|
+
/**
|
|
303
|
+
* Mutation to migrate content entries when a content type schema changes.
|
|
304
|
+
*
|
|
305
|
+
* This mutation applies a series of migration operations to all entries
|
|
306
|
+
* of a given content type. It supports:
|
|
307
|
+
* - Adding new fields with default values
|
|
308
|
+
* - Removing fields
|
|
309
|
+
* - Renaming fields
|
|
310
|
+
* - Transforming field values (type conversions)
|
|
311
|
+
* - Setting default values for empty fields
|
|
312
|
+
*
|
|
313
|
+
* The mutation can run in dry-run mode to preview changes before applying them.
|
|
314
|
+
* By default, it creates version snapshots before modifying entries.
|
|
315
|
+
*
|
|
316
|
+
* @param contentTypeId - The content type to migrate
|
|
317
|
+
* @param migrations - Array of migration operations to apply
|
|
318
|
+
* @param dryRun - If true, preview changes without applying (default: false)
|
|
319
|
+
* @param createVersionSnapshots - Create version snapshots before migration (default: true)
|
|
320
|
+
* @param statusFilter - Only migrate entries with these statuses
|
|
321
|
+
* @param entryIds - Only migrate entries with these IDs
|
|
322
|
+
* @param migratedBy - User performing the migration
|
|
323
|
+
* @param changeDescription - Description for version history
|
|
324
|
+
*
|
|
325
|
+
* @returns MigrationResult with details of all changes
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* ```typescript
|
|
329
|
+
* // Preview migration
|
|
330
|
+
* const preview = await ctx.runMutation(api.contentTypeMigration.migrateContentType, {
|
|
331
|
+
* contentTypeId: blogPostTypeId,
|
|
332
|
+
* migrations: [
|
|
333
|
+
* { type: "RENAME_FIELD", oldFieldName: "body", newFieldName: "content" },
|
|
334
|
+
* { type: "ADD_FIELD", fieldName: "featured", defaultValue: false },
|
|
335
|
+
* { type: "TRANSFORM_FIELD", fieldName: "viewCount", transformation: "TEXT_TO_NUMBER" },
|
|
336
|
+
* ],
|
|
337
|
+
* dryRun: true,
|
|
338
|
+
* });
|
|
339
|
+
*
|
|
340
|
+
* // Apply migration after reviewing preview
|
|
341
|
+
* const result = await ctx.runMutation(api.contentTypeMigration.migrateContentType, {
|
|
342
|
+
* contentTypeId: blogPostTypeId,
|
|
343
|
+
* migrations: [...],
|
|
344
|
+
* dryRun: false,
|
|
345
|
+
* changeDescription: "Renamed body to content, added featured flag",
|
|
346
|
+
* migratedBy: currentUserId,
|
|
347
|
+
* });
|
|
348
|
+
* ```
|
|
349
|
+
*/
|
|
350
|
+
export declare const migrateContentType: import("convex/server").RegisteredMutation<"public", {
|
|
351
|
+
changeDescription?: string | undefined;
|
|
352
|
+
createVersionSnapshots?: boolean | undefined;
|
|
353
|
+
dryRun?: boolean | undefined;
|
|
354
|
+
entryIds?: import("convex/values").GenericId<"contentEntries">[] | undefined;
|
|
355
|
+
migratedBy?: string | undefined;
|
|
356
|
+
statusFilter?: ("draft" | "published" | "archived" | "scheduled")[] | undefined;
|
|
357
|
+
contentTypeId: import("convex/values").GenericId<"contentTypes">;
|
|
358
|
+
migrations: {
|
|
359
|
+
defaultValue?: any;
|
|
360
|
+
fieldName?: string | undefined;
|
|
361
|
+
oldFieldName?: string | undefined;
|
|
362
|
+
newFieldName?: string | undefined;
|
|
363
|
+
transformation?: "TEXT_TO_NUMBER" | "NUMBER_TO_TEXT" | "TEXT_TO_BOOLEAN" | "BOOLEAN_TO_TEXT" | "TEXT_TO_DATE" | "DATE_TO_TEXT" | "TEXT_TO_JSON" | "JSON_TO_TEXT" | "SINGLE_TO_ARRAY" | "ARRAY_TO_SINGLE" | "SELECT_VALUE_REMAP" | undefined;
|
|
364
|
+
customTransformation?: string | undefined;
|
|
365
|
+
valueMap?: any;
|
|
366
|
+
preserveEmpty?: boolean | undefined;
|
|
367
|
+
type: "ADD_FIELD" | "REMOVE_FIELD" | "RENAME_FIELD" | "TRANSFORM_FIELD" | "SET_DEFAULT";
|
|
368
|
+
}[];
|
|
369
|
+
}, Promise<MigrationResult>>;
|
|
370
|
+
/**
|
|
371
|
+
* Query to preview migration without modifying data.
|
|
372
|
+
*
|
|
373
|
+
* This is a convenience wrapper that always runs in dry-run mode.
|
|
374
|
+
* Use this to safely preview what changes would be made.
|
|
375
|
+
*/
|
|
376
|
+
export declare const previewMigration: import("convex/server").RegisteredQuery<"public", {
|
|
377
|
+
limit?: number | undefined;
|
|
378
|
+
entryIds?: import("convex/values").GenericId<"contentEntries">[] | undefined;
|
|
379
|
+
statusFilter?: ("draft" | "published" | "archived" | "scheduled")[] | undefined;
|
|
380
|
+
contentTypeId: import("convex/values").GenericId<"contentTypes">;
|
|
381
|
+
migrations: {
|
|
382
|
+
defaultValue?: any;
|
|
383
|
+
fieldName?: string | undefined;
|
|
384
|
+
oldFieldName?: string | undefined;
|
|
385
|
+
newFieldName?: string | undefined;
|
|
386
|
+
transformation?: "TEXT_TO_NUMBER" | "NUMBER_TO_TEXT" | "TEXT_TO_BOOLEAN" | "BOOLEAN_TO_TEXT" | "TEXT_TO_DATE" | "DATE_TO_TEXT" | "TEXT_TO_JSON" | "JSON_TO_TEXT" | "SINGLE_TO_ARRAY" | "ARRAY_TO_SINGLE" | "SELECT_VALUE_REMAP" | undefined;
|
|
387
|
+
customTransformation?: string | undefined;
|
|
388
|
+
valueMap?: any;
|
|
389
|
+
preserveEmpty?: boolean | undefined;
|
|
390
|
+
type: "ADD_FIELD" | "REMOVE_FIELD" | "RENAME_FIELD" | "TRANSFORM_FIELD" | "SET_DEFAULT";
|
|
391
|
+
}[];
|
|
392
|
+
}, Promise<{
|
|
393
|
+
totalEntries: number;
|
|
394
|
+
previewedEntries: number;
|
|
395
|
+
results: EntryMigrationResult[];
|
|
396
|
+
summary: {
|
|
397
|
+
entriesWithChanges: number;
|
|
398
|
+
entriesWithoutChanges: number;
|
|
399
|
+
operationCounts: Record<string, number>;
|
|
400
|
+
};
|
|
401
|
+
}>>;
|
|
402
|
+
/**
|
|
403
|
+
* Query to get available transformation types and their descriptions.
|
|
404
|
+
*/
|
|
405
|
+
export declare const getTransformationTypes: import("convex/server").RegisteredQuery<"public", {}, Promise<{
|
|
406
|
+
type: string;
|
|
407
|
+
description: string;
|
|
408
|
+
fromType: string;
|
|
409
|
+
toType: string;
|
|
410
|
+
}[]>>;
|
|
411
|
+
//# sourceMappingURL=contentTypeMigration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentTypeMigration.d.ts","sourceRoot":"","sources":["../../src/component/contentTypeMigration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAKH,OAAO,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AAM/C;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAC/B,WAAW,GACX,cAAc,GACd,cAAc,GACd,iBAAiB,GACjB,aAAa,CAAC;AAEjB;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC9B,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,GACjB,iBAAiB,GACjB,cAAc,GACd,cAAc,GACd,cAAc,GACd,cAAc,GACd,iBAAiB,GACjB,iBAAiB,GACjB,oBAAoB,CAAC;AAExB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,kCAAkC;IAClC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mCAAmC;IACnC,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,oEAAoE;IACpE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,sEAAsE;IACtE,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,eAAe;IACf,OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC;IAC9B,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,SAAS,EAAE,sBAAsB,CAAC;IAClC,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,iCAAiC;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,8BAA8B;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAChC,sCAAsC;IACtC,uBAAuB,EAAE,MAAM,CAAC;CAChC;AAqPD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,UAAU,EAAE,kBAAkB,EAAE,GAC9B;IAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,OAAO,EAAE,WAAW,EAAE,CAAA;CAAE,CAqHnE;AAkCD;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;oNAUtC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;IAClC,iCAAiC;;IAEjC,6CAA6C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAE7C,qDAAqD;;IAErD,gEAAgE;;IAEhE,uDAAuD;;IAWvD,iDAAiD;;IAEjD,oCAAoC;;IAEpC,uDAAuD;;uJAEtD,CAAC;AAoBH;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oIAQnC,CAAC;AAMH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;4BAuK7B,CAAC;AAMH;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;GA8G3B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;KAmFjC,CAAC"}
|