@xlinklight/testkit 0.0.0-stage → 7.0.0-rc.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/LICENSE +21 -0
- package/README.md +169 -3
- package/content/platform-baseline.sql +273 -0
- package/package.json +274 -3
- package/src/acceptance-oracle.d.mts +24 -0
- package/src/acceptance-oracle.mjs +79 -0
- package/src/architecture-database.d.mts +36 -0
- package/src/architecture-database.mjs +64 -0
- package/src/artifact-build.d.mts +3 -0
- package/src/artifact-build.mjs +35 -0
- package/src/artifact-declarations.mjs +24 -0
- package/src/artifact-graphs.mjs +61 -0
- package/src/artifact-lock.mjs +32 -0
- package/src/artifact-observation.mjs +50 -0
- package/src/artifact-publisher.d.mts +30 -0
- package/src/artifact-publisher.mjs +84 -0
- package/src/browser-lifecycle.mjs +45 -0
- package/src/browser-operation-owner.mjs +28 -0
- package/src/cloudflare-browser.d.mts +14 -0
- package/src/cloudflare-browser.mjs +41 -0
- package/src/cloudflare-build.d.mts +19 -0
- package/src/cloudflare-build.mjs +61 -0
- package/src/cloudflare-http.d.mts +5 -0
- package/src/cloudflare-http.mjs +65 -0
- package/src/cloudflare-pages.d.mts +34 -0
- package/src/cloudflare-pages.mjs +170 -0
- package/src/cloudflare-provider-http.d.mts +8 -0
- package/src/cloudflare-provider-http.mjs +32 -0
- package/src/cloudflare-worker-package.d.mts +6 -0
- package/src/cloudflare-worker-package.mjs +24 -0
- package/src/cloudflare-worker-qualification.d.mts +4 -0
- package/src/cloudflare-worker-qualification.mjs +63 -0
- package/src/cloudflare-workers.d.mts +37 -0
- package/src/cloudflare-workers.mjs +90 -0
- package/src/cluster-directory.d.mts +16 -0
- package/src/cluster-directory.mjs +90 -0
- package/src/core-publishing.d.mts +75 -0
- package/src/core-publishing.mjs +214 -0
- package/src/dev-command-runner.mjs +97 -0
- package/src/fixture-path.mjs +19 -0
- package/src/function-admission.d.mts +1 -0
- package/src/function-admission.mjs +58 -0
- package/src/host-artifact.mjs +32 -0
- package/src/host-stop.mjs +15 -0
- package/src/independent-artifact-qualification.mjs +67 -0
- package/src/independent-runtime-qualification.mjs +647 -0
- package/src/isolated-browser-child.mjs +29 -0
- package/src/isolated-browser.mjs +69 -0
- package/src/lifecycle-trace.mjs +32 -0
- package/src/managed-native-fixture.d.mts +84 -0
- package/src/managed-native-fixture.mjs +209 -0
- package/src/native-fixture.mjs +125 -0
- package/src/native-platform.mjs +56 -0
- package/src/operator-accounts.mjs +103 -0
- package/src/operator-vault.d.mts +2 -0
- package/src/operator-vault.mjs +9 -0
- package/src/owned-process.mjs +75 -0
- package/src/owner-build-cli.d.mts +1 -0
- package/src/owner-build-cli.mjs +31 -0
- package/src/owner-database.mjs +215 -0
- package/src/owner-operator-build.d.mts +1 -0
- package/src/owner-operator-build.mjs +33 -0
- package/src/owner-package-build.d.mts +2 -0
- package/src/owner-package-build.mjs +29 -0
- package/src/owner-production-browser.mjs +215 -0
- package/src/owner-production-instances.mjs +41 -0
- package/src/owner-production.d.mts +104 -0
- package/src/owner-production.mjs +338 -0
- package/src/owner-release.mjs +41 -0
- package/src/owner-worker-build.d.mts +3 -0
- package/src/owner-worker-build.mjs +83 -0
- package/src/prebuilt-build.d.mts +8 -0
- package/src/prebuilt-build.mjs +69 -0
- package/src/prebuilt-output.d.mts +2 -0
- package/src/prebuilt-output.mjs +104 -0
- package/src/production-hosts.mjs +38 -0
- package/src/publisher-acceptance-host-cli.mjs +23 -0
- package/src/publisher-acceptance-owner.mjs +116 -0
- package/src/publisher-acceptance-runner.mjs +250 -0
- package/src/publisher-acceptance-service.mjs +49 -0
- package/src/publisher-acceptance.d.mts +61 -0
- package/src/publisher-acceptance.mjs +3 -0
- package/src/publishing-source.d.mts +11 -0
- package/src/publishing-source.mjs +32 -0
- package/src/qualification-function-host.mjs +26 -0
- package/src/qualification-route-owner.mjs +64 -0
- package/src/qualification-transport.mjs +18 -0
- package/src/registry-core-selection.mjs +41 -0
- package/src/release-artifact.d.mts +17 -0
- package/src/release-artifact.mjs +113 -0
- package/src/release-build.d.mts +12 -0
- package/src/release-build.mjs +71 -0
- package/src/release-cli.d.mts +27 -0
- package/src/release-cli.mjs +79 -0
- package/src/release-control.mjs +45 -0
- package/src/release-coordinator.d.mts +9 -0
- package/src/release-coordinator.mjs +222 -0
- package/src/release-credentials.d.mts +8 -0
- package/src/release-credentials.mjs +97 -0
- package/src/release-environment.mjs +60 -0
- package/src/release-mutex.d.mts +10 -0
- package/src/release-mutex.mjs +38 -0
- package/src/release-operator.d.mts +6 -0
- package/src/release-operator.mjs +59 -0
- package/src/release-supabase.d.mts +7 -0
- package/src/release-supabase.mjs +37 -0
- package/src/release-vercel.d.mts +22 -0
- package/src/release-vercel.mjs +51 -0
- package/src/release-writer.d.mts +6 -0
- package/src/release-writer.mjs +172 -0
- package/src/retained-postgres-shutdown.d.mts +51 -0
- package/src/retained-postgres-shutdown.mjs +262 -0
- package/src/schema-snapshot.mjs +51 -0
- package/src/static-ui-artifact.mjs +54 -0
- package/src/static-ui-routes.mjs +3 -0
- package/src/temporary-acquisition.mjs +62 -0
- package/src/temporary-scope.d.mts +47 -0
- package/src/temporary-scope.mjs +268 -0
- package/src/unscoped-read.mjs +14 -0
- package/src/worker-artifact.mjs +214 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { lstat, readFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
const NORMAL_SHUTDOWN_LIMIT_MS = 60000;
|
|
6
|
+
|
|
7
|
+
function failure(code, message, cause) {
|
|
8
|
+
return Object.assign(new Error(message, cause === undefined ? undefined : { cause }), { code });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function validateOptions({ dataDirectory, pgCtl, terminationGraceMs = NORMAL_SHUTDOWN_LIMIT_MS }) {
|
|
12
|
+
if (!path.isAbsolute(dataDirectory ?? "") || !path.isAbsolute(pgCtl ?? "")) {
|
|
13
|
+
throw failure("PG_SHUTDOWN_PATH_REJECTED", "PostgreSQL shutdown requires absolute owned data and pg_ctl paths");
|
|
14
|
+
}
|
|
15
|
+
if (!Number.isInteger(terminationGraceMs) || terminationGraceMs < 1 || terminationGraceMs > NORMAL_SHUTDOWN_LIMIT_MS) {
|
|
16
|
+
throw failure("PG_SHUTDOWN_BOUND_REJECTED", "PostgreSQL termination grace must be 1..60000 ms");
|
|
17
|
+
}
|
|
18
|
+
return { dataDirectory: path.resolve(dataDirectory), pgCtl, terminationGraceMs };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function observeChild(child, state, onError = () => {}) {
|
|
22
|
+
let resolve;
|
|
23
|
+
const completion = new Promise(done => { resolve = done; });
|
|
24
|
+
function closed(code, signal) {
|
|
25
|
+
if (state.closed) return;
|
|
26
|
+
state.closed = true;
|
|
27
|
+
state.exitCode = code;
|
|
28
|
+
state.signalCode = signal ?? null;
|
|
29
|
+
resolve(state);
|
|
30
|
+
}
|
|
31
|
+
child.once("error", error => { onError(error); state.error = String(error); });
|
|
32
|
+
child.once("close", closed);
|
|
33
|
+
// An EmbeddedPostgres start can finish before this adapter sees its child.
|
|
34
|
+
// Exit without pipe closure is deliberately insufficient.
|
|
35
|
+
if ((child.exitCode !== null || child.signalCode !== null)
|
|
36
|
+
&& [child.stdout, child.stderr].every(stream => !stream || stream.closed)) {
|
|
37
|
+
closed(child.exitCode, child.signalCode);
|
|
38
|
+
}
|
|
39
|
+
return { child, state, completion };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function createShutdownGate(getChild, startPending, options, clearChild = () => {}) {
|
|
43
|
+
const { dataDirectory, pgCtl, terminationGraceMs } = validateOptions(options);
|
|
44
|
+
const state = {
|
|
45
|
+
pid: undefined, closed: false, exitCode: null, signalCode: null,
|
|
46
|
+
stopMethod: "owned-postgres-pg-ctl-fast", stopError: null, stopErrors: [],
|
|
47
|
+
normalPostgresStopped: false, pendingStart: false,
|
|
48
|
+
controlPid: undefined, controlClosed: false, controlExitCode: null,
|
|
49
|
+
};
|
|
50
|
+
let producer, stopPromise, closing = false, finished = false, pollTimer;
|
|
51
|
+
let primaryFailure, diagnostic = "";
|
|
52
|
+
const originals = [];
|
|
53
|
+
const retain = (stage, error) => originals.push(Object.freeze({ stage, error }));
|
|
54
|
+
const getOriginalFailures = () => Object.freeze([...originals]);
|
|
55
|
+
const remember = error => {
|
|
56
|
+
retain("shutdown", error);
|
|
57
|
+
primaryFailure ??= error;
|
|
58
|
+
state.stopError ??= String(error);
|
|
59
|
+
state.stopErrors.push(String(error));
|
|
60
|
+
return error;
|
|
61
|
+
};
|
|
62
|
+
function capture() {
|
|
63
|
+
const child = getChild();
|
|
64
|
+
if (!child) return producer;
|
|
65
|
+
if (producer && producer.child !== child) {
|
|
66
|
+
throw failure("PG_SHUTDOWN_IDENTITY_CHANGED", "Owned PostgreSQL producer changed during shutdown");
|
|
67
|
+
}
|
|
68
|
+
if (!producer) {
|
|
69
|
+
state.pid = child.pid;
|
|
70
|
+
producer = observeChild(child, state, error => retain("producer error", error));
|
|
71
|
+
producer.completion.then(() => {
|
|
72
|
+
if (!closing) options.signal?.removeEventListener("abort", abort);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return producer;
|
|
76
|
+
}
|
|
77
|
+
function delay() {
|
|
78
|
+
return new Promise(resolve => {
|
|
79
|
+
pollTimer = setTimeout(() => { pollTimer = undefined; resolve(); }, 25);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function assertActive() {
|
|
83
|
+
if (finished) throw primaryFailure ?? failure("PG_SHUTDOWN_CLOSED_GATE", "PostgreSQL shutdown boundary has ended");
|
|
84
|
+
}
|
|
85
|
+
async function normalStop() {
|
|
86
|
+
while (!capture()) {
|
|
87
|
+
state.pendingStart = startPending();
|
|
88
|
+
if (!state.pendingStart) {
|
|
89
|
+
state.closed = true;
|
|
90
|
+
state.normalPostgresStopped = true;
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
await delay();
|
|
94
|
+
assertActive();
|
|
95
|
+
}
|
|
96
|
+
state.pendingStart = startPending();
|
|
97
|
+
if (!Number.isSafeInteger(producer.child.pid) || producer.child.pid < 1) {
|
|
98
|
+
// A failed spawn still owns a ChildProcess close event. Do not lose that
|
|
99
|
+
// lifetime by throwing out of the factory after spawn returned.
|
|
100
|
+
await producer.completion;
|
|
101
|
+
assertActive();
|
|
102
|
+
state.normalPostgresStopped = true;
|
|
103
|
+
clearChild(producer.child);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
try { await options.beforeStop?.(producer.child); }
|
|
107
|
+
catch (error) { remember(error); }
|
|
108
|
+
assertActive();
|
|
109
|
+
if (!producer.state.closed && producer.child.exitCode === null && producer.child.signalCode === null) {
|
|
110
|
+
// A cancellation can arrive in onSpawn, before PostgreSQL publishes its
|
|
111
|
+
// pid file. Never let pg_ctl target an unverified directory in that gap.
|
|
112
|
+
for (;;) {
|
|
113
|
+
assertActive();
|
|
114
|
+
if (producer.state.closed || producer.child.exitCode !== null || producer.child.signalCode !== null) break;
|
|
115
|
+
let pidFile;
|
|
116
|
+
try {
|
|
117
|
+
const filename = path.join(dataDirectory, "postmaster.pid");
|
|
118
|
+
const metadata = await lstat(filename);
|
|
119
|
+
if (!metadata.isFile() || metadata.isSymbolicLink() || metadata.size > 4096) {
|
|
120
|
+
throw failure("PG_SHUTDOWN_PID_FILE_REJECTED", "Owned postmaster pid file is not a bounded ordinary file");
|
|
121
|
+
}
|
|
122
|
+
pidFile = await readFile(filename, "utf8");
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
if (error.code !== "ENOENT") throw failure("PG_SHUTDOWN_PID_FILE_UNKNOWN", "Cannot read owned postmaster pid file", error);
|
|
126
|
+
await delay();
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
assertActive();
|
|
130
|
+
const lines = pidFile.split(/\r?\n/);
|
|
131
|
+
if (!/^[1-9][0-9]*$/.test(lines[0] ?? "") || Number(lines[0]) !== producer.child.pid
|
|
132
|
+
|| !lines[1] || path.resolve(lines[1]) !== dataDirectory) {
|
|
133
|
+
throw failure("PG_SHUTDOWN_PID_FILE_MISMATCH", "Postmaster pid file does not identify this owned producer and data directory");
|
|
134
|
+
}
|
|
135
|
+
if (producer.state.closed || producer.child.exitCode !== null || producer.child.signalCode !== null) break;
|
|
136
|
+
const controller = spawn(pgCtl, [
|
|
137
|
+
"-D", dataDirectory, "stop", "-m", "fast", "-w", "-t", String(Math.ceil(terminationGraceMs / 1000)),
|
|
138
|
+
], { windowsHide: true, shell: false, stdio: ["ignore", "pipe", "pipe"] });
|
|
139
|
+
const controlState = { closed: false, exitCode: null, signalCode: null };
|
|
140
|
+
state.controlPid = controller.pid;
|
|
141
|
+
const control = observeChild(controller, controlState, error => retain("controller error", error));
|
|
142
|
+
// Draining output prevents pipe backpressure; pg_ctl diagnostics are
|
|
143
|
+
// bounded separately from the producer's caller-owned log streams.
|
|
144
|
+
const drain = chunk => { if (diagnostic.length < 2048) diagnostic += String(chunk).slice(0, 2048 - diagnostic.length); };
|
|
145
|
+
controller.stdout?.on("data", drain);
|
|
146
|
+
controller.stderr?.on("data", drain);
|
|
147
|
+
controller.once("error", error => remember(failure("PG_NORMAL_STOP_CONTROL_ERROR", "Owned pg_ctl could not complete", error)));
|
|
148
|
+
const controlled = control.completion.then(result => {
|
|
149
|
+
state.controlClosed = true;
|
|
150
|
+
state.controlExitCode = result.exitCode;
|
|
151
|
+
if (result.error || result.exitCode !== 0 || result.signalCode) {
|
|
152
|
+
remember(failure("PG_NORMAL_STOP_CONTROL_FAILED", "Owned pg_ctl fast stop failed: "
|
|
153
|
+
+ String(result.exitCode) + (diagnostic ? " " + diagnostic : "")));
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
// Both close events include stdio EOF. A controller error must not
|
|
157
|
+
// short-circuit waiting for the still-owned producer.
|
|
158
|
+
await Promise.all([controlled, producer.completion]);
|
|
159
|
+
if (primaryFailure) throw primaryFailure;
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
await producer.completion;
|
|
164
|
+
assertActive();
|
|
165
|
+
if (primaryFailure) throw primaryFailure;
|
|
166
|
+
state.normalPostgresStopped = true;
|
|
167
|
+
clearChild(producer.child);
|
|
168
|
+
}
|
|
169
|
+
function stop() {
|
|
170
|
+
if (stopPromise) return stopPromise;
|
|
171
|
+
closing = true;
|
|
172
|
+
stopPromise = (async () => {
|
|
173
|
+
let boundaryTimer;
|
|
174
|
+
const boundary = new Promise((_, reject) => {
|
|
175
|
+
boundaryTimer = setTimeout(() => {
|
|
176
|
+
const error = failure("PG_NORMAL_STOP_TIMEOUT", "Owned PostgreSQL normal shutdown did not close within "
|
|
177
|
+
+ String(terminationGraceMs) + " ms; ownership remains unknown" + (diagnostic ? ": " + diagnostic : ""));
|
|
178
|
+
remember(error);
|
|
179
|
+
reject(primaryFailure);
|
|
180
|
+
}, terminationGraceMs);
|
|
181
|
+
});
|
|
182
|
+
try {
|
|
183
|
+
await Promise.race([normalStop(), boundary]);
|
|
184
|
+
} catch (error) {
|
|
185
|
+
if (!state.stopErrors.includes(String(error))) remember(error);
|
|
186
|
+
throw primaryFailure ?? error;
|
|
187
|
+
} finally {
|
|
188
|
+
finished = true;
|
|
189
|
+
clearTimeout(boundaryTimer);
|
|
190
|
+
clearTimeout(pollTimer);
|
|
191
|
+
pollTimer = undefined;
|
|
192
|
+
options.signal?.removeEventListener("abort", abort);
|
|
193
|
+
}
|
|
194
|
+
})();
|
|
195
|
+
// Preserve the public promise while making automatic cancellation safe
|
|
196
|
+
// when its caller only inspects state later.
|
|
197
|
+
void stopPromise.catch(() => {});
|
|
198
|
+
return stopPromise;
|
|
199
|
+
}
|
|
200
|
+
function abort() { void stop().catch(() => {}); }
|
|
201
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
202
|
+
return { state, stop, capture, fail: remember, getOriginalFailures, get closing() { return closing; } };
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* A retained PostgreSQL producer uses pg_ctl fast stop, including cancellation.
|
|
207
|
+
* This proves direct producer/controller closure, not a whole job lifetime.
|
|
208
|
+
*/
|
|
209
|
+
export function startRetainedPostgres(executable, args, options = {}) {
|
|
210
|
+
const { dataDirectory, pgCtl, signal, onSpawn, beforeStop, terminationGraceMs = NORMAL_SHUTDOWN_LIMIT_MS, ...spawnOptions } = options;
|
|
211
|
+
validateOptions({ dataDirectory, pgCtl, terminationGraceMs });
|
|
212
|
+
signal?.throwIfAborted();
|
|
213
|
+
const child = spawn(executable, args, {
|
|
214
|
+
windowsHide: true, stdio: ["ignore", "pipe", "pipe"], ...spawnOptions, shell: false,
|
|
215
|
+
});
|
|
216
|
+
const gate = createShutdownGate(() => child, () => false, { dataDirectory, pgCtl, signal, beforeStop, terminationGraceMs });
|
|
217
|
+
const producer = gate.capture();
|
|
218
|
+
function abort() { void gate.stop().catch(() => {}); }
|
|
219
|
+
// The gate installs cancellation before the spawn callback is delivered.
|
|
220
|
+
child.once("spawn", () => {
|
|
221
|
+
try { onSpawn?.(); }
|
|
222
|
+
catch (error) {
|
|
223
|
+
gate.state.error = String(error);
|
|
224
|
+
gate.fail(error);
|
|
225
|
+
void gate.stop().catch(() => {});
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
if (signal?.aborted) abort();
|
|
229
|
+
return { child, state: gate.state, completion: producer.completion, stop: gate.stop, getOriginalFailures: gate.getOriginalFailures };
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Installed embedded-postgres 16.11 stores its child in an ordinary JS field.
|
|
234
|
+
* Its automatic exit hook dynamically calls public stop(), so binding before
|
|
235
|
+
* start routes explicit stop, abort and that hook through one normal close.
|
|
236
|
+
*/
|
|
237
|
+
export function bindEmbeddedPostgresShutdown(instance, options = {}) {
|
|
238
|
+
if (!instance || typeof instance.start !== "function" || typeof instance.stop !== "function") {
|
|
239
|
+
throw failure("PG_SHUTDOWN_INSTANCE_REJECTED", "Expected the installed EmbeddedPostgres start/stop interface");
|
|
240
|
+
}
|
|
241
|
+
options.signal?.throwIfAborted();
|
|
242
|
+
const originalStart = instance.start.bind(instance);
|
|
243
|
+
let pending = false, started = false, startPromise;
|
|
244
|
+
const gate = createShutdownGate(() => instance.process, () => pending, options, child => {
|
|
245
|
+
if (instance.process === child) instance.process = undefined;
|
|
246
|
+
});
|
|
247
|
+
instance.start = function start() {
|
|
248
|
+
if (gate.closing) return Promise.reject(failure("PG_START_AFTER_SHUTDOWN", "PostgreSQL start is closed by its shared shutdown gate"));
|
|
249
|
+
if (started) return startPromise;
|
|
250
|
+
started = true;
|
|
251
|
+
pending = true;
|
|
252
|
+
startPromise = Promise.resolve().then(originalStart).finally(() => {
|
|
253
|
+
pending = false;
|
|
254
|
+
gate.state.pendingStart = false;
|
|
255
|
+
try { gate.capture(); } catch (error) { gate.state.error ??= String(error); }
|
|
256
|
+
});
|
|
257
|
+
return startPromise;
|
|
258
|
+
};
|
|
259
|
+
instance.stop = gate.stop;
|
|
260
|
+
if (options.signal?.aborted) void gate.stop().catch(() => {});
|
|
261
|
+
return { state: gate.state, stop: gate.stop, getOriginalFailures: gate.getOriginalFailures };
|
|
262
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {isDeepStrictEqual} from 'node:util';
|
|
2
|
+
|
|
3
|
+
function schemaName(value,scope='owner'){
|
|
4
|
+
if(scope==='platform'&&['platform','platform_private'].includes(value))return value;
|
|
5
|
+
if(scope!=='owner')throw Error('SCHEMA_SNAPSHOT_INPUT');
|
|
6
|
+
if(typeof value!=='string'||!/^[a-z][a-z0-9_]{0,62}$/.test(value)||value.startsWith('pg_')||['public','platform','platform_private','auth','storage','vault','extensions','information_schema'].includes(value))throw Error('SCHEMA_SNAPSHOT_INPUT');
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
const roleSql=id=>`CASE WHEN ${id}=0 THEN 'public' WHEN pg_get_userbyid(${id})=current_user THEN '$operator' ELSE pg_get_userbyid(${id}) END`;
|
|
10
|
+
// The owner retains implicit authority even after revoking its explicit ACL.
|
|
11
|
+
// Omit only self-to-self owner entries (e.g. PostgreSQL17 adds MAINTAIN). Owner
|
|
12
|
+
// identity remains separately pinned; every grant to another role stays exact.
|
|
13
|
+
const aclSql=(value,owner)=>`coalesce((SELECT jsonb_agg(jsonb_build_object('grantor',a.grantor,'grantee',a.grantee,'privilege',a.privilege_type,'grantable',a.is_grantable) ORDER BY a.grantee COLLATE "C",a.privilege_type COLLATE "C",a.grantor COLLATE "C") FROM (SELECT ${roleSql('x.grantor')} AS grantor,${roleSql('x.grantee')} AS grantee,x.privilege_type,x.is_grantable FROM aclexplode(CASE WHEN cardinality(${value})>0 THEN ${value} ELSE NULL::aclitem[] END) x WHERE NOT(x.grantor=${owner} AND x.grantee=${owner})) a),'[]'::jsonb)`;
|
|
14
|
+
/** Catalog definitions only; never reads a business row. Creator identity is
|
|
15
|
+
* normalized to the querying operator, so native/provider administrator names
|
|
16
|
+
* do not change an otherwise identical owned contract. Other owners stay exact. */
|
|
17
|
+
export function schemaSnapshotSql(schema,{scope='owner'}={}){
|
|
18
|
+
schemaName(schema,scope);
|
|
19
|
+
return `SELECT (SELECT jsonb_build_object(
|
|
20
|
+
'schemaName',n.nspname,'owner',CASE WHEN pg_get_userbyid(n.nspowner)=current_user THEN '$operator' ELSE pg_get_userbyid(n.nspowner) END,'acl',${aclSql("coalesce(n.nspacl,acldefault('n',n.nspowner))",'n.nspowner')},
|
|
21
|
+
'unsupported',EXISTS(SELECT 1 FROM pg_proc p WHERE p.pronamespace=n.oid AND p.prokind='a') OR EXISTS(SELECT 1 FROM pg_type t WHERE t.typnamespace=n.oid AND t.typtype IN ('e','d','r','m')) OR EXISTS(SELECT 1 FROM pg_operator o WHERE o.oprnamespace=n.oid) OR EXISTS(SELECT 1 FROM pg_class c WHERE c.relnamespace=n.oid AND c.relkind NOT IN ('r','p','v','m','S','i','I','t')),
|
|
22
|
+
'relations',coalesce((SELECT jsonb_agg(jsonb_build_object(
|
|
23
|
+
'name',c.relname,'kind',c.relkind,'owner',CASE WHEN pg_get_userbyid(c.relowner)=current_user THEN '$operator' ELSE pg_get_userbyid(c.relowner) END,
|
|
24
|
+
'rls',c.relrowsecurity,'forceRls',c.relforcerowsecurity,'options',c.reloptions,
|
|
25
|
+
'columns',coalesce((SELECT jsonb_agg(jsonb_build_object('name',a.attname,'type',format_type(a.atttypid,a.atttypmod),'notNull',a.attnotnull,'identity',a.attidentity,'generated',a.attgenerated,'default',pg_get_expr(d.adbin,d.adrelid),'acl',${aclSql("coalesce(a.attacl,'{}'::aclitem[])",'c.relowner')}) ORDER BY a.attnum)
|
|
26
|
+
FROM pg_attribute a LEFT JOIN pg_attrdef d ON d.adrelid=a.attrelid AND d.adnum=a.attnum WHERE a.attrelid=c.oid AND a.attnum>0 AND NOT a.attisdropped),'[]'::jsonb),
|
|
27
|
+
'constraints',coalesce((SELECT jsonb_agg(jsonb_build_object('name',k.conname,'definition',pg_get_constraintdef(k.oid,false),'validated',k.convalidated) ORDER BY k.conname) FROM pg_constraint k WHERE k.conrelid=c.oid),'[]'::jsonb),
|
|
28
|
+
'indexes',coalesce((SELECT jsonb_agg(jsonb_build_object('name',ic.relname,'definition',pg_get_indexdef(i.indexrelid,0,false),'valid',i.indisvalid,'ready',i.indisready) ORDER BY ic.relname) FROM pg_index i JOIN pg_class ic ON ic.oid=i.indexrelid WHERE i.indrelid=c.oid),'[]'::jsonb),
|
|
29
|
+
'policies',coalesce((SELECT jsonb_agg(jsonb_build_object('name',p.polname,'command',p.polcmd,'permissive',p.polpermissive,'roles',(SELECT jsonb_agg(roles.name ORDER BY roles.name COLLATE "C") FROM (SELECT ${roleSql('r')} AS name FROM unnest(p.polroles) r) roles),'using',pg_get_expr(p.polqual,p.polrelid),'check',pg_get_expr(p.polwithcheck,p.polrelid)) ORDER BY p.polname) FROM pg_policy p WHERE p.polrelid=c.oid),'[]'::jsonb),
|
|
30
|
+
'triggers',coalesce((SELECT jsonb_agg(jsonb_build_object('name',t.tgname,'enabled',t.tgenabled,'definition',pg_get_triggerdef(t.oid,false)) ORDER BY t.tgname) FROM pg_trigger t WHERE t.tgrelid=c.oid AND NOT t.tgisinternal),'[]'::jsonb),
|
|
31
|
+
'acl',${aclSql("coalesce(c.relacl,acldefault((CASE WHEN c.relkind='S' THEN 's' ELSE 'r' END)::\"char\",c.relowner))",'c.relowner')},
|
|
32
|
+
'view',CASE WHEN c.relkind IN ('v','m') THEN pg_get_viewdef(c.oid,false) ELSE NULL END
|
|
33
|
+
) ORDER BY c.relname) FROM pg_class c WHERE c.relnamespace=n.oid AND c.relkind IN ('r','p','v','m','f','S')),'[]'::jsonb),
|
|
34
|
+
'functions',coalesce((SELECT jsonb_agg(jsonb_build_object('name',p.proname,'arguments',pg_get_function_identity_arguments(p.oid),'owner',CASE WHEN pg_get_userbyid(p.proowner)=current_user THEN '$operator' ELSE pg_get_userbyid(p.proowner) END,'securityDefiner',p.prosecdef,'definition',pg_get_functiondef(p.oid),
|
|
35
|
+
'acl',${aclSql("coalesce(p.proacl,acldefault('f',p.proowner))",'p.proowner')}
|
|
36
|
+
) ORDER BY p.proname,pg_get_function_identity_arguments(p.oid)) FROM pg_proc p WHERE p.pronamespace=n.oid AND p.prokind<>'a'),'[]'::jsonb)
|
|
37
|
+
) FROM pg_namespace n WHERE n.nspname='${schema}') AS snapshot;`;
|
|
38
|
+
}
|
|
39
|
+
export async function readSchemaSnapshot(client,schema,{signal,scope='owner'}={}){
|
|
40
|
+
if(typeof client?.query!=='function')throw Error('SCHEMA_SNAPSHOT_CLIENT');
|
|
41
|
+
const observed=await client.query(schemaSnapshotSql(schema,{scope}),{signal});
|
|
42
|
+
if(!Array.isArray(observed.rows)||observed.rows.length!==1||!Object.hasOwn(observed.rows[0],'snapshot'))throw Error('SCHEMA_SNAPSHOT_UNKNOWN');
|
|
43
|
+
const snapshot=observed.rows[0].snapshot;
|
|
44
|
+
if(snapshot!==null&&(!snapshot||typeof snapshot!=='object'||Array.isArray(snapshot)||snapshot.schemaName!==schema||Buffer.byteLength(JSON.stringify(snapshot))>1048576))throw Error('SCHEMA_SNAPSHOT_UNKNOWN');
|
|
45
|
+
if(snapshot?.unsupported!==false&&snapshot!==null)throw Error('SCHEMA_SNAPSHOT_UNSUPPORTED');
|
|
46
|
+
return snapshot;
|
|
47
|
+
}
|
|
48
|
+
export function assertSchemaSnapshot(expected,actual){
|
|
49
|
+
if(!expected||typeof expected!=='object'||!actual||typeof actual!=='object'||!isDeepStrictEqual(expected,actual))throw Error('SCHEMA_CONTRACT_MISMATCH');
|
|
50
|
+
return {status:'SCHEMA_CONTRACT_MATCH',schema:expected.schemaName};
|
|
51
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {createHash} from 'node:crypto';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import {captureArtifactFiles} from '@openge/forge-artifact-publish/node';
|
|
5
|
+
|
|
6
|
+
const invalid=()=>Error('STATIC_UI_INPUT_INVALID');
|
|
7
|
+
const sha=value=>"'sha256-"+createHash('sha256').update(value).digest('base64')+"'";
|
|
8
|
+
|
|
9
|
+
/** Describe the response policy of an owned static export. Inline
|
|
10
|
+
* scripts/styles are authorized by their exact bytes, never unsafe-inline JS. */
|
|
11
|
+
export async function prepareStaticUiArtifact({root,directory,hostOrigin,maximumFiles=10000,maximumBytes=134217728,maximumFileBytes=maximumBytes,maximumManifestBytes=1048576,maximumHeaderLineBytes=2000,timeoutMs=300000,captureFiles=false,signal}){
|
|
12
|
+
if(typeof root!=='string'||!path.isAbsolute(root)||typeof directory!=='string'||!directory||/[\\:\0\r\n]/.test(directory)||directory.startsWith('/')||directory.split('/').some(part=>!part||part==='.'||part==='..'))throw invalid();
|
|
13
|
+
let origin;
|
|
14
|
+
try{origin=new URL(hostOrigin);}catch{throw invalid();}
|
|
15
|
+
if(origin.protocol!=='https:'||origin.origin!==hostOrigin||origin.username||origin.password)throw invalid();
|
|
16
|
+
for(const limit of [maximumFiles,maximumBytes,maximumFileBytes,maximumManifestBytes,maximumHeaderLineBytes,timeoutMs])if(!Number.isSafeInteger(limit)||limit<1)throw invalid();
|
|
17
|
+
if(typeof captureFiles!=='boolean'||timeoutMs>300000)throw invalid();signal=AbortSignal.any([signal,AbortSignal.timeout(timeoutMs)].filter(Boolean));
|
|
18
|
+
root=path.resolve(root);
|
|
19
|
+
const output=path.join(root,directory),rootInfo=await fs.lstat(root),info=await fs.lstat(output);
|
|
20
|
+
if(!rootInfo.isDirectory()||rootInfo.isSymbolicLink()||await fs.realpath(root)!==root||!info.isDirectory()||info.isSymbolicLink()||await fs.realpath(output)!==output)throw invalid();
|
|
21
|
+
const scripts=new Set(),styles=new Set(),queue=[output],plan=[];
|
|
22
|
+
let files=0,bytes=0,html=0,visited=0;
|
|
23
|
+
while(queue.length){
|
|
24
|
+
signal?.throwIfAborted();const current=queue.pop(),handle=await fs.opendir(current,{bufferSize:1});
|
|
25
|
+
for await(const entryName of handle){
|
|
26
|
+
signal?.throwIfAborted();if(++visited>maximumFiles*4)throw Error('STATIC_UI_LIMIT');const name=entryName.name;
|
|
27
|
+
const file=path.join(current,name),entry=await fs.lstat(file);
|
|
28
|
+
if(entry.isSymbolicLink()||await fs.realpath(file)!==file)throw invalid();
|
|
29
|
+
if(entry.isDirectory()){queue.push(file);continue;}
|
|
30
|
+
if(!entry.isFile()||entry.nlink!==1)throw invalid();
|
|
31
|
+
files++;bytes+=entry.size;
|
|
32
|
+
if(files>maximumFiles||bytes>maximumBytes||entry.size>maximumFileBytes)throw Error('STATIC_UI_LIMIT');
|
|
33
|
+
const relative=path.relative(output,file).split(path.sep).join('/');plan.push({sourcePath:relative,path:relative,role:'control'});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
let captured;
|
|
37
|
+
try{captured=await captureArtifactFiles({sources:[{rootDirectory:output,closure:'exact',files:plan}],pathCaseSensitivity:'case-insensitive',maxFiles:maximumFiles,maxEntries:maximumFiles*8,maxFileBytes:maximumFileBytes,maxTotalBytes:maximumBytes,maxManifestBytes:maximumManifestBytes,timeoutMilliseconds:timeoutMs,signal});}
|
|
38
|
+
catch(error){throw Error(error.code==='BUDGET_EXCEEDED'?'STATIC_UI_LIMIT':'STATIC_UI_CAPTURE_FAILED');}
|
|
39
|
+
bytes=captured.payloadByteLength;
|
|
40
|
+
for(const file of captured.manifest.files){
|
|
41
|
+
if(!file.path.endsWith('.html'))continue;html++;
|
|
42
|
+
const body=new TextDecoder('utf-8',{fatal:true}).decode(captured.readFile(file.path));
|
|
43
|
+
for(const match of body.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi)){
|
|
44
|
+
if(!/\bsrc\s*=/i.test(match[1])&&match[2])scripts.add(sha(match[2]));
|
|
45
|
+
}
|
|
46
|
+
for(const match of body.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style\s*>/gi))if(match[1])styles.add(sha(match[1]));
|
|
47
|
+
}
|
|
48
|
+
if(!html)throw Error('STATIC_UI_HTML_REQUIRED');
|
|
49
|
+
const csp=["default-src 'self'","script-src 'self'"+(scripts.size?' '+[...scripts].sort().join(' '):''),"style-src 'self'"+(styles.size?' '+[...styles].sort().join(' '):''),"style-src-attr 'unsafe-inline'","img-src 'self' data:","font-src 'self'","connect-src 'self'","object-src 'none'","base-uri 'none'","form-action 'none'","frame-src 'none'",'frame-ancestors '+hostOrigin].join('; ');
|
|
50
|
+
const responseHeaders={'content-security-policy':csp,'x-content-type-options':'nosniff','referrer-policy':'no-referrer','permissions-policy':'camera=(), microphone=(), geolocation=()','cache-control':'no-store'};
|
|
51
|
+
if(Object.entries(responseHeaders).some(([key,value])=>Buffer.byteLength(key+': '+value)>maximumHeaderLineBytes))throw Error('STATIC_UI_CSP_LIMIT');
|
|
52
|
+
const policyBytes=Buffer.byteLength(JSON.stringify(responseHeaders)+'\n');if(bytes+policyBytes>maximumBytes)throw Error('STATIC_UI_LIMIT');signal?.throwIfAborted();
|
|
53
|
+
return {files,bytes:bytes+policyBytes,payloadBytes:bytes,inlineScriptHashes:scripts.size,inlineStyleHashes:styles.size,responseHeaders,...(captureFiles?{capturedFiles:captured.manifest.files.map(file=>({path:file.path,bytes:captured.readFile(file.path)}))}:{})};
|
|
54
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Pages' raw and extensionless HTML aliases, shared with byte observation and local fixtures. */
|
|
2
|
+
export const rawStaticUiRoute=file=>'/'+file.split('/').map(encodeURIComponent).join('/');
|
|
3
|
+
export const servedStaticUiRoute=file=>file==='index.html'?'/':file.endsWith('/index.html')?rawStaticUiRoute(file.slice(0,-10)):file.endsWith('.html')?rawStaticUiRoute(file.slice(0,-5)):rawStaticUiRoute(file);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import {randomUUID} from 'node:crypto';
|
|
3
|
+
|
|
4
|
+
// A bounded, non-waiting bakery doorway. Unique intent files avoid deleting a
|
|
5
|
+
// replacement lock while retiring an interrupted contender. No heartbeat or
|
|
6
|
+
// age-based lease can expire a live owner.
|
|
7
|
+
export function acquireTemporaryScope({io, directory, label, probeOwner, verifyScope}) {
|
|
8
|
+
const prefix = '.' + label + '-acquire-', token = randomUUID(), file = path.join(directory, prefix + token + '.json');
|
|
9
|
+
const intent = {version: 1, token, ownerPid: process.pid, sequence: 0};
|
|
10
|
+
let created = false;
|
|
11
|
+
const fail = () => { throw Error('TEMPORARY_ACQUISITION_BUSY'); };
|
|
12
|
+
const read = name => {
|
|
13
|
+
verifyScope();
|
|
14
|
+
try {
|
|
15
|
+
const target = path.join(directory, name), before = io.lstatSync(target);
|
|
16
|
+
if (!before.isFile() || before.isSymbolicLink() || before.nlink !== 1 || before.size > 8192) return fail();
|
|
17
|
+
const bytes = io.readFileSync(target), after = io.lstatSync(target), value = JSON.parse(bytes.toString('utf8'));
|
|
18
|
+
if (before.dev !== after.dev || before.ino !== after.ino || before.size !== after.size || bytes.length !== after.size
|
|
19
|
+
|| value.version !== 1 || name !== prefix + value.token + '.json' || !/^[a-f0-9-]{36}$/.test(value.token ?? '')
|
|
20
|
+
|| !Number.isSafeInteger(value.ownerPid) || value.ownerPid < 1 || !Number.isSafeInteger(value.sequence) || value.sequence < 0) return fail();
|
|
21
|
+
return {name, target, value, identity: {dev: after.dev, ino: after.ino}};
|
|
22
|
+
} catch (error) { if (error.code === 'ENOENT') return null; throw error; }
|
|
23
|
+
};
|
|
24
|
+
const list = () => {
|
|
25
|
+
verifyScope();
|
|
26
|
+
const names = io.readdirSync(directory).filter(name => name.startsWith(prefix));
|
|
27
|
+
if (names.length > 64) return fail();
|
|
28
|
+
return names.map(read).filter(Boolean);
|
|
29
|
+
};
|
|
30
|
+
const retired = candidate => candidate.value.ownerPid !== process.pid && probeOwner(candidate.value.ownerPid) === 'dead';
|
|
31
|
+
const remove = candidate => {
|
|
32
|
+
const current = read(candidate.name);
|
|
33
|
+
if (!current) return;
|
|
34
|
+
if (current.identity.dev !== candidate.identity.dev || current.identity.ino !== candidate.identity.ino
|
|
35
|
+
|| JSON.stringify(current.value) !== JSON.stringify(candidate.value)) return fail();
|
|
36
|
+
verifyScope(); io.unlinkSync(candidate.target);
|
|
37
|
+
};
|
|
38
|
+
const release = () => {
|
|
39
|
+
if (!created) return;
|
|
40
|
+
const own = read(path.basename(file));
|
|
41
|
+
if (!own || JSON.stringify(own.value) !== JSON.stringify(intent)) return fail();
|
|
42
|
+
remove(own); created = false;
|
|
43
|
+
};
|
|
44
|
+
try {
|
|
45
|
+
verifyScope(); io.writeFileSync(file, JSON.stringify(intent) + '\n', {flag: 'wx', mode: 0o600}); created = true;
|
|
46
|
+
const others = list().filter(candidate => candidate.value.token !== token && !retired(candidate));
|
|
47
|
+
intent.sequence = 1 + Math.max(0, ...others.map(candidate => candidate.value.sequence));
|
|
48
|
+
if (!Number.isSafeInteger(intent.sequence)) return fail();
|
|
49
|
+
verifyScope(); io.writeFileSync(file, JSON.stringify(intent) + '\n');
|
|
50
|
+
const contenders = list().filter(candidate => candidate.value.token !== token);
|
|
51
|
+
for (const candidate of contenders) {
|
|
52
|
+
if (retired(candidate)) continue;
|
|
53
|
+
const other = candidate.value;
|
|
54
|
+
if (other.sequence === 0 || other.sequence < intent.sequence || (other.sequence === intent.sequence && other.token < token)) return fail();
|
|
55
|
+
}
|
|
56
|
+
for (const candidate of contenders) if (retired(candidate)) remove(candidate);
|
|
57
|
+
return release;
|
|
58
|
+
} catch (error) {
|
|
59
|
+
try { release(); } catch (releaseError) { error.releaseError = releaseError; }
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type fs from 'node:fs';
|
|
2
|
+
|
|
3
|
+
export interface TemporaryDirectoryIdentity {readonly path:string;readonly dev:string;readonly ino:string}
|
|
4
|
+
/** Original local-tool owner metadata, deeply frozen at runtime. Never a
|
|
5
|
+
* publishing business/release result or permission to replay an operation. */
|
|
6
|
+
export interface PreviousTemporaryClosure {
|
|
7
|
+
readonly version:1;readonly label:string;readonly root:TemporaryDirectoryIdentity;
|
|
8
|
+
readonly scope:TemporaryDirectoryIdentity;readonly payload:TemporaryDirectoryIdentity;
|
|
9
|
+
readonly evidence?:TemporaryDirectoryIdentity;readonly ownerPid:number;readonly ownerToken:string;
|
|
10
|
+
readonly inputDigest:string|null;readonly children:readonly number[];readonly launching:false;
|
|
11
|
+
readonly state:'active'|'blocked';readonly requiresClosureProof:boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface TemporaryClosureConfirmation {
|
|
14
|
+
readonly status:'closed';readonly ownerToken:string;readonly inputDigest:string|null;
|
|
15
|
+
/** Digest of caller-verified original process/tree/output closure evidence. */
|
|
16
|
+
readonly evidenceSha256:string;
|
|
17
|
+
}
|
|
18
|
+
export interface TemporaryScopeOptions {
|
|
19
|
+
root:string;scope:string;label:string;maximumBytes:number;inputDigest?:string|null;
|
|
20
|
+
requiresClosureProof?:boolean;filesystem?:typeof fs;
|
|
21
|
+
probeOwner?:(pid:number)=>'alive'|'dead'|'unknown';
|
|
22
|
+
/** Explicit trusted synchronous recovery port for local temporary resources.
|
|
23
|
+
* The caller must verify actual original closure evidence and exact binding.
|
|
24
|
+
* Called only after dead owner/children, no launch and verified identities;
|
|
25
|
+
* identities and original metadata are checked again before any removal.
|
|
26
|
+
* Boolean, Promise, unknown, throw or mismatched receipts do not confirm. */
|
|
27
|
+
confirmPreviousClosure?:(original:PreviousTemporaryClosure)=>TemporaryClosureConfirmation|undefined;
|
|
28
|
+
}
|
|
29
|
+
export interface TemporaryScopeReceipt {
|
|
30
|
+
readonly version:1;readonly label:string;readonly root:TemporaryDirectoryIdentity;
|
|
31
|
+
readonly scope:TemporaryDirectoryIdentity;readonly inputDigest:string|null;
|
|
32
|
+
readonly status:string;readonly directory:string;readonly ownerPid:number;
|
|
33
|
+
readonly closed:true;readonly removed:true;readonly previousClosure?:TemporaryClosureConfirmation;
|
|
34
|
+
}
|
|
35
|
+
export interface TemporaryScope {
|
|
36
|
+
directory:string;token:string;previousInputMatched:boolean;
|
|
37
|
+
recovery?:{status:string;ownerPid?:number;inputDigest?:string|null;removed?:boolean;closureConfirmation?:TemporaryClosureConfirmation;[key:string]:unknown};
|
|
38
|
+
verify():void;finish(input:{status:string;closed:boolean}):TemporaryScopeReceipt;
|
|
39
|
+
registerEvidence(directory:string):void;beginLaunch():void;trackPid(pid:number):void;
|
|
40
|
+
checkBudget():{bytes:number;entries:number};
|
|
41
|
+
}
|
|
42
|
+
export function createTemporaryScope(options:TemporaryScopeOptions):TemporaryScope;
|
|
43
|
+
export function temporaryChildClosed(handle:{state:{closed?:boolean;stopError?:unknown;stdoutEof?:boolean;stderrEof?:boolean};child?:{stdout?:{readableEnded?:boolean}|null;stderr?:{readableEnded?:boolean}|null}}):boolean;
|
|
44
|
+
export function createVerificationRun(options:Omit<TemporaryScopeOptions,'requiresClosureProof'>):{
|
|
45
|
+
directory:string;resultFile:string;checkBudget():{bytes:number;entries:number};
|
|
46
|
+
finish(input:{result:{status:string;[key:string]:unknown};closed:boolean}):TemporaryScopeReceipt;
|
|
47
|
+
};
|