@hot-updater/plugin-core 1.2.0-rc.6 → 1.2.0-rc.61

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.
Files changed (95) hide show
  1. package/dist/coreApi.d.cts +277 -10
  2. package/dist/coreApi.d.mts +277 -10
  3. package/dist/database/adapter.d.cts +24 -0
  4. package/dist/database/adapter.d.mts +24 -0
  5. package/dist/databaseRows.cjs +4 -2
  6. package/dist/databaseRows.mjs +4 -2
  7. package/dist/engine/core/schema.cjs +253 -6
  8. package/dist/engine/core/schema.d.cts +154 -1
  9. package/dist/engine/core/schema.d.mts +154 -1
  10. package/dist/engine/core/schema.mjs +252 -7
  11. package/dist/engine/createEngine.cjs +1 -2
  12. package/dist/engine/createEngine.d.cts +1 -6
  13. package/dist/engine/createEngine.d.mts +1 -6
  14. package/dist/engine/createEngine.mjs +1 -2
  15. package/dist/engine/database/aggregateBatching.cjs +87 -129
  16. package/dist/engine/database/aggregateBatching.mjs +87 -129
  17. package/dist/engine/database/database.cjs +1 -4
  18. package/dist/engine/database/database.mjs +1 -4
  19. package/dist/engine/database/engineTransaction.cjs +26 -2
  20. package/dist/engine/database/engineTransaction.d.cts +5 -1
  21. package/dist/engine/database/engineTransaction.d.mts +5 -1
  22. package/dist/engine/database/engineTransaction.mjs +26 -2
  23. package/dist/engine/database/fence.cjs +24 -2
  24. package/dist/engine/database/fence.d.cts +4 -1
  25. package/dist/engine/database/fence.d.mts +4 -1
  26. package/dist/engine/database/fence.mjs +24 -3
  27. package/dist/engine/database/kv/kvAdapter.cjs +80 -4
  28. package/dist/engine/database/kv/kvAdapter.mjs +80 -4
  29. package/dist/engine/database/resolveSchema.cjs +6 -3
  30. package/dist/engine/database/resolveSchema.mjs +6 -3
  31. package/dist/engine/database/sql/sqlAdapter.cjs +36 -12
  32. package/dist/engine/database/sql/sqlAdapter.mjs +37 -13
  33. package/dist/engine/database/sql/sqlSchema.cjs +24 -6
  34. package/dist/engine/database/sql/sqlSchema.d.cts +1 -1
  35. package/dist/engine/database/sql/sqlSchema.d.mts +1 -1
  36. package/dist/engine/database/sql/sqlSchema.mjs +24 -6
  37. package/dist/engine/db/coreDatabase.cjs +10 -5
  38. package/dist/engine/db/coreDatabase.d.cts +2 -1
  39. package/dist/engine/db/coreDatabase.d.mts +2 -1
  40. package/dist/engine/db/coreDatabase.mjs +10 -5
  41. package/dist/engine/db/engineMigrator.cjs +45 -17
  42. package/dist/engine/db/engineMigrator.mjs +46 -18
  43. package/dist/engine/db/engineSql.cjs +25 -0
  44. package/dist/engine/db/engineSql.d.cts +13 -1
  45. package/dist/engine/db/engineSql.d.mts +13 -1
  46. package/dist/engine/db/engineSql.mjs +26 -2
  47. package/dist/engine/db/engineSqlMigrator.cjs +60 -21
  48. package/dist/engine/db/engineSqlMigrator.d.cts +2 -0
  49. package/dist/engine/db/engineSqlMigrator.d.mts +2 -0
  50. package/dist/engine/db/engineSqlMigrator.mjs +62 -23
  51. package/dist/engine/db/schemaSettings.cjs +56 -5
  52. package/dist/engine/db/schemaSettings.d.cts +5 -2
  53. package/dist/engine/db/schemaSettings.d.mts +5 -2
  54. package/dist/engine/db/schemaSettings.mjs +55 -6
  55. package/dist/engine/db/settingsMigrator.cjs +113 -15
  56. package/dist/engine/db/settingsMigrator.d.cts +18 -8
  57. package/dist/engine/db/settingsMigrator.d.mts +18 -8
  58. package/dist/engine/db/settingsMigrator.mjs +111 -17
  59. package/dist/engine/db/sqlSchemaState.cjs +136 -0
  60. package/dist/engine/db/sqlSchemaState.mjs +131 -0
  61. package/dist/engine/db/types.d.cts +6 -0
  62. package/dist/engine/db/types.d.mts +6 -0
  63. package/dist/index.cjs +4 -8
  64. package/dist/index.d.cts +7 -8
  65. package/dist/index.d.mts +7 -8
  66. package/dist/index.mjs +5 -6
  67. package/dist/releaseCatalogCompiler.cjs +89 -7
  68. package/dist/releaseCatalogCompiler.d.cts +12 -1
  69. package/dist/releaseCatalogCompiler.d.mts +12 -1
  70. package/dist/releaseCatalogCompiler.mjs +89 -8
  71. package/dist/releaseCatalogMutation.d.cts +8 -2
  72. package/dist/releaseCatalogMutation.d.mts +8 -2
  73. package/dist/serverPlugin/coreReads.d.cts +10 -1
  74. package/dist/serverPlugin/coreReads.d.mts +10 -1
  75. package/dist/serverPlugin/definitions.d.cts +4 -0
  76. package/dist/serverPlugin/definitions.d.mts +4 -0
  77. package/dist/serverPlugin/schema.d.cts +4 -0
  78. package/dist/serverPlugin/schema.d.mts +4 -0
  79. package/dist/types/databaseConfig.d.cts +10 -20
  80. package/dist/types/databaseConfig.d.mts +10 -20
  81. package/dist/types/databaseRows.d.cts +77 -2
  82. package/dist/types/databaseRows.d.mts +77 -2
  83. package/dist/types/index.cjs +3 -0
  84. package/dist/types/index.d.cts +114 -56
  85. package/dist/types/index.d.mts +114 -56
  86. package/dist/types/index.mjs +3 -1
  87. package/dist/types/models.d.cts +9 -1
  88. package/dist/types/models.d.mts +9 -1
  89. package/dist/types/public.d.cts +3 -3
  90. package/dist/types/public.d.mts +3 -3
  91. package/package.json +3 -9
  92. package/dist/remoteBundleSigning.cjs +0 -357
  93. package/dist/remoteBundleSigning.d.cts +0 -38
  94. package/dist/remoteBundleSigning.d.mts +0 -38
  95. package/dist/remoteBundleSigning.mjs +0 -352
@@ -0,0 +1,136 @@
1
+ const require_schema = require("../core/schema.cjs");
2
+ const require_fence = require("../database/fence.cjs");
3
+ const require_sqlSchema = require("../database/sql/sqlSchema.cjs");
4
+ //#region src/engine/db/sqlSchemaState.ts
5
+ /** Each table, and the index tables of its multi-valued indexes. */
6
+ const flattenShapes = (shapes) => shapes.flatMap((shape) => [shape, ...flattenShapes(shape.indexes.flatMap((index) => index.kind === "table" ? [index.table] : []))]);
7
+ /** Every table the target declares, settings table included, as the DDL creates it. */
8
+ const targetShapes = (dialect, schema, tablePrefix = "") => flattenShapes(require_sqlSchema.sqlTableShapes(dialect, [...schema.tables, require_fence.SETTINGS_TABLE], tablePrefix));
9
+ /** PostgreSQL's identifier limit, NAMEDATALEN - 1 bytes. */
10
+ const POSTGRES_NAME_BYTES = 63;
11
+ /** A name as PostgreSQL stores it: cut to its limit on a character boundary. */
12
+ const postgresName = (name) => {
13
+ const encoder = new TextEncoder();
14
+ let bytes = 0;
15
+ let cut = "";
16
+ for (const character of name) {
17
+ bytes += encoder.encode(character).length;
18
+ if (bytes > POSTGRES_NAME_BYTES) break;
19
+ cut += character;
20
+ }
21
+ return cut;
22
+ };
23
+ /**
24
+ * A name as the catalog reports it, so declared and stored names compare.
25
+ * PostgreSQL cuts a longer name to its limit. MySQL compares index names,
26
+ * and with lower_case_table_names table names, without case, and reports
27
+ * them folded.
28
+ */
29
+ const fold = (dialect, name) => dialect === "mysql" ? String(name).toLowerCase() : dialect === "postgresql" ? postgresName(String(name)) : String(name);
30
+ const CATALOG = {
31
+ postgresql: {
32
+ tables: "SELECT c.relname AS t FROM pg_class c WHERE c.relkind IN ('r', 'p') AND pg_table_is_visible(c.oid)",
33
+ indexes: "SELECT t.relname AS t, c.relname AS i FROM pg_index x JOIN pg_class c ON c.oid = x.indexrelid JOIN pg_class t ON t.oid = x.indrelid WHERE pg_table_is_visible(t.oid)",
34
+ columns: "SELECT c.relname AS t, a.attname AS c FROM pg_attribute a JOIN pg_class c ON c.oid = a.attrelid WHERE c.relkind IN ('r', 'p') AND a.attnum > 0 AND NOT a.attisdropped AND pg_table_is_visible(c.oid)"
35
+ },
36
+ mysql: {
37
+ tables: "SELECT TABLE_NAME AS t FROM information_schema.tables WHERE TABLE_SCHEMA = DATABASE()",
38
+ indexes: "SELECT DISTINCT TABLE_NAME AS t, INDEX_NAME AS i FROM information_schema.statistics WHERE TABLE_SCHEMA = DATABASE()",
39
+ columns: "SELECT TABLE_NAME AS t, COLUMN_NAME AS c FROM information_schema.columns WHERE TABLE_SCHEMA = DATABASE()"
40
+ },
41
+ sqlite: {
42
+ tables: "SELECT name AS t FROM sqlite_master WHERE type = 'table'",
43
+ indexes: "SELECT tbl_name AS t, name AS i FROM sqlite_master WHERE type = 'index'",
44
+ columns: "SELECT m.name AS t, p.name AS c FROM sqlite_master m JOIN pragma_table_info(m.name) p WHERE m.type = 'table'"
45
+ }
46
+ };
47
+ /** Reads which tables, indexes and columns exist: three catalog reads. */
48
+ const readSqlSchemaState = async (executor) => {
49
+ const { dialect } = executor;
50
+ const read = (sql) => executor.execute({
51
+ sql,
52
+ params: []
53
+ });
54
+ const [tables, indexes, columns] = await Promise.all([
55
+ read(CATALOG[dialect].tables),
56
+ read(CATALOG[dialect].indexes),
57
+ read(CATALOG[dialect].columns)
58
+ ]);
59
+ const columnNames = new Set(columns.rows.map(({ t, c }) => JSON.stringify([fold(dialect, t), fold(dialect, c)])));
60
+ const tableNames = new Set(tables.rows.map(({ t }) => fold(dialect, t)));
61
+ const indexNames = new Set(indexes.rows.map(({ t, i }) => JSON.stringify([fold(dialect, t), fold(dialect, i)])));
62
+ return {
63
+ hasTable: (table) => tableNames.has(fold(dialect, table)),
64
+ hasIndex: (table, index) => indexNames.has(JSON.stringify([fold(dialect, table), fold(dialect, index)])),
65
+ hasColumn: (table, column) => columnNames.has(JSON.stringify([fold(dialect, table), fold(dialect, column)]))
66
+ };
67
+ };
68
+ /**
69
+ * The declared tables, indexes and late columns the database lacks. An index
70
+ * on a late column is missing too while the column is.
71
+ */
72
+ const missingSqlSchema = (shapes, state, tablePrefix = "") => ({
73
+ columns: require_schema.LATE_COLUMNS.flatMap(({ table, column }) => {
74
+ const shape = shapes.find(({ name }) => name === tablePrefix + table);
75
+ const declared = shape?.columns.find(({ name }) => name === column);
76
+ return shape === void 0 || declared === void 0 || !state.hasTable(shape.name) || state.hasColumn(shape.name, column) ? [] : [{
77
+ table: shape.name,
78
+ column: declared
79
+ }];
80
+ }),
81
+ tables: shapes.filter((shape) => !state.hasTable(shape.name)).map((shape) => shape.name),
82
+ indexes: shapes.filter((shape) => state.hasTable(shape.name)).flatMap((shape) => shape.indexes.flatMap((index) => index.kind === "index" && !state.hasIndex(shape.name, index.name) ? [{
83
+ table: shape.name,
84
+ index: index.name
85
+ }] : []))
86
+ });
87
+ /** The collation a column's DDL type declares, such as `C` or `utf8mb4_0900_bin`. */
88
+ const declaredCollation = (type) => /COLLATE "?([\w]+)"?/u.exec(type)?.[1];
89
+ const COLLATIONS = {
90
+ postgresql: "SELECT c.relname AS t, a.attname AS c, co.collname AS k FROM pg_attribute a JOIN pg_class c ON c.oid = a.attrelid JOIN pg_collation co ON co.oid = a.attcollation WHERE c.relkind IN ('r', 'p') AND a.attnum > 0 AND NOT a.attisdropped AND pg_table_is_visible(c.oid)",
91
+ mysql: "SELECT TABLE_NAME AS t, COLUMN_NAME AS c, COLLATION_NAME AS k FROM information_schema.columns WHERE TABLE_SCHEMA = DATABASE() AND COLLATION_NAME IS NOT NULL"
92
+ };
93
+ /**
94
+ * The statements that set the collation an ORM cannot declare on each column
95
+ * `collate` selects whose stored collation differs, one per table: PostgreSQL
96
+ * `ALTER COLUMN … TYPE`, MySQL `MODIFY`. One catalog read; none on SQLite,
97
+ * whose text compares by bytes already.
98
+ */
99
+ const collationStatements = async (executor, shapes, collate) => {
100
+ const { dialect } = executor;
101
+ if (dialect === "sqlite") return {
102
+ statements: [],
103
+ columns: 0
104
+ };
105
+ const { rows } = await executor.execute({
106
+ sql: COLLATIONS[dialect],
107
+ params: []
108
+ });
109
+ const stored = new Map(rows.map(({ t, c, k }) => [JSON.stringify([fold(dialect, t), fold(dialect, c)]), String(k)]));
110
+ const quote = (name) => require_sqlSchema.quoteSql(dialect, name);
111
+ let columns = 0;
112
+ return {
113
+ statements: shapes.flatMap((shape) => {
114
+ const changes = shape.columns.filter((column) => {
115
+ const expected = declaredCollation(column.type);
116
+ return expected !== void 0 && collate(column) && stored.get(JSON.stringify([fold(dialect, shape.name), fold(dialect, column.name)])) !== expected;
117
+ }).map((column) => dialect === "postgresql" ? `ALTER COLUMN ${quote(column.name)} TYPE ${column.type}` : `MODIFY ${quote(column.name)} ${column.type}${column.notNull ? " NOT NULL" : " NULL"}`);
118
+ columns += changes.length;
119
+ return changes.length === 0 ? [] : [`ALTER TABLE ${quote(shape.name)} ${changes.join(", ")}`];
120
+ }),
121
+ columns
122
+ };
123
+ };
124
+ /**
125
+ * `ALTER TABLE … ADD COLUMN` for each late column a table lacks, which run
126
+ * before the statements that create the table's indexes. Each is nullable,
127
+ * so rows written before it read as null.
128
+ */
129
+ const addColumnStatements = (dialect, columns) => columns.map(({ table, column }) => `ALTER TABLE ${require_sqlSchema.quoteSql(dialect, table)} ADD COLUMN ${require_sqlSchema.quoteSql(dialect, column.name)} ${column.type}`);
130
+ //#endregion
131
+ exports.addColumnStatements = addColumnStatements;
132
+ exports.collationStatements = collationStatements;
133
+ exports.flattenShapes = flattenShapes;
134
+ exports.missingSqlSchema = missingSqlSchema;
135
+ exports.readSqlSchemaState = readSqlSchemaState;
136
+ exports.targetShapes = targetShapes;
@@ -0,0 +1,131 @@
1
+ import { LATE_COLUMNS } from "../core/schema.mjs";
2
+ import { SETTINGS_TABLE } from "../database/fence.mjs";
3
+ import { quoteSql, sqlTableShapes } from "../database/sql/sqlSchema.mjs";
4
+ //#region src/engine/db/sqlSchemaState.ts
5
+ /** Each table, and the index tables of its multi-valued indexes. */
6
+ const flattenShapes = (shapes) => shapes.flatMap((shape) => [shape, ...flattenShapes(shape.indexes.flatMap((index) => index.kind === "table" ? [index.table] : []))]);
7
+ /** Every table the target declares, settings table included, as the DDL creates it. */
8
+ const targetShapes = (dialect, schema, tablePrefix = "") => flattenShapes(sqlTableShapes(dialect, [...schema.tables, SETTINGS_TABLE], tablePrefix));
9
+ /** PostgreSQL's identifier limit, NAMEDATALEN - 1 bytes. */
10
+ const POSTGRES_NAME_BYTES = 63;
11
+ /** A name as PostgreSQL stores it: cut to its limit on a character boundary. */
12
+ const postgresName = (name) => {
13
+ const encoder = new TextEncoder();
14
+ let bytes = 0;
15
+ let cut = "";
16
+ for (const character of name) {
17
+ bytes += encoder.encode(character).length;
18
+ if (bytes > POSTGRES_NAME_BYTES) break;
19
+ cut += character;
20
+ }
21
+ return cut;
22
+ };
23
+ /**
24
+ * A name as the catalog reports it, so declared and stored names compare.
25
+ * PostgreSQL cuts a longer name to its limit. MySQL compares index names,
26
+ * and with lower_case_table_names table names, without case, and reports
27
+ * them folded.
28
+ */
29
+ const fold = (dialect, name) => dialect === "mysql" ? String(name).toLowerCase() : dialect === "postgresql" ? postgresName(String(name)) : String(name);
30
+ const CATALOG = {
31
+ postgresql: {
32
+ tables: "SELECT c.relname AS t FROM pg_class c WHERE c.relkind IN ('r', 'p') AND pg_table_is_visible(c.oid)",
33
+ indexes: "SELECT t.relname AS t, c.relname AS i FROM pg_index x JOIN pg_class c ON c.oid = x.indexrelid JOIN pg_class t ON t.oid = x.indrelid WHERE pg_table_is_visible(t.oid)",
34
+ columns: "SELECT c.relname AS t, a.attname AS c FROM pg_attribute a JOIN pg_class c ON c.oid = a.attrelid WHERE c.relkind IN ('r', 'p') AND a.attnum > 0 AND NOT a.attisdropped AND pg_table_is_visible(c.oid)"
35
+ },
36
+ mysql: {
37
+ tables: "SELECT TABLE_NAME AS t FROM information_schema.tables WHERE TABLE_SCHEMA = DATABASE()",
38
+ indexes: "SELECT DISTINCT TABLE_NAME AS t, INDEX_NAME AS i FROM information_schema.statistics WHERE TABLE_SCHEMA = DATABASE()",
39
+ columns: "SELECT TABLE_NAME AS t, COLUMN_NAME AS c FROM information_schema.columns WHERE TABLE_SCHEMA = DATABASE()"
40
+ },
41
+ sqlite: {
42
+ tables: "SELECT name AS t FROM sqlite_master WHERE type = 'table'",
43
+ indexes: "SELECT tbl_name AS t, name AS i FROM sqlite_master WHERE type = 'index'",
44
+ columns: "SELECT m.name AS t, p.name AS c FROM sqlite_master m JOIN pragma_table_info(m.name) p WHERE m.type = 'table'"
45
+ }
46
+ };
47
+ /** Reads which tables, indexes and columns exist: three catalog reads. */
48
+ const readSqlSchemaState = async (executor) => {
49
+ const { dialect } = executor;
50
+ const read = (sql) => executor.execute({
51
+ sql,
52
+ params: []
53
+ });
54
+ const [tables, indexes, columns] = await Promise.all([
55
+ read(CATALOG[dialect].tables),
56
+ read(CATALOG[dialect].indexes),
57
+ read(CATALOG[dialect].columns)
58
+ ]);
59
+ const columnNames = new Set(columns.rows.map(({ t, c }) => JSON.stringify([fold(dialect, t), fold(dialect, c)])));
60
+ const tableNames = new Set(tables.rows.map(({ t }) => fold(dialect, t)));
61
+ const indexNames = new Set(indexes.rows.map(({ t, i }) => JSON.stringify([fold(dialect, t), fold(dialect, i)])));
62
+ return {
63
+ hasTable: (table) => tableNames.has(fold(dialect, table)),
64
+ hasIndex: (table, index) => indexNames.has(JSON.stringify([fold(dialect, table), fold(dialect, index)])),
65
+ hasColumn: (table, column) => columnNames.has(JSON.stringify([fold(dialect, table), fold(dialect, column)]))
66
+ };
67
+ };
68
+ /**
69
+ * The declared tables, indexes and late columns the database lacks. An index
70
+ * on a late column is missing too while the column is.
71
+ */
72
+ const missingSqlSchema = (shapes, state, tablePrefix = "") => ({
73
+ columns: LATE_COLUMNS.flatMap(({ table, column }) => {
74
+ const shape = shapes.find(({ name }) => name === tablePrefix + table);
75
+ const declared = shape?.columns.find(({ name }) => name === column);
76
+ return shape === void 0 || declared === void 0 || !state.hasTable(shape.name) || state.hasColumn(shape.name, column) ? [] : [{
77
+ table: shape.name,
78
+ column: declared
79
+ }];
80
+ }),
81
+ tables: shapes.filter((shape) => !state.hasTable(shape.name)).map((shape) => shape.name),
82
+ indexes: shapes.filter((shape) => state.hasTable(shape.name)).flatMap((shape) => shape.indexes.flatMap((index) => index.kind === "index" && !state.hasIndex(shape.name, index.name) ? [{
83
+ table: shape.name,
84
+ index: index.name
85
+ }] : []))
86
+ });
87
+ /** The collation a column's DDL type declares, such as `C` or `utf8mb4_0900_bin`. */
88
+ const declaredCollation = (type) => /COLLATE "?([\w]+)"?/u.exec(type)?.[1];
89
+ const COLLATIONS = {
90
+ postgresql: "SELECT c.relname AS t, a.attname AS c, co.collname AS k FROM pg_attribute a JOIN pg_class c ON c.oid = a.attrelid JOIN pg_collation co ON co.oid = a.attcollation WHERE c.relkind IN ('r', 'p') AND a.attnum > 0 AND NOT a.attisdropped AND pg_table_is_visible(c.oid)",
91
+ mysql: "SELECT TABLE_NAME AS t, COLUMN_NAME AS c, COLLATION_NAME AS k FROM information_schema.columns WHERE TABLE_SCHEMA = DATABASE() AND COLLATION_NAME IS NOT NULL"
92
+ };
93
+ /**
94
+ * The statements that set the collation an ORM cannot declare on each column
95
+ * `collate` selects whose stored collation differs, one per table: PostgreSQL
96
+ * `ALTER COLUMN … TYPE`, MySQL `MODIFY`. One catalog read; none on SQLite,
97
+ * whose text compares by bytes already.
98
+ */
99
+ const collationStatements = async (executor, shapes, collate) => {
100
+ const { dialect } = executor;
101
+ if (dialect === "sqlite") return {
102
+ statements: [],
103
+ columns: 0
104
+ };
105
+ const { rows } = await executor.execute({
106
+ sql: COLLATIONS[dialect],
107
+ params: []
108
+ });
109
+ const stored = new Map(rows.map(({ t, c, k }) => [JSON.stringify([fold(dialect, t), fold(dialect, c)]), String(k)]));
110
+ const quote = (name) => quoteSql(dialect, name);
111
+ let columns = 0;
112
+ return {
113
+ statements: shapes.flatMap((shape) => {
114
+ const changes = shape.columns.filter((column) => {
115
+ const expected = declaredCollation(column.type);
116
+ return expected !== void 0 && collate(column) && stored.get(JSON.stringify([fold(dialect, shape.name), fold(dialect, column.name)])) !== expected;
117
+ }).map((column) => dialect === "postgresql" ? `ALTER COLUMN ${quote(column.name)} TYPE ${column.type}` : `MODIFY ${quote(column.name)} ${column.type}${column.notNull ? " NOT NULL" : " NULL"}`);
118
+ columns += changes.length;
119
+ return changes.length === 0 ? [] : [`ALTER TABLE ${quote(shape.name)} ${changes.join(", ")}`];
120
+ }),
121
+ columns
122
+ };
123
+ };
124
+ /**
125
+ * `ALTER TABLE … ADD COLUMN` for each late column a table lacks, which run
126
+ * before the statements that create the table's indexes. Each is nullable,
127
+ * so rows written before it read as null.
128
+ */
129
+ const addColumnStatements = (dialect, columns) => columns.map(({ table, column }) => `ALTER TABLE ${quoteSql(dialect, table)} ADD COLUMN ${quoteSql(dialect, column.name)} ${column.type}`);
130
+ //#endregion
131
+ export { addColumnStatements, collationStatements, flattenShapes, missingSqlSchema, readSqlSchemaState, targetShapes };
@@ -56,6 +56,12 @@ interface Migrator {
56
56
  interface ToolingTarget {
57
57
  readonly schema: ResolvedSchema;
58
58
  readonly settings: SchemaSettings;
59
+ /**
60
+ * The settings keys whose versions only move forward: core's and the
61
+ * official plugins'. A migrator refuses a database that
62
+ * recorded a newer one than `settings` instead of writing it back.
63
+ */
64
+ readonly ordered?: readonly string[];
59
65
  }
60
66
  type SchemaGenerator = (version: string | "latest", name?: string, target?: ToolingTarget) => {
61
67
  code: string;
@@ -56,6 +56,12 @@ interface Migrator {
56
56
  interface ToolingTarget {
57
57
  readonly schema: ResolvedSchema;
58
58
  readonly settings: SchemaSettings;
59
+ /**
60
+ * The settings keys whose versions only move forward: core's and the
61
+ * official plugins'. A migrator refuses a database that
62
+ * recorded a newer one than `settings` instead of writing it back.
63
+ */
64
+ readonly ordered?: readonly string[];
59
65
  }
60
66
  type SchemaGenerator = (version: string | "latest", name?: string, target?: ToolingTarget) => {
61
67
  code: string;
package/dist/index.cjs CHANGED
@@ -14,7 +14,6 @@ const require_uuidv7 = require("./uuidv7.cjs");
14
14
  const require_releaseCatalogCompiler = require("./releaseCatalogCompiler.cjs");
15
15
  const require_releaseManagement = require("./releaseManagement.cjs");
16
16
  const require_releaseCatalogMutation = require("./releaseCatalogMutation.cjs");
17
- const require_remoteBundleSigning = require("./remoteBundleSigning.cjs");
18
17
  const require_semverSatisfies = require("./semverSatisfies.cjs");
19
18
  const require_databaseConfig = require("./types/databaseConfig.cjs");
20
19
  const require_index = require("./types/index.cjs");
@@ -31,10 +30,10 @@ const require_memoryAdapter = require("./database/memoryAdapter.cjs");
31
30
  const require_verifyAdapter = require("./database/verifyAdapter.cjs");
32
31
  const require_fence = require("./engine/database/fence.cjs");
33
32
  const require_readMeter = require("./engine/database/readMeter.cjs");
34
- const require_schemaSettings = require("./engine/db/schemaSettings.cjs");
35
33
  const require_sqlSchema = require("./engine/database/sql/sqlSchema.cjs");
36
34
  const require_engineSql = require("./engine/db/engineSql.cjs");
37
35
  const require_settingsMigrator = require("./engine/db/settingsMigrator.cjs");
36
+ const require_schemaSettings = require("./engine/db/schemaSettings.cjs");
38
37
  const require_coreDatabase = require("./engine/db/coreDatabase.cjs");
39
38
  const require_createEngine = require("./engine/createEngine.cjs");
40
39
  const require_kvAdapter = require("./engine/database/kv/kvAdapter.cjs");
@@ -59,10 +58,6 @@ exports.DatabaseSchemaError = require_adapter.DatabaseSchemaError;
59
58
  exports.DatabaseTransactionError = require_errors.DatabaseTransactionError;
60
59
  exports.HotUpdaterConfigError = require_configError.HotUpdaterConfigError;
61
60
  exports.HotUpdaterSchemaMigrationRequiredError = require_fence.HotUpdaterSchemaMigrationRequiredError;
62
- exports.REMOTE_BUNDLE_SIGNING_ALGORITHM = require_remoteBundleSigning.REMOTE_BUNDLE_SIGNING_ALGORITHM;
63
- exports.REMOTE_BUNDLE_SIGNING_PATH = require_remoteBundleSigning.REMOTE_BUNDLE_SIGNING_PATH;
64
- exports.REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION = require_remoteBundleSigning.REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION;
65
- exports.REMOTE_BUNDLE_SIGNING_TOKEN_HEADER = require_remoteBundleSigning.REMOTE_BUNDLE_SIGNING_TOKEN_HEADER;
66
61
  exports.ReleaseCatalogCompilationError = require_releaseCatalogCompiler.ReleaseCatalogCompilationError;
67
62
  exports.ReleaseCatalogMutationError = require_releaseCatalogMutation.ReleaseCatalogMutationError;
68
63
  exports.ReleaseManagementError = require_releaseManagement.ReleaseManagementError;
@@ -85,7 +80,6 @@ exports.coreSchema = require_coreDatabase.coreSchema;
85
80
  exports.coreSettings = require_coreDatabase.coreSettings;
86
81
  exports.coreTarget = require_coreDatabase.coreTarget;
87
82
  exports.countDistinct = require_distinct.countDistinct;
88
- exports.createBundleSigningHandler = require_remoteBundleSigning.createBundleSigningHandler;
89
83
  exports.createBundleStorageKey = require_bundleStorageLayout.createBundleStorageKey;
90
84
  exports.createEngine = require_createEngine.createEngine;
91
85
  exports.createEngineDatabase = require_coreDatabase.createEngineDatabase;
@@ -132,6 +126,7 @@ Object.defineProperty(exports, "isUUIDv7", {
132
126
  return _hot_updater_protocol.isUUIDv7;
133
127
  }
134
128
  });
129
+ exports.lateColumnStatements = require_engineSql.lateColumnStatements;
135
130
  exports.mergeDistinct = require_distinct.mergeDistinct;
136
131
  exports.meterReads = require_readMeter.meterReads;
137
132
  exports.migrateCoreSchema = require_coreDatabase.migrateCoreSchema;
@@ -141,11 +136,12 @@ exports.parseStorageUri = require_parseStorageUri.parseStorageUri;
141
136
  exports.projectCompiledCatalog = require_releaseCatalogCompiler.projectCompiledCatalog;
142
137
  exports.projectCompiledRollbackCatalog = require_releaseCatalogCompiler.projectCompiledRollbackCatalog;
143
138
  exports.quoteSql = require_sqlSchema.quoteSql;
139
+ exports.readCompiledCatalogPayload = require_releaseCatalogCompiler.readCompiledCatalogPayload;
144
140
  exports.referenceCompatibleReleases = require_releaseCatalogCompiler.referenceCompatibleReleases;
145
141
  exports.releaseRowToRelease = require_databaseRows.releaseRowToRelease;
146
142
  exports.releaseToRow = require_databaseRows.releaseToRow;
147
- exports.remoteSigning = require_remoteBundleSigning.remoteSigning;
148
143
  exports.replaceStorageUriKeySuffix = require_assetStorageLayout.replaceStorageUriKeySuffix;
144
+ exports.resolveLazy = require_index.resolveLazy;
149
145
  exports.resolveManifestAssetStorageFileHash = require_assetStorageLayout.resolveManifestAssetStorageFileHash;
150
146
  exports.resolveManifestAssetStorageUri = require_assetStorageLayout.resolveManifestAssetStorageUri;
151
147
  exports.rowKey = require_adapter.rowKey;
package/dist/index.d.cts CHANGED
@@ -2,8 +2,8 @@ import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWith
2
2
  import { createStorageUriWithRelativePath, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri } from "./assetStorageLayout.cjs";
3
3
  import { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath, isContentAddressedAssetFileHash } from "./contentAddressedAssets.cjs";
4
4
  import { getContentType } from "./contentType.cjs";
5
- import { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases } from "./releaseCatalogCompiler.cjs";
6
- import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, NativeBuildArtifactKind, NativeBuildRow, NativeBuildSubmissionDestination, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.cjs";
5
+ import { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, readCompiledCatalogPayload, referenceCompatibleReleases } from "./releaseCatalogCompiler.cjs";
6
+ import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, IosDeviceRow, IosDeviceStatus, NativeBuildArtifactKind, NativeBuildExportMethod, NativeBuildRow, NativeBuildSubmissionDestination, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.cjs";
7
7
  import { CoreReads, ReleaseCatalogRequest } from "./serverPlugin/coreReads.cjs";
8
8
  import { DATABASE_VERSION_COLUMN, DatabaseAdapter, DatabaseJson, DatabaseKey, DatabaseKeyValue, DatabaseSchemaError, DatabaseValue, PhysicalColumn, PhysicalColumnType, PhysicalIndex, PhysicalRetention, PhysicalTable, QueryBound, QueryRequest, StoredRow, WriteGuard, WriteOp, WriteResult, expiresAt, findPhysicalColumn, findPhysicalIndex, indexOrderColumns, rowKey } from "./database/adapter.cjs";
9
9
  import { FieldDefinition, FieldReference, FieldType, IndexDefinition, ReferenceAction } from "./serverPlugin/definitions.cjs";
@@ -17,11 +17,11 @@ import { RetryOptions } from "./engine/database/engineTransaction.cjs";
17
17
  import { AggregateBatching, ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./types/databaseConfig.cjs";
18
18
  import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.cjs";
19
19
  import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./types/databaseOperations.cjs";
20
- import { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult } from "./types/models.cjs";
21
- import { ApplePlatform, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, Bundle, BundleSigningAdapter, ConfigInput, FingerprintExtraSources, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, Platform, PlatformConfig, SecretsAdapter, SecretsContext, SigningConfig, StorageAdapter, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePutInput, StoragePutResult, supportedIosPlatforms } from "./types/index.cjs";
20
+ import { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult, NativeBuildMarkResult } from "./types/models.cjs";
21
+ import { ApplePlatform, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, Bundle, ConfigInput, FingerprintExtraSources, IosBuildDestination, Lazy, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NativeBuildSandboxOptions, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, Platform, PlatformConfig, SecretRef, SecretsAdapter, SecretsContext, SigningConfig, StorageAdapter, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePutInput, StoragePutResult, resolveLazy, supportedIosPlatforms } from "./types/index.cjs";
22
22
  import { ReleaseCatalogMutationError, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, ReleaseCatalogScope } from "./releaseCatalogMutation.cjs";
23
23
  import { PromoteReleaseResult, ReleaseManagementError, ReleasePolicyPatch } from "./releaseManagement.cjs";
24
- import { BundleDeployment, BundleDetail, DeployReleasePolicy, Deployment, HotUpdaterCoreApi, KeysetInput, NativeBuildRegistration, NativeBuildScope, ReleaseFilter, ReleaseTarget, StoredBundleDeployment } from "./coreApi.cjs";
24
+ import { BundleDeployment, BundleDetail, DeployReleasePolicy, Deployment, HotUpdaterCoreApi, IosDeviceAccount, IosDeviceAccountClaim, IosDeviceOutcome, IosDeviceOutcomeInput, IosDeviceRequestResult, KeysetInput, NativeBuildDistribution, NativeBuildRegistration, NativeBuildSandboxScope, NativeBuildScope, ReleaseFilter, ReleaseLabelFill, ReleaseTarget, StoredBundleDeployment } from "./coreApi.cjs";
25
25
  import { DatabaseAdapterInputError, DatabaseAdapterInputErrorCode, DatabaseBundleNotFoundError, DatabaseRowReferencedError } from "./databaseErrors.cjs";
26
26
  import { createStorageKeyBuilder } from "./createStorageKeyBuilder.cjs";
27
27
  import { CreateStorageAdapterOptions, StorageAdapterWith, StorageOperation, assertStorageOperations, createStorageAdapter } from "./createStorageAdapter.cjs";
@@ -29,7 +29,6 @@ import { isDatabaseJsonObject, isDatabaseMetadataObject } from "./databaseJsonVa
29
29
  import { BundleRowHydrationError, BundleRowHydrationErrorReason, bundleToPatchRows, bundleToRow, releaseRowToRelease, releaseToRow, rowToBundle, rowsToBundles } from "./databaseRows.cjs";
30
30
  import { generateMinBundleId } from "./generateMinBundleId.cjs";
31
31
  import { CreateStorageUriInput, ParsedStorageUri, createStorageUri, parseStorageUri } from "./parseStorageUri.cjs";
32
- import { BundleSigningHandlerOptions, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, RemoteSigningOptions, createBundleSigningHandler, remoteSigning } from "./remoteBundleSigning.cjs";
33
32
  import { semverSatisfies } from "./semverSatisfies.cjs";
34
33
  import { createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, isUUIDv7 } from "./uuidv7.cjs";
35
34
  import { isDatabaseBusyError } from "./serverPlugin/busy.cjs";
@@ -48,8 +47,8 @@ import { KeyValueStore, KvAdapterOptions, KvCondition, KvItem, KvKey, KvOp, KvRa
48
47
  import { MeteredDatabase, ReadMeasurement, meterReads } from "./engine/database/readMeter.cjs";
49
48
  import { SqlColumnShape, SqlDialect, SqlTableShape, createTableStatements, isMultiIndex, quoteSql, sqlTableShapes } from "./engine/database/sql/sqlSchema.cjs";
50
49
  import { SqlAdapterOptions, SqlConnection, SqlExecutor, SqlResult, SqlStatement, WRITE_GUARD_TABLE, createSqlAdapter } from "./engine/database/sql/sqlAdapter.cjs";
51
- import { EngineSqlOptions, generateEngineSql } from "./engine/db/engineSql.cjs";
50
+ import { EngineSqlOptions, generateEngineSql, lateColumnStatements } from "./engine/db/engineSql.cjs";
52
51
  import { EngineSqlMigratorOptions, createEngineSqlMigrator } from "./engine/db/engineSqlMigrator.cjs";
53
52
  import { writeSchemaSettings } from "./engine/db/schemaSettings.cjs";
54
53
  import { createSettingsMigrator } from "./engine/db/settingsMigrator.cjs";
55
- export { type AggregateBatching, type AggregateChanges, type AggregateDefinition, type AggregateIdentity, type AggregateRow, type AnyHotUpdaterPlugin, ApplePlatform, BUNDLE_STORAGE_PREFIX, type BaseCandidateQuery, type BaseCandidateTarget, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, BuiltIns, type Bundle, type BundleDeployment, type BundleDetail, type BundlePatchRow, type BundleRow, BundleRowHydrationError, BundleRowHydrationErrorReason, type BundleRowUpdate, BundleSigningAdapter, BundleSigningHandlerOptions, CONTENT_ADDRESSED_ASSET_PREFIX, CatalogVersionBound, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ClientAuth, CompiledCatalogSegment, CompiledReleaseCatalog, ConfigInput, type ConfiguredDatabase, type ConstraintReason, type CoreReader, type CoreReads, type CoreSchema, type CreateRow, CreateStorageAdapterOptions, CreateStorageUriInput, DATABASE_VERSION_COLUMN, type DatabaseAdapter, DatabaseAdapterContractError, DatabaseAdapterInputError, type DatabaseAdapterInputErrorCode, DatabaseAmbiguousCommitError, type DatabaseBundleMetadata, DatabaseBundleNotFoundError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, type DatabaseJson, type DatabaseJsonObject, type DatabaseJsonValue, type DatabaseKey, type DatabaseKeyValue, DatabaseQueryError, type DatabaseReadCount, type DatabaseReadMeter, DatabaseRowReferencedError, DatabaseSchemaError, type DatabaseTooling, DatabaseTransactionError, type DatabaseValue, type DeployReleasePolicy, type Deployment, type DerivedDefinition, type DerivedFields, type Engine, type EngineColumns, type EngineDatabase, type EngineDatabaseOptions, type EngineOptions, type EngineReadCount, type EngineSqlMigratorOptions, type EngineSqlOptions, type FieldDefinition, type FieldReference, type FieldType, type FieldValue, type FindAggregatesModel, type FindManyModel, FingerprintExtraSources, HasMultipleCallSignatures, HotUpdaterConfigError, type HotUpdaterCoreApi, type HotUpdaterDatabase, type HotUpdaterPlugin, HotUpdaterSchemaMigrationRequiredError, type HotUpdaterTransaction, type IndexDefinition, IosBuildDestination, type KeyLookup, type KeyValueStore, type KeysetInput, type KvAdapterOptions, type KvCondition, type KvItem, type KvKey, type KvOp, type KvRange, LocalSigningConfig, type Lookup, type MemoryAdapterOptions, type MeteredDatabase, type MigrateOptions, type MigrationResult, type Migrator, type ModelDefinition, type ModuleSchema, NativeBuildAndroidScheme, NativeBuildArgs, type NativeBuildArtifactKind, type NativeBuildDeleteResult, NativeBuildIosScheme, NativeBuildOptions, type NativeBuildRegistration, type NativeBuildRow, type NativeBuildScope, type NativeBuildSubmissionDestination, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, type NormalizeOptions, type Page, ParsedStorageUri, type PhysicalColumn, type PhysicalColumnType, type PhysicalIndex, type PhysicalRetention, type PhysicalTable, type Platform, PlatformConfig, type PluginApis, type PluginCli, type PluginClientCredential, type PluginClientPlugin, type PluginContext, type PluginEndpoint, type PluginEndpointMethod, type PluginInstance, type PluginProvides, type PluginTables, Primitive, PromoteReleaseResult, type QueryBound, type QueryRequest, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, type ReadMeasurement, type ReadOptions, type ReadRow, type ReferenceAction, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, ReleaseCatalogMutationError, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRequest, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, type ReleaseFilter, ReleaseManagementError, ReleasePolicyPatch, type ReleaseRow, type ReleaseRowUpdate, type ReleaseTarget, type RemoteDatabase, RemoteSigningOptions, RequiredDeep, type ResolvedModel, type ResolvedSchema, type RetentionDefinition, type RetryOptions, type RowOf, SETTINGS_TABLE, type SchemaGenerator, type SchemaSettings, SecretsAdapter, SecretsContext, SigningConfig, type SqlAdapterOptions, type SqlColumnShape, type SqlConnection, type SqlDialect, type SqlExecutor, type SqlResult, type SqlStatement, type SqlTableShape, StorageAdapter, StorageAdapterWith, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StorageOperation, StoragePutInput, StoragePutResult, type StoredBundleDeployment, type StoredRow, type TableDefinition, type TableRow, type ToolingDatabase, type ToolingTarget, type UpdateSet, type VerifiedDatabaseAdapter, type VerifyAdapterOptions, WRITE_GUARD_TABLE, type WriteGuard, type WriteOp, type WriteResult, addDistinct, aggregateBatchingTables, assertStorageOperations, bundleToPatchRows, bundleToRow, canonicalizeAppVersion, compareUtf8, compileReleaseCatalog, coreSchema, coreSettings, coreTarget, countDistinct, createBundleSigningHandler, createBundleStorageKey, createEngine, createEngineDatabase, createEngineSqlMigrator, createKvAdapter, createMemoryAdapter, createSettingsMigrator, createSqlAdapter, createStorageAdapter, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createTableStatements, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, defineAggregate, definePlugin, defineTable, encodeKvKey, expiresAt, extractTimestampFromUUIDv7, findPhysicalColumn, findPhysicalIndex, generateEngineSql, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, indexOrderColumns, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBusyError, isDatabaseJsonObject, isDatabaseMetadataObject, isMultiIndex, isRemoteDatabase, isUUIDv7, mergeDistinct, meterReads, migrateCoreSchema, normalizeStoredRow, parseBaseCandidateKey, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, quoteSql, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, remoteSigning, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowKey, rowToBundle, rowsToBundles, semverSatisfies, sqlTableShapes, supportedIosPlatforms, targetBaseCandidateKey, toolingTargetOf, verifyAdapter, writeSchemaSettings };
54
+ export { type AggregateBatching, type AggregateChanges, type AggregateDefinition, type AggregateIdentity, type AggregateRow, type AnyHotUpdaterPlugin, ApplePlatform, BUNDLE_STORAGE_PREFIX, type BaseCandidateQuery, type BaseCandidateTarget, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, BuiltIns, type Bundle, type BundleDeployment, type BundleDetail, type BundlePatchRow, type BundleRow, BundleRowHydrationError, BundleRowHydrationErrorReason, type BundleRowUpdate, CONTENT_ADDRESSED_ASSET_PREFIX, CatalogVersionBound, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ClientAuth, CompiledCatalogSegment, CompiledReleaseCatalog, ConfigInput, type ConfiguredDatabase, type ConstraintReason, type CoreReader, type CoreReads, type CoreSchema, type CreateRow, CreateStorageAdapterOptions, CreateStorageUriInput, DATABASE_VERSION_COLUMN, type DatabaseAdapter, DatabaseAdapterContractError, DatabaseAdapterInputError, type DatabaseAdapterInputErrorCode, DatabaseAmbiguousCommitError, type DatabaseBundleMetadata, DatabaseBundleNotFoundError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, type DatabaseJson, type DatabaseJsonObject, type DatabaseJsonValue, type DatabaseKey, type DatabaseKeyValue, DatabaseQueryError, type DatabaseReadCount, type DatabaseReadMeter, DatabaseRowReferencedError, DatabaseSchemaError, type DatabaseTooling, DatabaseTransactionError, type DatabaseValue, type DeployReleasePolicy, type Deployment, type DerivedDefinition, type DerivedFields, type Engine, type EngineColumns, type EngineDatabase, type EngineDatabaseOptions, type EngineOptions, type EngineReadCount, type EngineSqlMigratorOptions, type EngineSqlOptions, type FieldDefinition, type FieldReference, type FieldType, type FieldValue, type FindAggregatesModel, type FindManyModel, FingerprintExtraSources, HasMultipleCallSignatures, HotUpdaterConfigError, type HotUpdaterCoreApi, type HotUpdaterDatabase, type HotUpdaterPlugin, HotUpdaterSchemaMigrationRequiredError, type HotUpdaterTransaction, type IndexDefinition, IosBuildDestination, type IosDeviceAccount, type IosDeviceAccountClaim, type IosDeviceOutcome, type IosDeviceOutcomeInput, type IosDeviceRequestResult, type IosDeviceRow, type IosDeviceStatus, type KeyLookup, type KeyValueStore, type KeysetInput, type KvAdapterOptions, type KvCondition, type KvItem, type KvKey, type KvOp, type KvRange, Lazy, LocalSigningConfig, type Lookup, type MemoryAdapterOptions, type MeteredDatabase, type MigrateOptions, type MigrationResult, type Migrator, type ModelDefinition, type ModuleSchema, NativeBuildAndroidScheme, NativeBuildArgs, type NativeBuildArtifactKind, type NativeBuildDeleteResult, type NativeBuildDistribution, type NativeBuildExportMethod, NativeBuildIosScheme, type NativeBuildMarkResult, NativeBuildOptions, type NativeBuildRegistration, type NativeBuildRow, NativeBuildSandboxOptions, type NativeBuildSandboxScope, type NativeBuildScope, type NativeBuildSubmissionDestination, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, type NormalizeOptions, type Page, ParsedStorageUri, type PhysicalColumn, type PhysicalColumnType, type PhysicalIndex, type PhysicalRetention, type PhysicalTable, type Platform, PlatformConfig, type PluginApis, type PluginCli, type PluginClientCredential, type PluginClientPlugin, type PluginContext, type PluginEndpoint, type PluginEndpointMethod, type PluginInstance, type PluginProvides, type PluginTables, Primitive, PromoteReleaseResult, type QueryBound, type QueryRequest, type ReadMeasurement, type ReadOptions, type ReadRow, type ReferenceAction, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, ReleaseCatalogMutationError, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRequest, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, type ReleaseFilter, type ReleaseLabelFill, ReleaseManagementError, ReleasePolicyPatch, type ReleaseRow, type ReleaseRowUpdate, type ReleaseTarget, type RemoteDatabase, RequiredDeep, type ResolvedModel, type ResolvedSchema, type RetentionDefinition, type RetryOptions, type RowOf, SETTINGS_TABLE, type SchemaGenerator, type SchemaSettings, SecretRef, SecretsAdapter, SecretsContext, SigningConfig, type SqlAdapterOptions, type SqlColumnShape, type SqlConnection, type SqlDialect, type SqlExecutor, type SqlResult, type SqlStatement, type SqlTableShape, StorageAdapter, StorageAdapterWith, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StorageOperation, StoragePutInput, StoragePutResult, type StoredBundleDeployment, type StoredRow, type TableDefinition, type TableRow, type ToolingDatabase, type ToolingTarget, type UpdateSet, type VerifiedDatabaseAdapter, type VerifyAdapterOptions, WRITE_GUARD_TABLE, type WriteGuard, type WriteOp, type WriteResult, addDistinct, aggregateBatchingTables, assertStorageOperations, bundleToPatchRows, bundleToRow, canonicalizeAppVersion, compareUtf8, compileReleaseCatalog, coreSchema, coreSettings, coreTarget, countDistinct, createBundleStorageKey, createEngine, createEngineDatabase, createEngineSqlMigrator, createKvAdapter, createMemoryAdapter, createSettingsMigrator, createSqlAdapter, createStorageAdapter, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createTableStatements, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, defineAggregate, definePlugin, defineTable, encodeKvKey, expiresAt, extractTimestampFromUUIDv7, findPhysicalColumn, findPhysicalIndex, generateEngineSql, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, indexOrderColumns, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBusyError, isDatabaseJsonObject, isDatabaseMetadataObject, isMultiIndex, isRemoteDatabase, isUUIDv7, lateColumnStatements, mergeDistinct, meterReads, migrateCoreSchema, normalizeStoredRow, parseBaseCandidateKey, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, quoteSql, readCompiledCatalogPayload, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, replaceStorageUriKeySuffix, resolveLazy, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowKey, rowToBundle, rowsToBundles, semverSatisfies, sqlTableShapes, supportedIosPlatforms, targetBaseCandidateKey, toolingTargetOf, verifyAdapter, writeSchemaSettings };
package/dist/index.d.mts CHANGED
@@ -2,8 +2,8 @@ import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWith
2
2
  import { createStorageUriWithRelativePath, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri } from "./assetStorageLayout.mjs";
3
3
  import { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath, isContentAddressedAssetFileHash } from "./contentAddressedAssets.mjs";
4
4
  import { getContentType } from "./contentType.mjs";
5
- import { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases } from "./releaseCatalogCompiler.mjs";
6
- import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, NativeBuildArtifactKind, NativeBuildRow, NativeBuildSubmissionDestination, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.mjs";
5
+ import { CatalogVersionBound, CompiledCatalogSegment, CompiledReleaseCatalog, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, readCompiledCatalogPayload, referenceCompatibleReleases } from "./releaseCatalogCompiler.mjs";
6
+ import { BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, IosDeviceRow, IosDeviceStatus, NativeBuildArtifactKind, NativeBuildExportMethod, NativeBuildRow, NativeBuildSubmissionDestination, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.mjs";
7
7
  import { CoreReads, ReleaseCatalogRequest } from "./serverPlugin/coreReads.mjs";
8
8
  import { DATABASE_VERSION_COLUMN, DatabaseAdapter, DatabaseJson, DatabaseKey, DatabaseKeyValue, DatabaseSchemaError, DatabaseValue, PhysicalColumn, PhysicalColumnType, PhysicalIndex, PhysicalRetention, PhysicalTable, QueryBound, QueryRequest, StoredRow, WriteGuard, WriteOp, WriteResult, expiresAt, findPhysicalColumn, findPhysicalIndex, indexOrderColumns, rowKey } from "./database/adapter.mjs";
9
9
  import { FieldDefinition, FieldReference, FieldType, IndexDefinition, ReferenceAction } from "./serverPlugin/definitions.mjs";
@@ -17,11 +17,11 @@ import { RetryOptions } from "./engine/database/engineTransaction.mjs";
17
17
  import { AggregateBatching, ConfiguredDatabase, EngineDatabase, RemoteDatabase, isRemoteDatabase } from "./types/databaseConfig.mjs";
18
18
  import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.mjs";
19
19
  import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./types/databaseOperations.mjs";
20
- import { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult } from "./types/models.mjs";
21
- import { ApplePlatform, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, Bundle, BundleSigningAdapter, ConfigInput, FingerprintExtraSources, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, Platform, PlatformConfig, SecretsAdapter, SecretsContext, SigningConfig, StorageAdapter, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePutInput, StoragePutResult, supportedIosPlatforms } from "./types/index.mjs";
20
+ import { ChannelDeleteResult, ChannelInsertResult, NativeBuildDeleteResult, NativeBuildMarkResult } from "./types/models.mjs";
21
+ import { ApplePlatform, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, Bundle, ConfigInput, FingerprintExtraSources, IosBuildDestination, Lazy, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NativeBuildSandboxOptions, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, Platform, PlatformConfig, SecretRef, SecretsAdapter, SecretsContext, SigningConfig, StorageAdapter, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePutInput, StoragePutResult, resolveLazy, supportedIosPlatforms } from "./types/index.mjs";
22
22
  import { ReleaseCatalogMutationError, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, ReleaseCatalogScope } from "./releaseCatalogMutation.mjs";
23
23
  import { PromoteReleaseResult, ReleaseManagementError, ReleasePolicyPatch } from "./releaseManagement.mjs";
24
- import { BundleDeployment, BundleDetail, DeployReleasePolicy, Deployment, HotUpdaterCoreApi, KeysetInput, NativeBuildRegistration, NativeBuildScope, ReleaseFilter, ReleaseTarget, StoredBundleDeployment } from "./coreApi.mjs";
24
+ import { BundleDeployment, BundleDetail, DeployReleasePolicy, Deployment, HotUpdaterCoreApi, IosDeviceAccount, IosDeviceAccountClaim, IosDeviceOutcome, IosDeviceOutcomeInput, IosDeviceRequestResult, KeysetInput, NativeBuildDistribution, NativeBuildRegistration, NativeBuildSandboxScope, NativeBuildScope, ReleaseFilter, ReleaseLabelFill, ReleaseTarget, StoredBundleDeployment } from "./coreApi.mjs";
25
25
  import { DatabaseAdapterInputError, DatabaseAdapterInputErrorCode, DatabaseBundleNotFoundError, DatabaseRowReferencedError } from "./databaseErrors.mjs";
26
26
  import { createStorageKeyBuilder } from "./createStorageKeyBuilder.mjs";
27
27
  import { CreateStorageAdapterOptions, StorageAdapterWith, StorageOperation, assertStorageOperations, createStorageAdapter } from "./createStorageAdapter.mjs";
@@ -29,7 +29,6 @@ import { isDatabaseJsonObject, isDatabaseMetadataObject } from "./databaseJsonVa
29
29
  import { BundleRowHydrationError, BundleRowHydrationErrorReason, bundleToPatchRows, bundleToRow, releaseRowToRelease, releaseToRow, rowToBundle, rowsToBundles } from "./databaseRows.mjs";
30
30
  import { generateMinBundleId } from "./generateMinBundleId.mjs";
31
31
  import { CreateStorageUriInput, ParsedStorageUri, createStorageUri, parseStorageUri } from "./parseStorageUri.mjs";
32
- import { BundleSigningHandlerOptions, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, RemoteSigningOptions, createBundleSigningHandler, remoteSigning } from "./remoteBundleSigning.mjs";
33
32
  import { semverSatisfies } from "./semverSatisfies.mjs";
34
33
  import { createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, isUUIDv7 } from "./uuidv7.mjs";
35
34
  import { isDatabaseBusyError } from "./serverPlugin/busy.mjs";
@@ -48,8 +47,8 @@ import { KeyValueStore, KvAdapterOptions, KvCondition, KvItem, KvKey, KvOp, KvRa
48
47
  import { MeteredDatabase, ReadMeasurement, meterReads } from "./engine/database/readMeter.mjs";
49
48
  import { SqlColumnShape, SqlDialect, SqlTableShape, createTableStatements, isMultiIndex, quoteSql, sqlTableShapes } from "./engine/database/sql/sqlSchema.mjs";
50
49
  import { SqlAdapterOptions, SqlConnection, SqlExecutor, SqlResult, SqlStatement, WRITE_GUARD_TABLE, createSqlAdapter } from "./engine/database/sql/sqlAdapter.mjs";
51
- import { EngineSqlOptions, generateEngineSql } from "./engine/db/engineSql.mjs";
50
+ import { EngineSqlOptions, generateEngineSql, lateColumnStatements } from "./engine/db/engineSql.mjs";
52
51
  import { EngineSqlMigratorOptions, createEngineSqlMigrator } from "./engine/db/engineSqlMigrator.mjs";
53
52
  import { writeSchemaSettings } from "./engine/db/schemaSettings.mjs";
54
53
  import { createSettingsMigrator } from "./engine/db/settingsMigrator.mjs";
55
- export { type AggregateBatching, type AggregateChanges, type AggregateDefinition, type AggregateIdentity, type AggregateRow, type AnyHotUpdaterPlugin, ApplePlatform, BUNDLE_STORAGE_PREFIX, type BaseCandidateQuery, type BaseCandidateTarget, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, BuiltIns, type Bundle, type BundleDeployment, type BundleDetail, type BundlePatchRow, type BundleRow, BundleRowHydrationError, BundleRowHydrationErrorReason, type BundleRowUpdate, BundleSigningAdapter, BundleSigningHandlerOptions, CONTENT_ADDRESSED_ASSET_PREFIX, CatalogVersionBound, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ClientAuth, CompiledCatalogSegment, CompiledReleaseCatalog, ConfigInput, type ConfiguredDatabase, type ConstraintReason, type CoreReader, type CoreReads, type CoreSchema, type CreateRow, CreateStorageAdapterOptions, CreateStorageUriInput, DATABASE_VERSION_COLUMN, type DatabaseAdapter, DatabaseAdapterContractError, DatabaseAdapterInputError, type DatabaseAdapterInputErrorCode, DatabaseAmbiguousCommitError, type DatabaseBundleMetadata, DatabaseBundleNotFoundError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, type DatabaseJson, type DatabaseJsonObject, type DatabaseJsonValue, type DatabaseKey, type DatabaseKeyValue, DatabaseQueryError, type DatabaseReadCount, type DatabaseReadMeter, DatabaseRowReferencedError, DatabaseSchemaError, type DatabaseTooling, DatabaseTransactionError, type DatabaseValue, type DeployReleasePolicy, type Deployment, type DerivedDefinition, type DerivedFields, type Engine, type EngineColumns, type EngineDatabase, type EngineDatabaseOptions, type EngineOptions, type EngineReadCount, type EngineSqlMigratorOptions, type EngineSqlOptions, type FieldDefinition, type FieldReference, type FieldType, type FieldValue, type FindAggregatesModel, type FindManyModel, FingerprintExtraSources, HasMultipleCallSignatures, HotUpdaterConfigError, type HotUpdaterCoreApi, type HotUpdaterDatabase, type HotUpdaterPlugin, HotUpdaterSchemaMigrationRequiredError, type HotUpdaterTransaction, type IndexDefinition, IosBuildDestination, type KeyLookup, type KeyValueStore, type KeysetInput, type KvAdapterOptions, type KvCondition, type KvItem, type KvKey, type KvOp, type KvRange, LocalSigningConfig, type Lookup, type MemoryAdapterOptions, type MeteredDatabase, type MigrateOptions, type MigrationResult, type Migrator, type ModelDefinition, type ModuleSchema, NativeBuildAndroidScheme, NativeBuildArgs, type NativeBuildArtifactKind, type NativeBuildDeleteResult, NativeBuildIosScheme, NativeBuildOptions, type NativeBuildRegistration, type NativeBuildRow, type NativeBuildScope, type NativeBuildSubmissionDestination, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, type NormalizeOptions, type Page, ParsedStorageUri, type PhysicalColumn, type PhysicalColumnType, type PhysicalIndex, type PhysicalRetention, type PhysicalTable, type Platform, PlatformConfig, type PluginApis, type PluginCli, type PluginClientCredential, type PluginClientPlugin, type PluginContext, type PluginEndpoint, type PluginEndpointMethod, type PluginInstance, type PluginProvides, type PluginTables, Primitive, PromoteReleaseResult, type QueryBound, type QueryRequest, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, type ReadMeasurement, type ReadOptions, type ReadRow, type ReferenceAction, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, ReleaseCatalogMutationError, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRequest, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, type ReleaseFilter, ReleaseManagementError, ReleasePolicyPatch, type ReleaseRow, type ReleaseRowUpdate, type ReleaseTarget, type RemoteDatabase, RemoteSigningOptions, RequiredDeep, type ResolvedModel, type ResolvedSchema, type RetentionDefinition, type RetryOptions, type RowOf, SETTINGS_TABLE, type SchemaGenerator, type SchemaSettings, SecretsAdapter, SecretsContext, SigningConfig, type SqlAdapterOptions, type SqlColumnShape, type SqlConnection, type SqlDialect, type SqlExecutor, type SqlResult, type SqlStatement, type SqlTableShape, StorageAdapter, StorageAdapterWith, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StorageOperation, StoragePutInput, StoragePutResult, type StoredBundleDeployment, type StoredRow, type TableDefinition, type TableRow, type ToolingDatabase, type ToolingTarget, type UpdateSet, type VerifiedDatabaseAdapter, type VerifyAdapterOptions, WRITE_GUARD_TABLE, type WriteGuard, type WriteOp, type WriteResult, addDistinct, aggregateBatchingTables, assertStorageOperations, bundleToPatchRows, bundleToRow, canonicalizeAppVersion, compareUtf8, compileReleaseCatalog, coreSchema, coreSettings, coreTarget, countDistinct, createBundleSigningHandler, createBundleStorageKey, createEngine, createEngineDatabase, createEngineSqlMigrator, createKvAdapter, createMemoryAdapter, createSettingsMigrator, createSqlAdapter, createStorageAdapter, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createTableStatements, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, defineAggregate, definePlugin, defineTable, encodeKvKey, expiresAt, extractTimestampFromUUIDv7, findPhysicalColumn, findPhysicalIndex, generateEngineSql, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, indexOrderColumns, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBusyError, isDatabaseJsonObject, isDatabaseMetadataObject, isMultiIndex, isRemoteDatabase, isUUIDv7, mergeDistinct, meterReads, migrateCoreSchema, normalizeStoredRow, parseBaseCandidateKey, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, quoteSql, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, remoteSigning, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowKey, rowToBundle, rowsToBundles, semverSatisfies, sqlTableShapes, supportedIosPlatforms, targetBaseCandidateKey, toolingTargetOf, verifyAdapter, writeSchemaSettings };
54
+ export { type AggregateBatching, type AggregateChanges, type AggregateDefinition, type AggregateIdentity, type AggregateRow, type AnyHotUpdaterPlugin, ApplePlatform, BUNDLE_STORAGE_PREFIX, type BaseCandidateQuery, type BaseCandidateTarget, BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, BuiltIns, type Bundle, type BundleDeployment, type BundleDetail, type BundlePatchRow, type BundleRow, BundleRowHydrationError, BundleRowHydrationErrorReason, type BundleRowUpdate, CONTENT_ADDRESSED_ASSET_PREFIX, CatalogVersionBound, type ChannelDeleteResult, type ChannelInsertResult, type ChannelRow, type ClientAuth, CompiledCatalogSegment, CompiledReleaseCatalog, ConfigInput, type ConfiguredDatabase, type ConstraintReason, type CoreReader, type CoreReads, type CoreSchema, type CreateRow, CreateStorageAdapterOptions, CreateStorageUriInput, DATABASE_VERSION_COLUMN, type DatabaseAdapter, DatabaseAdapterContractError, DatabaseAdapterInputError, type DatabaseAdapterInputErrorCode, DatabaseAmbiguousCommitError, type DatabaseBundleMetadata, DatabaseBundleNotFoundError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, type DatabaseJson, type DatabaseJsonObject, type DatabaseJsonValue, type DatabaseKey, type DatabaseKeyValue, DatabaseQueryError, type DatabaseReadCount, type DatabaseReadMeter, DatabaseRowReferencedError, DatabaseSchemaError, type DatabaseTooling, DatabaseTransactionError, type DatabaseValue, type DeployReleasePolicy, type Deployment, type DerivedDefinition, type DerivedFields, type Engine, type EngineColumns, type EngineDatabase, type EngineDatabaseOptions, type EngineOptions, type EngineReadCount, type EngineSqlMigratorOptions, type EngineSqlOptions, type FieldDefinition, type FieldReference, type FieldType, type FieldValue, type FindAggregatesModel, type FindManyModel, FingerprintExtraSources, HasMultipleCallSignatures, HotUpdaterConfigError, type HotUpdaterCoreApi, type HotUpdaterDatabase, type HotUpdaterPlugin, HotUpdaterSchemaMigrationRequiredError, type HotUpdaterTransaction, type IndexDefinition, IosBuildDestination, type IosDeviceAccount, type IosDeviceAccountClaim, type IosDeviceOutcome, type IosDeviceOutcomeInput, type IosDeviceRequestResult, type IosDeviceRow, type IosDeviceStatus, type KeyLookup, type KeyValueStore, type KeysetInput, type KvAdapterOptions, type KvCondition, type KvItem, type KvKey, type KvOp, type KvRange, Lazy, LocalSigningConfig, type Lookup, type MemoryAdapterOptions, type MeteredDatabase, type MigrateOptions, type MigrationResult, type Migrator, type ModelDefinition, type ModuleSchema, NativeBuildAndroidScheme, NativeBuildArgs, type NativeBuildArtifactKind, type NativeBuildDeleteResult, type NativeBuildDistribution, type NativeBuildExportMethod, NativeBuildIosScheme, type NativeBuildMarkResult, NativeBuildOptions, type NativeBuildRegistration, type NativeBuildRow, NativeBuildSandboxOptions, type NativeBuildSandboxScope, type NativeBuildScope, type NativeBuildSubmissionDestination, NativeFingerprint, NativeFingerprintOptions, NativeFingerprintProvider, NativeFingerprintSource, type NormalizeOptions, type Page, ParsedStorageUri, type PhysicalColumn, type PhysicalColumnType, type PhysicalIndex, type PhysicalRetention, type PhysicalTable, type Platform, PlatformConfig, type PluginApis, type PluginCli, type PluginClientCredential, type PluginClientPlugin, type PluginContext, type PluginEndpoint, type PluginEndpointMethod, type PluginInstance, type PluginProvides, type PluginTables, Primitive, PromoteReleaseResult, type QueryBound, type QueryRequest, type ReadMeasurement, type ReadOptions, type ReadRow, type ReferenceAction, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, ReleaseCatalogMutationError, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRequest, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, type ReleaseFilter, type ReleaseLabelFill, ReleaseManagementError, ReleasePolicyPatch, type ReleaseRow, type ReleaseRowUpdate, type ReleaseTarget, type RemoteDatabase, RequiredDeep, type ResolvedModel, type ResolvedSchema, type RetentionDefinition, type RetryOptions, type RowOf, SETTINGS_TABLE, type SchemaGenerator, type SchemaSettings, SecretRef, SecretsAdapter, SecretsContext, SigningConfig, type SqlAdapterOptions, type SqlColumnShape, type SqlConnection, type SqlDialect, type SqlExecutor, type SqlResult, type SqlStatement, type SqlTableShape, StorageAdapter, StorageAdapterWith, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StorageOperation, StoragePutInput, StoragePutResult, type StoredBundleDeployment, type StoredRow, type TableDefinition, type TableRow, type ToolingDatabase, type ToolingTarget, type UpdateSet, type VerifiedDatabaseAdapter, type VerifyAdapterOptions, WRITE_GUARD_TABLE, type WriteGuard, type WriteOp, type WriteResult, addDistinct, aggregateBatchingTables, assertStorageOperations, bundleToPatchRows, bundleToRow, canonicalizeAppVersion, compareUtf8, compileReleaseCatalog, coreSchema, coreSettings, coreTarget, countDistinct, createBundleStorageKey, createEngine, createEngineDatabase, createEngineSqlMigrator, createKvAdapter, createMemoryAdapter, createSettingsMigrator, createSqlAdapter, createStorageAdapter, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createTableStatements, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, defineAggregate, definePlugin, defineTable, encodeKvKey, expiresAt, extractTimestampFromUUIDv7, findPhysicalColumn, findPhysicalIndex, generateEngineSql, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, indexOrderColumns, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBusyError, isDatabaseJsonObject, isDatabaseMetadataObject, isMultiIndex, isRemoteDatabase, isUUIDv7, lateColumnStatements, mergeDistinct, meterReads, migrateCoreSchema, normalizeStoredRow, parseBaseCandidateKey, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, quoteSql, readCompiledCatalogPayload, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, replaceStorageUriKeySuffix, resolveLazy, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowKey, rowToBundle, rowsToBundles, semverSatisfies, sqlTableShapes, supportedIosPlatforms, targetBaseCandidateKey, toolingTargetOf, verifyAdapter, writeSchemaSettings };
package/dist/index.mjs CHANGED
@@ -10,13 +10,12 @@ import { isDatabaseJsonObject, isDatabaseMetadataObject } from "./databaseJsonVa
10
10
  import { BundleRowHydrationError, BundleRowHydrationErrorReason, bundleToPatchRows, bundleToRow, releaseRowToRelease, releaseToRow, rowToBundle, rowsToBundles } from "./databaseRows.mjs";
11
11
  import { generateMinBundleId } from "./generateMinBundleId.mjs";
12
12
  import { createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, isUUIDv7 } from "./uuidv7.mjs";
13
- import { ReleaseCatalogCompilationError, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, referenceCompatibleReleases } from "./releaseCatalogCompiler.mjs";
13
+ import { ReleaseCatalogCompilationError, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, readCompiledCatalogPayload, referenceCompatibleReleases } from "./releaseCatalogCompiler.mjs";
14
14
  import { ReleaseManagementError } from "./releaseManagement.mjs";
15
15
  import { ReleaseCatalogMutationError } from "./releaseCatalogMutation.mjs";
16
- import { REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, createBundleSigningHandler, remoteSigning } from "./remoteBundleSigning.mjs";
17
16
  import { semverSatisfies } from "./semverSatisfies.mjs";
18
17
  import { isRemoteDatabase } from "./types/databaseConfig.mjs";
19
- import { supportedIosPlatforms } from "./types/index.mjs";
18
+ import { resolveLazy, supportedIosPlatforms } from "./types/index.mjs";
20
19
  import { definePlugin } from "./serverPlugin/definePlugin.mjs";
21
20
  import { defineAggregate, defineTable } from "./serverPlugin/schema.mjs";
22
21
  import { DatabaseAmbiguousCommitError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, DatabaseQueryError, DatabaseTransactionError } from "./serverPlugin/errors.mjs";
@@ -30,13 +29,13 @@ import { createMemoryAdapter } from "./database/memoryAdapter.mjs";
30
29
  import { DatabaseAdapterContractError, verifyAdapter } from "./database/verifyAdapter.mjs";
31
30
  import { HotUpdaterSchemaMigrationRequiredError, SETTINGS_TABLE } from "./engine/database/fence.mjs";
32
31
  import { meterReads } from "./engine/database/readMeter.mjs";
33
- import { writeSchemaSettings } from "./engine/db/schemaSettings.mjs";
34
32
  import { createTableStatements, isMultiIndex, quoteSql, sqlTableShapes } from "./engine/database/sql/sqlSchema.mjs";
35
- import { generateEngineSql } from "./engine/db/engineSql.mjs";
33
+ import { generateEngineSql, lateColumnStatements } from "./engine/db/engineSql.mjs";
36
34
  import { createSettingsMigrator } from "./engine/db/settingsMigrator.mjs";
35
+ import { writeSchemaSettings } from "./engine/db/schemaSettings.mjs";
37
36
  import { aggregateBatchingTables, coreSchema, coreSettings, coreTarget, createEngineDatabase, migrateCoreSchema, toolingTargetOf } from "./engine/db/coreDatabase.mjs";
38
37
  import { createEngine } from "./engine/createEngine.mjs";
39
38
  import { createKvAdapter, encodeKvKey } from "./engine/database/kv/kvAdapter.mjs";
40
39
  import { WRITE_GUARD_TABLE, createSqlAdapter } from "./engine/database/sql/sqlAdapter.mjs";
41
40
  import { createEngineSqlMigrator } from "./engine/db/engineSqlMigrator.mjs";
42
- export { BUNDLE_STORAGE_PREFIX, BundleRowHydrationError, BundleRowHydrationErrorReason, CONTENT_ADDRESSED_ASSET_PREFIX, DATABASE_VERSION_COLUMN, DatabaseAdapterContractError, DatabaseAdapterInputError, DatabaseAmbiguousCommitError, DatabaseBundleNotFoundError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, DatabaseQueryError, DatabaseRowReferencedError, DatabaseSchemaError, DatabaseTransactionError, HotUpdaterConfigError, HotUpdaterSchemaMigrationRequiredError, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, ReleaseCatalogCompilationError, ReleaseCatalogMutationError, ReleaseManagementError, SETTINGS_TABLE, WRITE_GUARD_TABLE, addDistinct, aggregateBatchingTables, assertStorageOperations, bundleToPatchRows, bundleToRow, canonicalizeAppVersion, compareUtf8, compileReleaseCatalog, coreSchema, coreSettings, coreTarget, countDistinct, createBundleSigningHandler, createBundleStorageKey, createEngine, createEngineDatabase, createEngineSqlMigrator, createKvAdapter, createMemoryAdapter, createSettingsMigrator, createSqlAdapter, createStorageAdapter, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createTableStatements, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, defineAggregate, definePlugin, defineTable, encodeKvKey, expiresAt, extractTimestampFromUUIDv7, findPhysicalColumn, findPhysicalIndex, generateEngineSql, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, indexOrderColumns, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBusyError, isDatabaseJsonObject, isDatabaseMetadataObject, isMultiIndex, isRemoteDatabase, isUUIDv7, mergeDistinct, meterReads, migrateCoreSchema, normalizeStoredRow, parseBaseCandidateKey, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, quoteSql, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, remoteSigning, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowKey, rowToBundle, rowsToBundles, semverSatisfies, sqlTableShapes, supportedIosPlatforms, targetBaseCandidateKey, toolingTargetOf, verifyAdapter, writeSchemaSettings };
41
+ export { BUNDLE_STORAGE_PREFIX, BundleRowHydrationError, BundleRowHydrationErrorReason, CONTENT_ADDRESSED_ASSET_PREFIX, DATABASE_VERSION_COLUMN, DatabaseAdapterContractError, DatabaseAdapterInputError, DatabaseAmbiguousCommitError, DatabaseBundleNotFoundError, DatabaseConflictError, DatabaseConstraintError, DatabaseCursorError, DatabaseQueryError, DatabaseRowReferencedError, DatabaseSchemaError, DatabaseTransactionError, HotUpdaterConfigError, HotUpdaterSchemaMigrationRequiredError, ReleaseCatalogCompilationError, ReleaseCatalogMutationError, ReleaseManagementError, SETTINGS_TABLE, WRITE_GUARD_TABLE, addDistinct, aggregateBatchingTables, assertStorageOperations, bundleToPatchRows, bundleToRow, canonicalizeAppVersion, compareUtf8, compileReleaseCatalog, coreSchema, coreSettings, coreTarget, countDistinct, createBundleStorageKey, createEngine, createEngineDatabase, createEngineSqlMigrator, createKvAdapter, createMemoryAdapter, createSettingsMigrator, createSqlAdapter, createStorageAdapter, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createTableStatements, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, defineAggregate, definePlugin, defineTable, encodeKvKey, expiresAt, extractTimestampFromUUIDv7, findPhysicalColumn, findPhysicalIndex, generateEngineSql, generateMinBundleId, getBundleArchiveStorageUri, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, indexOrderColumns, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBusyError, isDatabaseJsonObject, isDatabaseMetadataObject, isMultiIndex, isRemoteDatabase, isUUIDv7, lateColumnStatements, mergeDistinct, meterReads, migrateCoreSchema, normalizeStoredRow, parseBaseCandidateKey, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, quoteSql, readCompiledCatalogPayload, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, replaceStorageUriKeySuffix, resolveLazy, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowKey, rowToBundle, rowsToBundles, semverSatisfies, sqlTableShapes, supportedIosPlatforms, targetBaseCandidateKey, toolingTargetOf, verifyAdapter, writeSchemaSettings };