target-supabase-sdk 0.2.3 → 0.2.5
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 +24 -18
- package/dist/browser.d.ts +11 -4
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +3 -3
- package/dist/chunks/{enable-log-persist-C7GJo_Nc.js → enable-log-persist-BL2FaGQp.js} +10 -8
- package/dist/chunks/enable-log-persist-BL2FaGQp.js.map +1 -0
- package/dist/chunks/{create-logger-DyH3mZ8p.js → list.api-Ab9v8yOg.js} +66 -57
- package/dist/chunks/list.api-Ab9v8yOg.js.map +1 -0
- package/dist/chunks/{word.interface-DLgRobKV.js → word.interface-Mw7bTSqs.js} +1191 -97
- package/dist/chunks/word.interface-Mw7bTSqs.js.map +1 -0
- package/dist/extraction/extraction.api.d.ts +117 -0
- package/dist/extraction/extraction.api.d.ts.map +1 -0
- package/dist/extraction/extraction.interface.d.ts +43 -0
- package/dist/extraction/extraction.interface.d.ts.map +1 -0
- package/dist/list/list.interface.d.ts +2 -2
- package/dist/list/list.interface.d.ts.map +1 -1
- package/dist/node/fs/json-state-store.d.ts.map +1 -1
- package/dist/node/fs/runtime-state-path.d.ts +17 -0
- package/dist/node/fs/runtime-state-path.d.ts.map +1 -0
- package/dist/node/fs/sharded-json-state-store.d.ts +19 -0
- package/dist/node/fs/sharded-json-state-store.d.ts.map +1 -0
- package/dist/node/node-runtime.base.d.ts +13 -1
- package/dist/node/node-runtime.base.d.ts.map +1 -1
- package/dist/node/process/create-managed-child-processes.d.ts +12 -0
- package/dist/node/process/create-managed-child-processes.d.ts.map +1 -0
- package/dist/node/process/index.d.ts +3 -1
- package/dist/node/process/index.d.ts.map +1 -1
- package/dist/node/process/managed-child-processes.d.ts +15 -2
- package/dist/node/process/managed-child-processes.d.ts.map +1 -1
- package/dist/node/runtime-state/create-service-runtime-state-store.d.ts +27 -0
- package/dist/node/runtime-state/create-service-runtime-state-store.d.ts.map +1 -0
- package/dist/node/runtime-state/index.d.ts +4 -0
- package/dist/node/runtime-state/index.d.ts.map +1 -0
- package/dist/node/runtime-state/service-runtime-state.types.d.ts +57 -0
- package/dist/node/runtime-state/service-runtime-state.types.d.ts.map +1 -0
- package/dist/node/service-guard/index.d.ts +9 -0
- package/dist/node/service-guard/index.d.ts.map +1 -0
- package/dist/node/service-guard/register-service-guard-runner.d.ts +9 -0
- package/dist/node/service-guard/register-service-guard-runner.d.ts.map +1 -0
- package/dist/node/service-guard/run-readiness-gate.d.ts +11 -0
- package/dist/node/service-guard/run-readiness-gate.d.ts.map +1 -0
- package/dist/node/service-guard/run-service-guard-tick.d.ts +7 -0
- package/dist/node/service-guard/run-service-guard-tick.d.ts.map +1 -0
- package/dist/node/service-guard/service-guard-node.d.ts +18 -0
- package/dist/node/service-guard/service-guard-node.d.ts.map +1 -0
- package/dist/node/service-guard/service-guard.interface.d.ts +58 -0
- package/dist/node/service-guard/service-guard.interface.d.ts.map +1 -0
- package/dist/node/service-guard/worker-spawn-cooldown.d.ts +4 -0
- package/dist/node/service-guard/worker-spawn-cooldown.d.ts.map +1 -0
- package/dist/node/service-host/index.d.ts +9 -0
- package/dist/node/service-host/index.d.ts.map +1 -0
- package/dist/node/service-host/registry-slot-guard-step.d.ts +21 -0
- package/dist/node/service-host/registry-slot-guard-step.d.ts.map +1 -0
- package/dist/node/service-host/service-host.d.ts +36 -0
- package/dist/node/service-host/service-host.d.ts.map +1 -0
- package/dist/node/service-host/single-process-service.d.ts +21 -0
- package/dist/node/service-host/single-process-service.d.ts.map +1 -0
- package/dist/node.d.ts +15 -2
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +2221 -1485
- package/dist/node.js.map +1 -1
- package/dist/preload.js +3 -3
- package/dist/service/config.api.d.ts +143 -0
- package/dist/service/config.api.d.ts.map +1 -0
- package/dist/service/config.interface.d.ts +22 -0
- package/dist/service/config.interface.d.ts.map +1 -0
- package/dist/service/index.d.ts +16 -17
- package/dist/service/index.d.ts.map +1 -1
- package/dist/service/registry-lifecycle.d.ts +43 -0
- package/dist/service/registry-lifecycle.d.ts.map +1 -0
- package/dist/service/registry.service.d.ts +117 -0
- package/dist/service/registry.service.d.ts.map +1 -0
- package/dist/service/service-bootstrap.d.ts +28 -0
- package/dist/service/service-bootstrap.d.ts.map +1 -0
- package/dist/service/service.api.d.ts +160 -0
- package/dist/service/service.api.d.ts.map +1 -1
- package/dist/service/service.interface.d.ts +32 -1
- package/dist/service/service.interface.d.ts.map +1 -1
- package/dist/shared/log/index.d.ts +4 -0
- package/dist/shared/log/index.d.ts.map +1 -1
- package/dist/shared/log/log-batch.d.ts +44 -0
- package/dist/shared/log/log-batch.d.ts.map +1 -0
- package/dist/shared/log/log-persist-coordinator.d.ts +37 -0
- package/dist/shared/log/log-persist-coordinator.d.ts.map +1 -0
- package/dist/shared/log/log-persist-flush.d.ts.map +1 -1
- package/dist/shared/log/log-persist.config.d.ts +0 -1
- package/dist/shared/log/log-persist.config.d.ts.map +1 -1
- package/dist/shared/log/log-persist.interface.d.ts +8 -0
- package/dist/shared/log/log-persist.interface.d.ts.map +1 -1
- package/dist/shared/utils/config-path.utils.d.ts +21 -0
- package/dist/shared/utils/config-path.utils.d.ts.map +1 -1
- package/dist/shared/utils/get-value-at-path.d.ts +3 -0
- package/dist/shared/utils/get-value-at-path.d.ts.map +1 -0
- package/dist/task/index.d.ts +2 -0
- package/dist/task/index.d.ts.map +1 -1
- package/dist/task/task-manager.d.ts +1 -1
- package/dist/task/task-manager.d.ts.map +1 -1
- package/dist/task/task-post-retry.api.d.ts +24 -0
- package/dist/task/task-post-retry.api.d.ts.map +1 -0
- package/dist/task/task-repo-context.d.ts +7 -1
- package/dist/task/task-repo-context.d.ts.map +1 -1
- package/dist/trigger/trigger-manager.d.ts +1 -1
- package/dist/trigger/trigger-manager.d.ts.map +1 -1
- package/dist/trigger/trigger-node.d.ts +1 -0
- package/dist/trigger/trigger-node.d.ts.map +1 -1
- package/dist/trigger/trigger.constant.d.ts +1 -1
- package/dist/trigger/trigger.constant.d.ts.map +1 -1
- package/dist/trigger/trigger.interface.d.ts +10 -0
- package/dist/trigger/trigger.interface.d.ts.map +1 -1
- package/package.json +4 -2
- package/src/browser.ts +102 -4
- package/src/extraction/extraction.api.ts +232 -0
- package/src/extraction/extraction.interface.ts +45 -0
- package/src/list/list.interface.ts +2 -2
- package/src/node/fs/json-state-store.ts +5 -2
- package/src/node/fs/runtime-state-path.ts +35 -0
- package/src/node/fs/sharded-json-state-store.ts +157 -0
- package/src/node/node-runtime.base.ts +37 -6
- package/src/node/process/create-managed-child-processes.ts +27 -0
- package/src/node/process/index.ts +4 -0
- package/src/node/process/managed-child-processes.ts +48 -15
- package/src/node/runtime-state/create-service-runtime-state-store.ts +125 -0
- package/src/node/runtime-state/index.ts +17 -0
- package/src/node/runtime-state/service-runtime-state.types.ts +64 -0
- package/src/node/service-guard/index.ts +17 -0
- package/src/node/service-guard/register-service-guard-runner.ts +64 -0
- package/src/node/service-guard/run-readiness-gate.ts +34 -0
- package/src/node/service-guard/run-service-guard-tick.ts +106 -0
- package/src/node/service-guard/service-guard-node.ts +52 -0
- package/src/node/service-guard/service-guard.interface.ts +64 -0
- package/src/node/service-guard/worker-spawn-cooldown.ts +13 -0
- package/src/node/service-host/index.ts +30 -0
- package/src/node/service-host/registry-slot-guard-step.ts +57 -0
- package/src/node/service-host/service-host.ts +168 -0
- package/src/node/service-host/single-process-service.ts +58 -0
- package/src/node.ts +69 -0
- package/src/service/config.api.ts +224 -0
- package/src/service/config.interface.ts +25 -0
- package/src/service/index.ts +78 -149
- package/src/service/registry-lifecycle.ts +144 -0
- package/src/service/registry.service.ts +726 -0
- package/src/service/service-bootstrap.ts +74 -0
- package/src/service/service.api.ts +13 -0
- package/src/service/service.interface.ts +36 -1
- package/src/shared/log/index.ts +13 -0
- package/src/shared/log/log-batch.ts +156 -0
- package/src/shared/log/log-persist-coordinator.ts +107 -0
- package/src/shared/log/log-persist-flush.ts +3 -3
- package/src/shared/log/log-persist.config.ts +0 -2
- package/src/shared/log/log-persist.interface.ts +10 -0
- package/src/shared/utils/config-path.utils.ts +35 -0
- package/src/shared/utils/get-value-at-path.ts +17 -0
- package/src/task/index.ts +2 -0
- package/src/task/task-manager.ts +10 -4
- package/src/task/task-post-retry.api.ts +61 -0
- package/src/task/task-repo-context.ts +8 -1
- package/src/trigger/trigger-manager.ts +4 -2
- package/src/trigger/trigger-node.ts +10 -4
- package/src/trigger/trigger.constant.ts +1 -1
- package/src/trigger/trigger.interface.ts +10 -0
- package/dist/chunks/create-logger-DyH3mZ8p.js.map +0 -1
- package/dist/chunks/enable-log-persist-C7GJo_Nc.js.map +0 -1
- package/dist/chunks/word.interface-DLgRobKV.js.map +0 -1
|
@@ -12,6 +12,7 @@ import type { TriggerNodeOptions } from "./trigger.interface";
|
|
|
12
12
|
*/
|
|
13
13
|
declare class TriggerNode extends BaseNodeRuntime {
|
|
14
14
|
private readonly requireRunners;
|
|
15
|
+
private readonly loopIntervalMs;
|
|
15
16
|
constructor(options?: TriggerNodeOptions);
|
|
16
17
|
protected getLoopIntervalMs(): number;
|
|
17
18
|
protected loopLoggerMinLevel(): LogLevel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger-node.d.ts","sourceRoot":"","sources":["../../src/trigger/trigger-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAkB,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EAA6B,KAAK,eAAe,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9D;;;;;;;;GAQG;AACH,cAAM,WAAY,SAAQ,eAAe;IACrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;
|
|
1
|
+
{"version":3,"file":"trigger-node.d.ts","sourceRoot":"","sources":["../../src/trigger/trigger-node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAkB,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EAA6B,KAAK,eAAe,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9D;;;;;;;;GAQG;AACH,cAAM,WAAY,SAAQ,eAAe;IACrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;IACzC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;gBAE5B,OAAO,CAAC,EAAE,kBAAkB;IAUxC,SAAS,CAAC,iBAAiB,IAAI,MAAM;IAIrC,SAAS,CAAC,kBAAkB,IAAI,QAAQ;cAIxB,oBAAoB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;cA+B5D,YAAY,CAAC,GAAG,EAAE,eAAe,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAc1F;AAED,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const LOG_TOPIC_TRIGGER = "trigger";
|
|
2
|
-
/**
|
|
2
|
+
/** Default main-loop interval for {@link TriggerNode} when `loopIntervalMs` is omitted (ms). */
|
|
3
3
|
export declare const TRIGGER_LOOP_INTERVAL_MS = 60000;
|
|
4
4
|
/** Default extra retries after first failure within one runner tick. */
|
|
5
5
|
export declare const TRIGGER_RUNNER_DEFAULT_RETRY_COUNT = 3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.constant.d.ts","sourceRoot":"","sources":["../../src/trigger/trigger.constant.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,
|
|
1
|
+
{"version":3,"file":"trigger.constant.d.ts","sourceRoot":"","sources":["../../src/trigger/trigger.constant.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,gGAAgG;AAChG,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C,wEAAwE;AACxE,eAAO,MAAM,kCAAkC,IAAI,CAAC;AAEpD,sEAAsE;AACtE,eAAO,MAAM,qCAAqC,IAAI,CAAC"}
|
|
@@ -83,5 +83,15 @@ export interface TriggerNodeOptions {
|
|
|
83
83
|
* Default `false` (warn and idle loop).
|
|
84
84
|
*/
|
|
85
85
|
requireRunners?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Main loop tick interval (ms). Runners are evaluated each tick; effective runner
|
|
88
|
+
* precision is bounded by this value. Default {@link TRIGGER_LOOP_INTERVAL_MS} (60s).
|
|
89
|
+
*/
|
|
90
|
+
loopIntervalMs?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Called after node logout, immediately before `process.exit`.
|
|
93
|
+
* Typical use: {@link unregisterServiceAtShutdown} for single-process L3 services.
|
|
94
|
+
*/
|
|
95
|
+
beforeProcessExit?: () => void | Promise<void>;
|
|
86
96
|
}
|
|
87
97
|
//# sourceMappingURL=trigger.interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.interface.d.ts","sourceRoot":"","sources":["../../src/trigger/trigger.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,oBAAY,eAAe;IACvB,OAAO,YAAY;CACtB;AAED,oBAAY,aAAa;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;CACpB;AAED,kDAAkD;AAClD,MAAM,WAAW,oBAAoB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAEnD,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,UAAU,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;CAClD;AAED,MAAM,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAElD,MAAM,WAAW,OAAQ,SAAQ,MAAM;IACnC,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,wFAAwF;IACxF,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAID,gDAAgD;AAChD,MAAM,WAAW,oBAAoB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,eAAe,CAAC;IACxB,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,oBAAoB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAElF,MAAM,WAAW,4BAA4B;IACzC,0EAA0E;IAC1E,GAAG,EAAE,MAAM,CAAC;IACZ,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,eAAe,CAAC;IACpB,uDAAuD;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IAC/B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"trigger.interface.d.ts","sourceRoot":"","sources":["../../src/trigger/trigger.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,oBAAY,eAAe;IACvB,OAAO,YAAY;CACtB;AAED,oBAAY,aAAa;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;CACpB;AAED,kDAAkD;AAClD,MAAM,WAAW,oBAAoB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAEnD,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,UAAU,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;CAClD;AAED,MAAM,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAElD,MAAM,WAAW,OAAQ,SAAQ,MAAM;IACnC,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,wFAAwF;IACxF,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAID,gDAAgD;AAChD,MAAM,WAAW,oBAAoB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,eAAe,CAAC;IACxB,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,oBAAoB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAElF,MAAM,WAAW,4BAA4B;IACzC,0EAA0E;IAC1E,GAAG,EAAE,MAAM,CAAC;IACZ,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,eAAe,CAAC;IACpB,uDAAuD;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IAC/B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "target-supabase-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Supabase client initializer and data access APIs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "KyLoc20",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
],
|
|
48
48
|
"scripts": {
|
|
49
49
|
"clean": "node --input-type=module -e \"import fs from 'node:fs'; fs.rmSync('dist', { recursive: true, force: true })\"",
|
|
50
|
-
"build": "pnpm clean && rollup -c && tsc -p tsconfig.dts.json && node scripts/verify-browser-entry.mjs",
|
|
50
|
+
"build": "pnpm clean && rollup -c && node --input-type=module -e \"console.log('[build] emitting declarations (tsc)...')\" && tsc -p tsconfig.dts.json && node scripts/verify-browser-entry.mjs",
|
|
51
51
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
52
52
|
"typecheck:scripts": "tsc -p tsconfig.scripts.json",
|
|
53
53
|
"format": "biome check --write .",
|
|
@@ -56,6 +56,8 @@
|
|
|
56
56
|
"worker:trigger": "tsx scripts/run-trigger-node.ts",
|
|
57
57
|
"post-command": "tsx scripts/post-command.ts",
|
|
58
58
|
"post-trigger": "tsx scripts/post-trigger.ts",
|
|
59
|
+
"seed:system-registry": "tsx scripts/seed-system-registry.ts",
|
|
60
|
+
"reset:system-registry": "tsx scripts/reset-system-registry.ts",
|
|
59
61
|
"parcel:split": "tsx scripts/parcel-split-local.ts",
|
|
60
62
|
"parcel:restore": "tsx scripts/parcel-restore-local.ts",
|
|
61
63
|
"dev": "rollup -c --watch",
|
package/src/browser.ts
CHANGED
|
@@ -9,6 +9,24 @@ export type { SupabaseClient } from "@supabase/supabase-js";
|
|
|
9
9
|
export * from "./core.api";
|
|
10
10
|
export * from "./core.interface";
|
|
11
11
|
export * from "./core.utils";
|
|
12
|
+
export type {
|
|
13
|
+
GetExtractionPayload,
|
|
14
|
+
PatchExtractionObjectsPayload,
|
|
15
|
+
PostExtractionPayload,
|
|
16
|
+
ScanExtractionListPayload,
|
|
17
|
+
} from "./extraction/extraction.api";
|
|
18
|
+
export {
|
|
19
|
+
getExtraction,
|
|
20
|
+
getExtractionSchema,
|
|
21
|
+
patchExtractionObjects,
|
|
22
|
+
patchExtractionObjectsSchema,
|
|
23
|
+
postExtraction,
|
|
24
|
+
postExtractionSchema,
|
|
25
|
+
scanExtractionList,
|
|
26
|
+
scanExtractionListSchema,
|
|
27
|
+
} from "./extraction/extraction.api";
|
|
28
|
+
export type { Extraction, ExtractionDetails } from "./extraction/extraction.interface";
|
|
29
|
+
export { CategoryExtraction } from "./extraction/extraction.interface";
|
|
12
30
|
export * from "./idea/idea.interface";
|
|
13
31
|
export * from "./link/link.api";
|
|
14
32
|
export * from "./link/link.interface";
|
|
@@ -86,32 +104,88 @@ export * from "./repo/repo.interface";
|
|
|
86
104
|
export type {
|
|
87
105
|
Api,
|
|
88
106
|
ApiDetails,
|
|
89
|
-
|
|
107
|
+
ClaimRegistrySlotInput,
|
|
108
|
+
Config,
|
|
109
|
+
ConfigDetails,
|
|
90
110
|
GetApiPayload,
|
|
111
|
+
GetConfigPayload,
|
|
91
112
|
GetServicePayload,
|
|
113
|
+
PatchServiceRuntimeInput,
|
|
92
114
|
PostApiPayload,
|
|
115
|
+
PostServiceInstanceOptions,
|
|
93
116
|
PostServicePayload,
|
|
117
|
+
PostSystemRegistryConfigPayload,
|
|
118
|
+
RegisterServiceInput,
|
|
119
|
+
RegistrySlotGuardResult,
|
|
120
|
+
RegistrySlotRuntimeState,
|
|
121
|
+
ReleasedRegistrySlot,
|
|
122
|
+
ReleaseSystemRegistrySlotsInput,
|
|
123
|
+
ReleaseSystemRegistrySlotsOutcome,
|
|
124
|
+
ResetSystemRegistryConfigPayload,
|
|
94
125
|
Service,
|
|
126
|
+
ServiceBootstrapResult,
|
|
95
127
|
ServiceDetails,
|
|
128
|
+
ServiceNodeSnapshot,
|
|
129
|
+
ServiceRegistrySession,
|
|
130
|
+
ServiceRuntime,
|
|
131
|
+
ServiceSlot,
|
|
132
|
+
SystemRegistrySeedSlot,
|
|
133
|
+
TargetSystemRegistrySlotView,
|
|
134
|
+
TargetSystemRegistryView,
|
|
96
135
|
} from "./service/index";
|
|
97
136
|
export {
|
|
98
137
|
ApiMethod,
|
|
99
138
|
apiDetailsSchema,
|
|
139
|
+
assertRegistrySlotAvailable,
|
|
140
|
+
assertRegistrySlotOwner,
|
|
141
|
+
buildEmptyServiceSlots,
|
|
142
|
+
buildSystemRegistryConfigDetails,
|
|
143
|
+
CategoryConfig,
|
|
100
144
|
CategoryService,
|
|
101
|
-
|
|
145
|
+
claimServiceRegistrySlot,
|
|
146
|
+
createActiveServiceLifecycle,
|
|
147
|
+
createClaimedRegistrySlotRuntimeState,
|
|
148
|
+
DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS,
|
|
149
|
+
defaultL3ServiceDetails,
|
|
150
|
+
EMPTY_REGISTRY_SLOT_RUNTIME_STATE,
|
|
102
151
|
fieldDefinitionSchema,
|
|
103
152
|
getApi,
|
|
104
153
|
getApiSchema,
|
|
154
|
+
getConfig,
|
|
155
|
+
getConfigSchema,
|
|
105
156
|
getService,
|
|
106
157
|
getServiceSchema,
|
|
158
|
+
getTargetSystemRegistry,
|
|
159
|
+
parseServiceSlot,
|
|
160
|
+
parseServiceSlots,
|
|
161
|
+
patchServiceRuntime,
|
|
107
162
|
postApi,
|
|
108
163
|
postApiSchema,
|
|
109
164
|
postService,
|
|
165
|
+
postServiceInstance,
|
|
110
166
|
postServiceSchema,
|
|
167
|
+
postSystemRegistryConfig,
|
|
168
|
+
postSystemRegistryConfigSchema,
|
|
169
|
+
registerService,
|
|
170
|
+
registerServiceAtStartup,
|
|
171
|
+
registrySlotRuntimePatchFromGuardResult,
|
|
172
|
+
releaseSystemRegistrySlots,
|
|
173
|
+
resetSystemRegistryConfig,
|
|
174
|
+
resetSystemRegistryConfigSchema,
|
|
175
|
+
resolveActiveRegistryServiceId,
|
|
176
|
+
runRegistrySlotGuardCheck,
|
|
111
177
|
ServiceLifecycleStatus,
|
|
178
|
+
ServiceRegistryError,
|
|
179
|
+
ServiceSlotStatus,
|
|
112
180
|
schemaDefinitionSchema,
|
|
113
181
|
serviceDetailsSchema,
|
|
114
182
|
serviceLifecycleSchema,
|
|
183
|
+
serviceNodeSnapshotSchema,
|
|
184
|
+
serviceRuntimeSchema,
|
|
185
|
+
systemRegistrySeedSlotSchema,
|
|
186
|
+
TARGET_SYSTEM_REGISTRY_KEY,
|
|
187
|
+
unregisterService,
|
|
188
|
+
unregisterServiceAtShutdown,
|
|
115
189
|
} from "./service/index";
|
|
116
190
|
export type { FetchInitFactory, FetchRetryOptions } from "./shared/http/fetch-retry";
|
|
117
191
|
export {
|
|
@@ -120,9 +194,31 @@ export {
|
|
|
120
194
|
isRetryableHttpStatus,
|
|
121
195
|
requestHasBody,
|
|
122
196
|
} from "./shared/http/fetch-retry";
|
|
123
|
-
export type {
|
|
124
|
-
|
|
197
|
+
export type {
|
|
198
|
+
CreateLoggerInput,
|
|
199
|
+
DecodedLogBatch,
|
|
200
|
+
FlatLogEntry,
|
|
201
|
+
LogEntry,
|
|
202
|
+
LoggerWithScope,
|
|
203
|
+
LogScope,
|
|
204
|
+
LogScopePatch,
|
|
205
|
+
} from "./shared/log";
|
|
206
|
+
export {
|
|
207
|
+
createLogger,
|
|
208
|
+
decodeLogBatch,
|
|
209
|
+
decodeLogBatchList,
|
|
210
|
+
flattenLogBatch,
|
|
211
|
+
flattenLogBatches,
|
|
212
|
+
isLogBatchList,
|
|
213
|
+
isLogEntry,
|
|
214
|
+
LOG_BATCH_LOADER_KEY,
|
|
215
|
+
LOG_PERSIST_LOADER_KEY,
|
|
216
|
+
LogLevel,
|
|
217
|
+
logManager,
|
|
218
|
+
parseLogBatchMeta,
|
|
219
|
+
} from "./shared/log";
|
|
125
220
|
export { isHttpUrl, resolveFetchUrl } from "./shared/utils/fetch-url";
|
|
221
|
+
export { getValueAtPath } from "./shared/utils/get-value-at-path";
|
|
126
222
|
export type {
|
|
127
223
|
ClassifiedNetworkError,
|
|
128
224
|
FormatNetworkErrorOptions,
|
|
@@ -160,6 +256,8 @@ export {
|
|
|
160
256
|
} from "./task/task.interface";
|
|
161
257
|
export type { PostTaskPayload } from "./task/task-post.api";
|
|
162
258
|
export { postTask, postTaskSchema } from "./task/task-post.api";
|
|
259
|
+
export type { PostTaskWithRetryOptions, PostTaskWithRetryResult } from "./task/task-post-retry.api";
|
|
260
|
+
export { POST_TASK_DEFAULT_MAX_ATTEMPTS, postTaskWithRetry } from "./task/task-post-retry.api";
|
|
163
261
|
export type { TaskStatusCount } from "./task/task-queue";
|
|
164
262
|
export { countTasksByType, summarizeTaskQueue } from "./task/task-queue";
|
|
165
263
|
export * from "./word/word.interface";
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
createTarget,
|
|
4
|
+
getPossibleTarget,
|
|
5
|
+
getTarget,
|
|
6
|
+
isCreateTargetAlreadyExistsError,
|
|
7
|
+
type QueryFilter,
|
|
8
|
+
scanTargetList,
|
|
9
|
+
updateTargetDetails,
|
|
10
|
+
validateWithSchema,
|
|
11
|
+
} from "../core.api";
|
|
12
|
+
import type { SupabaseResponse } from "../core.interface";
|
|
13
|
+
import { generateResponse } from "../core.interface";
|
|
14
|
+
import { createLogger } from "../shared/log";
|
|
15
|
+
import { CategoryExtraction, type Extraction, type ExtractionDetails } from "./extraction.interface";
|
|
16
|
+
|
|
17
|
+
const targetIdSchema = z.string().trim().min(1);
|
|
18
|
+
const loaderKeySchema = z.string().trim().min(1);
|
|
19
|
+
|
|
20
|
+
export const postExtractionSchema = z.object({
|
|
21
|
+
name: z.string().trim().min(1),
|
|
22
|
+
/** Source Target id — for log analysis this is the producing Task id. */
|
|
23
|
+
sourceId: targetIdSchema,
|
|
24
|
+
loaderKey: loaderKeySchema,
|
|
25
|
+
meta: z.unknown().optional(),
|
|
26
|
+
objects: z.array(z.unknown()).min(1),
|
|
27
|
+
tagList: z.array(z.string()).optional().default([]),
|
|
28
|
+
extra: z.string().optional(),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export type PostExtractionPayload = z.infer<typeof postExtractionSchema>;
|
|
32
|
+
|
|
33
|
+
export const getExtractionSchema = z
|
|
34
|
+
.object({
|
|
35
|
+
id: targetIdSchema.optional(),
|
|
36
|
+
sourceId: targetIdSchema.optional(),
|
|
37
|
+
loaderKey: loaderKeySchema.optional(),
|
|
38
|
+
})
|
|
39
|
+
.refine(
|
|
40
|
+
(payload) => {
|
|
41
|
+
const hasId = payload.id != null && payload.id !== "";
|
|
42
|
+
const hasSource = payload.sourceId != null && payload.sourceId !== "";
|
|
43
|
+
if (hasId) {
|
|
44
|
+
return !hasSource;
|
|
45
|
+
}
|
|
46
|
+
return hasSource && payload.loaderKey != null && payload.loaderKey !== "";
|
|
47
|
+
},
|
|
48
|
+
{ message: "Provide id, or both sourceId and loaderKey" },
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export type GetExtractionPayload = z.infer<typeof getExtractionSchema>;
|
|
52
|
+
|
|
53
|
+
export const scanExtractionListSchema = z.object({
|
|
54
|
+
loaderKey: loaderKeySchema.optional(),
|
|
55
|
+
sourceId: targetIdSchema.optional(),
|
|
56
|
+
maxRows: z.number().int().min(1).max(500).optional(),
|
|
57
|
+
ascending: z.boolean().optional(),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export type ScanExtractionListPayload = z.infer<typeof scanExtractionListSchema>;
|
|
61
|
+
|
|
62
|
+
export const patchExtractionObjectsSchema = z.object({
|
|
63
|
+
id: targetIdSchema,
|
|
64
|
+
objects: z.array(z.unknown()).min(1),
|
|
65
|
+
meta: z.unknown().optional(),
|
|
66
|
+
expectedRevision: z.number().int().min(0).optional(),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export type PatchExtractionObjectsPayload = z.infer<typeof patchExtractionObjectsSchema>;
|
|
70
|
+
|
|
71
|
+
const extractionCategoryFilter: QueryFilter = {
|
|
72
|
+
field: "category",
|
|
73
|
+
operator: "eq",
|
|
74
|
+
value: CategoryExtraction.EXTRACTION,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
function extractionRedundancyFilters(sourceId: string, loaderKey: string): QueryFilter[] {
|
|
78
|
+
return [
|
|
79
|
+
extractionCategoryFilter,
|
|
80
|
+
{ field: "value", operator: "eq", value: sourceId },
|
|
81
|
+
{ field: "details->>loaderKey", operator: "eq", value: loaderKey },
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function normalizeExtractionMeta(meta: unknown, patch?: unknown): Record<string, unknown> {
|
|
86
|
+
const base =
|
|
87
|
+
meta != null && typeof meta === "object" && !Array.isArray(meta)
|
|
88
|
+
? { ...(meta as Record<string, unknown>) }
|
|
89
|
+
: {};
|
|
90
|
+
if (patch != null && typeof patch === "object" && !Array.isArray(patch)) {
|
|
91
|
+
Object.assign(base, patch as Record<string, unknown>);
|
|
92
|
+
}
|
|
93
|
+
const revision = typeof base.revision === "number" && Number.isInteger(base.revision) ? base.revision : 0;
|
|
94
|
+
base.revision = revision;
|
|
95
|
+
base.updatedAt = new Date().toISOString();
|
|
96
|
+
return base;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Create an Extraction row for `(sourceId, loaderKey)`. Idempotent on redundancy key. */
|
|
100
|
+
export const postExtraction = validateWithSchema(
|
|
101
|
+
postExtractionSchema,
|
|
102
|
+
"postExtractionSchema",
|
|
103
|
+
)(async (payload): Promise<SupabaseResponse<Extraction>> => {
|
|
104
|
+
const logger = createLogger({ module: "postExtraction" });
|
|
105
|
+
const meta = normalizeExtractionMeta(payload.meta, { revision: 0 });
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
return await createTarget<Extraction, PostExtractionPayload>({
|
|
109
|
+
payload,
|
|
110
|
+
checkRedundancyFilterList: extractionRedundancyFilters(payload.sourceId, payload.loaderKey),
|
|
111
|
+
createFn: () => ({
|
|
112
|
+
name: payload.name,
|
|
113
|
+
value: payload.sourceId,
|
|
114
|
+
category: CategoryExtraction.EXTRACTION,
|
|
115
|
+
tagList: payload.tagList,
|
|
116
|
+
extra: payload.extra,
|
|
117
|
+
details: {
|
|
118
|
+
manifestVersion: 0,
|
|
119
|
+
loaderKey: payload.loaderKey,
|
|
120
|
+
meta,
|
|
121
|
+
objects: payload.objects,
|
|
122
|
+
},
|
|
123
|
+
}),
|
|
124
|
+
});
|
|
125
|
+
} catch (error) {
|
|
126
|
+
if (isCreateTargetAlreadyExistsError(error)) {
|
|
127
|
+
logger.warn("Extraction already exists for source + loaderKey", {
|
|
128
|
+
topic: "extraction",
|
|
129
|
+
data: { sourceId: payload.sourceId, loaderKey: payload.loaderKey },
|
|
130
|
+
});
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
/** Fetch one Extraction by row id, or by `(sourceId, loaderKey)`. */
|
|
138
|
+
export const getExtraction = validateWithSchema(
|
|
139
|
+
getExtractionSchema,
|
|
140
|
+
"getExtractionSchema",
|
|
141
|
+
)(async (payload): Promise<SupabaseResponse<Extraction>> => {
|
|
142
|
+
if (payload.id != null && payload.id !== "") {
|
|
143
|
+
const result = await getTarget({
|
|
144
|
+
id: payload.id,
|
|
145
|
+
filterList: [extractionCategoryFilter],
|
|
146
|
+
});
|
|
147
|
+
return {
|
|
148
|
+
...result,
|
|
149
|
+
data: result.data as Extraction | undefined,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const result = await getPossibleTarget({
|
|
154
|
+
filterList: extractionRedundancyFilters(payload.sourceId!, payload.loaderKey!),
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
if (result.data == null) {
|
|
158
|
+
return generateResponse.error("Extraction not found", undefined, "NOT_FOUND") as SupabaseResponse<Extraction>;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
...result,
|
|
163
|
+
data: result.data as Extraction,
|
|
164
|
+
};
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
/** Scan Extraction rows (newest first by default). */
|
|
168
|
+
export const scanExtractionList = validateWithSchema(
|
|
169
|
+
scanExtractionListSchema,
|
|
170
|
+
"scanExtractionListSchema",
|
|
171
|
+
)(async (payload) => {
|
|
172
|
+
const filterList: QueryFilter[] = [extractionCategoryFilter];
|
|
173
|
+
if (payload.loaderKey != null) {
|
|
174
|
+
filterList.push({ field: "details->>loaderKey", operator: "eq", value: payload.loaderKey });
|
|
175
|
+
}
|
|
176
|
+
if (payload.sourceId != null) {
|
|
177
|
+
filterList.push({ field: "value", operator: "eq", value: payload.sourceId });
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return scanTargetList<Extraction>({
|
|
181
|
+
category: CategoryExtraction.EXTRACTION,
|
|
182
|
+
filterList,
|
|
183
|
+
maxRows: payload.maxRows ?? 100,
|
|
184
|
+
orderBy: { field: "created_at", ascending: payload.ascending ?? false },
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
/** Replace {@link ExtractionDetails.objects} and bump `meta.revision`. */
|
|
189
|
+
export const patchExtractionObjects = validateWithSchema(
|
|
190
|
+
patchExtractionObjectsSchema,
|
|
191
|
+
"patchExtractionObjectsSchema",
|
|
192
|
+
)(async (payload): Promise<SupabaseResponse<Extraction>> => {
|
|
193
|
+
const optimisticLockFilterList: QueryFilter[] = [];
|
|
194
|
+
if (payload.expectedRevision != null) {
|
|
195
|
+
optimisticLockFilterList.push({
|
|
196
|
+
field: "details->meta->>revision",
|
|
197
|
+
operator: "eq",
|
|
198
|
+
value: String(payload.expectedRevision),
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
try {
|
|
203
|
+
const data = await updateTargetDetails<Extraction, ExtractionDetails>({
|
|
204
|
+
id: payload.id,
|
|
205
|
+
optimisticLockFilterList,
|
|
206
|
+
updateFn: (current) => {
|
|
207
|
+
const currentMeta =
|
|
208
|
+
current.meta != null && typeof current.meta === "object" && !Array.isArray(current.meta)
|
|
209
|
+
? (current.meta as Record<string, unknown>)
|
|
210
|
+
: {};
|
|
211
|
+
const revision =
|
|
212
|
+
typeof currentMeta.revision === "number" && Number.isInteger(currentMeta.revision)
|
|
213
|
+
? currentMeta.revision + 1
|
|
214
|
+
: 1;
|
|
215
|
+
return {
|
|
216
|
+
...current,
|
|
217
|
+
meta: normalizeExtractionMeta(current.meta, {
|
|
218
|
+
...(payload.meta != null && typeof payload.meta === "object" && !Array.isArray(payload.meta)
|
|
219
|
+
? payload.meta
|
|
220
|
+
: {}),
|
|
221
|
+
revision,
|
|
222
|
+
}),
|
|
223
|
+
objects: payload.objects,
|
|
224
|
+
};
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
return generateResponse.success(data as Extraction);
|
|
228
|
+
} catch (error) {
|
|
229
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
230
|
+
return generateResponse.error(message, undefined, "PATCH_FAILED") as SupabaseResponse<Extraction>;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Target } from "../core.interface";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Interpretation layer for a source Target: pipeline output (systems, models, algorithms)
|
|
5
|
+
* materialized as structured data. Not a process (see Task) or raw bytes (see Parcel).
|
|
6
|
+
*
|
|
7
|
+
* @see `.cursor/skills/extraction/SKILL.md`
|
|
8
|
+
*/
|
|
9
|
+
export interface Extraction extends Target {
|
|
10
|
+
/** Human-readable label. */
|
|
11
|
+
name: string;
|
|
12
|
+
/**
|
|
13
|
+
* Source Target id — the single input this row interprets (any category).
|
|
14
|
+
* Immutable after create. Indexed for lookup: all Extractions where `value = sourceId`.
|
|
15
|
+
* Not a dedup hash or pipeline run id.
|
|
16
|
+
*/
|
|
17
|
+
value: string;
|
|
18
|
+
category: CategoryExtraction;
|
|
19
|
+
details: ExtractionDetails;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export enum CategoryExtraction {
|
|
23
|
+
EXTRACTION = "extraction",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ExtractionDetails {
|
|
27
|
+
manifestVersion: 0;
|
|
28
|
+
/**
|
|
29
|
+
* Extractor identifier. Together with {@link Extraction.value} (source id) forms the
|
|
30
|
+
* logical unique key: one Extraction row per `(sourceTargetId, loaderKey)`.
|
|
31
|
+
* Determines how to parse and render {@link objects} (Extractor-owned schema).
|
|
32
|
+
*/
|
|
33
|
+
loaderKey: string;
|
|
34
|
+
/**
|
|
35
|
+
* Extractor-owned metadata for this interpretation (e.g. revision, updatedAt, pipeline).
|
|
36
|
+
* Updated alongside {@link objects}; kept `unknown` at SDK boundary — see Extractor module.
|
|
37
|
+
*/
|
|
38
|
+
meta: unknown;
|
|
39
|
+
/**
|
|
40
|
+
* Latest mutable analysis results for this source + Extractor — not an immutable snapshot.
|
|
41
|
+
* Shape is defined by the Extractor for {@link loaderKey}; SDK keeps `unknown[]` at core.
|
|
42
|
+
* Large payloads should reference Parcel (or similar) rather than inline in this array.
|
|
43
|
+
*/
|
|
44
|
+
objects: Array<unknown>;
|
|
45
|
+
}
|
|
@@ -13,8 +13,8 @@ export interface List extends Target {
|
|
|
13
13
|
|
|
14
14
|
export interface ListDetails {
|
|
15
15
|
manifestVersion: number;
|
|
16
|
-
/**
|
|
17
|
-
meta:
|
|
16
|
+
/** Optional list metadata (shape depends on `loaderKey`). */
|
|
17
|
+
meta: unknown;
|
|
18
18
|
/** If string, it is the url of the preview TODO */
|
|
19
19
|
preview: string;
|
|
20
20
|
/** How to render the List */
|
|
@@ -76,8 +76,11 @@ export function createJsonFileStateStore<T extends object, NK extends keyof T =
|
|
|
76
76
|
const raw = await readFile(filePath, "utf8");
|
|
77
77
|
const parsed = JSON.parse(raw) as Partial<T>;
|
|
78
78
|
return mergeWithNested(defaultState, parsed, {}, nestedKeys);
|
|
79
|
-
} catch {
|
|
80
|
-
|
|
79
|
+
} catch (error) {
|
|
80
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") {
|
|
81
|
+
return mergeWithNested(defaultState, {}, {}, nestedKeys);
|
|
82
|
+
}
|
|
83
|
+
throw error;
|
|
81
84
|
}
|
|
82
85
|
},
|
|
83
86
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { dirname, join } from "node:path";
|
|
2
|
+
|
|
3
|
+
const RUNTIME_STATE_SHARD_DIR = "runtime-state";
|
|
4
|
+
|
|
5
|
+
export interface ResolvedRuntimeStatePaths {
|
|
6
|
+
/** Directory holding one JSON file per top-level slice. */
|
|
7
|
+
stateDir: string;
|
|
8
|
+
/** Legacy monolithic `state.json` — migrated on read/reset when present. */
|
|
9
|
+
legacyFilePath: string | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Resolve sharded runtime state layout from {@link CreateServiceRuntimeStateStoreOptions.filePath}.
|
|
14
|
+
*
|
|
15
|
+
* | `filePath` | Shard dir | Legacy |
|
|
16
|
+
* |-------------------------|-----------------------------------|---------------|
|
|
17
|
+
* | `.../state.json` | `.../runtime-state/` | `state.json` |
|
|
18
|
+
* | `.../runtime-state/` | same directory | none |
|
|
19
|
+
*/
|
|
20
|
+
export function resolveRuntimeStatePaths(filePath: string): ResolvedRuntimeStatePaths {
|
|
21
|
+
if (filePath.endsWith(".json")) {
|
|
22
|
+
return {
|
|
23
|
+
stateDir: join(dirname(filePath), RUNTIME_STATE_SHARD_DIR),
|
|
24
|
+
legacyFilePath: filePath,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
stateDir: filePath,
|
|
29
|
+
legacyFilePath: null,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function runtimeStateShardPath(stateDir: string, sliceKey: string): string {
|
|
34
|
+
return join(stateDir, `${sliceKey}.json`);
|
|
35
|
+
}
|