@bjornpagen/bumbledb-log 1.0.0 → 1.1.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/README.md +28 -54
- package/dist/codes.js +4 -4
- package/dist/codes.js.map +1 -1
- package/dist/command.d.ts +4 -4
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +2 -2
- package/dist/errors.js.map +1 -1
- package/dist/history.d.ts +4 -4
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +1 -1
- package/dist/history.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/machine.d.ts +14 -14
- package/dist/machine.d.ts.map +1 -1
- package/dist/machine.js +50 -56
- package/dist/machine.js.map +1 -1
- package/dist/migration-ops.d.ts +3 -3
- package/dist/migrations/bin.js +1 -14
- package/dist/migrations/bin.js.map +1 -1
- package/dist/migrations/canonical.d.ts +1 -1
- package/dist/migrations/cli.d.ts +2 -5
- package/dist/migrations/cli.d.ts.map +1 -1
- package/dist/migrations/cli.js +3 -26
- package/dist/migrations/cli.js.map +1 -1
- package/dist/migrations/codec.d.ts +9 -9
- package/dist/migrations/codec.d.ts.map +1 -1
- package/dist/migrations/diff.d.ts +1 -1
- package/dist/migrations/diff.js +1 -1
- package/dist/migrations/expr.d.ts.map +1 -1
- package/dist/migrations/expr.js +4 -13
- package/dist/migrations/expr.js.map +1 -1
- package/dist/migrations/fail.d.ts +2 -14
- package/dist/migrations/fail.d.ts.map +1 -1
- package/dist/migrations/fail.js +2 -19
- package/dist/migrations/fail.js.map +1 -1
- package/dist/migrations/generate.d.ts.map +1 -1
- package/dist/migrations/generate.js +45 -54
- package/dist/migrations/generate.js.map +1 -1
- package/dist/migrations/index.d.ts +5 -7
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/intent.d.ts +2 -2
- package/dist/migrations/intent.js +2 -2
- package/dist/migrations/lock.d.ts +2 -2
- package/dist/migrations/lock.d.ts.map +1 -1
- package/dist/migrations/lock.js +2 -2
- package/dist/migrations/lock.js.map +1 -1
- package/dist/migrations/native.d.ts +7 -18
- package/dist/migrations/native.d.ts.map +1 -1
- package/dist/migrations/native.js +11 -22
- package/dist/migrations/native.js.map +1 -1
- package/dist/migrations/types.d.ts +1 -2
- package/dist/migrations/types.d.ts.map +1 -1
- package/dist/native.d.ts +17 -24
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js.map +1 -1
- package/dist/options.d.ts +14 -22
- package/dist/options.d.ts.map +1 -1
- package/dist/outcome.d.ts +4 -11
- package/dist/outcome.d.ts.map +1 -1
- package/dist/production.d.ts +3 -3
- package/dist/production.js +3 -3
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +1 -1
- package/dist/surface.d.ts +8 -9
- package/dist/surface.d.ts.map +1 -1
- package/pack-provenance.json +3 -3
- package/package.json +2 -2
package/dist/migrations/bin.js
CHANGED
|
@@ -3,19 +3,6 @@
|
|
|
3
3
|
import { NativeRuntime } from "@bjornpagen/bumbledb";
|
|
4
4
|
import { Effect, Exit } from "effect";
|
|
5
5
|
import { cliProgram, loadAuthoring, parseCliArguments } from "#migrations/cli.ts";
|
|
6
|
-
const RUNTIME = {
|
|
7
|
-
workers: 2,
|
|
8
|
-
queueCapacity: 64,
|
|
9
|
-
cleanupCapacity: 16,
|
|
10
|
-
ownerCapacity: 8,
|
|
11
|
-
nativeHandleCapacity: 64,
|
|
12
|
-
inputBytes: 512n * 1024n * 1024n,
|
|
13
|
-
workingBytes: 512n * 1024n * 1024n,
|
|
14
|
-
scratchBytes: 512n * 1024n * 1024n,
|
|
15
|
-
resultBytes: 128n * 1024n * 1024n,
|
|
16
|
-
chunkBytes: 1024n * 1024n,
|
|
17
|
-
cleanupTimeout: 5000
|
|
18
|
-
};
|
|
19
6
|
const parsed = parseCliArguments(process.argv.slice(2));
|
|
20
7
|
if (typeof parsed === "string") {
|
|
21
8
|
process.stderr.write(`${parsed}\n`);
|
|
@@ -23,7 +10,7 @@ if (typeof parsed === "string") {
|
|
|
23
10
|
}
|
|
24
11
|
else {
|
|
25
12
|
const program = loadAuthoring(parsed).pipe(Effect.flatMap((authored) => cliProgram(parsed, authored)));
|
|
26
|
-
const exit = await Effect.runPromiseExit(program.pipe(Effect.provide(NativeRuntime.layer(
|
|
13
|
+
const exit = await Effect.runPromiseExit(program.pipe(Effect.provide(NativeRuntime.layer())));
|
|
27
14
|
if (Exit.isSuccess(exit)) {
|
|
28
15
|
process.stdout.write(`${JSON.stringify(exit.value.report, null, 2)}\n`);
|
|
29
16
|
process.exitCode = exit.value.code;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/migrations/bin.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/migrations/bin.ts"],"names":[],"mappings":";AACA,mFAAmF;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEjF,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AACvD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;IAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,CAAA;IACnC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;AACrB,CAAC;KAAM,CAAC;IACP,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;IACtG,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;IAC7F,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAA;QACvE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAA;IACnC,CAAC;SAAM,CAAC;QACP,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;QAC1C,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YAClE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAA;YAC1C,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;QACrB,CAAC;aAAM,CAAC;YACP,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAA;YAChE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;QACrB,CAAC;IACF,CAAC;AACF,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Canonical value spelling and deterministic generated-text helpers.
|
|
3
3
|
*
|
|
4
|
-
* The native codec
|
|
4
|
+
* The native codec is the rendering and digest authority for plan,
|
|
5
5
|
* manifest and schema-snapshot FILES: those bytes come back from the native
|
|
6
6
|
* entrypoints (`schema_file::render`, `migration::plan::render_plan`,
|
|
7
7
|
* `migration::manifest::render_manifest`) and are written verbatim, so JSON
|
package/dist/migrations/cli.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { AnySchema
|
|
1
|
+
import type { AnySchema } from "@bjornpagen/bumbledb";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import type { MigrationIntent } from "./intent.js";
|
|
4
4
|
import type { CheckReport, GenerationReport } from "./types.js";
|
|
5
|
-
export declare const CLI_USAGE = "bumbledb-log <generate|check> --schema <module.ts> --out <migrations-dir>\n\t[--export <name>] schema export (default: \"default\", then \"schema\")\n\t[--intent <name>] intent export (default: \"evolution\" when present)\n\t[--label <label>] stable human label for a new plan ([a-z0-9-])\n\t[--contract <path>] runtime contract path (default: <out>/runtime-contract.json)\n
|
|
6
|
-
/** Generous fixed authoring-tool budgets; native admission still re-judges. */
|
|
7
|
-
export declare const CLI_WORK: ExecutionPolicy;
|
|
5
|
+
export declare const CLI_USAGE = "bumbledb-log <generate|check> --schema <module.ts> --out <migrations-dir>\n\t[--export <name>] schema export (default: \"default\", then \"schema\")\n\t[--intent <name>] intent export (default: \"evolution\" when present)\n\t[--label <label>] stable human label for a new plan ([a-z0-9-])\n\t[--contract <path>] runtime contract path (default: <out>/runtime-contract.json)\n";
|
|
8
6
|
export interface CliArguments {
|
|
9
7
|
readonly command: "generate" | "check";
|
|
10
8
|
readonly schemaPath: string;
|
|
@@ -13,7 +11,6 @@ export interface CliArguments {
|
|
|
13
11
|
readonly intentName: string | null;
|
|
14
12
|
readonly label: string | null;
|
|
15
13
|
readonly contract: string | null;
|
|
16
|
-
readonly timeoutMs: number | null;
|
|
17
14
|
}
|
|
18
15
|
export declare function parseCliArguments(argv: readonly string[]): CliArguments | string;
|
|
19
16
|
export interface AuthoredModule {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/migrations/cli.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/migrations/cli.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAGzE,eAAO,MAAM,SAAS,qYAKrB,CAAA;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAA;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,GAAG,MAAM,CA4ChF;AAiBD,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,GAAG,SAAS,CAAA;CACpE;AAED,0EAA0E;AAC1E,eAAO,MAAM,aAAa,qEAsBxB,CAAA;AAEF,eAAO,MAAM,UAAU;;UAeE,CAAC;;;;uEAQxB,CAAA"}
|
package/dist/migrations/cli.js
CHANGED
|
@@ -21,18 +21,7 @@ export const CLI_USAGE = `bumbledb-log <generate|check> --schema <module.ts> --o
|
|
|
21
21
|
[--intent <name>] intent export (default: "evolution" when present)
|
|
22
22
|
[--label <label>] stable human label for a new plan ([a-z0-9-])
|
|
23
23
|
[--contract <path>] runtime contract path (default: <out>/runtime-contract.json)
|
|
24
|
-
[--timeout-ms <n>] generation work deadline (default: 600000)
|
|
25
24
|
`;
|
|
26
|
-
/** Generous fixed authoring-tool budgets; native admission still re-judges. */
|
|
27
|
-
export const CLI_WORK = {
|
|
28
|
-
inputBytes: 256n * 1024n * 1024n,
|
|
29
|
-
workingBytes: 256n * 1024n * 1024n,
|
|
30
|
-
scratchBytes: 256n * 1024n * 1024n,
|
|
31
|
-
resultBytes: 64n * 1024n * 1024n,
|
|
32
|
-
rows: 1000000n,
|
|
33
|
-
workUnits: 1000000000n,
|
|
34
|
-
timeout: 600000
|
|
35
|
-
};
|
|
36
25
|
export function parseCliArguments(argv) {
|
|
37
26
|
const command = argv[0];
|
|
38
27
|
if (command !== "generate" && command !== "check") {
|
|
@@ -44,7 +33,6 @@ export function parseCliArguments(argv) {
|
|
|
44
33
|
let intentName = null;
|
|
45
34
|
let label = null;
|
|
46
35
|
let contract = null;
|
|
47
|
-
let timeoutMs = null;
|
|
48
36
|
for (let index = 1; index < argv.length; index += 2) {
|
|
49
37
|
const flag = argv[index];
|
|
50
38
|
const value = argv[index + 1];
|
|
@@ -70,14 +58,6 @@ export function parseCliArguments(argv) {
|
|
|
70
58
|
case "--contract":
|
|
71
59
|
contract = value;
|
|
72
60
|
break;
|
|
73
|
-
case "--timeout-ms": {
|
|
74
|
-
const parsed = Number.parseInt(value, 10);
|
|
75
|
-
if (!Number.isSafeInteger(parsed) || parsed <= 0) {
|
|
76
|
-
return CLI_USAGE;
|
|
77
|
-
}
|
|
78
|
-
timeoutMs = parsed;
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
61
|
default:
|
|
82
62
|
return CLI_USAGE;
|
|
83
63
|
}
|
|
@@ -85,7 +65,7 @@ export function parseCliArguments(argv) {
|
|
|
85
65
|
if (schemaPath === null || directory === null) {
|
|
86
66
|
return CLI_USAGE;
|
|
87
67
|
}
|
|
88
|
-
return { command, schemaPath, directory, exportName, intentName, label, contract
|
|
68
|
+
return { command, schemaPath, directory, exportName, intentName, label, contract };
|
|
89
69
|
}
|
|
90
70
|
function isSchemaValue(value) {
|
|
91
71
|
return (typeof value === "object" &&
|
|
@@ -121,7 +101,6 @@ export const loadAuthoring = Effect.fn("bumbledb-log.cli.loadAuthoring")(functio
|
|
|
121
101
|
return authored;
|
|
122
102
|
});
|
|
123
103
|
export const cliProgram = Effect.fn("bumbledb-log.cli.program")(function* (cli, authored) {
|
|
124
|
-
const work = cli.timeoutMs === null ? CLI_WORK : { ...CLI_WORK, timeout: cli.timeoutMs };
|
|
125
104
|
const repository = {
|
|
126
105
|
directory: cli.directory,
|
|
127
106
|
...(cli.contract === null ? {} : { contract: cli.contract })
|
|
@@ -131,16 +110,14 @@ export const cliProgram = Effect.fn("bumbledb-log.cli.program")(function* (cli,
|
|
|
131
110
|
schema: authored.schema,
|
|
132
111
|
...(authored.intent === undefined ? {} : { intent: authored.intent }),
|
|
133
112
|
...(cli.label === null ? {} : { label: cli.label }),
|
|
134
|
-
repository
|
|
135
|
-
work
|
|
113
|
+
repository
|
|
136
114
|
});
|
|
137
115
|
return { report, code: 0 };
|
|
138
116
|
}
|
|
139
117
|
const report = yield* checkMigrations({
|
|
140
118
|
schema: authored.schema,
|
|
141
119
|
...(authored.intent === undefined ? {} : { intent: authored.intent }),
|
|
142
|
-
repository
|
|
143
|
-
work
|
|
120
|
+
repository
|
|
144
121
|
});
|
|
145
122
|
return { report, code: report.status === "clean" ? 0 : 1 };
|
|
146
123
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/migrations/cli.ts"],"names":[],"mappings":";;;;;;;;AAAA;;;;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KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;QACrE,UAAU;KACV,CAAC,CAAA;IACF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAE,CAAW,CAAC,CAAC,CAAE,CAAW,EAAE,CAAA;AACjF,CAAC,CAAC,CAAA"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
2
|
+
* The native-codec interface of the migration generator. Everything
|
|
3
3
|
* semantic — schema validation, canonical SchemaId, snapshot rendering, plan
|
|
4
4
|
* validation/rendering/digesting, manifest verification/appending, plan-set
|
|
5
|
-
* digests — happens in the native
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* digests — happens in the native `schema_file`, `migration::plan` and
|
|
6
|
+
* `migration::manifest` modules reached through the shared bridge.
|
|
7
|
+
* TypeScript never reimplements framing, hashing or scalar
|
|
8
8
|
* arithmetic; this interface only names the two bounded read entrypoints the
|
|
9
9
|
* generator calls. `#migrations/native.ts` binds the production codec;
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* generator tests can substitute a scripted codec to exercise refusal and
|
|
11
|
+
* repository-publication behavior independently of native execution.
|
|
12
12
|
*
|
|
13
13
|
* This module is types only — importing it performs no native work and does
|
|
14
14
|
* not load the addon.
|
|
15
15
|
*/
|
|
16
|
-
import type {
|
|
16
|
+
import type { NativeRuntime, SchemaSpec } from "@bjornpagen/bumbledb";
|
|
17
17
|
import type { Effect } from "effect";
|
|
18
18
|
import type { LogError } from "../errors.js";
|
|
19
19
|
import type { JsonValue } from "./canonical.js";
|
|
@@ -61,7 +61,7 @@ export interface ChainPayload {
|
|
|
61
61
|
}
|
|
62
62
|
export interface MigrationCodec {
|
|
63
63
|
/** Validate + fingerprint + render the current schema natively. */
|
|
64
|
-
schemaIdentity(spec: SchemaSpec
|
|
64
|
+
schemaIdentity(spec: SchemaSpec): Effect.Effect<SchemaIdentity, LogError, NativeRuntime>;
|
|
65
65
|
/**
|
|
66
66
|
* One native chain pass: parse + verify the manifest, bind every recorded
|
|
67
67
|
* plan's canonical digest, optionally validate/append a new plan (returning
|
|
@@ -69,6 +69,6 @@ export interface MigrationCodec {
|
|
|
69
69
|
* and optionally compute a pending plan-set digest. Nothing is trusted
|
|
70
70
|
* from text.
|
|
71
71
|
*/
|
|
72
|
-
verifyChain(request: ChainRequest
|
|
72
|
+
verifyChain(request: ChainRequest): Effect.Effect<ChainPayload, LogError, NativeRuntime>;
|
|
73
73
|
}
|
|
74
74
|
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/migrations/codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/migrations/codec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEzD,MAAM,WAAW,cAAc;IAC9B,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,YAAY,EA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,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAA;CACxF"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* list — generation never guesses from matching shapes and never fabricates
|
|
9
9
|
* a zero/null.
|
|
10
10
|
*
|
|
11
|
-
* Output is inert plan data with TOTAL ordinary-relation coverage
|
|
11
|
+
* Output is inert plan data with TOTAL ordinary-relation coverage:
|
|
12
12
|
* every ordinary source relation becomes exactly one `map-relation` or
|
|
13
13
|
* `drop-relation`; every ordinary target relation exactly one
|
|
14
14
|
* `map-relation`/`empty-relation`. A source field no expression references is
|
package/dist/migrations/diff.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* list — generation never guesses from matching shapes and never fabricates
|
|
9
9
|
* a zero/null.
|
|
10
10
|
*
|
|
11
|
-
* Output is inert plan data with TOTAL ordinary-relation coverage
|
|
11
|
+
* Output is inert plan data with TOTAL ordinary-relation coverage:
|
|
12
12
|
* every ordinary source relation becomes exactly one `map-relation` or
|
|
13
13
|
* `drop-relation`; every ordinary target relation exactly one
|
|
14
14
|
* `map-relation`/`empty-relation`. A source field no expression references is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expr.d.ts","sourceRoot":"","sources":["../../src/migrations/expr.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"expr.d.ts","sourceRoot":"","sources":["../../src/migrations/expr.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAErE,MAAM,MAAM,UAAU,GACnB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC9F;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAuElD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CA6D9D;AAsED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,CAOhE;AAED,6DAA6D;AAC7D,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAE5D"}
|
package/dist/migrations/expr.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Core `ScalarExpr` → canonical plan expression data
|
|
2
|
+
* Core `ScalarExpr` → canonical migration-plan expression data.
|
|
3
3
|
* The generator SERIALIZES the core's typed scalar AST; it never evaluates
|
|
4
4
|
* it — the native executor lowers the plan onto `bumbledb::ScalarExpr` and
|
|
5
5
|
* the core `ScalarEvaluator` executes it with the core's exact numeric
|
|
@@ -8,18 +8,9 @@
|
|
|
8
8
|
* native codec (`MAX_EXPR_DEPTH = 128`); any node outside the frozen core
|
|
9
9
|
* roster (closure, module path, unknown kind) is an unsupported-transform
|
|
10
10
|
* refusal, never a fallback.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* identical to the plan JSON grammar in
|
|
15
|
-
* `crates/bumbledb-log/src/migration/plan.rs::parse_expr`:
|
|
16
|
-
* { kind: "field", name } | { kind: "literal", value: <one-arm value> }
|
|
17
|
-
* | { kind: "negate" | "isNaN" | "isFinite", expr }
|
|
18
|
-
* | { kind: "add" | "subtract" | "multiply" | "divide", left, right }
|
|
19
|
-
* | { kind: "cast", cast: "toF64" | "toF64Exact" | "toI64Exact" | "toU64Exact", expr }
|
|
20
|
-
* Literal payloads accept BOTH the wire spelling (decimal strings/bit hex)
|
|
21
|
-
* and the idiomatic host values (bigint/number/Uint8Array) the core SDK's
|
|
22
|
-
* `literal` constructor may retain.
|
|
11
|
+
* Literal payloads accept canonical wire values and the bigint, number,
|
|
12
|
+
* and Uint8Array values retained by core SDK constructors. The serialized
|
|
13
|
+
* form is checked again by the native migration-plan decoder.
|
|
23
14
|
*/
|
|
24
15
|
import { Uuid } from "@bjornpagen/bumbledb";
|
|
25
16
|
import { bytesHex, f64Bits } from "#migrations/canonical.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expr.js","sourceRoot":"","sources":["../../src/migrations/expr.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"expr.js","sourceRoot":"","sources":["../../src/migrations/expr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAO5D,MAAM,SAAS,GAAG,GAAG,CAAA;AACrB,MAAM,SAAS,GAAG,IAAI,CAAA;AACtB,MAAM,QAAQ,GAAG,KAAK,CAAA;AAEtB,SAAS,MAAM,CAAC,MAAc;IAC7B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AAC7B,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAA;AACnD,CAAC;AAED,SAAS,cAAc,CAAC,IAAY,EAAE,MAAc;IACnD,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAA;IACb,CAAC;IACD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QACnC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,IAAI,C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,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;YACxD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC/B,OAAO,KAAK,CAAA;YACb,CAAC;YACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;QAC3C,CAAC;QACD;YACC,OAAO,+BAA+B,IAAI,CAAC,IAAI,0GAA0G,CAAA;IAC3J,CAAC;AACF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAmB;IACnD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAA;IAChC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IACzD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,MAAM,CAAC,OAAO,CAAC,CAAA;IACvB,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,EAAE,CAAA;AAC9D,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,eAAe,CAAC,IAAY;IAC3C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;AAC/B,CAAC"}
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Migration
|
|
3
|
-
*
|
|
4
|
-
* typed E failures with bounded structured detail; there is no third error
|
|
5
|
-
* class and no side-channel message matching. Resource-budget refusals use
|
|
6
|
-
* the core `DbError` `ResourceLimit` reason.
|
|
7
|
-
*
|
|
8
|
-
* Cross-lane note (recorded in implementation/packets/P10.md): the structured
|
|
9
|
-
* reasons `MigrationIntentRequired`/`MigrationUnsupported`/
|
|
10
|
-
* `MigrationRepository` and the structured `MigrationDrift` payload are
|
|
11
|
-
* requested additions to P08's `#codes.ts`/`#errors.ts` roster, mirroring the
|
|
12
|
-
* native migration codec's refusal codes (C11).
|
|
2
|
+
* Migration failures use the shared `DbError | ProtocolError` vocabulary.
|
|
3
|
+
* Reasons carry bounded structured detail; consumers never parse messages.
|
|
13
4
|
*/
|
|
14
|
-
import { DbError } from "@bjornpagen/bumbledb";
|
|
15
5
|
import { ProtocolError } from "../errors.js";
|
|
16
6
|
/** One actionable generation refusal: what is required, about which subject. */
|
|
17
7
|
export interface IntentRequirement {
|
|
@@ -29,6 +19,4 @@ export declare function drift(operation: string, detail: string): ProtocolError;
|
|
|
29
19
|
export declare function unsupported(operation: string, detail: string): ProtocolError;
|
|
30
20
|
/** A malformed or unreadable repository artifact/layout. */
|
|
31
21
|
export declare function repository(operation: string, path: string, detail: string): ProtocolError;
|
|
32
|
-
/** A generation/seed budget refusal on the core resource reason. */
|
|
33
|
-
export declare function budget(operation: string, dimension: string, used: bigint, requested: bigint, limit: bigint): DbError;
|
|
34
22
|
//# sourceMappingURL=fail.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fail.d.ts","sourceRoot":"","sources":["../../src/migrations/fail.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fail.d.ts","sourceRoot":"","sources":["../../src/migrations/fail.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1C,gFAAgF;AAChF,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,IAAI,EACV,WAAW,GACX,aAAa,GACb,kBAAkB,GAClB,aAAa,GACb,aAAa,GACb,cAAc,GACd,oBAAoB,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACvB;AAKD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD;AAWD,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,iBAAiB,EAAE,GAAG,aAAa,CAU3G;AAED,iFAAiF;AACjF,wBAAgB,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAKtE;AAED,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAK5E;AAED,4DAA4D;AAC5D,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAKzF"}
|
package/dist/migrations/fail.js
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Migration
|
|
3
|
-
*
|
|
4
|
-
* typed E failures with bounded structured detail; there is no third error
|
|
5
|
-
* class and no side-channel message matching. Resource-budget refusals use
|
|
6
|
-
* the core `DbError` `ResourceLimit` reason.
|
|
7
|
-
*
|
|
8
|
-
* Cross-lane note (recorded in implementation/packets/P10.md): the structured
|
|
9
|
-
* reasons `MigrationIntentRequired`/`MigrationUnsupported`/
|
|
10
|
-
* `MigrationRepository` and the structured `MigrationDrift` payload are
|
|
11
|
-
* requested additions to P08's `#codes.ts`/`#errors.ts` roster, mirroring the
|
|
12
|
-
* native migration codec's refusal codes (C11).
|
|
2
|
+
* Migration failures use the shared `DbError | ProtocolError` vocabulary.
|
|
3
|
+
* Reasons carry bounded structured detail; consumers never parse messages.
|
|
13
4
|
*/
|
|
14
|
-
import { DbError } from "@bjornpagen/bumbledb";
|
|
15
5
|
import { ProtocolError } from "#errors.ts";
|
|
16
6
|
const MAX_REQUIREMENTS = 32;
|
|
17
7
|
const MAX_DETAIL = 512;
|
|
@@ -59,11 +49,4 @@ export function repository(operation, path, detail) {
|
|
|
59
49
|
reason: { _tag: "MigrationRepository", path: boundedDetail(path), detail: boundedDetail(detail) }
|
|
60
50
|
});
|
|
61
51
|
}
|
|
62
|
-
/** A generation/seed budget refusal on the core resource reason. */
|
|
63
|
-
export function budget(operation, dimension, used, requested, limit) {
|
|
64
|
-
return new DbError({
|
|
65
|
-
operation,
|
|
66
|
-
reason: { _tag: "ResourceLimit", dimension, used, requested, limit }
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
52
|
//# sourceMappingURL=fail.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fail.js","sourceRoot":"","sources":["../../src/migrations/fail.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fail.js","sourceRoot":"","sources":["../../src/migrations/fail.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAiB1C,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAC3B,MAAM,UAAU,GAAG,GAAG,CAAA;AAEtB,MAAM,UAAU,aAAa,CAAC,MAAc;IAC3C,OAAO,MAAM,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAA;AACnF,CAAC;AAED,SAAS,kBAAkB,CAAC,WAA8B;IACzD,OAAO;QACN,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,QAAQ,EAAE,WAAW,CAAC,QAAQ;QAC9B,KAAK,EAAE,WAAW,CAAC,KAAK;QACxB,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC;KACzC,CAAA;AACF,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,cAAc,CAAC,SAAiB,EAAE,YAA0C;IAC3F,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,GAAG,gBAAgB,CAAA;IACxD,OAAO,IAAI,aAAa,CAAC;QACxB,SAAS;QACT,MAAM,EAAE;YACP,IAAI,EAAE,yBAAyB;YAC/B,YAAY,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC;YAC7E,SAAS;SACT;KACD,CAAC,CAAA;AACH,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,KAAK,CAAC,SAAiB,EAAE,MAAc;IACtD,OAAO,IAAI,aAAa,CAAC;QACxB,SAAS;QACT,MAAM,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE;KACjE,CAAC,CAAA;AACH,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,WAAW,CAAC,SAAiB,EAAE,MAAc;IAC5D,OAAO,IAAI,aAAa,CAAC;QACxB,SAAS;QACT,MAAM,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE;KACvE,CAAC,CAAA;AACH,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,UAAU,CAAC,SAAiB,EAAE,IAAY,EAAE,MAAc;IACzE,OAAO,IAAI,aAAa,CAAC;QACxB,SAAS;QACT,MAAM,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE;KACjG,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/migrations/generate.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/migrations/generate.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAe,aAAa,EAAgB,eAAe,EAAc,MAAM,sBAAsB,CAAA;AAIjH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAG1C,OAAO,KAAK,EAAgB,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAcxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAc9D,OAAO,KAAK,EACX,YAAY,EACZ,WAAW,EACX,eAAe,EACf,gBAAgB,EAMhB,MAAM,sBAAsB,CAAA;AAqM7B,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,mBAAmB;yBAqIC,IAAI,SAAS,eAAe;sBA8IlC,IAAI,SAAS,eAAe;EAgEzG"}
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
* schema lowering and the core row-cell codec are imported literally.
|
|
21
21
|
*/
|
|
22
22
|
import * as path from "node:path";
|
|
23
|
-
import {
|
|
23
|
+
import { cellOf, Uuid } from "@bjornpagen/bumbledb";
|
|
24
24
|
import { lower } from "@bjornpagen/bumbledb/internal/log";
|
|
25
25
|
import { Effect } from "effect";
|
|
26
26
|
import { bytesHex, f64Bits, planJson, renderContract, renderIndex, renderSnapshots } from "#migrations/canonical.ts";
|
|
27
27
|
import { diffSchemas } from "#migrations/diff.ts";
|
|
28
|
-
import {
|
|
28
|
+
import { drift, intentRequired, unsupported } from "#migrations/fail.ts";
|
|
29
29
|
import { ensureDirectory, joinPendingIo, readBounded, removeFile, writeDerived, writeImmutable, writeManifest } from "#migrations/fsops.ts";
|
|
30
30
|
import { baseSnapshotPath, contractPath, indexPath, latestSnapshot, manifestPath, planId, planPath, readRepository, snapshotPath, snapshotsSidecarPath } from "#migrations/repo.ts";
|
|
31
31
|
import { parseTheory } from "#migrations/theory.ts";
|
|
@@ -54,10 +54,10 @@ function deriveLabel(tokens) {
|
|
|
54
54
|
return label.endsWith("-") ? label.slice(0, -1) : label;
|
|
55
55
|
}
|
|
56
56
|
// ---------------------------------------------------------------------------
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
// row-cell codec (`cellOf`)
|
|
57
|
+
// Read caller iterables once, yielding between bounded processing steps.
|
|
58
|
+
// The generated document owns the lowered rows; no second chunk array is
|
|
59
|
+
// necessary. This is incremental ingestion, not a streaming document codec.
|
|
60
|
+
// Values lower through the core's one row-cell codec (`cellOf`).
|
|
61
61
|
// ---------------------------------------------------------------------------
|
|
62
62
|
function isOrdinaryRelation(member) {
|
|
63
63
|
return (typeof member === "object" &&
|
|
@@ -84,7 +84,7 @@ function planValueOfCell(relation, ordinal, cell) {
|
|
|
84
84
|
return { $f64: f64Bits(typeof cell === "number" ? cell : Number.NaN) };
|
|
85
85
|
case "uuid": {
|
|
86
86
|
// The core row-cell codec lowers uuid to its canonical
|
|
87
|
-
// canonical hyphenated UUID string
|
|
87
|
+
// canonical hyphenated UUID string — already the plan wire
|
|
88
88
|
// spelling.
|
|
89
89
|
if (!Uuid.isUuid(cell)) {
|
|
90
90
|
throw new Error(`relation ${relation.name}.${declared.name}: uuid cell did not lower to canonical hex`);
|
|
@@ -113,10 +113,9 @@ function planValueOfCell(relation, ordinal, cell) {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
const lowerSeeds = Effect.fn("bumbledb-log.migrations.lowerSeeds")(function* (relations, intents, seedRelations
|
|
116
|
+
const lowerSeeds = Effect.fn("bumbledb-log.migrations.lowerSeeds")(function* (relations, intents, seedRelations) {
|
|
117
117
|
const operation = "migrations.generate";
|
|
118
118
|
const seedOps = [];
|
|
119
|
-
const used = { rows: 0n, bytes: 0n };
|
|
120
119
|
for (const relationName of seedRelations) {
|
|
121
120
|
const member = relations[relationName];
|
|
122
121
|
if (!isOrdinaryRelation(member)) {
|
|
@@ -128,44 +127,36 @@ const lowerSeeds = Effect.fn("bumbledb-log.migrations.lowerSeeds")(function* (re
|
|
|
128
127
|
if (intent.kind !== "seed" || intent.relation !== relationName) {
|
|
129
128
|
continue;
|
|
130
129
|
}
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
done
|
|
142
|
-
|
|
130
|
+
const refused = (cause) => unsupported(operation, `seed ${relationName}: ${cause instanceof Error ? cause.message : "row refused by the core cell codec"}`);
|
|
131
|
+
yield* Effect.acquireUseRelease(Effect.try({
|
|
132
|
+
try: () => ({ iterator: intent.rows[Symbol.iterator](), done: false }),
|
|
133
|
+
catch: refused
|
|
134
|
+
}), (state) => Effect.gen(function* () {
|
|
135
|
+
while (!state.done) {
|
|
136
|
+
yield* Effect.try({
|
|
137
|
+
try: () => {
|
|
138
|
+
for (let index = 0; index < SEED_CHUNK; index += 1) {
|
|
139
|
+
const next = state.iterator.next();
|
|
140
|
+
if (next.done === true) {
|
|
141
|
+
state.done = true;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
const fact = next.value;
|
|
145
|
+
rows.push(data.fields.map((declared, ordinal) => {
|
|
146
|
+
const cell = cellOf(`seed ${relationName}.${declared.name}`, declared.field, fact[declared.name]);
|
|
147
|
+
return planValueOfCell(data, ordinal, cell);
|
|
148
|
+
}));
|
|
143
149
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return planValueOfCell(data, ordinal, cell);
|
|
150
|
-
});
|
|
151
|
-
used.rows += 1n;
|
|
152
|
-
lowered.push(cells);
|
|
153
|
-
}
|
|
154
|
-
return lowered;
|
|
155
|
-
},
|
|
156
|
-
catch: (cause) => unsupported(operation, `seed ${relationName}: ${cause instanceof Error ? cause.message : "row refused by the core cell codec"}`)
|
|
157
|
-
});
|
|
158
|
-
if (used.rows > work.rows) {
|
|
159
|
-
return yield* Effect.fail(budget(operation, "seed.rows", used.rows, used.rows, work.rows));
|
|
150
|
+
},
|
|
151
|
+
catch: refused
|
|
152
|
+
});
|
|
153
|
+
if (!state.done)
|
|
154
|
+
yield* Effect.yieldNow;
|
|
160
155
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (!done) {
|
|
166
|
-
yield* Effect.yieldNow;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
156
|
+
}), (state) => Effect.sync(() => {
|
|
157
|
+
if (!state.done)
|
|
158
|
+
state.iterator.return?.();
|
|
159
|
+
}));
|
|
169
160
|
}
|
|
170
161
|
seedOps.push({ kind: "seed", target: relationName, rows });
|
|
171
162
|
}
|
|
@@ -196,9 +187,9 @@ export function makeGenerator(codec, exclusion) {
|
|
|
196
187
|
planTrees.push(yield* parseTree(operation, `plan ${index}`, text));
|
|
197
188
|
}
|
|
198
189
|
const currentSpec = lower(options.schema);
|
|
199
|
-
const identity = yield* codec.schemaIdentity(currentSpec
|
|
190
|
+
const identity = yield* codec.schemaIdentity(currentSpec);
|
|
200
191
|
// Empty-base snapshot is always compiled — empty source is not a shortcut.
|
|
201
|
-
const emptyIdentity = yield* codec.schemaIdentity(EMPTY_SPEC
|
|
192
|
+
const emptyIdentity = yield* codec.schemaIdentity(EMPTY_SPEC);
|
|
202
193
|
const baseSchemaId = repoState.manifest === null ? emptyIdentity.schemaId : repoState.manifest.baseSchemaId;
|
|
203
194
|
const emptySnapshotTree = yield* parseTree(operation, "empty-base snapshot", emptyIdentity.snapshot);
|
|
204
195
|
const snapshotChain = snapshotTrees.length > 0 ? snapshotTrees : [emptySnapshotTree];
|
|
@@ -209,7 +200,7 @@ export function makeGenerator(codec, exclusion) {
|
|
|
209
200
|
plans: planTrees,
|
|
210
201
|
append: null,
|
|
211
202
|
planSet: null
|
|
212
|
-
}
|
|
203
|
+
});
|
|
213
204
|
const previousText = latestSnapshot(repoState);
|
|
214
205
|
const prevSource = previousText === null ? emptyIdentity.snapshot : previousText;
|
|
215
206
|
const parsedPrev = parseTheory(prevSource);
|
|
@@ -268,7 +259,7 @@ export function makeGenerator(codec, exclusion) {
|
|
|
268
259
|
// -------------------------------------------------------------------------
|
|
269
260
|
// generateMigrations
|
|
270
261
|
// -------------------------------------------------------------------------
|
|
271
|
-
function exclusive(operation, directory,
|
|
262
|
+
function exclusive(operation, directory, body) {
|
|
272
263
|
return Effect.uninterruptibleMask((restore) => Effect.scoped(Effect.gen(function* () {
|
|
273
264
|
// L16 `internalAcquireRepositoryLock` registers
|
|
274
265
|
// `RepositoryLock.release` (`logRepositoryLockRelease`)
|
|
@@ -279,14 +270,14 @@ export function makeGenerator(codec, exclusion) {
|
|
|
279
270
|
// release (request: clear `slot.owner` after
|
|
280
271
|
// `joinLockRelease` so `joinPendingIo.andThen(lock.release)`
|
|
281
272
|
// is the one close).
|
|
282
|
-
yield* restore(exclusion.acquire(operation, directory
|
|
273
|
+
yield* restore(exclusion.acquire(operation, directory));
|
|
283
274
|
return yield* restore(body).pipe(Effect.ensuring(joinPendingIo));
|
|
284
275
|
})));
|
|
285
276
|
}
|
|
286
277
|
const generateMigrations = Effect.fn("bumbledb-log.generateMigrations")(function* (options) {
|
|
287
278
|
const operation = "migrations.generate";
|
|
288
279
|
const directory = options.repository.directory;
|
|
289
|
-
return yield* exclusive(operation, directory,
|
|
280
|
+
return yield* exclusive(operation, directory, Effect.gen(function* () {
|
|
290
281
|
yield* ensureDirectory(operation, directory);
|
|
291
282
|
if (options.label !== undefined && !validLabel(options.label)) {
|
|
292
283
|
return yield* Effect.fail(unsupported(operation, `label must be 1..${MAX_LABEL} characters of [a-z0-9-]`));
|
|
@@ -336,7 +327,7 @@ export function makeGenerator(codec, exclusion) {
|
|
|
336
327
|
const label = options.label ?? deriveLabel(analysis.diff.labelTokens);
|
|
337
328
|
const id = planId(sequence, label);
|
|
338
329
|
// Seeds are ingested exactly once, bounded, at generation time.
|
|
339
|
-
const seedOps = yield* lowerSeeds(options.schema.relations, analysis.seedIntents, analysis.diff.seedRelations
|
|
330
|
+
const seedOps = yield* lowerSeeds(options.schema.relations, analysis.seedIntents, analysis.diff.seedRelations);
|
|
340
331
|
const operations = [
|
|
341
332
|
...analysis.diff.operations,
|
|
342
333
|
...seedOps,
|
|
@@ -360,7 +351,7 @@ export function makeGenerator(codec, exclusion) {
|
|
|
360
351
|
plans: analysis.planTrees,
|
|
361
352
|
append: planJson(plan),
|
|
362
353
|
planSet: null
|
|
363
|
-
}
|
|
354
|
+
});
|
|
364
355
|
if (chain.appended === null) {
|
|
365
356
|
return yield* Effect.fail(drift(operation, "the native chain pass did not append the validated plan"));
|
|
366
357
|
}
|
|
@@ -419,7 +410,7 @@ export function makeGenerator(codec, exclusion) {
|
|
|
419
410
|
const checkMigrations = Effect.fn("bumbledb-log.checkMigrations")(function* (options) {
|
|
420
411
|
const operation = "migrations.check";
|
|
421
412
|
const directory = options.repository.directory;
|
|
422
|
-
return yield* exclusive(operation, directory,
|
|
413
|
+
return yield* exclusive(operation, directory, Effect.gen(function* () {
|
|
423
414
|
const analysis = yield* analyze(options);
|
|
424
415
|
if (analysis.diff.requirements.length > 0) {
|
|
425
416
|
return yield* Effect.fail(intentRequired(operation, analysis.diff.requirements));
|