target-supabase-sdk 0.2.25 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +2 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +2 -2
- package/dist/chunks/{list.api-B-aM4vzv.js → config-aBbuDpyt.js} +144 -2
- package/dist/chunks/config-aBbuDpyt.js.map +1 -0
- package/dist/chunks/{enable-DkiKPHDl.js → enable-BTFwzWHc.js} +3 -120
- package/dist/chunks/enable-BTFwzWHc.js.map +1 -0
- package/dist/chunks/{task-queue-BYfO0Nzm.js → task-queue-D8CraGI8.js} +36 -7
- package/dist/chunks/task-queue-D8CraGI8.js.map +1 -0
- package/dist/core.api.d.ts +17 -0
- package/dist/core.api.d.ts.map +1 -1
- package/dist/node/{node-runtime.base.d.ts → base-node-runtime.d.ts} +4 -1
- package/dist/node/base-node-runtime.d.ts.map +1 -0
- package/dist/node/node-liveness.d.ts +2 -0
- package/dist/node/node-liveness.d.ts.map +1 -1
- package/dist/node/node-service-id.d.ts +3 -0
- package/dist/node/node-service-id.d.ts.map +1 -0
- package/dist/node/node.api.d.ts +9 -1
- package/dist/node/node.api.d.ts.map +1 -1
- package/dist/node/node.interface.d.ts +12 -3
- package/dist/node/node.interface.d.ts.map +1 -1
- package/dist/node/service-guard/run-service-guard-tick.d.ts.map +1 -1
- package/dist/node/service-guard/service-guard-node.d.ts +3 -1
- package/dist/node/service-guard/service-guard-node.d.ts.map +1 -1
- package/dist/node/service-host/service-host.d.ts.map +1 -1
- package/dist/node/service-host/single-process-service.d.ts.map +1 -1
- package/dist/node.d.ts +2 -2
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +199 -181
- package/dist/node.js.map +1 -1
- package/dist/preload.js +2 -2
- package/dist/service/service.interface.d.ts +5 -3
- package/dist/service/service.interface.d.ts.map +1 -1
- package/dist/task/task-node.d.ts +3 -1
- package/dist/task/task-node.d.ts.map +1 -1
- package/dist/task/task.interface.d.ts +3 -1
- package/dist/task/task.interface.d.ts.map +1 -1
- package/dist/trigger/trigger-manager.d.ts +1 -1
- package/dist/trigger/trigger-node.d.ts +3 -1
- package/dist/trigger/trigger-node.d.ts.map +1 -1
- package/dist/trigger/trigger.api.d.ts +10 -10
- package/package.json +1 -1
- package/src/browser.ts +2 -1
- package/src/core.api.ts +53 -0
- package/src/node/{node-runtime.base.ts → base-node-runtime.ts} +11 -2
- package/src/node/node-liveness.ts +6 -1
- package/src/node/node-service-id.ts +12 -0
- package/src/node/node.api.ts +7 -5
- package/src/node/node.interface.ts +12 -2
- package/src/node/service-guard/run-service-guard-tick.ts +12 -6
- package/src/node/service-guard/service-guard-node.ts +6 -1
- package/src/node/service-host/service-host.ts +2 -1
- package/src/node/service-host/single-process-service.ts +3 -0
- package/src/node.ts +2 -2
- package/src/service/service.interface.ts +4 -2
- package/src/task/task-node.ts +6 -1
- package/src/task/task.interface.ts +2 -0
- package/src/trigger/trigger-manager.ts +1 -1
- package/src/trigger/trigger-node.ts +6 -1
- package/dist/chunks/enable-DkiKPHDl.js.map +0 -1
- package/dist/chunks/list.api-B-aM4vzv.js.map +0 -1
- package/dist/chunks/task-queue-BYfO0Nzm.js.map +0 -1
- package/dist/node/node-runtime.base.d.ts.map +0 -1
package/dist/preload.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
|
-
import { w as logManager, H as resolveLogMinLevel } from './chunks/
|
|
3
|
-
import { r as resolveProjectRootByPackageName, p as pinEnvProfileFromArgv, l as loadEnvFiles, v as validateLogSpoolPreloadEnv, a as logSpoolEnabledFromEnv, m as mergeLogSpoolExtraProcessRolesEnv } from './chunks/enable-
|
|
2
|
+
import { w as logManager, H as resolveLogMinLevel } from './chunks/config-aBbuDpyt.js';
|
|
3
|
+
import { r as resolveProjectRootByPackageName, p as pinEnvProfileFromArgv, l as loadEnvFiles, v as validateLogSpoolPreloadEnv, a as logSpoolEnabledFromEnv, m as mergeLogSpoolExtraProcessRolesEnv } from './chunks/enable-BTFwzWHc.js';
|
|
4
4
|
import 'node:crypto';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'lodash-es';
|
|
@@ -13,7 +13,9 @@ export interface Service extends Target {
|
|
|
13
13
|
details: ServiceDetails;
|
|
14
14
|
}
|
|
15
15
|
export declare enum CategoryService {
|
|
16
|
-
SERVICE = "service"
|
|
16
|
+
SERVICE = "service",
|
|
17
|
+
/** Cold storage — excluded from registry resolution and active service scans. */
|
|
18
|
+
SERVICE_ARCHIVED = "service.archived"
|
|
17
19
|
}
|
|
18
20
|
export interface ServiceDetails {
|
|
19
21
|
manifestVersion: number;
|
|
@@ -25,7 +27,7 @@ export interface ServiceDetails {
|
|
|
25
27
|
/** Present on runtime instances; omitted on catalog-only rows until guard starts. */
|
|
26
28
|
runtime?: ServiceRuntime;
|
|
27
29
|
}
|
|
28
|
-
/** Per-node snapshot
|
|
30
|
+
/** Per-node snapshot for nodes owned by this Service instance (`Node.name === serviceId`). */
|
|
29
31
|
export interface ServiceNodeSnapshot {
|
|
30
32
|
nodeId: string;
|
|
31
33
|
status: NodeStatus;
|
|
@@ -33,7 +35,7 @@ export interface ServiceNodeSnapshot {
|
|
|
33
35
|
}
|
|
34
36
|
/**
|
|
35
37
|
* Runtime observability for a registered Service instance.
|
|
36
|
-
* Heartbeat and node rollups are written by the service guard, not the system registry Config.
|
|
38
|
+
* Heartbeat and node rollups are written by the service guard (scoped to this instance), not the system registry Config.
|
|
37
39
|
*/
|
|
38
40
|
export interface ServiceRuntime {
|
|
39
41
|
lastHeartBeat: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.interface.d.ts","sourceRoot":"","sources":["../../src/service/service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE1E,MAAM,WAAW,OAAQ,SAAQ,MAAM;IACnC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,cAAc,CAAC;CAC3B;AAED,oBAAY,eAAe;IACvB,OAAO,YAAY;
|
|
1
|
+
{"version":3,"file":"service.interface.d.ts","sourceRoot":"","sources":["../../src/service/service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE1E,MAAM,WAAW,OAAQ,SAAQ,MAAM;IACnC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,cAAc,CAAC;CAC3B;AAED,oBAAY,eAAe;IACvB,OAAO,YAAY;IACnB,iFAAiF;IACjF,gBAAgB,qBAAqB;CACxC;AAED,MAAM,WAAW,cAAc;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,yBAAyB;IACzB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,qFAAqF;IACrF,OAAO,CAAC,EAAE,cAAc,CAAC;CAC5B;AAED,8FAA8F;AAC9F,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,mBAAmB,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,GAAI,SAAQ,MAAM;IAC/B,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,CAAC;IACtB,OAAO,EAAE,UAAU,CAAC;CACvB;AAED,oBAAY,WAAW;IACnB,GAAG,QAAQ;CACd;AAED,oBAAY,SAAS;IACjB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,MAAM,WAAW;CACpB;AAED,MAAM,WAAW,UAAU;IACvB,MAAM,EAAE,SAAS,CAAC;IAClB,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QACL,KAAK,EAAE,eAAe,EAAE,CAAC;KAC5B,CAAC;IACF,QAAQ,EAAE;QACN,KAAK,EAAE,eAAe,EAAE,CAAC;KAC5B,CAAC;IACF,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,gBAAgB,CAAC;CAG/B"}
|
package/dist/task/task-node.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BaseNodeRuntime, type NodeLoopContext } from "../node/node-runtime
|
|
1
|
+
import { BaseNodeRuntime, type NodeLoopContext } from "../node/base-node-runtime";
|
|
2
|
+
import { NodeKind } from "../node/node.interface";
|
|
2
3
|
import { type LoggerWithScope } from "../shared/log";
|
|
3
4
|
import { type PatchClaimTaskPayload } from "./task.api";
|
|
4
5
|
/**
|
|
@@ -12,6 +13,7 @@ declare class TaskNode extends BaseNodeRuntime {
|
|
|
12
13
|
/** Optional claim filters passed to {@link patchClaimTask} (e.g. name prefix per task type). */
|
|
13
14
|
protected getPatchClaimTaskOptions(): Pick<PatchClaimTaskPayload, "namePrefixList">;
|
|
14
15
|
constructor();
|
|
16
|
+
protected getNodeKind(): NodeKind;
|
|
15
17
|
protected onBeforeRegisterNode(logger: LoggerWithScope): Promise<void>;
|
|
16
18
|
protected runLoopSteps(ctx: NodeLoopContext, heartbeatOk: boolean): Promise<void>;
|
|
17
19
|
private runAsWorker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-node.d.ts","sourceRoot":"","sources":["../../src/task/task-node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAkB,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EAA6B,KAAK,eAAe,EAAc,MAAM,eAAe,CAAC;AAE5F,OAAO,EAAE,KAAK,qBAAqB,EAAyC,MAAM,YAAY,CAAC;AAK/F;;;GAGG;AACH,cAAM,QAAS,SAAQ,eAAe;IAClC,OAAO,CAAC,kBAAkB,CAAgB;IAC1C,OAAO,CAAC,cAAc,CAAQ;IAE9B,IAAI,iBAAiB,IAAI,SAAS,MAAM,EAAE,CAEzC;IAED,gGAAgG;IAChG,SAAS,CAAC,wBAAwB,IAAI,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;;
|
|
1
|
+
{"version":3,"file":"task-node.d.ts","sourceRoot":"","sources":["../../src/task/task-node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAkB,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAA6B,KAAK,eAAe,EAAc,MAAM,eAAe,CAAC;AAE5F,OAAO,EAAE,KAAK,qBAAqB,EAAyC,MAAM,YAAY,CAAC;AAK/F;;;GAGG;AACH,cAAM,QAAS,SAAQ,eAAe;IAClC,OAAO,CAAC,kBAAkB,CAAgB;IAC1C,OAAO,CAAC,cAAc,CAAQ;IAE9B,IAAI,iBAAiB,IAAI,SAAS,MAAM,EAAE,CAEzC;IAED,gGAAgG;IAChG,SAAS,CAAC,wBAAwB,IAAI,IAAI,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;;IAQnF,SAAS,CAAC,WAAW,IAAI,QAAQ;cAIjB,oBAAoB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;cAM5D,YAAY,CAAC,GAAG,EAAE,eAAe,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;YAezE,WAAW;YA8KX,YAAY;YA2BZ,eAAe;CAqDhC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Target } from "../core.interface";
|
|
2
2
|
export declare enum CategoryTask {
|
|
3
|
-
TASK = "task"
|
|
3
|
+
TASK = "task",
|
|
4
|
+
/** Cold storage — excluded from worker claim and `category=task` scans. See task-archive skill. */
|
|
5
|
+
TASK_ARCHIVED = "task.archived"
|
|
4
6
|
}
|
|
5
7
|
export declare enum TaskStatus {
|
|
6
8
|
OPEN = "OPEN",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.interface.d.ts","sourceRoot":"","sources":["../../src/task/task.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,oBAAY,YAAY;IACpB,IAAI,SAAS;
|
|
1
|
+
{"version":3,"file":"task.interface.d.ts","sourceRoot":"","sources":["../../src/task/task.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,oBAAY,YAAY;IACpB,IAAI,SAAS;IACb,mGAAmG;IACnG,aAAa,kBAAkB;CAClC;AAED,oBAAY,UAAU;IAClB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;IACb,MAAM,WAAW;CACpB;AAED,kGAAkG;AAClG,oBAAY,gBAAgB;IACxB,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,MAAM,WAAW;CACpB;AAED,oBAAY,UAAU;IAClB,OAAO,OAAO;IAEd,mBAAmB;IACnB,gBAAgB,OAAO;IACvB,cAAc,OAAO;IAErB,kBAAkB;IAClB,OAAO,OAAO;IACd,SAAS,OAAO;IAChB,gBAAgB,OAAO;IAEvB,aAAa,OAAO;CACvB;AAED,MAAM,WAAW,IAAK,SAAQ,MAAM;IAChC,eAAe;IACf,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,cAAc;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC;IACtB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,UAAU,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,IAAI,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACL;AAGD,MAAM,WAAW,QAAS,SAAQ,MAAM;CAAG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NodeLoopContext } from "../node/node-runtime
|
|
1
|
+
import type { NodeLoopContext } from "../node/base-node-runtime";
|
|
2
2
|
import type { RegisterTriggerRunnerOptions } from "./trigger.interface";
|
|
3
3
|
export type { RegisterTriggerRunnerOptions, TriggerRunnerContext, TriggerRunnerFn } from "./trigger.interface";
|
|
4
4
|
/** In-process registry and tick loop for {@link TriggerNode}. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BaseNodeRuntime, type NodeLoopContext } from "../node/node-runtime
|
|
1
|
+
import { BaseNodeRuntime, type NodeLoopContext } from "../node/base-node-runtime";
|
|
2
|
+
import { NodeKind } from "../node/node.interface";
|
|
2
3
|
import { type LoggerWithScope, LogLevel } from "../shared/log";
|
|
3
4
|
import type { TriggerNodeOptions } from "./trigger.interface";
|
|
4
5
|
/**
|
|
@@ -14,6 +15,7 @@ declare class TriggerNode extends BaseNodeRuntime {
|
|
|
14
15
|
private readonly requireRunners;
|
|
15
16
|
private readonly loopIntervalMs;
|
|
16
17
|
constructor(options?: TriggerNodeOptions);
|
|
18
|
+
protected getNodeKind(): NodeKind;
|
|
17
19
|
protected getLoopIntervalMs(): number;
|
|
18
20
|
protected loopLoggerMinLevel(): LogLevel;
|
|
19
21
|
protected onBeforeRegisterNode(logger: LoggerWithScope): Promise<void>;
|
|
@@ -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;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
|
+
{"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,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,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,WAAW,IAAI,QAAQ;IAIjC,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"}
|
|
@@ -11,13 +11,13 @@ export declare const postTriggerSchema: z.ZodObject<{
|
|
|
11
11
|
hour: z.ZodNumber;
|
|
12
12
|
minute: z.ZodNumber;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
kind: "daily";
|
|
14
15
|
hour: number;
|
|
15
16
|
minute: number;
|
|
16
|
-
kind: "daily";
|
|
17
17
|
}, {
|
|
18
|
+
kind: "daily";
|
|
18
19
|
hour: number;
|
|
19
20
|
minute: number;
|
|
20
|
-
kind: "daily";
|
|
21
21
|
}>;
|
|
22
22
|
action: z.ZodObject<{
|
|
23
23
|
kind: z.ZodLiteral<"post_task">;
|
|
@@ -26,14 +26,14 @@ export declare const postTriggerSchema: z.ZodObject<{
|
|
|
26
26
|
taskName: z.ZodOptional<z.ZodString>;
|
|
27
27
|
taskStatus: z.ZodOptional<z.ZodEnum<[TaskStatus.OPEN, TaskStatus.TODO]>>;
|
|
28
28
|
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
taskTypeKey: string;
|
|
30
29
|
kind: "post_task";
|
|
30
|
+
taskTypeKey: string;
|
|
31
31
|
taskStatus?: TaskStatus.OPEN | TaskStatus.TODO | undefined;
|
|
32
32
|
taskParams?: unknown;
|
|
33
33
|
taskName?: string | undefined;
|
|
34
34
|
}, {
|
|
35
|
-
taskTypeKey: string;
|
|
36
35
|
kind: "post_task";
|
|
36
|
+
taskTypeKey: string;
|
|
37
37
|
taskStatus?: TaskStatus.OPEN | TaskStatus.TODO | undefined;
|
|
38
38
|
taskParams?: unknown;
|
|
39
39
|
taskName?: string | undefined;
|
|
@@ -46,32 +46,32 @@ export declare const postTriggerSchema: z.ZodObject<{
|
|
|
46
46
|
name: string;
|
|
47
47
|
tagList: string[];
|
|
48
48
|
action: {
|
|
49
|
-
taskTypeKey: string;
|
|
50
49
|
kind: "post_task";
|
|
50
|
+
taskTypeKey: string;
|
|
51
51
|
taskStatus?: TaskStatus.OPEN | TaskStatus.TODO | undefined;
|
|
52
52
|
taskParams?: unknown;
|
|
53
53
|
taskName?: string | undefined;
|
|
54
54
|
};
|
|
55
55
|
schedule: {
|
|
56
|
+
kind: "daily";
|
|
56
57
|
hour: number;
|
|
57
58
|
minute: number;
|
|
58
|
-
kind: "daily";
|
|
59
59
|
};
|
|
60
60
|
traceId?: string | undefined;
|
|
61
61
|
}, {
|
|
62
62
|
value: string;
|
|
63
63
|
name: string;
|
|
64
64
|
action: {
|
|
65
|
-
taskTypeKey: string;
|
|
66
65
|
kind: "post_task";
|
|
66
|
+
taskTypeKey: string;
|
|
67
67
|
taskStatus?: TaskStatus.OPEN | TaskStatus.TODO | undefined;
|
|
68
68
|
taskParams?: unknown;
|
|
69
69
|
taskName?: string | undefined;
|
|
70
70
|
};
|
|
71
71
|
schedule: {
|
|
72
|
+
kind: "daily";
|
|
72
73
|
hour: number;
|
|
73
74
|
minute: number;
|
|
74
|
-
kind: "daily";
|
|
75
75
|
};
|
|
76
76
|
status?: TriggerStatus | undefined;
|
|
77
77
|
tagList?: string[] | undefined;
|
|
@@ -119,16 +119,16 @@ export declare const postTrigger: (payload: {
|
|
|
119
119
|
name: string;
|
|
120
120
|
tagList: string[];
|
|
121
121
|
action: {
|
|
122
|
-
taskTypeKey: string;
|
|
123
122
|
kind: "post_task";
|
|
123
|
+
taskTypeKey: string;
|
|
124
124
|
taskStatus?: TaskStatus.OPEN | TaskStatus.TODO | undefined;
|
|
125
125
|
taskParams?: unknown;
|
|
126
126
|
taskName?: string | undefined;
|
|
127
127
|
};
|
|
128
128
|
schedule: {
|
|
129
|
+
kind: "daily";
|
|
129
130
|
hour: number;
|
|
130
131
|
minute: number;
|
|
131
|
-
kind: "daily";
|
|
132
132
|
};
|
|
133
133
|
traceId?: string | undefined;
|
|
134
134
|
}) => SupabaseResponse<Trigger> | Promise<SupabaseResponse<Trigger>>;
|
package/package.json
CHANGED
package/src/browser.ts
CHANGED
|
@@ -43,7 +43,8 @@ export type {
|
|
|
43
43
|
TaskNodeLivenessFreshest,
|
|
44
44
|
TaskNodeLivenessReport,
|
|
45
45
|
} from "./node/node-liveness";
|
|
46
|
-
export { evaluateBusyNodeLiveness } from "./node/node-liveness";
|
|
46
|
+
export { evaluateBusyNodeLiveness, nodesForTaskLiveness } from "./node/node-liveness";
|
|
47
|
+
export { requireNodeServiceIdFromEnv } from "./node/node-service-id";
|
|
47
48
|
export type { ChunkResolveProvider } from "./parcel/chunk-fetch-registry";
|
|
48
49
|
export {
|
|
49
50
|
installChunkFetchRegistry,
|
package/src/core.api.ts
CHANGED
|
@@ -566,6 +566,59 @@ export const updateTarget = async <T, D>({ id, updateFn, optimisticLockFilterLis
|
|
|
566
566
|
return data as T;
|
|
567
567
|
};
|
|
568
568
|
|
|
569
|
+
/**
|
|
570
|
+
* Update only `target.category` with optional DB-level optimistic locking on UPDATE.
|
|
571
|
+
*
|
|
572
|
+
* **Restricted use** — not a general-purpose API:
|
|
573
|
+
* - Task archival (`task` → `task.archived`) and similar cold-storage moves
|
|
574
|
+
* - One-off admin / migration tooling with explicit review
|
|
575
|
+
*
|
|
576
|
+
* Do **not** use for normal domain flows (use feature APIs + {@link updateTarget} / {@link updateTargetDetails}).
|
|
577
|
+
* Identity fields (`name`, `value`) are never writable here. Prefer locks that include the **expected
|
|
578
|
+
* current** `category` and any row predicate needed for atomicity (e.g. `details->>status`).
|
|
579
|
+
*/
|
|
580
|
+
export interface UpdateTargetCategoryParams {
|
|
581
|
+
id: string;
|
|
582
|
+
category: Target["category"];
|
|
583
|
+
optimisticLockFilterList?: QueryFilter[];
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
export const updateTargetCategory = async ({
|
|
587
|
+
id,
|
|
588
|
+
category,
|
|
589
|
+
optimisticLockFilterList = [],
|
|
590
|
+
}: UpdateTargetCategoryParams) => {
|
|
591
|
+
const updateQuery = applyQueryFilters(
|
|
592
|
+
supabase.client.from("target").update({ category }).eq("id", id),
|
|
593
|
+
optimisticLockFilterList,
|
|
594
|
+
);
|
|
595
|
+
|
|
596
|
+
const { data, error } = await updateQuery.select("id, category").maybeSingle();
|
|
597
|
+
|
|
598
|
+
if (error) {
|
|
599
|
+
handleSupabaseError("updateTargetCategory", error, "Failed to update target category.");
|
|
600
|
+
}
|
|
601
|
+
if (!data) {
|
|
602
|
+
if (optimisticLockFilterList.length === 0) {
|
|
603
|
+
throw new Error(UPDATE_TARGET_NOT_FOUND_MESSAGE);
|
|
604
|
+
}
|
|
605
|
+
const { data: stillThere, error: recheckError } = await supabase.client
|
|
606
|
+
.from("target")
|
|
607
|
+
.select("id")
|
|
608
|
+
.eq("id", id)
|
|
609
|
+
.maybeSingle();
|
|
610
|
+
if (recheckError) {
|
|
611
|
+
handleSupabaseError("updateTargetCategory", recheckError, "Failed to recheck target after lock miss.");
|
|
612
|
+
}
|
|
613
|
+
if (!stillThere) {
|
|
614
|
+
throw new Error(UPDATE_TARGET_NOT_FOUND_MESSAGE);
|
|
615
|
+
}
|
|
616
|
+
throw new Error(OPTIMISTIC_LOCK_FAILED_MESSAGE);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
return generateResponse.success(data as Pick<Target, "id" | "category">);
|
|
620
|
+
};
|
|
621
|
+
|
|
569
622
|
/**
|
|
570
623
|
* Read-modify-write `target.details` with optional DB-level optimistic locking on UPDATE.
|
|
571
624
|
*
|
|
@@ -13,8 +13,9 @@ import {
|
|
|
13
13
|
import { getErrorMessage } from "../shared/utils/error.utils";
|
|
14
14
|
import { patchChangeNodeStatus, patchNodeHeartBeat, patchStopNode, postRegisterNode } from "./node.api";
|
|
15
15
|
import { LOG_TOPIC_NODE } from "./node.constant";
|
|
16
|
-
import { NodeStatus } from "./node.interface";
|
|
16
|
+
import { type NodeKind, NodeStatus } from "./node.interface";
|
|
17
17
|
import { formatHeartbeat, getRandomInterval } from "./node.utils";
|
|
18
|
+
import { requireNodeServiceIdFromEnv } from "./node-service-id";
|
|
18
19
|
|
|
19
20
|
export { LOG_TOPIC_NODE };
|
|
20
21
|
|
|
@@ -43,6 +44,9 @@ const LOG_TOPIC_PROCESS = "process";
|
|
|
43
44
|
*/
|
|
44
45
|
abstract class BaseNodeRuntime {
|
|
45
46
|
protected static readonly HEARTBEAT_FAILURE_THRESHOLD = 3;
|
|
47
|
+
|
|
48
|
+
/** Role written to {@link Node.value} at registration. */
|
|
49
|
+
protected abstract getNodeKind(): NodeKind;
|
|
46
50
|
/** Log `nodeId` label while startup has not yet received an assigned id from Supabase. */
|
|
47
51
|
private static readonly NODE_ID_PENDING_ASSIGNMENT = "pending-node-id";
|
|
48
52
|
|
|
@@ -241,7 +245,12 @@ abstract class BaseNodeRuntime {
|
|
|
241
245
|
|
|
242
246
|
logger.debug("開始向 Supabase 註冊節點", { topic: LOG_TOPIC_NODE });
|
|
243
247
|
try {
|
|
244
|
-
const
|
|
248
|
+
const serviceId = requireNodeServiceIdFromEnv();
|
|
249
|
+
const { data, error } = await postRegisterNode({
|
|
250
|
+
serviceId,
|
|
251
|
+
kind: this.getNodeKind(),
|
|
252
|
+
traceId: this.startupTraceId,
|
|
253
|
+
});
|
|
245
254
|
if (data == null || error) {
|
|
246
255
|
throw error ?? new Error("postRegisterNode 失敗");
|
|
247
256
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Node, NodeStatus } from "./node.interface";
|
|
1
|
+
import { type Node, NodeKind, NodeStatus } from "./node.interface";
|
|
2
2
|
|
|
3
3
|
export interface TaskNodeLivenessFreshest {
|
|
4
4
|
nodeId: string;
|
|
@@ -33,6 +33,11 @@ function isBusyWithHeartbeat(node: Node): boolean {
|
|
|
33
33
|
return node.details.status === NodeStatus.BUSY && typeof node.details.lastHeartBeat === "number";
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/** Subset used for worker liveness (Guard / observability) — {@link NodeKind.TASK} only. */
|
|
37
|
+
export function nodesForTaskLiveness(nodes: readonly Node[]): Node[] {
|
|
38
|
+
return nodes.filter((node) => node.value === NodeKind.TASK);
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
/** Evaluate TaskNode liveness from a scanned node list (no I/O). */
|
|
37
42
|
export function evaluateBusyNodeLiveness(
|
|
38
43
|
nodes: Node[],
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LOG_SPOOL_SERVICE_ID_ENV } from "../shared/log/spool/config";
|
|
2
|
+
|
|
3
|
+
/** Service instance id required for {@link postRegisterNode} (same env as log spool after registry claim). */
|
|
4
|
+
export function requireNodeServiceIdFromEnv(env: NodeJS.ProcessEnv = process.env): string {
|
|
5
|
+
const serviceId = env[LOG_SPOOL_SERVICE_ID_ENV]?.trim();
|
|
6
|
+
if (serviceId == null || serviceId === "") {
|
|
7
|
+
throw new Error(
|
|
8
|
+
`[Node] ${LOG_SPOOL_SERVICE_ID_ENV} must be set before registering a node (claim the registry slot on the service host first)`,
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
return serviceId;
|
|
12
|
+
}
|
package/src/node/node.api.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { createTarget, type QueryFilter, updateTargetDetails, validateWithSchema
|
|
|
3
3
|
import { generateResponse } from "../core.interface";
|
|
4
4
|
import { createLogger } from "../shared/log";
|
|
5
5
|
import { LOG_TOPIC_NODE } from "./node.constant";
|
|
6
|
-
import { CategoryNode, type Node, type NodeDetails, NodeStatus } from "./node.interface";
|
|
6
|
+
import { CategoryNode, type Node, type NodeDetails, NodeKind, NodeStatus } from "./node.interface";
|
|
7
7
|
|
|
8
8
|
const NODE_STATUS_FIELD = "details->>status" as const;
|
|
9
9
|
|
|
@@ -13,6 +13,8 @@ const traceIdSchema = z.string().trim().min(1).optional();
|
|
|
13
13
|
// ─── Zod schemas ─────────────────────────────────────────────────────────────
|
|
14
14
|
|
|
15
15
|
export const postRegisterNodeSchema = z.object({
|
|
16
|
+
serviceId: nodeIdSchema,
|
|
17
|
+
kind: z.nativeEnum(NodeKind),
|
|
16
18
|
traceId: traceIdSchema,
|
|
17
19
|
});
|
|
18
20
|
|
|
@@ -53,9 +55,9 @@ function lockOnNodeStatus(status: NodeStatus): QueryFilter[] {
|
|
|
53
55
|
export const postRegisterNode = validateWithSchema(
|
|
54
56
|
postRegisterNodeSchema,
|
|
55
57
|
"postRegisterNodeSchema",
|
|
56
|
-
)(async (payload) => {
|
|
58
|
+
)(async ({ serviceId, kind, ...payload }) => {
|
|
57
59
|
return createTarget<Node, PostRegisterNodePayload>({
|
|
58
|
-
payload,
|
|
60
|
+
payload: { serviceId, kind, ...payload },
|
|
59
61
|
createFn: () => {
|
|
60
62
|
const details: NodeDetails = {
|
|
61
63
|
manifestVersion: 0,
|
|
@@ -63,9 +65,9 @@ export const postRegisterNode = validateWithSchema(
|
|
|
63
65
|
lastHeartBeat: Date.now(),
|
|
64
66
|
};
|
|
65
67
|
return {
|
|
66
|
-
name:
|
|
68
|
+
name: serviceId,
|
|
67
69
|
category: CategoryNode.NODE,
|
|
68
|
-
value:
|
|
70
|
+
value: kind,
|
|
69
71
|
tagList: [],
|
|
70
72
|
details,
|
|
71
73
|
};
|
|
@@ -15,12 +15,22 @@ export enum NodeStatus {
|
|
|
15
15
|
|
|
16
16
|
export enum CategoryNode {
|
|
17
17
|
NODE = "node",
|
|
18
|
+
/** Cold storage — excluded from scheduling and active node scans. */
|
|
19
|
+
NODE_ARCHIVED = "node.archived",
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Node role — stored in {@link Node.value}. */
|
|
23
|
+
export enum NodeKind {
|
|
24
|
+
TASK = "node.task",
|
|
25
|
+
TRIGGER = "node.trigger",
|
|
26
|
+
GUARD = "node.guard",
|
|
27
|
+
OTHER = "node.other",
|
|
18
28
|
}
|
|
19
29
|
|
|
20
30
|
export interface Node extends Target {
|
|
21
|
-
/**
|
|
31
|
+
/** Owning Service instance id (`postService` row id); empty when not bound to a service. */
|
|
22
32
|
name: string;
|
|
23
|
-
/**
|
|
33
|
+
/** Node role — {@link NodeKind}. */
|
|
24
34
|
value: string;
|
|
25
35
|
details: NodeDetails;
|
|
26
36
|
category: CategoryNode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { scanTargetList } from "../../core.api";
|
|
2
2
|
import { patchServiceRuntime } from "../../service/registry/registry.service";
|
|
3
3
|
import { CategoryNode, type Node } from "../node.interface";
|
|
4
|
-
import { evaluateBusyNodeLiveness } from "../node-liveness";
|
|
4
|
+
import { evaluateBusyNodeLiveness, nodesForTaskLiveness } from "../node-liveness";
|
|
5
5
|
import { applyRegistrySlotGuardStep } from "./registry-slot-guard-step";
|
|
6
6
|
import type { ServiceGuardTickInput, ServiceGuardTickResult } from "./service-guard.interface";
|
|
7
7
|
import { getWorkerSpawnCooldownLastAt, markWorkerSpawned } from "./worker-spawn-cooldown";
|
|
@@ -48,12 +48,18 @@ export async function runServiceGuardTick(input: ServiceGuardTickInput): Promise
|
|
|
48
48
|
decision = "slot_ok";
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
const nodes =
|
|
52
|
+
serviceId == null
|
|
53
|
+
? []
|
|
54
|
+
: ((
|
|
55
|
+
await scanTargetList<Node>({
|
|
56
|
+
category: CategoryNode.NODE,
|
|
57
|
+
filterList: [{ field: "name", operator: "eq", value: serviceId }],
|
|
58
|
+
maxRows: maxNodes,
|
|
59
|
+
})
|
|
60
|
+
).data ?? []);
|
|
55
61
|
|
|
56
|
-
const liveness = evaluateBusyNodeLiveness(nodes, {
|
|
62
|
+
const liveness = evaluateBusyNodeLiveness(nodesForTaskLiveness(nodes), {
|
|
57
63
|
staleMs: taskNodeStaleMs,
|
|
58
64
|
now: nowMs,
|
|
59
65
|
excludeNodeId: nodeId,
|
|
@@ -2,7 +2,8 @@ import { createLogger, type LoggerWithScope } from "../../shared/log";
|
|
|
2
2
|
import { registerCollectLogRunner } from "../../shared/log/spool/register-collect-log-runner";
|
|
3
3
|
import { getErrorMessage } from "../../shared/utils/error.utils";
|
|
4
4
|
import { TriggerNode } from "../../trigger/trigger-node";
|
|
5
|
-
import type { NodeLoopContext } from "../node-runtime
|
|
5
|
+
import type { NodeLoopContext } from "../base-node-runtime";
|
|
6
|
+
import { NodeKind } from "../node.interface";
|
|
6
7
|
import { pollUntil } from "../readiness/poll-until";
|
|
7
8
|
import { runReadinessGate } from "../readiness/run-readiness-gate";
|
|
8
9
|
import type { GuardRuntimeSlice } from "../runtime-state/service-runtime-state.types";
|
|
@@ -40,6 +41,10 @@ class ServiceGuardNode extends TriggerNode {
|
|
|
40
41
|
this.businessReadyTimeoutMs = options.businessReadyTimeoutMs ?? DEFAULT_BUSINESS_READY_TIMEOUT_MS;
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
protected getNodeKind(): NodeKind {
|
|
45
|
+
return NodeKind.GUARD;
|
|
46
|
+
}
|
|
47
|
+
|
|
43
48
|
/** Register the guard runner and return a ready-to-start node. */
|
|
44
49
|
static create(options: ServiceGuardNodeOptions): ServiceGuardNode {
|
|
45
50
|
registerServiceGuardRunner({
|
|
@@ -127,9 +127,10 @@ export function createServiceHost(options: ServiceHostOptions): ServiceHost {
|
|
|
127
127
|
await options.onRegistryClaimed(hostCtx);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
process.env[LOG_SPOOL_SERVICE_ID_ENV] = session.service.id;
|
|
131
|
+
|
|
130
132
|
const enableSpool = options.enableLogSpoolAfterClaim ?? true;
|
|
131
133
|
if (enableSpool && logSpoolEnabledFromEnv()) {
|
|
132
|
-
process.env[LOG_SPOOL_SERVICE_ID_ENV] = session.service.id;
|
|
133
134
|
await ensureLogSpoolFromEnv({
|
|
134
135
|
serviceId: session.service.id,
|
|
135
136
|
serviceValue: options.serviceValue,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ServiceRegistrySession } from "../../service/registry/registry-lifecycle";
|
|
2
2
|
import type { Service } from "../../service/service.interface";
|
|
3
3
|
import { createLogger, type LoggerWithScope } from "../../shared/log";
|
|
4
|
+
import { LOG_SPOOL_SERVICE_ID_ENV } from "../../shared/log/spool/config";
|
|
4
5
|
import { claimRegistrySlotOrExit } from "./claim-registry-slot";
|
|
5
6
|
|
|
6
7
|
export interface SingleProcessServiceContext {
|
|
@@ -37,6 +38,8 @@ export async function runSingleProcessService(options: SingleProcessServiceOptio
|
|
|
37
38
|
logTopic,
|
|
38
39
|
});
|
|
39
40
|
|
|
41
|
+
process.env[LOG_SPOOL_SERVICE_ID_ENV] = session.service.id;
|
|
42
|
+
|
|
40
43
|
try {
|
|
41
44
|
await options.run({ service: session.service, session });
|
|
42
45
|
} catch (error: unknown) {
|
package/src/node.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
export * from "./browser";
|
|
8
8
|
export * from "./command/command.api";
|
|
9
9
|
export * from "./command/command.interface";
|
|
10
|
+
export type { BaseNodeRuntimeOptions, NodeLoopContext } from "./node/base-node-runtime";
|
|
11
|
+
export { BaseNodeRuntime } from "./node/base-node-runtime";
|
|
10
12
|
export type {
|
|
11
13
|
EnvIntOptions,
|
|
12
14
|
EnvNumberOptions,
|
|
@@ -48,8 +50,6 @@ export {
|
|
|
48
50
|
nodeBufferToArrayBuffer,
|
|
49
51
|
readAndVerifySourceFile,
|
|
50
52
|
} from "./node/fs/read-source-file";
|
|
51
|
-
export type { BaseNodeRuntimeOptions, NodeLoopContext } from "./node/node-runtime.base";
|
|
52
|
-
export { BaseNodeRuntime } from "./node/node-runtime.base";
|
|
53
53
|
export type {
|
|
54
54
|
BuildNodeImportArgsInput,
|
|
55
55
|
CreateManagedChildProcessesOptions,
|
|
@@ -16,6 +16,8 @@ export interface Service extends Target {
|
|
|
16
16
|
|
|
17
17
|
export enum CategoryService {
|
|
18
18
|
SERVICE = "service",
|
|
19
|
+
/** Cold storage — excluded from registry resolution and active service scans. */
|
|
20
|
+
SERVICE_ARCHIVED = "service.archived",
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export interface ServiceDetails {
|
|
@@ -29,7 +31,7 @@ export interface ServiceDetails {
|
|
|
29
31
|
runtime?: ServiceRuntime;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
/** Per-node snapshot
|
|
34
|
+
/** Per-node snapshot for nodes owned by this Service instance (`Node.name === serviceId`). */
|
|
33
35
|
export interface ServiceNodeSnapshot {
|
|
34
36
|
nodeId: string;
|
|
35
37
|
status: NodeStatus;
|
|
@@ -38,7 +40,7 @@ export interface ServiceNodeSnapshot {
|
|
|
38
40
|
|
|
39
41
|
/**
|
|
40
42
|
* Runtime observability for a registered Service instance.
|
|
41
|
-
* Heartbeat and node rollups are written by the service guard, not the system registry Config.
|
|
43
|
+
* Heartbeat and node rollups are written by the service guard (scoped to this instance), not the system registry Config.
|
|
42
44
|
*/
|
|
43
45
|
export interface ServiceRuntime {
|
|
44
46
|
lastHeartBeat: number;
|
package/src/task/task-node.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isOptimisticLockResponse } from "../core.api";
|
|
2
|
-
import { BaseNodeRuntime, LOG_TOPIC_NODE, type NodeLoopContext } from "../node/node-runtime
|
|
2
|
+
import { BaseNodeRuntime, LOG_TOPIC_NODE, type NodeLoopContext } from "../node/base-node-runtime";
|
|
3
|
+
import { NodeKind } from "../node/node.interface";
|
|
3
4
|
import { createLogger, createScope, type LoggerWithScope, withModule } from "../shared/log";
|
|
4
5
|
import { getErrorMessage, toError } from "../shared/utils/error.utils";
|
|
5
6
|
import { type PatchClaimTaskPayload, patchChangeTaskStatus, patchClaimTask } from "./task.api";
|
|
@@ -28,6 +29,10 @@ class TaskNode extends BaseNodeRuntime {
|
|
|
28
29
|
super("taskNode");
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
protected getNodeKind(): NodeKind {
|
|
33
|
+
return NodeKind.TASK;
|
|
34
|
+
}
|
|
35
|
+
|
|
31
36
|
protected async onBeforeRegisterNode(logger: LoggerWithScope): Promise<void> {
|
|
32
37
|
const { availableTaskList, includeRemote } = await TaskManager.registerTasks({ logger });
|
|
33
38
|
this._availableTaskList = availableTaskList;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NodeLoopContext } from "../node/node-runtime
|
|
1
|
+
import type { NodeLoopContext } from "../node/base-node-runtime";
|
|
2
2
|
import { createLogger, createScope, withModule } from "../shared/log";
|
|
3
3
|
import { getErrorMessage } from "../shared/utils/error.utils";
|
|
4
4
|
import {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BaseNodeRuntime, LOG_TOPIC_NODE, type NodeLoopContext } from "../node/node-runtime
|
|
1
|
+
import { BaseNodeRuntime, LOG_TOPIC_NODE, type NodeLoopContext } from "../node/base-node-runtime";
|
|
2
|
+
import { NodeKind } from "../node/node.interface";
|
|
2
3
|
import { createLogger, createScope, type LoggerWithScope, LogLevel } from "../shared/log";
|
|
3
4
|
import { LOG_TOPIC_TRIGGER, TRIGGER_LOOP_INTERVAL_MS } from "./trigger.constant";
|
|
4
5
|
import type { TriggerNodeOptions } from "./trigger.interface";
|
|
@@ -27,6 +28,10 @@ class TriggerNode extends BaseNodeRuntime {
|
|
|
27
28
|
this.loopIntervalMs = loopIntervalMs;
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
protected getNodeKind(): NodeKind {
|
|
32
|
+
return NodeKind.TRIGGER;
|
|
33
|
+
}
|
|
34
|
+
|
|
30
35
|
protected getLoopIntervalMs(): number {
|
|
31
36
|
return this.loopIntervalMs;
|
|
32
37
|
}
|