@hot-updater/server 1.0.0-rc.1 → 1.0.0-rc.2

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 (191) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +1 -1
  2. package/dist/adapters/databaseConstraintErrors.cjs +0 -1
  3. package/dist/adapters/databasePluginUtils.cjs +0 -1
  4. package/dist/adapters/drizzle.cjs +10 -3
  5. package/dist/adapters/drizzle.d.cts +0 -1
  6. package/dist/adapters/drizzle.d.mts +0 -1
  7. package/dist/adapters/drizzle.mjs +11 -3
  8. package/dist/adapters/drizzleCrud.cjs +62 -1
  9. package/dist/adapters/drizzleCrud.mjs +61 -2
  10. package/dist/adapters/drizzleLazyDB.cjs +6 -1
  11. package/dist/adapters/drizzleLazyDB.mjs +6 -1
  12. package/dist/adapters/drizzleQuery.cjs +3 -2
  13. package/dist/adapters/drizzleQuery.mjs +3 -1
  14. package/dist/adapters/insightsTransaction.cjs +22 -0
  15. package/dist/adapters/insightsTransaction.mjs +22 -0
  16. package/dist/adapters/kysely.cjs +2 -1
  17. package/dist/adapters/kysely.d.cts +0 -1
  18. package/dist/adapters/kysely.d.mts +0 -1
  19. package/dist/adapters/kysely.mjs +3 -1
  20. package/dist/adapters/kyselyCrud.cjs +54 -3
  21. package/dist/adapters/kyselyCrud.mjs +54 -3
  22. package/dist/adapters/kyselyQuery.cjs +2 -2
  23. package/dist/adapters/kyselyQuery.mjs +2 -1
  24. package/dist/adapters/mongodb.cjs +27 -1
  25. package/dist/adapters/mongodb.d.cts +1 -1
  26. package/dist/adapters/mongodb.d.mts +1 -1
  27. package/dist/adapters/mongodb.mjs +28 -1
  28. package/dist/adapters/mongodbCollections.cjs +2 -0
  29. package/dist/adapters/mongodbCollections.mjs +2 -0
  30. package/dist/adapters/mongodbQuery.cjs +21 -4
  31. package/dist/adapters/mongodbQuery.mjs +21 -5
  32. package/dist/adapters/mongodbReads.cjs +91 -29
  33. package/dist/adapters/mongodbReads.mjs +92 -29
  34. package/dist/adapters/mongodbWrites.cjs +16 -2
  35. package/dist/adapters/mongodbWrites.mjs +18 -3
  36. package/dist/adapters/prisma.cjs +55 -7
  37. package/dist/adapters/prisma.d.cts +0 -1
  38. package/dist/adapters/prisma.d.mts +0 -1
  39. package/dist/adapters/prisma.mjs +56 -7
  40. package/dist/adapters/prismaQuery.cjs +0 -1
  41. package/dist/adapters/prismaRows.cjs +22 -1
  42. package/dist/adapters/prismaRows.mjs +22 -1
  43. package/dist/apiKeys.cjs +6 -2
  44. package/dist/apiKeys.d.cts +0 -1
  45. package/dist/apiKeys.d.mts +0 -1
  46. package/dist/apiKeys.mjs +3 -3
  47. package/dist/createHotUpdaterCore.cjs +24 -9
  48. package/dist/createHotUpdaterCore.d.cts +1 -1
  49. package/dist/createHotUpdaterCore.d.mts +1 -1
  50. package/dist/createHotUpdaterCore.mjs +23 -9
  51. package/dist/db/createBundleDiff.cjs +2 -2
  52. package/dist/db/createBundleDiff.d.cts +1 -5
  53. package/dist/db/createBundleDiff.d.mts +1 -5
  54. package/dist/db/databasePluginCore.cjs +0 -1
  55. package/dist/db/fixedMigrator.cjs +2 -2
  56. package/dist/db/fixedMigrator.mjs +2 -2
  57. package/dist/db/fixedMigratorMongo.cjs +6 -4
  58. package/dist/db/fixedMigratorMongo.mjs +6 -4
  59. package/dist/db/index.d.cts +0 -1
  60. package/dist/db/index.d.mts +0 -1
  61. package/dist/db/releaseCatalog.cjs +0 -1
  62. package/dist/db/releaseCatalog.d.cts +0 -1
  63. package/dist/db/releaseCatalog.d.mts +0 -1
  64. package/dist/db/schema/insightsCollation.cjs +14 -0
  65. package/dist/db/schema/insightsCollation.mjs +14 -0
  66. package/dist/db/schema/sql.cjs +11 -7
  67. package/dist/db/schema/sql.mjs +8 -8
  68. package/dist/db/schemaGenerators.cjs +28 -9
  69. package/dist/db/schemaGenerators.mjs +28 -9
  70. package/dist/db/schemaReadiness.cjs +2 -0
  71. package/dist/db/schemaReadiness.d.cts +1 -0
  72. package/dist/db/schemaReadiness.d.mts +1 -0
  73. package/dist/db/schemaReadiness.mjs +2 -0
  74. package/dist/db/sqlMigrationExecution.cjs +1 -1
  75. package/dist/db/sqlMigrationExecution.mjs +1 -0
  76. package/dist/db/types.cjs +3 -1
  77. package/dist/db/types.d.cts +3 -6
  78. package/dist/db/types.d.mts +3 -6
  79. package/dist/db/types.mjs +2 -2
  80. package/dist/db/updateArtifacts.cjs +0 -1
  81. package/dist/handler.d.cts +1 -2
  82. package/dist/handler.d.mts +1 -2
  83. package/dist/handlerReleaseCatalogRoutes.cjs +0 -1
  84. package/dist/handlerReleaseManagementRoutes.cjs +0 -1
  85. package/dist/handlerTypes.d.cts +0 -1
  86. package/dist/handlerTypes.d.mts +0 -1
  87. package/dist/handlerVersionRoutes.d.cts +1 -0
  88. package/dist/handlerVersionRoutes.d.mts +1 -0
  89. package/dist/index.cjs +1 -1
  90. package/dist/index.d.cts +4 -4
  91. package/dist/index.d.mts +4 -4
  92. package/dist/index.mjs +1 -1
  93. package/dist/insights/domain.d.cts +37 -69
  94. package/dist/insights/domain.d.mts +37 -69
  95. package/dist/insights/errors.cjs +1 -8
  96. package/dist/insights/errors.mjs +2 -8
  97. package/dist/insights/eventInput.cjs +49 -5
  98. package/dist/insights/eventInput.mjs +48 -6
  99. package/dist/insights/provider.cjs +314 -0
  100. package/dist/insights/provider.d.cts +6 -0
  101. package/dist/insights/provider.d.mts +6 -0
  102. package/dist/insights/provider.mjs +314 -0
  103. package/dist/insights/queryInput.cjs +78 -43
  104. package/dist/insights/queryInput.mjs +76 -40
  105. package/dist/insights/routes.cjs +20 -25
  106. package/dist/insights/routes.mjs +22 -27
  107. package/dist/insights/types.d.cts +27 -12
  108. package/dist/insights/types.d.mts +27 -12
  109. package/dist/node.d.cts +0 -1
  110. package/dist/node.d.mts +0 -1
  111. package/dist/package.cjs +1 -1
  112. package/dist/package.mjs +1 -1
  113. package/dist/schema/index.cjs +17 -3
  114. package/dist/schema/index.mjs +4 -4
  115. package/dist/schema/v1_0_0.cjs +72 -30
  116. package/dist/schema/v1_0_0.mjs +72 -31
  117. package/dist/storageAccess.cjs +0 -1
  118. package/dist/types/index.d.cts +0 -1
  119. package/dist/types/index.d.mts +0 -1
  120. package/package.json +7 -7
  121. package/src/adapters/databasePluginTestDatabase.ts +14 -0
  122. package/src/adapters/drizzle.spec.ts +99 -0
  123. package/src/adapters/drizzle.ts +21 -3
  124. package/src/adapters/drizzleCrud.ts +154 -2
  125. package/src/adapters/drizzleLazyDB.ts +17 -3
  126. package/src/adapters/insightsTransaction.ts +32 -0
  127. package/src/adapters/kysely.spec.ts +29 -0
  128. package/src/adapters/kysely.ts +10 -1
  129. package/src/adapters/kyselyCrud.ts +121 -0
  130. package/src/adapters/mongodb.integration.spec.ts +210 -0
  131. package/src/adapters/mongodb.spec.ts +69 -1
  132. package/src/adapters/mongodb.ts +66 -2
  133. package/src/adapters/mongodbCollections.ts +5 -0
  134. package/src/adapters/mongodbQuery.ts +32 -3
  135. package/src/adapters/mongodbReads.ts +69 -0
  136. package/src/adapters/mongodbTestClient.ts +41 -6
  137. package/src/adapters/mongodbTestFilter.ts +4 -1
  138. package/src/adapters/mongodbWrites.ts +27 -0
  139. package/src/adapters/prisma.spec.ts +97 -0
  140. package/src/adapters/prisma.ts +103 -3
  141. package/src/adapters/prismaRows.ts +37 -1
  142. package/src/adapters/prismaTestClient.ts +22 -5
  143. package/src/apiKeys.integration.spec.ts +1 -1
  144. package/src/createHotUpdaterCore.ts +21 -7
  145. package/src/db/databasePluginUpdateCheck.bench.ts +3 -0
  146. package/src/db/fixedMigrator.spec.ts +65 -0
  147. package/src/db/fixedMigratorMongo.spec.ts +56 -9
  148. package/src/db/fixedMigratorMongo.ts +10 -10
  149. package/src/db/index.spec.ts +8 -1
  150. package/src/db/schema/insightsCollation.ts +21 -0
  151. package/src/db/schema/sql.ts +8 -5
  152. package/src/db/schemaGenerators.ts +41 -13
  153. package/src/db/types.spec.ts +8 -0
  154. package/src/db/types.ts +10 -4
  155. package/src/handler-standalone.integration.spec.ts +5 -7
  156. package/src/index.ts +2 -2
  157. package/src/insights/domain.ts +39 -75
  158. package/src/insights/errors.ts +0 -7
  159. package/src/insights/eventInput.ts +60 -3
  160. package/src/insights/insights.integration.spec.ts +254 -17
  161. package/src/insights/provider.spec.ts +385 -0
  162. package/src/insights/provider.ts +591 -0
  163. package/src/insights/queryInput.ts +112 -73
  164. package/src/insights/routes.ts +37 -56
  165. package/src/insights/types.ts +47 -36
  166. package/src/schema/dsl-all-versions.spec.ts +3 -1
  167. package/src/schema/v1_0_0.spec.ts +77 -3
  168. package/src/schema/v1_0_0.ts +94 -30
  169. package/dist/insights/bounded/activeOverview.cjs +0 -87
  170. package/dist/insights/bounded/activeOverview.mjs +0 -85
  171. package/dist/insights/bounded/installationSearch.cjs +0 -42
  172. package/dist/insights/bounded/installationSearch.mjs +0 -42
  173. package/dist/insights/bounded/persistence.cjs +0 -39
  174. package/dist/insights/bounded/persistence.mjs +0 -38
  175. package/dist/insights/bounded/provider.cjs +0 -170
  176. package/dist/insights/bounded/provider.d.cts +0 -7
  177. package/dist/insights/bounded/provider.d.mts +0 -7
  178. package/dist/insights/bounded/provider.mjs +0 -170
  179. package/dist/insights/bounded/scan.cjs +0 -144
  180. package/dist/insights/bounded/scan.mjs +0 -138
  181. package/dist/insights/persistence.d.cts +0 -6
  182. package/dist/insights/persistence.d.mts +0 -6
  183. package/src/insights/bounded/activeOverview.spec.ts +0 -189
  184. package/src/insights/bounded/activeOverview.ts +0 -148
  185. package/src/insights/bounded/installationSearch.spec.ts +0 -130
  186. package/src/insights/bounded/installationSearch.ts +0 -69
  187. package/src/insights/bounded/persistence.ts +0 -43
  188. package/src/insights/bounded/provider.spec.ts +0 -219
  189. package/src/insights/bounded/provider.ts +0 -229
  190. package/src/insights/bounded/scan.ts +0 -235
  191. package/src/insights/persistence.ts +0 -10
@@ -1,6 +1,5 @@
1
1
  import { DatabasePlugin } from "@hot-updater/plugin-core";
2
2
  import { ArtifactInfo, ReleaseCatalog } from "@hot-updater/core";
3
-
4
3
  //#region src/db/releaseCatalog.d.ts
5
4
  type ReleaseCatalogRequest = {
6
5
  readonly strategy: "APP_VERSION";
@@ -0,0 +1,14 @@
1
+ const require_v1_0_0 = require("../../schema/v1_0_0.cjs");
2
+ const require_sql = require("./sql.cjs");
3
+ //#region src/db/schema/insightsCollation.ts
4
+ const getInsightsCollationSql = (provider) => [require_v1_0_0.bundleEventsV100, require_v1_0_0.bundleInstallationsV100].flatMap((table) => table.columns.flatMap((column) => {
5
+ const collation = column.providerCollations?.[provider];
6
+ if (collation === void 0) return [];
7
+ if (provider === "mysql") return [`alter table ${table.ormName} modify column ${require_sql.sqlColumnDefinition(table, {
8
+ ...column,
9
+ primaryKey: void 0
10
+ }, provider)}`];
11
+ return [`alter table ${table.ormName} alter column ${column.ormName} type ${require_sql.getSqlType(column.type, provider)} collate ${collation}`];
12
+ }));
13
+ //#endregion
14
+ exports.getInsightsCollationSql = getInsightsCollationSql;
@@ -0,0 +1,14 @@
1
+ import { bundleEventsV100, bundleInstallationsV100 } from "../../schema/v1_0_0.mjs";
2
+ import { getSqlType, sqlColumnDefinition } from "./sql.mjs";
3
+ //#region src/db/schema/insightsCollation.ts
4
+ const getInsightsCollationSql = (provider) => [bundleEventsV100, bundleInstallationsV100].flatMap((table) => table.columns.flatMap((column) => {
5
+ const collation = column.providerCollations?.[provider];
6
+ if (collation === void 0) return [];
7
+ if (provider === "mysql") return [`alter table ${table.ormName} modify column ${sqlColumnDefinition(table, {
8
+ ...column,
9
+ primaryKey: void 0
10
+ }, provider)}`];
11
+ return [`alter table ${table.ormName} alter column ${column.ormName} type ${getSqlType(column.type, provider)} collate ${collation}`];
12
+ }));
13
+ //#endregion
14
+ export { getInsightsCollationSql };
@@ -83,19 +83,23 @@ const createTableStatement = (table, provider, relationMode = "foreign-keys") =>
83
83
  ];
84
84
  return `create table ${table.ormName} (\n${lines.join(",\n")}\n)`;
85
85
  };
86
- const createForeignKeySqlStatements = (provider, relationMode = "foreign-keys") => {
86
+ const createForeignKeySqlStatements = (provider, relationMode = "foreign-keys", schema = require_registry.hotUpdaterSchema) => {
87
87
  if (relationMode !== "foreign-keys" || provider === "sqlite") return [];
88
- return require_registry.hotUpdaterSchema.tables.flatMap((table) => (table.foreignKeys ?? []).map((foreignKey) => createForeignKeySql(table, foreignKey, provider)));
88
+ return schema.tables.flatMap((table) => (table.foreignKeys ?? []).map((foreignKey) => createForeignKeySql(table, foreignKey, provider)));
89
89
  };
90
- const createTableSql = (provider, relationMode = "foreign-keys") => [
91
- ...require_registry.hotUpdaterSchema.tables.map((table) => createTableStatement(table, provider, relationMode)),
92
- ...require_registry.hotUpdaterSchema.tables.flatMap((table) => (table.indexes ?? []).filter((index) => require_registry.schemaIndexAppliesToProvider(index, provider)).map((index) => createIndexSql(table, index, provider))),
93
- ...provider === "sqlite" ? [] : require_registry.hotUpdaterSchema.tables.flatMap((table) => (table.checks ?? []).map((check) => createCheckSql(table, check, provider))),
94
- ...createForeignKeySqlStatements(provider, relationMode)
90
+ const createTableSql = (provider, relationMode = "foreign-keys", schema = require_registry.hotUpdaterSchema) => [
91
+ ...schema.tables.map((table) => createTableStatement(table, provider, relationMode)),
92
+ ...schema.tables.flatMap((table) => (table.indexes ?? []).filter((index) => require_registry.schemaIndexAppliesToProvider(index, provider)).map((index) => createIndexSql(table, index, provider))),
93
+ ...provider === "sqlite" ? [] : schema.tables.flatMap((table) => (table.checks ?? []).map((check) => createCheckSql(table, check, provider))),
94
+ ...createForeignKeySqlStatements(provider, relationMode, schema)
95
95
  ];
96
96
  //#endregion
97
97
  exports.createCheckSql = createCheckSql;
98
98
  exports.createForeignKeySql = createForeignKeySql;
99
+ exports.createForeignKeySqlStatements = createForeignKeySqlStatements;
99
100
  exports.createIndexSql = createIndexSql;
100
101
  exports.createTableSql = createTableSql;
102
+ exports.createTableStatement = createTableStatement;
103
+ exports.getSqlType = getSqlType;
101
104
  exports.hotUpdaterCreateTableOperations = hotUpdaterCreateTableOperations;
105
+ exports.sqlColumnDefinition = sqlColumnDefinition;
@@ -83,15 +83,15 @@ const createTableStatement = (table, provider, relationMode = "foreign-keys") =>
83
83
  ];
84
84
  return `create table ${table.ormName} (\n${lines.join(",\n")}\n)`;
85
85
  };
86
- const createForeignKeySqlStatements = (provider, relationMode = "foreign-keys") => {
86
+ const createForeignKeySqlStatements = (provider, relationMode = "foreign-keys", schema = hotUpdaterSchema) => {
87
87
  if (relationMode !== "foreign-keys" || provider === "sqlite") return [];
88
- return hotUpdaterSchema.tables.flatMap((table) => (table.foreignKeys ?? []).map((foreignKey) => createForeignKeySql(table, foreignKey, provider)));
88
+ return schema.tables.flatMap((table) => (table.foreignKeys ?? []).map((foreignKey) => createForeignKeySql(table, foreignKey, provider)));
89
89
  };
90
- const createTableSql = (provider, relationMode = "foreign-keys") => [
91
- ...hotUpdaterSchema.tables.map((table) => createTableStatement(table, provider, relationMode)),
92
- ...hotUpdaterSchema.tables.flatMap((table) => (table.indexes ?? []).filter((index) => schemaIndexAppliesToProvider(index, provider)).map((index) => createIndexSql(table, index, provider))),
93
- ...provider === "sqlite" ? [] : hotUpdaterSchema.tables.flatMap((table) => (table.checks ?? []).map((check) => createCheckSql(table, check, provider))),
94
- ...createForeignKeySqlStatements(provider, relationMode)
90
+ const createTableSql = (provider, relationMode = "foreign-keys", schema = hotUpdaterSchema) => [
91
+ ...schema.tables.map((table) => createTableStatement(table, provider, relationMode)),
92
+ ...schema.tables.flatMap((table) => (table.indexes ?? []).filter((index) => schemaIndexAppliesToProvider(index, provider)).map((index) => createIndexSql(table, index, provider))),
93
+ ...provider === "sqlite" ? [] : schema.tables.flatMap((table) => (table.checks ?? []).map((check) => createCheckSql(table, check, provider))),
94
+ ...createForeignKeySqlStatements(provider, relationMode, schema)
95
95
  ];
96
96
  //#endregion
97
- export { createCheckSql, createForeignKeySql, createIndexSql, createTableSql, hotUpdaterCreateTableOperations };
97
+ export { createCheckSql, createForeignKeySql, createForeignKeySqlStatements, createIndexSql, createTableSql, createTableStatement, getSqlType, hotUpdaterCreateTableOperations, sqlColumnDefinition };
@@ -1,6 +1,8 @@
1
1
  require("../schema/types.cjs");
2
2
  const require_types$1 = require("./types.cjs");
3
3
  const require_registry = require("./schema/registry.cjs");
4
+ const require_sql = require("./schema/sql.cjs");
5
+ const require_insightsCollation = require("./schema/insightsCollation.cjs");
4
6
  //#region src/db/schemaGenerators.ts
5
7
  const literal = (value) => JSON.stringify(value);
6
8
  const varcharLength = (type) => Number(type.slice(8, -1));
@@ -55,17 +57,34 @@ const prismaRelationFields = (table, schema) => {
55
57
  return lines;
56
58
  };
57
59
  const prismaIndexes = (table, provider) => (table.indexes ?? []).filter((index) => require_registry.schemaIndexAppliesToProvider(index, provider)).map((index) => `@@${index.unique ? "unique" : "index"}([${index.columns.join(", ")}], map: ${literal(index.name)})`);
58
- const generatePrismaSchema = (provider, schema = require_registry.hotUpdaterSchema) => schema.tables.map((table) => {
59
- const lines = [
60
- ...table.columns.map((column) => prismaField(column, provider)),
61
- ...prismaRelationFields(table, schema),
62
- ...prismaIndexes(table, provider)
63
- ];
64
- return `model ${table.ormName} {\n${lines.map((line) => ` ${line}`).join("\n")}\n}`;
65
- }).join("\n\n");
60
+ const generatePrismaSchema = (provider, schema = require_registry.hotUpdaterSchema) => {
61
+ const sqlProvider = require_types$1.getSQLProvider(provider);
62
+ const collationSql = sqlProvider ? require_insightsCollation.getInsightsCollationSql(sqlProvider) : [];
63
+ return (collationSql.length === 0 ? "" : [
64
+ "// Apply these statements in the initial Prisma SQL migration to preserve exact Insights identities and cursors:",
65
+ ...collationSql.map((statement) => `// ${statement};`),
66
+ ""
67
+ ].join("\n")) + schema.tables.map((table) => {
68
+ const lines = [
69
+ ...table.columns.map((column) => prismaField(column, provider)),
70
+ ...prismaRelationFields(table, schema),
71
+ ...prismaIndexes(table, provider)
72
+ ];
73
+ return `model ${table.ormName} {\n${lines.map((line) => ` ${line}`).join("\n")}\n}`;
74
+ }).join("\n\n");
75
+ };
66
76
  const drizzleImportSource = (provider) => provider === "sqlite" ? "drizzle-orm/sqlite-core" : provider === "mysql" ? "drizzle-orm/mysql-core" : "drizzle-orm/pg-core";
67
77
  const drizzleTableFn = (provider) => provider === "sqlite" ? "sqliteTable" : provider === "mysql" ? "mysqlTable" : "pgTable";
68
78
  const drizzleColumnFn = (column, provider) => {
79
+ const collation = column.providerCollations?.[provider];
80
+ if (collation !== void 0) {
81
+ const charset = provider === "mysql" ? ` character set ${collation === "ascii_bin" ? "ascii" : "utf8mb4"}` : "";
82
+ const dataType = `${require_sql.getSqlType(column.type, provider)}${charset} collate ${collation}`;
83
+ return {
84
+ code: `customType<{ data: string }>({ dataType: () => ${literal(dataType)} })(${literal(column.ormName)})`,
85
+ imports: ["customType"]
86
+ };
87
+ }
69
88
  if (provider === "sqlite") {
70
89
  if (column.type === "bool") return {
71
90
  code: `integer(${literal(column.ormName)}, { mode: "boolean" })`,
@@ -227,7 +246,7 @@ ${lines.join(",\n")}
227
246
  }))`;
228
247
  };
229
248
  const generateDrizzleSchema = (provider, schema = require_registry.hotUpdaterSchema) => {
230
- const imports = new Set([drizzleTableFn(provider)]);
249
+ const imports = /* @__PURE__ */ new Set([drizzleTableFn(provider)]);
231
250
  const body = [];
232
251
  for (const table of schema.tables) {
233
252
  body.push(drizzleTable(table, provider, imports));
@@ -1,6 +1,8 @@
1
1
  import "../schema/types.mjs";
2
2
  import { getSQLProvider } from "./types.mjs";
3
3
  import { getHotUpdaterSchemaVersion, hotUpdaterSchema, schemaIndexAppliesToProvider } from "./schema/registry.mjs";
4
+ import { getSqlType } from "./schema/sql.mjs";
5
+ import { getInsightsCollationSql } from "./schema/insightsCollation.mjs";
4
6
  //#region src/db/schemaGenerators.ts
5
7
  const literal = (value) => JSON.stringify(value);
6
8
  const varcharLength = (type) => Number(type.slice(8, -1));
@@ -55,17 +57,34 @@ const prismaRelationFields = (table, schema) => {
55
57
  return lines;
56
58
  };
57
59
  const prismaIndexes = (table, provider) => (table.indexes ?? []).filter((index) => schemaIndexAppliesToProvider(index, provider)).map((index) => `@@${index.unique ? "unique" : "index"}([${index.columns.join(", ")}], map: ${literal(index.name)})`);
58
- const generatePrismaSchema = (provider, schema = hotUpdaterSchema) => schema.tables.map((table) => {
59
- const lines = [
60
- ...table.columns.map((column) => prismaField(column, provider)),
61
- ...prismaRelationFields(table, schema),
62
- ...prismaIndexes(table, provider)
63
- ];
64
- return `model ${table.ormName} {\n${lines.map((line) => ` ${line}`).join("\n")}\n}`;
65
- }).join("\n\n");
60
+ const generatePrismaSchema = (provider, schema = hotUpdaterSchema) => {
61
+ const sqlProvider = getSQLProvider(provider);
62
+ const collationSql = sqlProvider ? getInsightsCollationSql(sqlProvider) : [];
63
+ return (collationSql.length === 0 ? "" : [
64
+ "// Apply these statements in the initial Prisma SQL migration to preserve exact Insights identities and cursors:",
65
+ ...collationSql.map((statement) => `// ${statement};`),
66
+ ""
67
+ ].join("\n")) + schema.tables.map((table) => {
68
+ const lines = [
69
+ ...table.columns.map((column) => prismaField(column, provider)),
70
+ ...prismaRelationFields(table, schema),
71
+ ...prismaIndexes(table, provider)
72
+ ];
73
+ return `model ${table.ormName} {\n${lines.map((line) => ` ${line}`).join("\n")}\n}`;
74
+ }).join("\n\n");
75
+ };
66
76
  const drizzleImportSource = (provider) => provider === "sqlite" ? "drizzle-orm/sqlite-core" : provider === "mysql" ? "drizzle-orm/mysql-core" : "drizzle-orm/pg-core";
67
77
  const drizzleTableFn = (provider) => provider === "sqlite" ? "sqliteTable" : provider === "mysql" ? "mysqlTable" : "pgTable";
68
78
  const drizzleColumnFn = (column, provider) => {
79
+ const collation = column.providerCollations?.[provider];
80
+ if (collation !== void 0) {
81
+ const charset = provider === "mysql" ? ` character set ${collation === "ascii_bin" ? "ascii" : "utf8mb4"}` : "";
82
+ const dataType = `${getSqlType(column.type, provider)}${charset} collate ${collation}`;
83
+ return {
84
+ code: `customType<{ data: string }>({ dataType: () => ${literal(dataType)} })(${literal(column.ormName)})`,
85
+ imports: ["customType"]
86
+ };
87
+ }
69
88
  if (provider === "sqlite") {
70
89
  if (column.type === "bool") return {
71
90
  code: `integer(${literal(column.ormName)}, { mode: "boolean" })`,
@@ -227,7 +246,7 @@ ${lines.join(",\n")}
227
246
  }))`;
228
247
  };
229
248
  const generateDrizzleSchema = (provider, schema = hotUpdaterSchema) => {
230
- const imports = new Set([drizzleTableFn(provider)]);
249
+ const imports = /* @__PURE__ */ new Set([drizzleTableFn(provider)]);
231
250
  const body = [];
232
251
  for (const table of schema.tables) {
233
252
  body.push(drizzleTable(table, provider, imports));
@@ -2,6 +2,8 @@ require("../schema/types.cjs");
2
2
  const require_fixedMigratorShared = require("./fixedMigratorShared.cjs");
3
3
  //#region src/db/schemaReadiness.ts
4
4
  var HotUpdaterSchemaMigrationRequiredError = class extends Error {
5
+ adapterName;
6
+ currentVersion;
5
7
  constructor(adapterName, currentVersion) {
6
8
  super(currentVersion === void 0 ? `Hot Updater database schema is not initialized for ${adapterName}. Run \`hot-updater db migrate\` before using this adapter.` : require_fixedMigratorShared.unsupportedSchemaUpgradeMessage(currentVersion));
7
9
  this.adapterName = adapterName;
@@ -1,3 +1,4 @@
1
+ import "./types.cjs";
1
2
  //#region src/db/schemaReadiness.d.ts
2
3
  declare class HotUpdaterSchemaMigrationRequiredError extends Error {
3
4
  readonly adapterName: string;
@@ -1,3 +1,4 @@
1
+ import "./types.mjs";
1
2
  //#region src/db/schemaReadiness.d.ts
2
3
  declare class HotUpdaterSchemaMigrationRequiredError extends Error {
3
4
  readonly adapterName: string;
@@ -2,6 +2,8 @@ import "../schema/types.mjs";
2
2
  import { unsupportedSchemaUpgradeMessage } from "./fixedMigratorShared.mjs";
3
3
  //#region src/db/schemaReadiness.ts
4
4
  var HotUpdaterSchemaMigrationRequiredError = class extends Error {
5
+ adapterName;
6
+ currentVersion;
5
7
  constructor(adapterName, currentVersion) {
6
8
  super(currentVersion === void 0 ? `Hot Updater database schema is not initialized for ${adapterName}. Run \`hot-updater db migrate\` before using this adapter.` : unsupportedSchemaUpgradeMessage(currentVersion));
7
9
  this.adapterName = adapterName;
@@ -1,7 +1,7 @@
1
- require("../_virtual/_rolldown/runtime.cjs");
2
1
  let kysely = require("kysely");
3
2
  //#region src/db/sqlMigrationExecution.ts
4
3
  var SqliteMigrationForeignKeyError = class extends Error {
4
+ violations;
5
5
  name = "SqliteMigrationForeignKeyError";
6
6
  constructor(violations) {
7
7
  super(`SQLite migration produced ${violations} foreign key violation(s).`);
@@ -1,6 +1,7 @@
1
1
  import { sql } from "kysely";
2
2
  //#region src/db/sqlMigrationExecution.ts
3
3
  var SqliteMigrationForeignKeyError = class extends Error {
4
+ violations;
4
5
  name = "SqliteMigrationForeignKeyError";
5
6
  constructor(violations) {
6
7
  super(`SQLite migration produced ${violations} foreign key violation(s).`);
package/dist/db/types.cjs CHANGED
@@ -9,7 +9,7 @@ const sqlProviders = [
9
9
  const noSqlProviders = ["mongodb"];
10
10
  [...sqlProviders, ...noSqlProviders];
11
11
  function isDatabasePlugin(plugin) {
12
- return typeof plugin === "object" && plugin !== null && "name" in plugin && typeof plugin.name === "string" && "models" in plugin && typeof plugin.models === "object" && plugin.models !== null && "bundles" in plugin.models && typeof plugin.models.bundles === "object" && plugin.models.bundles !== null && "findById" in plugin.models.bundles && typeof plugin.models.bundles.findById === "function" && "findMany" in plugin.models.bundles && typeof plugin.models.bundles.findMany === "function" && "count" in plugin.models.bundles && typeof plugin.models.bundles.count === "function" && "bundlePatches" in plugin.models && typeof plugin.models.bundlePatches === "object" && plugin.models.bundlePatches !== null && "findByBundleIds" in plugin.models.bundlePatches && typeof plugin.models.bundlePatches.findByBundleIds === "function" && "channels" in plugin.models && typeof plugin.models.channels === "object" && plugin.models.channels !== null && "insert" in plugin.models.channels && typeof plugin.models.channels.insert === "function" && "list" in plugin.models.channels && typeof plugin.models.channels.list === "function" && "delete" in plugin.models.channels && typeof plugin.models.channels.delete === "function" && "insights" in plugin.models && typeof plugin.models.insights === "object" && plugin.models.insights !== null && "append" in plugin.models.insights && typeof plugin.models.insights.append === "function" && "scan" in plugin.models.insights && typeof plugin.models.insights.scan === "function" && "apiKeys" in plugin.models && typeof plugin.models.apiKeys === "object" && plugin.models.apiKeys !== null && "create" in plugin.models.apiKeys && typeof plugin.models.apiKeys.create === "function" && "findByHash" in plugin.models.apiKeys && typeof plugin.models.apiKeys.findByHash === "function" && "list" in plugin.models.apiKeys && typeof plugin.models.apiKeys.list === "function" && "revoke" in plugin.models.apiKeys && typeof plugin.models.apiKeys.revoke === "function" && "commit" in plugin && typeof plugin.commit === "function" && (!("dispose" in plugin) || plugin.dispose === void 0 || typeof plugin.dispose === "function");
12
+ return typeof plugin === "object" && plugin !== null && "name" in plugin && typeof plugin.name === "string" && "models" in plugin && typeof plugin.models === "object" && plugin.models !== null && "bundles" in plugin.models && typeof plugin.models.bundles === "object" && plugin.models.bundles !== null && "findById" in plugin.models.bundles && typeof plugin.models.bundles.findById === "function" && "findMany" in plugin.models.bundles && typeof plugin.models.bundles.findMany === "function" && "count" in plugin.models.bundles && typeof plugin.models.bundles.count === "function" && "bundlePatches" in plugin.models && typeof plugin.models.bundlePatches === "object" && plugin.models.bundlePatches !== null && "findByBundleIds" in plugin.models.bundlePatches && typeof plugin.models.bundlePatches.findByBundleIds === "function" && "channels" in plugin.models && typeof plugin.models.channels === "object" && plugin.models.channels !== null && "insert" in plugin.models.channels && typeof plugin.models.channels.insert === "function" && "list" in plugin.models.channels && typeof plugin.models.channels.list === "function" && "delete" in plugin.models.channels && typeof plugin.models.channels.delete === "function" && "insights" in plugin.models && typeof plugin.models.insights === "object" && plugin.models.insights !== null && "record" in plugin.models.insights && typeof plugin.models.insights.record === "function" && "listEvents" in plugin.models.insights && typeof plugin.models.insights.listEvents === "function" && "findInstallations" in plugin.models.insights && typeof plugin.models.insights.findInstallations === "function" && "countEvents" in plugin.models.insights && typeof plugin.models.insights.countEvents === "function" && "countInstallations" in plugin.models.insights && typeof plugin.models.insights.countInstallations === "function" && "apiKeys" in plugin.models && typeof plugin.models.apiKeys === "object" && plugin.models.apiKeys !== null && "create" in plugin.models.apiKeys && typeof plugin.models.apiKeys.create === "function" && "findByHash" in plugin.models.apiKeys && typeof plugin.models.apiKeys.findByHash === "function" && "list" in plugin.models.apiKeys && typeof plugin.models.apiKeys.list === "function" && "revoke" in plugin.models.apiKeys && typeof plugin.models.apiKeys.revoke === "function" && "commit" in plugin && typeof plugin.commit === "function" && (!("dispose" in plugin) || plugin.dispose === void 0 || typeof plugin.dispose === "function");
13
13
  }
14
14
  function getSQLProvider(provider) {
15
15
  if (!provider) return;
@@ -18,3 +18,5 @@ function getSQLProvider(provider) {
18
18
  //#endregion
19
19
  exports.getSQLProvider = getSQLProvider;
20
20
  exports.isDatabasePlugin = isDatabasePlugin;
21
+ exports.noSqlProviders = noSqlProviders;
22
+ exports.sqlProviders = sqlProviders;
@@ -1,10 +1,7 @@
1
1
  import { ReleaseCatalogRequest } from "./releaseCatalog.cjs";
2
2
  import { PaginatedResult } from "../types/index.cjs";
3
- import * as _$_hot_updater_core0 from "@hot-updater/core";
4
3
  import { ArtifactInfo, Bundle } from "@hot-updater/core";
5
- import * as _$_hot_updater_plugin_core0 from "@hot-updater/plugin-core";
6
4
  import { ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelRow, DatabaseCommit, DatabaseCommitResult, DatabasePlugin, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildResult, ReleaseCatalogRow, ReleasePolicyPatch, ReleaseRow } from "@hot-updater/plugin-core";
7
-
8
5
  //#region src/db/types.d.ts
9
6
  declare const sqlProviders: readonly ["sqlite", "cockroachdb", "mysql", "postgresql", "mssql"];
10
7
  declare const providers: readonly ["sqlite", "cockroachdb", "mysql", "postgresql", "mssql", "mongodb"];
@@ -69,7 +66,7 @@ type DatabaseAdapterWithCapabilities = DatabasePlugin & DatabaseAdapterCapabilit
69
66
  type DatabasePlugin$1 = DatabaseAdapterWithCapabilities;
70
67
  interface DatabaseAPI {
71
68
  getBundleById(id: string): Promise<Bundle | null>;
72
- getReleaseCatalog(input: ReleaseCatalogRequest): Promise<_$_hot_updater_core0.ReleaseCatalog | null>;
69
+ getReleaseCatalog(input: ReleaseCatalogRequest): Promise<import("@hot-updater/core").ReleaseCatalog | null>;
73
70
  getArtifactInfo(targetBundleId: string, currentBundleId: string): Promise<ArtifactInfo | null>;
74
71
  getReleaseById(id: string): Promise<ReleaseRow | null>;
75
72
  getReleasesByScope(input: {
@@ -111,11 +108,11 @@ interface DatabaseAPI {
111
108
  getChannels(): Promise<readonly ChannelRow[]>;
112
109
  insertChannel(input: ChannelInsertInput): Promise<ChannelInsertResult>;
113
110
  deleteChannel(input: ChannelDeleteInput): Promise<ChannelDeleteResult>;
114
- getBundles(options: _$_hot_updater_plugin_core0.DatabaseBundleQueryOptions): Promise<PaginatedResult>;
111
+ getBundles(options: import("@hot-updater/plugin-core").DatabaseBundleQueryOptions): Promise<PaginatedResult>;
115
112
  insertBundle(bundle: Bundle): Promise<void>;
116
113
  insertBundles(bundles: readonly Bundle[]): Promise<void>;
117
114
  updateBundleById(bundleId: string, newBundle: Partial<Bundle>): Promise<void>;
118
115
  deleteBundleById(bundleId: string): Promise<void>;
119
116
  }
120
117
  //#endregion
121
- export { DatabaseAPI, DatabaseAdapterWithCapabilities, DatabasePlugin$1 as DatabasePlugin, Migrator, ORMProvider, ORMSQLProvider, RelationMode, SchemaGenerator };
118
+ export { DatabaseAPI, DatabaseAdapterCapabilities, DatabaseAdapterWithCapabilities, DatabasePlugin$1 as DatabasePlugin, MigrateOptions, MigrationOperation, MigrationResult, Migrator, ORMProvider, ORMSQLProvider, RelationMode, SchemaGenerator, providers, sqlProviders };
@@ -1,10 +1,7 @@
1
1
  import { ReleaseCatalogRequest } from "./releaseCatalog.mjs";
2
2
  import { PaginatedResult } from "../types/index.mjs";
3
- import * as _$_hot_updater_plugin_core0 from "@hot-updater/plugin-core";
4
3
  import { ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelRow, DatabaseCommit, DatabaseCommitResult, DatabasePlugin, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildResult, ReleaseCatalogRow, ReleasePolicyPatch, ReleaseRow } from "@hot-updater/plugin-core";
5
- import * as _$_hot_updater_core0 from "@hot-updater/core";
6
4
  import { ArtifactInfo, Bundle as Bundle$1 } from "@hot-updater/core";
7
-
8
5
  //#region src/db/types.d.ts
9
6
  declare const sqlProviders: readonly ["sqlite", "cockroachdb", "mysql", "postgresql", "mssql"];
10
7
  declare const providers: readonly ["sqlite", "cockroachdb", "mysql", "postgresql", "mssql", "mongodb"];
@@ -69,7 +66,7 @@ type DatabaseAdapterWithCapabilities = DatabasePlugin & DatabaseAdapterCapabilit
69
66
  type DatabasePlugin$1 = DatabaseAdapterWithCapabilities;
70
67
  interface DatabaseAPI {
71
68
  getBundleById(id: string): Promise<Bundle$1 | null>;
72
- getReleaseCatalog(input: ReleaseCatalogRequest): Promise<_$_hot_updater_core0.ReleaseCatalog | null>;
69
+ getReleaseCatalog(input: ReleaseCatalogRequest): Promise<import("@hot-updater/core").ReleaseCatalog | null>;
73
70
  getArtifactInfo(targetBundleId: string, currentBundleId: string): Promise<ArtifactInfo | null>;
74
71
  getReleaseById(id: string): Promise<ReleaseRow | null>;
75
72
  getReleasesByScope(input: {
@@ -111,11 +108,11 @@ interface DatabaseAPI {
111
108
  getChannels(): Promise<readonly ChannelRow[]>;
112
109
  insertChannel(input: ChannelInsertInput): Promise<ChannelInsertResult>;
113
110
  deleteChannel(input: ChannelDeleteInput): Promise<ChannelDeleteResult>;
114
- getBundles(options: _$_hot_updater_plugin_core0.DatabaseBundleQueryOptions): Promise<PaginatedResult>;
111
+ getBundles(options: import("@hot-updater/plugin-core").DatabaseBundleQueryOptions): Promise<PaginatedResult>;
115
112
  insertBundle(bundle: Bundle$1): Promise<void>;
116
113
  insertBundles(bundles: readonly Bundle$1[]): Promise<void>;
117
114
  updateBundleById(bundleId: string, newBundle: Partial<Bundle$1>): Promise<void>;
118
115
  deleteBundleById(bundleId: string): Promise<void>;
119
116
  }
120
117
  //#endregion
121
- export { DatabaseAPI, DatabaseAdapterWithCapabilities, DatabasePlugin$1 as DatabasePlugin, Migrator, ORMProvider, ORMSQLProvider, RelationMode, SchemaGenerator };
118
+ export { DatabaseAPI, DatabaseAdapterCapabilities, DatabaseAdapterWithCapabilities, DatabasePlugin$1 as DatabasePlugin, MigrateOptions, MigrationOperation, MigrationResult, Migrator, ORMProvider, ORMSQLProvider, RelationMode, SchemaGenerator, providers, sqlProviders };
package/dist/db/types.mjs CHANGED
@@ -9,11 +9,11 @@ const sqlProviders = [
9
9
  const noSqlProviders = ["mongodb"];
10
10
  [...sqlProviders, ...noSqlProviders];
11
11
  function isDatabasePlugin(plugin) {
12
- return typeof plugin === "object" && plugin !== null && "name" in plugin && typeof plugin.name === "string" && "models" in plugin && typeof plugin.models === "object" && plugin.models !== null && "bundles" in plugin.models && typeof plugin.models.bundles === "object" && plugin.models.bundles !== null && "findById" in plugin.models.bundles && typeof plugin.models.bundles.findById === "function" && "findMany" in plugin.models.bundles && typeof plugin.models.bundles.findMany === "function" && "count" in plugin.models.bundles && typeof plugin.models.bundles.count === "function" && "bundlePatches" in plugin.models && typeof plugin.models.bundlePatches === "object" && plugin.models.bundlePatches !== null && "findByBundleIds" in plugin.models.bundlePatches && typeof plugin.models.bundlePatches.findByBundleIds === "function" && "channels" in plugin.models && typeof plugin.models.channels === "object" && plugin.models.channels !== null && "insert" in plugin.models.channels && typeof plugin.models.channels.insert === "function" && "list" in plugin.models.channels && typeof plugin.models.channels.list === "function" && "delete" in plugin.models.channels && typeof plugin.models.channels.delete === "function" && "insights" in plugin.models && typeof plugin.models.insights === "object" && plugin.models.insights !== null && "append" in plugin.models.insights && typeof plugin.models.insights.append === "function" && "scan" in plugin.models.insights && typeof plugin.models.insights.scan === "function" && "apiKeys" in plugin.models && typeof plugin.models.apiKeys === "object" && plugin.models.apiKeys !== null && "create" in plugin.models.apiKeys && typeof plugin.models.apiKeys.create === "function" && "findByHash" in plugin.models.apiKeys && typeof plugin.models.apiKeys.findByHash === "function" && "list" in plugin.models.apiKeys && typeof plugin.models.apiKeys.list === "function" && "revoke" in plugin.models.apiKeys && typeof plugin.models.apiKeys.revoke === "function" && "commit" in plugin && typeof plugin.commit === "function" && (!("dispose" in plugin) || plugin.dispose === void 0 || typeof plugin.dispose === "function");
12
+ return typeof plugin === "object" && plugin !== null && "name" in plugin && typeof plugin.name === "string" && "models" in plugin && typeof plugin.models === "object" && plugin.models !== null && "bundles" in plugin.models && typeof plugin.models.bundles === "object" && plugin.models.bundles !== null && "findById" in plugin.models.bundles && typeof plugin.models.bundles.findById === "function" && "findMany" in plugin.models.bundles && typeof plugin.models.bundles.findMany === "function" && "count" in plugin.models.bundles && typeof plugin.models.bundles.count === "function" && "bundlePatches" in plugin.models && typeof plugin.models.bundlePatches === "object" && plugin.models.bundlePatches !== null && "findByBundleIds" in plugin.models.bundlePatches && typeof plugin.models.bundlePatches.findByBundleIds === "function" && "channels" in plugin.models && typeof plugin.models.channels === "object" && plugin.models.channels !== null && "insert" in plugin.models.channels && typeof plugin.models.channels.insert === "function" && "list" in plugin.models.channels && typeof plugin.models.channels.list === "function" && "delete" in plugin.models.channels && typeof plugin.models.channels.delete === "function" && "insights" in plugin.models && typeof plugin.models.insights === "object" && plugin.models.insights !== null && "record" in plugin.models.insights && typeof plugin.models.insights.record === "function" && "listEvents" in plugin.models.insights && typeof plugin.models.insights.listEvents === "function" && "findInstallations" in plugin.models.insights && typeof plugin.models.insights.findInstallations === "function" && "countEvents" in plugin.models.insights && typeof plugin.models.insights.countEvents === "function" && "countInstallations" in plugin.models.insights && typeof plugin.models.insights.countInstallations === "function" && "apiKeys" in plugin.models && typeof plugin.models.apiKeys === "object" && plugin.models.apiKeys !== null && "create" in plugin.models.apiKeys && typeof plugin.models.apiKeys.create === "function" && "findByHash" in plugin.models.apiKeys && typeof plugin.models.apiKeys.findByHash === "function" && "list" in plugin.models.apiKeys && typeof plugin.models.apiKeys.list === "function" && "revoke" in plugin.models.apiKeys && typeof plugin.models.apiKeys.revoke === "function" && "commit" in plugin && typeof plugin.commit === "function" && (!("dispose" in plugin) || plugin.dispose === void 0 || typeof plugin.dispose === "function");
13
13
  }
14
14
  function getSQLProvider(provider) {
15
15
  if (!provider) return;
16
16
  return sqlProviders.includes(provider) ? provider : void 0;
17
17
  }
18
18
  //#endregion
19
- export { getSQLProvider, isDatabasePlugin };
19
+ export { getSQLProvider, isDatabasePlugin, noSqlProviders, sqlProviders };
@@ -1,4 +1,3 @@
1
- require("../_virtual/_rolldown/runtime.cjs");
2
1
  let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
3
2
  let _hot_updater_core = require("@hot-updater/core");
4
3
  //#region src/db/updateArtifacts.ts
@@ -1,6 +1,5 @@
1
1
  import { HandlerAPI, HotUpdaterHandler, HotUpdaterHandlers } from "./handlerTypes.cjs";
2
-
3
2
  //#region src/handler.d.ts
4
3
  declare function createHandlers(api: HandlerAPI): HotUpdaterHandlers;
5
4
  //#endregion
6
- export { createHandlers };
5
+ export { type HandlerAPI, type HotUpdaterHandler, type HotUpdaterHandlers, createHandlers };
@@ -1,6 +1,5 @@
1
1
  import { HandlerAPI, HotUpdaterHandler, HotUpdaterHandlers } from "./handlerTypes.mjs";
2
-
3
2
  //#region src/handler.d.ts
4
3
  declare function createHandlers(api: HandlerAPI): HotUpdaterHandlers;
5
4
  //#endregion
6
- export { createHandlers };
5
+ export { type HandlerAPI, type HotUpdaterHandler, type HotUpdaterHandlers, createHandlers };
@@ -1,4 +1,3 @@
1
- require("./_virtual/_rolldown/runtime.cjs");
2
1
  const require_handlerParameters = require("./handlerParameters.cjs");
3
2
  let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
4
3
  //#region src/handlerReleaseCatalogRoutes.ts
@@ -1,4 +1,3 @@
1
- require("./_virtual/_rolldown/runtime.cjs");
2
1
  const require_handlerErrors = require("./handlerErrors.cjs");
3
2
  const require_handlerParameters = require("./handlerParameters.cjs");
4
3
  let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
@@ -2,7 +2,6 @@ import { ReleaseCatalogRequest } from "./db/releaseCatalog.cjs";
2
2
  import { PaginatedResult } from "./types/index.cjs";
3
3
  import { ArtifactInfo, Bundle, ReleaseCatalog } from "@hot-updater/core";
4
4
  import { ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelRow, DatabaseBundleQueryOptions, DatabaseCommit, DatabaseCommitResult, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildResult, ReleaseCatalogRow, ReleasePolicyPatch, ReleaseRow } from "@hot-updater/plugin-core";
5
-
6
5
  //#region src/handlerTypes.d.ts
7
6
  interface HandlerAPI {
8
7
  getReleaseCatalog?: (input: ReleaseCatalogRequest) => Promise<ReleaseCatalog | null>;
@@ -2,7 +2,6 @@ import { ReleaseCatalogRequest } from "./db/releaseCatalog.mjs";
2
2
  import { PaginatedResult } from "./types/index.mjs";
3
3
  import { ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelRow, DatabaseBundleQueryOptions, DatabaseCommit, DatabaseCommitResult, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildResult, ReleaseCatalogRow, ReleasePolicyPatch, ReleaseRow } from "@hot-updater/plugin-core";
4
4
  import { ArtifactInfo, Bundle as Bundle$1, ReleaseCatalog } from "@hot-updater/core";
5
-
6
5
  //#region src/handlerTypes.d.ts
7
6
  interface HandlerAPI {
8
7
  getReleaseCatalog?: (input: ReleaseCatalogRequest) => Promise<ReleaseCatalog | null>;
@@ -1,3 +1,4 @@
1
+ import "./handlerTypes.cjs";
1
2
  //#region src/handlerVersionRoutes.d.ts
2
3
  declare const HOT_UPDATER_INFRASTRUCTURE_GENERATION = 1;
3
4
  //#endregion
@@ -1,3 +1,4 @@
1
+ import "./handlerTypes.mjs";
1
2
  //#region src/handlerVersionRoutes.d.ts
2
3
  declare const HOT_UPDATER_INFRASTRUCTURE_GENERATION = 1;
3
4
  //#endregion
package/dist/index.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_version = require("./version.cjs");
3
3
  const require_handlerVersionRoutes = require("./handlerVersionRoutes.cjs");
4
4
  const require_handler = require("./handler.cjs");
5
- const require_provider = require("./insights/bounded/provider.cjs");
5
+ const require_provider = require("./insights/provider.cjs");
6
6
  const require_apiKeys = require("./apiKeys.cjs");
7
7
  const require_createHotUpdaterCore = require("./createHotUpdaterCore.cjs");
8
8
  exports.API_KEY_HEADER_NAME = require_apiKeys.API_KEY_HEADER_NAME;
package/dist/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { API_KEY_HEADER_NAME, ApiKeyManagementAPI, ApiKeyMetadata, CreatedApiKey, createApiKey, provisionApiKey, registerApiKey } from "./apiKeys.cjs";
2
2
  import { HandlerAPI, HotUpdaterHandler, HotUpdaterHandlers } from "./handlerTypes.cjs";
3
- import { ActiveInstallationInput, ActiveInstallationOverview, ActiveInstallationWindow, BundleEventInsightsResult, BundleEventInsightsWindow, BundleEventOverview, BundleEventSummary, BundleEventSummaryByBundle, CreateBundleEventRequest, CreateBundleEventRequestBase, InsightsCohortPoint, InsightsSeriesPoint, InstallationHistoryRow, InstallationSearchRow, OffsetPaginationResult } from "./insights/domain.cjs";
4
- import { InsightsProvider } from "./insights/types.cjs";
3
+ import { ActiveInstallationWindow, CreateBundleEventRequest, CreateBundleEventRequestBase, CursorPage, EventCursorPage, EventHistoryRow, InsightsBundleSelection, InsightsCountMeasurement, InsightsScope, InstallationHistoryRow, InstallationRow, ReportingOverview } from "./insights/domain.cjs";
4
+ import { InsightsEventPageInput, InsightsInstallationEventPageInput, InsightsProvider, InsightsUserInstallationPageInput } from "./insights/types.cjs";
5
5
  import { createHandlers } from "./handler.cjs";
6
6
  import { ClientAccessPolicy, CreateHotUpdaterOptions, HotUpdaterAPI, RuntimeHotUpdaterAPI, createHotUpdater } from "./createHotUpdaterCore.cjs";
7
7
  import { Bundle, ChannelsResponse, DataResponse, Paginated, PaginatedResult, PaginationInfo, PaginationOptions } from "./types/index.cjs";
8
8
  import { HOT_UPDATER_SERVER_VERSION } from "./version.cjs";
9
- import { createInsightsProvider } from "./insights/bounded/provider.cjs";
9
+ import { createInsightsProvider } from "./insights/provider.cjs";
10
10
  import { HOT_UPDATER_INFRASTRUCTURE_GENERATION } from "./handlerVersionRoutes.cjs";
11
- export { API_KEY_HEADER_NAME, ActiveInstallationInput, ActiveInstallationOverview, ActiveInstallationWindow, type ApiKeyManagementAPI, type ApiKeyMetadata, Bundle, BundleEventInsightsResult, BundleEventInsightsWindow, BundleEventOverview, BundleEventSummary, BundleEventSummaryByBundle, ChannelsResponse, type ClientAccessPolicy, CreateBundleEventRequest, CreateBundleEventRequestBase, type CreateHotUpdaterOptions, type CreatedApiKey, DataResponse, HOT_UPDATER_INFRASTRUCTURE_GENERATION, HOT_UPDATER_SERVER_VERSION, type HandlerAPI, type HotUpdaterAPI, type HotUpdaterHandler, type HotUpdaterHandlers, InsightsCohortPoint, type InsightsProvider, InsightsSeriesPoint, InstallationHistoryRow, InstallationSearchRow, OffsetPaginationResult, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, type RuntimeHotUpdaterAPI, createApiKey, createHandlers, createHotUpdater, createInsightsProvider, provisionApiKey, registerApiKey };
11
+ export { API_KEY_HEADER_NAME, type ActiveInstallationWindow, type ApiKeyManagementAPI, type ApiKeyMetadata, type Bundle, ChannelsResponse, type ClientAccessPolicy, type CreateBundleEventRequest, type CreateBundleEventRequestBase, type CreateHotUpdaterOptions, type CreatedApiKey, type CursorPage, DataResponse, type EventCursorPage, type EventHistoryRow, HOT_UPDATER_INFRASTRUCTURE_GENERATION, HOT_UPDATER_SERVER_VERSION, type HandlerAPI, type HotUpdaterAPI, type HotUpdaterHandler, type HotUpdaterHandlers, type InsightsBundleSelection, type InsightsCountMeasurement, type InsightsEventPageInput, type InsightsInstallationEventPageInput, type InsightsProvider, type InsightsScope, type InsightsUserInstallationPageInput, type InstallationHistoryRow, type InstallationRow, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, type ReportingOverview, type RuntimeHotUpdaterAPI, createApiKey, createHandlers, createHotUpdater, createInsightsProvider, provisionApiKey, registerApiKey };
package/dist/index.d.mts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { API_KEY_HEADER_NAME, ApiKeyManagementAPI, ApiKeyMetadata, CreatedApiKey, createApiKey, provisionApiKey, registerApiKey } from "./apiKeys.mjs";
2
2
  import { HandlerAPI, HotUpdaterHandler, HotUpdaterHandlers } from "./handlerTypes.mjs";
3
- import { ActiveInstallationInput, ActiveInstallationOverview, ActiveInstallationWindow, BundleEventInsightsResult, BundleEventInsightsWindow, BundleEventOverview, BundleEventSummary, BundleEventSummaryByBundle, CreateBundleEventRequest, CreateBundleEventRequestBase, InsightsCohortPoint, InsightsSeriesPoint, InstallationHistoryRow, InstallationSearchRow, OffsetPaginationResult } from "./insights/domain.mjs";
4
- import { InsightsProvider } from "./insights/types.mjs";
3
+ import { ActiveInstallationWindow, CreateBundleEventRequest, CreateBundleEventRequestBase, CursorPage, EventCursorPage, EventHistoryRow, InsightsBundleSelection, InsightsCountMeasurement, InsightsScope, InstallationHistoryRow, InstallationRow, ReportingOverview } from "./insights/domain.mjs";
4
+ import { InsightsEventPageInput, InsightsInstallationEventPageInput, InsightsProvider, InsightsUserInstallationPageInput } from "./insights/types.mjs";
5
5
  import { createHandlers } from "./handler.mjs";
6
6
  import { ClientAccessPolicy, CreateHotUpdaterOptions, HotUpdaterAPI, RuntimeHotUpdaterAPI, createHotUpdater } from "./createHotUpdaterCore.mjs";
7
7
  import { Bundle, ChannelsResponse, DataResponse, Paginated, PaginatedResult, PaginationInfo, PaginationOptions } from "./types/index.mjs";
8
8
  import { HOT_UPDATER_SERVER_VERSION } from "./version.mjs";
9
- import { createInsightsProvider } from "./insights/bounded/provider.mjs";
9
+ import { createInsightsProvider } from "./insights/provider.mjs";
10
10
  import { HOT_UPDATER_INFRASTRUCTURE_GENERATION } from "./handlerVersionRoutes.mjs";
11
- export { API_KEY_HEADER_NAME, ActiveInstallationInput, ActiveInstallationOverview, ActiveInstallationWindow, type ApiKeyManagementAPI, type ApiKeyMetadata, Bundle, BundleEventInsightsResult, BundleEventInsightsWindow, BundleEventOverview, BundleEventSummary, BundleEventSummaryByBundle, ChannelsResponse, type ClientAccessPolicy, CreateBundleEventRequest, CreateBundleEventRequestBase, type CreateHotUpdaterOptions, type CreatedApiKey, DataResponse, HOT_UPDATER_INFRASTRUCTURE_GENERATION, HOT_UPDATER_SERVER_VERSION, type HandlerAPI, type HotUpdaterAPI, type HotUpdaterHandler, type HotUpdaterHandlers, InsightsCohortPoint, type InsightsProvider, InsightsSeriesPoint, InstallationHistoryRow, InstallationSearchRow, OffsetPaginationResult, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, type RuntimeHotUpdaterAPI, createApiKey, createHandlers, createHotUpdater, createInsightsProvider, provisionApiKey, registerApiKey };
11
+ export { API_KEY_HEADER_NAME, type ActiveInstallationWindow, type ApiKeyManagementAPI, type ApiKeyMetadata, type Bundle, ChannelsResponse, type ClientAccessPolicy, type CreateBundleEventRequest, type CreateBundleEventRequestBase, type CreateHotUpdaterOptions, type CreatedApiKey, type CursorPage, DataResponse, type EventCursorPage, type EventHistoryRow, HOT_UPDATER_INFRASTRUCTURE_GENERATION, HOT_UPDATER_SERVER_VERSION, type HandlerAPI, type HotUpdaterAPI, type HotUpdaterHandler, type HotUpdaterHandlers, type InsightsBundleSelection, type InsightsCountMeasurement, type InsightsEventPageInput, type InsightsInstallationEventPageInput, type InsightsProvider, type InsightsScope, type InsightsUserInstallationPageInput, type InstallationHistoryRow, type InstallationRow, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, type ReportingOverview, type RuntimeHotUpdaterAPI, createApiKey, createHandlers, createHotUpdater, createInsightsProvider, provisionApiKey, registerApiKey };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { HOT_UPDATER_SERVER_VERSION } from "./version.mjs";
2
2
  import { HOT_UPDATER_INFRASTRUCTURE_GENERATION } from "./handlerVersionRoutes.mjs";
3
3
  import { createHandlers } from "./handler.mjs";
4
- import { createInsightsProvider } from "./insights/bounded/provider.mjs";
4
+ import { createInsightsProvider } from "./insights/provider.mjs";
5
5
  import { API_KEY_HEADER_NAME, createApiKey, provisionApiKey, registerApiKey } from "./apiKeys.mjs";
6
6
  import { createHotUpdater } from "./createHotUpdaterCore.mjs";
7
7
  export { API_KEY_HEADER_NAME, HOT_UPDATER_INFRASTRUCTURE_GENERATION, HOT_UPDATER_SERVER_VERSION, createApiKey, createHandlers, createHotUpdater, createInsightsProvider, provisionApiKey, registerApiKey };