@hot-updater/plugin-core 1.0.0-rc.0 → 1.0.0-rc.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.cjs +1 -1
- package/dist/assetStorageLayout.cjs +4 -2
- package/dist/assetStorageLayout.d.cts +5 -24
- package/dist/assetStorageLayout.d.mts +5 -24
- package/dist/assetStorageLayout.mjs +4 -2
- package/dist/calculatePagination.d.cts +0 -1
- package/dist/calculatePagination.d.mts +0 -1
- package/dist/compressionFormat.cjs +12 -5
- package/dist/compressionFormat.d.cts +1 -1
- package/dist/compressionFormat.d.mts +1 -1
- package/dist/compressionFormat.mjs +11 -4
- package/dist/contentAddressedAssets.d.cts +1 -4
- package/dist/contentAddressedAssets.d.mts +1 -4
- package/dist/createDatabasePlugin.cjs +116 -42
- package/dist/createDatabasePlugin.d.cts +3 -1
- package/dist/createDatabasePlugin.d.mts +3 -1
- package/dist/createDatabasePlugin.mjs +116 -43
- package/dist/createStoragePlugin.d.cts +0 -1
- package/dist/createStoragePlugin.d.mts +0 -1
- package/dist/databaseClient.cjs +6 -1
- package/dist/databaseClient.d.cts +1 -2
- package/dist/databaseClient.d.mts +1 -2
- package/dist/databaseClient.mjs +6 -2
- package/dist/databaseClientReads.cjs +3 -1
- package/dist/databaseClientReads.mjs +3 -2
- package/dist/databaseClientUpdates.cjs +2 -1
- package/dist/databaseClientUpdates.d.cts +1 -1
- package/dist/databaseClientUpdates.d.mts +1 -1
- package/dist/databaseClientUpdates.mjs +2 -0
- package/dist/databaseJsonValue.cjs +4 -0
- package/dist/databaseJsonValue.d.cts +4 -2
- package/dist/databaseJsonValue.d.mts +4 -2
- package/dist/databaseJsonValue.mjs +2 -1
- package/dist/databaseMetadata.cjs +0 -1
- package/dist/databasePluginCrud.cjs +1 -0
- package/dist/databasePluginCrud.d.cts +4 -1
- package/dist/databasePluginCrud.d.mts +4 -1
- package/dist/databasePluginCrud.mjs +1 -1
- package/dist/databasePluginCrudValidation.d.cts +6 -1
- package/dist/databasePluginCrudValidation.d.mts +6 -1
- package/dist/databasePluginCrudValidationErrors.cjs +1 -0
- package/dist/databasePluginCrudValidationErrors.mjs +1 -0
- package/dist/databasePluginCrudValidationFields.cjs +21 -19
- package/dist/databasePluginCrudValidationFields.d.cts +1 -1
- package/dist/databasePluginCrudValidationFields.d.mts +1 -1
- package/dist/databasePluginCrudValidationFields.mjs +20 -20
- package/dist/databasePluginCrudValidationMutations.cjs +1 -1
- package/dist/databasePluginCrudValidationMutations.d.cts +1 -1
- package/dist/databasePluginCrudValidationMutations.d.mts +1 -1
- package/dist/databasePluginCrudValidationMutations.mjs +1 -1
- package/dist/databasePluginCrudValidationQueries.d.cts +2 -1
- package/dist/databasePluginCrudValidationQueries.d.mts +2 -1
- package/dist/databasePluginCrudValidationRows.cjs +2 -2
- package/dist/databasePluginCrudValidationRows.d.cts +1 -1
- package/dist/databasePluginCrudValidationRows.d.mts +1 -1
- package/dist/databasePluginCrudValidationRows.mjs +2 -2
- package/dist/databaseRows.cjs +0 -1
- package/dist/databaseRows.d.cts +2 -6
- package/dist/databaseRows.d.mts +2 -6
- package/dist/index.cjs +4 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.mts +5 -4
- package/dist/index.mjs +3 -2
- package/dist/insightsContract.cjs +146 -0
- package/dist/insightsContract.d.cts +9 -0
- package/dist/insightsContract.d.mts +9 -0
- package/dist/insightsContract.mjs +143 -0
- package/dist/insightsLatestQueries.cjs +53 -0
- package/dist/insightsLatestQueries.d.cts +13 -0
- package/dist/insightsLatestQueries.d.mts +13 -0
- package/dist/insightsLatestQueries.mjs +52 -0
- package/dist/internal.cjs +3 -0
- package/dist/internal.d.cts +5 -3
- package/dist/internal.d.mts +5 -3
- package/dist/internal.mjs +2 -1
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/comparison-DenM3wCn.cjs +136 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/comparison-DenM3wCn.mjs +116 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/range-DvX-Y6iv.cjs +167 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/range-DvX-Y6iv.mjs +165 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/set-CC5YeoYX.cjs +42 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/set-CC5YeoYX.mjs +39 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/version-CQ98ZBpL.cjs +39 -0
- package/dist/node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/version-CQ98ZBpL.mjs +37 -0
- package/dist/paginateBundles.d.cts +1 -8
- package/dist/paginateBundles.d.mts +1 -8
- package/dist/parseStorageUri.d.cts +1 -5
- package/dist/parseStorageUri.d.mts +1 -5
- package/dist/queryBundles.d.cts +0 -1
- package/dist/queryBundles.d.mts +0 -1
- package/dist/releaseCatalogCompiler.cjs +15 -12
- package/dist/releaseCatalogCompiler.d.cts +0 -1
- package/dist/releaseCatalogCompiler.d.mts +0 -1
- package/dist/releaseCatalogCompiler.mjs +11 -7
- package/dist/releaseCatalogMutation.cjs +1 -1
- package/dist/releaseCatalogMutation.d.cts +1 -1
- package/dist/releaseCatalogMutation.d.mts +1 -1
- package/dist/releaseCatalogMutation.mjs +1 -0
- package/dist/releaseManagement.cjs +3 -2
- package/dist/releaseManagement.d.cts +1 -1
- package/dist/releaseManagement.d.mts +1 -1
- package/dist/releaseManagement.mjs +3 -1
- package/dist/remoteBundleSigning.cjs +5 -7
- package/dist/remoteBundleSigning.d.cts +2 -15
- package/dist/remoteBundleSigning.d.mts +2 -15
- package/dist/remoteBundleSigning.mjs +5 -7
- package/dist/requestBundleCache.d.cts +1 -2
- package/dist/requestBundleCache.d.mts +1 -2
- package/dist/semverSatisfies.cjs +4 -3
- package/dist/semverSatisfies.mjs +2 -1
- package/dist/storageDownloadPath.cjs +2 -1
- package/dist/storageDownloadPath.d.cts +1 -3
- package/dist/storageDownloadPath.d.mts +1 -3
- package/dist/storageDownloadPath.mjs +2 -1
- package/dist/types/database.d.cts +4 -3
- package/dist/types/database.d.mts +4 -3
- package/dist/types/databaseFields.cjs +1 -5
- package/dist/types/databaseFields.d.cts +1 -1
- package/dist/types/databaseFields.d.mts +1 -1
- package/dist/types/databaseFields.mjs +1 -5
- package/dist/types/databaseOperations.d.cts +15 -12
- package/dist/types/databaseOperations.d.mts +15 -12
- package/dist/types/databasePlugin.d.cts +77 -13
- package/dist/types/databasePlugin.d.mts +77 -13
- package/dist/types/databaseQuery.d.cts +2 -3
- package/dist/types/databaseQuery.d.mts +2 -3
- package/dist/types/databaseRows.d.cts +16 -11
- package/dist/types/databaseRows.d.mts +16 -11
- package/dist/types/index.d.cts +15 -11
- package/dist/types/index.d.mts +15 -11
- package/dist/types/internal.d.cts +4 -3
- package/dist/types/internal.d.mts +4 -3
- package/dist/types/public.d.cts +4 -3
- package/dist/types/public.d.mts +4 -3
- package/dist/types/utils.d.cts +1 -1
- package/dist/types/utils.d.mts +1 -1
- package/dist/uuidv7.cjs +7 -2
- package/dist/uuidv7.d.cts +0 -1
- package/dist/uuidv7.d.mts +0 -1
- package/dist/uuidv7.mjs +1 -1
- package/package.json +4 -4
- package/dist/node_modules/.pnpm/verkit@0.3.2/node_modules/verkit/dist/index.cjs +0 -345
- package/dist/node_modules/.pnpm/verkit@0.3.2/node_modules/verkit/dist/index.mjs +0 -341
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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,6 +13,8 @@ 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",
|
|
@@ -87,10 +89,9 @@ const modelValidators = {
|
|
|
87
89
|
},
|
|
88
90
|
bundle_events: {
|
|
89
91
|
id: (value) => typeof value === "string",
|
|
90
|
-
type: (value) => value === "
|
|
91
|
-
install_id:
|
|
92
|
-
user_id:
|
|
93
|
-
username: (value) => value === null || typeof value === "string",
|
|
92
|
+
type: (value) => value === "UPDATE_DOWNLOADED" || value === "UPDATE_APPLIED" || value === "RECOVERED" || value === "UNCHANGED",
|
|
93
|
+
install_id: isInsightsIdentityText,
|
|
94
|
+
user_id: isNullableInsightsIdentityText,
|
|
94
95
|
from_bundle_id: (value) => value === null || typeof value === "string",
|
|
95
96
|
from_release_id: (value) => value === null || typeof value === "string",
|
|
96
97
|
to_release_id: (value) => value === null || typeof value === "string",
|
|
@@ -98,10 +99,7 @@ const modelValidators = {
|
|
|
98
99
|
platform: (value) => value === "ios" || value === "android",
|
|
99
100
|
app_version: (value) => typeof value === "string",
|
|
100
101
|
channel: (value) => typeof value === "string",
|
|
101
|
-
|
|
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",
|
|
102
|
+
metadata: isDatabaseBundleEventMetadata,
|
|
105
103
|
received_at_ms: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0
|
|
106
104
|
},
|
|
107
105
|
api_keys: {
|
|
@@ -114,7 +112,7 @@ const modelValidators = {
|
|
|
114
112
|
revoked_at_ms: (value) => value === null || typeof value === "number" && Number.isSafeInteger(value) && value >= 0
|
|
115
113
|
}
|
|
116
114
|
};
|
|
117
|
-
const stringFields = new Set([
|
|
115
|
+
const stringFields = /* @__PURE__ */ new Set([
|
|
118
116
|
"id",
|
|
119
117
|
"platform",
|
|
120
118
|
"file_hash",
|
|
@@ -155,7 +153,7 @@ const stringFields = new Set([
|
|
|
155
153
|
"prefix",
|
|
156
154
|
"role"
|
|
157
155
|
]);
|
|
158
|
-
const numberFields = new Set([
|
|
156
|
+
const numberFields = /* @__PURE__ */ new Set([
|
|
159
157
|
"archive_byte_size",
|
|
160
158
|
"byte_size",
|
|
161
159
|
"rollout_cohort_count",
|
|
@@ -168,13 +166,13 @@ const numberFields = new Set([
|
|
|
168
166
|
"created_at_ms",
|
|
169
167
|
"revoked_at_ms"
|
|
170
168
|
]);
|
|
171
|
-
const booleanFields = new Set([
|
|
169
|
+
const booleanFields = /* @__PURE__ */ new Set([
|
|
172
170
|
"should_force_update",
|
|
173
171
|
"enabled",
|
|
174
172
|
"is_tombstone"
|
|
175
173
|
]);
|
|
176
174
|
const sortableFields = {
|
|
177
|
-
bundles: new Set([
|
|
175
|
+
bundles: /* @__PURE__ */ new Set([
|
|
178
176
|
"id",
|
|
179
177
|
"platform",
|
|
180
178
|
"file_hash",
|
|
@@ -191,7 +189,7 @@ const sortableFields = {
|
|
|
191
189
|
"manifest_file_hash",
|
|
192
190
|
"asset_base_storage_uri"
|
|
193
191
|
]),
|
|
194
|
-
bundle_patches: new Set([
|
|
192
|
+
bundle_patches: /* @__PURE__ */ new Set([
|
|
195
193
|
"id",
|
|
196
194
|
"bundle_id",
|
|
197
195
|
"base_bundle_id",
|
|
@@ -201,7 +199,7 @@ const sortableFields = {
|
|
|
201
199
|
"byte_size",
|
|
202
200
|
"order_index"
|
|
203
201
|
]),
|
|
204
|
-
releases: new Set([
|
|
202
|
+
releases: /* @__PURE__ */ new Set([
|
|
205
203
|
"id",
|
|
206
204
|
"revision",
|
|
207
205
|
"scope_key",
|
|
@@ -221,7 +219,7 @@ const sortableFields = {
|
|
|
221
219
|
"created_at_ms",
|
|
222
220
|
"updated_at_ms"
|
|
223
221
|
]),
|
|
224
|
-
release_catalogs: new Set([
|
|
222
|
+
release_catalogs: /* @__PURE__ */ new Set([
|
|
225
223
|
"scope_key",
|
|
226
224
|
"catalog_id",
|
|
227
225
|
"strategy",
|
|
@@ -235,8 +233,8 @@ const sortableFields = {
|
|
|
235
233
|
"is_tombstone",
|
|
236
234
|
"updated_at_ms"
|
|
237
235
|
]),
|
|
238
|
-
channels: new Set(["id", "name"]),
|
|
239
|
-
bundle_events: new Set([
|
|
236
|
+
channels: /* @__PURE__ */ new Set(["id", "name"]),
|
|
237
|
+
bundle_events: /* @__PURE__ */ new Set([
|
|
240
238
|
"id",
|
|
241
239
|
"type",
|
|
242
240
|
"install_id",
|
|
@@ -246,6 +244,8 @@ const sortableFields = {
|
|
|
246
244
|
"from_release_id",
|
|
247
245
|
"to_release_id",
|
|
248
246
|
"to_bundle_id",
|
|
247
|
+
"pending_bundle_id",
|
|
248
|
+
"pending_release_id",
|
|
249
249
|
"platform",
|
|
250
250
|
"app_version",
|
|
251
251
|
"channel",
|
|
@@ -255,7 +255,7 @@ const sortableFields = {
|
|
|
255
255
|
"sdk_version",
|
|
256
256
|
"received_at_ms"
|
|
257
257
|
]),
|
|
258
|
-
api_keys: new Set([
|
|
258
|
+
api_keys: /* @__PURE__ */ new Set([
|
|
259
259
|
"id",
|
|
260
260
|
"hash",
|
|
261
261
|
"name",
|
|
@@ -278,4 +278,4 @@ const isStringField = (field) => stringFields.has(field);
|
|
|
278
278
|
const isNumberField = (field) => numberFields.has(field);
|
|
279
279
|
const isBooleanField = (field) => booleanFields.has(field);
|
|
280
280
|
//#endregion
|
|
281
|
-
export { isBooleanField, isChannelText, isNumberField, isRecord, isStringField, modelValidators, sortableFields, validateField, validateFields, validateModel };
|
|
281
|
+
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
|
-
|
|
1
|
+
import "./types/internal.cjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
1
|
+
import "./types/internal.cjs";
|
|
2
|
+
import "./databasePluginCrudValidationFields.cjs";
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
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 === "
|
|
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
|
-
"
|
|
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
|
-
|
|
1
|
+
import "./types/internal.cjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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 === "
|
|
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
|
-
"
|
|
49
|
+
"metadata"
|
|
50
50
|
].every((field) => Object.hasOwn(row, field)) && !hasValidBundleEventInvariants(row)) throw new DatabasePluginInputError("invalid-result");
|
|
51
51
|
};
|
|
52
52
|
//#endregion
|
package/dist/databaseRows.cjs
CHANGED
package/dist/databaseRows.d.cts
CHANGED
|
@@ -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[];
|
package/dist/databaseRows.d.mts
CHANGED
|
@@ -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[];
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("./_virtual/_rolldown/runtime.cjs");
|
|
3
2
|
const require_calculatePagination = require("./calculatePagination.cjs");
|
|
4
3
|
const require_bundleStorageLayout = require("./bundleStorageLayout.cjs");
|
|
5
4
|
const require_compressionFormat = require("./compressionFormat.cjs");
|
|
@@ -10,6 +9,7 @@ const require_assetStorageLayout = require("./assetStorageLayout.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;
|
|
@@ -81,7 +82,9 @@ exports.getManifestAssetDownloadPath = require_assetStorageLayout.getManifestAss
|
|
|
81
82
|
exports.getManifestAssetStoragePath = require_assetStorageLayout.getManifestAssetStoragePath;
|
|
82
83
|
exports.isBrotliManifestAssetPath = require_assetStorageLayout.isBrotliManifestAssetPath;
|
|
83
84
|
exports.isContentAddressedAssetFileHash = require_contentAddressedAssets.isContentAddressedAssetFileHash;
|
|
85
|
+
exports.isDatabaseBundleEventMetadata = require_databaseJsonValue.isDatabaseBundleEventMetadata;
|
|
84
86
|
exports.isDatabaseMetadataObject = require_databaseJsonValue.isDatabaseMetadataObject;
|
|
87
|
+
exports.isInsightsMovementEvent = require_insightsContract.isInsightsMovementEvent;
|
|
85
88
|
Object.defineProperty(exports, "isUUIDv7", {
|
|
86
89
|
enumerable: true,
|
|
87
90
|
get: function() {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.cjs";
|
|
2
|
-
import {
|
|
1
|
+
import { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleEventMetadata, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.cjs";
|
|
2
|
+
import { ApiKeyModel, BundleModel, BundleModelQuery, BundlePatchModel, BundleRepository, BundleRepositoryChange, BundleRepositoryCommit, ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelModel, DatabaseChange, DatabaseCommit, DatabaseCommitExpectation, DatabaseCommitResult, DatabaseModels, DatabasePlugin, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, ReleaseCatalogModel, ReleaseModel } from "./types/databasePlugin.cjs";
|
|
3
3
|
import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./types/databaseOperations.cjs";
|
|
4
4
|
import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.cjs";
|
|
5
5
|
import { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, BundleSigningPlugin, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, FingerprintExtraSources, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, Platform, PlatformConfig, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePlugin, StoragePutInput, StoragePutResult, supportedIosPlatforms } from "./types/index.cjs";
|
|
@@ -14,10 +14,11 @@ import { createStorageKeyBuilder } from "./createStorageKeyBuilder.cjs";
|
|
|
14
14
|
import { CreateStoragePluginOptions, StorageOperation, StoragePluginWith, assertStorageOperations, createStoragePlugin } from "./createStoragePlugin.cjs";
|
|
15
15
|
import { DatabasePatchUpdateUnsupportedError } from "./databaseClientUpdates.cjs";
|
|
16
16
|
import { DatabaseBundleNotFoundError, DatabaseClient, DatabaseMutationClient, DatabasePatchInsertUnsupportedError, createDatabaseClient } from "./databaseClient.cjs";
|
|
17
|
-
import { isDatabaseMetadataObject } from "./databaseJsonValue.cjs";
|
|
17
|
+
import { isDatabaseBundleEventMetadata, isDatabaseMetadataObject } from "./databaseJsonValue.cjs";
|
|
18
18
|
import { BundleRowHydrationError, BundleRowHydrationErrorReason, bundleToPatchRows, bundleToRow, releaseRowToRelease, releaseToRow, rowToBundle, rowsToBundles } from "./databaseRows.cjs";
|
|
19
19
|
import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.cjs";
|
|
20
20
|
import { generateMinBundleId } from "./generateMinBundleId.cjs";
|
|
21
|
+
import { compareInsightsText, isInsightsMovementEvent } from "./insightsContract.cjs";
|
|
21
22
|
import { CreateStorageUriInput, ParsedStorageUri, createStorageUri, parseStorageUri } from "./parseStorageUri.cjs";
|
|
22
23
|
import { paginateBundles } from "./paginateBundles.cjs";
|
|
23
24
|
import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./queryBundles.cjs";
|
|
@@ -29,4 +30,4 @@ import { BundleSigningHandlerOptions, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BU
|
|
|
29
30
|
import { semverSatisfies } from "./semverSatisfies.cjs";
|
|
30
31
|
import { createStorageDownloadPath, createStorageDownloadUrl, parseStorageDownloadPath } from "./storageDownloadPath.cjs";
|
|
31
32
|
import { createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, isUUIDv7 } from "./uuidv7.cjs";
|
|
32
|
-
export {
|
|
33
|
+
export { type ApiKeyModel, type ApiKeyRow, ApplePlatform, BUNDLE_STORAGE_PREFIX, BasePluginArgs, BuildPlugin, BuildPluginConfig, BuiltIns, type Bundle, type BundleEventRow, type BundleEventRowBase, type BundleModel, type BundleModelQuery, type BundlePatchModel, type BundlePatchRow, type BundleRepository, type BundleRepositoryChange, type BundleRepositoryCommit, type BundleRow, BundleRowHydrationError, BundleRowHydrationErrorReason, type BundleRowUpdate, BundleSigningHandlerOptions, BundleSigningPlugin, CONTENT_ADDRESSED_ASSET_PREFIX, CatalogVersionBound, type ChannelDeleteInput, type ChannelDeleteResult, type ChannelInsertInput, type ChannelInsertResult, type ChannelModel, type ChannelRow, CompiledCatalogSegment, CompiledReleaseCatalog, CompressionFormat, CompressionFormatInfo, ConfigInput, type CreateDatabasePluginOptions, CreateStoragePluginOptions, CreateStorageUriInput, DatabaseAtomicCommitUnsupportedError, DatabaseBundleCursor, type DatabaseBundleEventMetadata, DatabaseBundleIdFilter, type DatabaseBundleMetadata, DatabaseBundleNotFoundError, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, type DatabaseChange, DatabaseClient, type DatabaseCommit, type DatabaseCommitExpectation, type DatabaseCommitResult, type DatabaseJsonObject, type DatabaseJsonValue, type DatabaseModels, DatabaseMutationClient, DatabasePatchInsertUnsupportedError, DatabasePatchUpdateUnsupportedError, type DatabasePlugin, DatabasePluginInputError, type DatabasePluginInputErrorCode, FingerprintExtraSources, HasMultipleCallSignatures, type InsightsBundleEventFilter, type InsightsCountEventsInput, type InsightsCountLatestEventsInput, type InsightsEventCursor, type InsightsEventFilter, type InsightsFindLatestEventsInput, type InsightsListEventsInput, type InsightsModel, type InsightsRecordEventInput, type InsightsScope, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, type Platform, PlatformConfig, Primitive, PromoteReleaseInput, PromoteReleaseResult, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, type ReleaseCatalogModel, ReleaseCatalogMutation, ReleaseCatalogMutationError, ReleaseCatalogMutationInput, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, ReleaseManagementError, type ReleaseModel, ReleaseMutationTarget, ReleasePolicyPatch, type ReleaseRow, type ReleaseRowUpdate, RemoteSigningOptions, RequiredDeep, RollbackReleaseInput, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StorageOperation, StoragePlugin, StoragePluginWith, StoragePutInput, StoragePutResult, assertStorageOperations, bundleIdMatchesFilter, bundleMatchesQueryWhere, bundleToPatchRows, bundleToRow, calculatePagination, canonicalizeAppVersion, commitReleaseCatalogMutation, commitReleaseCatalogMutations, compareInsightsText, compileReleaseCatalog, createBundleSigningHandler, createBundleStorageKey, createDatabaseClient, createDatabasePlugin, createRequestBundleResolver, createStorageDownloadPath, createStorageDownloadUrl, createStorageKeyBuilder, createStoragePlugin, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, deleteRelease, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBundleEventMetadata, isDatabaseMetadataObject, isInsightsMovementEvent, isUUIDv7, paginateBundles, parseStorageDownloadPath, parseStorageUri, preflightReleaseCatalogMutation, preflightReleaseCatalogRebuild, preflightReleasePolicy, projectCompiledCatalog, projectCompiledRollbackCatalog, promoteRelease, rebuildReleaseCatalog, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, remoteSigning, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rollbackRelease, rollbackReleases, rowToBundle, rowsToBundles, semverSatisfies, sortBundles, supportedIosPlatforms, updateReleasePolicy };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.mjs";
|
|
2
|
-
import {
|
|
1
|
+
import { ApiKeyRow, BundleEventRow, BundleEventRowBase, BundlePatchRow, BundleRow, ChannelRow, DatabaseBundleEventMetadata, DatabaseBundleMetadata, DatabaseJsonObject, DatabaseJsonValue, ReleaseCatalogRow, ReleaseRow } from "./types/databaseRows.mjs";
|
|
2
|
+
import { ApiKeyModel, BundleModel, BundleModelQuery, BundlePatchModel, BundleRepository, BundleRepositoryChange, BundleRepositoryCommit, ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelModel, DatabaseChange, DatabaseCommit, DatabaseCommitExpectation, DatabaseCommitResult, DatabaseModels, DatabasePlugin, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, ReleaseCatalogModel, ReleaseModel } from "./types/databasePlugin.mjs";
|
|
3
3
|
import { BundleRowUpdate, ReleaseCatalogRowUpdate, ReleaseRowUpdate } from "./types/databaseOperations.mjs";
|
|
4
4
|
import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.mjs";
|
|
5
5
|
import { ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, BundleSigningPlugin, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, FingerprintExtraSources, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, Platform, PlatformConfig, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StoragePlugin, StoragePutInput, StoragePutResult, supportedIosPlatforms } from "./types/index.mjs";
|
|
@@ -14,10 +14,11 @@ import { createStorageKeyBuilder } from "./createStorageKeyBuilder.mjs";
|
|
|
14
14
|
import { CreateStoragePluginOptions, StorageOperation, StoragePluginWith, assertStorageOperations, createStoragePlugin } from "./createStoragePlugin.mjs";
|
|
15
15
|
import { DatabasePatchUpdateUnsupportedError } from "./databaseClientUpdates.mjs";
|
|
16
16
|
import { DatabaseBundleNotFoundError, DatabaseClient, DatabaseMutationClient, DatabasePatchInsertUnsupportedError, createDatabaseClient } from "./databaseClient.mjs";
|
|
17
|
-
import { isDatabaseMetadataObject } from "./databaseJsonValue.mjs";
|
|
17
|
+
import { isDatabaseBundleEventMetadata, isDatabaseMetadataObject } from "./databaseJsonValue.mjs";
|
|
18
18
|
import { BundleRowHydrationError, BundleRowHydrationErrorReason, bundleToPatchRows, bundleToRow, releaseRowToRelease, releaseToRow, rowToBundle, rowsToBundles } from "./databaseRows.mjs";
|
|
19
19
|
import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.mjs";
|
|
20
20
|
import { generateMinBundleId } from "./generateMinBundleId.mjs";
|
|
21
|
+
import { compareInsightsText, isInsightsMovementEvent } from "./insightsContract.mjs";
|
|
21
22
|
import { CreateStorageUriInput, ParsedStorageUri, createStorageUri, parseStorageUri } from "./parseStorageUri.mjs";
|
|
22
23
|
import { paginateBundles } from "./paginateBundles.mjs";
|
|
23
24
|
import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./queryBundles.mjs";
|
|
@@ -29,4 +30,4 @@ import { BundleSigningHandlerOptions, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BU
|
|
|
29
30
|
import { semverSatisfies } from "./semverSatisfies.mjs";
|
|
30
31
|
import { createStorageDownloadPath, createStorageDownloadUrl, parseStorageDownloadPath } from "./storageDownloadPath.mjs";
|
|
31
32
|
import { createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, isUUIDv7 } from "./uuidv7.mjs";
|
|
32
|
-
export {
|
|
33
|
+
export { type ApiKeyModel, type ApiKeyRow, ApplePlatform, BUNDLE_STORAGE_PREFIX, BasePluginArgs, BuildPlugin, BuildPluginConfig, BuiltIns, type Bundle, type BundleEventRow, type BundleEventRowBase, type BundleModel, type BundleModelQuery, type BundlePatchModel, type BundlePatchRow, type BundleRepository, type BundleRepositoryChange, type BundleRepositoryCommit, type BundleRow, BundleRowHydrationError, BundleRowHydrationErrorReason, type BundleRowUpdate, BundleSigningHandlerOptions, BundleSigningPlugin, CONTENT_ADDRESSED_ASSET_PREFIX, CatalogVersionBound, type ChannelDeleteInput, type ChannelDeleteResult, type ChannelInsertInput, type ChannelInsertResult, type ChannelModel, type ChannelRow, CompiledCatalogSegment, CompiledReleaseCatalog, CompressionFormat, CompressionFormatInfo, ConfigInput, type CreateDatabasePluginOptions, CreateStoragePluginOptions, CreateStorageUriInput, DatabaseAtomicCommitUnsupportedError, DatabaseBundleCursor, type DatabaseBundleEventMetadata, DatabaseBundleIdFilter, type DatabaseBundleMetadata, DatabaseBundleNotFoundError, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, type DatabaseChange, DatabaseClient, type DatabaseCommit, type DatabaseCommitExpectation, type DatabaseCommitResult, type DatabaseJsonObject, type DatabaseJsonValue, type DatabaseModels, DatabaseMutationClient, DatabasePatchInsertUnsupportedError, DatabasePatchUpdateUnsupportedError, type DatabasePlugin, DatabasePluginInputError, type DatabasePluginInputErrorCode, FingerprintExtraSources, HasMultipleCallSignatures, type InsightsBundleEventFilter, type InsightsCountEventsInput, type InsightsCountLatestEventsInput, type InsightsEventCursor, type InsightsEventFilter, type InsightsFindLatestEventsInput, type InsightsListEventsInput, type InsightsModel, type InsightsRecordEventInput, type InsightsScope, IosBuildDestination, LocalSigningConfig, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, type Platform, PlatformConfig, Primitive, PromoteReleaseInput, PromoteReleaseResult, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, type ReleaseCatalogModel, ReleaseCatalogMutation, ReleaseCatalogMutationError, ReleaseCatalogMutationInput, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, ReleaseManagementError, type ReleaseModel, ReleaseMutationTarget, ReleasePolicyPatch, type ReleaseRow, type ReleaseRowUpdate, RemoteSigningOptions, RequiredDeep, RollbackReleaseInput, SigningConfig, StorageDeleteInput, StorageDeleteResult, StorageExistsInput, StorageExistsResult, StorageGetDownloadUrlInput, StorageGetDownloadUrlResult, StorageGetInput, StorageGetResult, StorageObject, StorageOperation, StoragePlugin, StoragePluginWith, StoragePutInput, StoragePutResult, assertStorageOperations, bundleIdMatchesFilter, bundleMatchesQueryWhere, bundleToPatchRows, bundleToRow, calculatePagination, canonicalizeAppVersion, commitReleaseCatalogMutation, commitReleaseCatalogMutations, compareInsightsText, compileReleaseCatalog, createBundleSigningHandler, createBundleStorageKey, createDatabaseClient, createDatabasePlugin, createRequestBundleResolver, createStorageDownloadPath, createStorageDownloadUrl, createStorageKeyBuilder, createStoragePlugin, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, deleteRelease, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBundleEventMetadata, isDatabaseMetadataObject, isInsightsMovementEvent, isUUIDv7, paginateBundles, parseStorageDownloadPath, parseStorageUri, preflightReleaseCatalogMutation, preflightReleaseCatalogRebuild, preflightReleasePolicy, projectCompiledCatalog, projectCompiledRollbackCatalog, promoteRelease, rebuildReleaseCatalog, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, remoteSigning, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rollbackRelease, rollbackReleases, rowToBundle, rowsToBundles, semverSatisfies, sortBundles, supportedIosPlatforms, updateReleasePolicy };
|
package/dist/index.mjs
CHANGED
|
@@ -6,8 +6,9 @@ import { createStorageKeyBuilder } from "./createStorageKeyBuilder.mjs";
|
|
|
6
6
|
import { createStorageUri, parseStorageUri } from "./parseStorageUri.mjs";
|
|
7
7
|
import { createStorageUriWithRelativePath, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri } from "./assetStorageLayout.mjs";
|
|
8
8
|
import { DatabasePluginInputError } from "./databasePluginCrudValidationErrors.mjs";
|
|
9
|
-
import { isDatabaseMetadataObject } from "./databaseJsonValue.mjs";
|
|
9
|
+
import { isDatabaseBundleEventMetadata, isDatabaseMetadataObject } from "./databaseJsonValue.mjs";
|
|
10
10
|
import { createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, isUUIDv7 } from "./uuidv7.mjs";
|
|
11
|
+
import { compareInsightsText, isInsightsMovementEvent } from "./insightsContract.mjs";
|
|
11
12
|
import { DatabaseAtomicCommitUnsupportedError, createDatabasePlugin } from "./createDatabasePlugin.mjs";
|
|
12
13
|
import { assertStorageOperations, createStoragePlugin } from "./createStoragePlugin.mjs";
|
|
13
14
|
import { BundleRowHydrationError, BundleRowHydrationErrorReason, bundleToPatchRows, bundleToRow, releaseRowToRelease, releaseToRow, rowToBundle, rowsToBundles } from "./databaseRows.mjs";
|
|
@@ -25,4 +26,4 @@ import { ReleaseManagementError, deleteRelease, preflightReleasePolicy, promoteR
|
|
|
25
26
|
import { REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, createBundleSigningHandler, remoteSigning } from "./remoteBundleSigning.mjs";
|
|
26
27
|
import { createStorageDownloadPath, createStorageDownloadUrl, parseStorageDownloadPath } from "./storageDownloadPath.mjs";
|
|
27
28
|
import { supportedIosPlatforms } from "./types/index.mjs";
|
|
28
|
-
export { BUNDLE_STORAGE_PREFIX, BundleRowHydrationError, BundleRowHydrationErrorReason, CONTENT_ADDRESSED_ASSET_PREFIX, DatabaseAtomicCommitUnsupportedError, DatabaseBundleNotFoundError, DatabasePatchInsertUnsupportedError, DatabasePatchUpdateUnsupportedError, DatabasePluginInputError, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, ReleaseCatalogCompilationError, ReleaseCatalogMutationError, ReleaseManagementError, assertStorageOperations, bundleIdMatchesFilter, bundleMatchesQueryWhere, bundleToPatchRows, bundleToRow, calculatePagination, canonicalizeAppVersion, commitReleaseCatalogMutation, commitReleaseCatalogMutations, compileReleaseCatalog, createBundleSigningHandler, createBundleStorageKey, createDatabaseClient, createDatabasePlugin, createRequestBundleResolver, createStorageDownloadPath, createStorageDownloadUrl, createStorageKeyBuilder, createStoragePlugin, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, deleteRelease, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseMetadataObject, isUUIDv7, paginateBundles, parseStorageDownloadPath, parseStorageUri, preflightReleaseCatalogMutation, preflightReleaseCatalogRebuild, preflightReleasePolicy, projectCompiledCatalog, projectCompiledRollbackCatalog, promoteRelease, rebuildReleaseCatalog, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, remoteSigning, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rollbackRelease, rollbackReleases, rowToBundle, rowsToBundles, semverSatisfies, sortBundles, supportedIosPlatforms, updateReleasePolicy };
|
|
29
|
+
export { BUNDLE_STORAGE_PREFIX, BundleRowHydrationError, BundleRowHydrationErrorReason, CONTENT_ADDRESSED_ASSET_PREFIX, DatabaseAtomicCommitUnsupportedError, DatabaseBundleNotFoundError, DatabasePatchInsertUnsupportedError, DatabasePatchUpdateUnsupportedError, DatabasePluginInputError, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BUNDLE_SIGNING_PATH, REMOTE_BUNDLE_SIGNING_PROTOCOL_VERSION, REMOTE_BUNDLE_SIGNING_TOKEN_HEADER, ReleaseCatalogCompilationError, ReleaseCatalogMutationError, ReleaseManagementError, assertStorageOperations, bundleIdMatchesFilter, bundleMatchesQueryWhere, bundleToPatchRows, bundleToRow, calculatePagination, canonicalizeAppVersion, commitReleaseCatalogMutation, commitReleaseCatalogMutations, compareInsightsText, compileReleaseCatalog, createBundleSigningHandler, createBundleStorageKey, createDatabaseClient, createDatabasePlugin, createRequestBundleResolver, createStorageDownloadPath, createStorageDownloadUrl, createStorageKeyBuilder, createStoragePlugin, createStorageRootUriWithPath, createStorageUri, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, deleteRelease, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetFileHash, isDatabaseBundleEventMetadata, isDatabaseMetadataObject, isInsightsMovementEvent, isUUIDv7, paginateBundles, parseStorageDownloadPath, parseStorageUri, preflightReleaseCatalogMutation, preflightReleaseCatalogRebuild, preflightReleasePolicy, projectCompiledCatalog, projectCompiledRollbackCatalog, promoteRelease, rebuildReleaseCatalog, referenceCompatibleReleases, releaseRowToRelease, releaseToRow, remoteSigning, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri, rollbackRelease, rollbackReleases, rowToBundle, rowsToBundles, semverSatisfies, sortBundles, supportedIosPlatforms, updateReleasePolicy };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
const require_databasePluginCrudValidationErrors = require("./databasePluginCrudValidationErrors.cjs");
|
|
2
|
+
const require_databasePluginCrudValidationFields = require("./databasePluginCrudValidationFields.cjs");
|
|
3
|
+
const require_databasePluginCrudValidationRows = require("./databasePluginCrudValidationRows.cjs");
|
|
4
|
+
let _hot_updater_core = require("@hot-updater/core");
|
|
5
|
+
//#region src/insightsContract.ts
|
|
6
|
+
const encoder = new TextEncoder();
|
|
7
|
+
/** Exact UTF-8 byte ordering, without case folding or Unicode normalization. */
|
|
8
|
+
const compareInsightsText = (left, right) => {
|
|
9
|
+
const a = encoder.encode(left);
|
|
10
|
+
const b = encoder.encode(right);
|
|
11
|
+
for (let index = 0; index < Math.min(a.length, b.length); index += 1) if (a[index] !== b[index]) return a[index] - b[index];
|
|
12
|
+
return a.length - b.length;
|
|
13
|
+
};
|
|
14
|
+
const isWellFormedText = (value) => {
|
|
15
|
+
for (const character of value) {
|
|
16
|
+
const point = character.codePointAt(0);
|
|
17
|
+
if (point >= 55296 && point <= 57343) return false;
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
};
|
|
21
|
+
const isIdentity = (value) => typeof value === "string" && value.length > 0 && value.length <= 255 && isWellFormedText(value);
|
|
22
|
+
const isText = (value) => typeof value === "string" && value.length > 0 && isWellFormedText(value);
|
|
23
|
+
const isTimestamp = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
24
|
+
const isLimit = (value) => isTimestamp(value) && value >= 1 && value <= 101;
|
|
25
|
+
const hasOnlyKeys = (value, keys) => Object.keys(value).every((key) => keys.includes(key));
|
|
26
|
+
const hasScope = (value) => (value.platform === "ios" || value.platform === "android") && isText(value.channel);
|
|
27
|
+
const isBundleFilter = (value, withKind = false) => {
|
|
28
|
+
if (!require_databasePluginCrudValidationFields.isRecord(value) || !hasScope(value)) return false;
|
|
29
|
+
const keys = [
|
|
30
|
+
"platform",
|
|
31
|
+
"channel",
|
|
32
|
+
"type",
|
|
33
|
+
...withKind ? ["kind"] : []
|
|
34
|
+
];
|
|
35
|
+
return value.type === "RECOVERED" ? isText(value.fromBundleId) && hasOnlyKeys(value, [...keys, "fromBundleId"]) : (value.type === "UPDATE_DOWNLOADED" || value.type === "UPDATE_APPLIED" || value.type === "UNCHANGED") && isText(value.toBundleId) && hasOnlyKeys(value, [...keys, "toBundleId"]);
|
|
36
|
+
};
|
|
37
|
+
const isEventFilter = (value) => {
|
|
38
|
+
if (!require_databasePluginCrudValidationFields.isRecord(value)) return false;
|
|
39
|
+
if (value.kind === "all") return hasOnlyKeys(value, ["kind"]);
|
|
40
|
+
if (value.kind === "installationMovement") return isIdentity(value.installId) && hasOnlyKeys(value, ["kind", "installId"]);
|
|
41
|
+
return value.kind === "bundle" && isBundleFilter(value, true);
|
|
42
|
+
};
|
|
43
|
+
const validateRow = (model, row, result = false) => {
|
|
44
|
+
try {
|
|
45
|
+
require_databasePluginCrudValidationRows.validateCreateData(model, row);
|
|
46
|
+
if (!require_databasePluginCrudValidationFields.isRecord(row) || typeof row.id !== "string" || !(0, _hot_updater_core.isUUIDv7)(row.id) || [...Object.values(row), ...require_databasePluginCrudValidationFields.isRecord(row.metadata) ? Object.values(row.metadata) : []].some((value) => typeof value === "string" && !isWellFormedText(value))) throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-data");
|
|
47
|
+
} catch (error) {
|
|
48
|
+
if (result) throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-result");
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
/** Downloads and applied transitions belong in installation history. */
|
|
53
|
+
const isInsightsMovementEvent = (event) => event.type === "UPDATE_DOWNLOADED" || event.type === "UPDATE_APPLIED" || event.type === "RECOVERED";
|
|
54
|
+
const matchesInsightsEventFilter = (event, filter) => {
|
|
55
|
+
if (filter.kind === "all") return true;
|
|
56
|
+
if (filter.kind === "installationMovement") return event.install_id === filter.installId && isInsightsMovementEvent(event);
|
|
57
|
+
return event.type === filter.type && event.platform === filter.platform && event.channel === filter.channel && (filter.type === "RECOVERED" ? event.from_bundle_id === filter.fromBundleId : event.to_bundle_id === filter.toBundleId);
|
|
58
|
+
};
|
|
59
|
+
const invalidQuery = () => {
|
|
60
|
+
throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-query");
|
|
61
|
+
};
|
|
62
|
+
const invalidResult = () => {
|
|
63
|
+
throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-result");
|
|
64
|
+
};
|
|
65
|
+
const validateCount = (count) => isTimestamp(count) ? count : invalidResult();
|
|
66
|
+
/** Validate custom and bundled providers at the same public boundary. */
|
|
67
|
+
const createValidatedInsightsModel = (model) => ({
|
|
68
|
+
async recordEvent(input) {
|
|
69
|
+
if (!require_databasePluginCrudValidationFields.isRecord(input) || !hasOnlyKeys(input, ["event"])) throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-data");
|
|
70
|
+
validateRow("bundle_events", input.event);
|
|
71
|
+
await model.recordEvent(input);
|
|
72
|
+
},
|
|
73
|
+
async listEvents(input) {
|
|
74
|
+
if (!require_databasePluginCrudValidationFields.isRecord(input) || !hasOnlyKeys(input, [
|
|
75
|
+
"filter",
|
|
76
|
+
"sinceMs",
|
|
77
|
+
"beforeReceivedAtMs",
|
|
78
|
+
"after",
|
|
79
|
+
"limit"
|
|
80
|
+
]) || !isEventFilter(input.filter) || !isLimit(input.limit) || !isTimestamp(input.beforeReceivedAtMs) || input.sinceMs !== void 0 && !isTimestamp(input.sinceMs)) invalidQuery();
|
|
81
|
+
const sinceMs = input.sinceMs ?? 0;
|
|
82
|
+
if (sinceMs > input.beforeReceivedAtMs || input.after !== void 0 && (!require_databasePluginCrudValidationFields.isRecord(input.after) || !hasOnlyKeys(input.after, ["receivedAtMs", "id"]) || !isTimestamp(input.after.receivedAtMs) || typeof input.after.id !== "string" || !(0, _hot_updater_core.isUUIDv7)(input.after.id) || input.after.receivedAtMs < sinceMs || input.after.receivedAtMs >= input.beforeReceivedAtMs)) invalidQuery();
|
|
83
|
+
const rows = await model.listEvents(input);
|
|
84
|
+
if (!Array.isArray(rows) || rows.length > input.limit) invalidResult();
|
|
85
|
+
let previous = input.after;
|
|
86
|
+
for (const row of rows) {
|
|
87
|
+
validateRow("bundle_events", row, true);
|
|
88
|
+
if (row.received_at_ms < sinceMs || row.received_at_ms >= input.beforeReceivedAtMs || !matchesInsightsEventFilter(row, input.filter) || previous !== void 0 && (row.received_at_ms > previous.receivedAtMs || row.received_at_ms === previous.receivedAtMs && row.id >= previous.id)) invalidResult();
|
|
89
|
+
previous = {
|
|
90
|
+
receivedAtMs: row.received_at_ms,
|
|
91
|
+
id: row.id
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return rows;
|
|
95
|
+
},
|
|
96
|
+
async findLatestEvents(input) {
|
|
97
|
+
if (!require_databasePluginCrudValidationFields.isRecord(input)) invalidQuery();
|
|
98
|
+
if ("installId" in input) {
|
|
99
|
+
if (!hasOnlyKeys(input, ["installId"]) || !isIdentity(input.installId)) invalidQuery();
|
|
100
|
+
} else if (!hasOnlyKeys(input, [
|
|
101
|
+
"userId",
|
|
102
|
+
"afterInstallId",
|
|
103
|
+
"limit"
|
|
104
|
+
]) || !isIdentity(input.userId) || !isLimit(input.limit) || input.afterInstallId !== void 0 && !isIdentity(input.afterInstallId)) invalidQuery();
|
|
105
|
+
const rows = await model.findLatestEvents(input);
|
|
106
|
+
if (!Array.isArray(rows) || rows.length > ("installId" in input ? 1 : input.limit)) invalidResult();
|
|
107
|
+
let previous = "installId" in input ? void 0 : input.afterInstallId;
|
|
108
|
+
for (const row of rows) {
|
|
109
|
+
validateRow("bundle_events", row, true);
|
|
110
|
+
if ("installId" in input ? row.install_id !== input.installId : row.user_id !== input.userId || previous !== void 0 && compareInsightsText(row.install_id, previous) <= 0) invalidResult();
|
|
111
|
+
previous = row.install_id;
|
|
112
|
+
}
|
|
113
|
+
return rows;
|
|
114
|
+
},
|
|
115
|
+
async countLatestEvents(input) {
|
|
116
|
+
if (!require_databasePluginCrudValidationFields.isRecord(input) || !hasOnlyKeys(input, [
|
|
117
|
+
"platform",
|
|
118
|
+
"channel",
|
|
119
|
+
"sinceMs",
|
|
120
|
+
"bundle"
|
|
121
|
+
]) || !hasScope(input) || !isTimestamp(input.sinceMs) || input.bundle !== void 0 && (!Array.isArray(input.bundle) || input.bundle.length < 1 || input.bundle.length > 2 || input.bundle.some((bundle) => !require_databasePluginCrudValidationFields.isRecord(bundle) || !hasOnlyKeys(bundle, [
|
|
122
|
+
"field",
|
|
123
|
+
"value",
|
|
124
|
+
"types"
|
|
125
|
+
]) || bundle.field !== "from_bundle_id" && bundle.field !== "to_bundle_id" || !isText(bundle.value) || !Array.isArray(bundle.types) || bundle.types.length === 0 || bundle.types.some((type) => ![
|
|
126
|
+
"UNCHANGED",
|
|
127
|
+
"UPDATE_DOWNLOADED",
|
|
128
|
+
"UPDATE_APPLIED",
|
|
129
|
+
"RECOVERED"
|
|
130
|
+
].includes(type))))) invalidQuery();
|
|
131
|
+
return validateCount(await model.countLatestEvents(input));
|
|
132
|
+
},
|
|
133
|
+
async countEvents(input) {
|
|
134
|
+
if (!require_databasePluginCrudValidationFields.isRecord(input) || !hasOnlyKeys(input, [
|
|
135
|
+
"filter",
|
|
136
|
+
"sinceMs",
|
|
137
|
+
"beforeReceivedAtMs"
|
|
138
|
+
]) || !isBundleFilter(input.filter) || !isTimestamp(input.sinceMs) || !isTimestamp(input.beforeReceivedAtMs) || input.sinceMs > input.beforeReceivedAtMs) invalidQuery();
|
|
139
|
+
return validateCount(await model.countEvents(input));
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
//#endregion
|
|
143
|
+
exports.compareInsightsText = compareInsightsText;
|
|
144
|
+
exports.createValidatedInsightsModel = createValidatedInsightsModel;
|
|
145
|
+
exports.isInsightsMovementEvent = isInsightsMovementEvent;
|
|
146
|
+
exports.matchesInsightsEventFilter = matchesInsightsEventFilter;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BundleEventRow } from "./types/databaseRows.cjs";
|
|
2
|
+
import "./types/index.cjs";
|
|
3
|
+
//#region src/insightsContract.d.ts
|
|
4
|
+
/** Exact UTF-8 byte ordering, without case folding or Unicode normalization. */
|
|
5
|
+
declare const compareInsightsText: (left: string, right: string) => number;
|
|
6
|
+
/** Downloads and applied transitions belong in installation history. */
|
|
7
|
+
declare const isInsightsMovementEvent: (event: Pick<BundleEventRow, "type">) => boolean;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { compareInsightsText, isInsightsMovementEvent };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BundleEventRow } from "./types/databaseRows.mjs";
|
|
2
|
+
import "./types/index.mjs";
|
|
3
|
+
//#region src/insightsContract.d.ts
|
|
4
|
+
/** Exact UTF-8 byte ordering, without case folding or Unicode normalization. */
|
|
5
|
+
declare const compareInsightsText: (left: string, right: string) => number;
|
|
6
|
+
/** Downloads and applied transitions belong in installation history. */
|
|
7
|
+
declare const isInsightsMovementEvent: (event: Pick<BundleEventRow, "type">) => boolean;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { compareInsightsText, isInsightsMovementEvent };
|