@nylorun/runtime 0.9.0-beta → 0.11.0-beta
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/CHANGELOG.md +81 -0
- package/README.md +110 -37
- package/dist/adapters/execution/restate.d.ts +130 -0
- package/dist/adapters/execution/restate.js +442 -0
- package/dist/adapters/media.d.ts +2 -2
- package/dist/adapters/media.js +2 -2
- package/dist/adapters/observe.d.ts +2 -1
- package/dist/adapters/observe.js +2 -3
- package/dist/adapters/sandbox/virtual.js +1 -1
- package/dist/adapters/streams/s2.d.ts +18 -0
- package/dist/adapters/streams/s2.js +361 -0
- package/dist/assets.d.ts +2 -2
- package/dist/assets.js +5 -3
- package/dist/core/executors.d.ts +15 -3
- package/dist/core/executors.js +40 -5
- package/dist/core/flow-host.d.ts +225 -0
- package/dist/core/flow-host.js +518 -0
- package/dist/core/limits.d.ts +40 -0
- package/dist/core/limits.js +76 -0
- package/dist/core/runtime.d.ts +5 -90
- package/dist/core/runtime.js +3 -1447
- package/dist/core/sandbox-routes.d.ts +40 -0
- package/dist/core/sandbox-routes.js +106 -0
- package/dist/core/turn-manifest.d.ts +50 -0
- package/dist/core/turn-manifest.js +66 -0
- package/dist/execution/memory.d.ts +54 -0
- package/dist/execution/memory.js +217 -0
- package/dist/execution/types.d.ts +125 -0
- package/dist/execution/types.js +52 -0
- package/dist/host/config-for.d.ts +17 -0
- package/dist/host/config-for.js +27 -0
- package/dist/host/config.d.ts +16 -0
- package/dist/host/create-host.d.ts +56 -0
- package/dist/host/create-host.js +420 -0
- package/dist/host/environment.d.ts +13 -0
- package/dist/host/environment.js +53 -0
- package/dist/host/execution.d.ts +61 -0
- package/dist/host/execution.js +69 -0
- package/dist/host/http.d.ts +39 -0
- package/dist/host/http.js +142 -0
- package/dist/host/index.d.ts +8 -0
- package/dist/host/index.js +7 -0
- package/dist/host/logger.d.ts +3 -0
- package/dist/host/logger.js +18 -0
- package/dist/host/main.d.ts +3 -0
- package/dist/host/main.js +201 -0
- package/dist/host/stack-config.d.ts +72 -0
- package/dist/host/stack-config.js +193 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.js +4 -2
- package/dist/infra/database.d.ts +16 -0
- package/dist/infra/database.js +31 -0
- package/dist/infra/execution.d.ts +39 -0
- package/dist/infra/execution.js +68 -0
- package/dist/infra/index.d.ts +42 -0
- package/dist/infra/index.js +56 -0
- package/dist/infra/readiness.d.ts +33 -0
- package/dist/infra/readiness.js +53 -0
- package/dist/infra/streams.d.ts +17 -0
- package/dist/infra/streams.js +33 -0
- package/dist/infra/workers.d.ts +39 -0
- package/dist/infra/workers.js +31 -0
- package/dist/mcp/connect.d.ts +1 -0
- package/dist/mcp/connect.js +2 -0
- package/dist/mcp/pool.d.ts +3 -1
- package/dist/mcp/pool.js +2 -1
- package/dist/mcp/stdio.d.ts +2 -0
- package/dist/mcp/stdio.js +3 -1
- package/dist/model/auth-store.d.ts +1 -1
- package/dist/model/auth-store.js +2 -2
- package/dist/model/models.d.ts +4 -0
- package/dist/model/models.js +22 -26
- package/dist/model/pi-model.d.ts +2 -2
- package/dist/model/pi-model.js +6 -6
- package/dist/model/settings.d.ts +5 -1
- package/dist/model/settings.js +6 -2
- package/dist/sandbox/manager.d.ts +26 -8
- package/dist/sandbox/manager.js +95 -47
- package/dist/sandbox/select.d.ts +5 -4
- package/dist/sandbox/select.js +18 -13
- package/dist/sandbox/share.d.ts +23 -0
- package/dist/sandbox/share.js +58 -0
- package/dist/sandbox/types.d.ts +2 -2
- package/dist/store/canonical.d.ts +5 -0
- package/dist/store/canonical.js +17 -0
- package/dist/store/cursor.d.ts +9 -0
- package/dist/store/cursor.js +18 -0
- package/dist/store/memory.d.ts +57 -0
- package/dist/store/memory.js +643 -0
- package/dist/store/ownership.d.ts +19 -0
- package/dist/store/ownership.js +33 -0
- package/dist/store/postgres/connect.d.ts +25 -0
- package/dist/store/postgres/connect.js +25 -0
- package/dist/store/postgres/locking.d.ts +16 -0
- package/dist/store/postgres/locking.js +22 -0
- package/dist/store/postgres/migrations/001_initial.d.ts +27 -0
- package/dist/store/postgres/migrations/001_initial.js +196 -0
- package/dist/store/postgres/migrations/index.d.ts +49 -0
- package/dist/store/postgres/migrations/index.js +75 -0
- package/dist/store/postgres/names.d.ts +11 -0
- package/dist/store/postgres/names.js +42 -0
- package/dist/store/postgres/store.d.ts +11 -0
- package/dist/store/postgres/store.js +790 -0
- package/dist/store/postgres/tenants.d.ts +90 -0
- package/dist/store/postgres/tenants.js +207 -0
- package/dist/store/types.d.ts +440 -0
- package/dist/store/types.js +10 -0
- package/dist/streams/basin.d.ts +23 -0
- package/dist/streams/basin.js +51 -0
- package/dist/streams/memory.d.ts +25 -0
- package/dist/streams/memory.js +124 -0
- package/dist/streams/relay.d.ts +37 -0
- package/dist/streams/relay.js +254 -0
- package/dist/streams/types.d.ts +115 -0
- package/dist/streams/types.js +86 -0
- package/dist/tenant/actions.d.ts +153 -0
- package/dist/tenant/actions.js +191 -0
- package/dist/tenant/advance.d.ts +15 -0
- package/dist/tenant/advance.js +439 -0
- package/dist/tenant/auth.d.ts +11 -0
- package/dist/tenant/auth.js +34 -0
- package/dist/tenant/commands.d.ts +3 -0
- package/dist/tenant/commands.js +384 -0
- package/dist/tenant/context.d.ts +140 -0
- package/dist/tenant/context.js +40 -0
- package/dist/tenant/effects.d.ts +20 -0
- package/dist/tenant/effects.js +539 -0
- package/dist/tenant/envelope.d.ts +7 -0
- package/dist/tenant/envelope.js +22 -0
- package/dist/tenant/ephemeral.d.ts +42 -0
- package/dist/tenant/ephemeral.js +224 -0
- package/dist/tenant/http.d.ts +32 -0
- package/dist/tenant/http.js +51 -0
- package/dist/tenant/live.d.ts +92 -0
- package/dist/tenant/live.js +290 -0
- package/dist/tenant/logger.d.ts +9 -0
- package/dist/tenant/logger.js +25 -0
- package/dist/tenant/model-setting.d.ts +16 -0
- package/dist/tenant/model-setting.js +12 -0
- package/dist/tenant/module.d.ts +38 -0
- package/dist/tenant/module.js +319 -0
- package/dist/tenant/paths.d.ts +28 -0
- package/dist/tenant/paths.js +91 -0
- package/dist/tenant/pool.d.ts +10 -0
- package/dist/tenant/pool.js +54 -0
- package/dist/tenant/principals.d.ts +13 -0
- package/dist/tenant/principals.js +37 -0
- package/dist/tenant/quarantine-error.d.ts +6 -0
- package/dist/tenant/quarantine-error.js +9 -0
- package/dist/tenant/quarantine.d.ts +27 -0
- package/dist/tenant/quarantine.js +72 -0
- package/dist/tenant/reset.d.ts +22 -0
- package/dist/tenant/reset.js +81 -0
- package/dist/tenant/routes-tenant.d.ts +12 -0
- package/dist/tenant/routes-tenant.js +126 -0
- package/dist/tenant/routes.d.ts +9 -0
- package/dist/tenant/routes.js +142 -0
- package/dist/tenant/runtime.d.ts +81 -0
- package/dist/tenant/runtime.js +298 -0
- package/dist/tenant/scheduler.d.ts +25 -0
- package/dist/tenant/scheduler.js +84 -0
- package/dist/tenant/session.d.ts +60 -0
- package/dist/tenant/session.js +94 -0
- package/dist/tenant/sessions.d.ts +34 -0
- package/dist/tenant/sessions.js +149 -0
- package/dist/tenant/status.d.ts +37 -0
- package/dist/tenant/status.js +130 -0
- package/dist/tenant/store-memory.d.ts +16 -0
- package/dist/tenant/store-memory.js +111 -0
- package/dist/tenant/store-pg.d.ts +15 -0
- package/dist/tenant/store-pg.js +140 -0
- package/dist/tenant/streams.d.ts +126 -0
- package/dist/tenant/streams.js +419 -0
- package/dist/tenant/sweep.d.ts +15 -0
- package/dist/tenant/sweep.js +122 -0
- package/dist/tenant/types.d.ts +205 -0
- package/dist/tenant/types.js +23 -0
- package/dist/tenant/worker.d.ts +84 -0
- package/dist/tenant/worker.js +189 -0
- package/dist/vault/kek.d.ts +5 -2
- package/dist/vault/kek.js +7 -10
- package/dist/vault/service.d.ts +37 -31
- package/dist/vault/service.js +439 -359
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +14 -11
- package/dist/adapters/sandbox/microsandbox.d.ts +0 -2
- package/dist/adapters/sandbox/microsandbox.js +0 -238
- package/dist/core/main.js +0 -35
- package/dist/core/store.d.ts +0 -30
- package/dist/core/store.js +0 -202
- /package/dist/{core/main.d.ts → host/config.js} +0 -0
package/dist/sandbox/select.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { tmpdir } from "node:os";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { microsandboxBackend } from "../adapters/sandbox/microsandbox.js";
|
|
4
1
|
import { virtualBackend } from "../adapters/sandbox/virtual.js";
|
|
5
|
-
const PREFERENCES = ["auto", "
|
|
6
|
-
/** The
|
|
2
|
+
const PREFERENCES = ["auto", "virtual"];
|
|
3
|
+
/** The backends a Runtime probes, in order. `auto` picks the first available one. */
|
|
7
4
|
export function defaultSandboxBackends(options) {
|
|
8
|
-
return [
|
|
5
|
+
return [virtualBackend({ root: options.root })];
|
|
9
6
|
}
|
|
10
7
|
export function parseSandboxPreference(value) {
|
|
11
8
|
const normalized = (value ?? "auto").trim().toLowerCase() || "auto";
|
|
@@ -26,10 +23,15 @@ export async function selectSandboxBackend(backends, preference) {
|
|
|
26
23
|
const backend = backends.find((item) => item.name === preference);
|
|
27
24
|
const probe = probeOf(preference);
|
|
28
25
|
if (backend && probe?.available)
|
|
29
|
-
return {
|
|
26
|
+
return {
|
|
27
|
+
preference,
|
|
28
|
+
backend,
|
|
29
|
+
reason: `${preference} selected by TenantConfig.sandbox.backend`,
|
|
30
|
+
probes,
|
|
31
|
+
};
|
|
30
32
|
return {
|
|
31
33
|
preference,
|
|
32
|
-
reason: `
|
|
34
|
+
reason: `sandbox.backend=${preference} but ${preference} is unavailable: ${probe?.reason ?? "unknown backend"}. Fix it, or set backend to auto to use the best available backend`,
|
|
33
35
|
probes,
|
|
34
36
|
};
|
|
35
37
|
}
|
|
@@ -58,18 +60,21 @@ export function reportSelection(selection) {
|
|
|
58
60
|
};
|
|
59
61
|
}
|
|
60
62
|
/**
|
|
61
|
-
* Probe
|
|
62
|
-
*
|
|
63
|
+
* Probe backends the way a Tenant Runtime would at open.
|
|
64
|
+
* Callers must pass an explicit probe root; no ambient env or OS temp (A7).
|
|
63
65
|
*/
|
|
64
66
|
export async function probeSandboxBackends(options = {}) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
if (!options.root) {
|
|
68
|
+
throw new Error("probeSandboxBackends requires an explicit root (Tenant or Host tmp path)");
|
|
69
|
+
}
|
|
70
|
+
const preference = parseSandboxPreference(options.preference ?? "auto");
|
|
71
|
+
const backends = defaultSandboxBackends({ root: options.root });
|
|
67
72
|
if (!preference)
|
|
68
73
|
return {
|
|
69
74
|
preference: "auto",
|
|
70
75
|
backend: null,
|
|
71
76
|
isolation: null,
|
|
72
|
-
reason: "
|
|
77
|
+
reason: "sandbox.backend must be auto or virtual",
|
|
73
78
|
probes: await Promise.all(backends.map((backend) => backend.probe())),
|
|
74
79
|
};
|
|
75
80
|
return reportSelection(await selectSandboxBackend(backends, preference));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared workflow sandbox: one sandbox per owning session, attached via
|
|
3
|
+
* PutSession.sandbox = { session }. Specs must match; keys use the owner id.
|
|
4
|
+
*/
|
|
5
|
+
import { type AgentManifest, type CapabilityManifest, type SandboxManifest, type WorkflowManifest } from "@nylorun/core/define";
|
|
6
|
+
export type SessionSandboxRef = {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly ownerUserId: string;
|
|
9
|
+
readonly manifest: AgentManifest | WorkflowManifest | Record<string, unknown>;
|
|
10
|
+
/** Session whose id keys the sandbox. Absent means this session owns its own. */
|
|
11
|
+
readonly sandboxOwnerId?: string | null;
|
|
12
|
+
};
|
|
13
|
+
/** Sandbox spec declared on an agent capability or a workflow manifest. */
|
|
14
|
+
export declare function sandboxSpecOf(manifest: AgentManifest | WorkflowManifest | Record<string, unknown> | undefined): SandboxManifest | undefined;
|
|
15
|
+
export declare function sandboxSpecsEqual(a: SandboxManifest | undefined, b: SandboxManifest | undefined): boolean;
|
|
16
|
+
/** Synthetic capability so SandboxManager.run can use a workflow (or shared) spec. */
|
|
17
|
+
export declare function capabilityForSandbox(sandbox: SandboxManifest): CapabilityManifest;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the session id that keys the sandbox. Walks one hop via sandboxOwnerId;
|
|
20
|
+
* cycles fall back to the starting session.
|
|
21
|
+
*/
|
|
22
|
+
export declare function owningSandboxSessionId(session: SessionSandboxRef, lookup: (id: string) => SessionSandboxRef | undefined): string;
|
|
23
|
+
export declare function sessionHasSandbox(session: SessionSandboxRef, lookup: (id: string) => SessionSandboxRef | undefined): boolean;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared workflow sandbox: one sandbox per owning session, attached via
|
|
3
|
+
* PutSession.sandbox = { session }. Specs must match; keys use the owner id.
|
|
4
|
+
*/
|
|
5
|
+
import { canonical, } from "@nylorun/core/define";
|
|
6
|
+
/** Sandbox spec declared on an agent capability or a workflow manifest. */
|
|
7
|
+
export function sandboxSpecOf(manifest) {
|
|
8
|
+
if (!manifest || typeof manifest !== "object")
|
|
9
|
+
return undefined;
|
|
10
|
+
if (manifest.kind === "workflow")
|
|
11
|
+
return manifest.sandbox;
|
|
12
|
+
const capabilities = manifest.capabilities;
|
|
13
|
+
if (!Array.isArray(capabilities))
|
|
14
|
+
return undefined;
|
|
15
|
+
for (const capability of capabilities)
|
|
16
|
+
if (capability.sandbox)
|
|
17
|
+
return capability.sandbox;
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
export function sandboxSpecsEqual(a, b) {
|
|
21
|
+
if (a === undefined && b === undefined)
|
|
22
|
+
return true;
|
|
23
|
+
if (a === undefined || b === undefined)
|
|
24
|
+
return false;
|
|
25
|
+
return canonical(a) === canonical(b);
|
|
26
|
+
}
|
|
27
|
+
/** Synthetic capability so SandboxManager.run can use a workflow (or shared) spec. */
|
|
28
|
+
export function capabilityForSandbox(sandbox) {
|
|
29
|
+
return {
|
|
30
|
+
id: "sandbox",
|
|
31
|
+
type: "agent",
|
|
32
|
+
sandbox,
|
|
33
|
+
tools: [],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Resolve the session id that keys the sandbox. Walks one hop via sandboxOwnerId;
|
|
38
|
+
* cycles fall back to the starting session.
|
|
39
|
+
*/
|
|
40
|
+
export function owningSandboxSessionId(session, lookup) {
|
|
41
|
+
const seen = new Set();
|
|
42
|
+
let current = session;
|
|
43
|
+
while (current) {
|
|
44
|
+
if (seen.has(current.id))
|
|
45
|
+
return session.id;
|
|
46
|
+
seen.add(current.id);
|
|
47
|
+
const ownerId = current.sandboxOwnerId;
|
|
48
|
+
if (!ownerId || ownerId === current.id)
|
|
49
|
+
return current.id;
|
|
50
|
+
current = lookup(ownerId);
|
|
51
|
+
}
|
|
52
|
+
return session.id;
|
|
53
|
+
}
|
|
54
|
+
export function sessionHasSandbox(session, lookup) {
|
|
55
|
+
const ownerId = owningSandboxSessionId(session, lookup);
|
|
56
|
+
const owner = ownerId === session.id ? session : lookup(ownerId) ?? session;
|
|
57
|
+
return sandboxSpecOf(owner.manifest) !== undefined || sandboxSpecOf(session.manifest) !== undefined;
|
|
58
|
+
}
|
package/dist/sandbox/types.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* and import a substrate SDK; everything else in the Runtime talks to this interface.
|
|
4
4
|
*/
|
|
5
5
|
import type { SandboxNetworkPreset } from "@nylorun/core/define";
|
|
6
|
-
export type SandboxBackendName = "
|
|
7
|
-
export type SandboxIsolation = "
|
|
6
|
+
export type SandboxBackendName = "virtual";
|
|
7
|
+
export type SandboxIsolation = "process";
|
|
8
8
|
export interface SandboxProbe {
|
|
9
9
|
readonly name: SandboxBackendName;
|
|
10
10
|
readonly available: boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical JSON: object keys sorted, `undefined` members dropped. Idempotency
|
|
3
|
+
* comparisons (commands, effects, vault requests) compare canonical forms.
|
|
4
|
+
*/
|
|
5
|
+
export function canonical(value) {
|
|
6
|
+
if (Array.isArray(value))
|
|
7
|
+
return "[" + value.map(canonical).join(",") + "]";
|
|
8
|
+
if (value && typeof value === "object")
|
|
9
|
+
return ("{" +
|
|
10
|
+
Object.keys(value)
|
|
11
|
+
.sort()
|
|
12
|
+
.filter((k) => value[k] !== undefined)
|
|
13
|
+
.map((k) => JSON.stringify(k) + ":" + canonical(value[k]))
|
|
14
|
+
.join(",") +
|
|
15
|
+
"}");
|
|
16
|
+
return JSON.stringify(value) ?? "null";
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event cursors. A cursor names the last event a client has seen:
|
|
3
|
+
* `base64url("<sessionId>:<seq>")`, where `seq` is the per-session event
|
|
4
|
+
* sequence and also the S2 sequence number in `sessions/<sessionId>`.
|
|
5
|
+
* The encoding matches the old global-sequence cursors, so clients see no format change.
|
|
6
|
+
*/
|
|
7
|
+
export declare function encodeCursor(sessionId: string, seq: number): string;
|
|
8
|
+
/** Decodes a cursor for `sessionId`, or throws `Invalid cursor`. */
|
|
9
|
+
export declare function decodeCursor(sessionId: string, cursor: string): number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event cursors. A cursor names the last event a client has seen:
|
|
3
|
+
* `base64url("<sessionId>:<seq>")`, where `seq` is the per-session event
|
|
4
|
+
* sequence and also the S2 sequence number in `sessions/<sessionId>`.
|
|
5
|
+
* The encoding matches the old global-sequence cursors, so clients see no format change.
|
|
6
|
+
*/
|
|
7
|
+
export function encodeCursor(sessionId, seq) {
|
|
8
|
+
return Buffer.from(`${sessionId}:${seq}`).toString("base64url");
|
|
9
|
+
}
|
|
10
|
+
/** Decodes a cursor for `sessionId`, or throws `Invalid cursor`. */
|
|
11
|
+
export function decodeCursor(sessionId, cursor) {
|
|
12
|
+
const decoded = Buffer.from(cursor, "base64url").toString();
|
|
13
|
+
const prefix = `${sessionId}:`;
|
|
14
|
+
const rest = decoded.slice(prefix.length);
|
|
15
|
+
if (!decoded.startsWith(prefix) || !/^\d+$/.test(rest))
|
|
16
|
+
throw new Error("Invalid cursor");
|
|
17
|
+
return Number(rest);
|
|
18
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type CommitListener, type DocTable, type ExecutorRow, type PrincipalRow, type SessionOwnership, type SessionStore, type SessionStoreOptions, type StoreHealth, type Tx, type VaultAuditRow, type VaultCredentialRow, type VaultIdempotencyRow, type VaultRow } from "./types.js";
|
|
2
|
+
/** Schema version the fake reports; it has no migrations. */
|
|
3
|
+
export declare const MEMORY_SCHEMA_VERSION = 1;
|
|
4
|
+
interface SessionMeta extends SessionOwnership {
|
|
5
|
+
nextSeq: number;
|
|
6
|
+
}
|
|
7
|
+
interface State {
|
|
8
|
+
/** JSON text per id, like a `body` column. */
|
|
9
|
+
docs: Record<DocTable, Map<string, string>>;
|
|
10
|
+
sessionMeta: Map<string, SessionMeta>;
|
|
11
|
+
/** sessionId → seq → event JSON. */
|
|
12
|
+
outbox: Map<string, Map<number, string>>;
|
|
13
|
+
executors: Map<string, ExecutorRow>;
|
|
14
|
+
principals: Map<string, PrincipalRow>;
|
|
15
|
+
vaults: Map<string, VaultRow>;
|
|
16
|
+
credentials: Map<string, VaultCredentialRow>;
|
|
17
|
+
audit: VaultAuditRow[];
|
|
18
|
+
idempotency: Map<string, VaultIdempotencyRow>;
|
|
19
|
+
settings: Map<string, string>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The data behind in-memory Session Stores: what a database is to its connections. Several
|
|
23
|
+
* `MemorySessionStore`s on one `MemoryStoreData` see each other's commits and serialize their
|
|
24
|
+
* transactions together, as several processes on one Tenant schema would; it outlives them,
|
|
25
|
+
* so a test can close a Tenant and open it again.
|
|
26
|
+
*/
|
|
27
|
+
export declare class MemoryStoreData {
|
|
28
|
+
/** @internal */ state: State;
|
|
29
|
+
/** @internal */ queue: Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* In-memory `SessionStore` for unit tests. Not a supported profile.
|
|
33
|
+
*
|
|
34
|
+
* Transactions are serialized (one at a time), each works on a copy of the
|
|
35
|
+
* state and replaces it on commit, so a throw rolls back everything: documents,
|
|
36
|
+
* sequences, outbox rows, `afterCommit` callbacks and `signalWork`. Commit listeners see
|
|
37
|
+
* only this store's commits, as with a Postgres connection.
|
|
38
|
+
*/
|
|
39
|
+
export declare class MemorySessionStore implements SessionStore {
|
|
40
|
+
/** Shared with other stores on the same data; a fresh, private one by default. */
|
|
41
|
+
private readonly data;
|
|
42
|
+
readonly tenantId: string;
|
|
43
|
+
private readonly active;
|
|
44
|
+
private readonly listeners;
|
|
45
|
+
private readonly now;
|
|
46
|
+
private readonly onError;
|
|
47
|
+
private closed;
|
|
48
|
+
constructor(options: SessionStoreOptions,
|
|
49
|
+
/** Shared with other stores on the same data; a fresh, private one by default. */
|
|
50
|
+
data?: MemoryStoreData);
|
|
51
|
+
tx<T>(fn: (t: Tx) => Promise<T>): Promise<T>;
|
|
52
|
+
onCommit(listener: CommitListener): () => void;
|
|
53
|
+
health(): Promise<StoreHealth>;
|
|
54
|
+
close(): Promise<void>;
|
|
55
|
+
private acquire;
|
|
56
|
+
}
|
|
57
|
+
export {};
|