target-supabase-sdk 0.2.4 → 0.2.6
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 -3
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +1 -1
- package/dist/chunks/{enable-log-persist-B8rg_wXG.js → enable-log-persist-BL2FaGQp.js} +6 -3
- package/dist/chunks/enable-log-persist-BL2FaGQp.js.map +1 -0
- package/dist/chunks/{word.interface-B_fbVFOW.js → task-queue-D_7kYBx3.js} +196 -7
- package/dist/chunks/task-queue-D_7kYBx3.js.map +1 -0
- 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/runtime-state/create-service-runtime-state-store.d.ts +6 -2
- package/dist/node/runtime-state/create-service-runtime-state-store.d.ts.map +1 -1
- package/dist/node.js +164 -21
- package/dist/node.js.map +1 -1
- package/dist/preload.js +1 -1
- package/dist/service/config.api.d.ts.map +1 -1
- package/dist/service/index.d.ts +2 -2
- package/dist/service/index.d.ts.map +1 -1
- package/dist/service/registry.service.d.ts +42 -0
- package/dist/service/registry.service.d.ts.map +1 -1
- package/package.json +1 -3
- package/src/browser.ts +7 -1
- 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/runtime-state/create-service-runtime-state-store.ts +17 -17
- package/src/service/config.api.ts +1 -0
- package/src/service/index.ts +7 -0
- package/src/service/registry.service.ts +273 -0
- package/dist/chunks/enable-log-persist-B8rg_wXG.js.map +0 -1
- package/dist/chunks/word.interface-B_fbVFOW.js.map +0 -1
- package/dist/word/word.api.d.ts +0 -15
- package/dist/word/word.api.d.ts.map +0 -1
- package/dist/word/word.interface.d.ts +0 -20
- package/dist/word/word.interface.d.ts.map +0 -1
- package/src/word/word.api.ts +0 -41
- package/src/word/word.interface.ts +0 -22
package/dist/preload.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
|
-
import { r as resolveProjectRootByPackageName, p as pinEnvProfileFromArgv, l as loadEnvFiles, v as validateLogPersistPreloadEnv, a as logPersistEnabledFromEnv } from './chunks/enable-log-persist-
|
|
2
|
+
import { r as resolveProjectRootByPackageName, p as pinEnvProfileFromArgv, l as loadEnvFiles, v as validateLogPersistPreloadEnv, a as logPersistEnabledFromEnv } from './chunks/enable-log-persist-BL2FaGQp.js';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:url';
|
|
5
5
|
import 'node:fs/promises';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.api.d.ts","sourceRoot":"","sources":["../../src/service/config.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,OAAO,EAAkB,KAAK,MAAM,EAAE,KAAK,aAAa,EAA8B,MAAM,oBAAoB,CAAC;AACjH,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,qBAAqB,CAAC;AAI1E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;EAYvB,CAAC;AAEN,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE/D,wEAAwE;AACxE,eAAO,MAAM,4BAA4B;;;;;;EAEvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,eAAO,MAAM,8BAA8B;IACvC,wEAAwE;;;;;;;;;;;;;;;;;;;EAG1E,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;A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AyE;AACzE,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,aAAa,CAO7F;AAED,+EAA+E;AAC/E,eAAO,MAAM,SAAS;;;;UAaW,MAAM;;;;;;YA3GnC,CAAC;;;;;;;;;YAAD,CAAC;;;UA2G4B,MAAM;;;;;;YA3GnC,CAAC;;;;;;;;;YAAD,CAAC;;EA8HH,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;4FAsBnC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;;;;;4FA2CpC,CAAC"}
|
package/dist/service/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export type { GetConfigPayload, PostSystemRegistryConfigPayload, ResetSystemRegi
|
|
|
7
7
|
export { buildEmptyServiceSlots, buildSystemRegistryConfigDetails, DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS, getConfig, getConfigSchema, postSystemRegistryConfig, postSystemRegistryConfigSchema, resetSystemRegistryConfig, resetSystemRegistryConfigSchema, systemRegistrySeedSlotSchema, } from "./config.api";
|
|
8
8
|
export type { Config, ConfigDetails } from "./config.interface";
|
|
9
9
|
export { CategoryConfig, TARGET_SYSTEM_REGISTRY_KEY } from "./config.interface";
|
|
10
|
-
export type { PatchServiceRuntimeInput, RegisterServiceInput, TargetSystemRegistrySlotView, TargetSystemRegistryView, } from "./registry.service";
|
|
11
|
-
export { assertRegistrySlotAvailable, assertRegistrySlotOwner, getTargetSystemRegistry, parseServiceSlot, parseServiceSlots, patchServiceRuntime, registerService, registerServiceAtStartup, resolveActiveRegistryServiceId, ServiceRegistryError, unregisterService, unregisterServiceAtShutdown, } from "./registry.service";
|
|
10
|
+
export type { AppendSystemRegistrySlotsInput, AppendSystemRegistrySlotsOutcome, PatchServiceRuntimeInput, RegisterServiceInput, ReleasedRegistrySlot, ReleaseSystemRegistrySlotsInput, ReleaseSystemRegistrySlotsOutcome, TargetSystemRegistrySlotView, TargetSystemRegistryView, } from "./registry.service";
|
|
11
|
+
export { appendSystemRegistrySlots, assertRegistrySlotAvailable, assertRegistrySlotOwner, getTargetSystemRegistry, parseServiceSlot, parseServiceSlots, patchServiceRuntime, registerService, registerServiceAtStartup, releaseSystemRegistrySlots, resolveActiveRegistryServiceId, ServiceRegistryError, unregisterService, unregisterServiceAtShutdown, } from "./registry.service";
|
|
12
12
|
export type { ClaimRegistrySlotInput, RegistrySlotGuardResult, RegistrySlotRuntimeState, ServiceRegistrySession, } from "./registry-lifecycle";
|
|
13
13
|
export { claimServiceRegistrySlot, createClaimedRegistrySlotRuntimeState, EMPTY_REGISTRY_SLOT_RUNTIME_STATE, registrySlotRuntimePatchFromGuardResult, runRegistrySlotGuardCheck, } from "./registry-lifecycle";
|
|
14
14
|
export type { GetApiPayload, GetServicePayload, PostApiPayload, PostServicePayload } from "./service.api";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACR,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,YAAY,EACR,gBAAgB,EAChB,+BAA+B,EAC/B,gCAAgC,EAChC,sBAAsB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACH,sBAAsB,EACtB,gCAAgC,EAChC,kCAAkC,EAClC,SAAS,EACT,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,yBAAyB,EACzB,+BAA+B,EAC/B,4BAA4B,GAC/B,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChF,YAAY,EACR,wBAAwB,EACxB,oBAAoB,EACpB,4BAA4B,EAC5B,wBAAwB,GAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,2BAA2B,EAC3B,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,oBAAoB,EACpB,iBAAiB,EACjB,2BAA2B,GAC9B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACR,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACH,wBAAwB,EACxB,qCAAqC,EACrC,iCAAiC,EACjC,uCAAuC,EACvC,yBAAyB,GAC5B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC1G,OAAO,EACH,gBAAgB,EAChB,qBAAqB,EACrB,MAAM,EACN,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,oBAAoB,GACvB,MAAM,eAAe,CAAC;AACvB,YAAY,EACR,GAAG,EACH,UAAU,EACV,OAAO,EACP,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,WAAW,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACjG,YAAY,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EACH,4BAA4B,EAC5B,uBAAuB,EACvB,mBAAmB,GACtB,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAAA;;GAEG;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E,MAAM,eAAe,CAAC;AAC1G,OAAO,EACH,gBAAgB,EAChB,qBAAqB,EACrB,MAAM,EACN,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,oBAAoB,GACvB,MAAM,eAAe,CAAC;AACvB,YAAY,EACR,GAAG,EACH,UAAU,EACV,OAAO,EACP,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,WAAW,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACjG,YAAY,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EACH,4BAA4B,EAC5B,uBAAuB,EACvB,mBAAmB,GACtB,MAAM,qBAAqB,CAAC"}
|
|
@@ -27,6 +27,36 @@ export interface RegisterServiceInput {
|
|
|
27
27
|
traceId?: string;
|
|
28
28
|
maxAttempts?: number;
|
|
29
29
|
}
|
|
30
|
+
export interface ReleaseSystemRegistrySlotsInput {
|
|
31
|
+
/** Logical service keys whose ACTIVE slots should be forced to EMPTY (e.g. `watch-service`). */
|
|
32
|
+
serviceValues: string[];
|
|
33
|
+
traceId?: string;
|
|
34
|
+
maxAttempts?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface ReleasedRegistrySlot {
|
|
37
|
+
serviceValue: string;
|
|
38
|
+
serviceId: string;
|
|
39
|
+
slotIndex: number;
|
|
40
|
+
}
|
|
41
|
+
export interface ReleaseSystemRegistrySlotsOutcome {
|
|
42
|
+
config: Config;
|
|
43
|
+
released: ReleasedRegistrySlot[];
|
|
44
|
+
/** Requested `serviceValues` with no ACTIVE slot released (already EMPTY or never bound). */
|
|
45
|
+
unchangedServiceValues: string[];
|
|
46
|
+
}
|
|
47
|
+
export interface AppendSystemRegistrySlotsInput {
|
|
48
|
+
/** Logical service keys to declare with one new EMPTY slot each when missing. */
|
|
49
|
+
serviceValues: string[];
|
|
50
|
+
traceId?: string;
|
|
51
|
+
maxAttempts?: number;
|
|
52
|
+
}
|
|
53
|
+
export interface AppendSystemRegistrySlotsOutcome {
|
|
54
|
+
config: Config;
|
|
55
|
+
/** Service keys that received a new EMPTY slot this run. */
|
|
56
|
+
added: string[];
|
|
57
|
+
/** Requested keys that already had at least one declared slot — no change. */
|
|
58
|
+
skipped: string[];
|
|
59
|
+
}
|
|
30
60
|
export declare class ServiceRegistryError extends Error {
|
|
31
61
|
readonly code: "REGISTRY_CONFIG_NOT_FOUND" | "SERVICE_NOT_DECLARED" | "SERVICE_SLOTS_FULL" | "REGISTRY_SLOT_LOST" | "REGISTRY_UPDATE_FAILED";
|
|
32
62
|
constructor(message: string, code: "REGISTRY_CONFIG_NOT_FOUND" | "SERVICE_NOT_DECLARED" | "SERVICE_SLOTS_FULL" | "REGISTRY_SLOT_LOST" | "REGISTRY_UPDATE_FAILED");
|
|
@@ -53,6 +83,18 @@ export declare function assertRegistrySlotOwner(input: {
|
|
|
53
83
|
serviceValue: string;
|
|
54
84
|
serviceId: string;
|
|
55
85
|
}): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Force-release ACTIVE registry slots for the given logical service keys (`ACTIVE → EMPTY`).
|
|
88
|
+
* Ops/dev recovery when a process crashed without {@link unregisterService}.
|
|
89
|
+
* Does not delete Service rows or mutate `details.runtime`.
|
|
90
|
+
*/
|
|
91
|
+
export declare function releaseSystemRegistrySlots(input: ReleaseSystemRegistrySlotsInput): Promise<ReleaseSystemRegistrySlotsOutcome>;
|
|
92
|
+
/**
|
|
93
|
+
* Append EMPTY {@link ServiceSlot} rows for logical service keys not yet declared.
|
|
94
|
+
* Idempotent — skips keys that already appear in `details.objects`.
|
|
95
|
+
* Does not modify existing slots or release ACTIVE bindings.
|
|
96
|
+
*/
|
|
97
|
+
export declare function appendSystemRegistrySlots(input: AppendSystemRegistrySlotsInput): Promise<AppendSystemRegistrySlotsOutcome>;
|
|
56
98
|
/**
|
|
57
99
|
* Claim one EMPTY slot for a running Service instance (`EMPTY → ACTIVE` only).
|
|
58
100
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.service.d.ts","sourceRoot":"","sources":["../../src/service/registry.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAGnD,OAAO,EAAE,KAAK,MAAM,EAAkD,MAAM,oBAAoB,CAAC;AAEjG,OAAO,EACH,KAAK,OAAO,EAGZ,KAAK,WAAW,EAEnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAUhE,MAAM,WAAW,4BAA4B;IACzC,IAAI,EAAE,WAAW,CAAC;IAClB,mEAAmE;IACnE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,4BAA4B,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,oBAAoB;IACjC,2DAA2D;IAC3D,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAGvC,QAAQ,CAAC,IAAI,EACP,2BAA2B,GAC3B,sBAAsB,GACtB,oBAAoB,GACpB,oBAAoB,GACpB,wBAAwB;gBAN9B,OAAO,EAAE,MAAM,EACN,IAAI,EACP,2BAA2B,GAC3B,sBAAsB,GACtB,oBAAoB,GACpB,oBAAoB,GACpB,wBAAwB;CAKrC;AAcD,iFAAiF;AACjF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CA2BnE;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{
|
|
2
2
|
"name": "target-supabase-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Supabase client initializer and data access APIs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "KyLoc20",
|
|
@@ -56,8 +56,6 @@
|
|
|
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",
|
|
61
59
|
"parcel:split": "tsx scripts/parcel-split-local.ts",
|
|
62
60
|
"parcel:restore": "tsx scripts/parcel-restore-local.ts",
|
|
63
61
|
"dev": "rollup -c --watch",
|
package/src/browser.ts
CHANGED
|
@@ -104,6 +104,8 @@ export * from "./repo/repo.interface";
|
|
|
104
104
|
export type {
|
|
105
105
|
Api,
|
|
106
106
|
ApiDetails,
|
|
107
|
+
AppendSystemRegistrySlotsInput,
|
|
108
|
+
AppendSystemRegistrySlotsOutcome,
|
|
107
109
|
ClaimRegistrySlotInput,
|
|
108
110
|
Config,
|
|
109
111
|
ConfigDetails,
|
|
@@ -118,6 +120,9 @@ export type {
|
|
|
118
120
|
RegisterServiceInput,
|
|
119
121
|
RegistrySlotGuardResult,
|
|
120
122
|
RegistrySlotRuntimeState,
|
|
123
|
+
ReleasedRegistrySlot,
|
|
124
|
+
ReleaseSystemRegistrySlotsInput,
|
|
125
|
+
ReleaseSystemRegistrySlotsOutcome,
|
|
121
126
|
ResetSystemRegistryConfigPayload,
|
|
122
127
|
Service,
|
|
123
128
|
ServiceBootstrapResult,
|
|
@@ -133,6 +138,7 @@ export type {
|
|
|
133
138
|
export {
|
|
134
139
|
ApiMethod,
|
|
135
140
|
apiDetailsSchema,
|
|
141
|
+
appendSystemRegistrySlots,
|
|
136
142
|
assertRegistrySlotAvailable,
|
|
137
143
|
assertRegistrySlotOwner,
|
|
138
144
|
buildEmptyServiceSlots,
|
|
@@ -166,6 +172,7 @@ export {
|
|
|
166
172
|
registerService,
|
|
167
173
|
registerServiceAtStartup,
|
|
168
174
|
registrySlotRuntimePatchFromGuardResult,
|
|
175
|
+
releaseSystemRegistrySlots,
|
|
169
176
|
resetSystemRegistryConfig,
|
|
170
177
|
resetSystemRegistryConfigSchema,
|
|
171
178
|
resolveActiveRegistryServiceId,
|
|
@@ -256,4 +263,3 @@ export type { PostTaskWithRetryOptions, PostTaskWithRetryResult } from "./task/t
|
|
|
256
263
|
export { POST_TASK_DEFAULT_MAX_ATTEMPTS, postTaskWithRetry } from "./task/task-post-retry.api";
|
|
257
264
|
export type { TaskStatusCount } from "./task/task-queue";
|
|
258
265
|
export { countTasksByType, summarizeTaskQueue } from "./task/task-queue";
|
|
259
|
-
export * from "./word/word.interface";
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { mkdir, readFile, stat, unlink } from "node:fs/promises";
|
|
2
|
+
import { createJsonFileStateStore, type JsonStatePatch } from "./json-state-store";
|
|
3
|
+
import { resolveRuntimeStatePaths, runtimeStateShardPath } from "./runtime-state-path";
|
|
4
|
+
|
|
5
|
+
export interface CreateShardedJsonFileStateStoreOptions<T extends object, NK extends keyof T> {
|
|
6
|
+
/** Monolithic legacy path or shard directory root (see {@link resolveRuntimeStatePaths}). */
|
|
7
|
+
filePath: string;
|
|
8
|
+
defaultState: T;
|
|
9
|
+
/** Top-level keys persisted as separate shard files. */
|
|
10
|
+
nestedKeys: NK[];
|
|
11
|
+
updatedAtKey?: keyof T;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
15
|
+
return value != null && typeof value === "object" && !Array.isArray(value);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function mergeSlice<T extends object>(defaults: T, key: keyof T, patchValue: unknown): T[keyof T] {
|
|
19
|
+
const base = defaults[key];
|
|
20
|
+
if (isPlainObject(base) && isPlainObject(patchValue)) {
|
|
21
|
+
return { ...base, ...patchValue } as T[keyof T];
|
|
22
|
+
}
|
|
23
|
+
return patchValue as T[keyof T];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* JSON runtime state with **one file per top-level slice** (log-persist registry pattern).
|
|
28
|
+
* Eliminates cross-slice lost updates when guard/scheduler/worker write concurrently.
|
|
29
|
+
*/
|
|
30
|
+
export function createShardedJsonFileStateStore<T extends object, NK extends keyof T>(
|
|
31
|
+
options: CreateShardedJsonFileStateStoreOptions<T, NK>,
|
|
32
|
+
): {
|
|
33
|
+
read(): Promise<T>;
|
|
34
|
+
write(patch: JsonStatePatch<T, NK>): Promise<T>;
|
|
35
|
+
reset(): Promise<T>;
|
|
36
|
+
} {
|
|
37
|
+
const { defaultState, nestedKeys, updatedAtKey } = options;
|
|
38
|
+
const { stateDir, legacyFilePath } = resolveRuntimeStatePaths(options.filePath);
|
|
39
|
+
|
|
40
|
+
type ShardStore = ReturnType<typeof createJsonFileStateStore<object>>;
|
|
41
|
+
const shardStores = new Map<string, ShardStore>();
|
|
42
|
+
|
|
43
|
+
function shardStore(sliceKey: NK): ShardStore {
|
|
44
|
+
const key = String(sliceKey);
|
|
45
|
+
let store = shardStores.get(key);
|
|
46
|
+
if (store == null) {
|
|
47
|
+
store = createJsonFileStateStore({
|
|
48
|
+
filePath: runtimeStateShardPath(stateDir, key),
|
|
49
|
+
defaultState: defaultState[sliceKey] as object,
|
|
50
|
+
});
|
|
51
|
+
shardStores.set(key, store);
|
|
52
|
+
}
|
|
53
|
+
return store;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function readUpdatedAtFromShardMtimes(): Promise<string> {
|
|
57
|
+
let maxMtimeMs = 0;
|
|
58
|
+
for (const sliceKey of nestedKeys) {
|
|
59
|
+
try {
|
|
60
|
+
const shardStat = await stat(runtimeStateShardPath(stateDir, String(sliceKey)));
|
|
61
|
+
maxMtimeMs = Math.max(maxMtimeMs, shardStat.mtimeMs);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
if ((error as NodeJS.ErrnoException).code !== "ENOENT") {
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (maxMtimeMs <= 0) {
|
|
69
|
+
return defaultState[updatedAtKey as keyof T] as string;
|
|
70
|
+
}
|
|
71
|
+
return new Date(maxMtimeMs).toISOString();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function migrateLegacyMonolithicIfPresent(): Promise<void> {
|
|
75
|
+
if (legacyFilePath == null) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let raw: string;
|
|
80
|
+
try {
|
|
81
|
+
raw = await readFile(legacyFilePath, "utf8");
|
|
82
|
+
} catch (error) {
|
|
83
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
let parsed: Partial<T>;
|
|
90
|
+
try {
|
|
91
|
+
parsed = JSON.parse(raw) as Partial<T>;
|
|
92
|
+
} catch {
|
|
93
|
+
await unlink(legacyFilePath).catch(() => undefined);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
await mkdir(stateDir, { recursive: true });
|
|
98
|
+
for (const sliceKey of nestedKeys) {
|
|
99
|
+
const slice = parsed[sliceKey];
|
|
100
|
+
if (slice != null) {
|
|
101
|
+
await shardStore(sliceKey).write(slice as object);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
await unlink(legacyFilePath).catch(() => undefined);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
async read(): Promise<T> {
|
|
110
|
+
await mkdir(stateDir, { recursive: true });
|
|
111
|
+
await migrateLegacyMonolithicIfPresent();
|
|
112
|
+
|
|
113
|
+
const merged = { ...defaultState } as T;
|
|
114
|
+
for (const sliceKey of nestedKeys) {
|
|
115
|
+
merged[sliceKey] = (await shardStore(sliceKey).read()) as T[NK];
|
|
116
|
+
}
|
|
117
|
+
if (updatedAtKey != null) {
|
|
118
|
+
merged[updatedAtKey] = (await readUpdatedAtFromShardMtimes()) as T[keyof T];
|
|
119
|
+
}
|
|
120
|
+
return merged;
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
async write(patch: JsonStatePatch<T, NK>): Promise<T> {
|
|
124
|
+
await mkdir(stateDir, { recursive: true });
|
|
125
|
+
await migrateLegacyMonolithicIfPresent();
|
|
126
|
+
|
|
127
|
+
for (const sliceKey of nestedKeys) {
|
|
128
|
+
const patchSlice = patch[sliceKey];
|
|
129
|
+
if (patchSlice == null) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const current = await shardStore(sliceKey).read();
|
|
133
|
+
const nextSlice = mergeSlice(defaultState, sliceKey, {
|
|
134
|
+
...(current as object),
|
|
135
|
+
...(patchSlice as object),
|
|
136
|
+
});
|
|
137
|
+
await shardStore(sliceKey).write(nextSlice as object);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return this.read();
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
async reset(): Promise<T> {
|
|
144
|
+
await mkdir(stateDir, { recursive: true });
|
|
145
|
+
|
|
146
|
+
for (const sliceKey of nestedKeys) {
|
|
147
|
+
await shardStore(sliceKey).reset();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (legacyFilePath != null) {
|
|
151
|
+
await unlink(legacyFilePath).catch(() => undefined);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return this.read();
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EMPTY_REGISTRY_SLOT_RUNTIME_STATE } from "../../service/registry-lifecycle";
|
|
2
|
-
import
|
|
2
|
+
import type { JsonStatePatch } from "../fs/json-state-store";
|
|
3
|
+
import { createShardedJsonFileStateStore } from "../fs/sharded-json-state-store";
|
|
3
4
|
import type {
|
|
4
5
|
DefaultExtraRuntimeSlices,
|
|
5
6
|
GuardRuntimeSlice,
|
|
@@ -16,6 +17,10 @@ const EPOCH_ISO = new Date(0).toISOString();
|
|
|
16
17
|
export interface CreateServiceRuntimeStateStoreOptions<
|
|
17
18
|
TExtraSlices extends Record<string, object> = DefaultExtraRuntimeSlices,
|
|
18
19
|
> {
|
|
20
|
+
/**
|
|
21
|
+
* Monolithic legacy path (`…/state.json`) or shard directory (`…/runtime-state/`).
|
|
22
|
+
* Legacy files migrate automatically to `dirname/state.json → runtime-state/*.json`.
|
|
23
|
+
*/
|
|
19
24
|
filePath: string;
|
|
20
25
|
/** Default values for service-specific top-level nested slices. */
|
|
21
26
|
extraDefaults?: TExtraSlices;
|
|
@@ -78,7 +83,7 @@ function createDefaultServiceRuntimeState<TExtraSlices extends Record<string, ob
|
|
|
78
83
|
};
|
|
79
84
|
}
|
|
80
85
|
|
|
81
|
-
/** JSON
|
|
86
|
+
/** Sharded JSON runtime state (L3 blueprint) — one file per slice under `runtime-state/`. */
|
|
82
87
|
export function createServiceRuntimeStateStore<TExtraSlices extends Record<string, object> = DefaultExtraRuntimeSlices>(
|
|
83
88
|
options: CreateServiceRuntimeStateStoreOptions<TExtraSlices>,
|
|
84
89
|
): ServiceRuntimeStateStore<TExtraSlices> {
|
|
@@ -95,24 +100,19 @@ export function createServiceRuntimeStateStore<TExtraSlices extends Record<strin
|
|
|
95
100
|
...(Object.keys(options.extraDefaults ?? {}) as (keyof TExtraSlices & string)[]),
|
|
96
101
|
] as NK[];
|
|
97
102
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
nestedKeys,
|
|
105
|
-
updatedAtKey: "updatedAt",
|
|
106
|
-
});
|
|
107
|
-
return store;
|
|
108
|
-
}
|
|
103
|
+
const store = createShardedJsonFileStateStore<State, NK>({
|
|
104
|
+
filePath: options.filePath,
|
|
105
|
+
defaultState,
|
|
106
|
+
nestedKeys,
|
|
107
|
+
updatedAtKey: "updatedAt",
|
|
108
|
+
});
|
|
109
109
|
|
|
110
110
|
return {
|
|
111
|
-
readRuntimeState: () =>
|
|
112
|
-
writeRuntimeState: (patch) =>
|
|
113
|
-
resetRuntimeStateForStartup: () =>
|
|
111
|
+
readRuntimeState: () => store.read(),
|
|
112
|
+
writeRuntimeState: (patch) => store.write(patch),
|
|
113
|
+
resetRuntimeStateForStartup: () => store.reset(),
|
|
114
114
|
finishRunnerTick: async ({ nowMs, lastFired, postedCount, extra }) => {
|
|
115
|
-
await
|
|
115
|
+
await store.write({
|
|
116
116
|
scheduler: {
|
|
117
117
|
lastTickAt: new Date(nowMs).toISOString(),
|
|
118
118
|
lastFired,
|
|
@@ -59,6 +59,7 @@ export const DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS: readonly SystemRegistrySeedSlot
|
|
|
59
59
|
{ serviceValue: "watch-service" },
|
|
60
60
|
{ serviceValue: "download-service" },
|
|
61
61
|
{ serviceValue: "storage-service" },
|
|
62
|
+
{ serviceValue: "gc-service" },
|
|
62
63
|
] as const;
|
|
63
64
|
|
|
64
65
|
const configCategoryFilter: QueryFilter = {
|
package/src/service/index.ts
CHANGED
|
@@ -30,12 +30,18 @@ export {
|
|
|
30
30
|
export type { Config, ConfigDetails } from "./config.interface";
|
|
31
31
|
export { CategoryConfig, TARGET_SYSTEM_REGISTRY_KEY } from "./config.interface";
|
|
32
32
|
export type {
|
|
33
|
+
AppendSystemRegistrySlotsInput,
|
|
34
|
+
AppendSystemRegistrySlotsOutcome,
|
|
33
35
|
PatchServiceRuntimeInput,
|
|
34
36
|
RegisterServiceInput,
|
|
37
|
+
ReleasedRegistrySlot,
|
|
38
|
+
ReleaseSystemRegistrySlotsInput,
|
|
39
|
+
ReleaseSystemRegistrySlotsOutcome,
|
|
35
40
|
TargetSystemRegistrySlotView,
|
|
36
41
|
TargetSystemRegistryView,
|
|
37
42
|
} from "./registry.service";
|
|
38
43
|
export {
|
|
44
|
+
appendSystemRegistrySlots,
|
|
39
45
|
assertRegistrySlotAvailable,
|
|
40
46
|
assertRegistrySlotOwner,
|
|
41
47
|
getTargetSystemRegistry,
|
|
@@ -44,6 +50,7 @@ export {
|
|
|
44
50
|
patchServiceRuntime,
|
|
45
51
|
registerService,
|
|
46
52
|
registerServiceAtStartup,
|
|
53
|
+
releaseSystemRegistrySlots,
|
|
47
54
|
resolveActiveRegistryServiceId,
|
|
48
55
|
ServiceRegistryError,
|
|
49
56
|
unregisterService,
|