@hot-updater/plugin-core 1.0.0-rc.1 → 1.0.0-rc.15

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 (159) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +1 -1
  2. package/dist/assetStorageLayout.cjs +4 -2
  3. package/dist/assetStorageLayout.d.cts +5 -24
  4. package/dist/assetStorageLayout.d.mts +5 -24
  5. package/dist/assetStorageLayout.mjs +4 -2
  6. package/dist/bundleStorageLayout.cjs +7 -0
  7. package/dist/bundleStorageLayout.d.cts +5 -1
  8. package/dist/bundleStorageLayout.d.mts +5 -1
  9. package/dist/bundleStorageLayout.mjs +7 -1
  10. package/dist/calculatePagination.d.cts +0 -1
  11. package/dist/calculatePagination.d.mts +0 -1
  12. package/dist/contentAddressedAssets.d.cts +1 -4
  13. package/dist/contentAddressedAssets.d.mts +1 -4
  14. package/dist/contentType.cjs +9 -0
  15. package/dist/contentType.d.cts +4 -0
  16. package/dist/contentType.d.mts +4 -0
  17. package/dist/contentType.mjs +7 -0
  18. package/dist/createDatabasePlugin.cjs +118 -42
  19. package/dist/createDatabasePlugin.d.cts +3 -1
  20. package/dist/createDatabasePlugin.d.mts +3 -1
  21. package/dist/createDatabasePlugin.mjs +118 -43
  22. package/dist/createStoragePlugin.d.cts +0 -1
  23. package/dist/createStoragePlugin.d.mts +0 -1
  24. package/dist/databaseClient.cjs +6 -1
  25. package/dist/databaseClient.d.cts +1 -2
  26. package/dist/databaseClient.d.mts +1 -2
  27. package/dist/databaseClient.mjs +6 -2
  28. package/dist/databaseClientReads.cjs +3 -1
  29. package/dist/databaseClientReads.mjs +3 -2
  30. package/dist/databaseClientUpdates.cjs +2 -4
  31. package/dist/databaseClientUpdates.d.cts +1 -1
  32. package/dist/databaseClientUpdates.d.mts +1 -1
  33. package/dist/databaseClientUpdates.mjs +2 -3
  34. package/dist/databaseJsonValue.cjs +4 -0
  35. package/dist/databaseJsonValue.d.cts +4 -2
  36. package/dist/databaseJsonValue.d.mts +4 -2
  37. package/dist/databaseJsonValue.mjs +2 -1
  38. package/dist/databaseMetadata.cjs +0 -1
  39. package/dist/databasePluginCrud.cjs +1 -0
  40. package/dist/databasePluginCrud.d.cts +4 -1
  41. package/dist/databasePluginCrud.d.mts +4 -1
  42. package/dist/databasePluginCrud.mjs +1 -1
  43. package/dist/databasePluginCrudValidation.d.cts +6 -1
  44. package/dist/databasePluginCrudValidation.d.mts +6 -1
  45. package/dist/databasePluginCrudValidationErrors.cjs +1 -0
  46. package/dist/databasePluginCrudValidationErrors.mjs +1 -0
  47. package/dist/databasePluginCrudValidationFields.cjs +24 -31
  48. package/dist/databasePluginCrudValidationFields.d.cts +1 -1
  49. package/dist/databasePluginCrudValidationFields.d.mts +1 -1
  50. package/dist/databasePluginCrudValidationFields.mjs +23 -32
  51. package/dist/databasePluginCrudValidationMutations.cjs +1 -1
  52. package/dist/databasePluginCrudValidationMutations.d.cts +1 -1
  53. package/dist/databasePluginCrudValidationMutations.d.mts +1 -1
  54. package/dist/databasePluginCrudValidationMutations.mjs +1 -1
  55. package/dist/databasePluginCrudValidationQueries.d.cts +2 -1
  56. package/dist/databasePluginCrudValidationQueries.d.mts +2 -1
  57. package/dist/databasePluginCrudValidationRows.cjs +2 -2
  58. package/dist/databasePluginCrudValidationRows.d.cts +1 -1
  59. package/dist/databasePluginCrudValidationRows.d.mts +1 -1
  60. package/dist/databasePluginCrudValidationRows.mjs +2 -2
  61. package/dist/databaseRows.cjs +0 -7
  62. package/dist/databaseRows.d.cts +2 -6
  63. package/dist/databaseRows.d.mts +2 -6
  64. package/dist/databaseRows.mjs +0 -6
  65. package/dist/index.cjs +8 -6
  66. package/dist/index.d.cts +7 -6
  67. package/dist/index.d.mts +7 -6
  68. package/dist/index.mjs +5 -4
  69. package/dist/insightsContract.cjs +192 -0
  70. package/dist/insightsContract.d.cts +9 -0
  71. package/dist/insightsContract.d.mts +9 -0
  72. package/dist/insightsContract.mjs +189 -0
  73. package/dist/insightsDistinctSummary.cjs +72 -0
  74. package/dist/insightsDistinctSummary.d.cts +12 -0
  75. package/dist/insightsDistinctSummary.d.mts +12 -0
  76. package/dist/insightsDistinctSummary.mjs +68 -0
  77. package/dist/insightsLatestQueries.cjs +53 -0
  78. package/dist/insightsLatestQueries.d.cts +13 -0
  79. package/dist/insightsLatestQueries.d.mts +13 -0
  80. package/dist/insightsLatestQueries.mjs +52 -0
  81. package/dist/insightsOverview.cjs +139 -0
  82. package/dist/insightsOverview.d.cts +40 -0
  83. package/dist/insightsOverview.d.mts +40 -0
  84. package/dist/insightsOverview.mjs +135 -0
  85. package/dist/internal.cjs +15 -0
  86. package/dist/internal.d.cts +7 -3
  87. package/dist/internal.d.mts +7 -3
  88. package/dist/internal.mjs +4 -1
  89. package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/comparison-DenM3wCn.cjs +136 -0
  90. package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/comparison-DenM3wCn.mjs +116 -0
  91. package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/range-DvX-Y6iv.cjs +167 -0
  92. package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/range-DvX-Y6iv.mjs +165 -0
  93. package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/set-CC5YeoYX.cjs +42 -0
  94. package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/set-CC5YeoYX.mjs +39 -0
  95. package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/version-CQ98ZBpL.cjs +39 -0
  96. package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/version-CQ98ZBpL.mjs +37 -0
  97. package/dist/paginateBundles.d.cts +1 -8
  98. package/dist/paginateBundles.d.mts +1 -8
  99. package/dist/parseStorageUri.d.cts +1 -5
  100. package/dist/parseStorageUri.d.mts +1 -5
  101. package/dist/queryBundles.d.cts +0 -1
  102. package/dist/queryBundles.d.mts +0 -1
  103. package/dist/releaseCatalogCompiler.cjs +15 -12
  104. package/dist/releaseCatalogCompiler.d.cts +0 -1
  105. package/dist/releaseCatalogCompiler.d.mts +0 -1
  106. package/dist/releaseCatalogCompiler.mjs +11 -7
  107. package/dist/releaseCatalogMutation.cjs +1 -1
  108. package/dist/releaseCatalogMutation.d.cts +1 -1
  109. package/dist/releaseCatalogMutation.d.mts +1 -1
  110. package/dist/releaseCatalogMutation.mjs +1 -0
  111. package/dist/releaseManagement.cjs +3 -2
  112. package/dist/releaseManagement.d.cts +1 -1
  113. package/dist/releaseManagement.d.mts +1 -1
  114. package/dist/releaseManagement.mjs +3 -1
  115. package/dist/remoteBundleSigning.cjs +4 -4
  116. package/dist/remoteBundleSigning.d.cts +2 -13
  117. package/dist/remoteBundleSigning.d.mts +2 -13
  118. package/dist/remoteBundleSigning.mjs +4 -4
  119. package/dist/requestBundleCache.d.cts +1 -2
  120. package/dist/requestBundleCache.d.mts +1 -2
  121. package/dist/semverSatisfies.cjs +4 -3
  122. package/dist/semverSatisfies.mjs +2 -1
  123. package/dist/storageDownloadPath.cjs +2 -1
  124. package/dist/storageDownloadPath.d.cts +1 -3
  125. package/dist/storageDownloadPath.d.mts +1 -3
  126. package/dist/storageDownloadPath.mjs +2 -1
  127. package/dist/types/database.d.cts +4 -3
  128. package/dist/types/database.d.mts +4 -3
  129. package/dist/types/databaseFields.cjs +1 -8
  130. package/dist/types/databaseFields.d.cts +2 -2
  131. package/dist/types/databaseFields.d.mts +2 -2
  132. package/dist/types/databaseFields.mjs +1 -8
  133. package/dist/types/databaseOperations.d.cts +17 -12
  134. package/dist/types/databaseOperations.d.mts +17 -12
  135. package/dist/types/databasePlugin.d.cts +159 -11
  136. package/dist/types/databasePlugin.d.mts +159 -11
  137. package/dist/types/databaseQuery.d.cts +2 -3
  138. package/dist/types/databaseQuery.d.mts +2 -3
  139. package/dist/types/databaseRows.d.cts +19 -17
  140. package/dist/types/databaseRows.d.mts +19 -17
  141. package/dist/types/index.d.cts +12 -20
  142. package/dist/types/index.d.mts +12 -20
  143. package/dist/types/internal.d.cts +4 -3
  144. package/dist/types/internal.d.mts +4 -3
  145. package/dist/types/public.d.cts +4 -3
  146. package/dist/types/public.d.mts +4 -3
  147. package/dist/types/utils.d.cts +1 -1
  148. package/dist/types/utils.d.mts +1 -1
  149. package/dist/uuidv7.cjs +7 -2
  150. package/dist/uuidv7.d.cts +0 -1
  151. package/dist/uuidv7.d.mts +0 -1
  152. package/dist/uuidv7.mjs +1 -1
  153. package/package.json +4 -4
  154. package/dist/compressionFormat.cjs +0 -55
  155. package/dist/compressionFormat.d.cts +0 -33
  156. package/dist/compressionFormat.d.mts +0 -33
  157. package/dist/compressionFormat.mjs +0 -51
  158. package/dist/node_modules/.pnpm/verkit@0.3.2/node_modules/verkit/dist/index.cjs +0 -345
  159. package/dist/node_modules/.pnpm/verkit@0.3.2/node_modules/verkit/dist/index.mjs +0 -341
@@ -1,4 +1,3 @@
1
- require("./_virtual/_rolldown/runtime.cjs");
2
1
  const require_databasePluginCrudValidationErrors = require("./databasePluginCrudValidationErrors.cjs");
3
2
  const require_databaseJsonValue = require("./databaseJsonValue.cjs");
4
3
  const require_databaseFields = require("./types/databaseFields.cjs");
@@ -14,27 +13,26 @@ const isChannelText = (value) => {
14
13
  }
15
14
  return true;
16
15
  };
16
+ const isInsightsIdentityText = (value) => typeof value === "string" && value.length > 0 && value.length <= 255;
17
+ const isNullableInsightsIdentityText = (value) => value === null || isInsightsIdentityText(value);
17
18
  const modelValidators = {
18
19
  bundles: {
19
20
  id: (value) => typeof value === "string",
20
21
  platform: (value) => value === "ios" || value === "android",
21
22
  should_force_update: (value) => typeof value === "boolean",
22
23
  enabled: (value) => typeof value === "boolean",
23
- file_hash: (value) => typeof value === "string",
24
24
  git_commit_hash: (value) => value === null || typeof value === "string",
25
25
  message: (value) => value === null || typeof value === "string",
26
26
  channel: isChannelText,
27
27
  channel_id: isChannelText,
28
- storage_uri: (value) => typeof value === "string",
29
- archive_byte_size: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0,
30
28
  target_app_version: (value) => value === null || typeof value === "string",
31
29
  fingerprint_hash: (value) => value === null || typeof value === "string",
32
30
  metadata: require_databaseJsonValue.isDatabaseMetadataObject,
33
31
  rollout_cohort_count: (value) => typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 1e3,
34
32
  target_cohorts: (value) => value === null || Array.isArray(value) && value.every((item) => typeof item === "string"),
35
- manifest_storage_uri: (value) => value === null || typeof value === "string",
36
- manifest_file_hash: (value) => value === null || typeof value === "string",
37
- asset_base_storage_uri: (value) => value === null || typeof value === "string"
33
+ manifest_storage_uri: (value) => typeof value === "string",
34
+ manifest_file_hash: (value) => typeof value === "string",
35
+ asset_base_storage_uri: (value) => typeof value === "string"
38
36
  },
39
37
  bundle_patches: {
40
38
  id: (value) => typeof value === "string",
@@ -88,10 +86,9 @@ const modelValidators = {
88
86
  },
89
87
  bundle_events: {
90
88
  id: (value) => typeof value === "string",
91
- type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "RELEASE_ADOPTED" || value === "UNCHANGED",
92
- install_id: (value) => typeof value === "string",
93
- user_id: (value) => value === null || typeof value === "string",
94
- username: (value) => value === null || typeof value === "string",
89
+ type: (value) => value === "UPDATE_DOWNLOADED" || value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "UNCHANGED",
90
+ install_id: isInsightsIdentityText,
91
+ user_id: isNullableInsightsIdentityText,
95
92
  from_bundle_id: (value) => value === null || typeof value === "string",
96
93
  from_release_id: (value) => value === null || typeof value === "string",
97
94
  to_release_id: (value) => value === null || typeof value === "string",
@@ -99,10 +96,7 @@ const modelValidators = {
99
96
  platform: (value) => value === "ios" || value === "android",
100
97
  app_version: (value) => typeof value === "string",
101
98
  channel: (value) => typeof value === "string",
102
- cohort: (value) => typeof value === "string",
103
- update_strategy: (value) => value === null || value === "fingerprint" || value === "appVersion",
104
- fingerprint_hash: (value) => value === null || typeof value === "string",
105
- sdk_version: (value) => value === null || typeof value === "string",
99
+ metadata: require_databaseJsonValue.isDatabaseBundleEventMetadata,
106
100
  received_at_ms: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0
107
101
  },
108
102
  api_keys: {
@@ -115,15 +109,13 @@ const modelValidators = {
115
109
  revoked_at_ms: (value) => value === null || typeof value === "number" && Number.isSafeInteger(value) && value >= 0
116
110
  }
117
111
  };
118
- const stringFields = new Set([
112
+ const stringFields = /* @__PURE__ */ new Set([
119
113
  "id",
120
114
  "platform",
121
- "file_hash",
122
115
  "git_commit_hash",
123
116
  "message",
124
117
  "channel",
125
118
  "channel_id",
126
- "storage_uri",
127
119
  "target_app_version",
128
120
  "fingerprint_hash",
129
121
  "bundle_id",
@@ -156,8 +148,7 @@ const stringFields = new Set([
156
148
  "prefix",
157
149
  "role"
158
150
  ]);
159
- const numberFields = new Set([
160
- "archive_byte_size",
151
+ const numberFields = /* @__PURE__ */ new Set([
161
152
  "byte_size",
162
153
  "rollout_cohort_count",
163
154
  "order_index",
@@ -169,22 +160,19 @@ const numberFields = new Set([
169
160
  "created_at_ms",
170
161
  "revoked_at_ms"
171
162
  ]);
172
- const booleanFields = new Set([
163
+ const booleanFields = /* @__PURE__ */ new Set([
173
164
  "should_force_update",
174
165
  "enabled",
175
166
  "is_tombstone"
176
167
  ]);
177
168
  const sortableFields = {
178
- bundles: new Set([
169
+ bundles: /* @__PURE__ */ new Set([
179
170
  "id",
180
171
  "platform",
181
- "file_hash",
182
172
  "git_commit_hash",
183
173
  "message",
184
174
  "channel",
185
175
  "channel_id",
186
- "storage_uri",
187
- "archive_byte_size",
188
176
  "target_app_version",
189
177
  "fingerprint_hash",
190
178
  "rollout_cohort_count",
@@ -192,7 +180,7 @@ const sortableFields = {
192
180
  "manifest_file_hash",
193
181
  "asset_base_storage_uri"
194
182
  ]),
195
- bundle_patches: new Set([
183
+ bundle_patches: /* @__PURE__ */ new Set([
196
184
  "id",
197
185
  "bundle_id",
198
186
  "base_bundle_id",
@@ -202,7 +190,7 @@ const sortableFields = {
202
190
  "byte_size",
203
191
  "order_index"
204
192
  ]),
205
- releases: new Set([
193
+ releases: /* @__PURE__ */ new Set([
206
194
  "id",
207
195
  "revision",
208
196
  "scope_key",
@@ -222,7 +210,7 @@ const sortableFields = {
222
210
  "created_at_ms",
223
211
  "updated_at_ms"
224
212
  ]),
225
- release_catalogs: new Set([
213
+ release_catalogs: /* @__PURE__ */ new Set([
226
214
  "scope_key",
227
215
  "catalog_id",
228
216
  "strategy",
@@ -236,8 +224,8 @@ const sortableFields = {
236
224
  "is_tombstone",
237
225
  "updated_at_ms"
238
226
  ]),
239
- channels: new Set(["id", "name"]),
240
- bundle_events: new Set([
227
+ channels: /* @__PURE__ */ new Set(["id", "name"]),
228
+ bundle_events: /* @__PURE__ */ new Set([
241
229
  "id",
242
230
  "type",
243
231
  "install_id",
@@ -247,6 +235,8 @@ const sortableFields = {
247
235
  "from_release_id",
248
236
  "to_release_id",
249
237
  "to_bundle_id",
238
+ "pending_bundle_id",
239
+ "pending_release_id",
250
240
  "platform",
251
241
  "app_version",
252
242
  "channel",
@@ -256,7 +246,7 @@ const sortableFields = {
256
246
  "sdk_version",
257
247
  "received_at_ms"
258
248
  ]),
259
- api_keys: new Set([
249
+ api_keys: /* @__PURE__ */ new Set([
260
250
  "id",
261
251
  "hash",
262
252
  "name",
@@ -279,13 +269,16 @@ const isStringField = (field) => stringFields.has(field);
279
269
  const isNumberField = (field) => numberFields.has(field);
280
270
  const isBooleanField = (field) => booleanFields.has(field);
281
271
  //#endregion
272
+ exports.booleanFields = booleanFields;
282
273
  exports.isBooleanField = isBooleanField;
283
274
  exports.isChannelText = isChannelText;
284
275
  exports.isNumberField = isNumberField;
285
276
  exports.isRecord = isRecord;
286
277
  exports.isStringField = isStringField;
287
278
  exports.modelValidators = modelValidators;
279
+ exports.numberFields = numberFields;
288
280
  exports.sortableFields = sortableFields;
281
+ exports.stringFields = stringFields;
289
282
  exports.validateField = validateField;
290
283
  exports.validateFields = validateFields;
291
284
  exports.validateModel = validateModel;
@@ -1 +1 @@
1
- export { };
1
+ import "./types/internal.cjs";
@@ -1 +1 @@
1
- export { };
1
+ import "./types/internal.mjs";
@@ -1,5 +1,5 @@
1
1
  import { DatabasePluginInputError } from "./databasePluginCrudValidationErrors.mjs";
2
- import { isDatabaseMetadataObject } from "./databaseJsonValue.mjs";
2
+ import { isDatabaseBundleEventMetadata, isDatabaseMetadataObject } from "./databaseJsonValue.mjs";
3
3
  import { databaseFields } from "./types/databaseFields.mjs";
4
4
  import { isUUIDv7 } from "./uuidv7.mjs";
5
5
  //#region src/databasePluginCrudValidationFields.ts
@@ -13,27 +13,26 @@ const isChannelText = (value) => {
13
13
  }
14
14
  return true;
15
15
  };
16
+ const isInsightsIdentityText = (value) => typeof value === "string" && value.length > 0 && value.length <= 255;
17
+ const isNullableInsightsIdentityText = (value) => value === null || isInsightsIdentityText(value);
16
18
  const modelValidators = {
17
19
  bundles: {
18
20
  id: (value) => typeof value === "string",
19
21
  platform: (value) => value === "ios" || value === "android",
20
22
  should_force_update: (value) => typeof value === "boolean",
21
23
  enabled: (value) => typeof value === "boolean",
22
- file_hash: (value) => typeof value === "string",
23
24
  git_commit_hash: (value) => value === null || typeof value === "string",
24
25
  message: (value) => value === null || typeof value === "string",
25
26
  channel: isChannelText,
26
27
  channel_id: isChannelText,
27
- storage_uri: (value) => typeof value === "string",
28
- archive_byte_size: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0,
29
28
  target_app_version: (value) => value === null || typeof value === "string",
30
29
  fingerprint_hash: (value) => value === null || typeof value === "string",
31
30
  metadata: isDatabaseMetadataObject,
32
31
  rollout_cohort_count: (value) => typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 1e3,
33
32
  target_cohorts: (value) => value === null || Array.isArray(value) && value.every((item) => typeof item === "string"),
34
- manifest_storage_uri: (value) => value === null || typeof value === "string",
35
- manifest_file_hash: (value) => value === null || typeof value === "string",
36
- asset_base_storage_uri: (value) => value === null || typeof value === "string"
33
+ manifest_storage_uri: (value) => typeof value === "string",
34
+ manifest_file_hash: (value) => typeof value === "string",
35
+ asset_base_storage_uri: (value) => typeof value === "string"
37
36
  },
38
37
  bundle_patches: {
39
38
  id: (value) => typeof value === "string",
@@ -87,10 +86,9 @@ const modelValidators = {
87
86
  },
88
87
  bundle_events: {
89
88
  id: (value) => typeof value === "string",
90
- type: (value) => value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "RELEASE_ADOPTED" || value === "UNCHANGED",
91
- install_id: (value) => typeof value === "string",
92
- user_id: (value) => value === null || typeof value === "string",
93
- username: (value) => value === null || typeof value === "string",
89
+ type: (value) => value === "UPDATE_DOWNLOADED" || value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "UNCHANGED",
90
+ install_id: isInsightsIdentityText,
91
+ user_id: isNullableInsightsIdentityText,
94
92
  from_bundle_id: (value) => value === null || typeof value === "string",
95
93
  from_release_id: (value) => value === null || typeof value === "string",
96
94
  to_release_id: (value) => value === null || typeof value === "string",
@@ -98,10 +96,7 @@ const modelValidators = {
98
96
  platform: (value) => value === "ios" || value === "android",
99
97
  app_version: (value) => typeof value === "string",
100
98
  channel: (value) => typeof value === "string",
101
- cohort: (value) => typeof value === "string",
102
- update_strategy: (value) => value === null || value === "fingerprint" || value === "appVersion",
103
- fingerprint_hash: (value) => value === null || typeof value === "string",
104
- sdk_version: (value) => value === null || typeof value === "string",
99
+ metadata: isDatabaseBundleEventMetadata,
105
100
  received_at_ms: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0
106
101
  },
107
102
  api_keys: {
@@ -114,15 +109,13 @@ const modelValidators = {
114
109
  revoked_at_ms: (value) => value === null || typeof value === "number" && Number.isSafeInteger(value) && value >= 0
115
110
  }
116
111
  };
117
- const stringFields = new Set([
112
+ const stringFields = /* @__PURE__ */ new Set([
118
113
  "id",
119
114
  "platform",
120
- "file_hash",
121
115
  "git_commit_hash",
122
116
  "message",
123
117
  "channel",
124
118
  "channel_id",
125
- "storage_uri",
126
119
  "target_app_version",
127
120
  "fingerprint_hash",
128
121
  "bundle_id",
@@ -155,8 +148,7 @@ const stringFields = new Set([
155
148
  "prefix",
156
149
  "role"
157
150
  ]);
158
- const numberFields = new Set([
159
- "archive_byte_size",
151
+ const numberFields = /* @__PURE__ */ new Set([
160
152
  "byte_size",
161
153
  "rollout_cohort_count",
162
154
  "order_index",
@@ -168,22 +160,19 @@ const numberFields = new Set([
168
160
  "created_at_ms",
169
161
  "revoked_at_ms"
170
162
  ]);
171
- const booleanFields = new Set([
163
+ const booleanFields = /* @__PURE__ */ new Set([
172
164
  "should_force_update",
173
165
  "enabled",
174
166
  "is_tombstone"
175
167
  ]);
176
168
  const sortableFields = {
177
- bundles: new Set([
169
+ bundles: /* @__PURE__ */ new Set([
178
170
  "id",
179
171
  "platform",
180
- "file_hash",
181
172
  "git_commit_hash",
182
173
  "message",
183
174
  "channel",
184
175
  "channel_id",
185
- "storage_uri",
186
- "archive_byte_size",
187
176
  "target_app_version",
188
177
  "fingerprint_hash",
189
178
  "rollout_cohort_count",
@@ -191,7 +180,7 @@ const sortableFields = {
191
180
  "manifest_file_hash",
192
181
  "asset_base_storage_uri"
193
182
  ]),
194
- bundle_patches: new Set([
183
+ bundle_patches: /* @__PURE__ */ new Set([
195
184
  "id",
196
185
  "bundle_id",
197
186
  "base_bundle_id",
@@ -201,7 +190,7 @@ const sortableFields = {
201
190
  "byte_size",
202
191
  "order_index"
203
192
  ]),
204
- releases: new Set([
193
+ releases: /* @__PURE__ */ new Set([
205
194
  "id",
206
195
  "revision",
207
196
  "scope_key",
@@ -221,7 +210,7 @@ const sortableFields = {
221
210
  "created_at_ms",
222
211
  "updated_at_ms"
223
212
  ]),
224
- release_catalogs: new Set([
213
+ release_catalogs: /* @__PURE__ */ new Set([
225
214
  "scope_key",
226
215
  "catalog_id",
227
216
  "strategy",
@@ -235,8 +224,8 @@ const sortableFields = {
235
224
  "is_tombstone",
236
225
  "updated_at_ms"
237
226
  ]),
238
- channels: new Set(["id", "name"]),
239
- bundle_events: new Set([
227
+ channels: /* @__PURE__ */ new Set(["id", "name"]),
228
+ bundle_events: /* @__PURE__ */ new Set([
240
229
  "id",
241
230
  "type",
242
231
  "install_id",
@@ -246,6 +235,8 @@ const sortableFields = {
246
235
  "from_release_id",
247
236
  "to_release_id",
248
237
  "to_bundle_id",
238
+ "pending_bundle_id",
239
+ "pending_release_id",
249
240
  "platform",
250
241
  "app_version",
251
242
  "channel",
@@ -255,7 +246,7 @@ const sortableFields = {
255
246
  "sdk_version",
256
247
  "received_at_ms"
257
248
  ]),
258
- api_keys: new Set([
249
+ api_keys: /* @__PURE__ */ new Set([
259
250
  "id",
260
251
  "hash",
261
252
  "name",
@@ -278,4 +269,4 @@ const isStringField = (field) => stringFields.has(field);
278
269
  const isNumberField = (field) => numberFields.has(field);
279
270
  const isBooleanField = (field) => booleanFields.has(field);
280
271
  //#endregion
281
- export { isBooleanField, isChannelText, isNumberField, isRecord, isStringField, modelValidators, sortableFields, validateField, validateFields, validateModel };
272
+ export { booleanFields, isBooleanField, isChannelText, isNumberField, isRecord, isStringField, modelValidators, numberFields, sortableFields, stringFields, validateField, validateFields, validateModel };
@@ -22,7 +22,7 @@ const validateBundleUpdateData = (update) => {
22
22
  const validateApiKeyUpdateData = (update) => {
23
23
  if (!require_databasePluginCrudValidationFields.isRecord(update) || Reflect.ownKeys(update).length !== 1 || !Object.hasOwn(update, "revoked_at_ms") || !require_databasePluginCrudValidationFields.modelValidators.api_keys.revoked_at_ms(Reflect.get(update, "revoked_at_ms"))) throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-data");
24
24
  };
25
- const RELEASE_MUTABLE_FIELDS = new Set([
25
+ const RELEASE_MUTABLE_FIELDS = /* @__PURE__ */ new Set([
26
26
  "revision",
27
27
  "scope_key",
28
28
  "target_app_version",
@@ -1 +1 @@
1
- export { };
1
+ import "./types/internal.cjs";
@@ -1 +1 @@
1
- export { };
1
+ import "./types/internal.mjs";
@@ -22,7 +22,7 @@ const validateBundleUpdateData = (update) => {
22
22
  const validateApiKeyUpdateData = (update) => {
23
23
  if (!isRecord(update) || Reflect.ownKeys(update).length !== 1 || !Object.hasOwn(update, "revoked_at_ms") || !modelValidators.api_keys.revoked_at_ms(Reflect.get(update, "revoked_at_ms"))) throw new DatabasePluginInputError("invalid-data");
24
24
  };
25
- const RELEASE_MUTABLE_FIELDS = new Set([
25
+ const RELEASE_MUTABLE_FIELDS = /* @__PURE__ */ new Set([
26
26
  "revision",
27
27
  "scope_key",
28
28
  "target_app_version",
@@ -1 +1,2 @@
1
- export { };
1
+ import "./types/internal.cjs";
2
+ import "./databasePluginCrudValidationFields.cjs";
@@ -1 +1,2 @@
1
- export { };
1
+ import "./types/internal.mjs";
2
+ import "./databasePluginCrudValidationFields.mjs";
@@ -10,7 +10,7 @@ const hasValidReleaseInvariants = (data) => {
10
10
  const fingerprintHash = data.fingerprint_hash;
11
11
  return (kind === "BUNDLE" && typeof bundleId === "string" || kind === "EMBEDDED" && bundleId === null) && (strategy === "APP_VERSION" && typeof targetAppVersion === "string" && fingerprintHash === null || strategy === "FINGERPRINT" && targetAppVersion === null && typeof fingerprintHash === "string");
12
12
  };
13
- const hasValidBundleEventInvariants = (data) => (data.type === "UPDATE_APPLIED" || data.type === "RECOVERED" || data.type === "RELEASE_ADOPTED") && typeof data.from_bundle_id === "string" && (data.update_strategy === "fingerprint" || data.update_strategy === "appVersion") || data.type === "UNCHANGED" && data.from_bundle_id === null && data.update_strategy === null;
13
+ const hasValidBundleEventInvariants = (data) => (data.type === "UPDATE_DOWNLOADED" || data.type === "UPDATE_APPLIED" || data.type === "RECOVERED") && typeof data.from_bundle_id === "string" && ((require_databasePluginCrudValidationFields.isRecord(data.metadata) ? data.metadata.update_strategy : void 0) === "fingerprint" || (require_databasePluginCrudValidationFields.isRecord(data.metadata) ? data.metadata.update_strategy : void 0) === "appVersion") || data.type === "UNCHANGED" && data.from_bundle_id === null && (require_databasePluginCrudValidationFields.isRecord(data.metadata) ? data.metadata.update_strategy : void 0) === null;
14
14
  const validateCreateData = (model, data) => {
15
15
  if (!require_databasePluginCrudValidationFields.isRecord(data)) throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-data");
16
16
  require_databasePluginCrudValidationFields.validateFields(model, Object.keys(data));
@@ -46,7 +46,7 @@ const validateResult = (model, row, select) => {
46
46
  if (model === "bundle_events" && [
47
47
  "type",
48
48
  "from_bundle_id",
49
- "update_strategy"
49
+ "metadata"
50
50
  ].every((field) => Object.hasOwn(row, field)) && !hasValidBundleEventInvariants(row)) throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-result");
51
51
  };
52
52
  //#endregion
@@ -1 +1 @@
1
- export { };
1
+ import "./types/internal.cjs";
@@ -1 +1 @@
1
- export { };
1
+ import "./types/internal.mjs";
@@ -10,7 +10,7 @@ const hasValidReleaseInvariants = (data) => {
10
10
  const fingerprintHash = data.fingerprint_hash;
11
11
  return (kind === "BUNDLE" && typeof bundleId === "string" || kind === "EMBEDDED" && bundleId === null) && (strategy === "APP_VERSION" && typeof targetAppVersion === "string" && fingerprintHash === null || strategy === "FINGERPRINT" && targetAppVersion === null && typeof fingerprintHash === "string");
12
12
  };
13
- const hasValidBundleEventInvariants = (data) => (data.type === "UPDATE_APPLIED" || data.type === "RECOVERED" || data.type === "RELEASE_ADOPTED") && typeof data.from_bundle_id === "string" && (data.update_strategy === "fingerprint" || data.update_strategy === "appVersion") || data.type === "UNCHANGED" && data.from_bundle_id === null && data.update_strategy === null;
13
+ const hasValidBundleEventInvariants = (data) => (data.type === "UPDATE_DOWNLOADED" || data.type === "UPDATE_APPLIED" || data.type === "RECOVERED") && typeof data.from_bundle_id === "string" && ((isRecord(data.metadata) ? data.metadata.update_strategy : void 0) === "fingerprint" || (isRecord(data.metadata) ? data.metadata.update_strategy : void 0) === "appVersion") || data.type === "UNCHANGED" && data.from_bundle_id === null && (isRecord(data.metadata) ? data.metadata.update_strategy : void 0) === null;
14
14
  const validateCreateData = (model, data) => {
15
15
  if (!isRecord(data)) throw new DatabasePluginInputError("invalid-data");
16
16
  validateFields(model, Object.keys(data));
@@ -46,7 +46,7 @@ const validateResult = (model, row, select) => {
46
46
  if (model === "bundle_events" && [
47
47
  "type",
48
48
  "from_bundle_id",
49
- "update_strategy"
49
+ "metadata"
50
50
  ].every((field) => Object.hasOwn(row, field)) && !hasValidBundleEventInvariants(row)) throw new DatabasePluginInputError("invalid-result");
51
51
  };
52
52
  //#endregion
@@ -1,4 +1,3 @@
1
- require("./_virtual/_rolldown/runtime.cjs");
2
1
  const require_databaseMetadata = require("./databaseMetadata.cjs");
3
2
  let _hot_updater_core = require("@hot-updater/core");
4
3
  //#region src/databaseRows.ts
@@ -65,10 +64,7 @@ const bundleToRow = (bundle) => {
65
64
  return {
66
65
  id: bundle.id,
67
66
  platform: bundle.platform,
68
- file_hash: bundle.fileHash,
69
67
  git_commit_hash: bundle.gitCommitHash,
70
- storage_uri: bundle.storageUri,
71
- archive_byte_size: bundle.archiveByteSize,
72
68
  metadata,
73
69
  manifest_storage_uri: (0, _hot_updater_core.getManifestStorageUri)(bundle),
74
70
  manifest_file_hash: (0, _hot_updater_core.getManifestFileHash)(bundle),
@@ -98,10 +94,7 @@ const rowToBundle = (row, patchRows = []) => {
98
94
  return {
99
95
  id: row.id,
100
96
  platform: row.platform,
101
- fileHash: row.file_hash,
102
97
  gitCommitHash: row.git_commit_hash,
103
- storageUri: row.storage_uri,
104
- archiveByteSize: row.archive_byte_size,
105
98
  metadata: (0, _hot_updater_core.stripBundleArtifactMetadata)(row.metadata),
106
99
  manifestStorageUri: row.manifest_storage_uri,
107
100
  manifestFileHash: row.manifest_file_hash,
@@ -1,6 +1,6 @@
1
1
  import { BundlePatchRow, BundleRow, ReleaseRow } from "./types/databaseRows.cjs";
2
+ import "./types/index.cjs";
2
3
  import { Bundle, Release } from "@hot-updater/core";
3
-
4
4
  //#region src/databaseRows.d.ts
5
5
  declare const releaseToRow: (release: Release, scopeKey: string) => ReleaseRow;
6
6
  declare const releaseRowToRelease: (row: ReleaseRow) => Release;
@@ -20,11 +20,7 @@ declare class BundleRowHydrationError extends Error {
20
20
  readonly reason: BundleRowHydrationErrorReason;
21
21
  readonly patchId: string;
22
22
  readonly bundleId: string;
23
- constructor({
24
- reason,
25
- patchId,
26
- bundleId
27
- }: BundleRowHydrationErrorInput);
23
+ constructor({ reason, patchId, bundleId }: BundleRowHydrationErrorInput);
28
24
  }
29
25
  declare const bundleToRow: (bundle: Bundle) => BundleRow;
30
26
  declare const bundleToPatchRows: (bundle: Bundle) => BundlePatchRow[];
@@ -1,6 +1,6 @@
1
1
  import { BundlePatchRow, BundleRow, ReleaseRow } from "./types/databaseRows.mjs";
2
+ import "./types/index.mjs";
2
3
  import { Bundle, Release } from "@hot-updater/core";
3
-
4
4
  //#region src/databaseRows.d.ts
5
5
  declare const releaseToRow: (release: Release, scopeKey: string) => ReleaseRow;
6
6
  declare const releaseRowToRelease: (row: ReleaseRow) => Release;
@@ -20,11 +20,7 @@ declare class BundleRowHydrationError extends Error {
20
20
  readonly reason: BundleRowHydrationErrorReason;
21
21
  readonly patchId: string;
22
22
  readonly bundleId: string;
23
- constructor({
24
- reason,
25
- patchId,
26
- bundleId
27
- }: BundleRowHydrationErrorInput);
23
+ constructor({ reason, patchId, bundleId }: BundleRowHydrationErrorInput);
28
24
  }
29
25
  declare const bundleToRow: (bundle: Bundle) => BundleRow;
30
26
  declare const bundleToPatchRows: (bundle: Bundle) => BundlePatchRow[];
@@ -64,10 +64,7 @@ const bundleToRow = (bundle) => {
64
64
  return {
65
65
  id: bundle.id,
66
66
  platform: bundle.platform,
67
- file_hash: bundle.fileHash,
68
67
  git_commit_hash: bundle.gitCommitHash,
69
- storage_uri: bundle.storageUri,
70
- archive_byte_size: bundle.archiveByteSize,
71
68
  metadata,
72
69
  manifest_storage_uri: getManifestStorageUri(bundle),
73
70
  manifest_file_hash: getManifestFileHash(bundle),
@@ -97,10 +94,7 @@ const rowToBundle = (row, patchRows = []) => {
97
94
  return {
98
95
  id: row.id,
99
96
  platform: row.platform,
100
- fileHash: row.file_hash,
101
97
  gitCommitHash: row.git_commit_hash,
102
- storageUri: row.storage_uri,
103
- archiveByteSize: row.archive_byte_size,
104
98
  metadata: stripBundleArtifactMetadata(row.metadata),
105
99
  manifestStorageUri: row.manifest_storage_uri,
106
100
  manifestFileHash: row.manifest_file_hash,
package/dist/index.cjs CHANGED
@@ -1,15 +1,15 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("./_virtual/_rolldown/runtime.cjs");
3
2
  const require_calculatePagination = require("./calculatePagination.cjs");
4
- const require_bundleStorageLayout = require("./bundleStorageLayout.cjs");
5
- const require_compressionFormat = require("./compressionFormat.cjs");
6
3
  const require_contentAddressedAssets = require("./contentAddressedAssets.cjs");
7
4
  const require_createStorageKeyBuilder = require("./createStorageKeyBuilder.cjs");
8
5
  const require_parseStorageUri = require("./parseStorageUri.cjs");
9
6
  const require_assetStorageLayout = require("./assetStorageLayout.cjs");
7
+ const require_bundleStorageLayout = require("./bundleStorageLayout.cjs");
8
+ const require_contentType = require("./contentType.cjs");
10
9
  const require_databasePluginCrudValidationErrors = require("./databasePluginCrudValidationErrors.cjs");
11
10
  const require_databaseJsonValue = require("./databaseJsonValue.cjs");
12
11
  const require_uuidv7 = require("./uuidv7.cjs");
12
+ const require_insightsContract = require("./insightsContract.cjs");
13
13
  const require_createDatabasePlugin = require("./createDatabasePlugin.cjs");
14
14
  const require_createStoragePlugin = require("./createStoragePlugin.cjs");
15
15
  const require_databaseRows = require("./databaseRows.cjs");
@@ -53,6 +53,7 @@ exports.calculatePagination = require_calculatePagination.calculatePagination;
53
53
  exports.canonicalizeAppVersion = require_releaseCatalogCompiler.canonicalizeAppVersion;
54
54
  exports.commitReleaseCatalogMutation = require_releaseCatalogMutation.commitReleaseCatalogMutation;
55
55
  exports.commitReleaseCatalogMutations = require_releaseCatalogMutation.commitReleaseCatalogMutations;
56
+ exports.compareInsightsText = require_insightsContract.compareInsightsText;
56
57
  exports.compileReleaseCatalog = require_releaseCatalogCompiler.compileReleaseCatalog;
57
58
  exports.createBundleSigningHandler = require_remoteBundleSigning.createBundleSigningHandler;
58
59
  exports.createBundleStorageKey = require_bundleStorageLayout.createBundleStorageKey;
@@ -70,18 +71,19 @@ exports.createUUIDv7 = require_uuidv7.createUUIDv7;
70
71
  exports.createUUIDv7After = require_uuidv7.createUUIDv7After;
71
72
  exports.createUUIDv7WithSameTimestamp = require_uuidv7.createUUIDv7WithSameTimestamp;
72
73
  exports.deleteRelease = require_releaseManagement.deleteRelease;
73
- exports.detectCompressionFormat = require_compressionFormat.detectCompressionFormat;
74
74
  exports.extractTimestampFromUUIDv7 = require_uuidv7.extractTimestampFromUUIDv7;
75
75
  exports.filterCompatibleAppVersions = require_filterCompatibleAppVersions.filterCompatibleAppVersions;
76
76
  exports.generateMinBundleId = require_generateMinBundleId.generateMinBundleId;
77
- exports.getCompressionMimeType = require_compressionFormat.getCompressionMimeType;
77
+ exports.getBundleArchiveStorageUri = require_bundleStorageLayout.getBundleArchiveStorageUri;
78
78
  exports.getContentAddressedAssetStoragePath = require_contentAddressedAssets.getContentAddressedAssetStoragePath;
79
- exports.getContentType = require_compressionFormat.getContentType;
79
+ exports.getContentType = require_contentType.getContentType;
80
80
  exports.getManifestAssetDownloadPath = require_assetStorageLayout.getManifestAssetDownloadPath;
81
81
  exports.getManifestAssetStoragePath = require_assetStorageLayout.getManifestAssetStoragePath;
82
82
  exports.isBrotliManifestAssetPath = require_assetStorageLayout.isBrotliManifestAssetPath;
83
83
  exports.isContentAddressedAssetFileHash = require_contentAddressedAssets.isContentAddressedAssetFileHash;
84
+ exports.isDatabaseBundleEventMetadata = require_databaseJsonValue.isDatabaseBundleEventMetadata;
84
85
  exports.isDatabaseMetadataObject = require_databaseJsonValue.isDatabaseMetadataObject;
86
+ exports.isInsightsMovementEvent = require_insightsContract.isInsightsMovementEvent;
85
87
  Object.defineProperty(exports, "isUUIDv7", {
86
88
  enumerable: true,
87
89
  get: function() {