@porulle/core 0.9.0 → 0.10.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/config/defaults.js +1 -1
- package/dist/config/types.d.ts +4 -3
- package/dist/config/types.d.ts.map +1 -1
- package/dist/generated/plugin-manifest.d.ts +3 -0
- package/dist/generated/plugin-manifest.d.ts.map +1 -1
- package/dist/generated/plugin-manifest.js +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/interfaces/rest/router.d.ts.map +1 -1
- package/dist/interfaces/rest/router.js +2 -0
- package/dist/interfaces/rest/routes/checkout.d.ts.map +1 -1
- package/dist/interfaces/rest/routes/checkout.js +1 -0
- package/dist/interfaces/rest/schemas/catalog.d.ts +391 -0
- package/dist/interfaces/rest/schemas/catalog.d.ts.map +1 -1
- package/dist/interfaces/rest/schemas/responses.d.ts +51 -0
- package/dist/interfaces/rest/schemas/responses.d.ts.map +1 -1
- package/dist/interfaces/rest/schemas/search.d.ts +17 -0
- package/dist/interfaces/rest/schemas/search.d.ts.map +1 -1
- package/dist/kernel/database/scoped-db.d.ts.map +1 -1
- package/dist/kernel/database/scoped-db.js +21 -23
- package/dist/kernel/errors.d.ts +12 -0
- package/dist/kernel/errors.d.ts.map +1 -1
- package/dist/kernel/errors.js +16 -0
- package/dist/kernel/jobs/adapter.d.ts +27 -8
- package/dist/kernel/jobs/adapter.d.ts.map +1 -1
- package/dist/kernel/jobs/adapter.js +1 -2
- package/dist/kernel/jobs/drizzle-adapter.d.ts +13 -3
- package/dist/kernel/jobs/drizzle-adapter.d.ts.map +1 -1
- package/dist/kernel/jobs/drizzle-adapter.js +46 -5
- package/dist/kernel/jobs/runner.d.ts +2 -1
- package/dist/kernel/jobs/runner.d.ts.map +1 -1
- package/dist/kernel/jobs/runner.js +100 -15
- package/dist/kernel/jobs/types.d.ts +13 -0
- package/dist/kernel/jobs/types.d.ts.map +1 -1
- package/dist/kernel/plugin/manifest.d.ts +2 -0
- package/dist/kernel/plugin/manifest.d.ts.map +1 -1
- package/dist/kernel/plugin/manifest.js +9 -0
- package/dist/modules/catalog/entity-service.d.ts +1 -0
- package/dist/modules/catalog/entity-service.d.ts.map +1 -1
- package/dist/modules/catalog/entity-service.js +15 -1
- package/dist/modules/catalog/repository/index.d.ts +2 -2
- package/dist/modules/catalog/repository/index.d.ts.map +1 -1
- package/dist/modules/catalog/repository/index.js +9 -1
- package/dist/modules/catalog/schema.d.ts +51 -0
- package/dist/modules/catalog/schema.d.ts.map +1 -1
- package/dist/modules/catalog/schema.js +12 -1
- package/dist/modules/catalog/schemas.d.ts +3 -1
- package/dist/modules/catalog/schemas.d.ts.map +1 -1
- package/dist/modules/channels/adapter.d.ts +117 -0
- package/dist/modules/channels/adapter.d.ts.map +1 -0
- package/dist/modules/channels/adapter.js +3 -0
- package/dist/modules/inventory/repository/index.js +4 -4
- package/dist/modules/inventory/service.d.ts.map +1 -1
- package/dist/modules/inventory/service.js +7 -3
- package/dist/modules/orders/service.d.ts.map +1 -1
- package/dist/modules/orders/service.js +7 -4
- package/dist/modules/orders/stale-order-cleanup.d.ts.map +1 -1
- package/dist/modules/orders/stale-order-cleanup.js +25 -16
- package/dist/modules/promotions/repository/index.d.ts +1 -1
- package/dist/modules/promotions/repository/index.d.ts.map +1 -1
- package/dist/modules/promotions/repository/index.js +6 -3
- package/dist/modules/promotions/service.d.ts +1 -0
- package/dist/modules/promotions/service.d.ts.map +1 -1
- package/dist/modules/promotions/service.js +1 -1
- package/dist/modules/webhooks/repository/index.d.ts +1 -1
- package/dist/modules/webhooks/repository/index.d.ts.map +1 -1
- package/dist/modules/webhooks/repository/index.js +16 -10
- package/dist/runtime/kernel.d.ts.map +1 -1
- package/dist/runtime/kernel.js +14 -2
- package/dist/runtime/server.d.ts +1 -4
- package/dist/runtime/server.d.ts.map +1 -1
- package/dist/runtime/server.js +16 -34
- package/package.json +1 -1
- package/src/config/defaults.ts +1 -1
- package/src/config/types.ts +7 -3
- package/src/generated/plugin-capabilities.d.ts +1 -0
- package/src/generated/plugin-manifest.ts +1 -0
- package/src/generated/plugin-repositories.d.ts +1 -0
- package/src/index.ts +31 -1
- package/src/interfaces/rest/router.ts +2 -0
- package/src/interfaces/rest/routes/checkout.ts +1 -0
- package/src/kernel/database/scoped-db.ts +25 -26
- package/src/kernel/errors.ts +20 -0
- package/src/kernel/jobs/adapter.ts +39 -8
- package/src/kernel/jobs/drizzle-adapter.ts +72 -9
- package/src/kernel/jobs/runner.ts +194 -72
- package/src/kernel/jobs/types.ts +25 -0
- package/src/kernel/plugin/manifest.ts +12 -0
- package/src/modules/catalog/entity-service.ts +9 -1
- package/src/modules/catalog/repository/index.ts +13 -3
- package/src/modules/catalog/schema.ts +33 -18
- package/src/modules/catalog/schemas.ts +3 -1
- package/src/modules/channels/adapter.ts +139 -0
- package/src/modules/inventory/repository/index.ts +4 -4
- package/src/modules/inventory/service.ts +12 -2
- package/src/modules/orders/service.ts +8 -12
- package/src/modules/orders/stale-order-cleanup.ts +35 -24
- package/src/modules/promotions/repository/index.ts +6 -2
- package/src/modules/promotions/service.ts +2 -0
- package/src/modules/webhooks/repository/index.ts +16 -14
- package/src/runtime/kernel.ts +16 -2
- package/src/runtime/server.ts +22 -42
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/rest/schemas/responses.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAStC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAkD,CAAC"}
|
|
@@ -56,6 +56,23 @@ export declare const searchRoute: {
|
|
|
56
56
|
identity: undefined;
|
|
57
57
|
generated: undefined;
|
|
58
58
|
}, {}, {}>;
|
|
59
|
+
sourceStoreId: import("drizzle-orm/pg-core").PgColumn<{
|
|
60
|
+
name: "source_store_id";
|
|
61
|
+
tableName: "sellable_entities";
|
|
62
|
+
dataType: "string";
|
|
63
|
+
columnType: "PgText";
|
|
64
|
+
data: string;
|
|
65
|
+
driverParam: string;
|
|
66
|
+
notNull: false;
|
|
67
|
+
hasDefault: false;
|
|
68
|
+
isPrimaryKey: false;
|
|
69
|
+
isAutoincrement: false;
|
|
70
|
+
hasRuntimeDefault: false;
|
|
71
|
+
enumValues: [string, ...string[]];
|
|
72
|
+
baseColumn: never;
|
|
73
|
+
identity: undefined;
|
|
74
|
+
generated: undefined;
|
|
75
|
+
}, {}, {}>;
|
|
59
76
|
type: import("drizzle-orm/pg-core").PgColumn<{
|
|
60
77
|
name: "type";
|
|
61
78
|
tableName: "sellable_entities";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/rest/schemas/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AAKnD,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/rest/schemas/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AAKnD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCtB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scoped-db.d.ts","sourceRoot":"","sources":["../../../src/kernel/database/scoped-db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"scoped-db.d.ts","sourceRoot":"","sources":["../../../src/kernel/database/scoped-db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;AAuD3D,wBAAgB,cAAc,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,oBAAoB,GAAG,GAAG,CA2GpF"}
|
|
@@ -26,28 +26,39 @@ function tableHasOrganizationId(table) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
29
|
+
* Wrap a WHERE-able Drizzle builder so every `.where()` call AND-s `orgEq` in
|
|
30
|
+
* AND re-wraps its result. Re-wrapping is what makes a chained
|
|
31
|
+
* `.where(a).where(b)` safe: Drizzle's second `.where()` REPLACES the first, so
|
|
32
|
+
* without re-wrapping the chained call would reach the raw builder and execute
|
|
33
|
+
* with only the caller's condition — dropping the org predicate and leaking
|
|
34
|
+
* across tenants. Every link in the chain re-injects `orgEq`.
|
|
34
35
|
*/
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
return new Proxy(scoped, {
|
|
36
|
+
function wrapWhereable(builder, orgEq) {
|
|
37
|
+
return new Proxy(builder, {
|
|
38
38
|
get(st, sp, sr) {
|
|
39
39
|
const sv = Reflect.get(st, sp, sr);
|
|
40
40
|
if (sp === "where" && typeof sv === "function") {
|
|
41
41
|
return (condition, ...wRest) => {
|
|
42
42
|
const c = condition;
|
|
43
43
|
const merged = c ? and(orgEq, c) : orgEq;
|
|
44
|
-
|
|
44
|
+
const next = sv.call(st, merged, ...wRest);
|
|
45
|
+
return wrapWhereable(next, orgEq);
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
48
|
return typeof sv === "function" ? sv.bind(st) : sv;
|
|
48
49
|
},
|
|
49
50
|
});
|
|
50
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Pre-apply the org predicate to a WHERE-able builder (UPDATE/DELETE) and wrap
|
|
54
|
+
* its `.where()` so a caller-supplied condition is AND-ed with the org filter
|
|
55
|
+
* rather than replacing it. Pre-applying `orgEq` immediately means a builder
|
|
56
|
+
* executed with NO caller `.where()` (e.g. `update(t).set(...)`) is still
|
|
57
|
+
* constrained to the org — it can never touch another tenant's rows.
|
|
58
|
+
*/
|
|
59
|
+
function scopeWhereBuilder(builder, orgEq) {
|
|
60
|
+
return wrapWhereable(builder.where(orgEq), orgEq);
|
|
61
|
+
}
|
|
51
62
|
export function createScopedDb(rawDb, orgSource) {
|
|
52
63
|
if (!rawDb || typeof rawDb !== "object")
|
|
53
64
|
return rawDb;
|
|
@@ -100,20 +111,7 @@ export function createScopedDb(rawDb, orgSource) {
|
|
|
100
111
|
return chain;
|
|
101
112
|
const orgEq = eq(orgCol, resolveOrganizationId(orgSource));
|
|
102
113
|
const inner = chain;
|
|
103
|
-
|
|
104
|
-
return new Proxy(scoped, {
|
|
105
|
-
get(st, sp, sr) {
|
|
106
|
-
const sv = Reflect.get(st, sp, sr);
|
|
107
|
-
if (sp === "where" && typeof sv === "function") {
|
|
108
|
-
return (condition, ...wRest) => {
|
|
109
|
-
const c = condition;
|
|
110
|
-
const merged = c ? and(orgEq, c) : orgEq;
|
|
111
|
-
return sv.call(st, merged, ...wRest);
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
return typeof sv === "function" ? sv.bind(st) : sv;
|
|
115
|
-
},
|
|
116
|
-
});
|
|
114
|
+
return wrapWhereable(inner.where(orgEq), orgEq);
|
|
117
115
|
};
|
|
118
116
|
}
|
|
119
117
|
return typeof sbVal === "function" ? sbVal.bind(sbTarget) : sbVal;
|
package/dist/kernel/errors.d.ts
CHANGED
|
@@ -18,6 +18,18 @@ export declare class CommerceValidationError extends Error implements CommerceEr
|
|
|
18
18
|
code: "VALIDATION_FAILED";
|
|
19
19
|
constructor(message: string, fieldErrors?: FieldError[] | undefined, details?: unknown | undefined);
|
|
20
20
|
}
|
|
21
|
+
/** Canonical message for a missing inventory record — the single source used by
|
|
22
|
+
* the inventory repository and mapped to the typed error below. */
|
|
23
|
+
export declare const INVENTORY_RECORD_NOT_FOUND_MESSAGE = "No inventory record found for this entity.";
|
|
24
|
+
/** Raised when an inventory reserve/release targets an entity with no inventory
|
|
25
|
+
* record. Consumers (e.g. order status transitions that tolerate a missing
|
|
26
|
+
* record) discriminate on `code === "INVENTORY_RECORD_NOT_FOUND"`, never the
|
|
27
|
+
* message string. */
|
|
28
|
+
export declare class CommerceInventoryRecordNotFoundError extends Error implements CommerceError {
|
|
29
|
+
details?: unknown | undefined;
|
|
30
|
+
code: "INVENTORY_RECORD_NOT_FOUND";
|
|
31
|
+
constructor(message?: string, details?: unknown | undefined);
|
|
32
|
+
}
|
|
21
33
|
export declare class CommerceForbiddenError extends Error implements CommerceError {
|
|
22
34
|
details?: unknown | undefined;
|
|
23
35
|
code: "FORBIDDEN";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/kernel/errors.ts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aAAa,CAgB7D"}
|
package/dist/kernel/errors.js
CHANGED
|
@@ -18,6 +18,22 @@ export class CommerceValidationError extends Error {
|
|
|
18
18
|
this.name = "CommerceValidationError";
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
+
/** Canonical message for a missing inventory record — the single source used by
|
|
22
|
+
* the inventory repository and mapped to the typed error below. */
|
|
23
|
+
export const INVENTORY_RECORD_NOT_FOUND_MESSAGE = "No inventory record found for this entity.";
|
|
24
|
+
/** Raised when an inventory reserve/release targets an entity with no inventory
|
|
25
|
+
* record. Consumers (e.g. order status transitions that tolerate a missing
|
|
26
|
+
* record) discriminate on `code === "INVENTORY_RECORD_NOT_FOUND"`, never the
|
|
27
|
+
* message string. */
|
|
28
|
+
export class CommerceInventoryRecordNotFoundError extends Error {
|
|
29
|
+
details;
|
|
30
|
+
code = "INVENTORY_RECORD_NOT_FOUND";
|
|
31
|
+
constructor(message = INVENTORY_RECORD_NOT_FOUND_MESSAGE, details) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.details = details;
|
|
34
|
+
this.name = "CommerceInventoryRecordNotFoundError";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
21
37
|
export class CommerceForbiddenError extends Error {
|
|
22
38
|
details;
|
|
23
39
|
code = "FORBIDDEN";
|
|
@@ -1,12 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* The full DrizzleJobsAdapter implements this; hooks receive
|
|
4
|
-
* it on HookContext.jobs so they can defer work without caring
|
|
5
|
-
* about the underlying storage.
|
|
6
|
-
*/
|
|
1
|
+
import type { JobProcessingOrder, TaskContext, TaskDefinition } from "./types.js";
|
|
2
|
+
/** Enqueue-only surface exposed to hooks and services. */
|
|
7
3
|
export interface JobsAdapter {
|
|
8
4
|
enqueue(taskSlug: string, input: Record<string, unknown>, options: EnqueueOptions): Promise<string>;
|
|
9
5
|
}
|
|
6
|
+
export interface RunJobsOptions {
|
|
7
|
+
queue?: string;
|
|
8
|
+
limit?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface RunJobsResult {
|
|
11
|
+
processed: number;
|
|
12
|
+
failed: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ExecutionEngineSetup {
|
|
15
|
+
tasks: ReadonlyMap<string, TaskDefinition>;
|
|
16
|
+
context: TaskContext;
|
|
17
|
+
processingOrder?: JobProcessingOrder;
|
|
18
|
+
}
|
|
19
|
+
export type ExecutionDriver = {
|
|
20
|
+
mode: "pull";
|
|
21
|
+
run(options?: RunJobsOptions): Promise<RunJobsResult>;
|
|
22
|
+
} | {
|
|
23
|
+
mode: "push";
|
|
24
|
+
};
|
|
25
|
+
/** Full job-engine contract selected through `config.jobs.adapter`. */
|
|
26
|
+
export interface ExecutionEngine extends JobsAdapter {
|
|
27
|
+
readonly execution: ExecutionDriver;
|
|
28
|
+
register(setup: ExecutionEngineSetup): void;
|
|
29
|
+
}
|
|
10
30
|
export interface EnqueueOptions {
|
|
11
31
|
organizationId: string;
|
|
12
32
|
queue?: string;
|
|
@@ -16,8 +36,7 @@ export interface EnqueueOptions {
|
|
|
16
36
|
supersedes?: boolean;
|
|
17
37
|
}
|
|
18
38
|
/**
|
|
19
|
-
* No-op
|
|
20
|
-
* All enqueue calls silently succeed and return a placeholder ID.
|
|
39
|
+
* No-op enqueue surface used by isolated hook contexts.
|
|
21
40
|
*/
|
|
22
41
|
export declare class NullJobsAdapter implements JobsAdapter {
|
|
23
42
|
enqueue(_taskSlug: string, _input: Record<string, unknown>, _options: EnqueueOptions): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/kernel/jobs/adapter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/kernel/jobs/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,0DAA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AC,MAAM,EAAE,OAAO,CAAC,EAC/B,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC;CAGnB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* No-op
|
|
3
|
-
* All enqueue calls silently succeed and return a placeholder ID.
|
|
2
|
+
* No-op enqueue surface used by isolated hook contexts.
|
|
4
3
|
*/
|
|
5
4
|
export class NullJobsAdapter {
|
|
6
5
|
async enqueue(_taskSlug, _input, _options) {
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import type { DrizzleDatabase } from "../database/drizzle-db.js";
|
|
2
2
|
import type { TaskDefinition } from "./types.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { EnqueueOptions, ExecutionEngine, ExecutionEngineSetup, RunJobsOptions } from "./adapter.js";
|
|
4
4
|
/**
|
|
5
5
|
* PostgreSQL-backed job queue adapter using the application's own database.
|
|
6
6
|
* Stores jobs in the `commerce_jobs` table. Supports concurrency keys
|
|
7
7
|
* and supersede semantics for deduplication.
|
|
8
8
|
*/
|
|
9
|
-
export declare class DrizzleJobsAdapter implements
|
|
9
|
+
export declare class DrizzleJobsAdapter implements ExecutionEngine {
|
|
10
10
|
private db;
|
|
11
11
|
private tasks;
|
|
12
|
-
|
|
12
|
+
private setup;
|
|
13
|
+
private lastStaleJobReaperAt;
|
|
14
|
+
readonly execution: {
|
|
15
|
+
mode: "pull";
|
|
16
|
+
run: (options?: RunJobsOptions) => Promise<{
|
|
17
|
+
processed: number;
|
|
18
|
+
failed: number;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
constructor(db: DrizzleDatabase, tasks?: Map<string, TaskDefinition>);
|
|
22
|
+
register(setup: ExecutionEngineSetup): void;
|
|
13
23
|
enqueue(taskSlug: string, input: Record<string, unknown>, options: EnqueueOptions): Promise<string>;
|
|
14
24
|
}
|
|
15
25
|
//# sourceMappingURL=drizzle-adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drizzle-adapter.d.ts","sourceRoot":"","sources":["../../../src/kernel/jobs/drizzle-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"drizzle-adapter.d.ts","sourceRoot":"","sources":["../../../src/kernel/jobs/drizzle-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,cAAc,EACf,MAAM,cAAc,CAAC;AAUtB;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,eAAe;IA4CtD,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,KAAK;IA5Cf,OAAO,CAAC,KAAK,CAAmC;IAChD,OAAO,CAAC,oBAAoB,CAAK;IAEjC,QAAQ,CAAC,SAAS;;wBAEK,cAAc;;;;MAmCnC;gBAGQ,EAAE,EAAE,eAAe,EACnB,KAAK,GAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAa;IAGxD,QAAQ,CAAC,KAAK,EAAE,oBAAoB,GAAG,IAAI;IAKrC,OAAO,CACX,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,CAAC;CA+CnB"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { eq, and } from "drizzle-orm";
|
|
2
2
|
import { OrgResolutionError } from "../errors.js";
|
|
3
3
|
import { commerceJobs } from "./schema.js";
|
|
4
|
+
import { runPendingJobs } from "./runner.js";
|
|
5
|
+
import { getJobReapThresholdMs, getJobsReaperIntervalMs, runStaleJobReaper, } from "./reaper.js";
|
|
4
6
|
/**
|
|
5
7
|
* PostgreSQL-backed job queue adapter using the application's own database.
|
|
6
8
|
* Stores jobs in the `commerce_jobs` table. Supports concurrency keys
|
|
@@ -9,23 +11,62 @@ import { commerceJobs } from "./schema.js";
|
|
|
9
11
|
export class DrizzleJobsAdapter {
|
|
10
12
|
db;
|
|
11
13
|
tasks;
|
|
12
|
-
|
|
14
|
+
setup;
|
|
15
|
+
lastStaleJobReaperAt = 0;
|
|
16
|
+
execution = {
|
|
17
|
+
mode: "pull",
|
|
18
|
+
run: async (options = {}) => {
|
|
19
|
+
if (!this.setup) {
|
|
20
|
+
throw new Error("DrizzleJobsAdapter must be registered before running jobs.");
|
|
21
|
+
}
|
|
22
|
+
const now = Date.now();
|
|
23
|
+
if (now - this.lastStaleJobReaperAt >= getJobsReaperIntervalMs()) {
|
|
24
|
+
this.lastStaleJobReaperAt = now;
|
|
25
|
+
try {
|
|
26
|
+
await runStaleJobReaper(this.db, getJobReapThresholdMs(), this.setup.context.logger);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
this.setup.context.logger.error("Stale job reaper failed", {
|
|
30
|
+
error: error instanceof Error ? error.message : String(error),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return runPendingJobs({
|
|
35
|
+
db: this.db,
|
|
36
|
+
tasks: new Map(this.setup.tasks),
|
|
37
|
+
logger: this.setup.context.logger,
|
|
38
|
+
services: this.setup.context.services,
|
|
39
|
+
...(options.queue !== undefined ? { queue: options.queue } : {}),
|
|
40
|
+
...(options.limit !== undefined ? { limit: options.limit } : {}),
|
|
41
|
+
...(this.setup.processingOrder !== undefined
|
|
42
|
+
? { processingOrder: this.setup.processingOrder }
|
|
43
|
+
: {}),
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
constructor(db, tasks = new Map()) {
|
|
13
48
|
this.db = db;
|
|
14
49
|
this.tasks = tasks;
|
|
15
50
|
}
|
|
51
|
+
register(setup) {
|
|
52
|
+
this.setup = setup;
|
|
53
|
+
this.tasks = new Map(setup.tasks);
|
|
54
|
+
}
|
|
16
55
|
async enqueue(taskSlug, input, options) {
|
|
17
56
|
const organizationId = options.organizationId.trim();
|
|
18
57
|
if (!organizationId) {
|
|
19
58
|
throw new OrgResolutionError("Jobs enqueue requires a non-empty organizationId.");
|
|
20
59
|
}
|
|
60
|
+
const task = this.tasks.get(taskSlug);
|
|
61
|
+
const concurrencyKey = options.concurrencyKey ?? task?.concurrency?.key(input);
|
|
62
|
+
const supersedes = options.supersedes ?? task?.concurrency?.supersedes;
|
|
21
63
|
// If supersedes is set, delete existing pending jobs with the same concurrency key
|
|
22
|
-
if (
|
|
64
|
+
if (concurrencyKey && supersedes) {
|
|
23
65
|
await this.db
|
|
24
66
|
.delete(commerceJobs)
|
|
25
|
-
.where(and(eq(commerceJobs.
|
|
67
|
+
.where(and(eq(commerceJobs.organizationId, organizationId), eq(commerceJobs.taskSlug, taskSlug), eq(commerceJobs.concurrencyKey, concurrencyKey), eq(commerceJobs.status, "pending")));
|
|
26
68
|
}
|
|
27
69
|
// Look up task definition for default retry config
|
|
28
|
-
const task = this.tasks.get(taskSlug);
|
|
29
70
|
const maxAttempts = options.maxAttempts ?? task?.retries?.attempts ?? 1;
|
|
30
71
|
const rows = await this.db
|
|
31
72
|
.insert(commerceJobs)
|
|
@@ -38,7 +79,7 @@ export class DrizzleJobsAdapter {
|
|
|
38
79
|
waitUntil: options.delayMs
|
|
39
80
|
? new Date(Date.now() + options.delayMs)
|
|
40
81
|
: null,
|
|
41
|
-
concurrencyKey:
|
|
82
|
+
concurrencyKey: concurrencyKey ?? null,
|
|
42
83
|
})
|
|
43
84
|
.returning({ id: commerceJobs.id });
|
|
44
85
|
return rows[0].id;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { DrizzleDatabase } from "../database/drizzle-db.js";
|
|
2
2
|
import type { Logger, ServiceContainer } from "../hooks/types.js";
|
|
3
|
-
import type { TaskDefinition } from "./types.js";
|
|
3
|
+
import type { JobProcessingOrder, TaskDefinition } from "./types.js";
|
|
4
4
|
export interface RunPendingJobsArgs {
|
|
5
5
|
db: DrizzleDatabase;
|
|
6
6
|
tasks: Map<string, TaskDefinition>;
|
|
7
7
|
queue?: string;
|
|
8
8
|
limit?: number;
|
|
9
|
+
processingOrder?: JobProcessingOrder;
|
|
9
10
|
logger: Logger;
|
|
10
11
|
services: ServiceContainer;
|
|
11
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/kernel/jobs/runner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/kernel/jobs/runner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGrE,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,eAAe,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,kBAAkB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AA4CD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAkNhD"}
|
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
import { eq, and, sql } from "drizzle-orm";
|
|
2
2
|
import { commerceJobs } from "./schema.js";
|
|
3
|
+
function isExclusiveTask(task) {
|
|
4
|
+
return Boolean(task?.concurrency && task.concurrency.exclusive !== false);
|
|
5
|
+
}
|
|
6
|
+
function compareByProcessingOrder(processingOrder) {
|
|
7
|
+
if (typeof processingOrder === "function") {
|
|
8
|
+
return (left, right) => processingOrder({
|
|
9
|
+
...left,
|
|
10
|
+
input: left.input,
|
|
11
|
+
}, {
|
|
12
|
+
...right,
|
|
13
|
+
input: right.input,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
const field = processingOrder?.field ?? "createdAt";
|
|
17
|
+
const direction = processingOrder?.direction === "desc" ? -1 : 1;
|
|
18
|
+
return (left, right) => {
|
|
19
|
+
const leftValue = left[field];
|
|
20
|
+
const rightValue = right[field];
|
|
21
|
+
const compared = leftValue instanceof Date && rightValue instanceof Date
|
|
22
|
+
? leftValue.getTime() - rightValue.getTime()
|
|
23
|
+
: typeof leftValue === "number" && typeof rightValue === "number"
|
|
24
|
+
? leftValue - rightValue
|
|
25
|
+
: String(leftValue).localeCompare(String(rightValue));
|
|
26
|
+
if (compared !== 0)
|
|
27
|
+
return compared * direction;
|
|
28
|
+
return (left.createdAt.getTime() - right.createdAt.getTime() ||
|
|
29
|
+
left.id.localeCompare(right.id));
|
|
30
|
+
};
|
|
31
|
+
}
|
|
3
32
|
/**
|
|
4
33
|
* Claims and processes pending jobs from the `commerce_jobs` table.
|
|
5
34
|
*
|
|
@@ -9,18 +38,38 @@ import { commerceJobs } from "./schema.js";
|
|
|
9
38
|
* claim transaction.
|
|
10
39
|
*/
|
|
11
40
|
export async function runPendingJobs(args) {
|
|
12
|
-
const { db, tasks, queue = "default", limit = 10, logger, services, } = args;
|
|
13
|
-
let processed = 0;
|
|
14
|
-
let failed = 0;
|
|
41
|
+
const { db, tasks, queue = "default", limit = 10, processingOrder, logger, services, } = args;
|
|
15
42
|
// Phase 1: Claim jobs atomically
|
|
16
43
|
const claimed = await db.transaction(async (tx) => {
|
|
17
|
-
const
|
|
44
|
+
const processing = await tx
|
|
45
|
+
.select({ concurrencyKey: commerceJobs.concurrencyKey })
|
|
46
|
+
.from(commerceJobs)
|
|
47
|
+
.where(eq(commerceJobs.status, "processing"));
|
|
48
|
+
const processingKeys = new Set(processing.flatMap((job) => job.concurrencyKey ? [job.concurrencyKey] : []));
|
|
49
|
+
const candidates = await tx
|
|
18
50
|
.select()
|
|
19
51
|
.from(commerceJobs)
|
|
20
52
|
.where(and(eq(commerceJobs.status, "pending"), eq(commerceJobs.queue, queue), sql `(${commerceJobs.waitUntil} IS NULL OR ${commerceJobs.waitUntil} <= now())`))
|
|
21
|
-
.orderBy(commerceJobs.createdAt)
|
|
22
|
-
|
|
23
|
-
|
|
53
|
+
.orderBy(commerceJobs.createdAt);
|
|
54
|
+
candidates.sort(compareByProcessingOrder(processingOrder));
|
|
55
|
+
const pending = [];
|
|
56
|
+
for (const candidate of candidates) {
|
|
57
|
+
if (pending.length >= limit)
|
|
58
|
+
break;
|
|
59
|
+
if (candidate.concurrencyKey &&
|
|
60
|
+
isExclusiveTask(tasks.get(candidate.taskSlug)) &&
|
|
61
|
+
processingKeys.has(candidate.concurrencyKey)) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const [locked] = await tx
|
|
65
|
+
.select()
|
|
66
|
+
.from(commerceJobs)
|
|
67
|
+
.where(and(eq(commerceJobs.id, candidate.id), eq(commerceJobs.status, "pending")))
|
|
68
|
+
.limit(1)
|
|
69
|
+
.for("update", { skipLocked: true });
|
|
70
|
+
if (locked)
|
|
71
|
+
pending.push(locked);
|
|
72
|
+
}
|
|
24
73
|
for (const job of pending) {
|
|
25
74
|
await tx
|
|
26
75
|
.update(commerceJobs)
|
|
@@ -31,10 +80,42 @@ export async function runPendingJobs(args) {
|
|
|
31
80
|
})
|
|
32
81
|
.where(eq(commerceJobs.id, job.id));
|
|
33
82
|
}
|
|
34
|
-
|
|
83
|
+
const oldestByKey = new Map();
|
|
84
|
+
const jobsToRun = [];
|
|
85
|
+
const jobsToRelease = [];
|
|
86
|
+
for (const job of pending) {
|
|
87
|
+
if (!job.concurrencyKey || !isExclusiveTask(tasks.get(job.taskSlug))) {
|
|
88
|
+
jobsToRun.push(job);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const oldest = oldestByKey.get(job.concurrencyKey);
|
|
92
|
+
if (!oldest) {
|
|
93
|
+
oldestByKey.set(job.concurrencyKey, job);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (job.createdAt < oldest.createdAt) {
|
|
97
|
+
oldestByKey.set(job.concurrencyKey, job);
|
|
98
|
+
jobsToRelease.push(oldest);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
jobsToRelease.push(job);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
jobsToRun.push(...oldestByKey.values());
|
|
105
|
+
for (const job of jobsToRelease) {
|
|
106
|
+
await tx
|
|
107
|
+
.update(commerceJobs)
|
|
108
|
+
.set({
|
|
109
|
+
status: "pending",
|
|
110
|
+
processingStartedAt: null,
|
|
111
|
+
updatedAt: new Date(),
|
|
112
|
+
})
|
|
113
|
+
.where(eq(commerceJobs.id, job.id));
|
|
114
|
+
}
|
|
115
|
+
return jobsToRun.sort(compareByProcessingOrder(processingOrder));
|
|
35
116
|
});
|
|
36
117
|
// Phase 2: Execute each claimed job outside the claim transaction
|
|
37
|
-
|
|
118
|
+
const outcomes = await Promise.all(claimed.map(async (job) => {
|
|
38
119
|
const task = tasks.get(job.taskSlug);
|
|
39
120
|
if (!task) {
|
|
40
121
|
logger.warn("Unknown task slug — job marked as failed. Register the task handler in config.jobs.tasks.", {
|
|
@@ -50,8 +131,7 @@ export async function runPendingJobs(args) {
|
|
|
50
131
|
completedAt: new Date(),
|
|
51
132
|
})
|
|
52
133
|
.where(eq(commerceJobs.id, job.id));
|
|
53
|
-
failed
|
|
54
|
-
continue;
|
|
134
|
+
return "failed";
|
|
55
135
|
}
|
|
56
136
|
try {
|
|
57
137
|
const result = await task.handler({
|
|
@@ -72,7 +152,7 @@ export async function runPendingJobs(args) {
|
|
|
72
152
|
completedAt: new Date(),
|
|
73
153
|
})
|
|
74
154
|
.where(eq(commerceJobs.id, job.id));
|
|
75
|
-
processed
|
|
155
|
+
return "processed";
|
|
76
156
|
}
|
|
77
157
|
catch (err) {
|
|
78
158
|
logger.error("Job handler failed", {
|
|
@@ -93,7 +173,7 @@ export async function runPendingJobs(args) {
|
|
|
93
173
|
completedAt: new Date(),
|
|
94
174
|
})
|
|
95
175
|
.where(eq(commerceJobs.id, job.id));
|
|
96
|
-
failed
|
|
176
|
+
return "failed";
|
|
97
177
|
}
|
|
98
178
|
else {
|
|
99
179
|
// Compute backoff delay
|
|
@@ -108,11 +188,16 @@ export async function runPendingJobs(args) {
|
|
|
108
188
|
error: err instanceof Error ? err.message : String(err),
|
|
109
189
|
attempts,
|
|
110
190
|
waitUntil: new Date(Date.now() + delay),
|
|
191
|
+
processingStartedAt: null,
|
|
111
192
|
updatedAt: new Date(),
|
|
112
193
|
})
|
|
113
194
|
.where(eq(commerceJobs.id, job.id));
|
|
195
|
+
return "retrying";
|
|
114
196
|
}
|
|
115
197
|
}
|
|
116
|
-
}
|
|
117
|
-
return {
|
|
198
|
+
}));
|
|
199
|
+
return {
|
|
200
|
+
processed: outcomes.filter((outcome) => outcome === "processed").length,
|
|
201
|
+
failed: outcomes.filter((outcome) => outcome === "failed").length,
|
|
202
|
+
};
|
|
118
203
|
}
|
|
@@ -16,6 +16,19 @@ export interface TaskRetryConfig {
|
|
|
16
16
|
delay: number;
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
+
export interface JobProcessingOrderRecord {
|
|
20
|
+
id: string;
|
|
21
|
+
taskSlug: string;
|
|
22
|
+
input: Record<string, unknown>;
|
|
23
|
+
attempts: number;
|
|
24
|
+
createdAt: Date;
|
|
25
|
+
updatedAt: Date;
|
|
26
|
+
}
|
|
27
|
+
export type JobProcessingOrderField = "createdAt" | "updatedAt" | "attempts" | "taskSlug";
|
|
28
|
+
export type JobProcessingOrder = {
|
|
29
|
+
field: JobProcessingOrderField;
|
|
30
|
+
direction?: "asc" | "desc";
|
|
31
|
+
} | ((left: JobProcessingOrderRecord, right: JobProcessingOrderRecord) => number);
|
|
19
32
|
/** Present when the handler is invoked by `runPendingJobs` (not for ad-hoc calls). */
|
|
20
33
|
export interface TaskJobMeta {
|
|
21
34
|
attemptNumber: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/kernel/jobs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjE,eAAO,MAAM,sBAAsB;;;CAGzB,CAAC;AAEX,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,eAAe,CAAC;IACpB,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,OAAO,GAAG,aAAa,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5D;AAED,sFAAsF;AACtF,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc,CAC7B,MAAM,SAAS,MAAM,CAAC,MAAM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 -1,6 +1,7 @@
|
|
|
1
1
|
import type { RouteConfig } from "@hono/zod-openapi";
|
|
2
2
|
import type { PluginDb } from "../database/plugin-types.js";
|
|
3
3
|
import type { CommerceConfig, CommercePlugin, PluginPermission } from "../../config/types.js";
|
|
4
|
+
import type { TaskDefinition } from "../jobs/types.js";
|
|
4
5
|
export interface PluginLogger {
|
|
5
6
|
info(message: string, data?: unknown): void;
|
|
6
7
|
warn(message: string, data?: unknown): void;
|
|
@@ -76,6 +77,7 @@ export interface CommercePluginManifest {
|
|
|
76
77
|
hooks?: () => PluginHookRegistration[];
|
|
77
78
|
routes?: (ctx: PluginContext) => PluginRouteRegistration[];
|
|
78
79
|
analyticsModels?: () => unknown[];
|
|
80
|
+
jobs?: () => TaskDefinition[];
|
|
79
81
|
/**
|
|
80
82
|
* Named API-key scopes this plugin mints credentials under (issue #51),
|
|
81
83
|
* merged into `config.auth.apiKeyScopes`. User-defined scopes with the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/kernel/plugin/manifest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAS5D,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/kernel/plugin/manifest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAS5D,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIv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