target-supabase-sdk 0.2.24 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +3 -2
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +3 -2
- package/dist/browser.js.map +1 -1
- package/dist/chunks/{list.api-BzbTJBsM.js → config-BNxsVKR4.js} +163 -10
- package/dist/chunks/config-BNxsVKR4.js.map +1 -0
- package/dist/chunks/{enable-C7lFooTG.js → enable-CF77OsXr.js} +20 -238
- package/dist/chunks/enable-CF77OsXr.js.map +1 -0
- package/dist/chunks/{task-queue-C_nUaM2S.js → task-queue-BL-KwAGW.js} +39 -13
- package/dist/chunks/task-queue-BL-KwAGW.js.map +1 -0
- 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 +9 -2
- 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 +244 -198
- package/dist/node.js.map +1 -1
- package/dist/preload.js +3 -3
- package/dist/service/service.interface.d.ts +2 -2
- package/dist/service/service.interface.d.ts.map +1 -1
- package/dist/shared/log/core/log-batch.d.ts +4 -4
- package/dist/shared/log/core/log-batch.d.ts.map +1 -1
- package/dist/shared/log/index.d.ts +2 -1
- package/dist/shared/log/index.d.ts.map +1 -1
- package/dist/shared/log/spool/collector.d.ts +1 -1
- package/dist/shared/log/spool/collector.d.ts.map +1 -1
- package/dist/shared/log/spool/file.d.ts +2 -8
- package/dist/shared/log/spool/file.d.ts.map +1 -1
- package/dist/shared/log/spool/writer.d.ts.map +1 -1
- package/dist/shared/log/upload/flush.d.ts.map +1 -1
- package/dist/shared/log/upload/interface.d.ts +3 -11
- package/dist/shared/log/upload/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/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 +4 -3
- 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 +10 -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 +2 -2
- package/src/shared/log/README.md +2 -3
- package/src/shared/log/core/log-batch.ts +12 -10
- package/src/shared/log/index.ts +2 -1
- package/src/shared/log/spool/collector.ts +46 -20
- package/src/shared/log/spool/file.ts +12 -25
- package/src/shared/log/spool/writer.ts +2 -7
- package/src/shared/log/upload/flush.ts +23 -38
- package/src/shared/log/upload/interface.ts +3 -12
- package/src/task/task-node.ts +6 -1
- package/src/trigger/trigger-manager.ts +1 -1
- package/src/trigger/trigger-node.ts +6 -1
- package/dist/chunks/enable-C7lFooTG.js.map +0 -1
- package/dist/chunks/list.api-BzbTJBsM.js.map +0 -1
- package/dist/chunks/task-queue-C_nUaM2S.js.map +0 -1
- package/dist/node/node-runtime.base.d.ts.map +0 -1
- package/dist/shared/log/upload/batch-id.d.ts +0 -13
- package/dist/shared/log/upload/batch-id.d.ts.map +0 -1
- package/src/shared/log/upload/batch-id.ts +0 -43
package/dist/preload.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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-BNxsVKR4.js';
|
|
3
|
+
import { r as resolveProjectRootByPackageName, p as pinEnvProfileFromArgv, l as loadEnvFiles, v as validateLogSpoolPreloadEnv, a as logSpoolEnabledFromEnv, m as mergeLogSpoolExtraProcessRolesEnv } from './chunks/enable-CF77OsXr.js';
|
|
4
|
+
import 'node:crypto';
|
|
4
5
|
import 'zod';
|
|
5
6
|
import 'lodash-es';
|
|
6
7
|
import '@supabase/supabase-js';
|
|
7
8
|
import 'node:fs';
|
|
8
9
|
import 'node:url';
|
|
9
10
|
import 'node:fs/promises';
|
|
10
|
-
import 'node:crypto';
|
|
11
11
|
|
|
12
12
|
function applyServiceEnvDefaults(projectRoot, options) {
|
|
13
13
|
if (!logSpoolEnabledFromEnv()) {
|
|
@@ -25,7 +25,7 @@ export interface ServiceDetails {
|
|
|
25
25
|
/** Present on runtime instances; omitted on catalog-only rows until guard starts. */
|
|
26
26
|
runtime?: ServiceRuntime;
|
|
27
27
|
}
|
|
28
|
-
/** Per-node snapshot
|
|
28
|
+
/** Per-node snapshot for nodes owned by this Service instance (`Node.name === serviceId`). */
|
|
29
29
|
export interface ServiceNodeSnapshot {
|
|
30
30
|
nodeId: string;
|
|
31
31
|
status: NodeStatus;
|
|
@@ -33,7 +33,7 @@ export interface ServiceNodeSnapshot {
|
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Runtime observability for a registered Service instance.
|
|
36
|
-
* Heartbeat and node rollups are written by the service guard, not the system registry Config.
|
|
36
|
+
* Heartbeat and node rollups are written by the service guard (scoped to this instance), not the system registry Config.
|
|
37
37
|
*/
|
|
38
38
|
export interface ServiceRuntime {
|
|
39
39
|
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;CACtB;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,
|
|
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;A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E;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"}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* skipped rather than thrown. Mirrors the write side in `upload/flush.ts`.
|
|
5
5
|
*/
|
|
6
6
|
import type { List } from "../../../list/list.interface";
|
|
7
|
-
import type { LogEntry } from "../core/log-manager";
|
|
8
7
|
import { type LogBatchMeta, type LogPersistLane } from "../upload/interface";
|
|
8
|
+
import type { LogEntry } from "./log-manager";
|
|
9
9
|
/** A decoded log batch: origin metadata plus its raw entries. */
|
|
10
10
|
export interface DecodedLogBatch {
|
|
11
11
|
/** Source `List` row id. */
|
|
@@ -21,14 +21,14 @@ export interface FlatLogEntry extends LogEntry {
|
|
|
21
21
|
process: string;
|
|
22
22
|
lane: LogPersistLane;
|
|
23
23
|
pid: number;
|
|
24
|
-
/**
|
|
25
|
-
|
|
24
|
+
/** Source List row id. */
|
|
25
|
+
listId: string;
|
|
26
26
|
}
|
|
27
27
|
/** Parse `ListDetails.meta` (object or legacy JSON string) into typed batch meta, or null. */
|
|
28
28
|
export declare function parseLogBatchMeta(rawMeta: unknown): LogBatchMeta | null;
|
|
29
29
|
/** Structural guard for a persisted {@link LogEntry}. */
|
|
30
30
|
export declare function isLogEntry(value: unknown): value is LogEntry;
|
|
31
|
-
/** Is this List a persisted log batch (by
|
|
31
|
+
/** Is this List a persisted log batch (by `value`)? */
|
|
32
32
|
export declare function isLogBatchList(list: List): boolean;
|
|
33
33
|
/**
|
|
34
34
|
* Decode a `List` row into a {@link DecodedLogBatch}. Returns null when the row
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-batch.d.ts","sourceRoot":"","sources":["../../../../src/shared/log/core/log-batch.ts"],"names":[],"mappings":"AAAA;;;;GAIG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AAG,eAAe,EAAE,CAS5E;AAED,8EAA8E;AAC9E,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,EAAE,CAStE;AAED,0DAA0D;AAC1D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,GAAG,YAAY,EAAE,CAMrF"}
|
|
@@ -11,6 +11,7 @@ export type { ResolveLogMinLevelOptions } from "./core/log-min-level";
|
|
|
11
11
|
export { LOG_MIN_LEVEL_ENV_KEY, logMinLevelFromEnv, resolveLogMinLevel, } from "./core/log-min-level";
|
|
12
12
|
export type { CreateScopeInput, LoggerResetScopePatch, LogScope, LogScopeInput, LogScopePatch, PatchScopeInput, } from "./core/log-scope";
|
|
13
13
|
export { createScope, formatScopeLabels, normalizeScope, patchScope, resolveLogData, withModule, } from "./core/log-scope";
|
|
14
|
+
export { formatLogSpoolBatchTimestamp } from "./spool/file";
|
|
14
15
|
export type { LogBatchMeta, LogPersistLane } from "./upload/interface";
|
|
15
|
-
export {
|
|
16
|
+
export { LOG_BATCH_LIST_VALUE } from "./upload/interface";
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/log/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACR,2BAA2B,EAC3B,0BAA0B,EAC1B,iBAAiB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACH,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,iBAAiB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,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B,EAClB,kBAAkB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACR,gBAAgB,EAChB,qBAAqB,EACrB,QAAQ,EACR,aAAa,EACb,aAAa,EACb,eAAe,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACH,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,cAAc,EACd,UAAU,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAC5D,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -15,7 +15,7 @@ export interface RunCollectLogTickResult {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Guard-only: upload pending `.tmp` batches, rename to `.json`, then periodic GC.
|
|
18
|
-
*
|
|
18
|
+
* Post success is tracked via `.json` or `.synced` marker (prevents duplicate DB inserts).
|
|
19
19
|
*/
|
|
20
20
|
export declare function runCollectLogTick(input: RunCollectLogTickInput): Promise<RunCollectLogTickResult>;
|
|
21
21
|
//# sourceMappingURL=collector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../../../src/shared/log/spool/collector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../../../src/shared/log/spool/collector.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,wBAAwB,EAAyB,MAAM,UAAU,CAAC;AAYhF,MAAM,WAAW,sBAAsB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,wBAAwB,CAAC,CAAC;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CAC3B;AAqPD;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA2EvG"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import type { LogEntry } from "../core/log-manager";
|
|
2
1
|
import type { LogSpoolProcessRole } from "./interface";
|
|
3
2
|
export declare function formatLogSpoolBatchTimestamp(ms: number): string;
|
|
4
|
-
export declare function
|
|
5
|
-
serviceValue: string;
|
|
6
|
-
serviceId: string;
|
|
7
|
-
processRole: LogSpoolProcessRole;
|
|
8
|
-
entries: LogEntry[];
|
|
9
|
-
}): string;
|
|
3
|
+
export declare function randomLogSpoolShortId(): string;
|
|
10
4
|
export declare function buildLogSpoolBatchBaseName(input: {
|
|
11
5
|
processRole: LogSpoolProcessRole;
|
|
12
6
|
firstEntryTimestamp: number;
|
|
@@ -16,6 +10,6 @@ export declare function parseLogSpoolBatchFilename(filename: string): {
|
|
|
16
10
|
processRole: LogSpoolProcessRole;
|
|
17
11
|
timestampMs: number;
|
|
18
12
|
shortHash: string;
|
|
19
|
-
extension: "tmp" | "json";
|
|
13
|
+
extension: "tmp" | "json" | "synced";
|
|
20
14
|
} | null;
|
|
21
15
|
//# sourceMappingURL=file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../../src/shared/log/spool/file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../../src/shared/log/spool/file.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAKvD,wBA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AC,cAAc;YAOR,UAAU;YA2DV,aAAa;CAmC9B;AAED,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAExF;AAED,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5D;AAED,wBAAgB,sBAAsB,IAAI,mBAAmB,CAE5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flush.d.ts","sourceRoot":"","sources":["../../../../src/shared/log/upload/flush.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flush.d.ts","sourceRoot":"","sources":["../../../../src/shared/log/upload/flush.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIxE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,CAShE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,CA2B7E;AAoBD,wBAAsB,YAAY,CAAC,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB5F;AAED,0DAA0D;AAC1D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,CAyBxF"}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import type { TargetDraft } from "../../../core.interface";
|
|
2
2
|
import type { List } from "../../../list/list.interface";
|
|
3
3
|
import type { LogEntry } from "../core/log-manager";
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* (`LogTrace.0`) after rekeying by `traceId`.
|
|
8
|
-
*/
|
|
9
|
-
export declare const LOG_PERSIST_LOADER_KEY = "LogBatch.0";
|
|
10
|
-
/** Alias for {@link LOG_PERSIST_LOADER_KEY} — preferred when contrasting with LogTrace. */
|
|
11
|
-
export declare const LOG_BATCH_LOADER_KEY = "LogBatch.0";
|
|
12
|
-
/** Legacy transport metadata — fixed `"slow"` for spool uploads; required for downstream decode today. */
|
|
4
|
+
/** Discriminator on `List.value` and `details.loaderKey` — query by `value` only, not JSON loaderKey. */
|
|
5
|
+
export declare const LOG_BATCH_LIST_VALUE = "log-batch";
|
|
6
|
+
/** Legacy transport metadata — fixed `"slow"` for spool uploads. */
|
|
13
7
|
export type LogPersistLane = "fast" | "medium" | "slow";
|
|
14
8
|
export interface LogBatchMeta {
|
|
15
9
|
service: string;
|
|
@@ -20,13 +14,11 @@ export interface LogBatchMeta {
|
|
|
20
14
|
from: number | null;
|
|
21
15
|
to: number | null;
|
|
22
16
|
flushedAt: number;
|
|
23
|
-
idempotencyKey: string;
|
|
24
17
|
}
|
|
25
18
|
export interface BuildLogListDraftInput {
|
|
26
19
|
service: string;
|
|
27
20
|
process: string;
|
|
28
21
|
lane: LogPersistLane;
|
|
29
|
-
idempotencyKey: string;
|
|
30
22
|
entries: LogEntry[];
|
|
31
23
|
}
|
|
32
24
|
export type LogListDraft = TargetDraft<List>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/shared/log/upload/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/shared/log/upload/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,yGAAyG;AACzG,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAEhD,oEAAoE;AACpE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;AAExD,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC"}
|
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,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,
|
|
@@ -240,11 +241,11 @@ export {
|
|
|
240
241
|
decodeLogBatchList,
|
|
241
242
|
flattenLogBatch,
|
|
242
243
|
flattenLogBatches,
|
|
244
|
+
formatLogSpoolBatchTimestamp,
|
|
243
245
|
isLogBatchList,
|
|
244
246
|
isLogEntry,
|
|
245
|
-
|
|
247
|
+
LOG_BATCH_LIST_VALUE,
|
|
246
248
|
LOG_MIN_LEVEL_ENV_KEY,
|
|
247
|
-
LOG_PERSIST_LOADER_KEY,
|
|
248
249
|
LogLevel,
|
|
249
250
|
logManager,
|
|
250
251
|
logMinLevelFromEnv,
|
|
@@ -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
|
};
|
|
@@ -17,10 +17,18 @@ export enum CategoryNode {
|
|
|
17
17
|
NODE = "node",
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/** Node role — stored in {@link Node.value}. */
|
|
21
|
+
export enum NodeKind {
|
|
22
|
+
TASK = "node.task",
|
|
23
|
+
TRIGGER = "node.trigger",
|
|
24
|
+
GUARD = "node.guard",
|
|
25
|
+
OTHER = "node.other",
|
|
26
|
+
}
|
|
27
|
+
|
|
20
28
|
export interface Node extends Target {
|
|
21
|
-
/**
|
|
29
|
+
/** Owning Service instance id (`postService` row id); empty when not bound to a service. */
|
|
22
30
|
name: string;
|
|
23
|
-
/**
|
|
31
|
+
/** Node role — {@link NodeKind}. */
|
|
24
32
|
value: string;
|
|
25
33
|
details: NodeDetails;
|
|
26
34
|
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,
|