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,412 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rate Limit Hooks Execution Module
|
|
3
|
+
*
|
|
4
|
+
* This module provides the infrastructure for executing rate limit hooks
|
|
5
|
+
* that enable custom rate limiting logic for CMS operations.
|
|
6
|
+
*
|
|
7
|
+
* Rate limiting hooks allow parent applications to:
|
|
8
|
+
* - Implement custom rate limiting strategies (token bucket, fixed window, etc.)
|
|
9
|
+
* - Define different limits for different user tiers
|
|
10
|
+
* - Apply limits per operation, category, or globally
|
|
11
|
+
* - Integrate with external rate limiting services
|
|
12
|
+
*
|
|
13
|
+
* Hook execution order:
|
|
14
|
+
* 1. getConfig hook (optional) - Get dynamic rate limit configuration
|
|
15
|
+
* 2. check hook - Check if operation is rate limited
|
|
16
|
+
* 3. consume hook - Record rate limit usage (only if check passed)
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import { executeRateLimitHooks, RateLimitedError } from './rateLimitHooks';
|
|
21
|
+
*
|
|
22
|
+
* // In a mutation handler
|
|
23
|
+
* const rateLimitResult = await executeRateLimitHooks({
|
|
24
|
+
* hooks: config.rateLimitHooks,
|
|
25
|
+
* context: {
|
|
26
|
+
* operation: 'contentEntries.create',
|
|
27
|
+
* operationCategory: 'write',
|
|
28
|
+
* userId: args.createdBy,
|
|
29
|
+
* role: userRole,
|
|
30
|
+
* timestamp: Date.now(),
|
|
31
|
+
* },
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* if (!rateLimitResult.allowed) {
|
|
35
|
+
* throw new RateLimitedError(rateLimitResult.reason ?? 'Rate limit exceeded', {
|
|
36
|
+
* retryAt: rateLimitResult.retryAt,
|
|
37
|
+
* });
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* Error thrown when a rate limit is exceeded.
|
|
43
|
+
*/
|
|
44
|
+
export class RateLimitedError extends Error {
|
|
45
|
+
code = "RATE_LIMITED";
|
|
46
|
+
retryAt;
|
|
47
|
+
operation;
|
|
48
|
+
operationCategory;
|
|
49
|
+
rateLimitInfo;
|
|
50
|
+
constructor(message, options) {
|
|
51
|
+
super(message);
|
|
52
|
+
this.name = "RateLimitedError";
|
|
53
|
+
this.retryAt = options?.retryAt;
|
|
54
|
+
this.operation = options?.operation;
|
|
55
|
+
this.operationCategory = options?.operationCategory;
|
|
56
|
+
this.rateLimitInfo = options?.rateLimitInfo;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Returns a human-readable message with retry information.
|
|
60
|
+
*/
|
|
61
|
+
toUserMessage() {
|
|
62
|
+
if (this.retryAt) {
|
|
63
|
+
const retryInMs = this.retryAt - Date.now();
|
|
64
|
+
if (retryInMs > 0) {
|
|
65
|
+
const retryInSeconds = Math.ceil(retryInMs / 1000);
|
|
66
|
+
return `${this.message}. Please retry in ${retryInSeconds} second${retryInSeconds !== 1 ? "s" : ""}.`;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return this.message;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// =============================================================================
|
|
73
|
+
// Helper Functions
|
|
74
|
+
// =============================================================================
|
|
75
|
+
/**
|
|
76
|
+
* Maps a CMS operation to its category.
|
|
77
|
+
*/
|
|
78
|
+
export function operationToCategory(operation) {
|
|
79
|
+
// Read operations
|
|
80
|
+
if (operation.endsWith(".read") || operation === "versions.read") {
|
|
81
|
+
return "read";
|
|
82
|
+
}
|
|
83
|
+
// Publish operations
|
|
84
|
+
if (operation === "contentEntries.publish" ||
|
|
85
|
+
operation === "contentEntries.unpublish" ||
|
|
86
|
+
operation === "contentEntries.schedule") {
|
|
87
|
+
return "publish";
|
|
88
|
+
}
|
|
89
|
+
// Media operations
|
|
90
|
+
if (operation.startsWith("mediaAssets.") ||
|
|
91
|
+
operation.startsWith("mediaFolders.")) {
|
|
92
|
+
return "media";
|
|
93
|
+
}
|
|
94
|
+
// Admin operations (content type management)
|
|
95
|
+
if (operation.startsWith("contentTypes.")) {
|
|
96
|
+
return "admin";
|
|
97
|
+
}
|
|
98
|
+
// Write operations (default for mutations)
|
|
99
|
+
return "write";
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Creates a rate limit context for a CMS operation.
|
|
103
|
+
*/
|
|
104
|
+
export function createRateLimitContext(operation, options) {
|
|
105
|
+
return {
|
|
106
|
+
operation,
|
|
107
|
+
operationCategory: operationToCategory(operation),
|
|
108
|
+
userId: options.userId,
|
|
109
|
+
role: options.role,
|
|
110
|
+
contentTypeId: options.contentTypeId,
|
|
111
|
+
contentTypeName: options.contentTypeName,
|
|
112
|
+
metadata: options.metadata,
|
|
113
|
+
timestamp: Date.now(),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Execute a single rate limit hook safely.
|
|
118
|
+
* Catches errors and converts them to allowed results to avoid blocking operations.
|
|
119
|
+
*/
|
|
120
|
+
async function executeCheckHook(hook, context) {
|
|
121
|
+
if (!hook) {
|
|
122
|
+
return { allowed: true };
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
return await hook(context);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
// Hook threw an error - log and allow operation to proceed
|
|
129
|
+
// This prevents rate limit hook errors from blocking legitimate operations
|
|
130
|
+
console.error("Rate limit check hook error:", error);
|
|
131
|
+
return { allowed: true };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Execute the consume hook safely.
|
|
136
|
+
*/
|
|
137
|
+
async function executeConsumeHook(hook, context) {
|
|
138
|
+
if (!hook) {
|
|
139
|
+
return { allowed: true, consumed: false };
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
return await hook(context);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
// Hook threw an error - log and allow operation to proceed
|
|
146
|
+
console.error("Rate limit consume hook error:", error);
|
|
147
|
+
return { allowed: true, consumed: false };
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Execute the config hook safely.
|
|
152
|
+
*/
|
|
153
|
+
async function executeConfigHook(hook, context) {
|
|
154
|
+
if (!hook) {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
return await hook(context);
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
console.error("Rate limit config hook error:", error);
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// =============================================================================
|
|
166
|
+
// Main Rate Limit Execution Function
|
|
167
|
+
// =============================================================================
|
|
168
|
+
/**
|
|
169
|
+
* Execute the full rate limit hook chain for an operation.
|
|
170
|
+
*
|
|
171
|
+
* This function orchestrates the execution of rate limit hooks in the correct order:
|
|
172
|
+
*
|
|
173
|
+
* 1. Check if rate limiting should be skipped (no hooks, excluded operation/category, admin bypass)
|
|
174
|
+
* 2. Get configuration from getConfig hook (if provided)
|
|
175
|
+
* 3. Execute check hook (or operation-specific override)
|
|
176
|
+
* 4. Execute consume hook if check passed (or operation-specific override)
|
|
177
|
+
* 5. Call onRateLimited callback if operation was denied
|
|
178
|
+
*
|
|
179
|
+
* @param options - Configuration for the rate limit execution
|
|
180
|
+
* @returns RateLimitResult indicating if the operation is allowed
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* const result = await executeRateLimitHooks({
|
|
185
|
+
* hooks: config.rateLimitHooks,
|
|
186
|
+
* context: {
|
|
187
|
+
* operation: 'contentEntries.create',
|
|
188
|
+
* operationCategory: 'write',
|
|
189
|
+
* userId: 'user123',
|
|
190
|
+
* role: 'editor',
|
|
191
|
+
* timestamp: Date.now(),
|
|
192
|
+
* },
|
|
193
|
+
* });
|
|
194
|
+
*
|
|
195
|
+
* if (!result.allowed) {
|
|
196
|
+
* throw new RateLimitedError(result.reason ?? 'Rate limit exceeded', {
|
|
197
|
+
* retryAt: result.retryAt,
|
|
198
|
+
* });
|
|
199
|
+
* }
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
export async function executeRateLimitHooks(options) {
|
|
203
|
+
const { hooks, context } = options;
|
|
204
|
+
// -------------------------------------------------------------------------
|
|
205
|
+
// Step 1: Check if rate limiting should be skipped
|
|
206
|
+
// -------------------------------------------------------------------------
|
|
207
|
+
// No hooks configured - skip rate limiting
|
|
208
|
+
if (!hooks || (!hooks.check && !hooks.consume && !hooks.operationHooks)) {
|
|
209
|
+
return {
|
|
210
|
+
allowed: true,
|
|
211
|
+
skipped: true,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
// Check if operation is excluded
|
|
215
|
+
if (hooks.excludeOperations?.includes(context.operation)) {
|
|
216
|
+
return {
|
|
217
|
+
allowed: true,
|
|
218
|
+
skipped: true,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
// Check if category is excluded
|
|
222
|
+
if (hooks.excludeCategories?.includes(context.operationCategory)) {
|
|
223
|
+
return {
|
|
224
|
+
allowed: true,
|
|
225
|
+
skipped: true,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
// Check if admin users should be exempted
|
|
229
|
+
if (hooks.skipForAdmin && context.role === "admin") {
|
|
230
|
+
return {
|
|
231
|
+
allowed: true,
|
|
232
|
+
skipped: true,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
// -------------------------------------------------------------------------
|
|
236
|
+
// Step 2: Get operation-specific hooks or use global hooks
|
|
237
|
+
// -------------------------------------------------------------------------
|
|
238
|
+
const operationHooks = hooks.operationHooks?.[context.operation];
|
|
239
|
+
const checkHook = operationHooks?.check ?? hooks.check;
|
|
240
|
+
const consumeHook = operationHooks?.consume ?? hooks.consume;
|
|
241
|
+
const configHook = operationHooks?.getConfig ?? hooks.getConfig;
|
|
242
|
+
// No check hook configured - skip rate limiting
|
|
243
|
+
if (!checkHook) {
|
|
244
|
+
return {
|
|
245
|
+
allowed: true,
|
|
246
|
+
skipped: true,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
// -------------------------------------------------------------------------
|
|
250
|
+
// Step 3: Get configuration (optional)
|
|
251
|
+
// -------------------------------------------------------------------------
|
|
252
|
+
const configResult = await executeConfigHook(configHook, context);
|
|
253
|
+
// Config hook says rate limiting is disabled
|
|
254
|
+
if (configResult && !configResult.enabled) {
|
|
255
|
+
return {
|
|
256
|
+
allowed: true,
|
|
257
|
+
skipped: true,
|
|
258
|
+
config: configResult,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
// -------------------------------------------------------------------------
|
|
262
|
+
// Step 4: Execute check hook
|
|
263
|
+
// -------------------------------------------------------------------------
|
|
264
|
+
const checkResult = await executeCheckHook(checkHook, context);
|
|
265
|
+
if (!checkResult.allowed) {
|
|
266
|
+
// Rate limit exceeded - call onRateLimited callback
|
|
267
|
+
if (hooks.onRateLimited) {
|
|
268
|
+
try {
|
|
269
|
+
await hooks.onRateLimited(context, checkResult);
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
// Don't let callback errors affect the result
|
|
273
|
+
console.error("onRateLimited callback error:", error);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
allowed: false,
|
|
278
|
+
retryAt: checkResult.retryAt,
|
|
279
|
+
reason: checkResult.reason ?? "Rate limit exceeded",
|
|
280
|
+
skipped: false,
|
|
281
|
+
rateLimitInfo: checkResult.rateLimitInfo,
|
|
282
|
+
config: configResult,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
// -------------------------------------------------------------------------
|
|
286
|
+
// Step 5: Execute consume hook (if provided)
|
|
287
|
+
// -------------------------------------------------------------------------
|
|
288
|
+
// If no separate consume hook, the check hook is assumed to have consumed
|
|
289
|
+
if (consumeHook) {
|
|
290
|
+
const consumeResult = await executeConsumeHook(consumeHook, context);
|
|
291
|
+
if (!consumeResult.allowed) {
|
|
292
|
+
// Consume failed (another request beat us to the limit)
|
|
293
|
+
if (hooks.onRateLimited) {
|
|
294
|
+
try {
|
|
295
|
+
await hooks.onRateLimited(context, consumeResult);
|
|
296
|
+
}
|
|
297
|
+
catch (error) {
|
|
298
|
+
console.error("onRateLimited callback error:", error);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return {
|
|
302
|
+
allowed: false,
|
|
303
|
+
retryAt: consumeResult.retryAt,
|
|
304
|
+
reason: consumeResult.reason ?? "Rate limit exceeded",
|
|
305
|
+
skipped: false,
|
|
306
|
+
rateLimitInfo: consumeResult.rateLimitInfo,
|
|
307
|
+
config: configResult,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
// -------------------------------------------------------------------------
|
|
312
|
+
// All checks passed
|
|
313
|
+
// -------------------------------------------------------------------------
|
|
314
|
+
return {
|
|
315
|
+
allowed: true,
|
|
316
|
+
skipped: false,
|
|
317
|
+
rateLimitInfo: checkResult.rateLimitInfo,
|
|
318
|
+
config: configResult,
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Execute rate limit hooks and throw RateLimitedError if rate limited.
|
|
323
|
+
*
|
|
324
|
+
* This is a convenience wrapper that executes hooks and throws
|
|
325
|
+
* RateLimitedError if the operation is rate limited.
|
|
326
|
+
*
|
|
327
|
+
* @param options - Rate limit execution options
|
|
328
|
+
* @throws RateLimitedError if the operation is rate limited
|
|
329
|
+
* @returns The rate limit result (if allowed)
|
|
330
|
+
*/
|
|
331
|
+
export async function requireRateLimit(options) {
|
|
332
|
+
const result = await executeRateLimitHooks(options);
|
|
333
|
+
if (!result.allowed) {
|
|
334
|
+
throw new RateLimitedError(result.reason ?? "Rate limit exceeded", {
|
|
335
|
+
retryAt: result.retryAt,
|
|
336
|
+
operation: options.context.operation,
|
|
337
|
+
operationCategory: options.context.operationCategory,
|
|
338
|
+
rateLimitInfo: result.rateLimitInfo,
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
return result;
|
|
342
|
+
}
|
|
343
|
+
// =============================================================================
|
|
344
|
+
// Utility Functions for Building Rate Limit Hooks
|
|
345
|
+
// =============================================================================
|
|
346
|
+
/**
|
|
347
|
+
* Creates a simple rate limit key from context.
|
|
348
|
+
* Default format: `{userId}:{operationCategory}`
|
|
349
|
+
*/
|
|
350
|
+
export function createRateLimitKey(context, options) {
|
|
351
|
+
const parts = [];
|
|
352
|
+
if (options?.prefix) {
|
|
353
|
+
parts.push(options.prefix);
|
|
354
|
+
}
|
|
355
|
+
if (context.userId) {
|
|
356
|
+
parts.push(context.userId);
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
parts.push("anonymous");
|
|
360
|
+
}
|
|
361
|
+
if (options?.includeOperation) {
|
|
362
|
+
parts.push(context.operation);
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
parts.push(context.operationCategory);
|
|
366
|
+
}
|
|
367
|
+
if (options?.includeContentType && context.contentTypeName) {
|
|
368
|
+
parts.push(context.contentTypeName);
|
|
369
|
+
}
|
|
370
|
+
return parts.join(":");
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Creates a rate limit name from operation category.
|
|
374
|
+
* Useful for mapping to named rate limits in convex-helpers.
|
|
375
|
+
*/
|
|
376
|
+
export function createRateLimitName(context, prefix = "cms") {
|
|
377
|
+
return `${prefix}.${context.operationCategory}`;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Default tier-based rate limit configurations.
|
|
381
|
+
* Can be used as a starting point for custom configurations.
|
|
382
|
+
*/
|
|
383
|
+
export const DEFAULT_TIER_LIMITS = {
|
|
384
|
+
free: {
|
|
385
|
+
read: { rate: 100, period: 60000 }, // 100 reads per minute
|
|
386
|
+
write: { rate: 10, period: 60000 }, // 10 writes per minute
|
|
387
|
+
publish: { rate: 5, period: 60000 }, // 5 publishes per minute
|
|
388
|
+
media: { rate: 10, period: 60000 }, // 10 media ops per minute
|
|
389
|
+
admin: { rate: 5, period: 60000 }, // 5 admin ops per minute
|
|
390
|
+
},
|
|
391
|
+
pro: {
|
|
392
|
+
read: { rate: 500, period: 60000 },
|
|
393
|
+
write: { rate: 50, period: 60000 },
|
|
394
|
+
publish: { rate: 20, period: 60000 },
|
|
395
|
+
media: { rate: 50, period: 60000 },
|
|
396
|
+
admin: { rate: 20, period: 60000 },
|
|
397
|
+
},
|
|
398
|
+
enterprise: {
|
|
399
|
+
read: { rate: 2000, period: 60000 },
|
|
400
|
+
write: { rate: 200, period: 60000 },
|
|
401
|
+
publish: { rate: 100, period: 60000 },
|
|
402
|
+
media: { rate: 200, period: 60000 },
|
|
403
|
+
admin: { rate: 100, period: 60000 },
|
|
404
|
+
},
|
|
405
|
+
};
|
|
406
|
+
/**
|
|
407
|
+
* Get rate limit configuration for a user tier and operation category.
|
|
408
|
+
*/
|
|
409
|
+
export function getTierLimit(tier, category) {
|
|
410
|
+
return DEFAULT_TIER_LIMITS[tier][category];
|
|
411
|
+
}
|
|
412
|
+
//# sourceMappingURL=rateLimitHooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rateLimitHooks.js","sourceRoot":"","sources":["../../src/component/rateLimitHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAoEH;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,IAAI,GAAG,cAAc,CAAC;IACtB,OAAO,CAAU;IACjB,SAAS,CAAgB;IACzB,iBAAiB,CAAqB;IACtC,aAAa,CAAyC;IAE/D,YACE,OAAe,EACf,OAKC;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,OAAO,EAAE,SAAS,CAAC;QACpC,IAAI,CAAC,iBAAiB,GAAG,OAAO,EAAE,iBAAiB,CAAC;QACpD,IAAI,CAAC,aAAa,GAAG,OAAO,EAAE,aAAa,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,aAAa;QACX,IAAI,I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