@substrat-run/kernel 0.148.0 → 0.149.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/attachment-sweep.d.ts +208 -0
- package/dist/attachment-sweep.d.ts.map +1 -0
- package/dist/attachment-sweep.js +318 -0
- package/dist/attachment-sweep.js.map +1 -0
- package/dist/index.d.ts +15 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/invocation-line.d.ts +85 -0
- package/dist/invocation-line.d.ts.map +1 -1
- package/dist/invocation-line.js +43 -0
- package/dist/invocation-line.js.map +1 -1
- package/dist/migration-digest.d.ts +56 -0
- package/dist/migration-digest.d.ts.map +1 -1
- package/dist/migration-digest.js +92 -0
- package/dist/migration-digest.js.map +1 -1
- package/dist/migration-fence.d.ts +14 -0
- package/dist/migration-fence.d.ts.map +1 -0
- package/dist/migration-fence.js +515 -0
- package/dist/migration-fence.js.map +1 -0
- package/dist/migration-replay.d.ts +52 -0
- package/dist/migration-replay.d.ts.map +1 -0
- package/dist/migration-replay.js +140 -0
- package/dist/migration-replay.js.map +1 -0
- package/dist/module-migrations.d.ts +3 -3
- package/dist/module-migrations.js +3 -3
- package/dist/peer.d.ts +32 -2
- package/dist/peer.d.ts.map +1 -1
- package/dist/peer.js +99 -3
- package/dist/peer.js.map +1 -1
- package/dist/permission-eval.d.ts +8 -0
- package/dist/permission-eval.d.ts.map +1 -1
- package/dist/permission-eval.js +14 -0
- package/dist/permission-eval.js.map +1 -1
- package/dist/platform-sweep.d.ts +94 -1
- package/dist/platform-sweep.d.ts.map +1 -1
- package/dist/platform-sweep.js +130 -0
- package/dist/platform-sweep.js.map +1 -1
- package/dist/promote-review.d.ts +125 -0
- package/dist/promote-review.d.ts.map +1 -0
- package/dist/promote-review.js +181 -0
- package/dist/promote-review.js.map +1 -0
- package/dist/scope-host.d.ts +204 -42
- package/dist/scope-host.d.ts.map +1 -1
- package/dist/scope-host.js.map +1 -1
- package/dist/scope-store.d.ts +5 -5
- package/dist/scope-store.d.ts.map +1 -1
- package/dist/spine-restore.d.ts +2 -0
- package/dist/spine-restore.d.ts.map +1 -1
- package/dist/spine-restore.js +5 -0
- package/dist/spine-restore.js.map +1 -1
- package/dist/store-driver-releases.d.ts +306 -0
- package/dist/store-driver-releases.d.ts.map +1 -0
- package/dist/store-driver-releases.js +581 -0
- package/dist/store-driver-releases.js.map +1 -0
- package/dist/table-ownership.d.ts +5 -2
- package/dist/table-ownership.d.ts.map +1 -1
- package/dist/table-ownership.js +19 -10
- package/dist/table-ownership.js.map +1 -1
- package/dist/testing.d.ts +2 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +2 -0
- package/dist/testing.js.map +1 -1
- package/dist/upload-link.d.ts +60 -7
- package/dist/upload-link.d.ts.map +1 -1
- package/dist/upload-link.js +189 -25
- package/dist/upload-link.js.map +1 -1
- package/dist/version-migrations.d.ts +63 -1
- package/dist/version-migrations.d.ts.map +1 -1
- package/dist/version-migrations.js +174 -8
- package/dist/version-migrations.js.map +1 -1
- package/dist/vertical-scope-stores.d.ts +9 -9
- package/dist/vertical-scope-stores.d.ts.map +1 -1
- package/dist/vertical-scope-stores.js +29 -29
- package/dist/vertical-scope-stores.js.map +1 -1
- package/package.json +2 -2
- package/dist/store-kind-releases.d.ts +0 -137
- package/dist/store-kind-releases.d.ts.map +0 -1
- package/dist/store-kind-releases.js +0 -252
- package/dist/store-kind-releases.js.map +0 -1
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
* bounded batch at a time, and until it reaches a version the read falls back to that
|
|
22
22
|
* version's manifest. The fallback is only for those rows. A version published by this code
|
|
23
23
|
* is split on the way in.
|
|
24
|
+
* - `migration_digest_derived` (#2339): 1 once `migration_digest` is the one the control plane
|
|
25
|
+
* derives from these rows and the manifest's `doClasses`, never the one the push sent. NULL is
|
|
26
|
+
* a version stored before this, whose digest is still the pushed one: a backfill re-derives
|
|
27
|
+
* those a batch at a time, and a read of one derives it first.
|
|
24
28
|
*/
|
|
25
29
|
import { type DeclaredMigration } from '@substrat-run/contracts';
|
|
26
30
|
import type { SwitchSql } from './system-switch.js';
|
|
@@ -34,7 +38,7 @@ import type { SwitchSql } from './system-switch.js';
|
|
|
34
38
|
* a directory from before #1764 lacks, so the adapters run these statements after their
|
|
35
39
|
* column additions, not in their DDL loop.
|
|
36
40
|
*/
|
|
37
|
-
export declare const VERSION_MIGRATIONS_DDL = "\n CREATE TABLE IF NOT EXISTS vertical_version_migrations (\n version_id TEXT NOT NULL,\n -- The migration's place in the order the host runs them, from 0.\n ordinal INTEGER NOT NULL,\n module_id TEXT NOT NULL,\n -- The module's SqlMigration.version, e.g. 0001-init.\n version TEXT NOT NULL,\n sql TEXT NOT NULL,\n PRIMARY KEY (version_id, ordinal)\n );\n CREATE INDEX IF NOT EXISTS vertical_versions_unsplit\n ON vertical_versions (id) WHERE migrations_split IS NULL;\n";
|
|
41
|
+
export declare const VERSION_MIGRATIONS_DDL = "\n CREATE TABLE IF NOT EXISTS vertical_version_migrations (\n version_id TEXT NOT NULL,\n -- The migration's place in the order the host runs them, from 0.\n ordinal INTEGER NOT NULL,\n module_id TEXT NOT NULL,\n -- The module's SqlMigration.version, e.g. 0001-init.\n version TEXT NOT NULL,\n sql TEXT NOT NULL,\n -- The migration's declared moves and discards (#2322), as JSON { moves?, discards? }.\n -- NULL = it declares none, or was stored before they were carried.\n declarations TEXT,\n PRIMARY KEY (version_id, ordinal)\n );\n CREATE INDEX IF NOT EXISTS vertical_versions_unsplit\n ON vertical_versions (id) WHERE migrations_split IS NULL;\n -- #2339: versions whose migration_digest is still the pushed one, not yet re-derived.\n CREATE INDEX IF NOT EXISTS vertical_versions_underived\n ON vertical_versions (id) WHERE migration_digest_derived IS NULL;\n";
|
|
38
42
|
/** A manifest with its SQL taken out, and the SQL. */
|
|
39
43
|
export interface SplitManifest {
|
|
40
44
|
/** The manifest to store: without `migrations`, or exactly as given when there was nothing to take. */
|
|
@@ -105,4 +109,62 @@ export declare function versionMigrationsOf(db: SwitchSql, versionId: string): {
|
|
|
105
109
|
verticalSlug: string;
|
|
106
110
|
migrations: DeclaredMigration[] | null;
|
|
107
111
|
} | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* The `reason` on a push refused because its `digests.migration` is not the one the control plane
|
|
114
|
+
* derives from the migrations it carries (#2339).
|
|
115
|
+
*/
|
|
116
|
+
export declare const MIGRATION_DIGEST_MISMATCH_REASON = "migration_digest_mismatch";
|
|
117
|
+
/**
|
|
118
|
+
* A version's migration digest as the control plane derives it (#2339): `migrationDigestOf`
|
|
119
|
+
* over the manifest's `doClasses` and the migrations the version stores, with what each
|
|
120
|
+
* declares. A version that stores no migrations to derive it from (`migrations` null), or whose
|
|
121
|
+
* `doClasses` do not read, gets `unheldMigrationDigest`, which equals no other version's.
|
|
122
|
+
*/
|
|
123
|
+
export declare function derivedMigrationDigest(versionId: string, doClasses: unknown, migrations: readonly DeclaredMigration[] | null): Promise<string>;
|
|
124
|
+
/**
|
|
125
|
+
* The migration digest a publish stores (#2339): the one derived from what it stores, never the
|
|
126
|
+
* one pushed. A push that carries its migrations and pushed another digest is refused
|
|
127
|
+
* (`validation_failed`, reason {@link MIGRATION_DIGEST_MISMATCH_REASON}): either its CLI hashes
|
|
128
|
+
* something other than what it sent, or it hashes less than the platform compares. One that
|
|
129
|
+
* carries none is not refused, since nothing can check it, and stores the unheld digest.
|
|
130
|
+
*/
|
|
131
|
+
export declare function publishedMigrationDigest(input: {
|
|
132
|
+
id: string;
|
|
133
|
+
migrationDigest: string;
|
|
134
|
+
manifestJson: string | null;
|
|
135
|
+
migrations: readonly DeclaredMigration[] | null;
|
|
136
|
+
}): Promise<string>;
|
|
137
|
+
/** The two reads that find versions whose digest is not derived yet, answered from `vertical_versions_underived`. */
|
|
138
|
+
export declare const UNDERIVED_IDS_SQL = "SELECT id FROM vertical_versions WHERE migration_digest_derived IS NULL ORDER BY id LIMIT ?";
|
|
139
|
+
export declare const UNDERIVED_PROBE_SQL = "SELECT 1 AS present FROM vertical_versions WHERE migration_digest_derived IS NULL LIMIT 1";
|
|
140
|
+
/**
|
|
141
|
+
* Derive one stored version's migration digest from its stored rows and record it (#2339),
|
|
142
|
+
* unless it is derived already. Returns the digest the version now holds, or undefined when
|
|
143
|
+
* there is no such version.
|
|
144
|
+
*
|
|
145
|
+
* Two statements, not a transaction: the digest is computed between them (Web Crypto is
|
|
146
|
+
* asynchronous), and the write is guarded on the row still being underived, so two derivations
|
|
147
|
+
* racing write once. A version's migrations and `doClasses` never change after it is published,
|
|
148
|
+
* so both derive the same value, and what was read is what is recorded.
|
|
149
|
+
*/
|
|
150
|
+
export declare function deriveVersionMigrationDigest(db: SwitchSql, versionId: string): Promise<string | undefined>;
|
|
151
|
+
/**
|
|
152
|
+
* Re-derive the next versions stored before #2339, whose migration digest is still the one their
|
|
153
|
+
* push sent: at most `limit` of them. Returns how many it derived, and whether any are left.
|
|
154
|
+
* Resumable and idempotent on #1764's terms: each version is marked as it is derived, and a
|
|
155
|
+
* derived one is never selected again. Until the backfill reaches a version, a read of it
|
|
156
|
+
* derives it first (`deriveVersionMigrationDigest`), so no gate compares a pushed digest.
|
|
157
|
+
*/
|
|
158
|
+
export declare function deriveMigrationDigestsBatch(db: SwitchSql, limit?: number): Promise<{
|
|
159
|
+
derived: number;
|
|
160
|
+
more: boolean;
|
|
161
|
+
}>;
|
|
162
|
+
/** Whether any version's migration digest still waits to be derived. One probe of the partial index. */
|
|
163
|
+
export declare function versionsAwaitDigest(db: SwitchSql): boolean;
|
|
164
|
+
/**
|
|
165
|
+
* The promote gate's refusal when the migration digest moved and the change was not acknowledged.
|
|
166
|
+
* A side whose digest is unheld (#2339) is named with why it always asks, so a vertical whose
|
|
167
|
+
* pushes leave their SQL out of the manifest is not surprised that every promote does.
|
|
168
|
+
*/
|
|
169
|
+
export declare function migrationChangeRefusal(outgoing: string, incoming: string): string;
|
|
108
170
|
//# sourceMappingURL=version-migrations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-migrations.d.ts","sourceRoot":"","sources":["../src/version-migrations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"version-migrations.d.ts","sourceRoot":"","sources":["../src/version-migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EASL,KAAK,iBAAiB,EAEvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,+5BAmBlC,CAAC;AAEF,sDAAsD;AACtD,MAAM,WAAW,aAAa;IAC5B,uGAAuG;IACvG,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,yFAAyF;IACzF,UAAU,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC;CACxC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,aAAa,CAkB3G;AAgCD,0GAA0G;AAC1G,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,SAAS,EACb,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,SAAS,iBAAiB,EAAE,GAAG,IAAI,GAC9C,IAAI,CASN;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,wFAAwF,CAAC;AACrH,eAAO,MAAM,iBAAiB,sFAAsF,CAAC;AAIrH;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,QAAkB,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CACzC,EAAE,EAAE,SAAS,EACb,KAAK,GAAE,MAAuB,GAC7B;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAiClC;AAED,wFAAwF;AACx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GAAG,OAAO,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAYjF"}
|
|
@@ -21,8 +21,12 @@
|
|
|
21
21
|
* bounded batch at a time, and until it reaches a version the read falls back to that
|
|
22
22
|
* version's manifest. The fallback is only for those rows. A version published by this code
|
|
23
23
|
* is split on the way in.
|
|
24
|
+
* - `migration_digest_derived` (#2339): 1 once `migration_digest` is the one the control plane
|
|
25
|
+
* derives from these rows and the manifest's `doClasses`, never the one the push sent. NULL is
|
|
26
|
+
* a version stored before this, whose digest is still the pushed one: a backfill re-derives
|
|
27
|
+
* those a batch at a time, and a read of one derives it first.
|
|
24
28
|
*/
|
|
25
|
-
import { deployManifest, storedDeployManifest, } from '@substrat-run/contracts';
|
|
29
|
+
import { declaredMigrationDeclarations, deployManifest, migrationDigestOf, reviewLine, storedDeployManifest, substratError, UNHELD_MIGRATION_DIGEST_PREFIX, unheldMigrationDigest, } from '@substrat-run/contracts';
|
|
26
30
|
/**
|
|
27
31
|
* The table, and the index the backfill walks. Interpolated into both adapters' directory DDL,
|
|
28
32
|
* so `lint:spine-ddl` sees one spelling on each side. Anything that references this table or
|
|
@@ -42,10 +46,16 @@ export const VERSION_MIGRATIONS_DDL = `
|
|
|
42
46
|
-- The module's SqlMigration.version, e.g. 0001-init.
|
|
43
47
|
version TEXT NOT NULL,
|
|
44
48
|
sql TEXT NOT NULL,
|
|
49
|
+
-- The migration's declared moves and discards (#2322), as JSON { moves?, discards? }.
|
|
50
|
+
-- NULL = it declares none, or was stored before they were carried.
|
|
51
|
+
declarations TEXT,
|
|
45
52
|
PRIMARY KEY (version_id, ordinal)
|
|
46
53
|
);
|
|
47
54
|
CREATE INDEX IF NOT EXISTS vertical_versions_unsplit
|
|
48
55
|
ON vertical_versions (id) WHERE migrations_split IS NULL;
|
|
56
|
+
-- #2339: versions whose migration_digest is still the pushed one, not yet re-derived.
|
|
57
|
+
CREATE INDEX IF NOT EXISTS vertical_versions_underived
|
|
58
|
+
ON vertical_versions (id) WHERE migration_digest_derived IS NULL;
|
|
49
59
|
`;
|
|
50
60
|
/**
|
|
51
61
|
* Take `migrations` out of a manifest.
|
|
@@ -84,12 +94,43 @@ export function splitManifestMigrations(manifestJson, mode) {
|
|
|
84
94
|
migrations: result.success && result.data !== undefined ? result.data : null,
|
|
85
95
|
};
|
|
86
96
|
}
|
|
97
|
+
/** The `declarations` column of one row: JSON `{ moves?, discards? }`, or NULL when it declares none. */
|
|
98
|
+
function declarationsJson(m) {
|
|
99
|
+
if (!m.moves && !m.discards)
|
|
100
|
+
return null;
|
|
101
|
+
return JSON.stringify({ ...(m.moves ? { moves: m.moves } : {}), ...(m.discards ? { discards: m.discards } : {}) });
|
|
102
|
+
}
|
|
103
|
+
/** What a stored `declarations` column must parse as: the push boundary's own schema, and nothing else. */
|
|
104
|
+
const storedDeclarations = declaredMigrationDeclarations.strict();
|
|
105
|
+
/**
|
|
106
|
+
* One row's declarations as a `DeclaredMigration`'s spread, or null when the column holds
|
|
107
|
+
* something that is not a declaration — which the caller answers as "not available" for the
|
|
108
|
+
* whole version, never as a list that silently lost what a migration may lose.
|
|
109
|
+
*/
|
|
110
|
+
function declarationsOf(json) {
|
|
111
|
+
if (json === null)
|
|
112
|
+
return {};
|
|
113
|
+
let parsed;
|
|
114
|
+
try {
|
|
115
|
+
parsed = JSON.parse(json);
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
const result = storedDeclarations.safeParse(parsed);
|
|
121
|
+
if (!result.success || (!result.data.moves && !result.data.discards))
|
|
122
|
+
return null;
|
|
123
|
+
return {
|
|
124
|
+
...(result.data.moves ? { moves: result.data.moves } : {}),
|
|
125
|
+
...(result.data.discards ? { discards: result.data.discards } : {}),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
87
128
|
/** Replace one version's migration rows. The caller sets its `migration_count` and `migrations_split`. */
|
|
88
129
|
export function writeVersionMigrations(db, versionId, migrations) {
|
|
89
130
|
db.run('DELETE FROM vertical_version_migrations WHERE version_id = ?', versionId);
|
|
90
131
|
(migrations ?? []).forEach((m, ordinal) => {
|
|
91
|
-
db.run(`INSERT INTO vertical_version_migrations (version_id, ordinal, module_id, version, sql)
|
|
92
|
-
VALUES (?, ?, ?, ?, ?)`, versionId, ordinal, m.moduleId, m.version, m.sql);
|
|
132
|
+
db.run(`INSERT INTO vertical_version_migrations (version_id, ordinal, module_id, version, sql, declarations)
|
|
133
|
+
VALUES (?, ?, ?, ?, ?, ?)`, versionId, ordinal, m.moduleId, m.version, m.sql, declarationsJson(m));
|
|
93
134
|
});
|
|
94
135
|
}
|
|
95
136
|
/**
|
|
@@ -173,15 +214,140 @@ export function versionMigrationsOf(db, versionId) {
|
|
|
173
214
|
}
|
|
174
215
|
if (row.migration_count === null)
|
|
175
216
|
return { verticalSlug: row.vertical_slug, migrations: null };
|
|
176
|
-
const rows = db.all(`SELECT module_id, version, sql FROM vertical_version_migrations
|
|
217
|
+
const rows = db.all(`SELECT module_id, version, sql, declarations FROM vertical_version_migrations
|
|
177
218
|
WHERE version_id = ? ORDER BY ordinal`, versionId);
|
|
178
219
|
// Never a short list: rows that disagree with the count are not the version's migrations.
|
|
179
220
|
if (rows.length !== row.migration_count)
|
|
180
221
|
return { verticalSlug: row.vertical_slug, migrations: null };
|
|
181
|
-
|
|
182
|
-
|
|
222
|
+
const migrations = [];
|
|
223
|
+
for (const r of rows) {
|
|
224
|
+
// Never a list without what a migration declares it may lose (#2322): a row whose
|
|
225
|
+
// declarations do not read makes the whole version "not available".
|
|
226
|
+
const declared = declarationsOf(r.declarations);
|
|
227
|
+
if (declared === null)
|
|
228
|
+
return { verticalSlug: row.vertical_slug, migrations: null };
|
|
183
229
|
// Parsed on the way in (`splitManifestMigrations`), so the brand is the stored value's.
|
|
184
|
-
migrations
|
|
185
|
-
}
|
|
230
|
+
migrations.push({ moduleId: r.module_id, version: r.version, sql: r.sql, ...declared });
|
|
231
|
+
}
|
|
232
|
+
return { verticalSlug: row.vertical_slug, migrations };
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* The `reason` on a push refused because its `digests.migration` is not the one the control plane
|
|
236
|
+
* derives from the migrations it carries (#2339).
|
|
237
|
+
*/
|
|
238
|
+
export const MIGRATION_DIGEST_MISMATCH_REASON = 'migration_digest_mismatch';
|
|
239
|
+
/** The manifest's `doClasses` as the stored parser reads them (absent is `[]`), or null when they do not read. */
|
|
240
|
+
function doClassesOf(raw) {
|
|
241
|
+
const result = storedDeployManifest.shape.doClasses.safeParse(raw);
|
|
242
|
+
return result.success ? result.data : null;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* A version's migration digest as the control plane derives it (#2339): `migrationDigestOf`
|
|
246
|
+
* over the manifest's `doClasses` and the migrations the version stores, with what each
|
|
247
|
+
* declares. A version that stores no migrations to derive it from (`migrations` null), or whose
|
|
248
|
+
* `doClasses` do not read, gets `unheldMigrationDigest`, which equals no other version's.
|
|
249
|
+
*/
|
|
250
|
+
export async function derivedMigrationDigest(versionId, doClasses, migrations) {
|
|
251
|
+
const classes = doClassesOf(doClasses);
|
|
252
|
+
if (migrations === null || classes === null)
|
|
253
|
+
return unheldMigrationDigest(versionId);
|
|
254
|
+
return migrationDigestOf({ doClasses: classes, migrations });
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* The migration digest a publish stores (#2339): the one derived from what it stores, never the
|
|
258
|
+
* one pushed. A push that carries its migrations and pushed another digest is refused
|
|
259
|
+
* (`validation_failed`, reason {@link MIGRATION_DIGEST_MISMATCH_REASON}): either its CLI hashes
|
|
260
|
+
* something other than what it sent, or it hashes less than the platform compares. One that
|
|
261
|
+
* carries none is not refused, since nothing can check it, and stores the unheld digest.
|
|
262
|
+
*/
|
|
263
|
+
export async function publishedMigrationDigest(input) {
|
|
264
|
+
let doClasses;
|
|
265
|
+
if (input.manifestJson !== null) {
|
|
266
|
+
try {
|
|
267
|
+
doClasses = JSON.parse(input.manifestJson)?.doClasses;
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
doClasses = null;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
const derived = await derivedMigrationDigest(input.id, input.manifestJson === null ? null : doClasses, input.migrations);
|
|
274
|
+
if (input.migrations !== null && derived !== input.migrationDigest) {
|
|
275
|
+
throw substratError('validation_failed', `the push's migration digest (${input.migrationDigest}) is not the digest of the migrations it carries ` +
|
|
276
|
+
`(${derived}). The platform derives the digest a promote compares from the migrations and their declared ` +
|
|
277
|
+
'moves and discards itself, so a push must hash exactly those: upgrade to a CLI release whose push digest ' +
|
|
278
|
+
'covers its SQL migrations and their declarations (npm i -g @substrat-run/cli), and push again', { reason: MIGRATION_DIGEST_MISMATCH_REASON });
|
|
279
|
+
}
|
|
280
|
+
return derived;
|
|
281
|
+
}
|
|
282
|
+
/** The two reads that find versions whose digest is not derived yet, answered from `vertical_versions_underived`. */
|
|
283
|
+
export const UNDERIVED_IDS_SQL = 'SELECT id FROM vertical_versions WHERE migration_digest_derived IS NULL ORDER BY id LIMIT ?';
|
|
284
|
+
export const UNDERIVED_PROBE_SQL = 'SELECT 1 AS present FROM vertical_versions WHERE migration_digest_derived IS NULL LIMIT 1';
|
|
285
|
+
/** How many versions one digest batch derives at most. Each reads at most the push's 512 KiB of SQL. */
|
|
286
|
+
const DIGEST_BATCH_VERSIONS = 10;
|
|
287
|
+
/**
|
|
288
|
+
* Derive one stored version's migration digest from its stored rows and record it (#2339),
|
|
289
|
+
* unless it is derived already. Returns the digest the version now holds, or undefined when
|
|
290
|
+
* there is no such version.
|
|
291
|
+
*
|
|
292
|
+
* Two statements, not a transaction: the digest is computed between them (Web Crypto is
|
|
293
|
+
* asynchronous), and the write is guarded on the row still being underived, so two derivations
|
|
294
|
+
* racing write once. A version's migrations and `doClasses` never change after it is published,
|
|
295
|
+
* so both derive the same value, and what was read is what is recorded.
|
|
296
|
+
*/
|
|
297
|
+
export async function deriveVersionMigrationDigest(db, versionId) {
|
|
298
|
+
const row = db.all(`SELECT migration_digest, migration_digest_derived,
|
|
299
|
+
CASE WHEN manifest_json IS NULL THEN 0 ELSE 1 END AS has_manifest,
|
|
300
|
+
CASE WHEN json_valid(manifest_json) THEN json_extract(manifest_json, '$.doClasses') END AS do_classes
|
|
301
|
+
FROM vertical_versions WHERE id = ?`, versionId)[0];
|
|
302
|
+
if (!row)
|
|
303
|
+
return undefined;
|
|
304
|
+
if (row.migration_digest_derived !== null)
|
|
305
|
+
return row.migration_digest;
|
|
306
|
+
let doClasses = null;
|
|
307
|
+
if (row.has_manifest === 1) {
|
|
308
|
+
try {
|
|
309
|
+
// `json_extract` answers an array as its JSON text, and NULL for a manifest without the key.
|
|
310
|
+
doClasses = row.do_classes === null ? undefined : JSON.parse(row.do_classes);
|
|
311
|
+
}
|
|
312
|
+
catch {
|
|
313
|
+
doClasses = null;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
const digest = await derivedMigrationDigest(versionId, doClasses, versionMigrationsOf(db, versionId)?.migrations ?? null);
|
|
317
|
+
db.run('UPDATE vertical_versions SET migration_digest = ?, migration_digest_derived = 1 WHERE id = ? AND migration_digest_derived IS NULL', digest, versionId);
|
|
318
|
+
return digest;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Re-derive the next versions stored before #2339, whose migration digest is still the one their
|
|
322
|
+
* push sent: at most `limit` of them. Returns how many it derived, and whether any are left.
|
|
323
|
+
* Resumable and idempotent on #1764's terms: each version is marked as it is derived, and a
|
|
324
|
+
* derived one is never selected again. Until the backfill reaches a version, a read of it
|
|
325
|
+
* derives it first (`deriveVersionMigrationDigest`), so no gate compares a pushed digest.
|
|
326
|
+
*/
|
|
327
|
+
export async function deriveMigrationDigestsBatch(db, limit = DIGEST_BATCH_VERSIONS) {
|
|
328
|
+
const ids = db.all(UNDERIVED_IDS_SQL, limit);
|
|
329
|
+
for (const { id } of ids)
|
|
330
|
+
await deriveVersionMigrationDigest(db, id);
|
|
331
|
+
return { derived: ids.length, more: versionsAwaitDigest(db) };
|
|
332
|
+
}
|
|
333
|
+
/** Whether any version's migration digest still waits to be derived. One probe of the partial index. */
|
|
334
|
+
export function versionsAwaitDigest(db) {
|
|
335
|
+
return db.all(UNDERIVED_PROBE_SQL).length > 0;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* The promote gate's refusal when the migration digest moved and the change was not acknowledged.
|
|
339
|
+
* A side whose digest is unheld (#2339) is named with why it always asks, so a vertical whose
|
|
340
|
+
* pushes leave their SQL out of the manifest is not surprised that every promote does.
|
|
341
|
+
*/
|
|
342
|
+
export function migrationChangeRefusal(outgoing, incoming) {
|
|
343
|
+
const unheld = [outgoing, incoming]
|
|
344
|
+
.filter((d) => d.startsWith(UNHELD_MIGRATION_DIGEST_PREFIX))
|
|
345
|
+
.map((d) => d.slice(UNHELD_MIGRATION_DIGEST_PREFIX.length));
|
|
346
|
+
return (`promotion changes migrations (${outgoing} → ${incoming}) — acknowledge it explicitly to promote` +
|
|
347
|
+
(unheld.length === 0
|
|
348
|
+
? ''
|
|
349
|
+
: `. ${unheld.length === 1 ? `Version ${reviewLine(unheld[0])} holds` : `Versions ${unheld.map((id) => reviewLine(id)).join(' and ')} hold`} ` +
|
|
350
|
+
'no migrations the platform can compare: the push left them out of the manifest (over the size a manifest ' +
|
|
351
|
+
'carries, or from before manifests carried them), so a promote to or over it always asks for this acknowledgement'));
|
|
186
352
|
}
|
|
187
353
|
//# sourceMappingURL=version-migrations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-migrations.js","sourceRoot":"","sources":["../src/version-migrations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"version-migrations.js","sourceRoot":"","sources":["../src/version-migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EACL,6BAA6B,E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C,CAAC,KAAK,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,UAAU,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG;gBAC7I,2GAA2G;gBAC3G,kHAAkH,CAAC,CACxH,CAAC;AACJ,CAAC"}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import type { SwitchSql } from './system-switch.js';
|
|
2
2
|
/** Interpolated into both adapters' directory DDL, so `lint:spine-ddl` sees one spelling on each side. */
|
|
3
|
-
export declare const VERTICAL_SCOPE_STORES_DDL = "\n CREATE TABLE IF NOT EXISTS vertical_scope_stores (\n vertical_slug TEXT NOT NULL,\n binding TEXT NOT NULL,\n
|
|
3
|
+
export declare const VERTICAL_SCOPE_STORES_DDL = "\n CREATE TABLE IF NOT EXISTS vertical_scope_stores (\n vertical_slug TEXT NOT NULL,\n binding TEXT NOT NULL,\n driver TEXT NOT NULL,\n -- The version that declared the binding first.\n first_version_id TEXT NOT NULL,\n PRIMARY KEY (vertical_slug, binding)\n );\n CREATE TABLE IF NOT EXISTS vertical_scope_store_versions (\n version_id TEXT PRIMARY KEY,\n vertical_slug TEXT NOT NULL,\n -- 0: the manifest could not be read, so the version may declare a store nobody can name.\n readable INTEGER NOT NULL\n );\n CREATE INDEX IF NOT EXISTS vertical_scope_store_versions_slug\n ON vertical_scope_store_versions (vertical_slug, readable);\n -- A vertical every version of which is indexed above.\n CREATE TABLE IF NOT EXISTS vertical_scope_store_indexed (\n vertical_slug TEXT PRIMARY KEY\n );\n";
|
|
4
4
|
/** One declared binding. */
|
|
5
5
|
export interface VerticalScopeStore {
|
|
6
6
|
readonly binding: string;
|
|
7
|
-
readonly
|
|
7
|
+
readonly driver: string;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Index a version `publishVersion` is inserting, in the insert's transaction, after its row. The
|
|
11
|
-
* vertical's older versions are indexed first when it is not marked yet, so a
|
|
11
|
+
* vertical's older versions are indexed first when it is not marked yet, so a driver change is judged
|
|
12
12
|
* against every version, not only those a read reached. Refuses (`conflict`) a binding the vertical
|
|
13
|
-
* already declared as another
|
|
13
|
+
* already declared as another driver, or one declared twice, and then nothing is written.
|
|
14
14
|
*/
|
|
15
15
|
export declare function indexVersionScopeStores(db: SwitchSql, verticalSlug: string, versionId: string, manifestJson: string | null): void;
|
|
16
16
|
/**
|
|
17
17
|
* Every binding any version of the vertical declared, in binding order. An unmarked vertical is
|
|
18
18
|
* indexed first (the caller runs this in one transaction). Refuses (`unavailable`) when a version's
|
|
19
|
-
* manifest cannot be read, or when versions stored before the record
|
|
19
|
+
* manifest cannot be read, or when versions stored before the record moved a binding to another driver: the
|
|
20
20
|
* lifecycle cannot name every store the vertical may hold.
|
|
21
21
|
*/
|
|
22
22
|
export declare function verticalScopeStoresOf(db: SwitchSql, verticalSlug: string): VerticalScopeStore[];
|
|
23
23
|
/**
|
|
24
|
-
* Every vertical whose any version declared a binding of `
|
|
25
|
-
* store scripts a release rollout of the
|
|
24
|
+
* Every vertical whose any version declared a binding of `driver`, with those bindings (#2300): the
|
|
25
|
+
* store scripts a release rollout of the driver reaches, including a vertical whose serving version
|
|
26
26
|
* dropped the store while a pinned or preview scope still runs one that declares it. Every vertical
|
|
27
27
|
* not indexed yet is indexed first (the caller runs this in one transaction).
|
|
28
28
|
*
|
|
29
29
|
* `unreadable` names the verticals that cannot say: a version whose manifest cannot be read, or
|
|
30
|
-
* versions stored before the record that
|
|
30
|
+
* versions stored before the record that moved a binding to another driver. Any of them may declare the driver, so
|
|
31
31
|
* a caller that must reach every script (a rollout) refuses while the list is not empty, rather
|
|
32
32
|
* than leave a script on another release without saying so.
|
|
33
33
|
*/
|
|
34
|
-
export declare function
|
|
34
|
+
export declare function driverDeclarationsOf(db: SwitchSql, driver: string): {
|
|
35
35
|
verticals: {
|
|
36
36
|
vertical: string;
|
|
37
37
|
stores: VerticalScopeStore[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertical-scope-stores.d.ts","sourceRoot":"","sources":["../src/vertical-scope-stores.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,0GAA0G;AAC1G,eAAO,MAAM,yBAAyB,u2BAqBrC,CAAC;AAEF,4BAA4B;AAC5B,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"vertical-scope-stores.d.ts","sourceRoot":"","sources":["../src/vertical-scope-stores.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,0GAA0G;AAC1G,eAAO,MAAM,yBAAyB,u2BAqBrC,CAAC;AAEF,4BAA4B;AAC5B,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAiFD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,SAAS,EACb,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GAAG,IAAI,GAC1B,IAAI,CAGN;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAa/F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,SAAS,EACb,MAAM,EAAE,MAAM,GACb;IAAE,SAAS,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,kBAAkB,EAAE,CAAA;KAAE,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CA6B3F;AAED,uGAAuG;AACvG,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAInF"}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* erasure, the meter) reaches the union of every binding any version declared, which this keeps as
|
|
8
8
|
* a directory table, read by its keys, instead of reading every version's manifest per call.
|
|
9
9
|
*
|
|
10
|
-
* A binding keeps its
|
|
11
|
-
*
|
|
10
|
+
* A binding keeps its driver for the life of its vertical. The driver names the store script, so a
|
|
11
|
+
* binding moved to another driver would point the same name at another script's object, and the union would have
|
|
12
12
|
* to hold both. `publishVersion` refuses it instead (`conflict`), in the transaction that inserts
|
|
13
13
|
* the version: one door, where the push can still be told to pick a new binding name. A manifest
|
|
14
14
|
* that declares one binding twice is refused there too.
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* directory restore from an older dump, leaves its vertical unmarked. Whichever comes first, a read
|
|
20
20
|
* or a publish, then indexes all of the vertical's versions, oldest first, in its own transaction:
|
|
21
21
|
* nothing runs on a constructor's path, a restore needs no backfill of its own, and a publish judges
|
|
22
|
-
* a
|
|
22
|
+
* a driver change against every older version, not only those indexed so far. A version whose manifest
|
|
23
23
|
* cannot be read is marked unreadable, and a read of its vertical refuses: it may declare a store
|
|
24
24
|
* nobody can name.
|
|
25
25
|
*
|
|
@@ -32,7 +32,7 @@ export const VERTICAL_SCOPE_STORES_DDL = `
|
|
|
32
32
|
CREATE TABLE IF NOT EXISTS vertical_scope_stores (
|
|
33
33
|
vertical_slug TEXT NOT NULL,
|
|
34
34
|
binding TEXT NOT NULL,
|
|
35
|
-
|
|
35
|
+
driver TEXT NOT NULL,
|
|
36
36
|
-- The version that declared the binding first.
|
|
37
37
|
first_version_id TEXT NOT NULL,
|
|
38
38
|
PRIMARY KEY (vertical_slug, binding)
|
|
@@ -52,9 +52,9 @@ export const VERTICAL_SCOPE_STORES_DDL = `
|
|
|
52
52
|
`;
|
|
53
53
|
/**
|
|
54
54
|
* The bindings a stored manifest declares, or null when the manifest cannot be read. No manifest
|
|
55
|
-
* declares none. Read for its shape only, `{ binding,
|
|
56
|
-
* whether a
|
|
57
|
-
* hold a
|
|
55
|
+
* declares none. Read for its shape only, `{ binding, driver }` strings as the router reads them:
|
|
56
|
+
* whether a driver is one the platform runs is the push's question, and a record that refused to
|
|
57
|
+
* hold a driver it did not know could not refuse a move away from that driver either.
|
|
58
58
|
*/
|
|
59
59
|
function declaredIn(manifestJson) {
|
|
60
60
|
if (manifestJson === null)
|
|
@@ -75,10 +75,10 @@ function declaredIn(manifestJson) {
|
|
|
75
75
|
return null;
|
|
76
76
|
const declared = [];
|
|
77
77
|
for (const store of stores) {
|
|
78
|
-
const { binding,
|
|
79
|
-
if (typeof binding !== 'string' || typeof
|
|
78
|
+
const { binding, driver } = (store ?? {});
|
|
79
|
+
if (typeof binding !== 'string' || typeof driver !== 'string')
|
|
80
80
|
return null;
|
|
81
|
-
declared.push({ binding,
|
|
81
|
+
declared.push({ binding, driver });
|
|
82
82
|
}
|
|
83
83
|
return declared;
|
|
84
84
|
}
|
|
@@ -90,22 +90,22 @@ function indexOne(db, verticalSlug, versionId, manifestJson) {
|
|
|
90
90
|
// Every binding is judged before any is written, so a refusal writes nothing.
|
|
91
91
|
const fresh = [];
|
|
92
92
|
const seen = new Set();
|
|
93
|
-
for (const { binding,
|
|
93
|
+
for (const { binding, driver } of declared ?? []) {
|
|
94
94
|
if (seen.has(binding)) {
|
|
95
95
|
throw substratError('conflict', `a version of '${verticalSlug}' declares scope store '${binding}' twice`);
|
|
96
96
|
}
|
|
97
97
|
seen.add(binding);
|
|
98
|
-
const [held] = db.all('SELECT
|
|
99
|
-
if (held && held.
|
|
100
|
-
throw substratError('conflict', `scope store '${binding}' of '${verticalSlug}' is a '${held.
|
|
101
|
-
`the life of its vertical: objects of the old
|
|
102
|
-
`Declare the '${
|
|
98
|
+
const [held] = db.all('SELECT driver FROM vertical_scope_stores WHERE vertical_slug = ? AND binding = ?', verticalSlug, binding);
|
|
99
|
+
if (held && held.driver !== driver) {
|
|
100
|
+
throw substratError('conflict', `scope store '${binding}' of '${verticalSlug}' is a '${held.driver}', and a binding keeps its driver for ` +
|
|
101
|
+
`the life of its vertical: objects of the old driver may still hold data under that name. ` +
|
|
102
|
+
`Declare the '${driver}' store under a new binding name`);
|
|
103
103
|
}
|
|
104
104
|
if (!held)
|
|
105
|
-
fresh.push({ binding,
|
|
105
|
+
fresh.push({ binding, driver });
|
|
106
106
|
}
|
|
107
|
-
for (const { binding,
|
|
108
|
-
db.run('INSERT INTO vertical_scope_stores (vertical_slug, binding,
|
|
107
|
+
for (const { binding, driver } of fresh) {
|
|
108
|
+
db.run('INSERT INTO vertical_scope_stores (vertical_slug, binding, driver, first_version_id) VALUES (?, ?, ?, ?)', verticalSlug, binding, driver, versionId);
|
|
109
109
|
}
|
|
110
110
|
db.run('INSERT INTO vertical_scope_store_versions (version_id, vertical_slug, readable) VALUES (?, ?, ?)', versionId, verticalSlug, declared === null ? 0 : 1);
|
|
111
111
|
}
|
|
@@ -123,9 +123,9 @@ function indexVertical(db, verticalSlug) {
|
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
125
|
* Index a version `publishVersion` is inserting, in the insert's transaction, after its row. The
|
|
126
|
-
* vertical's older versions are indexed first when it is not marked yet, so a
|
|
126
|
+
* vertical's older versions are indexed first when it is not marked yet, so a driver change is judged
|
|
127
127
|
* against every version, not only those a read reached. Refuses (`conflict`) a binding the vertical
|
|
128
|
-
* already declared as another
|
|
128
|
+
* already declared as another driver, or one declared twice, and then nothing is written.
|
|
129
129
|
*/
|
|
130
130
|
export function indexVersionScopeStores(db, verticalSlug, versionId, manifestJson) {
|
|
131
131
|
indexVertical(db, verticalSlug);
|
|
@@ -134,7 +134,7 @@ export function indexVersionScopeStores(db, verticalSlug, versionId, manifestJso
|
|
|
134
134
|
/**
|
|
135
135
|
* Every binding any version of the vertical declared, in binding order. An unmarked vertical is
|
|
136
136
|
* indexed first (the caller runs this in one transaction). Refuses (`unavailable`) when a version's
|
|
137
|
-
* manifest cannot be read, or when versions stored before the record
|
|
137
|
+
* manifest cannot be read, or when versions stored before the record moved a binding to another driver: the
|
|
138
138
|
* lifecycle cannot name every store the vertical may hold.
|
|
139
139
|
*/
|
|
140
140
|
export function verticalScopeStoresOf(db, verticalSlug) {
|
|
@@ -147,20 +147,20 @@ export function verticalScopeStoresOf(db, verticalSlug) {
|
|
|
147
147
|
if (db.all('SELECT 1 AS present FROM vertical_scope_store_versions WHERE vertical_slug = ? AND readable = 0 LIMIT 1', verticalSlug).length > 0) {
|
|
148
148
|
throw substratError('unavailable', `a version of '${verticalSlug}' has a manifest that cannot be read, so its scope stores cannot be named`);
|
|
149
149
|
}
|
|
150
|
-
return db.all('SELECT binding,
|
|
150
|
+
return db.all('SELECT binding, driver FROM vertical_scope_stores WHERE vertical_slug = ? ORDER BY binding', verticalSlug).map(({ binding, driver }) => ({ binding, driver }));
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
|
-
* Every vertical whose any version declared a binding of `
|
|
154
|
-
* store scripts a release rollout of the
|
|
153
|
+
* Every vertical whose any version declared a binding of `driver`, with those bindings (#2300): the
|
|
154
|
+
* store scripts a release rollout of the driver reaches, including a vertical whose serving version
|
|
155
155
|
* dropped the store while a pinned or preview scope still runs one that declares it. Every vertical
|
|
156
156
|
* not indexed yet is indexed first (the caller runs this in one transaction).
|
|
157
157
|
*
|
|
158
158
|
* `unreadable` names the verticals that cannot say: a version whose manifest cannot be read, or
|
|
159
|
-
* versions stored before the record that
|
|
159
|
+
* versions stored before the record that moved a binding to another driver. Any of them may declare the driver, so
|
|
160
160
|
* a caller that must reach every script (a rollout) refuses while the list is not empty, rather
|
|
161
161
|
* than leave a script on another release without saying so.
|
|
162
162
|
*/
|
|
163
|
-
export function
|
|
163
|
+
export function driverDeclarationsOf(db, driver) {
|
|
164
164
|
const slugs = db.all('SELECT DISTINCT vertical_slug FROM vertical_versions ORDER BY vertical_slug');
|
|
165
165
|
const unreadable = new Set();
|
|
166
166
|
for (const { vertical_slug } of slugs) {
|
|
@@ -174,11 +174,11 @@ export function kindDeclarationsOf(db, kind) {
|
|
|
174
174
|
for (const { vertical_slug } of db.all('SELECT DISTINCT vertical_slug FROM vertical_scope_store_versions WHERE readable = 0')) {
|
|
175
175
|
unreadable.add(vertical_slug);
|
|
176
176
|
}
|
|
177
|
-
const rows = db.all('SELECT vertical_slug, binding FROM vertical_scope_stores WHERE
|
|
177
|
+
const rows = db.all('SELECT vertical_slug, binding FROM vertical_scope_stores WHERE driver = ? ORDER BY vertical_slug, binding', driver);
|
|
178
178
|
const byVertical = new Map();
|
|
179
179
|
for (const { vertical_slug, binding } of rows) {
|
|
180
180
|
const stores = byVertical.get(vertical_slug) ?? [];
|
|
181
|
-
stores.push({ binding,
|
|
181
|
+
stores.push({ binding, driver });
|
|
182
182
|
byVertical.set(vertical_slug, stores);
|
|
183
183
|
}
|
|
184
184
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertical-scope-stores.js","sourceRoot":"","sources":["../src/vertical-scope-stores.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,0GAA0G;AAC1G,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBxC,CAAC;AAQF;;;;;GAKG;AACH,SAAS,UAAU,CAAC,YAA2B;IAC7C,IAAI,YAAY,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IACrC,IAAI,GAAY,CAAC;IACjB,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;I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GAAG,CACpC,qFAAqF,CACvD,EAAE,CAAC;QACjC,UAAU,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC;IACD,MAAM,IAAI,GAAG,EAAE,CAAC,GAAG,CACjB,2GAA2G,EAC3G,MAAM,CACyC,CAAC;IAClD,MAAM,UAAU,GAAG,IAAI,GAAG,EAAgC,CAAC;IAC3D,KAAK,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC;QAC9C,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;QACnD,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACjC,UAAU,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;IACD,OAAO;QACL,SAAS,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QAC9E,UAAU,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,IAAI,EAAE;KACnC,CAAC;AACJ,CAAC;AAED,uGAAuG;AACvG,MAAM,UAAU,yBAAyB,CAAC,EAAa,EAAE,YAAoB;IAC3E,EAAE,CAAC,GAAG,CAAC,2DAA2D,EAAE,YAAY,CAAC,CAAC;IAClF,EAAE,CAAC,GAAG,CAAC,mEAAmE,EAAE,YAAY,CAAC,CAAC;IAC1F,EAAE,CAAC,GAAG,CAAC,kEAAkE,EAAE,YAAY,CAAC,CAAC;AAC3F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@substrat-run/kernel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.149.0",
|
|
4
4
|
"description": "Substrat kernel contracts and services — pure TypeScript, no platform imports (D-14)",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@substrat-run/contracts": "^0.
|
|
37
|
+
"@substrat-run/contracts": "^0.149.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^22.20.5",
|