@hot-updater/plugin-core 1.0.0-rc.14 → 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 (57) hide show
  1. package/dist/bundleStorageLayout.cjs +7 -0
  2. package/dist/bundleStorageLayout.d.cts +5 -1
  3. package/dist/bundleStorageLayout.d.mts +5 -1
  4. package/dist/bundleStorageLayout.mjs +7 -1
  5. package/dist/contentType.cjs +9 -0
  6. package/dist/contentType.d.cts +4 -0
  7. package/dist/contentType.d.mts +4 -0
  8. package/dist/contentType.mjs +7 -0
  9. package/dist/createDatabasePlugin.cjs +3 -1
  10. package/dist/createDatabasePlugin.mjs +3 -1
  11. package/dist/databaseClientUpdates.cjs +0 -3
  12. package/dist/databaseClientUpdates.mjs +0 -3
  13. package/dist/databasePluginCrudValidationFields.cjs +3 -12
  14. package/dist/databasePluginCrudValidationFields.mjs +3 -12
  15. package/dist/databaseRows.cjs +0 -6
  16. package/dist/databaseRows.mjs +0 -6
  17. package/dist/index.cjs +4 -5
  18. package/dist/index.d.cts +4 -4
  19. package/dist/index.d.mts +4 -4
  20. package/dist/index.mjs +3 -3
  21. package/dist/insightsContract.cjs +46 -0
  22. package/dist/insightsContract.mjs +46 -0
  23. package/dist/insightsDistinctSummary.cjs +72 -0
  24. package/dist/insightsDistinctSummary.d.cts +12 -0
  25. package/dist/insightsDistinctSummary.d.mts +12 -0
  26. package/dist/insightsDistinctSummary.mjs +68 -0
  27. package/dist/insightsOverview.cjs +139 -0
  28. package/dist/insightsOverview.d.cts +40 -0
  29. package/dist/insightsOverview.d.mts +40 -0
  30. package/dist/insightsOverview.mjs +135 -0
  31. package/dist/internal.cjs +12 -0
  32. package/dist/internal.d.cts +4 -2
  33. package/dist/internal.d.mts +4 -2
  34. package/dist/internal.mjs +3 -1
  35. package/dist/types/database.d.cts +2 -2
  36. package/dist/types/database.d.mts +2 -2
  37. package/dist/types/databaseFields.cjs +0 -3
  38. package/dist/types/databaseFields.d.cts +1 -1
  39. package/dist/types/databaseFields.d.mts +1 -1
  40. package/dist/types/databaseFields.mjs +0 -3
  41. package/dist/types/databaseOperations.d.cts +2 -0
  42. package/dist/types/databaseOperations.d.mts +2 -0
  43. package/dist/types/databasePlugin.d.cts +85 -1
  44. package/dist/types/databasePlugin.d.mts +85 -1
  45. package/dist/types/databaseRows.d.cts +3 -6
  46. package/dist/types/databaseRows.d.mts +3 -6
  47. package/dist/types/index.d.cts +3 -15
  48. package/dist/types/index.d.mts +3 -15
  49. package/dist/types/internal.d.cts +2 -2
  50. package/dist/types/internal.d.mts +2 -2
  51. package/dist/types/public.d.cts +2 -2
  52. package/dist/types/public.d.mts +2 -2
  53. package/package.json +2 -2
  54. package/dist/compressionFormat.cjs +0 -62
  55. package/dist/compressionFormat.d.cts +0 -33
  56. package/dist/compressionFormat.d.mts +0 -33
  57. package/dist/compressionFormat.mjs +0 -58
@@ -1,3 +1,4 @@
1
+ const require_assetStorageLayout = require("./assetStorageLayout.cjs");
1
2
  //#region src/bundleStorageLayout.ts
2
3
  const BUNDLE_STORAGE_PREFIX = "bundles";
3
4
  const createBundleStorageKey = (bundleId, ...relativePaths) => [
@@ -5,6 +6,11 @@ const createBundleStorageKey = (bundleId, ...relativePaths) => [
5
6
  bundleId,
6
7
  ...relativePaths
7
8
  ].filter(Boolean).join("/");
9
+ const getBundleArchiveStorageUri = ({ manifestStorageUri, bundleId }) => require_assetStorageLayout.replaceStorageUriKeySuffix({
10
+ storageUri: manifestStorageUri,
11
+ keySuffix: createBundleStorageKey(bundleId, "manifest.json"),
12
+ replacement: createBundleStorageKey(bundleId, "bundle.tar.br")
13
+ });
8
14
  const createStorageRootUriWithPath = (storageUri, bundleId, relativePath) => {
9
15
  const storageUrl = new URL(storageUri);
10
16
  const segments = storageUrl.pathname.split("/").filter(Boolean);
@@ -19,3 +25,4 @@ const createStorageRootUriWithPath = (storageUri, bundleId, relativePath) => {
19
25
  exports.BUNDLE_STORAGE_PREFIX = BUNDLE_STORAGE_PREFIX;
20
26
  exports.createBundleStorageKey = createBundleStorageKey;
21
27
  exports.createStorageRootUriWithPath = createStorageRootUriWithPath;
28
+ exports.getBundleArchiveStorageUri = getBundleArchiveStorageUri;
@@ -1,6 +1,10 @@
1
1
  //#region src/bundleStorageLayout.d.ts
2
2
  declare const BUNDLE_STORAGE_PREFIX = "bundles";
3
3
  declare const createBundleStorageKey: (bundleId: string, ...relativePaths: string[]) => string;
4
+ declare const getBundleArchiveStorageUri: ({ manifestStorageUri, bundleId }: {
5
+ manifestStorageUri: string;
6
+ bundleId: string;
7
+ }) => string;
4
8
  declare const createStorageRootUriWithPath: (storageUri: string, bundleId: string, relativePath: string) => string;
5
9
  //#endregion
6
- export { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath };
10
+ export { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath, getBundleArchiveStorageUri };
@@ -1,6 +1,10 @@
1
1
  //#region src/bundleStorageLayout.d.ts
2
2
  declare const BUNDLE_STORAGE_PREFIX = "bundles";
3
3
  declare const createBundleStorageKey: (bundleId: string, ...relativePaths: string[]) => string;
4
+ declare const getBundleArchiveStorageUri: ({ manifestStorageUri, bundleId }: {
5
+ manifestStorageUri: string;
6
+ bundleId: string;
7
+ }) => string;
4
8
  declare const createStorageRootUriWithPath: (storageUri: string, bundleId: string, relativePath: string) => string;
5
9
  //#endregion
6
- export { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath };
10
+ export { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath, getBundleArchiveStorageUri };
@@ -1,3 +1,4 @@
1
+ import { replaceStorageUriKeySuffix } from "./assetStorageLayout.mjs";
1
2
  //#region src/bundleStorageLayout.ts
2
3
  const BUNDLE_STORAGE_PREFIX = "bundles";
3
4
  const createBundleStorageKey = (bundleId, ...relativePaths) => [
@@ -5,6 +6,11 @@ const createBundleStorageKey = (bundleId, ...relativePaths) => [
5
6
  bundleId,
6
7
  ...relativePaths
7
8
  ].filter(Boolean).join("/");
9
+ const getBundleArchiveStorageUri = ({ manifestStorageUri, bundleId }) => replaceStorageUriKeySuffix({
10
+ storageUri: manifestStorageUri,
11
+ keySuffix: createBundleStorageKey(bundleId, "manifest.json"),
12
+ replacement: createBundleStorageKey(bundleId, "bundle.tar.br")
13
+ });
8
14
  const createStorageRootUriWithPath = (storageUri, bundleId, relativePath) => {
9
15
  const storageUrl = new URL(storageUri);
10
16
  const segments = storageUrl.pathname.split("/").filter(Boolean);
@@ -16,4 +22,4 @@ const createStorageRootUriWithPath = (storageUri, bundleId, relativePath) => {
16
22
  return storageUrl.toString();
17
23
  };
18
24
  //#endregion
19
- export { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath };
25
+ export { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath, getBundleArchiveStorageUri };
@@ -0,0 +1,9 @@
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
+ let mime = require("mime");
3
+ mime = require_runtime.__toESM(mime, 1);
4
+ //#region src/contentType.ts
5
+ function getContentType(filePath) {
6
+ return mime.default.getType(filePath) ?? "application/octet-stream";
7
+ }
8
+ //#endregion
9
+ exports.getContentType = getContentType;
@@ -0,0 +1,4 @@
1
+ //#region src/contentType.d.ts
2
+ declare function getContentType(filePath: string): string;
3
+ //#endregion
4
+ export { getContentType };
@@ -0,0 +1,4 @@
1
+ //#region src/contentType.d.ts
2
+ declare function getContentType(filePath: string): string;
3
+ //#endregion
4
+ export { getContentType };
@@ -0,0 +1,7 @@
1
+ import mime from "mime";
2
+ //#region src/contentType.ts
3
+ function getContentType(filePath) {
4
+ return mime.getType(filePath) ?? "application/octet-stream";
5
+ }
6
+ //#endregion
7
+ export { getContentType };
@@ -815,7 +815,9 @@ const createDatabasePluginAdapter = (name, implementation) => {
815
815
  }
816
816
  ]
817
817
  });
818
- }
818
+ },
819
+ getReleaseActivity: (input) => implementation.getReleaseActivity(input),
820
+ getAppUsage: (input) => implementation.getAppUsage(input)
819
821
  },
820
822
  apiKeys: {
821
823
  async create(row) {
@@ -815,7 +815,9 @@ const createDatabasePluginAdapter = (name, implementation) => {
815
815
  }
816
816
  ]
817
817
  });
818
- }
818
+ },
819
+ getReleaseActivity: (input) => implementation.getReleaseActivity(input),
820
+ getAppUsage: (input) => implementation.getAppUsage(input)
819
821
  },
820
822
  apiKeys: {
821
823
  async create(row) {
@@ -14,10 +14,7 @@ var DatabasePatchUpdateUnsupportedError = class extends Error {
14
14
  const bundleUpdateToRow = (update, _channelId) => {
15
15
  return {
16
16
  ...update.platform !== void 0 ? { platform: update.platform } : {},
17
- ...update.fileHash !== void 0 ? { file_hash: update.fileHash } : {},
18
17
  ...update.gitCommitHash !== void 0 ? { git_commit_hash: update.gitCommitHash } : {},
19
- ...update.storageUri !== void 0 ? { storage_uri: update.storageUri } : {},
20
- ...update.archiveByteSize !== void 0 ? { archive_byte_size: update.archiveByteSize } : {},
21
18
  ...update.metadata !== void 0 ? { metadata: require_databaseMetadata.bundleMetadataToRow(update.metadata) } : {},
22
19
  ...update.manifestStorageUri !== void 0 ? { manifest_storage_uri: update.manifestStorageUri } : {},
23
20
  ...update.manifestFileHash !== void 0 ? { manifest_file_hash: update.manifestFileHash } : {},
@@ -14,10 +14,7 @@ var DatabasePatchUpdateUnsupportedError = class extends Error {
14
14
  const bundleUpdateToRow = (update, _channelId) => {
15
15
  return {
16
16
  ...update.platform !== void 0 ? { platform: update.platform } : {},
17
- ...update.fileHash !== void 0 ? { file_hash: update.fileHash } : {},
18
17
  ...update.gitCommitHash !== void 0 ? { git_commit_hash: update.gitCommitHash } : {},
19
- ...update.storageUri !== void 0 ? { storage_uri: update.storageUri } : {},
20
- ...update.archiveByteSize !== void 0 ? { archive_byte_size: update.archiveByteSize } : {},
21
18
  ...update.metadata !== void 0 ? { metadata: bundleMetadataToRow(update.metadata) } : {},
22
19
  ...update.manifestStorageUri !== void 0 ? { manifest_storage_uri: update.manifestStorageUri } : {},
23
20
  ...update.manifestFileHash !== void 0 ? { manifest_file_hash: update.manifestFileHash } : {},
@@ -21,21 +21,18 @@ const modelValidators = {
21
21
  platform: (value) => value === "ios" || value === "android",
22
22
  should_force_update: (value) => typeof value === "boolean",
23
23
  enabled: (value) => typeof value === "boolean",
24
- file_hash: (value) => typeof value === "string",
25
24
  git_commit_hash: (value) => value === null || typeof value === "string",
26
25
  message: (value) => value === null || typeof value === "string",
27
26
  channel: isChannelText,
28
27
  channel_id: isChannelText,
29
- storage_uri: (value) => typeof value === "string",
30
- archive_byte_size: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0,
31
28
  target_app_version: (value) => value === null || typeof value === "string",
32
29
  fingerprint_hash: (value) => value === null || typeof value === "string",
33
30
  metadata: require_databaseJsonValue.isDatabaseMetadataObject,
34
31
  rollout_cohort_count: (value) => typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 1e3,
35
32
  target_cohorts: (value) => value === null || Array.isArray(value) && value.every((item) => typeof item === "string"),
36
- manifest_storage_uri: (value) => value === null || typeof value === "string",
37
- manifest_file_hash: (value) => value === null || typeof value === "string",
38
- 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"
39
36
  },
40
37
  bundle_patches: {
41
38
  id: (value) => typeof value === "string",
@@ -115,12 +112,10 @@ const modelValidators = {
115
112
  const stringFields = /* @__PURE__ */ new Set([
116
113
  "id",
117
114
  "platform",
118
- "file_hash",
119
115
  "git_commit_hash",
120
116
  "message",
121
117
  "channel",
122
118
  "channel_id",
123
- "storage_uri",
124
119
  "target_app_version",
125
120
  "fingerprint_hash",
126
121
  "bundle_id",
@@ -154,7 +149,6 @@ const stringFields = /* @__PURE__ */ new Set([
154
149
  "role"
155
150
  ]);
156
151
  const numberFields = /* @__PURE__ */ new Set([
157
- "archive_byte_size",
158
152
  "byte_size",
159
153
  "rollout_cohort_count",
160
154
  "order_index",
@@ -175,13 +169,10 @@ const sortableFields = {
175
169
  bundles: /* @__PURE__ */ new Set([
176
170
  "id",
177
171
  "platform",
178
- "file_hash",
179
172
  "git_commit_hash",
180
173
  "message",
181
174
  "channel",
182
175
  "channel_id",
183
- "storage_uri",
184
- "archive_byte_size",
185
176
  "target_app_version",
186
177
  "fingerprint_hash",
187
178
  "rollout_cohort_count",
@@ -21,21 +21,18 @@ const modelValidators = {
21
21
  platform: (value) => value === "ios" || value === "android",
22
22
  should_force_update: (value) => typeof value === "boolean",
23
23
  enabled: (value) => typeof value === "boolean",
24
- file_hash: (value) => typeof value === "string",
25
24
  git_commit_hash: (value) => value === null || typeof value === "string",
26
25
  message: (value) => value === null || typeof value === "string",
27
26
  channel: isChannelText,
28
27
  channel_id: isChannelText,
29
- storage_uri: (value) => typeof value === "string",
30
- archive_byte_size: (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0,
31
28
  target_app_version: (value) => value === null || typeof value === "string",
32
29
  fingerprint_hash: (value) => value === null || typeof value === "string",
33
30
  metadata: isDatabaseMetadataObject,
34
31
  rollout_cohort_count: (value) => typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 1e3,
35
32
  target_cohorts: (value) => value === null || Array.isArray(value) && value.every((item) => typeof item === "string"),
36
- manifest_storage_uri: (value) => value === null || typeof value === "string",
37
- manifest_file_hash: (value) => value === null || typeof value === "string",
38
- 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"
39
36
  },
40
37
  bundle_patches: {
41
38
  id: (value) => typeof value === "string",
@@ -115,12 +112,10 @@ const modelValidators = {
115
112
  const stringFields = /* @__PURE__ */ new Set([
116
113
  "id",
117
114
  "platform",
118
- "file_hash",
119
115
  "git_commit_hash",
120
116
  "message",
121
117
  "channel",
122
118
  "channel_id",
123
- "storage_uri",
124
119
  "target_app_version",
125
120
  "fingerprint_hash",
126
121
  "bundle_id",
@@ -154,7 +149,6 @@ const stringFields = /* @__PURE__ */ new Set([
154
149
  "role"
155
150
  ]);
156
151
  const numberFields = /* @__PURE__ */ new Set([
157
- "archive_byte_size",
158
152
  "byte_size",
159
153
  "rollout_cohort_count",
160
154
  "order_index",
@@ -175,13 +169,10 @@ const sortableFields = {
175
169
  bundles: /* @__PURE__ */ new Set([
176
170
  "id",
177
171
  "platform",
178
- "file_hash",
179
172
  "git_commit_hash",
180
173
  "message",
181
174
  "channel",
182
175
  "channel_id",
183
- "storage_uri",
184
- "archive_byte_size",
185
176
  "target_app_version",
186
177
  "fingerprint_hash",
187
178
  "rollout_cohort_count",
@@ -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: (0, _hot_updater_core.getManifestStorageUri)(bundle),
73
70
  manifest_file_hash: (0, _hot_updater_core.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: (0, _hot_updater_core.stripBundleArtifactMetadata)(row.metadata),
105
99
  manifestStorageUri: row.manifest_storage_uri,
106
100
  manifestFileHash: row.manifest_file_hash,
@@ -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,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_calculatePagination = require("./calculatePagination.cjs");
3
- const require_bundleStorageLayout = require("./bundleStorageLayout.cjs");
4
- const require_compressionFormat = require("./compressionFormat.cjs");
5
3
  const require_contentAddressedAssets = require("./contentAddressedAssets.cjs");
6
4
  const require_createStorageKeyBuilder = require("./createStorageKeyBuilder.cjs");
7
5
  const require_parseStorageUri = require("./parseStorageUri.cjs");
8
6
  const require_assetStorageLayout = require("./assetStorageLayout.cjs");
7
+ const require_bundleStorageLayout = require("./bundleStorageLayout.cjs");
8
+ const require_contentType = require("./contentType.cjs");
9
9
  const require_databasePluginCrudValidationErrors = require("./databasePluginCrudValidationErrors.cjs");
10
10
  const require_databaseJsonValue = require("./databaseJsonValue.cjs");
11
11
  const require_uuidv7 = require("./uuidv7.cjs");
@@ -71,13 +71,12 @@ exports.createUUIDv7 = require_uuidv7.createUUIDv7;
71
71
  exports.createUUIDv7After = require_uuidv7.createUUIDv7After;
72
72
  exports.createUUIDv7WithSameTimestamp = require_uuidv7.createUUIDv7WithSameTimestamp;
73
73
  exports.deleteRelease = require_releaseManagement.deleteRelease;
74
- exports.detectCompressionFormat = require_compressionFormat.detectCompressionFormat;
75
74
  exports.extractTimestampFromUUIDv7 = require_uuidv7.extractTimestampFromUUIDv7;
76
75
  exports.filterCompatibleAppVersions = require_filterCompatibleAppVersions.filterCompatibleAppVersions;
77
76
  exports.generateMinBundleId = require_generateMinBundleId.generateMinBundleId;
78
- exports.getCompressionMimeType = require_compressionFormat.getCompressionMimeType;
77
+ exports.getBundleArchiveStorageUri = require_bundleStorageLayout.getBundleArchiveStorageUri;
79
78
  exports.getContentAddressedAssetStoragePath = require_contentAddressedAssets.getContentAddressedAssetStoragePath;
80
- exports.getContentType = require_compressionFormat.getContentType;
79
+ exports.getContentType = require_contentType.getContentType;
81
80
  exports.getManifestAssetDownloadPath = require_assetStorageLayout.getManifestAssetDownloadPath;
82
81
  exports.getManifestAssetStoragePath = require_assetStorageLayout.getManifestAssetStoragePath;
83
82
  exports.isBrotliManifestAssetPath = require_assetStorageLayout.isBrotliManifestAssetPath;
package/dist/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
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";
2
+ import { ApiKeyModel, BundleModel, BundleModelQuery, BundlePatchModel, BundleRepository, BundleRepositoryChange, BundleRepositoryCommit, ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelModel, DatabaseChange, DatabaseCommit, DatabaseCommitExpectation, DatabaseCommitResult, DatabaseModels, DatabasePlugin, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseCatalogModel, ReleaseModel, ReleaseReference } 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";
6
6
  import { PaginationOptions, calculatePagination } from "./calculatePagination.cjs";
7
- import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath } from "./bundleStorageLayout.cjs";
8
- import { CompressionFormat, CompressionFormatInfo, detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.cjs";
7
+ import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath, getBundleArchiveStorageUri } from "./bundleStorageLayout.cjs";
9
8
  import { createStorageUriWithRelativePath, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri } from "./assetStorageLayout.cjs";
10
9
  import { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath, isContentAddressedAssetFileHash } from "./contentAddressedAssets.cjs";
10
+ import { getContentType } from "./contentType.cjs";
11
11
  import { DatabasePluginInputError, DatabasePluginInputErrorCode } from "./databasePluginCrudValidationErrors.cjs";
12
12
  import { CreateDatabasePluginOptions, DatabaseAtomicCommitUnsupportedError, createDatabasePlugin } from "./createDatabasePlugin.cjs";
13
13
  import { createStorageKeyBuilder } from "./createStorageKeyBuilder.cjs";
@@ -30,4 +30,4 @@ import { BundleSigningHandlerOptions, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BU
30
30
  import { semverSatisfies } from "./semverSatisfies.cjs";
31
31
  import { createStorageDownloadPath, createStorageDownloadUrl, parseStorageDownloadPath } from "./storageDownloadPath.cjs";
32
32
  import { createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, isUUIDv7 } from "./uuidv7.cjs";
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 };
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, 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 InsightsCoverage, type InsightsEventCursor, type InsightsEventFilter, type InsightsFindLatestEventsInput, type InsightsGetAppUsageInput, type InsightsGetAppUsageResult, type InsightsGetReleaseActivityInput, type InsightsGetReleaseActivityResult, type InsightsListEventsInput, type InsightsModel, type InsightsRecordEventInput, type InsightsScope, type InsightsTimeRange, 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, type ReleaseActivityMetrics, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, type ReleaseCatalogModel, ReleaseCatalogMutation, ReleaseCatalogMutationError, ReleaseCatalogMutationInput, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, ReleaseManagementError, type ReleaseModel, ReleaseMutationTarget, ReleasePolicyPatch, type ReleaseReference, 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, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getBundleArchiveStorageUri, 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,13 +1,13 @@
1
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";
2
+ import { ApiKeyModel, BundleModel, BundleModelQuery, BundlePatchModel, BundleRepository, BundleRepositoryChange, BundleRepositoryCommit, ChannelDeleteInput, ChannelDeleteResult, ChannelInsertInput, ChannelInsertResult, ChannelModel, DatabaseChange, DatabaseCommit, DatabaseCommitExpectation, DatabaseCommitResult, DatabaseModels, DatabasePlugin, InsightsBundleEventFilter, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseCatalogModel, ReleaseModel, ReleaseReference } 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";
6
6
  import { PaginationOptions, calculatePagination } from "./calculatePagination.mjs";
7
- import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath } from "./bundleStorageLayout.mjs";
8
- import { CompressionFormat, CompressionFormatInfo, detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.mjs";
7
+ import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath, getBundleArchiveStorageUri } from "./bundleStorageLayout.mjs";
9
8
  import { createStorageUriWithRelativePath, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri } from "./assetStorageLayout.mjs";
10
9
  import { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath, isContentAddressedAssetFileHash } from "./contentAddressedAssets.mjs";
10
+ import { getContentType } from "./contentType.mjs";
11
11
  import { DatabasePluginInputError, DatabasePluginInputErrorCode } from "./databasePluginCrudValidationErrors.mjs";
12
12
  import { CreateDatabasePluginOptions, DatabaseAtomicCommitUnsupportedError, createDatabasePlugin } from "./createDatabasePlugin.mjs";
13
13
  import { createStorageKeyBuilder } from "./createStorageKeyBuilder.mjs";
@@ -30,4 +30,4 @@ import { BundleSigningHandlerOptions, REMOTE_BUNDLE_SIGNING_ALGORITHM, REMOTE_BU
30
30
  import { semverSatisfies } from "./semverSatisfies.mjs";
31
31
  import { createStorageDownloadPath, createStorageDownloadUrl, parseStorageDownloadPath } from "./storageDownloadPath.mjs";
32
32
  import { createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, isUUIDv7 } from "./uuidv7.mjs";
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 };
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, 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 InsightsCoverage, type InsightsEventCursor, type InsightsEventFilter, type InsightsFindLatestEventsInput, type InsightsGetAppUsageInput, type InsightsGetAppUsageResult, type InsightsGetReleaseActivityInput, type InsightsGetReleaseActivityResult, type InsightsListEventsInput, type InsightsModel, type InsightsRecordEventInput, type InsightsScope, type InsightsTimeRange, 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, type ReleaseActivityMetrics, ReleaseCatalogCompilation, ReleaseCatalogCompilationError, ReleaseCatalogCompilerDiagnostics, type ReleaseCatalogModel, ReleaseCatalogMutation, ReleaseCatalogMutationError, ReleaseCatalogMutationInput, ReleaseCatalogMutationPreflight, ReleaseCatalogMutationResult, ReleaseCatalogRebuildPreflight, ReleaseCatalogRebuildResult, type ReleaseCatalogRow, type ReleaseCatalogRowUpdate, ReleaseCatalogScope, ReleaseManagementError, type ReleaseModel, ReleaseMutationTarget, ReleasePolicyPatch, type ReleaseReference, 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, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getBundleArchiveStorageUri, 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
@@ -1,10 +1,10 @@
1
1
  import { calculatePagination } from "./calculatePagination.mjs";
2
- import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath } from "./bundleStorageLayout.mjs";
3
- import { detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.mjs";
4
2
  import { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath, isContentAddressedAssetFileHash } from "./contentAddressedAssets.mjs";
5
3
  import { createStorageKeyBuilder } from "./createStorageKeyBuilder.mjs";
6
4
  import { createStorageUri, parseStorageUri } from "./parseStorageUri.mjs";
7
5
  import { createStorageUriWithRelativePath, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, replaceStorageUriKeySuffix, resolveManifestAssetStorageFileHash, resolveManifestAssetStorageUri } from "./assetStorageLayout.mjs";
6
+ import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath, getBundleArchiveStorageUri } from "./bundleStorageLayout.mjs";
7
+ import { getContentType } from "./contentType.mjs";
8
8
  import { DatabasePluginInputError } from "./databasePluginCrudValidationErrors.mjs";
9
9
  import { isDatabaseBundleEventMetadata, isDatabaseMetadataObject } from "./databaseJsonValue.mjs";
10
10
  import { createUUIDv7, createUUIDv7After, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7, isUUIDv7 } from "./uuidv7.mjs";
@@ -26,4 +26,4 @@ import { ReleaseManagementError, deleteRelease, preflightReleasePolicy, promoteR
26
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";
27
27
  import { createStorageDownloadPath, createStorageDownloadUrl, parseStorageDownloadPath } from "./storageDownloadPath.mjs";
28
28
  import { supportedIosPlatforms } from "./types/index.mjs";
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 };
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, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getBundleArchiveStorageUri, 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 };
@@ -63,6 +63,18 @@ const invalidResult = () => {
63
63
  throw new require_databasePluginCrudValidationErrors.DatabasePluginInputError("invalid-result");
64
64
  };
65
65
  const validateCount = (count) => isTimestamp(count) ? count : invalidResult();
66
+ const isTimeRange = (value) => require_databasePluginCrudValidationFields.isRecord(value) && hasOnlyKeys(value, ["start", "end"]) && isTimestamp(value.start) && isTimestamp(value.end) && value.start < value.end;
67
+ const isReleaseReference = (value) => require_databasePluginCrudValidationFields.isRecord(value) && hasOnlyKeys(value, [
68
+ "releaseId",
69
+ "platform",
70
+ "channel"
71
+ ]) && isIdentity(value.releaseId) && hasScope(value);
72
+ const validateAggregateResult = (value) => {
73
+ const result = require_databasePluginCrudValidationFields.isRecord(value) ? value : invalidResult();
74
+ if (!isTimestamp(result.measuredAtMs)) invalidResult();
75
+ const coverage = result.coverage;
76
+ if (!require_databasePluginCrudValidationFields.isRecord(coverage) || coverage.kind !== "complete" && coverage.kind !== "partial" || coverage.sinceMs !== null && !isTimestamp(coverage.sinceMs)) invalidResult();
77
+ };
66
78
  /** Validate custom and bundled providers at the same public boundary. */
67
79
  const createValidatedInsightsModel = (model) => ({
68
80
  async recordEvent(input) {
@@ -137,6 +149,40 @@ const createValidatedInsightsModel = (model) => ({
137
149
  "beforeReceivedAtMs"
138
150
  ]) || !isBundleFilter(input.filter) || !isTimestamp(input.sinceMs) || !isTimestamp(input.beforeReceivedAtMs) || input.sinceMs > input.beforeReceivedAtMs) invalidQuery();
139
151
  return validateCount(await model.countEvents(input));
152
+ },
153
+ async getReleaseActivity(input) {
154
+ if (!require_databasePluginCrudValidationFields.isRecord(input) || !hasOnlyKeys(input, [
155
+ "releases",
156
+ "scope",
157
+ "timeRange"
158
+ ])) invalidQuery();
159
+ const releases = input.releases;
160
+ const scope = input.scope;
161
+ const timeRange = input.timeRange;
162
+ const releaseQuery = Array.isArray(releases) && releases.length > 0 && releases.length <= 100 && releases.every(isReleaseReference) && scope === void 0 && (timeRange === void 0 || isTimeRange(timeRange));
163
+ const scopeQuery = releases === void 0 && require_databasePluginCrudValidationFields.isRecord(scope) && hasOnlyKeys(scope, ["platform", "channel"]) && hasScope(scope) && isTimeRange(timeRange);
164
+ if (!releaseQuery && !scopeQuery) invalidQuery();
165
+ const result = await model.getReleaseActivity(input);
166
+ validateAggregateResult(result);
167
+ if (!Array.isArray(result.data)) invalidResult();
168
+ return result;
169
+ },
170
+ async getAppUsage(input) {
171
+ if (!require_databasePluginCrudValidationFields.isRecord(input) || !hasOnlyKeys(input, [
172
+ "channel",
173
+ "platform",
174
+ "appVersion",
175
+ "timeRange",
176
+ "intervalMs"
177
+ ]) || !isText(input.channel) || ![
178
+ "all",
179
+ "ios",
180
+ "android"
181
+ ].includes(input.platform) || input.appVersion !== void 0 && !isText(input.appVersion) || !isTimeRange(input.timeRange) || !isTimestamp(input.intervalMs) || input.intervalMs < 36e5) invalidQuery();
182
+ const result = await model.getAppUsage(input);
183
+ validateAggregateResult(result);
184
+ if (!isTimestamp(result.activeInstallations) || !Array.isArray(result.points) || !Array.isArray(result.appVersions) || !Array.isArray(result.versions) || !Array.isArray(result.platforms) || !Array.isArray(result.bundleDistribution)) invalidResult();
185
+ return result;
140
186
  }
141
187
  });
142
188
  //#endregion
@@ -63,6 +63,18 @@ const invalidResult = () => {
63
63
  throw new DatabasePluginInputError("invalid-result");
64
64
  };
65
65
  const validateCount = (count) => isTimestamp(count) ? count : invalidResult();
66
+ const isTimeRange = (value) => isRecord(value) && hasOnlyKeys(value, ["start", "end"]) && isTimestamp(value.start) && isTimestamp(value.end) && value.start < value.end;
67
+ const isReleaseReference = (value) => isRecord(value) && hasOnlyKeys(value, [
68
+ "releaseId",
69
+ "platform",
70
+ "channel"
71
+ ]) && isIdentity(value.releaseId) && hasScope(value);
72
+ const validateAggregateResult = (value) => {
73
+ const result = isRecord(value) ? value : invalidResult();
74
+ if (!isTimestamp(result.measuredAtMs)) invalidResult();
75
+ const coverage = result.coverage;
76
+ if (!isRecord(coverage) || coverage.kind !== "complete" && coverage.kind !== "partial" || coverage.sinceMs !== null && !isTimestamp(coverage.sinceMs)) invalidResult();
77
+ };
66
78
  /** Validate custom and bundled providers at the same public boundary. */
67
79
  const createValidatedInsightsModel = (model) => ({
68
80
  async recordEvent(input) {
@@ -137,6 +149,40 @@ const createValidatedInsightsModel = (model) => ({
137
149
  "beforeReceivedAtMs"
138
150
  ]) || !isBundleFilter(input.filter) || !isTimestamp(input.sinceMs) || !isTimestamp(input.beforeReceivedAtMs) || input.sinceMs > input.beforeReceivedAtMs) invalidQuery();
139
151
  return validateCount(await model.countEvents(input));
152
+ },
153
+ async getReleaseActivity(input) {
154
+ if (!isRecord(input) || !hasOnlyKeys(input, [
155
+ "releases",
156
+ "scope",
157
+ "timeRange"
158
+ ])) invalidQuery();
159
+ const releases = input.releases;
160
+ const scope = input.scope;
161
+ const timeRange = input.timeRange;
162
+ const releaseQuery = Array.isArray(releases) && releases.length > 0 && releases.length <= 100 && releases.every(isReleaseReference) && scope === void 0 && (timeRange === void 0 || isTimeRange(timeRange));
163
+ const scopeQuery = releases === void 0 && isRecord(scope) && hasOnlyKeys(scope, ["platform", "channel"]) && hasScope(scope) && isTimeRange(timeRange);
164
+ if (!releaseQuery && !scopeQuery) invalidQuery();
165
+ const result = await model.getReleaseActivity(input);
166
+ validateAggregateResult(result);
167
+ if (!Array.isArray(result.data)) invalidResult();
168
+ return result;
169
+ },
170
+ async getAppUsage(input) {
171
+ if (!isRecord(input) || !hasOnlyKeys(input, [
172
+ "channel",
173
+ "platform",
174
+ "appVersion",
175
+ "timeRange",
176
+ "intervalMs"
177
+ ]) || !isText(input.channel) || ![
178
+ "all",
179
+ "ios",
180
+ "android"
181
+ ].includes(input.platform) || input.appVersion !== void 0 && !isText(input.appVersion) || !isTimeRange(input.timeRange) || !isTimestamp(input.intervalMs) || input.intervalMs < 36e5) invalidQuery();
182
+ const result = await model.getAppUsage(input);
183
+ validateAggregateResult(result);
184
+ if (!isTimestamp(result.activeInstallations) || !Array.isArray(result.points) || !Array.isArray(result.appVersions) || !Array.isArray(result.versions) || !Array.isArray(result.platforms) || !Array.isArray(result.bundleDistribution)) invalidResult();
185
+ return result;
140
186
  }
141
187
  });
142
188
  //#endregion