@sequenceholdings/orm 2.8.5 → 2.9.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/authoring.cjs.map +1 -1
- package/dist/authoring.d.cts +2 -2
- package/dist/authoring.d.ts +2 -2
- package/dist/authoring.js.map +1 -1
- package/dist/canonical.cjs.map +1 -1
- package/dist/canonical.d.cts +72 -72
- package/dist/canonical.d.ts +72 -72
- package/dist/canonical.js.map +1 -1
- package/dist/cli.cjs +93 -53
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +23 -1
- package/dist/cli.d.ts +23 -1
- package/dist/cli.js +90 -54
- package/dist/cli.js.map +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js.map +1 -1
- package/dist/compiler.cjs +1 -1
- package/dist/compiler.cjs.map +1 -1
- package/dist/compiler.d.cts +2 -2
- package/dist/compiler.d.ts +2 -2
- package/dist/compiler.js +1 -1
- package/dist/compiler.js.map +1 -1
- package/dist/{constants-Dou1RkTo.d.cts → constants-D2o0vK6U.d.cts} +8 -1
- package/dist/{constants-Dou1RkTo.d.ts → constants-D2o0vK6U.d.ts} +8 -1
- package/dist/dynamic-input.d.cts +1 -1
- package/dist/dynamic-input.d.ts +1 -1
- package/dist/index.cjs +44 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -59
- package/dist/index.d.ts +60 -59
- package/dist/index.js +43 -25
- package/dist/index.js.map +1 -1
- package/dist/ir.cjs.map +1 -1
- package/dist/ir.d.cts +73 -73
- package/dist/ir.d.ts +73 -73
- package/dist/ir.js.map +1 -1
- package/dist/predicate-v2.cjs.map +1 -1
- package/dist/predicate-v2.d.cts +1 -1
- package/dist/predicate-v2.d.ts +1 -1
- package/dist/predicate-v2.js.map +1 -1
- package/dist/sdl.cjs.map +1 -1
- package/dist/sdl.d.cts +1 -1
- package/dist/sdl.d.ts +1 -1
- package/dist/sdl.js.map +1 -1
- package/package.json +3 -3
- package/templates/orm-namespace/package.json +2 -1
- package/dist/{definition-DjfC7Lll.d.cts → definition-B99BsOAO.d.cts} +4 -4
- package/dist/{definition-DjfC7Lll.d.ts → definition-B99BsOAO.d.ts} +4 -4
|
@@ -100,5 +100,12 @@ declare function materializedRefreshFunctionName(table: string): string;
|
|
|
100
100
|
* a full refresh never reads a snapshot older than a write it then overwrites.
|
|
101
101
|
*/
|
|
102
102
|
declare function materializeLockKey(schema: string, table: string): string;
|
|
103
|
+
/**
|
|
104
|
+
* Committed copy of the exact operation documents a package registers —
|
|
105
|
+
* GraphQL text and SQL operations already materialized as inert JSON. Atlas
|
|
106
|
+
* recompiles it to check that a registered operation set is what a commit holds.
|
|
107
|
+
*/
|
|
108
|
+
declare const OPERATION_DOCUMENTS_FILE = "operations.documents.json";
|
|
109
|
+
declare const OPERATION_DOCUMENTS_VERSION: 1;
|
|
103
110
|
|
|
104
|
-
export { CELLS_FIELD as C, DEFINITION_FILE_EXTENSIONS as D, HASH_DOMAIN as H, IDENTIFIER_PATTERN as I, MATERIALIZE_ACTOR as M, NAMESPACE_PATTERN as N, ORM_DATA_TOKEN_HEADER as O, QUALIFIED_TABLE_PATTERN as Q, RESERVED_COLUMN_NAMES as R, SYNCED_SOURCE_PATTERN as S, CELL_PARTS as a, type CellPart as b, cellColumnName as c, ORM_SERVICE_DATA_TOKEN_HEADER as d, CAPABILITY_KEY_PATTERN as e, CELL_PART_SUFFIX as f, CLAIM_KEY_PATTERN as g, COLUMN_IDENTIFIER_PATTERN as h, CONSUMER_ROLE_SUFFIX as i, MATERIALIZE_CLAIMS_JSON as j, MAX_DEFINITION_FILE_BYTES as k, MAX_GENERATED_SDL_BYTES as l, MAX_IDENTIFIER_LENGTH as m, MAX_PERSISTED_READ_ROWS as n, MAX_TRACKED_COLUMN_NAME as o, NAMESPACE_CONFIG_FILENAMES as p,
|
|
111
|
+
export { CELLS_FIELD as C, DEFINITION_FILE_EXTENSIONS as D, HASH_DOMAIN as H, IDENTIFIER_PATTERN as I, MATERIALIZE_ACTOR as M, NAMESPACE_PATTERN as N, ORM_DATA_TOKEN_HEADER as O, QUALIFIED_TABLE_PATTERN as Q, RESERVED_COLUMN_NAMES as R, SYNCED_SOURCE_PATTERN as S, CELL_PARTS as a, type CellPart as b, cellColumnName as c, ORM_SERVICE_DATA_TOKEN_HEADER as d, CAPABILITY_KEY_PATTERN as e, CELL_PART_SUFFIX as f, CLAIM_KEY_PATTERN as g, COLUMN_IDENTIFIER_PATTERN as h, CONSUMER_ROLE_SUFFIX as i, MATERIALIZE_CLAIMS_JSON as j, MAX_DEFINITION_FILE_BYTES as k, MAX_GENERATED_SDL_BYTES as l, MAX_IDENTIFIER_LENGTH as m, MAX_PERSISTED_READ_ROWS as n, MAX_TRACKED_COLUMN_NAME as o, NAMESPACE_CONFIG_FILENAMES as p, OPERATION_DOCUMENTS_FILE as q, OPERATION_DOCUMENTS_VERSION as r, ORM_REGISTRATION_MAX_BYTES as s, ORM_SCHEMA_PREFIX as t, RESERVED_TABLE_NAMES as u, consumerRoleName as v, materializeLockKey as w, materializedRefreshFunctionName as x, ormSchemaName as y };
|
|
@@ -100,5 +100,12 @@ declare function materializedRefreshFunctionName(table: string): string;
|
|
|
100
100
|
* a full refresh never reads a snapshot older than a write it then overwrites.
|
|
101
101
|
*/
|
|
102
102
|
declare function materializeLockKey(schema: string, table: string): string;
|
|
103
|
+
/**
|
|
104
|
+
* Committed copy of the exact operation documents a package registers —
|
|
105
|
+
* GraphQL text and SQL operations already materialized as inert JSON. Atlas
|
|
106
|
+
* recompiles it to check that a registered operation set is what a commit holds.
|
|
107
|
+
*/
|
|
108
|
+
declare const OPERATION_DOCUMENTS_FILE = "operations.documents.json";
|
|
109
|
+
declare const OPERATION_DOCUMENTS_VERSION: 1;
|
|
103
110
|
|
|
104
|
-
export { CELLS_FIELD as C, DEFINITION_FILE_EXTENSIONS as D, HASH_DOMAIN as H, IDENTIFIER_PATTERN as I, MATERIALIZE_ACTOR as M, NAMESPACE_PATTERN as N, ORM_DATA_TOKEN_HEADER as O, QUALIFIED_TABLE_PATTERN as Q, RESERVED_COLUMN_NAMES as R, SYNCED_SOURCE_PATTERN as S, CELL_PARTS as a, type CellPart as b, cellColumnName as c, ORM_SERVICE_DATA_TOKEN_HEADER as d, CAPABILITY_KEY_PATTERN as e, CELL_PART_SUFFIX as f, CLAIM_KEY_PATTERN as g, COLUMN_IDENTIFIER_PATTERN as h, CONSUMER_ROLE_SUFFIX as i, MATERIALIZE_CLAIMS_JSON as j, MAX_DEFINITION_FILE_BYTES as k, MAX_GENERATED_SDL_BYTES as l, MAX_IDENTIFIER_LENGTH as m, MAX_PERSISTED_READ_ROWS as n, MAX_TRACKED_COLUMN_NAME as o, NAMESPACE_CONFIG_FILENAMES as p,
|
|
111
|
+
export { CELLS_FIELD as C, DEFINITION_FILE_EXTENSIONS as D, HASH_DOMAIN as H, IDENTIFIER_PATTERN as I, MATERIALIZE_ACTOR as M, NAMESPACE_PATTERN as N, ORM_DATA_TOKEN_HEADER as O, QUALIFIED_TABLE_PATTERN as Q, RESERVED_COLUMN_NAMES as R, SYNCED_SOURCE_PATTERN as S, CELL_PARTS as a, type CellPart as b, cellColumnName as c, ORM_SERVICE_DATA_TOKEN_HEADER as d, CAPABILITY_KEY_PATTERN as e, CELL_PART_SUFFIX as f, CLAIM_KEY_PATTERN as g, COLUMN_IDENTIFIER_PATTERN as h, CONSUMER_ROLE_SUFFIX as i, MATERIALIZE_CLAIMS_JSON as j, MAX_DEFINITION_FILE_BYTES as k, MAX_GENERATED_SDL_BYTES as l, MAX_IDENTIFIER_LENGTH as m, MAX_PERSISTED_READ_ROWS as n, MAX_TRACKED_COLUMN_NAME as o, NAMESPACE_CONFIG_FILENAMES as p, OPERATION_DOCUMENTS_FILE as q, OPERATION_DOCUMENTS_VERSION as r, ORM_REGISTRATION_MAX_BYTES as s, ORM_SCHEMA_PREFIX as t, RESERVED_TABLE_NAMES as u, consumerRoleName as v, materializeLockKey as w, materializedRefreshFunctionName as x, ormSchemaName as y };
|
package/dist/dynamic-input.d.cts
CHANGED
package/dist/dynamic-input.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -205,6 +205,8 @@ function materializedRefreshFunctionName(table) {
|
|
|
205
205
|
function materializeLockKey(schema, table) {
|
|
206
206
|
return `orm:materialize:${schema}.${table}`;
|
|
207
207
|
}
|
|
208
|
+
var OPERATION_DOCUMENTS_FILE = "operations.documents.json";
|
|
209
|
+
var OPERATION_DOCUMENTS_VERSION = 1;
|
|
208
210
|
|
|
209
211
|
// src/errors.ts
|
|
210
212
|
var OrmDefinitionError = class extends Error {
|
|
@@ -7634,6 +7636,42 @@ async function readSnapshot(dir, ordinal) {
|
|
|
7634
7636
|
const path$1 = path.join(dir, MIGRATIONS_DIRNAME, META_DIRNAME, `${pad(ordinal)}.snapshot.json`);
|
|
7635
7637
|
return parseJson(path$1, await readSnapshotText(dir, ordinal));
|
|
7636
7638
|
}
|
|
7639
|
+
async function verifyCommittedLedger(dir, entries) {
|
|
7640
|
+
const firstRequiredSnapshot = entries.length - 2;
|
|
7641
|
+
let previousId3;
|
|
7642
|
+
let previousSnapshotPresent = false;
|
|
7643
|
+
let previousHash = null;
|
|
7644
|
+
for (const [index3, entry] of entries.entries()) {
|
|
7645
|
+
const sql7 = await readMigrationSql(dir, entry);
|
|
7646
|
+
if (checksumOf(sql7) !== entry.checksum) {
|
|
7647
|
+
return `${MIGRATIONS_DIRNAME}/${entry.name}.sql does not match its journal checksum \u2014 committed migrations must not be edited`;
|
|
7648
|
+
}
|
|
7649
|
+
const snapshotText = index3 >= firstRequiredSnapshot ? await readSnapshotText(dir, entry.ordinal) : await readPrunableSnapshotText(dir, entry.ordinal);
|
|
7650
|
+
if (snapshotText !== void 0) {
|
|
7651
|
+
if (checksumOf(snapshotText) !== entry.snapshot_checksum) {
|
|
7652
|
+
return `the snapshot for ${entry.name} does not match its journal checksum \u2014 committed snapshots must not be edited (the next diff builds on it)`;
|
|
7653
|
+
}
|
|
7654
|
+
const snapshot = JSON.parse(snapshotText);
|
|
7655
|
+
if (previousSnapshotPresent && snapshot.prevId !== previousId3) {
|
|
7656
|
+
return `snapshot chain broken at ${entry.name} \u2014 regenerate the workspace with \`seq-studio orm diff\``;
|
|
7657
|
+
}
|
|
7658
|
+
previousId3 = snapshot.id;
|
|
7659
|
+
}
|
|
7660
|
+
previousSnapshotPresent = snapshotText !== void 0;
|
|
7661
|
+
if (entry.previous_content_hash !== previousHash) {
|
|
7662
|
+
return `content-hash chain broken at ${entry.name} \u2014 migrations must be appended in order by \`seq-studio orm diff\``;
|
|
7663
|
+
}
|
|
7664
|
+
previousHash = entry.content_hash;
|
|
7665
|
+
}
|
|
7666
|
+
return void 0;
|
|
7667
|
+
}
|
|
7668
|
+
async function readPrunableSnapshotText(dir, ordinal) {
|
|
7669
|
+
const path$1 = path.join(dir, MIGRATIONS_DIRNAME, META_DIRNAME, `${pad(ordinal)}.snapshot.json`);
|
|
7670
|
+
return promises.readFile(path$1, "utf8").catch((error) => {
|
|
7671
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return void 0;
|
|
7672
|
+
throw error;
|
|
7673
|
+
});
|
|
7674
|
+
}
|
|
7637
7675
|
async function readMigrationSql(dir, entry) {
|
|
7638
7676
|
const path$1 = path.join(dir, MIGRATIONS_DIRNAME, `${entry.name}.sql`);
|
|
7639
7677
|
return promises.readFile(path$1, "utf8").catch(() => {
|
|
@@ -7794,30 +7832,10 @@ async function checkWorkspace({
|
|
|
7794
7832
|
log(`no committed migrations for '${loaded.definition.namespace}' \u2014 run \`seq-studio orm diff\` and commit the result`);
|
|
7795
7833
|
return 1;
|
|
7796
7834
|
}
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
if (checksumOf(sql7) !== entry.checksum) {
|
|
7802
|
-
log(`${MIGRATIONS_DIRNAME}/${entry.name}.sql does not match its journal checksum \u2014 committed migrations must not be edited`);
|
|
7803
|
-
return 1;
|
|
7804
|
-
}
|
|
7805
|
-
const snapshotText = await readSnapshotText(dir, entry.ordinal);
|
|
7806
|
-
if (checksumOf(snapshotText) !== entry.snapshot_checksum) {
|
|
7807
|
-
log(`the snapshot for ${entry.name} does not match its journal checksum \u2014 committed snapshots must not be edited (the next diff builds on it)`);
|
|
7808
|
-
return 1;
|
|
7809
|
-
}
|
|
7810
|
-
const snapshot = JSON.parse(snapshotText);
|
|
7811
|
-
if (entry.ordinal > 1 && snapshot.prevId !== previousId3) {
|
|
7812
|
-
log(`snapshot chain broken at ${entry.name} \u2014 regenerate the workspace with \`seq-studio orm diff\``);
|
|
7813
|
-
return 1;
|
|
7814
|
-
}
|
|
7815
|
-
if (entry.previous_content_hash !== previousHash) {
|
|
7816
|
-
log(`content-hash chain broken at ${entry.name} \u2014 migrations must be appended in order by \`seq-studio orm diff\``);
|
|
7817
|
-
return 1;
|
|
7818
|
-
}
|
|
7819
|
-
previousId3 = snapshot.id;
|
|
7820
|
-
previousHash = entry.content_hash;
|
|
7835
|
+
const broken = await verifyCommittedLedger(dir, workspace.journal.entries);
|
|
7836
|
+
if (broken) {
|
|
7837
|
+
log(broken);
|
|
7838
|
+
return 1;
|
|
7821
7839
|
}
|
|
7822
7840
|
if (tip.content_hash !== loaded.contentHash) {
|
|
7823
7841
|
log(`definitions changed since ${tip.name} \u2014 run \`seq-studio orm diff\` and commit the new migration`);
|
|
@@ -8641,6 +8659,8 @@ exports.NAMESPACE_CONFIG_BRAND = NAMESPACE_CONFIG_BRAND;
|
|
|
8641
8659
|
exports.NAMESPACE_CONFIG_FILE = NAMESPACE_CONFIG_FILE;
|
|
8642
8660
|
exports.NAMESPACE_CONFIG_FILENAMES = NAMESPACE_CONFIG_FILENAMES;
|
|
8643
8661
|
exports.NAMESPACE_PATTERN = NAMESPACE_PATTERN;
|
|
8662
|
+
exports.OPERATION_DOCUMENTS_FILE = OPERATION_DOCUMENTS_FILE;
|
|
8663
|
+
exports.OPERATION_DOCUMENTS_VERSION = OPERATION_DOCUMENTS_VERSION;
|
|
8644
8664
|
exports.ORM_DATA_TOKEN_HEADER = ORM_DATA_TOKEN_HEADER;
|
|
8645
8665
|
exports.ORM_MIGRATION_EXPORT_FILE = ORM_MIGRATION_EXPORT_FILE;
|
|
8646
8666
|
exports.ORM_MIGRATION_EXPORT_MAX_BYTES = ORM_MIGRATION_EXPORT_MAX_BYTES;
|