@revealui/core 0.2.1 → 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/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 +29 -28
- package/dist/api/rate-limit.d.ts.map +1 -1
- package/dist/api/rate-limit.js +63 -3
- 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 +3 -2
- 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.map +1 -1
- package/dist/caching/cdn-config.js +4 -0
- 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 +36 -7
- 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 +6 -3
- package/dist/caching/service-worker.d.ts.map +1 -1
- package/dist/caching/service-worker.js +3 -2
- 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/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.map +1 -1
- 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 +7 -5
- 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 +0 -13
- 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.map +1 -1
- 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 +6 -1
- package/dist/dataloader.d.ts.map +1 -1
- 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 +1 -1
- package/dist/error-handling/error-reporter.d.ts.map +1 -1
- package/dist/error-handling/error-reporter.js +19 -5
- 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 +2 -4
- package/dist/error-handling/index.d.ts.map +1 -1
- package/dist/error-handling/index.js +1 -4
- 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 +0 -4
- package/dist/features.d.ts.map +1 -1
- package/dist/features.js +0 -2
- 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/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 -4
- package/dist/instance/RevealUIInstance.d.ts.map +1 -1
- package/dist/instance/RevealUIInstance.js +6 -19
- 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 +0 -3
- package/dist/instance/methods/delete.d.ts.map +1 -1
- package/dist/instance/methods/delete.js +1 -4
- 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/update.d.ts.map +1 -1
- package/dist/instance/methods/update.js +0 -3
- 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 +20 -3
- package/dist/license.d.ts.map +1 -1
- package/dist/license.js +73 -6
- 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 +0 -4
- package/dist/observability/health-check.d.ts.map +1 -1
- package/dist/observability/health-check.js +0 -36
- 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 -10
- package/dist/optimization/code-splitting.d.ts.map +1 -1
- package/dist/optimization/code-splitting.js +0 -16
- 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 +9 -2
- 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 +148 -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 +113 -96
- 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 -89
- 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.map +1 -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 -7
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Background Job Queue
|
|
3
|
+
*
|
|
4
|
+
* PostgreSQL-backed job queue using raw SQL for portability.
|
|
5
|
+
* No external dependencies (no Redis, no pg-boss).
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { createJobQueue } from '@revealui/core/jobs';
|
|
9
|
+
*
|
|
10
|
+
* const queue = createJobQueue(dbExecutor);
|
|
11
|
+
* await queue.send('email.send', { to: 'user@example.com', subject: '...' });
|
|
12
|
+
* queue.work('email.send', async (job) => { await sendEmail(job.data); });
|
|
13
|
+
*/
|
|
14
|
+
export { createJobQueue } from './queue.js';
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
/** Minimal database executor — accepts raw SQL strings */
|
|
10
|
+
export interface DatabaseExecutor {
|
|
11
|
+
execute(query: string, params?: unknown[]): Promise<{
|
|
12
|
+
rows: Record<string, unknown>[];
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export interface JobQueueConfig {
|
|
16
|
+
/** Polling interval in milliseconds (default: 5000) */
|
|
17
|
+
pollingIntervalMs: number;
|
|
18
|
+
/** Maximum concurrent jobs per worker (default: 5) */
|
|
19
|
+
concurrency: number;
|
|
20
|
+
/** Default retry limit for jobs without explicit limit (default: 3) */
|
|
21
|
+
defaultRetryLimit: number;
|
|
22
|
+
/** Base delay for exponential backoff in ms (default: 1000) */
|
|
23
|
+
retryBackoffMs: number;
|
|
24
|
+
/** Logger with error method */
|
|
25
|
+
logger?: {
|
|
26
|
+
error: (msg: string) => void;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface SendOptions {
|
|
30
|
+
/** Higher priority = processed first (default: 0) */
|
|
31
|
+
priority?: number;
|
|
32
|
+
/** Maximum retry attempts (default: config.defaultRetryLimit) */
|
|
33
|
+
retryLimit?: number;
|
|
34
|
+
/** Delay before first processing (Date or milliseconds from now) */
|
|
35
|
+
startAfter?: Date | number;
|
|
36
|
+
/** Job expires at this time (unprocessed jobs are skipped) */
|
|
37
|
+
expireAt?: Date;
|
|
38
|
+
}
|
|
39
|
+
export interface JobPayload {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
data: Record<string, unknown>;
|
|
43
|
+
retryCount: number;
|
|
44
|
+
}
|
|
45
|
+
export type JobHandler = (job: JobPayload) => Promise<void>;
|
|
46
|
+
export interface JobQueue {
|
|
47
|
+
/** Enqueue a job for background processing */
|
|
48
|
+
send(name: string, data: Record<string, unknown>, options?: SendOptions): Promise<string>;
|
|
49
|
+
/** Register a handler for a job type and start polling */
|
|
50
|
+
work(name: string, handler: JobHandler): void;
|
|
51
|
+
/** Stop all polling workers */
|
|
52
|
+
stop(): void;
|
|
53
|
+
/** Get counts by state for monitoring */
|
|
54
|
+
getQueueStats(): Promise<Record<string, number>>;
|
|
55
|
+
}
|
|
56
|
+
export declare function createJobQueue(executor: DatabaseExecutor, overrides?: Partial<JobQueueConfig>): JobQueue;
|
|
57
|
+
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/jobs/queue.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,0DAA0D;AAC1D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;KAAE,CAAC,CAAC;CAC1F;AAED,MA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C,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAClD;AAMD,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAClC,QAAQ,CAwJV"}
|
|
@@ -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
|
@@ -24,6 +24,21 @@ declare const licensePayloadSchema: z.ZodObject<{
|
|
|
24
24
|
exp: z.ZodOptional<z.ZodNumber>;
|
|
25
25
|
}, z.core.$strip>;
|
|
26
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;
|
|
27
42
|
/**
|
|
28
43
|
* Validates a license key JWT and returns the decoded payload.
|
|
29
44
|
* Returns null if the key is invalid, expired, or missing.
|
|
@@ -38,11 +53,11 @@ export declare function validateLicenseKey(licenseKey: string, publicKey: string
|
|
|
38
53
|
export declare function initializeLicense(): Promise<LicenseTier>;
|
|
39
54
|
/**
|
|
40
55
|
* Returns the current license tier.
|
|
41
|
-
* If the license hasn't been initialized, returns 'free'.
|
|
56
|
+
* If the license hasn't been initialized or the cache has expired, returns 'free'.
|
|
42
57
|
*/
|
|
43
58
|
export declare function getCurrentTier(): LicenseTier;
|
|
44
59
|
/**
|
|
45
|
-
* 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.
|
|
46
61
|
*/
|
|
47
62
|
export declare function getLicensePayload(): LicensePayload | null;
|
|
48
63
|
/**
|
|
@@ -71,9 +86,11 @@ export declare function getMaxAgentTasks(): number;
|
|
|
71
86
|
* @param privateKey - RS256 private key (PEM format)
|
|
72
87
|
* @param expiresInSeconds - JWT expiration in seconds. Pass null for perpetual
|
|
73
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.
|
|
74
91
|
* @returns Signed JWT string
|
|
75
92
|
*/
|
|
76
|
-
export declare function generateLicenseKey(payload: Omit<LicensePayload, 'iat' | 'exp'>, privateKey: string, expiresInSeconds?: number | null): Promise<string>;
|
|
93
|
+
export declare function generateLicenseKey(payload: Omit<LicensePayload, 'iat' | 'exp'>, privateKey: string, expiresInSeconds?: number | null, publicKey?: string): Promise<string>;
|
|
77
94
|
/**
|
|
78
95
|
* Reset license state. Primarily for testing.
|
|
79
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,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,sCAAsC;AACtC,MAAM,WAAW,kBAAkB;IACjC,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;CACf;AASD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAElF;AAkCD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA0BhC;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,WAAW,CAAC,CAkC9D;AAaD;;;GAGG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAG5C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,IAAI,CAGzD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,YAAY,EAAE,WAAW,GAAG,OAAO,CAqB7D;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAMpC;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAMpC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAMzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,KAAK,GAAG,KAAK,CAAC,EAC5C,UAAU,EAAE,MAAM,EAClB,gBAAgB,GAAE,MAAM,GAAG,IAAyB,EACpD,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAGxC"}
|
package/dist/license.js
CHANGED
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
* - jose - JWT token verification (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 */
|
|
@@ -30,6 +33,18 @@ const licensePayloadSchema = z.object({
|
|
|
30
33
|
/** License expiration timestamp — absent for perpetual licenses */
|
|
31
34
|
exp: z.number().optional(),
|
|
32
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
|
+
}
|
|
33
48
|
let cachedState = {
|
|
34
49
|
tier: 'free',
|
|
35
50
|
payload: null,
|
|
@@ -45,9 +60,20 @@ function getPublicKey() {
|
|
|
45
60
|
}
|
|
46
61
|
/**
|
|
47
62
|
* Reads the license key from environment.
|
|
63
|
+
* Supports encrypted keys (enc:iv:ciphertext:tag format) via REVEALUI_LICENSE_ENCRYPTION_KEY.
|
|
48
64
|
*/
|
|
49
65
|
function getLicenseKey() {
|
|
50
|
-
|
|
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);
|
|
51
77
|
}
|
|
52
78
|
/**
|
|
53
79
|
* Validates a license key JWT and returns the decoded payload.
|
|
@@ -55,6 +81,13 @@ function getLicenseKey() {
|
|
|
55
81
|
*/
|
|
56
82
|
export async function validateLicenseKey(licenseKey, publicKey) {
|
|
57
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
|
+
}
|
|
58
91
|
const key = await importSPKI(publicKey, 'RS256');
|
|
59
92
|
const { payload } = await jwtVerify(licenseKey, key, {
|
|
60
93
|
algorithms: ['RS256', 'ES256'],
|
|
@@ -80,11 +113,13 @@ export async function initializeLicense() {
|
|
|
80
113
|
const publicKey = getPublicKey();
|
|
81
114
|
if (!(licenseKey && publicKey)) {
|
|
82
115
|
cachedState = { tier: 'free', payload: null, validatedAt: Date.now() };
|
|
116
|
+
cachedAt = Date.now();
|
|
83
117
|
return 'free';
|
|
84
118
|
}
|
|
85
119
|
const payload = await validateLicenseKey(licenseKey, publicKey);
|
|
86
120
|
if (!payload) {
|
|
87
121
|
cachedState = { tier: 'free', payload: null, validatedAt: Date.now() };
|
|
122
|
+
cachedAt = Date.now();
|
|
88
123
|
return 'free';
|
|
89
124
|
}
|
|
90
125
|
cachedState = {
|
|
@@ -92,19 +127,39 @@ export async function initializeLicense() {
|
|
|
92
127
|
payload,
|
|
93
128
|
validatedAt: Date.now(),
|
|
94
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
|
+
}
|
|
95
138
|
return payload.tier;
|
|
96
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
|
+
}
|
|
97
150
|
/**
|
|
98
151
|
* Returns the current license tier.
|
|
99
|
-
* If the license hasn't been initialized, returns 'free'.
|
|
152
|
+
* If the license hasn't been initialized or the cache has expired, returns 'free'.
|
|
100
153
|
*/
|
|
101
154
|
export function getCurrentTier() {
|
|
155
|
+
evictStaleCache();
|
|
102
156
|
return cachedState.tier;
|
|
103
157
|
}
|
|
104
158
|
/**
|
|
105
|
-
* 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.
|
|
106
160
|
*/
|
|
107
161
|
export function getLicensePayload() {
|
|
162
|
+
evictStaleCache();
|
|
108
163
|
return cachedState.payload;
|
|
109
164
|
}
|
|
110
165
|
/**
|
|
@@ -112,6 +167,7 @@ export function getLicensePayload() {
|
|
|
112
167
|
* Also validates that the license has not expired (checks JWT exp claim).
|
|
113
168
|
*/
|
|
114
169
|
export function isLicensed(requiredTier) {
|
|
170
|
+
evictStaleCache();
|
|
115
171
|
const tierRank = {
|
|
116
172
|
free: 0,
|
|
117
173
|
pro: 1,
|
|
@@ -134,6 +190,7 @@ export function isLicensed(requiredTier) {
|
|
|
134
190
|
* Returns the maximum number of sites allowed by the current license.
|
|
135
191
|
*/
|
|
136
192
|
export function getMaxSites() {
|
|
193
|
+
evictStaleCache();
|
|
137
194
|
if (cachedState.tier === 'enterprise')
|
|
138
195
|
return Infinity;
|
|
139
196
|
if (cachedState.tier === 'max')
|
|
@@ -146,6 +203,7 @@ export function getMaxSites() {
|
|
|
146
203
|
* Returns the maximum number of users/editors allowed by the current license.
|
|
147
204
|
*/
|
|
148
205
|
export function getMaxUsers() {
|
|
206
|
+
evictStaleCache();
|
|
149
207
|
if (cachedState.tier === 'enterprise')
|
|
150
208
|
return Infinity;
|
|
151
209
|
if (cachedState.tier === 'max')
|
|
@@ -159,6 +217,7 @@ export function getMaxUsers() {
|
|
|
159
217
|
* Track B metering: free=1K, pro=10K, max=50K, enterprise=unlimited.
|
|
160
218
|
*/
|
|
161
219
|
export function getMaxAgentTasks() {
|
|
220
|
+
evictStaleCache();
|
|
162
221
|
if (cachedState.tier === 'enterprise')
|
|
163
222
|
return Infinity;
|
|
164
223
|
if (cachedState.tier === 'max')
|
|
@@ -175,11 +234,18 @@ export function getMaxAgentTasks() {
|
|
|
175
234
|
* @param privateKey - RS256 private key (PEM format)
|
|
176
235
|
* @param expiresInSeconds - JWT expiration in seconds. Pass null for perpetual
|
|
177
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.
|
|
178
239
|
* @returns Signed JWT string
|
|
179
240
|
*/
|
|
180
|
-
export async function generateLicenseKey(payload, privateKey, expiresInSeconds = 365 * 24 * 60 * 60) {
|
|
241
|
+
export async function generateLicenseKey(payload, privateKey, expiresInSeconds = 365 * 24 * 60 * 60, publicKey) {
|
|
181
242
|
const key = await importPKCS8(privateKey, 'RS256');
|
|
182
|
-
const
|
|
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();
|
|
183
249
|
if (expiresInSeconds !== null) {
|
|
184
250
|
builder.setExpirationTime(`${expiresInSeconds}s`);
|
|
185
251
|
}
|
|
@@ -190,4 +256,5 @@ export async function generateLicenseKey(payload, privateKey, expiresInSeconds =
|
|
|
190
256
|
*/
|
|
191
257
|
export function resetLicenseState() {
|
|
192
258
|
cachedState = { tier: 'free', payload: null, validatedAt: null };
|
|
259
|
+
cachedAt = 0;
|
|
193
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,CAAC;AAExC;;GAEG;AACH,UAAU,YAAY;IACpB,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7D,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAClC;AAsCD;;GAEG;AACH,KAAK,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEpD;;GAEG;AACH,UAAU,WAAW;IACnB,uBAAuB;IACvB,QAAQ,EAAE,YAAY,EAAE,CAAC;IAEzB,kFAAkF;IAClF,qBAAqB,EAAE,OAAO,CAAC;IAE/B,2CAA2C;IAC3C,mBAAmB,EAAE,MAAM,CAAC;IAE5B,uCAAuC;IACvC,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAYD;;GAEG;AACH,cAAM,YAAY;IAChB,OAAO,CAAC,M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AI,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,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,IAAI;IAqBtF;;OAEG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAM5B;;OAEG;IACG,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmD7C;;OAEG;YACW,eAAe;IAsC7B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAmD9B;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAWnC;;OAEG;IACH,WAAW,IAAI,mBAAmB,EAAE;IAIpC;;OAEG;IACH,oBAAoB,IAAI,OAAO;IAI/B;;OAEG;IACH,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAIpC;;OAEG;IACH,KAAK,IAAI,IAAI;CAId;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,gBAAuB,CAAC;AAEnD;;GAEG;AAEH,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,MAAM,EACnB,QAAQ,SAAI,GACX,IAAI,CAEN;AAED,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAEzD;AAED,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9D;AAED,wBAAgB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5C;AAED,wBAAgB,kBAAkB,IAAI,mBAAmB,EAAE,CAE1D;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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":["../../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AAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAIlC;;OAEG;IACH,SAAS,IAAI,OAAO;CAGrB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,iBAAwB,CAAC;AAErD;;GAEG;AAEH,wBAAgB,eAAe,CAC7B,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,CAEN;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,aAAa,EACrB,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,IAAI,CAEN;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEnD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAElE;AAED,wBAAgB,eAAe,IAAI,cAAc,EAAE,CAElD;AAED,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;I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MAAM,EAAE,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAM1C;AAED;;GAEG;AACH,wBAAgB,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/monitoring/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,eAAe,GACf,KAAK,GACL,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,SAAS,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/monitoring/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,eAAe,GACf,KAAK,GACL,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtD;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iBAAiB;IACjB,GAAG,EAAE,MAAM,CAAC;IAEZ,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAEhB,wBAAwB;IACxB,IAAI,EAAE,MAAM,EAAE,CAAC;IAEf,qBAAqB;IACrB,MAAM,EAAE,aAAa,CAAC;IAEtB,qBAAqB;IACrB,MAAM,EAAE,aAAa,CAAC;IAEtB,sBAAsB;IACtB,SAAS,EAAE,MAAM,CAAC;IAElB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,sCAAsC;IACtC,QAAQ,CAAC,E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C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zombie-detector.d.ts","sourceRoot":"","sources":["../../src/monitoring/zombie-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"zombie-detector.d.ts","sourceRoot":"","sources":["../../src/monitoring/zombie-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAKhD;;GAEG;AACH,cAAM,cAAc;IAClB,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,OAAO,CAA8C;IAC7D,OAAO,CAAC,iBAAiB,CAA6D;IACtF,OAAO,CAAC,UAAU,CAAsD;IACxE,OAAO,CAAC,gBAAgB,CAAC,CAAkC;IAE3D;;OAEG;IACH,KAAK,IAAI,IAAI;IAuBb;;OAEG;IACH,IAAI,IAAI,IAAI;IAQZ;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IA6DtC;;OAEG;YACW,cAAc;IAoD5B;;OAEG;IACH,OAAO,CAAC,YAAY;IASpB;;OAEG;IACH,UAAU,IAAI,aAAa,EAAE;IAI7B;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,YAAY,IAAI,IAAI;IAIpB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI;IAIzD;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAUlC;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,SAAS,IAAI,OAAO;CAGrB;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,gBAAuB,CAAC;AAEnD;;GAEG;AAEH,wBAAgB,oBAAoB,IA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