@hot-updater/plugin-core 0.35.11 → 0.36.0

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.
@@ -1,6 +1,8 @@
1
1
  const require_contentAddressedAssets = require("./contentAddressedAssets.cjs");
2
2
  const require_legacyAssetStorageLayout = require("./legacyAssetStorageLayout.cjs");
3
3
  //#region src/assetStorageLayout.ts
4
+ const isBrotliManifestAssetPath = (assetPath) => /(^|\/)index\.[^/]+\.bundle$/.test(assetPath.replace(/\\/g, "/"));
5
+ const getManifestAssetDownloadPath = (assetPath) => isBrotliManifestAssetPath(assetPath) ? `${assetPath}.br` : assetPath;
4
6
  const createStorageUriWithRelativePath = ({ baseStorageUri, relativePath }) => {
5
7
  const storageUrl = new URL(baseStorageUri);
6
8
  storageUrl.pathname = `${storageUrl.pathname.replace(/\/+$/, "")}/${relativePath.replace(/\\/g, "/").split("/").filter(Boolean).map((segment) => encodeURIComponent(segment)).join("/")}`;
@@ -29,6 +31,8 @@ const resolveManifestAssetStorageUri = ({ assetBaseStorageUri, assetPath, fileHa
29
31
  //#endregion
30
32
  exports.createStorageUriWithRelativePath = createStorageUriWithRelativePath;
31
33
  exports.getAssetStorageLayout = getAssetStorageLayout;
34
+ exports.getManifestAssetDownloadPath = getManifestAssetDownloadPath;
32
35
  exports.getManifestAssetStoragePath = getManifestAssetStoragePath;
36
+ exports.isBrotliManifestAssetPath = isBrotliManifestAssetPath;
33
37
  exports.isContentAddressedAssetBaseStorageUri = isContentAddressedAssetBaseStorageUri;
34
38
  exports.resolveManifestAssetStorageUri = resolveManifestAssetStorageUri;
@@ -1,5 +1,7 @@
1
1
  //#region src/assetStorageLayout.d.ts
2
2
  type AssetStorageLayout = "content-addressed" | "legacy-files";
3
+ declare const isBrotliManifestAssetPath: (assetPath: string) => boolean;
4
+ declare const getManifestAssetDownloadPath: (assetPath: string) => string;
3
5
  declare const createStorageUriWithRelativePath: ({
4
6
  baseStorageUri,
5
7
  relativePath
@@ -28,4 +30,4 @@ declare const resolveManifestAssetStorageUri: ({
28
30
  fileHash: string;
29
31
  }) => string;
30
32
  //#endregion
31
- export { AssetStorageLayout, createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetStoragePath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri };
33
+ export { AssetStorageLayout, createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri };
@@ -1,5 +1,7 @@
1
1
  //#region src/assetStorageLayout.d.ts
2
2
  type AssetStorageLayout = "content-addressed" | "legacy-files";
3
+ declare const isBrotliManifestAssetPath: (assetPath: string) => boolean;
4
+ declare const getManifestAssetDownloadPath: (assetPath: string) => string;
3
5
  declare const createStorageUriWithRelativePath: ({
4
6
  baseStorageUri,
5
7
  relativePath
@@ -28,4 +30,4 @@ declare const resolveManifestAssetStorageUri: ({
28
30
  fileHash: string;
29
31
  }) => string;
30
32
  //#endregion
31
- export { AssetStorageLayout, createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetStoragePath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri };
33
+ export { AssetStorageLayout, createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri };
@@ -1,6 +1,8 @@
1
1
  import { getContentAddressedAssetStoragePath } from "./contentAddressedAssets.mjs";
2
2
  import { getLegacyManifestAssetStoragePath } from "./legacyAssetStorageLayout.mjs";
3
3
  //#region src/assetStorageLayout.ts
4
+ const isBrotliManifestAssetPath = (assetPath) => /(^|\/)index\.[^/]+\.bundle$/.test(assetPath.replace(/\\/g, "/"));
5
+ const getManifestAssetDownloadPath = (assetPath) => isBrotliManifestAssetPath(assetPath) ? `${assetPath}.br` : assetPath;
4
6
  const createStorageUriWithRelativePath = ({ baseStorageUri, relativePath }) => {
5
7
  const storageUrl = new URL(baseStorageUri);
6
8
  storageUrl.pathname = `${storageUrl.pathname.replace(/\/+$/, "")}/${relativePath.replace(/\\/g, "/").split("/").filter(Boolean).map((segment) => encodeURIComponent(segment)).join("/")}`;
@@ -27,4 +29,4 @@ const resolveManifestAssetStorageUri = ({ assetBaseStorageUri, assetPath, fileHa
27
29
  })
28
30
  });
29
31
  //#endregion
30
- export { createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetStoragePath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri };
32
+ export { createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri };
@@ -0,0 +1,22 @@
1
+ //#region src/bundleStorageLayout.ts
2
+ const BUNDLE_STORAGE_PREFIX = "bundles";
3
+ const createBundleStorageKey = (bundleId, ...relativePaths) => [
4
+ BUNDLE_STORAGE_PREFIX,
5
+ bundleId,
6
+ ...relativePaths
7
+ ].filter(Boolean).join("/");
8
+ const createStorageRootUriWithPath = (storageUri, bundleId, relativePath) => {
9
+ const storageUrl = new URL(storageUri);
10
+ const segments = storageUrl.pathname.split("/").filter(Boolean);
11
+ const bundleIndex = segments.lastIndexOf(bundleId);
12
+ if (bundleIndex < 0) throw new Error(`Storage URI does not contain bundle id: ${bundleId}`);
13
+ const rootSegments = segments.slice(0, bundleIndex);
14
+ if (rootSegments.at(-1) === "bundles") rootSegments.pop();
15
+ const relativeSegments = relativePath.split("/").filter(Boolean).map((segment) => encodeURIComponent(segment));
16
+ storageUrl.pathname = `/${[...rootSegments, ...relativeSegments].join("/")}`;
17
+ return storageUrl.toString();
18
+ };
19
+ //#endregion
20
+ exports.BUNDLE_STORAGE_PREFIX = BUNDLE_STORAGE_PREFIX;
21
+ exports.createBundleStorageKey = createBundleStorageKey;
22
+ exports.createStorageRootUriWithPath = createStorageRootUriWithPath;
@@ -0,0 +1,6 @@
1
+ //#region src/bundleStorageLayout.d.ts
2
+ declare const BUNDLE_STORAGE_PREFIX = "bundles";
3
+ declare const createBundleStorageKey: (bundleId: string, ...relativePaths: string[]) => string;
4
+ declare const createStorageRootUriWithPath: (storageUri: string, bundleId: string, relativePath: string) => string;
5
+ //#endregion
6
+ export { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath };
@@ -0,0 +1,6 @@
1
+ //#region src/bundleStorageLayout.d.ts
2
+ declare const BUNDLE_STORAGE_PREFIX = "bundles";
3
+ declare const createBundleStorageKey: (bundleId: string, ...relativePaths: string[]) => string;
4
+ declare const createStorageRootUriWithPath: (storageUri: string, bundleId: string, relativePath: string) => string;
5
+ //#endregion
6
+ export { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath };
@@ -0,0 +1,20 @@
1
+ //#region src/bundleStorageLayout.ts
2
+ const BUNDLE_STORAGE_PREFIX = "bundles";
3
+ const createBundleStorageKey = (bundleId, ...relativePaths) => [
4
+ BUNDLE_STORAGE_PREFIX,
5
+ bundleId,
6
+ ...relativePaths
7
+ ].filter(Boolean).join("/");
8
+ const createStorageRootUriWithPath = (storageUri, bundleId, relativePath) => {
9
+ const storageUrl = new URL(storageUri);
10
+ const segments = storageUrl.pathname.split("/").filter(Boolean);
11
+ const bundleIndex = segments.lastIndexOf(bundleId);
12
+ if (bundleIndex < 0) throw new Error(`Storage URI does not contain bundle id: ${bundleId}`);
13
+ const rootSegments = segments.slice(0, bundleIndex);
14
+ if (rootSegments.at(-1) === "bundles") rootSegments.pop();
15
+ const relativeSegments = relativePath.split("/").filter(Boolean).map((segment) => encodeURIComponent(segment));
16
+ storageUrl.pathname = `/${[...rootSegments, ...relativeSegments].join("/")}`;
17
+ return storageUrl.toString();
18
+ };
19
+ //#endregion
20
+ export { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath };
@@ -1,7 +1,9 @@
1
1
  //#region src/contentAddressedAssets.ts
2
+ const CONTENT_ADDRESSED_ASSET_PREFIX = "assets";
2
3
  const getContentAddressedAssetStoragePath = ({ assetPath, fileHash }) => {
3
4
  const extension = assetPath.endsWith(".br") ? ".br" : assetPath.includes(".") ? `.${assetPath.split(".").pop()}` : "";
4
5
  return `sha256/${fileHash.slice(0, 2)}/${fileHash}${extension}`;
5
6
  };
6
7
  //#endregion
8
+ exports.CONTENT_ADDRESSED_ASSET_PREFIX = CONTENT_ADDRESSED_ASSET_PREFIX;
7
9
  exports.getContentAddressedAssetStoragePath = getContentAddressedAssetStoragePath;
@@ -1,4 +1,5 @@
1
1
  //#region src/contentAddressedAssets.d.ts
2
+ declare const CONTENT_ADDRESSED_ASSET_PREFIX = "assets";
2
3
  declare const getContentAddressedAssetStoragePath: ({
3
4
  assetPath,
4
5
  fileHash
@@ -7,4 +8,4 @@ declare const getContentAddressedAssetStoragePath: ({
7
8
  fileHash: string;
8
9
  }) => string;
9
10
  //#endregion
10
- export { getContentAddressedAssetStoragePath };
11
+ export { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath };
@@ -1,4 +1,5 @@
1
1
  //#region src/contentAddressedAssets.d.ts
2
+ declare const CONTENT_ADDRESSED_ASSET_PREFIX = "assets";
2
3
  declare const getContentAddressedAssetStoragePath: ({
3
4
  assetPath,
4
5
  fileHash
@@ -7,4 +8,4 @@ declare const getContentAddressedAssetStoragePath: ({
7
8
  fileHash: string;
8
9
  }) => string;
9
10
  //#endregion
10
- export { getContentAddressedAssetStoragePath };
11
+ export { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath };
@@ -1,7 +1,8 @@
1
1
  //#region src/contentAddressedAssets.ts
2
+ const CONTENT_ADDRESSED_ASSET_PREFIX = "assets";
2
3
  const getContentAddressedAssetStoragePath = ({ assetPath, fileHash }) => {
3
4
  const extension = assetPath.endsWith(".br") ? ".br" : assetPath.includes(".") ? `.${assetPath.split(".").pop()}` : "";
4
5
  return `sha256/${fileHash.slice(0, 2)}/${fileHash}${extension}`;
5
6
  };
6
7
  //#endregion
7
- export { getContentAddressedAssetStoragePath };
8
+ export { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath };
@@ -1,12 +1,11 @@
1
- const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
1
+ require("./_virtual/_rolldown/runtime.cjs");
2
2
  const require_queryBundles = require("./queryBundles.cjs");
3
3
  const require_createDatabasePlugin = require("./createDatabasePlugin.cjs");
4
4
  const require_filterCompatibleAppVersions = require("./filterCompatibleAppVersions.cjs");
5
5
  const require_paginateBundles = require("./paginateBundles.cjs");
6
6
  const require_resolveUpdateInfoFromBundles = require("./resolveUpdateInfoFromBundles.cjs");
7
7
  let es_toolkit = require("es-toolkit");
8
- let semver = require("semver");
9
- semver = require_runtime.__toESM(semver);
8
+ let verkit = require("verkit");
10
9
  //#region src/createBlobDatabasePlugin.ts
11
10
  const STORAGE_OPERATION_CONCURRENCY = 8;
12
11
  async function mapWithConcurrency(items, concurrency, mapper) {
@@ -40,7 +39,7 @@ function isExactVersion(version) {
40
39
  if (!version) return false;
41
40
  const normalized = normalizeTargetAppVersion(version);
42
41
  if (!normalized) return false;
43
- return semver.default.valid(normalized) !== null;
42
+ return (0, verkit.normalize)(normalized) !== null;
44
43
  }
45
44
  /**
46
45
  * Get all normalized semver versions for a version string.
@@ -53,12 +52,13 @@ function isExactVersion(version) {
53
52
  */
54
53
  function getSemverNormalizedVersions(version) {
55
54
  const normalized = normalizeTargetAppVersion(version) || version;
56
- const coerced = semver.default.coerce(normalized);
55
+ const coerced = (0, verkit.coerce)(normalized);
57
56
  if (!coerced) return [normalized];
57
+ const { major, minor, patch } = (0, verkit.parse)(coerced);
58
58
  const versions = /* @__PURE__ */ new Set();
59
- versions.add(coerced.version);
60
- if (coerced.patch === 0) versions.add(`${coerced.major}.${coerced.minor}`);
61
- if (coerced.minor === 0 && coerced.patch === 0) versions.add(`${coerced.major}`);
59
+ versions.add(coerced);
60
+ if (patch === 0) versions.add(`${major}.${minor}`);
61
+ if (minor === 0 && patch === 0) versions.add(`${major}`);
62
62
  return Array.from(versions);
63
63
  }
64
64
  function resolveStorageTarget({ targetAppVersion, fingerprintHash }) {
@@ -93,10 +93,17 @@ function addTargetVersionRemoval(mutations, bundle) {
93
93
  getTargetVersionMutation(mutations, bundle).removals.add(targetAppVersion);
94
94
  }
95
95
  function getManagementListPrefixes(where) {
96
+ if (where?.channel && where.platform && typeof where.targetAppVersion === "string") {
97
+ const targetAppVersion = normalizeTargetAppVersion(where.targetAppVersion);
98
+ if (targetAppVersion) return [`${where.channel}/${where.platform}/${targetAppVersion}/`];
99
+ }
96
100
  if (where?.channel && where.platform) return [`${where.channel}/${where.platform}/`];
97
101
  if (where?.channel) return [`${where.channel}/`];
98
102
  return [""];
99
103
  }
104
+ function getChannelFromUpdateJsonKey(key) {
105
+ return key.match(/^([^/]+)\/(?:ios|android)\/[^/]+\/update\.json$/)?.[1] ?? null;
106
+ }
100
107
  const DEFAULT_DESC_ORDER = {
101
108
  field: "id",
102
109
  direction: "desc"
@@ -113,7 +120,7 @@ function sortManagedBundles(bundles, orderBy = DEFAULT_DESC_ORDER) {
113
120
  */
114
121
  const createBlobDatabasePlugin = ({ name, factory }) => {
115
122
  return (config, hooks) => {
116
- const { listObjects, loadObject, uploadObject, deleteObject, shouldSkipLoadObjectError, invalidatePaths, apiBasePath } = factory(config);
123
+ const { listObjects, loadObject, uploadObject, deleteObject, shouldSkipLoadObjectError, validateChannel, invalidatePaths, apiBasePath } = factory(config);
117
124
  const bundlesMap = /* @__PURE__ */ new Map();
118
125
  const pendingBundlesMap = /* @__PURE__ */ new Map();
119
126
  const locallyDeletedBundleIds = /* @__PURE__ */ new Set();
@@ -249,10 +256,12 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
249
256
  });
250
257
  },
251
258
  async getChannels() {
252
- return [...new Set((await loadAllBundlesForManagementFallback()).map((bundle) => bundle.channel))].sort();
259
+ const channels = (await listObjects("")).map(getChannelFromUpdateJsonKey).filter((channel) => channel !== null);
260
+ return [...new Set(channels)].sort();
253
261
  },
254
262
  async commitBundle({ changedSets }) {
255
263
  if (changedSets.length === 0) return;
264
+ for (const { operation, data } of changedSets) if (operation === "insert" || operation === "update" && data.channel !== void 0) validateChannel?.(data.channel);
256
265
  const changedBundlesByKey = {};
257
266
  const removalsByKey = {};
258
267
  const targetVersionRemovalsByKey = {};
@@ -7,6 +7,7 @@ interface BlobOperations {
7
7
  uploadObject: <T>(key: string, data: T) => Promise<void>;
8
8
  deleteObject: (key: string) => Promise<void>;
9
9
  shouldSkipLoadObjectError?: (error: unknown, key: string) => boolean;
10
+ validateChannel?: (channel: string) => void;
10
11
  invalidatePaths: (paths: string[]) => Promise<void>;
11
12
  apiBasePath: string;
12
13
  }
@@ -7,6 +7,7 @@ interface BlobOperations {
7
7
  uploadObject: <T>(key: string, data: T) => Promise<void>;
8
8
  deleteObject: (key: string) => Promise<void>;
9
9
  shouldSkipLoadObjectError?: (error: unknown, key: string) => boolean;
10
+ validateChannel?: (channel: string) => void;
10
11
  invalidatePaths: (paths: string[]) => Promise<void>;
11
12
  apiBasePath: string;
12
13
  }
@@ -4,7 +4,7 @@ import { filterCompatibleAppVersions } from "./filterCompatibleAppVersions.mjs";
4
4
  import { paginateBundles } from "./paginateBundles.mjs";
5
5
  import { resolveUpdateInfoFromBundles } from "./resolveUpdateInfoFromBundles.mjs";
6
6
  import { orderBy } from "es-toolkit";
7
- import semver from "semver";
7
+ import { coerce, normalize, parse } from "verkit";
8
8
  //#region src/createBlobDatabasePlugin.ts
9
9
  const STORAGE_OPERATION_CONCURRENCY = 8;
10
10
  async function mapWithConcurrency(items, concurrency, mapper) {
@@ -38,7 +38,7 @@ function isExactVersion(version) {
38
38
  if (!version) return false;
39
39
  const normalized = normalizeTargetAppVersion(version);
40
40
  if (!normalized) return false;
41
- return semver.valid(normalized) !== null;
41
+ return normalize(normalized) !== null;
42
42
  }
43
43
  /**
44
44
  * Get all normalized semver versions for a version string.
@@ -51,12 +51,13 @@ function isExactVersion(version) {
51
51
  */
52
52
  function getSemverNormalizedVersions(version) {
53
53
  const normalized = normalizeTargetAppVersion(version) || version;
54
- const coerced = semver.coerce(normalized);
54
+ const coerced = coerce(normalized);
55
55
  if (!coerced) return [normalized];
56
+ const { major, minor, patch } = parse(coerced);
56
57
  const versions = /* @__PURE__ */ new Set();
57
- versions.add(coerced.version);
58
- if (coerced.patch === 0) versions.add(`${coerced.major}.${coerced.minor}`);
59
- if (coerced.minor === 0 && coerced.patch === 0) versions.add(`${coerced.major}`);
58
+ versions.add(coerced);
59
+ if (patch === 0) versions.add(`${major}.${minor}`);
60
+ if (minor === 0 && patch === 0) versions.add(`${major}`);
60
61
  return Array.from(versions);
61
62
  }
62
63
  function resolveStorageTarget({ targetAppVersion, fingerprintHash }) {
@@ -91,10 +92,17 @@ function addTargetVersionRemoval(mutations, bundle) {
91
92
  getTargetVersionMutation(mutations, bundle).removals.add(targetAppVersion);
92
93
  }
93
94
  function getManagementListPrefixes(where) {
95
+ if (where?.channel && where.platform && typeof where.targetAppVersion === "string") {
96
+ const targetAppVersion = normalizeTargetAppVersion(where.targetAppVersion);
97
+ if (targetAppVersion) return [`${where.channel}/${where.platform}/${targetAppVersion}/`];
98
+ }
94
99
  if (where?.channel && where.platform) return [`${where.channel}/${where.platform}/`];
95
100
  if (where?.channel) return [`${where.channel}/`];
96
101
  return [""];
97
102
  }
103
+ function getChannelFromUpdateJsonKey(key) {
104
+ return key.match(/^([^/]+)\/(?:ios|android)\/[^/]+\/update\.json$/)?.[1] ?? null;
105
+ }
98
106
  const DEFAULT_DESC_ORDER = {
99
107
  field: "id",
100
108
  direction: "desc"
@@ -111,7 +119,7 @@ function sortManagedBundles(bundles, orderBy = DEFAULT_DESC_ORDER) {
111
119
  */
112
120
  const createBlobDatabasePlugin = ({ name, factory }) => {
113
121
  return (config, hooks) => {
114
- const { listObjects, loadObject, uploadObject, deleteObject, shouldSkipLoadObjectError, invalidatePaths, apiBasePath } = factory(config);
122
+ const { listObjects, loadObject, uploadObject, deleteObject, shouldSkipLoadObjectError, validateChannel, invalidatePaths, apiBasePath } = factory(config);
115
123
  const bundlesMap = /* @__PURE__ */ new Map();
116
124
  const pendingBundlesMap = /* @__PURE__ */ new Map();
117
125
  const locallyDeletedBundleIds = /* @__PURE__ */ new Set();
@@ -247,10 +255,12 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
247
255
  });
248
256
  },
249
257
  async getChannels() {
250
- return [...new Set((await loadAllBundlesForManagementFallback()).map((bundle) => bundle.channel))].sort();
258
+ const channels = (await listObjects("")).map(getChannelFromUpdateJsonKey).filter((channel) => channel !== null);
259
+ return [...new Set(channels)].sort();
251
260
  },
252
261
  async commitBundle({ changedSets }) {
253
262
  if (changedSets.length === 0) return;
263
+ for (const { operation, data } of changedSets) if (operation === "insert" || operation === "update" && data.channel !== void 0) validateChannel?.(data.channel);
254
264
  const changedBundlesByKey = {};
255
265
  const removalsByKey = {};
256
266
  const targetVersionRemovalsByKey = {};
@@ -38,21 +38,39 @@ const createProfiledStoragePlugin = ({ createProfiles, name, profileShape, suppo
38
38
  return runtime;
39
39
  };
40
40
  const profiles = {};
41
- if (profileShape?.node) profiles.node = {
42
- async delete(storageUri) {
43
- return requireNodeProfile().delete(storageUri);
44
- },
45
- async downloadFile(storageUri, filePath) {
46
- return requireNodeProfile().downloadFile(storageUri, filePath);
47
- },
48
- async exists(storageUri) {
49
- return requireNodeProfile().exists(storageUri);
50
- },
51
- async upload(key, filePath) {
52
- return requireNodeProfile().upload(key, filePath);
53
- }
54
- };
55
- else if (profileShape?.node !== false) Object.defineProperty(profiles, "node", {
41
+ if (profileShape?.node) {
42
+ const nodeProfile = {
43
+ async delete(storageUri) {
44
+ return requireNodeProfile().delete(storageUri);
45
+ },
46
+ async downloadFile(storageUri, filePath) {
47
+ return requireNodeProfile().downloadFile(storageUri, filePath);
48
+ },
49
+ async exists(storageUri) {
50
+ return requireNodeProfile().exists(storageUri);
51
+ },
52
+ async upload(key, filePath) {
53
+ return requireNodeProfile().upload(key, filePath);
54
+ }
55
+ };
56
+ Object.defineProperties(nodeProfile, {
57
+ deleteObjects: {
58
+ enumerable: true,
59
+ get: () => {
60
+ const deleteObjects = requireNodeProfile().deleteObjects;
61
+ return deleteObjects ? (keys) => deleteObjects(keys) : void 0;
62
+ }
63
+ },
64
+ listObjects: {
65
+ enumerable: true,
66
+ get: () => {
67
+ const listObjects = requireNodeProfile().listObjects;
68
+ return listObjects ? (prefix) => listObjects(prefix) : void 0;
69
+ }
70
+ }
71
+ });
72
+ profiles.node = nodeProfile;
73
+ } else if (profileShape?.node !== false) Object.defineProperty(profiles, "node", {
56
74
  enumerable: true,
57
75
  get: getNodeProfile
58
76
  });
@@ -38,21 +38,39 @@ const createProfiledStoragePlugin = ({ createProfiles, name, profileShape, suppo
38
38
  return runtime;
39
39
  };
40
40
  const profiles = {};
41
- if (profileShape?.node) profiles.node = {
42
- async delete(storageUri) {
43
- return requireNodeProfile().delete(storageUri);
44
- },
45
- async downloadFile(storageUri, filePath) {
46
- return requireNodeProfile().downloadFile(storageUri, filePath);
47
- },
48
- async exists(storageUri) {
49
- return requireNodeProfile().exists(storageUri);
50
- },
51
- async upload(key, filePath) {
52
- return requireNodeProfile().upload(key, filePath);
53
- }
54
- };
55
- else if (profileShape?.node !== false) Object.defineProperty(profiles, "node", {
41
+ if (profileShape?.node) {
42
+ const nodeProfile = {
43
+ async delete(storageUri) {
44
+ return requireNodeProfile().delete(storageUri);
45
+ },
46
+ async downloadFile(storageUri, filePath) {
47
+ return requireNodeProfile().downloadFile(storageUri, filePath);
48
+ },
49
+ async exists(storageUri) {
50
+ return requireNodeProfile().exists(storageUri);
51
+ },
52
+ async upload(key, filePath) {
53
+ return requireNodeProfile().upload(key, filePath);
54
+ }
55
+ };
56
+ Object.defineProperties(nodeProfile, {
57
+ deleteObjects: {
58
+ enumerable: true,
59
+ get: () => {
60
+ const deleteObjects = requireNodeProfile().deleteObjects;
61
+ return deleteObjects ? (keys) => deleteObjects(keys) : void 0;
62
+ }
63
+ },
64
+ listObjects: {
65
+ enumerable: true,
66
+ get: () => {
67
+ const listObjects = requireNodeProfile().listObjects;
68
+ return listObjects ? (prefix) => listObjects(prefix) : void 0;
69
+ }
70
+ }
71
+ });
72
+ profiles.node = nodeProfile;
73
+ } else if (profileShape?.node !== false) Object.defineProperty(profiles, "node", {
56
74
  enumerable: true,
57
75
  get: getNodeProfile
58
76
  });
package/dist/index.cjs CHANGED
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_calculatePagination = require("./calculatePagination.cjs");
3
+ const require_bundleStorageLayout = require("./bundleStorageLayout.cjs");
3
4
  const require_compressionFormat = require("./compressionFormat.cjs");
4
5
  const require_contentAddressedAssets = require("./contentAddressedAssets.cjs");
5
6
  const require_assetStorageLayout = require("./assetStorageLayout.cjs");
@@ -18,17 +19,21 @@ const require_parseStorageUri = require("./parseStorageUri.cjs");
18
19
  const require_storageProfile = require("./storageProfile.cjs");
19
20
  const require_index = require("./types/index.cjs");
20
21
  const require_uuidv7 = require("./uuidv7.cjs");
22
+ exports.BUNDLE_STORAGE_PREFIX = require_bundleStorageLayout.BUNDLE_STORAGE_PREFIX;
23
+ exports.CONTENT_ADDRESSED_ASSET_PREFIX = require_contentAddressedAssets.CONTENT_ADDRESSED_ASSET_PREFIX;
21
24
  exports.assertNodeStoragePlugin = require_storageProfile.assertNodeStoragePlugin;
22
25
  exports.assertRuntimeStoragePlugin = require_storageProfile.assertRuntimeStoragePlugin;
23
26
  exports.bundleIdMatchesFilter = require_queryBundles.bundleIdMatchesFilter;
24
27
  exports.bundleMatchesQueryWhere = require_queryBundles.bundleMatchesQueryWhere;
25
28
  exports.calculatePagination = require_calculatePagination.calculatePagination;
26
29
  exports.createBlobDatabasePlugin = require_createBlobDatabasePlugin.createBlobDatabasePlugin;
30
+ exports.createBundleStorageKey = require_bundleStorageLayout.createBundleStorageKey;
27
31
  exports.createDatabasePlugin = require_createDatabasePlugin.createDatabasePlugin;
28
32
  exports.createNodeStoragePlugin = require_createStoragePlugin.createNodeStoragePlugin;
29
33
  exports.createRequestUpdateBundleResolver = require_requestUpdateBundleState.createRequestUpdateBundleResolver;
30
34
  exports.createRuntimeStoragePlugin = require_createStoragePlugin.createRuntimeStoragePlugin;
31
35
  exports.createStorageKeyBuilder = require_createStorageKeyBuilder.createStorageKeyBuilder;
36
+ exports.createStorageRootUriWithPath = require_bundleStorageLayout.createStorageRootUriWithPath;
32
37
  exports.createStorageUriWithRelativePath = require_assetStorageLayout.createStorageUriWithRelativePath;
33
38
  exports.createUUIDv7 = require_uuidv7.createUUIDv7;
34
39
  exports.createUUIDv7WithSameTimestamp = require_uuidv7.createUUIDv7WithSameTimestamp;
@@ -41,8 +46,10 @@ exports.getAssetStorageLayout = require_assetStorageLayout.getAssetStorageLayout
41
46
  exports.getCompressionMimeType = require_compressionFormat.getCompressionMimeType;
42
47
  exports.getContentAddressedAssetStoragePath = require_contentAddressedAssets.getContentAddressedAssetStoragePath;
43
48
  exports.getContentType = require_compressionFormat.getContentType;
49
+ exports.getManifestAssetDownloadPath = require_assetStorageLayout.getManifestAssetDownloadPath;
44
50
  exports.getManifestAssetStoragePath = require_assetStorageLayout.getManifestAssetStoragePath;
45
51
  exports.getRequestUpdateBundleSeeds = require_requestUpdateBundleState.getRequestUpdateBundleSeeds;
52
+ exports.isBrotliManifestAssetPath = require_assetStorageLayout.isBrotliManifestAssetPath;
46
53
  exports.isContentAddressedAssetBaseStorageUri = require_assetStorageLayout.isContentAddressedAssetBaseStorageUri;
47
54
  exports.isNodeStoragePlugin = require_storageProfile.isNodeStoragePlugin;
48
55
  exports.isRuntimeStoragePlugin = require_storageProfile.isRuntimeStoragePlugin;
package/dist/index.d.cts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.cjs";
2
- import { AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintExtraSources, FingerprintGetBundlesArgs, GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, Platform, PlatformConfig, RequestEnvContext, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, UpdateInfo, supportedIosPlatforms } from "./types/index.cjs";
2
+ import { AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintExtraSources, FingerprintGetBundlesArgs, GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, Platform, PlatformConfig, RequestEnvContext, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StorageObject, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, UpdateInfo, supportedIosPlatforms } from "./types/index.cjs";
3
3
  import { PaginationOptions, calculatePagination } from "./calculatePagination.cjs";
4
+ import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath } from "./bundleStorageLayout.cjs";
4
5
  import { CompressionFormat, CompressionFormatInfo, detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.cjs";
5
- import { AssetStorageLayout, createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetStoragePath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri } from "./assetStorageLayout.cjs";
6
- import { getContentAddressedAssetStoragePath } from "./contentAddressedAssets.cjs";
6
+ import { AssetStorageLayout, createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri } from "./assetStorageLayout.cjs";
7
+ import { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath } from "./contentAddressedAssets.cjs";
7
8
  import { BlobOperations, createBlobDatabasePlugin } from "./createBlobDatabasePlugin.cjs";
8
9
  import { AbstractDatabasePlugin, CreateDatabasePluginOptions, createDatabasePlugin } from "./createDatabasePlugin.cjs";
9
10
  import { createStorageKeyBuilder } from "./createStorageKeyBuilder.cjs";
@@ -18,4 +19,4 @@ import { ResolveUpdateInfoFromBundlesOptions, resolveUpdateInfoFromBundles } fro
18
19
  import { semverSatisfies } from "./semverSatisfies.cjs";
19
20
  import { assertNodeStoragePlugin, assertRuntimeStoragePlugin, isNodeStoragePlugin, isRuntimeStoragePlugin } from "./storageProfile.cjs";
20
21
  import { createUUIDv7, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7 } from "./uuidv7.cjs";
21
- export { AbstractDatabasePlugin, AppVersionGetBundlesArgs, ApplePlatform, AssetStorageLayout, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintExtraSources, FingerprintGetBundlesArgs, GetBundlesArgs, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, ResolveUpdateInfoFromBundlesOptions, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, UpdateInfo, assertNodeStoragePlugin, assertRuntimeStoragePlugin, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createNodeStoragePlugin, createRequestUpdateBundleResolver, createRuntimeStoragePlugin, createStorageKeyBuilder, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7WithSameTimestamp, createUniversalStoragePlugin, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getAssetStorageLayout, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetStoragePath, getRequestUpdateBundleSeeds, isContentAddressedAssetBaseStorageUri, isNodeStoragePlugin, isRuntimeStoragePlugin, paginateBundles, parseStorageUri, resolveManifestAssetStorageUri, resolveUpdateInfoFromBundles, semverSatisfies, sortBundles, supportedIosPlatforms };
22
+ export { AbstractDatabasePlugin, AppVersionGetBundlesArgs, ApplePlatform, AssetStorageLayout, BUNDLE_STORAGE_PREFIX, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CONTENT_ADDRESSED_ASSET_PREFIX, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintExtraSources, FingerprintGetBundlesArgs, GetBundlesArgs, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, ResolveUpdateInfoFromBundlesOptions, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StorageObject, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, UpdateInfo, assertNodeStoragePlugin, assertRuntimeStoragePlugin, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createBundleStorageKey, createDatabasePlugin, createNodeStoragePlugin, createRequestUpdateBundleResolver, createRuntimeStoragePlugin, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7WithSameTimestamp, createUniversalStoragePlugin, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getAssetStorageLayout, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, getRequestUpdateBundleSeeds, isBrotliManifestAssetPath, isContentAddressedAssetBaseStorageUri, isNodeStoragePlugin, isRuntimeStoragePlugin, paginateBundles, parseStorageUri, resolveManifestAssetStorageUri, resolveUpdateInfoFromBundles, semverSatisfies, sortBundles, supportedIosPlatforms };
package/dist/index.d.mts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { BuiltIns, HasMultipleCallSignatures, Primitive, RequiredDeep } from "./types/utils.mjs";
2
- import { AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintExtraSources, FingerprintGetBundlesArgs, GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, Platform, PlatformConfig, RequestEnvContext, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, UpdateInfo, supportedIosPlatforms } from "./types/index.mjs";
2
+ import { AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, Bundle, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintExtraSources, FingerprintGetBundlesArgs, GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, Platform, PlatformConfig, RequestEnvContext, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StorageObject, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, UpdateInfo, supportedIosPlatforms } from "./types/index.mjs";
3
3
  import { PaginationOptions, calculatePagination } from "./calculatePagination.mjs";
4
+ import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath } from "./bundleStorageLayout.mjs";
4
5
  import { CompressionFormat, CompressionFormatInfo, detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.mjs";
5
- import { AssetStorageLayout, createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetStoragePath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri } from "./assetStorageLayout.mjs";
6
- import { getContentAddressedAssetStoragePath } from "./contentAddressedAssets.mjs";
6
+ import { AssetStorageLayout, createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri } from "./assetStorageLayout.mjs";
7
+ import { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath } from "./contentAddressedAssets.mjs";
7
8
  import { BlobOperations, createBlobDatabasePlugin } from "./createBlobDatabasePlugin.mjs";
8
9
  import { AbstractDatabasePlugin, CreateDatabasePluginOptions, createDatabasePlugin } from "./createDatabasePlugin.mjs";
9
10
  import { createStorageKeyBuilder } from "./createStorageKeyBuilder.mjs";
@@ -18,4 +19,4 @@ import { ResolveUpdateInfoFromBundlesOptions, resolveUpdateInfoFromBundles } fro
18
19
  import { semverSatisfies } from "./semverSatisfies.mjs";
19
20
  import { assertNodeStoragePlugin, assertRuntimeStoragePlugin, isNodeStoragePlugin, isRuntimeStoragePlugin } from "./storageProfile.mjs";
20
21
  import { createUUIDv7, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7 } from "./uuidv7.mjs";
21
- export { AbstractDatabasePlugin, AppVersionGetBundlesArgs, ApplePlatform, AssetStorageLayout, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintExtraSources, FingerprintGetBundlesArgs, GetBundlesArgs, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, ResolveUpdateInfoFromBundlesOptions, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, UpdateInfo, assertNodeStoragePlugin, assertRuntimeStoragePlugin, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createNodeStoragePlugin, createRequestUpdateBundleResolver, createRuntimeStoragePlugin, createStorageKeyBuilder, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7WithSameTimestamp, createUniversalStoragePlugin, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getAssetStorageLayout, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetStoragePath, getRequestUpdateBundleSeeds, isContentAddressedAssetBaseStorageUri, isNodeStoragePlugin, isRuntimeStoragePlugin, paginateBundles, parseStorageUri, resolveManifestAssetStorageUri, resolveUpdateInfoFromBundles, semverSatisfies, sortBundles, supportedIosPlatforms };
22
+ export { AbstractDatabasePlugin, AppVersionGetBundlesArgs, ApplePlatform, AssetStorageLayout, BUNDLE_STORAGE_PREFIX, BasePluginArgs, BlobOperations, BuildPlugin, BuildPluginConfig, BuiltIns, Bundle, CONTENT_ADDRESSED_ASSET_PREFIX, CompressionFormat, CompressionFormatInfo, ConfigInput, CreateDatabasePluginOptions, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintExtraSources, FingerprintGetBundlesArgs, GetBundlesArgs, HasMultipleCallSignatures, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, PaginationOptions, ParsedStorageUri, Platform, PlatformConfig, Primitive, RequestEnvContext, RequiredDeep, ResolveUpdateInfoFromBundlesOptions, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StorageObject, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, UpdateInfo, assertNodeStoragePlugin, assertRuntimeStoragePlugin, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createBundleStorageKey, createDatabasePlugin, createNodeStoragePlugin, createRequestUpdateBundleResolver, createRuntimeStoragePlugin, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7WithSameTimestamp, createUniversalStoragePlugin, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getAssetStorageLayout, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, getRequestUpdateBundleSeeds, isBrotliManifestAssetPath, isContentAddressedAssetBaseStorageUri, isNodeStoragePlugin, isRuntimeStoragePlugin, paginateBundles, parseStorageUri, resolveManifestAssetStorageUri, resolveUpdateInfoFromBundles, semverSatisfies, sortBundles, supportedIosPlatforms };
package/dist/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  import { calculatePagination } from "./calculatePagination.mjs";
2
+ import { BUNDLE_STORAGE_PREFIX, createBundleStorageKey, createStorageRootUriWithPath } from "./bundleStorageLayout.mjs";
2
3
  import { detectCompressionFormat, getCompressionMimeType, getContentType } from "./compressionFormat.mjs";
3
- import { getContentAddressedAssetStoragePath } from "./contentAddressedAssets.mjs";
4
- import { createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetStoragePath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri } from "./assetStorageLayout.mjs";
4
+ import { CONTENT_ADDRESSED_ASSET_PREFIX, getContentAddressedAssetStoragePath } from "./contentAddressedAssets.mjs";
5
+ import { createStorageUriWithRelativePath, getAssetStorageLayout, getManifestAssetDownloadPath, getManifestAssetStoragePath, isBrotliManifestAssetPath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri } from "./assetStorageLayout.mjs";
5
6
  import { bundleIdMatchesFilter, bundleMatchesQueryWhere, sortBundles } from "./queryBundles.mjs";
6
7
  import { createDatabasePlugin } from "./createDatabasePlugin.mjs";
7
8
  import { semverSatisfies } from "./semverSatisfies.mjs";
@@ -17,4 +18,4 @@ import { parseStorageUri } from "./parseStorageUri.mjs";
17
18
  import { assertNodeStoragePlugin, assertRuntimeStoragePlugin, isNodeStoragePlugin, isRuntimeStoragePlugin } from "./storageProfile.mjs";
18
19
  import { supportedIosPlatforms } from "./types/index.mjs";
19
20
  import { createUUIDv7, createUUIDv7WithSameTimestamp, extractTimestampFromUUIDv7 } from "./uuidv7.mjs";
20
- export { assertNodeStoragePlugin, assertRuntimeStoragePlugin, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createDatabasePlugin, createNodeStoragePlugin, createRequestUpdateBundleResolver, createRuntimeStoragePlugin, createStorageKeyBuilder, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7WithSameTimestamp, createUniversalStoragePlugin, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getAssetStorageLayout, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetStoragePath, getRequestUpdateBundleSeeds, isContentAddressedAssetBaseStorageUri, isNodeStoragePlugin, isRuntimeStoragePlugin, paginateBundles, parseStorageUri, resolveManifestAssetStorageUri, resolveUpdateInfoFromBundles, semverSatisfies, sortBundles, supportedIosPlatforms };
21
+ export { BUNDLE_STORAGE_PREFIX, CONTENT_ADDRESSED_ASSET_PREFIX, assertNodeStoragePlugin, assertRuntimeStoragePlugin, bundleIdMatchesFilter, bundleMatchesQueryWhere, calculatePagination, createBlobDatabasePlugin, createBundleStorageKey, createDatabasePlugin, createNodeStoragePlugin, createRequestUpdateBundleResolver, createRuntimeStoragePlugin, createStorageKeyBuilder, createStorageRootUriWithPath, createStorageUriWithRelativePath, createUUIDv7, createUUIDv7WithSameTimestamp, createUniversalStoragePlugin, detectCompressionFormat, extractTimestampFromUUIDv7, filterCompatibleAppVersions, generateMinBundleId, getAssetStorageLayout, getCompressionMimeType, getContentAddressedAssetStoragePath, getContentType, getManifestAssetDownloadPath, getManifestAssetStoragePath, getRequestUpdateBundleSeeds, isBrotliManifestAssetPath, isContentAddressedAssetBaseStorageUri, isNodeStoragePlugin, isRuntimeStoragePlugin, paginateBundles, parseStorageUri, resolveManifestAssetStorageUri, resolveUpdateInfoFromBundles, semverSatisfies, sortBundles, supportedIosPlatforms };
@@ -1,11 +1,10 @@
1
- const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
- let semver = require("semver");
3
- semver = require_runtime.__toESM(semver);
1
+ require("./_virtual/_rolldown/runtime.cjs");
2
+ let verkit = require("verkit");
4
3
  //#region src/semverSatisfies.ts
5
4
  const semverSatisfies = (targetAppVersion, currentVersion) => {
6
- const currentCoerce = semver.default.coerce(currentVersion);
5
+ const currentCoerce = (0, verkit.coerce)(currentVersion);
7
6
  if (!currentCoerce) return false;
8
- return semver.default.satisfies(currentCoerce.version, targetAppVersion);
7
+ return (0, verkit.satisfies)(currentCoerce, targetAppVersion);
9
8
  };
10
9
  //#endregion
11
10
  exports.semverSatisfies = semverSatisfies;
@@ -1,9 +1,9 @@
1
- import semver from "semver";
1
+ import { coerce, satisfies } from "verkit";
2
2
  //#region src/semverSatisfies.ts
3
3
  const semverSatisfies = (targetAppVersion, currentVersion) => {
4
- const currentCoerce = semver.coerce(currentVersion);
4
+ const currentCoerce = coerce(currentVersion);
5
5
  if (!currentCoerce) return false;
6
- return semver.satisfies(currentCoerce.version, targetAppVersion);
6
+ return satisfies(currentCoerce, targetAppVersion);
7
7
  };
8
8
  //#endregion
9
9
  export { semverSatisfies };
@@ -279,6 +279,13 @@ interface RequestEnvContext<TEnv = unknown> {
279
279
  }
280
280
  type HotUpdaterContext<TContext = unknown> = TContext;
281
281
  type StorageResolveContext<TContext = unknown> = HotUpdaterContext<TContext>;
282
+ interface StorageObject {
283
+ /** Object key relative to the storage plugin's configured base path. */
284
+ key: string;
285
+ storageUri: string;
286
+ size: number;
287
+ lastModifiedAt?: Date;
288
+ }
282
289
  interface NodeStorageProfile {
283
290
  upload: (key: string, filePath: string) => Promise<{
284
291
  storageUri: string;
@@ -291,6 +298,13 @@ interface NodeStorageProfile {
291
298
  exists: (storageUri: string) => Promise<boolean>;
292
299
  delete: (storageUri: string) => Promise<void>;
293
300
  downloadFile: (storageUri: string, filePath: string) => Promise<void>;
301
+ /**
302
+ * Optional management capabilities used by storage garbage collection.
303
+ * Object keys are relative to the configured storage base path.
304
+ * `deleteObjects` must delete only the exact keys it receives.
305
+ */
306
+ listObjects?: (prefix?: string) => Promise<StorageObject[]>;
307
+ deleteObjects?: (keys: readonly string[]) => Promise<void>;
294
308
  }
295
309
  interface RuntimeStorageProfile<TContext = unknown> {
296
310
  getDownloadUrl: (storageUri: string, context?: StorageResolveContext<TContext>) => Promise<{
@@ -521,4 +535,4 @@ interface NativeBuildOptions {
521
535
  scheme?: string;
522
536
  }
523
537
  //#endregion
524
- export { type AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintExtraSources, type FingerprintGetBundlesArgs, type GetBundlesArgs$1 as GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, type Platform$1 as Platform, PlatformConfig, RequestEnvContext, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, type UpdateInfo$1 as UpdateInfo, supportedIosPlatforms };
538
+ export { type AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintExtraSources, type FingerprintGetBundlesArgs, type GetBundlesArgs$1 as GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, type Platform$1 as Platform, PlatformConfig, RequestEnvContext, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StorageObject, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, type UpdateInfo$1 as UpdateInfo, supportedIosPlatforms };
@@ -279,6 +279,13 @@ interface RequestEnvContext<TEnv = unknown> {
279
279
  }
280
280
  type HotUpdaterContext<TContext = unknown> = TContext;
281
281
  type StorageResolveContext<TContext = unknown> = HotUpdaterContext<TContext>;
282
+ interface StorageObject {
283
+ /** Object key relative to the storage plugin's configured base path. */
284
+ key: string;
285
+ storageUri: string;
286
+ size: number;
287
+ lastModifiedAt?: Date;
288
+ }
282
289
  interface NodeStorageProfile {
283
290
  upload: (key: string, filePath: string) => Promise<{
284
291
  storageUri: string;
@@ -291,6 +298,13 @@ interface NodeStorageProfile {
291
298
  exists: (storageUri: string) => Promise<boolean>;
292
299
  delete: (storageUri: string) => Promise<void>;
293
300
  downloadFile: (storageUri: string, filePath: string) => Promise<void>;
301
+ /**
302
+ * Optional management capabilities used by storage garbage collection.
303
+ * Object keys are relative to the configured storage base path.
304
+ * `deleteObjects` must delete only the exact keys it receives.
305
+ */
306
+ listObjects?: (prefix?: string) => Promise<StorageObject[]>;
307
+ deleteObjects?: (keys: readonly string[]) => Promise<void>;
294
308
  }
295
309
  interface RuntimeStorageProfile<TContext = unknown> {
296
310
  getDownloadUrl: (storageUri: string, context?: StorageResolveContext<TContext>) => Promise<{
@@ -521,4 +535,4 @@ interface NativeBuildOptions {
521
535
  scheme?: string;
522
536
  }
523
537
  //#endregion
524
- export { type AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintExtraSources, type FingerprintGetBundlesArgs, type GetBundlesArgs$1 as GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, type Platform$1 as Platform, PlatformConfig, RequestEnvContext, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, type UpdateInfo$1 as UpdateInfo, supportedIosPlatforms };
538
+ export { type AppVersionGetBundlesArgs, ApplePlatform, BasePluginArgs, BuildPlugin, BuildPluginConfig, type Bundle$1 as Bundle, ConfigInput, DatabaseBundleCursor, DatabaseBundleIdFilter, DatabaseBundleQueryOptions, DatabaseBundleQueryOrder, DatabaseBundleQueryWhere, DatabasePlugin, DatabasePluginHooks, FingerprintExtraSources, type FingerprintGetBundlesArgs, type GetBundlesArgs$1 as GetBundlesArgs, HotUpdaterContext, IosBuildDestination, NativeBuildAndroidScheme, NativeBuildArgs, NativeBuildIosScheme, NativeBuildOptions, NodeStoragePlugin, NodeStorageProfile, Paginated, PaginatedResult, PaginationInfo, type Platform$1 as Platform, PlatformConfig, RequestEnvContext, RuntimeStoragePlugin, RuntimeStorageProfile, SigningConfig, StorageObject, StoragePlugin, StoragePluginHooks, StoragePluginProfiles, StorageResolveContext, UniversalStoragePlugin, type UpdateInfo$1 as UpdateInfo, supportedIosPlatforms };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/plugin-core",
3
- "version": "0.35.11",
3
+ "version": "0.36.0",
4
4
  "type": "module",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "sideEffects": false,
@@ -44,16 +44,15 @@
44
44
  "dependencies": {
45
45
  "es-toolkit": "^1.32.0",
46
46
  "mime": "^4.0.4",
47
- "semver": "^7.7.2",
48
- "@hot-updater/core": "0.35.11",
49
- "@hot-updater/js": "0.35.11"
47
+ "verkit": "0.3.2",
48
+ "@hot-updater/core": "0.36.0",
49
+ "@hot-updater/js": "0.36.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/node": "^20",
53
- "@types/semver": "^7.5.8",
54
53
  "@typescript/native": "npm:typescript@7.0.2",
55
54
  "typescript": "npm:@typescript/typescript6@6.0.2",
56
- "@hot-updater/test-utils": "0.35.11"
55
+ "@hot-updater/test-utils": "0.36.0"
57
56
  },
58
57
  "scripts": {
59
58
  "build": "tsdown",