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,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content Lock Functions
|
|
3
|
+
*
|
|
4
|
+
* Implements optimistic locking for content entries to prevent concurrent edit conflicts.
|
|
5
|
+
* Provides lock acquisition, release, renewal, and status checking.
|
|
6
|
+
*
|
|
7
|
+
* Lock Lifecycle:
|
|
8
|
+
* 1. User acquires lock when opening content for editing
|
|
9
|
+
* 2. Lock auto-expires after configured duration (default 30 minutes)
|
|
10
|
+
* 3. User can renew lock to extend editing session
|
|
11
|
+
* 4. User releases lock when done editing (or lock auto-expires)
|
|
12
|
+
* 5. Admins can force-release locks when needed
|
|
13
|
+
*
|
|
14
|
+
* Lock Behavior:
|
|
15
|
+
* - Only one user can hold a lock at a time
|
|
16
|
+
* - Locks automatically expire to prevent orphaned locks
|
|
17
|
+
* - The lock holder can update their locked entry
|
|
18
|
+
* - Other users receive an error when trying to update locked content
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Query to check the lock status of a content entry.
|
|
22
|
+
*
|
|
23
|
+
* Returns detailed information about the current lock state,
|
|
24
|
+
* including whether it's locked, by whom, and how much time remains.
|
|
25
|
+
*
|
|
26
|
+
* @param id - The content entry ID to check
|
|
27
|
+
* @returns Lock status information
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const status = await ctx.runQuery(api.contentLock.checkLock, {
|
|
32
|
+
* id: entryId,
|
|
33
|
+
* });
|
|
34
|
+
* if (status.isLocked && status.lockedBy !== currentUserId) {
|
|
35
|
+
* console.log(`Entry is locked by ${status.lockedBy}`);
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare const checkLock: import("convex/server").RegisteredQuery<"public", {
|
|
40
|
+
id: import("convex/values").GenericId<"contentEntries">;
|
|
41
|
+
}, Promise<{
|
|
42
|
+
isLocked: boolean;
|
|
43
|
+
lockedBy: string | undefined;
|
|
44
|
+
lockExpiresAt: number | undefined;
|
|
45
|
+
timeRemaining: number | undefined;
|
|
46
|
+
isExpired: boolean;
|
|
47
|
+
}>>;
|
|
48
|
+
/**
|
|
49
|
+
* Query to list all locked content entries.
|
|
50
|
+
*
|
|
51
|
+
* Useful for admin dashboards to see which entries are currently
|
|
52
|
+
* being edited and by whom.
|
|
53
|
+
*
|
|
54
|
+
* @param contentTypeId - Optional filter by content type
|
|
55
|
+
* @param lockedBy - Optional filter by locking user
|
|
56
|
+
* @param paginationOpts - Pagination options
|
|
57
|
+
* @returns Paginated list of locked entries
|
|
58
|
+
*/
|
|
59
|
+
export declare const listLockedEntries: import("convex/server").RegisteredQuery<"public", {
|
|
60
|
+
contentTypeId?: import("convex/values").GenericId<"contentTypes"> | undefined;
|
|
61
|
+
lockedBy?: string | undefined;
|
|
62
|
+
paginationOpts: {
|
|
63
|
+
id?: number;
|
|
64
|
+
endCursor?: string | null;
|
|
65
|
+
maximumRowsRead?: number;
|
|
66
|
+
maximumBytesRead?: number;
|
|
67
|
+
numItems: number;
|
|
68
|
+
cursor: string | null;
|
|
69
|
+
};
|
|
70
|
+
}, Promise<{
|
|
71
|
+
page: {
|
|
72
|
+
timeRemaining: number;
|
|
73
|
+
_id: import("convex/values").GenericId<"contentEntries">;
|
|
74
|
+
_creationTime: number;
|
|
75
|
+
deletedAt?: number | undefined;
|
|
76
|
+
createdBy?: string | undefined;
|
|
77
|
+
updatedBy?: string | undefined;
|
|
78
|
+
searchText?: string | undefined;
|
|
79
|
+
locale?: string | undefined;
|
|
80
|
+
primaryEntryId?: import("convex/values").GenericId<"contentEntries"> | undefined;
|
|
81
|
+
scheduledPublishAt?: number | undefined;
|
|
82
|
+
firstPublishedAt?: number | undefined;
|
|
83
|
+
lastPublishedAt?: number | undefined;
|
|
84
|
+
lockedBy?: string | undefined;
|
|
85
|
+
lockExpiresAt?: number | undefined;
|
|
86
|
+
contentTypeId: import("convex/values").GenericId<"contentTypes">;
|
|
87
|
+
slug: string;
|
|
88
|
+
status: string;
|
|
89
|
+
data: any;
|
|
90
|
+
version: number;
|
|
91
|
+
}[];
|
|
92
|
+
continueCursor: import("convex/values").GenericId<"contentEntries"> | null;
|
|
93
|
+
isDone: boolean;
|
|
94
|
+
}>>;
|
|
95
|
+
/**
|
|
96
|
+
* Mutation to acquire a lock on a content entry.
|
|
97
|
+
*
|
|
98
|
+
* Attempts to acquire an exclusive lock on an entry for editing.
|
|
99
|
+
* The lock will automatically expire after the specified duration.
|
|
100
|
+
*
|
|
101
|
+
* Lock acquisition rules:
|
|
102
|
+
* - If entry is not locked, lock is acquired
|
|
103
|
+
* - If entry is locked by the same user, lock is renewed
|
|
104
|
+
* - If entry is locked by another user and lock is expired, lock is acquired
|
|
105
|
+
* - If entry is locked by another user and lock is active, acquisition fails
|
|
106
|
+
*
|
|
107
|
+
* @param id - The content entry ID to lock
|
|
108
|
+
* @param userId - User ID acquiring the lock
|
|
109
|
+
* @param lockDuration - Optional lock duration (default 30 min, max 4 hours)
|
|
110
|
+
* @returns Lock acquisition result with success status and entry
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* const result = await ctx.runMutation(api.contentLock.acquireLock, {
|
|
115
|
+
* id: entryId,
|
|
116
|
+
* userId: currentUserId,
|
|
117
|
+
* lockDuration: 60 * 60 * 1000, // 1 hour
|
|
118
|
+
* });
|
|
119
|
+
*
|
|
120
|
+
* if (result.success) {
|
|
121
|
+
* console.log("Lock acquired, editing enabled");
|
|
122
|
+
* } else {
|
|
123
|
+
* console.log(`Lock held by ${result.currentLockHolder}`);
|
|
124
|
+
* }
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export declare const acquireLock: import("convex/server").RegisteredMutation<"public", {
|
|
128
|
+
lockDuration?: number | undefined;
|
|
129
|
+
id: import("convex/values").GenericId<"contentEntries">;
|
|
130
|
+
userId: string;
|
|
131
|
+
}, Promise<{
|
|
132
|
+
success: boolean;
|
|
133
|
+
error: string;
|
|
134
|
+
currentLockHolder?: undefined;
|
|
135
|
+
currentLockExpiresAt?: undefined;
|
|
136
|
+
entry?: undefined;
|
|
137
|
+
} | {
|
|
138
|
+
success: boolean;
|
|
139
|
+
error: string;
|
|
140
|
+
currentLockHolder: string | undefined;
|
|
141
|
+
currentLockExpiresAt: number | undefined;
|
|
142
|
+
entry?: undefined;
|
|
143
|
+
} | {
|
|
144
|
+
success: boolean;
|
|
145
|
+
entry: {
|
|
146
|
+
_id: import("convex/values").GenericId<"contentEntries">;
|
|
147
|
+
_creationTime: number;
|
|
148
|
+
deletedAt?: number | undefined;
|
|
149
|
+
createdBy?: string | undefined;
|
|
150
|
+
updatedBy?: string | undefined;
|
|
151
|
+
searchText?: string | undefined;
|
|
152
|
+
locale?: string | undefined;
|
|
153
|
+
primaryEntryId?: import("convex/values").GenericId<"contentEntries"> | undefined;
|
|
154
|
+
scheduledPublishAt?: number | undefined;
|
|
155
|
+
firstPublishedAt?: number | undefined;
|
|
156
|
+
lastPublishedAt?: number | undefined;
|
|
157
|
+
lockedBy?: string | undefined;
|
|
158
|
+
lockExpiresAt?: number | undefined;
|
|
159
|
+
contentTypeId: import("convex/values").GenericId<"contentTypes">;
|
|
160
|
+
slug: string;
|
|
161
|
+
status: string;
|
|
162
|
+
data: any;
|
|
163
|
+
version: number;
|
|
164
|
+
};
|
|
165
|
+
error?: undefined;
|
|
166
|
+
currentLockHolder?: undefined;
|
|
167
|
+
currentLockExpiresAt?: undefined;
|
|
168
|
+
}>>;
|
|
169
|
+
/**
|
|
170
|
+
* Mutation to release a lock on a content entry.
|
|
171
|
+
*
|
|
172
|
+
* Only the lock owner can release their lock. This should be called
|
|
173
|
+
* when the user finishes editing or navigates away from the editor.
|
|
174
|
+
*
|
|
175
|
+
* @param id - The content entry ID to unlock
|
|
176
|
+
* @param userId - User ID releasing the lock (must match lock owner)
|
|
177
|
+
* @returns The unlocked content entry
|
|
178
|
+
*
|
|
179
|
+
* @throws Error if entry not found
|
|
180
|
+
* @throws Error if entry not locked by this user
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* const entry = await ctx.runMutation(api.contentLock.releaseLock, {
|
|
185
|
+
* id: entryId,
|
|
186
|
+
* userId: currentUserId,
|
|
187
|
+
* });
|
|
188
|
+
* console.log("Lock released");
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
export declare const releaseLock: import("convex/server").RegisteredMutation<"public", {
|
|
192
|
+
id: import("convex/values").GenericId<"contentEntries">;
|
|
193
|
+
userId: string;
|
|
194
|
+
}, Promise<{
|
|
195
|
+
_id: import("convex/values").GenericId<"contentEntries">;
|
|
196
|
+
_creationTime: number;
|
|
197
|
+
deletedAt?: number | undefined;
|
|
198
|
+
createdBy?: string | undefined;
|
|
199
|
+
updatedBy?: string | undefined;
|
|
200
|
+
searchText?: string | undefined;
|
|
201
|
+
locale?: string | undefined;
|
|
202
|
+
primaryEntryId?: import("convex/values").GenericId<"contentEntries"> | undefined;
|
|
203
|
+
scheduledPublishAt?: number | undefined;
|
|
204
|
+
firstPublishedAt?: number | undefined;
|
|
205
|
+
lastPublishedAt?: number | undefined;
|
|
206
|
+
lockedBy?: string | undefined;
|
|
207
|
+
lockExpiresAt?: number | undefined;
|
|
208
|
+
contentTypeId: import("convex/values").GenericId<"contentTypes">;
|
|
209
|
+
slug: string;
|
|
210
|
+
status: string;
|
|
211
|
+
data: any;
|
|
212
|
+
version: number;
|
|
213
|
+
}>>;
|
|
214
|
+
/**
|
|
215
|
+
* Mutation to force-release a lock (admin operation).
|
|
216
|
+
*
|
|
217
|
+
* Allows administrators to remove locks from entries locked by other users.
|
|
218
|
+
* This should be used sparingly - only when a user has abandoned an editing
|
|
219
|
+
* session without releasing their lock, and the auto-expiry hasn't occurred yet.
|
|
220
|
+
*
|
|
221
|
+
* @param id - The content entry ID to force unlock
|
|
222
|
+
* @param releasedBy - User ID performing the force release (for audit trail)
|
|
223
|
+
* @returns The unlocked content entry
|
|
224
|
+
*
|
|
225
|
+
* @throws Error if entry not found
|
|
226
|
+
* @throws Error if entry is not locked
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```typescript
|
|
230
|
+
* // Admin forcing release of abandoned lock
|
|
231
|
+
* const entry = await ctx.runMutation(api.contentLock.forceReleaseLock, {
|
|
232
|
+
* id: entryId,
|
|
233
|
+
* releasedBy: adminUserId,
|
|
234
|
+
* });
|
|
235
|
+
* console.log("Lock forcibly released");
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
export declare const forceReleaseLock: import("convex/server").RegisteredMutation<"public", {
|
|
239
|
+
id: import("convex/values").GenericId<"contentEntries">;
|
|
240
|
+
releasedBy: string;
|
|
241
|
+
}, Promise<{
|
|
242
|
+
_id: import("convex/values").GenericId<"contentEntries">;
|
|
243
|
+
_creationTime: number;
|
|
244
|
+
deletedAt?: number | undefined;
|
|
245
|
+
createdBy?: string | undefined;
|
|
246
|
+
updatedBy?: string | undefined;
|
|
247
|
+
searchText?: string | undefined;
|
|
248
|
+
locale?: string | undefined;
|
|
249
|
+
primaryEntryId?: import("convex/values").GenericId<"contentEntries"> | undefined;
|
|
250
|
+
scheduledPublishAt?: number | undefined;
|
|
251
|
+
firstPublishedAt?: number | undefined;
|
|
252
|
+
lastPublishedAt?: number | undefined;
|
|
253
|
+
lockedBy?: string | undefined;
|
|
254
|
+
lockExpiresAt?: number | undefined;
|
|
255
|
+
contentTypeId: import("convex/values").GenericId<"contentTypes">;
|
|
256
|
+
slug: string;
|
|
257
|
+
status: string;
|
|
258
|
+
data: any;
|
|
259
|
+
version: number;
|
|
260
|
+
}>>;
|
|
261
|
+
/**
|
|
262
|
+
* Mutation to renew an existing lock.
|
|
263
|
+
*
|
|
264
|
+
* Extends the lock expiration time for continued editing sessions.
|
|
265
|
+
* Only the lock owner can renew their lock.
|
|
266
|
+
*
|
|
267
|
+
* This is typically called periodically by the client to keep the lock
|
|
268
|
+
* active during long editing sessions.
|
|
269
|
+
*
|
|
270
|
+
* @param id - The content entry ID whose lock to renew
|
|
271
|
+
* @param userId - User ID renewing the lock (must match lock owner)
|
|
272
|
+
* @param lockDuration - Optional new lock duration (default 30 min, max 4 hours)
|
|
273
|
+
* @returns The entry with renewed lock
|
|
274
|
+
*
|
|
275
|
+
* @throws Error if entry not found
|
|
276
|
+
* @throws Error if entry not locked by this user
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* ```typescript
|
|
280
|
+
* // Renew lock every 15 minutes during editing
|
|
281
|
+
* setInterval(async () => {
|
|
282
|
+
* await ctx.runMutation(api.contentLock.renewLock, {
|
|
283
|
+
* id: entryId,
|
|
284
|
+
* userId: currentUserId,
|
|
285
|
+
* });
|
|
286
|
+
* }, 15 * 60 * 1000);
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
export declare const renewLock: import("convex/server").RegisteredMutation<"public", {
|
|
290
|
+
lockDuration?: number | undefined;
|
|
291
|
+
id: import("convex/values").GenericId<"contentEntries">;
|
|
292
|
+
userId: string;
|
|
293
|
+
}, Promise<{
|
|
294
|
+
_id: import("convex/values").GenericId<"contentEntries">;
|
|
295
|
+
_creationTime: number;
|
|
296
|
+
deletedAt?: number | undefined;
|
|
297
|
+
createdBy?: string | undefined;
|
|
298
|
+
updatedBy?: string | undefined;
|
|
299
|
+
searchText?: string | undefined;
|
|
300
|
+
locale?: string | undefined;
|
|
301
|
+
primaryEntryId?: import("convex/values").GenericId<"contentEntries"> | undefined;
|
|
302
|
+
scheduledPublishAt?: number | undefined;
|
|
303
|
+
firstPublishedAt?: number | undefined;
|
|
304
|
+
lastPublishedAt?: number | undefined;
|
|
305
|
+
lockedBy?: string | undefined;
|
|
306
|
+
lockExpiresAt?: number | undefined;
|
|
307
|
+
contentTypeId: import("convex/values").GenericId<"contentTypes">;
|
|
308
|
+
slug: string;
|
|
309
|
+
status: string;
|
|
310
|
+
data: any;
|
|
311
|
+
version: number;
|
|
312
|
+
}>>;
|
|
313
|
+
/**
|
|
314
|
+
* Validates that a user can update a locked entry.
|
|
315
|
+
* This is exported for use by contentEntryMutations.
|
|
316
|
+
*
|
|
317
|
+
* @param entry - The content entry to check
|
|
318
|
+
* @param userId - The user attempting the update
|
|
319
|
+
* @returns Object with isAllowed boolean and optional error message
|
|
320
|
+
*/
|
|
321
|
+
export declare function validateLockForUpdate(entry: {
|
|
322
|
+
lockedBy?: string;
|
|
323
|
+
lockExpiresAt?: number;
|
|
324
|
+
}, userId: string | undefined): {
|
|
325
|
+
isAllowed: boolean;
|
|
326
|
+
error?: string;
|
|
327
|
+
};
|
|
328
|
+
//# sourceMappingURL=contentLock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentLock.d.ts","sourceRoot":"","sources":["../../src/component/contentLock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAmEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,SAAS;;;;;;;;GA4BpB,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2E5B,CAAC;AAMH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEtB,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;GAgCtB,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;GA+B3B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;GA2CpB,CAAC;AAMH;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,EACpD,MAAM,EAAE,MAAM,GAAG,SAAS,GACxB;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAuBxC"}
|