@hot-updater/plugin-core 1.2.0-rc.5 → 1.2.0-rc.50

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 (79) hide show
  1. package/dist/coreApi.d.cts +246 -10
  2. package/dist/coreApi.d.mts +246 -10
  3. package/dist/database/adapter.d.cts +12 -0
  4. package/dist/database/adapter.d.mts +12 -0
  5. package/dist/engine/core/schema.cjs +200 -5
  6. package/dist/engine/core/schema.d.cts +127 -1
  7. package/dist/engine/core/schema.d.mts +127 -1
  8. package/dist/engine/core/schema.mjs +200 -6
  9. package/dist/engine/createEngine.cjs +1 -2
  10. package/dist/engine/createEngine.d.cts +1 -6
  11. package/dist/engine/createEngine.d.mts +1 -6
  12. package/dist/engine/createEngine.mjs +1 -2
  13. package/dist/engine/database/aggregateBatching.cjs +87 -129
  14. package/dist/engine/database/aggregateBatching.mjs +87 -129
  15. package/dist/engine/database/database.cjs +1 -4
  16. package/dist/engine/database/database.mjs +1 -4
  17. package/dist/engine/database/engineTransaction.cjs +21 -1
  18. package/dist/engine/database/engineTransaction.d.cts +5 -1
  19. package/dist/engine/database/engineTransaction.d.mts +5 -1
  20. package/dist/engine/database/engineTransaction.mjs +21 -1
  21. package/dist/engine/database/kv/kvAdapter.cjs +80 -4
  22. package/dist/engine/database/kv/kvAdapter.mjs +80 -4
  23. package/dist/engine/database/resolveSchema.cjs +6 -3
  24. package/dist/engine/database/resolveSchema.mjs +6 -3
  25. package/dist/engine/database/sql/sqlAdapter.cjs +9 -4
  26. package/dist/engine/database/sql/sqlAdapter.mjs +9 -4
  27. package/dist/engine/database/sql/sqlSchema.cjs +24 -6
  28. package/dist/engine/database/sql/sqlSchema.d.cts +1 -1
  29. package/dist/engine/database/sql/sqlSchema.d.mts +1 -1
  30. package/dist/engine/database/sql/sqlSchema.mjs +24 -6
  31. package/dist/engine/db/coreDatabase.cjs +10 -5
  32. package/dist/engine/db/coreDatabase.d.cts +2 -1
  33. package/dist/engine/db/coreDatabase.d.mts +2 -1
  34. package/dist/engine/db/coreDatabase.mjs +10 -5
  35. package/dist/engine/db/engineMigrator.cjs +21 -16
  36. package/dist/engine/db/engineMigrator.mjs +22 -17
  37. package/dist/engine/db/engineSqlMigrator.cjs +53 -20
  38. package/dist/engine/db/engineSqlMigrator.d.cts +2 -0
  39. package/dist/engine/db/engineSqlMigrator.d.mts +2 -0
  40. package/dist/engine/db/engineSqlMigrator.mjs +55 -22
  41. package/dist/engine/db/schemaSettings.cjs +36 -5
  42. package/dist/engine/db/schemaSettings.d.cts +5 -2
  43. package/dist/engine/db/schemaSettings.d.mts +5 -2
  44. package/dist/engine/db/schemaSettings.mjs +36 -6
  45. package/dist/engine/db/settingsMigrator.cjs +92 -14
  46. package/dist/engine/db/settingsMigrator.d.cts +18 -8
  47. package/dist/engine/db/settingsMigrator.d.mts +18 -8
  48. package/dist/engine/db/settingsMigrator.mjs +89 -15
  49. package/dist/engine/db/sqlSchemaState.cjs +108 -0
  50. package/dist/engine/db/sqlSchemaState.mjs +104 -0
  51. package/dist/engine/db/types.d.cts +6 -0
  52. package/dist/engine/db/types.d.mts +6 -0
  53. package/dist/index.cjs +2 -8
  54. package/dist/index.d.cts +5 -6
  55. package/dist/index.d.mts +5 -6
  56. package/dist/index.mjs +3 -4
  57. package/dist/serverPlugin/coreReads.d.cts +10 -1
  58. package/dist/serverPlugin/coreReads.d.mts +10 -1
  59. package/dist/serverPlugin/definitions.d.cts +4 -0
  60. package/dist/serverPlugin/definitions.d.mts +4 -0
  61. package/dist/serverPlugin/schema.d.cts +4 -0
  62. package/dist/serverPlugin/schema.d.mts +4 -0
  63. package/dist/types/databaseConfig.d.cts +10 -20
  64. package/dist/types/databaseConfig.d.mts +10 -20
  65. package/dist/types/databaseRows.d.cts +70 -2
  66. package/dist/types/databaseRows.d.mts +70 -2
  67. package/dist/types/index.cjs +3 -0
  68. package/dist/types/index.d.cts +114 -56
  69. package/dist/types/index.d.mts +114 -56
  70. package/dist/types/index.mjs +3 -1
  71. package/dist/types/models.d.cts +9 -1
  72. package/dist/types/models.d.mts +9 -1
  73. package/dist/types/public.d.cts +3 -3
  74. package/dist/types/public.d.mts +3 -3
  75. package/package.json +3 -9
  76. package/dist/remoteBundleSigning.cjs +0 -357
  77. package/dist/remoteBundleSigning.d.cts +0 -38
  78. package/dist/remoteBundleSigning.d.mts +0 -38
  79. package/dist/remoteBundleSigning.mjs +0 -352
@@ -3,6 +3,7 @@ import { HotUpdaterSchemaMigrationRequiredError, SETTINGS_TABLE, isMissingSchema
3
3
  import { getEmptyMigrationResult } from "./fixedMigratorShared.mjs";
4
4
  import { quoteSql } from "../database/sql/sqlSchema.mjs";
5
5
  import { settingsStatements } from "./engineSql.mjs";
6
+ import { collationStatements, missingSqlSchema, readSqlSchemaState, targetShapes } from "./sqlSchemaState.mjs";
6
7
  //#region src/engine/db/settingsMigrator.ts
7
8
  /**
8
9
  * Every settings row by key and value alone, so a v0 layout reads too; null
@@ -35,33 +36,98 @@ const refuseV0Database = (adapterName, stored) => {
35
36
  if (typeof version !== "string" || stored.has("schema.engine")) return;
36
37
  throw new HotUpdaterSchemaMigrationRequiredError(adapterName, version);
37
38
  };
39
+ /** Compares dotted numeric versions, such as "1" and "1.2.0"; NaN when either is not one. */
40
+ const compareVersions = (left, right) => {
41
+ const parse = (version) => /^\d+(?:\.\d+)*$/u.test(version) ? version.split(".").map(Number) : [NaN];
42
+ const [a, b] = [parse(left), parse(right)];
43
+ if ([...a, ...b].some(Number.isNaN)) return NaN;
44
+ for (let index = 0; index < Math.max(a.length, b.length); index += 1) {
45
+ const difference = (a[index] ?? 0) - (b[index] ?? 0);
46
+ if (difference !== 0) return difference;
47
+ }
48
+ return 0;
49
+ };
50
+ /**
51
+ * The settings whose versions only move forward when a `ToolingTarget` names
52
+ * none. `schema.engine` is a storage layout, not a release: a store refuses
53
+ * another layout itself, and doctor reports it as not migratable.
54
+ */
55
+ const DEFAULT_ORDERED_SETTINGS = ["schema.core"];
56
+ /**
57
+ * Refuses a database a newer release migrated, one whose `schema.core` is
58
+ * newer than this release's: writing this release's settings would move the
59
+ * schema back, and every server of the newer release would answer 503. Only
60
+ * `ordered` settings are compared, `schema.core` among them, and the message
61
+ * lists each that is newer. An official plugin's
62
+ * newer version alone is no newer release: Insights recorded "1.2.0" in
63
+ * 1.0.0-rc.23 and rc.24, then went back to "1.0.0" with the same tables.
64
+ */
65
+ const refuseNewerSchema = (adapterName, stored, settings, ordered = DEFAULT_ORDERED_SETTINGS) => {
66
+ const newer = ordered.flatMap((key) => {
67
+ const found = stored.get(key);
68
+ const expected = settings[key];
69
+ return typeof found === "string" && expected !== void 0 && compareVersions(found, expected) > 0 ? [{
70
+ key,
71
+ found,
72
+ expected
73
+ }] : [];
74
+ });
75
+ const core = newer.find(({ key }) => key === "schema.core");
76
+ if (core === void 0) return;
77
+ throw new Error(`${adapterName}: the database was migrated by Hot Updater ${core.found} (${newer.map(({ key, found, expected }) => `${key} "${found}", this CLI's "${expected}"`).join("; ")}). Upgrade hot-updater to ${core.found} or later; nothing was written.`);
78
+ };
79
+ /**
80
+ * The tables or indexes an ORM has yet to apply, found before `db migrate`
81
+ * writes the settings rows, so the fence never passes over missing tables.
82
+ */
83
+ var HotUpdaterSchemaTablesMissingError = class extends Error {
84
+ adapterName;
85
+ missing;
86
+ applyTables;
87
+ constructor(adapterName, missing, applyTables) {
88
+ const all = missing.tables.includes(SETTINGS_TABLE.name);
89
+ const items = [...missing.tables.length === 0 ? [] : [`table${missing.tables.length === 1 ? "" : "s"} ${missing.tables.join(", ")}`], ...missing.indexes.length === 0 ? [] : [`index${missing.indexes.length === 1 ? "" : "es"} ${missing.indexes.map(({ index }) => index).join(", ")}`]];
90
+ super(`${adapterName}: ${all ? "the Hot Updater tables are missing" : `the database lacks ${items.join(" and ")}`}. Run \`hot-updater db generate\`, apply it with ${applyTables}, then migrate again.`);
91
+ this.adapterName = adapterName;
92
+ this.missing = missing;
93
+ this.applyTables = applyTables;
94
+ this.name = "HotUpdaterSchemaTablesMissingError";
95
+ }
96
+ };
38
97
  /**
39
98
  * `hot-updater db migrate` for an ORM that applies the DDL itself (Drizzle,
40
- * Prisma): it sets what the ORM cannot declare, writes the settings rows, and
41
- * refuses a v0 database. The `createMigrator` of an adapter whose ORM
99
+ * Prisma). Before it writes the settings rows it refuses a v0 database or one
100
+ * a newer release migrated, checks that every table and index the target
101
+ * declares exists, and sets the collations the ORM cannot declare on the
102
+ * columns that lack them. The `createMigrator` of an adapter whose ORM
42
103
  * creates the tables returns it, as the Drizzle and Prisma adapters' do.
43
104
  */
44
105
  const createSettingsMigrator = (options) => {
45
106
  const read = () => readStoredSettings(options.executor);
46
107
  const getVersion = async () => storedSchemaVersion(await read());
108
+ const { executor } = options;
47
109
  const makeResult = async (migrate = {}) => {
48
- const stored = await read();
49
- if (stored === null) throw new Error(`${options.adapterName}: the Hot Updater tables are missing. Run \`hot-updater db generate\`, apply the schema with ${options.applyTables}, then migrate again.`);
110
+ const stored = await read() ?? /* @__PURE__ */ new Map();
50
111
  refuseV0Database(options.adapterName, stored);
51
- if (migrate.updateSettings === false || Object.entries(options.settings).every(([key, value]) => stored.get(key) === value)) return getEmptyMigrationResult();
52
- const fixups = options.fixups?.statements ?? [];
53
- const statements = [...fixups, ...settingsStatements(options.executor.dialect, options.settings)];
112
+ refuseNewerSchema(options.adapterName, stored, options.settings, options.ordered);
113
+ const shapes = targetShapes(executor.dialect, options.schema);
114
+ const missing = missingSqlSchema(shapes, await readSqlSchemaState(executor));
115
+ if (missing.tables.length > 0 || missing.indexes.length > 0) throw new HotUpdaterSchemaTablesMissingError(options.adapterName, missing, options.applyTables);
116
+ const collations = options.collate === void 0 ? {
117
+ statements: [],
118
+ columns: 0
119
+ } : await collationStatements(executor, shapes.filter((shape) => shape.name !== SETTINGS_TABLE.name), options.collate);
120
+ const changed = migrate.updateSettings === false ? [] : Object.entries(options.settings).filter(([key, value]) => stored.get(key) !== value);
121
+ if (collations.statements.length === 0 && changed.length === 0) return getEmptyMigrationResult();
122
+ const statements = [...collations.statements, ...changed.length === 0 ? [] : settingsStatements(executor.dialect, options.settings)];
54
123
  return {
55
- operations: [...fixups.length === 0 ? [] : [{
56
- type: "custom",
57
- description: options.fixups.description
58
- }], {
124
+ operations: [...collations.columns === 0 ? [] : [{
59
125
  type: "custom",
60
- description: `Write the schema settings: ${Object.keys(options.settings).join(", ")}`
61
- }],
126
+ description: `Set the byte-order collation the ORM cannot declare on ${collations.columns} column${collations.columns === 1 ? "" : "s"} of ${collations.statements.length} table${collations.statements.length === 1 ? "" : "s"}`
127
+ }], ...changed.length === 0 ? [] : [settingsOperation(stored, changed)]],
62
128
  getSQL: () => statements.map((statement) => `${statement};`).join("\n\n"),
63
129
  execute: async () => {
64
- for (const sql of statements) await options.executor.execute({
130
+ for (const sql of statements) await executor.execute({
65
131
  sql,
66
132
  params: []
67
133
  });
@@ -84,5 +150,13 @@ const createSettingsMigrator = (options) => {
84
150
  migrateToLatest: makeResult
85
151
  };
86
152
  };
153
+ /** The settings rows a migration changes, each with its stored value. */
154
+ const settingsOperation = (stored, changed) => ({
155
+ type: "custom",
156
+ description: `Record ${changed.map(([key, value]) => {
157
+ const found = stored.get(key);
158
+ return typeof found === "string" ? `${key} ${found} → ${value}` : `${key} ${value}`;
159
+ }).join(", ")}`
160
+ });
87
161
  //#endregion
88
- export { createSettingsMigrator, readStoredSettings, refuseV0Database, storedSchemaVersion };
162
+ export { DEFAULT_ORDERED_SETTINGS, HotUpdaterSchemaTablesMissingError, createSettingsMigrator, readStoredSettings, refuseNewerSchema, refuseV0Database, settingsOperation, storedSchemaVersion };
@@ -0,0 +1,108 @@
1
+ const require_fence = require("../database/fence.cjs");
2
+ const require_sqlSchema = require("../database/sql/sqlSchema.cjs");
3
+ //#region src/engine/db/sqlSchemaState.ts
4
+ /** Each table, and the index tables of its multi-valued indexes. */
5
+ const flattenShapes = (shapes) => shapes.flatMap((shape) => [shape, ...flattenShapes(shape.indexes.flatMap((index) => index.kind === "table" ? [index.table] : []))]);
6
+ /** Every table the target declares, settings table included, as the DDL creates it. */
7
+ const targetShapes = (dialect, schema, tablePrefix = "") => flattenShapes(require_sqlSchema.sqlTableShapes(dialect, [...schema.tables, require_fence.SETTINGS_TABLE], tablePrefix));
8
+ /** PostgreSQL's identifier limit, NAMEDATALEN - 1 bytes. */
9
+ const POSTGRES_NAME_BYTES = 63;
10
+ /** A name as PostgreSQL stores it: cut to its limit on a character boundary. */
11
+ const postgresName = (name) => {
12
+ const encoder = new TextEncoder();
13
+ let bytes = 0;
14
+ let cut = "";
15
+ for (const character of name) {
16
+ bytes += encoder.encode(character).length;
17
+ if (bytes > POSTGRES_NAME_BYTES) break;
18
+ cut += character;
19
+ }
20
+ return cut;
21
+ };
22
+ /**
23
+ * A name as the catalog reports it, so declared and stored names compare.
24
+ * PostgreSQL cuts a longer name to its limit. MySQL compares index names,
25
+ * and with lower_case_table_names table names, without case, and reports
26
+ * them folded.
27
+ */
28
+ const fold = (dialect, name) => dialect === "mysql" ? String(name).toLowerCase() : dialect === "postgresql" ? postgresName(String(name)) : String(name);
29
+ const CATALOG = {
30
+ postgresql: {
31
+ tables: "SELECT c.relname AS t FROM pg_class c WHERE c.relkind IN ('r', 'p') AND pg_table_is_visible(c.oid)",
32
+ 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)"
33
+ },
34
+ mysql: {
35
+ tables: "SELECT TABLE_NAME AS t FROM information_schema.tables WHERE TABLE_SCHEMA = DATABASE()",
36
+ indexes: "SELECT DISTINCT TABLE_NAME AS t, INDEX_NAME AS i FROM information_schema.statistics WHERE TABLE_SCHEMA = DATABASE()"
37
+ },
38
+ sqlite: {
39
+ tables: "SELECT name AS t FROM sqlite_master WHERE type = 'table'",
40
+ indexes: "SELECT tbl_name AS t, name AS i FROM sqlite_master WHERE type = 'index'"
41
+ }
42
+ };
43
+ /** Reads which tables and indexes exist: two catalog reads. */
44
+ const readSqlSchemaState = async (executor) => {
45
+ const { dialect } = executor;
46
+ const read = (sql) => executor.execute({
47
+ sql,
48
+ params: []
49
+ });
50
+ const [tables, indexes] = await Promise.all([read(CATALOG[dialect].tables), read(CATALOG[dialect].indexes)]);
51
+ const tableNames = new Set(tables.rows.map(({ t }) => fold(dialect, t)));
52
+ const indexNames = new Set(indexes.rows.map(({ t, i }) => JSON.stringify([fold(dialect, t), fold(dialect, i)])));
53
+ return {
54
+ hasTable: (table) => tableNames.has(fold(dialect, table)),
55
+ hasIndex: (table, index) => indexNames.has(JSON.stringify([fold(dialect, table), fold(dialect, index)]))
56
+ };
57
+ };
58
+ /** The declared tables and indexes the database lacks. */
59
+ const missingSqlSchema = (shapes, state) => ({
60
+ tables: shapes.filter((shape) => !state.hasTable(shape.name)).map((shape) => shape.name),
61
+ indexes: shapes.filter((shape) => state.hasTable(shape.name)).flatMap((shape) => shape.indexes.flatMap((index) => index.kind === "index" && !state.hasIndex(shape.name, index.name) ? [{
62
+ table: shape.name,
63
+ index: index.name
64
+ }] : []))
65
+ });
66
+ /** The collation a column's DDL type declares, such as `C` or `utf8mb4_0900_bin`. */
67
+ const declaredCollation = (type) => /COLLATE "?([\w]+)"?/u.exec(type)?.[1];
68
+ const COLLATIONS = {
69
+ 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)",
70
+ 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"
71
+ };
72
+ /**
73
+ * The statements that set the collation an ORM cannot declare on each column
74
+ * `collate` selects whose stored collation differs, one per table: PostgreSQL
75
+ * `ALTER COLUMN … TYPE`, MySQL `MODIFY`. One catalog read; none on SQLite,
76
+ * whose text compares by bytes already.
77
+ */
78
+ const collationStatements = async (executor, shapes, collate) => {
79
+ const { dialect } = executor;
80
+ if (dialect === "sqlite") return {
81
+ statements: [],
82
+ columns: 0
83
+ };
84
+ const { rows } = await executor.execute({
85
+ sql: COLLATIONS[dialect],
86
+ params: []
87
+ });
88
+ const stored = new Map(rows.map(({ t, c, k }) => [JSON.stringify([fold(dialect, t), fold(dialect, c)]), String(k)]));
89
+ const quote = (name) => require_sqlSchema.quoteSql(dialect, name);
90
+ let columns = 0;
91
+ return {
92
+ statements: shapes.flatMap((shape) => {
93
+ const changes = shape.columns.filter((column) => {
94
+ const expected = declaredCollation(column.type);
95
+ return expected !== void 0 && collate(column) && stored.get(JSON.stringify([fold(dialect, shape.name), fold(dialect, column.name)])) !== expected;
96
+ }).map((column) => dialect === "postgresql" ? `ALTER COLUMN ${quote(column.name)} TYPE ${column.type}` : `MODIFY ${quote(column.name)} ${column.type}${column.notNull ? " NOT NULL" : " NULL"}`);
97
+ columns += changes.length;
98
+ return changes.length === 0 ? [] : [`ALTER TABLE ${quote(shape.name)} ${changes.join(", ")}`];
99
+ }),
100
+ columns
101
+ };
102
+ };
103
+ //#endregion
104
+ exports.collationStatements = collationStatements;
105
+ exports.flattenShapes = flattenShapes;
106
+ exports.missingSqlSchema = missingSqlSchema;
107
+ exports.readSqlSchemaState = readSqlSchemaState;
108
+ exports.targetShapes = targetShapes;
@@ -0,0 +1,104 @@
1
+ import { SETTINGS_TABLE } from "../database/fence.mjs";
2
+ import { quoteSql, sqlTableShapes } from "../database/sql/sqlSchema.mjs";
3
+ //#region src/engine/db/sqlSchemaState.ts
4
+ /** Each table, and the index tables of its multi-valued indexes. */
5
+ const flattenShapes = (shapes) => shapes.flatMap((shape) => [shape, ...flattenShapes(shape.indexes.flatMap((index) => index.kind === "table" ? [index.table] : []))]);
6
+ /** Every table the target declares, settings table included, as the DDL creates it. */
7
+ const targetShapes = (dialect, schema, tablePrefix = "") => flattenShapes(sqlTableShapes(dialect, [...schema.tables, SETTINGS_TABLE], tablePrefix));
8
+ /** PostgreSQL's identifier limit, NAMEDATALEN - 1 bytes. */
9
+ const POSTGRES_NAME_BYTES = 63;
10
+ /** A name as PostgreSQL stores it: cut to its limit on a character boundary. */
11
+ const postgresName = (name) => {
12
+ const encoder = new TextEncoder();
13
+ let bytes = 0;
14
+ let cut = "";
15
+ for (const character of name) {
16
+ bytes += encoder.encode(character).length;
17
+ if (bytes > POSTGRES_NAME_BYTES) break;
18
+ cut += character;
19
+ }
20
+ return cut;
21
+ };
22
+ /**
23
+ * A name as the catalog reports it, so declared and stored names compare.
24
+ * PostgreSQL cuts a longer name to its limit. MySQL compares index names,
25
+ * and with lower_case_table_names table names, without case, and reports
26
+ * them folded.
27
+ */
28
+ const fold = (dialect, name) => dialect === "mysql" ? String(name).toLowerCase() : dialect === "postgresql" ? postgresName(String(name)) : String(name);
29
+ const CATALOG = {
30
+ postgresql: {
31
+ tables: "SELECT c.relname AS t FROM pg_class c WHERE c.relkind IN ('r', 'p') AND pg_table_is_visible(c.oid)",
32
+ 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)"
33
+ },
34
+ mysql: {
35
+ tables: "SELECT TABLE_NAME AS t FROM information_schema.tables WHERE TABLE_SCHEMA = DATABASE()",
36
+ indexes: "SELECT DISTINCT TABLE_NAME AS t, INDEX_NAME AS i FROM information_schema.statistics WHERE TABLE_SCHEMA = DATABASE()"
37
+ },
38
+ sqlite: {
39
+ tables: "SELECT name AS t FROM sqlite_master WHERE type = 'table'",
40
+ indexes: "SELECT tbl_name AS t, name AS i FROM sqlite_master WHERE type = 'index'"
41
+ }
42
+ };
43
+ /** Reads which tables and indexes exist: two catalog reads. */
44
+ const readSqlSchemaState = async (executor) => {
45
+ const { dialect } = executor;
46
+ const read = (sql) => executor.execute({
47
+ sql,
48
+ params: []
49
+ });
50
+ const [tables, indexes] = await Promise.all([read(CATALOG[dialect].tables), read(CATALOG[dialect].indexes)]);
51
+ const tableNames = new Set(tables.rows.map(({ t }) => fold(dialect, t)));
52
+ const indexNames = new Set(indexes.rows.map(({ t, i }) => JSON.stringify([fold(dialect, t), fold(dialect, i)])));
53
+ return {
54
+ hasTable: (table) => tableNames.has(fold(dialect, table)),
55
+ hasIndex: (table, index) => indexNames.has(JSON.stringify([fold(dialect, table), fold(dialect, index)]))
56
+ };
57
+ };
58
+ /** The declared tables and indexes the database lacks. */
59
+ const missingSqlSchema = (shapes, state) => ({
60
+ tables: shapes.filter((shape) => !state.hasTable(shape.name)).map((shape) => shape.name),
61
+ indexes: shapes.filter((shape) => state.hasTable(shape.name)).flatMap((shape) => shape.indexes.flatMap((index) => index.kind === "index" && !state.hasIndex(shape.name, index.name) ? [{
62
+ table: shape.name,
63
+ index: index.name
64
+ }] : []))
65
+ });
66
+ /** The collation a column's DDL type declares, such as `C` or `utf8mb4_0900_bin`. */
67
+ const declaredCollation = (type) => /COLLATE "?([\w]+)"?/u.exec(type)?.[1];
68
+ const COLLATIONS = {
69
+ 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)",
70
+ 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"
71
+ };
72
+ /**
73
+ * The statements that set the collation an ORM cannot declare on each column
74
+ * `collate` selects whose stored collation differs, one per table: PostgreSQL
75
+ * `ALTER COLUMN … TYPE`, MySQL `MODIFY`. One catalog read; none on SQLite,
76
+ * whose text compares by bytes already.
77
+ */
78
+ const collationStatements = async (executor, shapes, collate) => {
79
+ const { dialect } = executor;
80
+ if (dialect === "sqlite") return {
81
+ statements: [],
82
+ columns: 0
83
+ };
84
+ const { rows } = await executor.execute({
85
+ sql: COLLATIONS[dialect],
86
+ params: []
87
+ });
88
+ const stored = new Map(rows.map(({ t, c, k }) => [JSON.stringify([fold(dialect, t), fold(dialect, c)]), String(k)]));
89
+ const quote = (name) => quoteSql(dialect, name);
90
+ let columns = 0;
91
+ return {
92
+ statements: shapes.flatMap((shape) => {
93
+ const changes = shape.columns.filter((column) => {
94
+ const expected = declaredCollation(column.type);
95
+ return expected !== void 0 && collate(column) && stored.get(JSON.stringify([fold(dialect, shape.name), fold(dialect, column.name)])) !== expected;
96
+ }).map((column) => dialect === "postgresql" ? `ALTER COLUMN ${quote(column.name)} TYPE ${column.type}` : `MODIFY ${quote(column.name)} ${column.type}${column.notNull ? " NOT NULL" : " NULL"}`);
97
+ columns += changes.length;
98
+ return changes.length === 0 ? [] : [`ALTER TABLE ${quote(shape.name)} ${changes.join(", ")}`];
99
+ }),
100
+ columns
101
+ };
102
+ };
103
+ //#endregion
104
+ export { 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;
@@ -144,8 +138,8 @@ exports.quoteSql = require_sqlSchema.quoteSql;
144
138
  exports.referenceCompatibleReleases = require_releaseCatalogCompiler.referenceCompatibleReleases;
145
139
  exports.releaseRowToRelease = require_databaseRows.releaseRowToRelease;
146
140
  exports.releaseToRow = require_databaseRows.releaseToRow;
147
- exports.remoteSigning = require_remoteBundleSigning.remoteSigning;
148
141
  exports.replaceStorageUriKeySuffix = require_assetStorageLayout.replaceStorageUriKeySuffix;
142
+ exports.resolveLazy = require_index.resolveLazy;
149
143
  exports.resolveManifestAssetStorageFileHash = require_assetStorageLayout.resolveManifestAssetStorageFileHash;
150
144
  exports.resolveManifestAssetStorageUri = require_assetStorageLayout.resolveManifestAssetStorageUri;
151
145
  exports.rowKey = require_adapter.rowKey;
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@ import { createStorageUriWithRelativePath, getManifestAssetDownloadPath, getMani
3
3
  import { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath, isContentAddressedAssetFileHash } from "./contentAddressedAssets.cjs";
4
4
  import { getContentType } from "./contentType.cjs";
5
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";
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, 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";
@@ -52,4 +51,4 @@ import { EngineSqlOptions, generateEngineSql } 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, 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, mergeDistinct, meterReads, migrateCoreSchema, normalizeStoredRow, parseBaseCandidateKey, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, quoteSql, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, replaceStorageUriKeySuffix, resolveLazy, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowKey, rowToBundle, rowsToBundles, semverSatisfies, sqlTableShapes, supportedIosPlatforms, targetBaseCandidateKey, toolingTargetOf, verifyAdapter, writeSchemaSettings };
package/dist/index.d.mts CHANGED
@@ -3,7 +3,7 @@ import { createStorageUriWithRelativePath, getManifestAssetDownloadPath, getMani
3
3
  import { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath, isContentAddressedAssetFileHash } from "./contentAddressedAssets.mjs";
4
4
  import { getContentType } from "./contentType.mjs";
5
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";
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, 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";
@@ -52,4 +51,4 @@ import { EngineSqlOptions, generateEngineSql } 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, 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, mergeDistinct, meterReads, migrateCoreSchema, normalizeStoredRow, parseBaseCandidateKey, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, quoteSql, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, replaceStorageUriKeySuffix, resolveLazy, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowKey, rowToBundle, rowsToBundles, semverSatisfies, sqlTableShapes, supportedIosPlatforms, targetBaseCandidateKey, toolingTargetOf, verifyAdapter, writeSchemaSettings };
package/dist/index.mjs CHANGED
@@ -13,10 +13,9 @@ import { createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extract
13
13
  import { ReleaseCatalogCompilationError, canonicalizeAppVersion, compileReleaseCatalog, projectCompiledCatalog, projectCompiledRollbackCatalog, 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
33
  import { generateEngineSql } 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, mergeDistinct, meterReads, migrateCoreSchema, normalizeStoredRow, parseBaseCandidateKey, parseStorageUri, projectCompiledCatalog, projectCompiledRollbackCatalog, quoteSql, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, replaceStorageUriKeySuffix, resolveLazy, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rowKey, rowToBundle, rowsToBundles, semverSatisfies, sqlTableShapes, supportedIosPlatforms, targetBaseCandidateKey, toolingTargetOf, verifyAdapter, writeSchemaSettings };