@revealui/core 0.2.0 → 0.3.0
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/README.md +137 -30
- package/dist/api/compression.d.ts.map +1 -1
- package/dist/api/payload-optimization.d.ts.map +1 -1
- package/dist/api/rate-limit.d.ts +30 -29
- package/dist/api/rate-limit.d.ts.map +1 -1
- package/dist/api/rate-limit.js +79 -4
- package/dist/api/response-cache.d.ts.map +1 -1
- package/dist/api/response-cache.js +1 -1
- package/dist/api/rest.d.ts.map +1 -1
- package/dist/api/rest.js +5 -4
- package/dist/auth/access.d.ts.map +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/cache/query-cache.d.ts +12 -10
- package/dist/cache/query-cache.d.ts.map +1 -1
- package/dist/cache/query-cache.js +38 -42
- package/dist/caching/app-cache.d.ts +5 -0
- package/dist/caching/app-cache.d.ts.map +1 -1
- package/dist/caching/app-cache.js +9 -1
- package/dist/caching/cdn-config.d.ts +2 -2
- package/dist/caching/cdn-config.d.ts.map +1 -1
- package/dist/caching/cdn-config.js +5 -15
- package/dist/caching/edge-cache.d.ts +1 -1
- package/dist/caching/edge-cache.d.ts.map +1 -1
- package/dist/caching/edge-cache.js +44 -11
- package/dist/caching/index.d.ts +6 -0
- package/dist/caching/index.d.ts.map +1 -0
- package/dist/caching/index.js +5 -0
- package/dist/caching/service-worker.d.ts +10 -18
- package/dist/caching/service-worker.d.ts.map +1 -1
- package/dist/caching/service-worker.js +5 -4
- package/dist/client/admin/RichText.d.ts +1 -1
- package/dist/client/admin/RichText.d.ts.map +1 -1
- package/dist/client/admin/components/AdminDashboard.d.ts.map +1 -1
- package/dist/client/admin/components/AdminDashboard.js +178 -205
- package/dist/client/admin/components/CollectionList.d.ts.map +1 -1
- package/dist/client/admin/components/DocumentForm.d.ts.map +1 -1
- package/dist/client/admin/components/DocumentForm.js +130 -6
- package/dist/client/admin/components/GlobalForm.d.ts.map +1 -1
- package/dist/client/admin/context/ServerFunctionContext.d.ts +8 -0
- package/dist/client/admin/context/ServerFunctionContext.d.ts.map +1 -0
- package/dist/client/admin/context/ServerFunctionContext.js +15 -0
- package/dist/client/admin/i18n/en.d.ts.map +1 -1
- package/dist/client/admin/index.d.ts +1 -0
- package/dist/client/admin/index.d.ts.map +1 -1
- package/dist/client/admin/index.js +1 -0
- package/dist/client/admin/layout.d.ts +1 -1
- package/dist/client/admin/layout.d.ts.map +1 -1
- package/dist/client/admin/layout.js +3 -2
- package/dist/client/admin/page.d.ts.map +1 -1
- package/dist/client/admin/utils/apiClient.d.ts.map +1 -1
- package/dist/client/admin/utils/apiClient.js +0 -4
- package/dist/client/admin/utils/auth.d.ts +0 -4
- package/dist/client/admin/utils/auth.d.ts.map +1 -1
- package/dist/client/admin/utils/auth.js +0 -6
- package/dist/client/admin/utils/index.d.ts +0 -1
- package/dist/client/admin/utils/index.d.ts.map +1 -1
- package/dist/client/admin/utils/index.js +0 -1
- package/dist/client/admin/utils/serializeConfig.d.ts.map +1 -1
- package/dist/client/hooks.d.ts.map +1 -1
- package/dist/client/index.d.ts +0 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +0 -2
- package/dist/client/richtext/RichTextEditor.d.ts.map +1 -1
- package/dist/client/richtext/components/ImageNodeComponent.d.ts.map +1 -1
- package/dist/client/richtext/components/ImageNodeComponent.js +0 -1
- package/dist/client/richtext/components/ImageUploadButton.d.ts +2 -0
- package/dist/client/richtext/components/ImageUploadButton.d.ts.map +1 -1
- package/dist/client/richtext/components/ImageUploadButton.js +30 -15
- package/dist/client/richtext/index.d.ts.map +1 -1
- package/dist/client/richtext/nodes/DecoratorBlockNode.d.ts.map +1 -1
- package/dist/client/richtext/nodes/ImageNode.d.ts.map +1 -1
- package/dist/client/richtext/plugins/CollaborationPlugin.d.ts.map +1 -1
- package/dist/client/richtext/plugins/CursorsOverlayPlugin.d.ts.map +1 -1
- package/dist/client/richtext/plugins/FloatingToolbarPlugin.d.ts.map +1 -1
- package/dist/client/richtext/plugins/ImagePlugin.d.ts.map +1 -1
- package/dist/client/richtext/plugins/ToolbarPlugin.d.ts.map +1 -1
- package/dist/client/ui/index.d.ts.map +1 -1
- package/dist/client/ui/index.js +1 -1
- package/dist/collections/CollectionOperations.d.ts +7 -7
- package/dist/collections/CollectionOperations.d.ts.map +1 -1
- package/dist/collections/CollectionOperations.js +15 -1
- package/dist/collections/hooks.d.ts.map +1 -1
- package/dist/collections/index.d.ts.map +1 -1
- package/dist/collections/operations/create.d.ts +2 -4
- package/dist/collections/operations/create.d.ts.map +1 -1
- package/dist/collections/operations/create.js +9 -7
- package/dist/collections/operations/createMany.d.ts +12 -0
- package/dist/collections/operations/createMany.d.ts.map +1 -0
- package/dist/collections/operations/createMany.js +43 -0
- package/dist/collections/operations/delete.d.ts +1 -1
- package/dist/collections/operations/delete.d.ts.map +1 -1
- package/dist/collections/operations/delete.js +31 -2
- package/dist/collections/operations/deleteMany.d.ts +11 -0
- package/dist/collections/operations/deleteMany.d.ts.map +1 -0
- package/dist/collections/operations/deleteMany.js +50 -0
- package/dist/collections/operations/fieldHooks.d.ts +2 -2
- package/dist/collections/operations/fieldHooks.d.ts.map +1 -1
- package/dist/collections/operations/fieldHooks.js +4 -4
- package/dist/collections/operations/find.d.ts +2 -4
- package/dist/collections/operations/find.d.ts.map +1 -1
- package/dist/collections/operations/find.js +115 -8
- package/dist/collections/operations/findById.d.ts +3 -4
- package/dist/collections/operations/findById.d.ts.map +1 -1
- package/dist/collections/operations/findById.js +53 -1
- package/dist/collections/operations/sqlAdapter.d.ts +23 -0
- package/dist/collections/operations/sqlAdapter.d.ts.map +1 -0
- package/dist/collections/operations/sqlAdapter.js +76 -0
- package/dist/collections/operations/update.d.ts +3 -5
- package/dist/collections/operations/update.d.ts.map +1 -1
- package/dist/collections/operations/update.js +103 -11
- package/dist/collections/operations/updateMany.d.ts +11 -0
- package/dist/collections/operations/updateMany.d.ts.map +1 -0
- package/dist/collections/operations/updateMany.js +52 -0
- package/dist/collections/registry.d.ts +12 -0
- package/dist/collections/registry.d.ts.map +1 -0
- package/dist/collections/registry.js +38 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/runtime.d.ts.map +1 -1
- package/dist/config/utils.d.ts +0 -10
- package/dist/config/utils.d.ts.map +1 -1
- package/dist/config/utils.js +18 -17
- package/dist/database/index.d.ts +3 -0
- package/dist/database/index.d.ts.map +1 -1
- package/dist/database/index.js +1 -5
- package/dist/database/safe-parse.d.ts +26 -0
- package/dist/database/safe-parse.d.ts.map +1 -0
- package/dist/database/safe-parse.js +42 -0
- package/dist/database/ssl-config.d.ts.map +1 -1
- package/dist/database/type-adapter.d.ts.map +1 -1
- package/dist/database/universal-postgres.d.ts.map +1 -1
- package/dist/database/universal-postgres.js +18 -13
- package/dist/dataloader.d.ts.map +1 -1
- package/dist/dataloader.js +16 -2
- package/dist/error-handling/circuit-breaker.d.ts +1 -1
- package/dist/error-handling/circuit-breaker.d.ts.map +1 -1
- package/dist/error-handling/circuit-breaker.js +11 -3
- package/dist/error-handling/error-boundary.d.ts.map +1 -1
- package/dist/error-handling/error-reporter.d.ts +6 -5
- package/dist/error-handling/error-reporter.d.ts.map +1 -1
- package/dist/error-handling/error-reporter.js +26 -41
- package/dist/error-handling/fallback-components.d.ts.map +1 -1
- package/dist/error-handling/fallback-components.js +1 -1
- package/dist/error-handling/index.d.ts +3 -5
- package/dist/error-handling/index.d.ts.map +1 -1
- package/dist/error-handling/index.js +2 -5
- package/dist/error-handling/retry.d.ts.map +1 -1
- package/dist/error-handling/retry.js +13 -8
- package/dist/factories/builders.d.ts.map +1 -1
- package/dist/factories/index.d.ts.map +1 -1
- package/dist/features.d.ts +5 -5
- package/dist/features.d.ts.map +1 -1
- package/dist/features.js +6 -5
- package/dist/fieldTraversal.d.ts.map +1 -1
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/getDefaultValue.d.ts.map +1 -1
- package/dist/fields/getFieldPaths.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/index.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
- package/dist/generated/types/cms.d.ts.map +1 -1
- package/dist/generated/types/cms.js +0 -1
- package/dist/generated/types/index.d.ts +0 -3
- package/dist/generated/types/index.d.ts.map +1 -1
- package/dist/generated/types/index.js +0 -7
- package/dist/generated/types/neon.d.ts.map +1 -1
- package/dist/generated/types/neon.js +4 -2
- package/dist/globals/GlobalOperations.d.ts.map +1 -1
- package/dist/globals/GlobalOperations.js +4 -2
- package/dist/globals/index.d.ts.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -6
- package/dist/instance/RevealUIInstance.d.ts.map +1 -1
- package/dist/instance/RevealUIInstance.js +50 -69
- package/dist/instance/index.d.ts.map +1 -1
- package/dist/instance/logger.d.ts.map +1 -1
- package/dist/instance/methods/create.d.ts.map +1 -1
- package/dist/instance/methods/create.js +4 -4
- package/dist/instance/methods/delete.d.ts.map +1 -1
- package/dist/instance/methods/delete.js +5 -5
- package/dist/instance/methods/find.d.ts.map +1 -1
- package/dist/instance/methods/find.js +0 -3
- package/dist/instance/methods/findById.d.ts.map +1 -1
- package/dist/instance/methods/findById.js +0 -3
- package/dist/instance/methods/hooks.d.ts.map +1 -1
- package/dist/instance/methods/hooks.js +3 -1
- package/dist/instance/methods/update.d.ts.map +1 -1
- package/dist/instance/methods/update.js +4 -4
- package/dist/jobs/index.d.ts +16 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +14 -0
- package/dist/jobs/queue.d.ts +57 -0
- package/dist/jobs/queue.d.ts.map +1 -0
- package/dist/jobs/queue.js +134 -0
- package/dist/license-encryption.d.ts +21 -0
- package/dist/license-encryption.d.ts.map +1 -0
- package/dist/license-encryption.js +74 -0
- package/dist/license.d.ts +33 -7
- package/dist/license.d.ts.map +1 -1
- package/dist/license.js +119 -16
- package/dist/monitoring/alerts.d.ts.map +1 -1
- package/dist/monitoring/cleanup-manager.d.ts.map +1 -1
- package/dist/monitoring/health-monitor.d.ts.map +1 -1
- package/dist/monitoring/index.d.ts.map +1 -1
- package/dist/monitoring/process-registry.d.ts.map +1 -1
- package/dist/monitoring/query-monitor.d.ts.map +1 -1
- package/dist/monitoring/types.d.ts.map +1 -1
- package/dist/monitoring/zombie-detector.d.ts.map +1 -1
- package/dist/monitoring/zombie-detector.js +5 -0
- package/dist/nextjs/index.d.ts.map +1 -1
- package/dist/nextjs/utilities.d.ts.map +1 -1
- package/dist/nextjs/withRevealUI.d.ts.map +1 -1
- package/dist/observability/alerts.d.ts.map +1 -1
- package/dist/observability/alerts.js +1 -2
- package/dist/observability/health-check.d.ts +1 -5
- package/dist/observability/health-check.d.ts.map +1 -1
- package/dist/observability/health-check.js +37 -43
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/logger.d.ts.map +1 -1
- package/dist/observability/logger.js +1 -1
- package/dist/observability/metrics.d.ts.map +1 -1
- package/dist/observability/tracing.d.ts.map +1 -1
- package/dist/observability/tracing.js +0 -1
- package/dist/optimization/asset-optimizer.d.ts +6 -2
- package/dist/optimization/asset-optimizer.d.ts.map +1 -1
- package/dist/optimization/asset-optimizer.js +31 -7
- package/dist/optimization/bundle-analyzer.d.ts +1 -1
- package/dist/optimization/bundle-analyzer.d.ts.map +1 -1
- package/dist/optimization/bundle-analyzer.js +29 -5
- package/dist/optimization/code-splitting.d.ts +0 -23
- package/dist/optimization/code-splitting.d.ts.map +1 -1
- package/dist/optimization/code-splitting.js +0 -29
- package/dist/plugins/form-builder.d.ts.map +1 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/nested-docs.d.ts +4 -0
- package/dist/plugins/nested-docs.d.ts.map +1 -1
- package/dist/plugins/nested-docs.js +50 -5
- package/dist/plugins/redirects.d.ts.map +1 -1
- package/dist/queries/index.d.ts.map +1 -1
- package/dist/queries/queryBuilder.d.ts.map +1 -1
- package/dist/queries/queryBuilder.js +15 -5
- package/dist/relationships/analyzer.d.ts.map +1 -1
- package/dist/relationships/analyzer.js +8 -0
- package/dist/relationships/index.d.ts.map +1 -1
- package/dist/relationships/populate-core.d.ts +57 -0
- package/dist/relationships/populate-core.d.ts.map +1 -0
- package/dist/relationships/populate-core.js +116 -0
- package/dist/relationships/populate-helpers.d.ts +5 -51
- package/dist/relationships/populate-helpers.d.ts.map +1 -1
- package/dist/relationships/populate-helpers.js +4 -109
- package/dist/relationships/population.d.ts +1 -9
- package/dist/relationships/population.d.ts.map +1 -1
- package/dist/relationships/population.js +8 -3
- package/dist/revealui.d.ts.map +1 -1
- package/dist/richtext/exports/client/rcc.d.ts.map +1 -1
- package/dist/richtext/exports/client/rcc.js +1 -1
- package/dist/richtext/exports/server/rsc.d.ts +17 -0
- package/dist/richtext/exports/server/rsc.d.ts.map +1 -1
- package/dist/richtext/exports/server/rsc.js +61 -5
- package/dist/richtext/index.d.ts.map +1 -1
- package/dist/richtext/lexical.d.ts.map +1 -1
- package/dist/security/audit.d.ts +1 -1
- package/dist/security/audit.d.ts.map +1 -1
- package/dist/security/audit.js +4 -2
- package/dist/security/auth.d.ts +29 -160
- package/dist/security/auth.d.ts.map +1 -1
- package/dist/security/auth.js +150 -367
- package/dist/security/authorization.d.ts +7 -31
- package/dist/security/authorization.d.ts.map +1 -1
- package/dist/security/authorization.js +72 -14
- package/dist/security/encryption.d.ts +56 -44
- package/dist/security/encryption.d.ts.map +1 -1
- package/dist/security/encryption.js +128 -100
- package/dist/security/gdpr-storage.d.ts +102 -0
- package/dist/security/gdpr-storage.d.ts.map +1 -0
- package/dist/security/gdpr-storage.js +65 -0
- package/dist/security/gdpr.d.ts +57 -37
- package/dist/security/gdpr.d.ts.map +1 -1
- package/dist/security/gdpr.js +155 -94
- package/dist/security/headers.d.ts +4 -2
- package/dist/security/headers.d.ts.map +1 -1
- package/dist/security/headers.js +35 -17
- package/dist/security/index.d.ts +3 -16
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +3 -16
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/renderPage.d.ts.map +1 -1
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +2 -4
- package/dist/storage/vercel-blob.d.ts.map +1 -1
- package/dist/translations/index.d.ts.map +1 -1
- package/dist/types/access.d.ts.map +1 -1
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/cms.d.ts.map +1 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/extensions.d.ts.map +1 -1
- package/dist/types/frontend.d.ts.map +1 -1
- package/dist/types/generated.d.ts +0 -2
- package/dist/types/generated.d.ts.map +1 -1
- package/dist/types/generated.js +0 -1
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/interfaces/app.d.ts.map +1 -1
- package/dist/types/jobs.d.ts.map +1 -1
- package/dist/types/legacy.d.ts.map +1 -1
- package/dist/types/plugins.d.ts.map +1 -1
- package/dist/types/query.d.ts.map +1 -1
- package/dist/types/request.d.ts.map +1 -1
- package/dist/types/richtext.d.ts.map +1 -1
- package/dist/types/runtime.d.ts +59 -1
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/schema.d.ts.map +1 -1
- package/dist/types/user.d.ts.map +1 -1
- package/dist/utils/access-conversion.d.ts.map +1 -1
- package/dist/utils/api-wrapper.d.ts.map +1 -1
- package/dist/utils/api-wrapper.js +1 -1
- package/dist/utils/block-conversion.d.ts.map +1 -1
- package/dist/utils/cache.d.ts.map +1 -1
- package/dist/utils/deep-clone.js +0 -1
- package/dist/utils/error-responses.d.ts.map +1 -1
- package/dist/utils/errors.d.ts +36 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +103 -0
- package/dist/utils/field-conversion.d.ts +1 -1
- package/dist/utils/field-conversion.d.ts.map +1 -1
- package/dist/utils/flattenResult.d.ts.map +1 -1
- package/dist/utils/flattenResult.js +0 -1
- package/dist/utils/getBlockSelect.d.ts.map +1 -1
- package/dist/utils/getSelectMode.d.ts.map +1 -1
- package/dist/utils/isValidID.d.ts.map +1 -1
- package/dist/utils/json-parsing.d.ts.map +1 -1
- package/dist/utils/logger-client.d.ts.map +1 -1
- package/dist/utils/logger-server.d.ts.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/request-context.d.ts.map +1 -1
- package/dist/utils/stripUnselectedFields.d.ts.map +1 -1
- package/dist/utils/type-guards.d.ts.map +1 -1
- package/package.json +39 -16
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PostgreSQL-backed Job Queue
|
|
3
|
+
*
|
|
4
|
+
* Uses raw SQL via a database executor for portability.
|
|
5
|
+
* Supports: delayed jobs, retries with exponential backoff, priorities, expiration.
|
|
6
|
+
*
|
|
7
|
+
* The jobs table must exist (see packages/db/src/schema/jobs.ts).
|
|
8
|
+
*/
|
|
9
|
+
const DEFAULT_CONFIG = {
|
|
10
|
+
pollingIntervalMs: 5000,
|
|
11
|
+
concurrency: 5,
|
|
12
|
+
defaultRetryLimit: 3,
|
|
13
|
+
retryBackoffMs: 1000,
|
|
14
|
+
};
|
|
15
|
+
// =============================================================================
|
|
16
|
+
// Implementation
|
|
17
|
+
// =============================================================================
|
|
18
|
+
export function createJobQueue(executor, overrides) {
|
|
19
|
+
const config = { ...DEFAULT_CONFIG, ...overrides };
|
|
20
|
+
const timers = [];
|
|
21
|
+
const activeJobs = new Set();
|
|
22
|
+
let stopped = false;
|
|
23
|
+
async function send(name, data, options) {
|
|
24
|
+
const id = crypto.randomUUID();
|
|
25
|
+
let startAfter = new Date();
|
|
26
|
+
if (options?.startAfter instanceof Date) {
|
|
27
|
+
startAfter = options.startAfter;
|
|
28
|
+
}
|
|
29
|
+
else if (typeof options?.startAfter === 'number') {
|
|
30
|
+
startAfter = new Date(Date.now() + options.startAfter);
|
|
31
|
+
}
|
|
32
|
+
await executor.execute(`INSERT INTO jobs (id, name, data, state, priority, retry_limit, start_after, expire_at, created_at)
|
|
33
|
+
VALUES ($1, $2, $3, 'created', $4, $5, $6, $7, NOW())`, [
|
|
34
|
+
id,
|
|
35
|
+
name,
|
|
36
|
+
JSON.stringify(data),
|
|
37
|
+
options?.priority ?? 0,
|
|
38
|
+
options?.retryLimit ?? config.defaultRetryLimit,
|
|
39
|
+
startAfter.toISOString(),
|
|
40
|
+
options?.expireAt?.toISOString() ?? null,
|
|
41
|
+
]);
|
|
42
|
+
return id;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Atomically claim the next available job using FOR UPDATE SKIP LOCKED.
|
|
46
|
+
*/
|
|
47
|
+
async function fetchNextJob(name) {
|
|
48
|
+
const result = await executor.execute(`UPDATE jobs
|
|
49
|
+
SET state = 'active', started_at = NOW()
|
|
50
|
+
WHERE id = (
|
|
51
|
+
SELECT id FROM jobs
|
|
52
|
+
WHERE name = $1
|
|
53
|
+
AND state IN ('created', 'retry')
|
|
54
|
+
AND start_after <= NOW()
|
|
55
|
+
AND (expire_at IS NULL OR expire_at > NOW())
|
|
56
|
+
ORDER BY priority DESC, created_at ASC
|
|
57
|
+
LIMIT 1
|
|
58
|
+
FOR UPDATE SKIP LOCKED
|
|
59
|
+
)
|
|
60
|
+
RETURNING id, name, data, retry_count`, [name]);
|
|
61
|
+
const row = result.rows[0];
|
|
62
|
+
if (!row)
|
|
63
|
+
return null;
|
|
64
|
+
return {
|
|
65
|
+
id: row.id,
|
|
66
|
+
name: row.name,
|
|
67
|
+
data: (typeof row.data === 'string' ? JSON.parse(row.data) : row.data),
|
|
68
|
+
retryCount: row.retry_count ?? 0,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
async function completeJob(id) {
|
|
72
|
+
await executor.execute(`UPDATE jobs SET state = 'completed', completed_at = NOW() WHERE id = $1`, [id]);
|
|
73
|
+
}
|
|
74
|
+
async function failJob(id, retryCount, retryLimit, error) {
|
|
75
|
+
if (retryCount + 1 < retryLimit) {
|
|
76
|
+
const delay = config.retryBackoffMs * 2 ** retryCount;
|
|
77
|
+
const nextRetry = new Date(Date.now() + delay);
|
|
78
|
+
await executor.execute(`UPDATE jobs SET state = 'retry', retry_count = $1, start_after = $2, output = $3 WHERE id = $4`, [retryCount + 1, nextRetry.toISOString(), JSON.stringify({ error }), id]);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
await executor.execute(`UPDATE jobs SET state = 'failed', retry_count = $1, completed_at = NOW(), output = $2 WHERE id = $3`, [retryCount + 1, JSON.stringify({ error }), id]);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async function poll(name, handler) {
|
|
85
|
+
if (stopped)
|
|
86
|
+
return;
|
|
87
|
+
if (activeJobs.size >= config.concurrency)
|
|
88
|
+
return;
|
|
89
|
+
try {
|
|
90
|
+
const job = await fetchNextJob(name);
|
|
91
|
+
if (!job)
|
|
92
|
+
return;
|
|
93
|
+
activeJobs.add(job.id);
|
|
94
|
+
try {
|
|
95
|
+
await handler(job);
|
|
96
|
+
await completeJob(job.id);
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
100
|
+
config.logger?.error(`Job ${name}/${job.id} failed: ${errorMsg}`);
|
|
101
|
+
await failJob(job.id, job.retryCount, config.defaultRetryLimit, errorMsg);
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
activeJobs.delete(job.id);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
config.logger?.error(`Job queue poll error for ${name}: ${err instanceof Error ? err.message : String(err)}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function work(name, handler) {
|
|
112
|
+
const timer = setInterval(() => {
|
|
113
|
+
void poll(name, handler);
|
|
114
|
+
}, config.pollingIntervalMs);
|
|
115
|
+
timers.push(timer);
|
|
116
|
+
void poll(name, handler);
|
|
117
|
+
}
|
|
118
|
+
function stop() {
|
|
119
|
+
stopped = true;
|
|
120
|
+
for (const timer of timers) {
|
|
121
|
+
clearInterval(timer);
|
|
122
|
+
}
|
|
123
|
+
timers.length = 0;
|
|
124
|
+
}
|
|
125
|
+
async function getQueueStats() {
|
|
126
|
+
const result = await executor.execute(`SELECT state, count(*)::int as count FROM jobs GROUP BY state`);
|
|
127
|
+
const stats = {};
|
|
128
|
+
for (const row of result.rows) {
|
|
129
|
+
stats[row.state] = row.count;
|
|
130
|
+
}
|
|
131
|
+
return stats;
|
|
132
|
+
}
|
|
133
|
+
return { send, work, stop, getQueueStats };
|
|
134
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AES-256-GCM encryption for license keys at rest.
|
|
3
|
+
*
|
|
4
|
+
* Format: enc:<iv-hex>:<ciphertext-hex>:<auth-tag-hex>
|
|
5
|
+
* Falls back to plaintext when REVEALUI_LICENSE_ENCRYPTION_KEY is not set.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Encrypt a plaintext license key.
|
|
9
|
+
* Returns `enc:<iv>:<ciphertext>:<tag>` or the original plaintext if no key is configured.
|
|
10
|
+
*/
|
|
11
|
+
export declare function encryptLicenseKey(plaintext: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Decrypt a license key.
|
|
14
|
+
* If the value doesn't start with `enc:`, returns it as-is (plaintext fallback).
|
|
15
|
+
*/
|
|
16
|
+
export declare function decryptLicenseKey(stored: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Check whether a stored license key value is encrypted.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isEncryptedLicenseKey(value: string): boolean;
|
|
21
|
+
//# sourceMappingURL=license-encryption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"license-encryption.d.ts","sourceRoot":"","sources":["../src/license-encryption.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyBH;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAW3D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CA+BxD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE5D"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AES-256-GCM encryption for license keys at rest.
|
|
3
|
+
*
|
|
4
|
+
* Format: enc:<iv-hex>:<ciphertext-hex>:<auth-tag-hex>
|
|
5
|
+
* Falls back to plaintext when REVEALUI_LICENSE_ENCRYPTION_KEY is not set.
|
|
6
|
+
*/
|
|
7
|
+
import { createCipheriv, createDecipheriv, createHash, randomBytes } from 'node:crypto';
|
|
8
|
+
const ENC_PREFIX = 'enc:';
|
|
9
|
+
const ALGORITHM = 'aes-256-gcm';
|
|
10
|
+
const IV_BYTES = 12;
|
|
11
|
+
/**
|
|
12
|
+
* Derives a 32-byte key from the env var value.
|
|
13
|
+
* Accepts either a 64-char hex string or an arbitrary passphrase (hashed to 32 bytes).
|
|
14
|
+
*/
|
|
15
|
+
function deriveKey(raw) {
|
|
16
|
+
if (/^[0-9a-f]{64}$/i.test(raw)) {
|
|
17
|
+
return Buffer.from(raw, 'hex');
|
|
18
|
+
}
|
|
19
|
+
return createHash('sha256').update(raw).digest();
|
|
20
|
+
}
|
|
21
|
+
function getEncryptionKey() {
|
|
22
|
+
const raw = process.env.REVEALUI_LICENSE_ENCRYPTION_KEY;
|
|
23
|
+
if (!raw)
|
|
24
|
+
return null;
|
|
25
|
+
return deriveKey(raw);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Encrypt a plaintext license key.
|
|
29
|
+
* Returns `enc:<iv>:<ciphertext>:<tag>` or the original plaintext if no key is configured.
|
|
30
|
+
*/
|
|
31
|
+
export function encryptLicenseKey(plaintext) {
|
|
32
|
+
const key = getEncryptionKey();
|
|
33
|
+
if (!key)
|
|
34
|
+
return plaintext;
|
|
35
|
+
const iv = randomBytes(IV_BYTES);
|
|
36
|
+
const cipher = createCipheriv(ALGORITHM, key, iv);
|
|
37
|
+
const encrypted = Buffer.concat([cipher.update(plaintext, 'utf8'), cipher.final()]);
|
|
38
|
+
const tag = cipher.getAuthTag();
|
|
39
|
+
return `${ENC_PREFIX}${iv.toString('hex')}:${encrypted.toString('hex')}:${tag.toString('hex')}`;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Decrypt a license key.
|
|
43
|
+
* If the value doesn't start with `enc:`, returns it as-is (plaintext fallback).
|
|
44
|
+
*/
|
|
45
|
+
export function decryptLicenseKey(stored) {
|
|
46
|
+
if (!stored.startsWith(ENC_PREFIX)) {
|
|
47
|
+
return stored; // plaintext — backward compatible
|
|
48
|
+
}
|
|
49
|
+
const key = getEncryptionKey();
|
|
50
|
+
if (!key) {
|
|
51
|
+
throw new Error('Encrypted license key found but REVEALUI_LICENSE_ENCRYPTION_KEY is not set. ' +
|
|
52
|
+
'Cannot decrypt without the encryption key.');
|
|
53
|
+
}
|
|
54
|
+
const parts = stored.slice(ENC_PREFIX.length).split(':');
|
|
55
|
+
if (parts.length !== 3) {
|
|
56
|
+
throw new Error('Malformed encrypted license key — expected enc:<iv>:<ciphertext>:<tag>');
|
|
57
|
+
}
|
|
58
|
+
const [ivHex, ciphertextHex, tagHex] = parts;
|
|
59
|
+
const iv = Buffer.from(ivHex, 'hex');
|
|
60
|
+
const ciphertext = Buffer.from(ciphertextHex, 'hex');
|
|
61
|
+
const tag = Buffer.from(tagHex, 'hex');
|
|
62
|
+
if (iv.length !== IV_BYTES) {
|
|
63
|
+
throw new Error(`Invalid IV length: expected ${IV_BYTES} bytes, got ${iv.length}`);
|
|
64
|
+
}
|
|
65
|
+
const decipher = createDecipheriv(ALGORITHM, key, iv);
|
|
66
|
+
decipher.setAuthTag(tag);
|
|
67
|
+
return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString('utf8');
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Check whether a stored license key value is encrypted.
|
|
71
|
+
*/
|
|
72
|
+
export function isEncryptedLicenseKey(value) {
|
|
73
|
+
return value.startsWith(ENC_PREFIX);
|
|
74
|
+
}
|
package/dist/license.d.ts
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
/** Available license tiers */
|
|
10
|
-
export type LicenseTier = 'free' | 'pro' | 'enterprise';
|
|
10
|
+
export type LicenseTier = 'free' | 'pro' | 'max' | 'enterprise';
|
|
11
11
|
/** Decoded license payload schema */
|
|
12
12
|
declare const licensePayloadSchema: z.ZodObject<{
|
|
13
13
|
tier: z.ZodEnum<{
|
|
14
|
+
max: "max";
|
|
14
15
|
pro: "pro";
|
|
15
16
|
enterprise: "enterprise";
|
|
16
17
|
}>;
|
|
@@ -18,10 +19,26 @@ declare const licensePayloadSchema: z.ZodObject<{
|
|
|
18
19
|
domains: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19
20
|
maxSites: z.ZodOptional<z.ZodNumber>;
|
|
20
21
|
maxUsers: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
perpetual: z.ZodOptional<z.ZodBoolean>;
|
|
21
23
|
iat: z.ZodOptional<z.ZodNumber>;
|
|
22
24
|
exp: z.ZodOptional<z.ZodNumber>;
|
|
23
25
|
}, z.core.$strip>;
|
|
24
26
|
export type LicensePayload = z.infer<typeof licensePayloadSchema>;
|
|
27
|
+
/** License cache TTL configuration */
|
|
28
|
+
export interface LicenseCacheConfig {
|
|
29
|
+
/** Cache TTL in milliseconds (default: 24 hours) */
|
|
30
|
+
ttlMs: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Configure the license cache TTL.
|
|
34
|
+
* Useful for tests (short TTL) or deployments needing faster revocation detection.
|
|
35
|
+
*/
|
|
36
|
+
export declare function configureLicenseCache(overrides: Partial<LicenseCacheConfig>): void;
|
|
37
|
+
/**
|
|
38
|
+
* Computes a deterministic Key ID (kid) from a public key PEM string.
|
|
39
|
+
* Returns the first 8 characters of the SHA-256 hex digest of the PEM.
|
|
40
|
+
*/
|
|
41
|
+
export declare function computeKeyId(publicKeyPem: string): string;
|
|
25
42
|
/**
|
|
26
43
|
* Validates a license key JWT and returns the decoded payload.
|
|
27
44
|
* Returns null if the key is invalid, expired, or missing.
|
|
@@ -36,15 +53,16 @@ export declare function validateLicenseKey(licenseKey: string, publicKey: string
|
|
|
36
53
|
export declare function initializeLicense(): Promise<LicenseTier>;
|
|
37
54
|
/**
|
|
38
55
|
* Returns the current license tier.
|
|
39
|
-
* If the license hasn't been initialized, returns 'free'.
|
|
56
|
+
* If the license hasn't been initialized or the cache has expired, returns 'free'.
|
|
40
57
|
*/
|
|
41
58
|
export declare function getCurrentTier(): LicenseTier;
|
|
42
59
|
/**
|
|
43
|
-
* Returns the full license payload, or null if no valid license.
|
|
60
|
+
* Returns the full license payload, or null if no valid license or cache expired.
|
|
44
61
|
*/
|
|
45
62
|
export declare function getLicensePayload(): LicensePayload | null;
|
|
46
63
|
/**
|
|
47
64
|
* Checks whether the current license is at least the given tier.
|
|
65
|
+
* Also validates that the license has not expired (checks JWT exp claim).
|
|
48
66
|
*/
|
|
49
67
|
export declare function isLicensed(requiredTier: LicenseTier): boolean;
|
|
50
68
|
/**
|
|
@@ -55,16 +73,24 @@ export declare function getMaxSites(): number;
|
|
|
55
73
|
* Returns the maximum number of users/editors allowed by the current license.
|
|
56
74
|
*/
|
|
57
75
|
export declare function getMaxUsers(): number;
|
|
76
|
+
/**
|
|
77
|
+
* Returns the maximum agent tasks per billing cycle for the current license.
|
|
78
|
+
* Track B metering: free=1K, pro=10K, max=50K, enterprise=unlimited.
|
|
79
|
+
*/
|
|
80
|
+
export declare function getMaxAgentTasks(): number;
|
|
58
81
|
/**
|
|
59
82
|
* Generates a signed license key JWT.
|
|
60
83
|
* This is a server-only function — requires the private key.
|
|
61
84
|
*
|
|
62
|
-
* @param payload - License payload (tier, customerId, limits)
|
|
63
|
-
* @param privateKey - RS256
|
|
64
|
-
* @param expiresInSeconds - JWT expiration in seconds.
|
|
85
|
+
* @param payload - License payload (tier, customerId, limits, perpetual flag)
|
|
86
|
+
* @param privateKey - RS256 private key (PEM format)
|
|
87
|
+
* @param expiresInSeconds - JWT expiration in seconds. Pass null for perpetual
|
|
88
|
+
* licenses (no exp claim). Defaults to 1 year for subscription licenses.
|
|
89
|
+
* @param publicKey - RS256 public key (PEM format). When provided, a `kid`
|
|
90
|
+
* claim is added to the JWT header for forward-compatible key rotation.
|
|
65
91
|
* @returns Signed JWT string
|
|
66
92
|
*/
|
|
67
|
-
export declare function generateLicenseKey(payload: Omit<LicensePayload, 'iat' | 'exp'>, privateKey: string, expiresInSeconds?: number): Promise<string>;
|
|
93
|
+
export declare function generateLicenseKey(payload: Omit<LicensePayload, 'iat' | 'exp'>, privateKey: string, expiresInSeconds?: number | null, publicKey?: string): Promise<string>;
|
|
68
94
|
/**
|
|
69
95
|
* Reset license state. Primarily for testing.
|
|
70
96
|
*/
|
package/dist/license.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../src/license.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../src/license.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,8BAA8B;AAC9B,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,YAAY,CAAC;AAEhE,qCAAqC;AACrC,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;iBAqBxB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC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ification (Web Crypto API)
|
|
6
6
|
* - zod - Schema validation for license payloads
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { createHash } from 'node:crypto';
|
|
9
|
+
import { decodeProtectedHeader, importPKCS8, importSPKI, jwtVerify, SignJWT } from 'jose';
|
|
9
10
|
import { z } from 'zod';
|
|
11
|
+
import { decryptLicenseKey } from './license-encryption.js';
|
|
12
|
+
import { logger } from './utils/logger.js';
|
|
10
13
|
/** Decoded license payload schema */
|
|
11
14
|
const licensePayloadSchema = z.object({
|
|
12
15
|
/** License tier */
|
|
13
|
-
tier: z.enum(['pro', 'enterprise']),
|
|
16
|
+
tier: z.enum(['pro', 'max', 'enterprise']),
|
|
14
17
|
/** Organization or customer ID */
|
|
15
18
|
customerId: z.string(),
|
|
16
19
|
/** Licensed domain(s) */
|
|
@@ -19,11 +22,29 @@ const licensePayloadSchema = z.object({
|
|
|
19
22
|
maxSites: z.number().int().positive().optional(),
|
|
20
23
|
/** Maximum number of users/editors allowed */
|
|
21
24
|
maxUsers: z.number().int().positive().optional(),
|
|
25
|
+
/**
|
|
26
|
+
* True for one-time perpetual purchases.
|
|
27
|
+
* When set, the exp claim is omitted from the JWT and isLicensed() skips
|
|
28
|
+
* expiry checks — the license is valid as long as it hasn't been revoked.
|
|
29
|
+
*/
|
|
30
|
+
perpetual: z.boolean().optional(),
|
|
22
31
|
/** License issued-at timestamp */
|
|
23
32
|
iat: z.number().optional(),
|
|
24
|
-
/** License expiration timestamp */
|
|
33
|
+
/** License expiration timestamp — absent for perpetual licenses */
|
|
25
34
|
exp: z.number().optional(),
|
|
26
35
|
});
|
|
36
|
+
const DEFAULT_CACHE_CONFIG = {
|
|
37
|
+
ttlMs: 5 * 60 * 1000, // 5 minutes — revoked licenses lose access within 5 min
|
|
38
|
+
};
|
|
39
|
+
let cacheConfig = { ...DEFAULT_CACHE_CONFIG };
|
|
40
|
+
let cachedAt = 0;
|
|
41
|
+
/**
|
|
42
|
+
* Configure the license cache TTL.
|
|
43
|
+
* Useful for tests (short TTL) or deployments needing faster revocation detection.
|
|
44
|
+
*/
|
|
45
|
+
export function configureLicenseCache(overrides) {
|
|
46
|
+
cacheConfig = { ...DEFAULT_CACHE_CONFIG, ...overrides };
|
|
47
|
+
}
|
|
27
48
|
let cachedState = {
|
|
28
49
|
tier: 'free',
|
|
29
50
|
payload: null,
|
|
@@ -39,9 +60,20 @@ function getPublicKey() {
|
|
|
39
60
|
}
|
|
40
61
|
/**
|
|
41
62
|
* Reads the license key from environment.
|
|
63
|
+
* Supports encrypted keys (enc:iv:ciphertext:tag format) via REVEALUI_LICENSE_ENCRYPTION_KEY.
|
|
42
64
|
*/
|
|
43
65
|
function getLicenseKey() {
|
|
44
|
-
|
|
66
|
+
const raw = process.env.REVEALUI_LICENSE_KEY ?? null;
|
|
67
|
+
if (!raw)
|
|
68
|
+
return null;
|
|
69
|
+
return decryptLicenseKey(raw);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Computes a deterministic Key ID (kid) from a public key PEM string.
|
|
73
|
+
* Returns the first 8 characters of the SHA-256 hex digest of the PEM.
|
|
74
|
+
*/
|
|
75
|
+
export function computeKeyId(publicKeyPem) {
|
|
76
|
+
return createHash('sha256').update(publicKeyPem).digest('hex').slice(0, 8);
|
|
45
77
|
}
|
|
46
78
|
/**
|
|
47
79
|
* Validates a license key JWT and returns the decoded payload.
|
|
@@ -49,6 +81,13 @@ function getLicenseKey() {
|
|
|
49
81
|
*/
|
|
50
82
|
export async function validateLicenseKey(licenseKey, publicKey) {
|
|
51
83
|
try {
|
|
84
|
+
// Extract kid from JWT header for forward-compatible key rotation
|
|
85
|
+
const header = decodeProtectedHeader(licenseKey);
|
|
86
|
+
const expectedKid = computeKeyId(publicKey);
|
|
87
|
+
if (header.kid && header.kid !== expectedKid) {
|
|
88
|
+
logger.warn(`JWT kid mismatch: token has "${header.kid}", current key is "${expectedKid}". ` +
|
|
89
|
+
'Token may have been signed with a rotated key.');
|
|
90
|
+
}
|
|
52
91
|
const key = await importSPKI(publicKey, 'RS256');
|
|
53
92
|
const { payload } = await jwtVerify(licenseKey, key, {
|
|
54
93
|
algorithms: ['RS256', 'ES256'],
|
|
@@ -74,11 +113,13 @@ export async function initializeLicense() {
|
|
|
74
113
|
const publicKey = getPublicKey();
|
|
75
114
|
if (!(licenseKey && publicKey)) {
|
|
76
115
|
cachedState = { tier: 'free', payload: null, validatedAt: Date.now() };
|
|
116
|
+
cachedAt = Date.now();
|
|
77
117
|
return 'free';
|
|
78
118
|
}
|
|
79
119
|
const payload = await validateLicenseKey(licenseKey, publicKey);
|
|
80
120
|
if (!payload) {
|
|
81
121
|
cachedState = { tier: 'free', payload: null, validatedAt: Date.now() };
|
|
122
|
+
cachedAt = Date.now();
|
|
82
123
|
return 'free';
|
|
83
124
|
}
|
|
84
125
|
cachedState = {
|
|
@@ -86,38 +127,74 @@ export async function initializeLicense() {
|
|
|
86
127
|
payload,
|
|
87
128
|
validatedAt: Date.now(),
|
|
88
129
|
};
|
|
130
|
+
cachedAt = Date.now();
|
|
131
|
+
// Clamp cache TTL to license expiry so revoked licenses don't survive the full TTL
|
|
132
|
+
if (payload.exp) {
|
|
133
|
+
const msUntilExpiry = payload.exp * 1000 - Date.now();
|
|
134
|
+
if (msUntilExpiry > 0 && msUntilExpiry < cacheConfig.ttlMs) {
|
|
135
|
+
cacheConfig = { ...cacheConfig, ttlMs: msUntilExpiry };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
89
138
|
return payload.tier;
|
|
90
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Invalidates the cached license state if it has exceeded the configured TTL.
|
|
142
|
+
* After invalidation, the license defaults to 'free' until re-initialized.
|
|
143
|
+
*/
|
|
144
|
+
function evictStaleCache() {
|
|
145
|
+
if (cachedAt > 0 && Date.now() - cachedAt > cacheConfig.ttlMs) {
|
|
146
|
+
cachedState = { tier: 'free', payload: null, validatedAt: null };
|
|
147
|
+
cachedAt = 0;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
91
150
|
/**
|
|
92
151
|
* Returns the current license tier.
|
|
93
|
-
* If the license hasn't been initialized, returns 'free'.
|
|
152
|
+
* If the license hasn't been initialized or the cache has expired, returns 'free'.
|
|
94
153
|
*/
|
|
95
154
|
export function getCurrentTier() {
|
|
155
|
+
evictStaleCache();
|
|
96
156
|
return cachedState.tier;
|
|
97
157
|
}
|
|
98
158
|
/**
|
|
99
|
-
* Returns the full license payload, or null if no valid license.
|
|
159
|
+
* Returns the full license payload, or null if no valid license or cache expired.
|
|
100
160
|
*/
|
|
101
161
|
export function getLicensePayload() {
|
|
162
|
+
evictStaleCache();
|
|
102
163
|
return cachedState.payload;
|
|
103
164
|
}
|
|
104
165
|
/**
|
|
105
166
|
* Checks whether the current license is at least the given tier.
|
|
167
|
+
* Also validates that the license has not expired (checks JWT exp claim).
|
|
106
168
|
*/
|
|
107
169
|
export function isLicensed(requiredTier) {
|
|
170
|
+
evictStaleCache();
|
|
108
171
|
const tierRank = {
|
|
109
172
|
free: 0,
|
|
110
173
|
pro: 1,
|
|
111
|
-
|
|
174
|
+
max: 2,
|
|
175
|
+
enterprise: 3,
|
|
112
176
|
};
|
|
177
|
+
// Free tier is always available
|
|
178
|
+
if (requiredTier === 'free')
|
|
179
|
+
return true;
|
|
180
|
+
// Perpetual licenses never expire — skip the exp check entirely
|
|
181
|
+
if (!cachedState.payload?.perpetual && cachedState.payload?.exp) {
|
|
182
|
+
const nowSeconds = Math.floor(Date.now() / 1000);
|
|
183
|
+
if (cachedState.payload.exp < nowSeconds) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
113
187
|
return tierRank[cachedState.tier] >= tierRank[requiredTier];
|
|
114
188
|
}
|
|
115
189
|
/**
|
|
116
190
|
* Returns the maximum number of sites allowed by the current license.
|
|
117
191
|
*/
|
|
118
192
|
export function getMaxSites() {
|
|
193
|
+
evictStaleCache();
|
|
119
194
|
if (cachedState.tier === 'enterprise')
|
|
120
195
|
return Infinity;
|
|
196
|
+
if (cachedState.tier === 'max')
|
|
197
|
+
return cachedState.payload?.maxSites ?? 15;
|
|
121
198
|
if (cachedState.tier === 'pro')
|
|
122
199
|
return cachedState.payload?.maxSites ?? 5;
|
|
123
200
|
return 1;
|
|
@@ -126,32 +203,58 @@ export function getMaxSites() {
|
|
|
126
203
|
* Returns the maximum number of users/editors allowed by the current license.
|
|
127
204
|
*/
|
|
128
205
|
export function getMaxUsers() {
|
|
206
|
+
evictStaleCache();
|
|
129
207
|
if (cachedState.tier === 'enterprise')
|
|
130
208
|
return Infinity;
|
|
209
|
+
if (cachedState.tier === 'max')
|
|
210
|
+
return cachedState.payload?.maxUsers ?? 100;
|
|
131
211
|
if (cachedState.tier === 'pro')
|
|
132
212
|
return cachedState.payload?.maxUsers ?? 25;
|
|
133
213
|
return 3;
|
|
134
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Returns the maximum agent tasks per billing cycle for the current license.
|
|
217
|
+
* Track B metering: free=1K, pro=10K, max=50K, enterprise=unlimited.
|
|
218
|
+
*/
|
|
219
|
+
export function getMaxAgentTasks() {
|
|
220
|
+
evictStaleCache();
|
|
221
|
+
if (cachedState.tier === 'enterprise')
|
|
222
|
+
return Infinity;
|
|
223
|
+
if (cachedState.tier === 'max')
|
|
224
|
+
return 50_000;
|
|
225
|
+
if (cachedState.tier === 'pro')
|
|
226
|
+
return 10_000;
|
|
227
|
+
return 1_000;
|
|
228
|
+
}
|
|
135
229
|
/**
|
|
136
230
|
* Generates a signed license key JWT.
|
|
137
231
|
* This is a server-only function — requires the private key.
|
|
138
232
|
*
|
|
139
|
-
* @param payload - License payload (tier, customerId, limits)
|
|
140
|
-
* @param privateKey - RS256
|
|
141
|
-
* @param expiresInSeconds - JWT expiration in seconds.
|
|
233
|
+
* @param payload - License payload (tier, customerId, limits, perpetual flag)
|
|
234
|
+
* @param privateKey - RS256 private key (PEM format)
|
|
235
|
+
* @param expiresInSeconds - JWT expiration in seconds. Pass null for perpetual
|
|
236
|
+
* licenses (no exp claim). Defaults to 1 year for subscription licenses.
|
|
237
|
+
* @param publicKey - RS256 public key (PEM format). When provided, a `kid`
|
|
238
|
+
* claim is added to the JWT header for forward-compatible key rotation.
|
|
142
239
|
* @returns Signed JWT string
|
|
143
240
|
*/
|
|
144
|
-
export async function generateLicenseKey(payload, privateKey, expiresInSeconds = 365 * 24 * 60 * 60) {
|
|
241
|
+
export async function generateLicenseKey(payload, privateKey, expiresInSeconds = 365 * 24 * 60 * 60, publicKey) {
|
|
145
242
|
const key = await importPKCS8(privateKey, 'RS256');
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
.
|
|
150
|
-
|
|
243
|
+
const kid = publicKey ? computeKeyId(publicKey) : undefined;
|
|
244
|
+
const header = { alg: 'RS256' };
|
|
245
|
+
if (kid) {
|
|
246
|
+
header.kid = kid;
|
|
247
|
+
}
|
|
248
|
+
const builder = new SignJWT({ ...payload }).setProtectedHeader(header).setIssuedAt();
|
|
249
|
+
if (expiresInSeconds !== null) {
|
|
250
|
+
builder.setExpirationTime(`${expiresInSeconds}s`);
|
|
251
|
+
}
|
|
252
|
+
return builder.sign(key);
|
|
151
253
|
}
|
|
152
254
|
/**
|
|
153
255
|
* Reset license state. Primarily for testing.
|
|
154
256
|
*/
|
|
155
257
|
export function resetLicenseState() {
|
|
156
258
|
cachedState = { tier: 'free', payload: null, validatedAt: null };
|
|
259
|
+
cachedAt = 0;
|
|
157
260
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["../../src/monitoring/alerts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["../../src/monitoring/alerts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAA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AQ,IAAI;QACV,SAAS,EAAE,MAAM,CAAC;QAClB,mBAAmB,EAAE,MAAM,CAAC;QAC5B,kBAAkB,EAAE,OAAO,CAAC;KAC7B;IAQD;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI;IAI3C;;OAEG;IACH,OAAO,IAAI,IAAI;CAIhB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,cAAqB,CAAC;AAE/C;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB;;GAEG;AACH,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;AAE3C;;GAEG;AAEH,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAE5C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAEhD;AAED,wBAAgB,aAAa,IAAI,UAAU,CAAC,OAAO,YAAY,CAAC,QAAQ,CAAC,CAExE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI,CAE/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanup-manager.d.ts","sourceRoot":"","sources":["../../src/monitoring/cleanup-manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"cleanup-manager.d.ts","sourceRoot":"","sources":["../../src/monitoring/cleanup-manager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtE;;GAEG;AACH,cAAM,cAAc;IAClB,OAAO,CAAC,QAAQ,CAA+C;IAC/D,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,wBAAwB,CAAS;IAEzC;;OAEG;IACH,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,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"health-monitor.d.ts","sourceRoot":"","sources":["../../src/monitoring/health-monitor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,KAAK,EAA2B,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAI7F;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,CAAC,EAAE;IAC/C,IAAI,EAAE,WAAW,EAAE,CAAC;IACpB,MAAM,EAAE,WAAW,EAAE,CAAC;CACvB,GAAG,aAAa,CAqChB;AAsID;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG;IAChD,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC;IAC7C,UAAU,EAAE,MAAM,CAAC;CACpB,CAWA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/monitoring/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,YAAY,EACZ,aAAa,EACb,SAAS,EACT,UAAU,EACV,gBAAgB,GACjB,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/monitoring/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,YAAY,EACZ,aAAa,EACb,SAAS,EACT,UAAU,EACV,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,EACL,eAAe,EACf,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAE/B,mBAAmB,YAAY,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,GACf,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-registry.d.ts","sourceRoot":"","sources":["../../src/monitoring/process-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACf,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"process-registry.d.ts","sourceRoot":"","sources":["../../src/monitoring/process-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACf,MAAM,YAAY,CAAC;AAGpB;;GAEG;AACH,cAAM,eAAe;IACnB,OAAO,CAAC,SAAS,CAA0C;IAC3D,OAAO,CAAC,OAAO,CAA8C;IAC7D,OAAO,CAAC,cAAc,CAAoD;IAE1E;;OAEG;IACH,QAAQ,CACN,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,aAAa,EACrB,QAAQ,CAAC,EAAE,eAAe,EAC1B,IAAI,CAAC,EAAE,MAAM,GACZ,IAAI;IAkBP;;OAEG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAkB1F;;OAEG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;I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,wBAAgB,mBAAmB,IAAI,cAAc,EAAE,CAEtD;AAED,wBAAgB,kBAAkB,IAAI,cAAc,EAAE,CAErD;AAED,wBAAgB,eAAe,IAAI,aAAa,CAE/C;AAED,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-monitor.d.ts","sourceRoot":"","sources":["../../src/monitoring/query-monitor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"query-monitor.d.ts","sourceRoot":"","sources":["../../src/monitoring/query-monitor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAUD;;GAEG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAgCzF;AAcD;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,CAqB1F;AAED;;GAEG;AACH,wBAAgB,aAAa;;;;;;;;;;;;;;;;EAyB5B;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,YAAY,EAAE,CAE/C;AAED;;GAEG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