@hot-updater/react-native 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 (181) hide show
  1. package/android/proguard-rules.pro +2 -2
  2. package/android/src/main/java/com/hotupdater/BuiltInAssetResolver.kt +286 -0
  3. package/android/src/main/java/com/hotupdater/BundleFileStorageService.kt +650 -636
  4. package/android/src/main/java/com/hotupdater/BundleMetadata.kt +3 -0
  5. package/android/src/main/java/com/hotupdater/HotUpdaterException.kt +0 -13
  6. package/android/src/main/java/com/hotupdater/HotUpdaterImpl.kt +10 -14
  7. package/android/src/main/java/com/hotupdater/OkHttpDownloadService.kt +19 -0
  8. package/android/src/main/java/com/hotupdater/TarArchiveInputStream.kt +214 -375
  9. package/android/src/main/java/com/hotupdater/TarBrArchiveExtractor.kt +119 -0
  10. package/android/src/newarch/HotUpdater.kt +7 -9
  11. package/android/src/newarch/HotUpdaterModule.kt +40 -20
  12. package/android/src/oldarch/HotUpdater.kt +7 -9
  13. package/android/src/oldarch/HotUpdaterModule.kt +40 -20
  14. package/android/src/test/java/com/hotupdater/BundleFileStorageServiceTest.kt +1126 -74
  15. package/android/src/test/java/com/hotupdater/HotUpdaterImplTest.kt +4 -5
  16. package/android/src/test/java/com/hotupdater/TarBrArchiveExtractorTest.kt +206 -0
  17. package/ios/HotUpdater/Internal/BrotliFileDecompressor.swift +167 -0
  18. package/ios/HotUpdater/Internal/BuiltInAssetResolver.swift +196 -0
  19. package/ios/HotUpdater/Internal/BundleFileStorageService.swift +773 -1016
  20. package/ios/HotUpdater/Internal/BundleMetadata.swift +5 -0
  21. package/ios/HotUpdater/Internal/FileUtilities.swift +64 -0
  22. package/ios/HotUpdater/Internal/HotUpdater-Bridging-Header.h +0 -1
  23. package/ios/HotUpdater/Internal/HotUpdater.mm +5 -27
  24. package/ios/HotUpdater/Internal/HotUpdaterImpl.swift +47 -31
  25. package/ios/HotUpdater/Internal/NotificationExtension.swift +0 -2
  26. package/ios/HotUpdater/Internal/TarArchiveExtractor.swift +182 -311
  27. package/ios/HotUpdater/Internal/URLSessionDownloadService.swift +13 -72
  28. package/lib/commonjs/checkForUpdate.js +7 -10
  29. package/lib/commonjs/checkForUpdate.js.map +1 -1
  30. package/lib/commonjs/checkForUpdate.releaseCatalog.spec.js +9 -4
  31. package/lib/commonjs/checkForUpdate.releaseCatalog.spec.js.map +1 -1
  32. package/lib/commonjs/error.js +4 -13
  33. package/lib/commonjs/error.js.map +1 -1
  34. package/lib/commonjs/fetchJSON.js +9 -2
  35. package/lib/commonjs/fetchJSON.js.map +1 -1
  36. package/lib/commonjs/httpClient.js +44 -27
  37. package/lib/commonjs/httpClient.js.map +1 -1
  38. package/lib/commonjs/httpClient.spec.js +57 -5
  39. package/lib/commonjs/httpClient.spec.js.map +1 -1
  40. package/lib/commonjs/index.js +2 -6
  41. package/lib/commonjs/index.js.map +1 -1
  42. package/lib/commonjs/native.js +7 -8
  43. package/lib/commonjs/native.js.map +1 -1
  44. package/lib/commonjs/native.spec.js +21 -16
  45. package/lib/commonjs/native.spec.js.map +1 -1
  46. package/lib/commonjs/notifyAppReadyInsights.boundary.spec.js +7 -0
  47. package/lib/commonjs/notifyAppReadyInsights.boundary.spec.js.map +1 -1
  48. package/lib/commonjs/notifyAppReadyInsights.js +4 -1
  49. package/lib/commonjs/notifyAppReadyInsights.js.map +1 -1
  50. package/lib/commonjs/notifyAppReadyInsights.spec.js +59 -0
  51. package/lib/commonjs/notifyAppReadyInsights.spec.js.map +1 -1
  52. package/lib/commonjs/notifyAppReadyInsights.transport.spec.js +7 -0
  53. package/lib/commonjs/notifyAppReadyInsights.transport.spec.js.map +1 -1
  54. package/lib/commonjs/sdkVersion.js +1 -1
  55. package/lib/commonjs/specs/NativeHotUpdater.js.map +1 -1
  56. package/lib/commonjs/store.js +3 -10
  57. package/lib/commonjs/store.js.map +1 -1
  58. package/lib/commonjs/store.notification.spec.js +12 -4
  59. package/lib/commonjs/store.notification.spec.js.map +1 -1
  60. package/lib/commonjs/store.spec.js +2 -136
  61. package/lib/commonjs/store.spec.js.map +1 -1
  62. package/lib/commonjs/wrap.js +1 -3
  63. package/lib/commonjs/wrap.js.map +1 -1
  64. package/lib/commonjs/wrap.spec.js +7 -0
  65. package/lib/commonjs/wrap.spec.js.map +1 -1
  66. package/lib/module/checkForUpdate.js +7 -10
  67. package/lib/module/checkForUpdate.js.map +1 -1
  68. package/lib/module/checkForUpdate.releaseCatalog.spec.js +9 -4
  69. package/lib/module/checkForUpdate.releaseCatalog.spec.js.map +1 -1
  70. package/lib/module/error.js +4 -13
  71. package/lib/module/error.js.map +1 -1
  72. package/lib/module/fetchJSON.js +7 -1
  73. package/lib/module/fetchJSON.js.map +1 -1
  74. package/lib/module/httpClient.js +46 -29
  75. package/lib/module/httpClient.js.map +1 -1
  76. package/lib/module/httpClient.spec.js +57 -5
  77. package/lib/module/httpClient.spec.js.map +1 -1
  78. package/lib/module/index.js +2 -6
  79. package/lib/module/index.js.map +1 -1
  80. package/lib/module/native.js +7 -8
  81. package/lib/module/native.js.map +1 -1
  82. package/lib/module/native.spec.js +21 -16
  83. package/lib/module/native.spec.js.map +1 -1
  84. package/lib/module/notifyAppReadyInsights.boundary.spec.js +7 -0
  85. package/lib/module/notifyAppReadyInsights.boundary.spec.js.map +1 -1
  86. package/lib/module/notifyAppReadyInsights.js +5 -2
  87. package/lib/module/notifyAppReadyInsights.js.map +1 -1
  88. package/lib/module/notifyAppReadyInsights.spec.js +59 -0
  89. package/lib/module/notifyAppReadyInsights.spec.js.map +1 -1
  90. package/lib/module/notifyAppReadyInsights.transport.spec.js +7 -0
  91. package/lib/module/notifyAppReadyInsights.transport.spec.js.map +1 -1
  92. package/lib/module/sdkVersion.js +1 -1
  93. package/lib/module/specs/NativeHotUpdater.js.map +1 -1
  94. package/lib/module/store.js +3 -10
  95. package/lib/module/store.js.map +1 -1
  96. package/lib/module/store.notification.spec.js +12 -4
  97. package/lib/module/store.notification.spec.js.map +1 -1
  98. package/lib/module/store.spec.js +2 -136
  99. package/lib/module/store.spec.js.map +1 -1
  100. package/lib/module/wrap.js +1 -3
  101. package/lib/module/wrap.js.map +1 -1
  102. package/lib/module/wrap.spec.js +7 -0
  103. package/lib/module/wrap.spec.js.map +1 -1
  104. package/lib/typescript/commonjs/checkForUpdate.d.ts +1 -2
  105. package/lib/typescript/commonjs/checkForUpdate.d.ts.map +1 -1
  106. package/lib/typescript/commonjs/error.d.ts +4 -13
  107. package/lib/typescript/commonjs/error.d.ts.map +1 -1
  108. package/lib/typescript/commonjs/fetchJSON.d.ts +4 -0
  109. package/lib/typescript/commonjs/fetchJSON.d.ts.map +1 -1
  110. package/lib/typescript/commonjs/httpClient.d.ts.map +1 -1
  111. package/lib/typescript/commonjs/index.d.ts +0 -2
  112. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  113. package/lib/typescript/commonjs/native.d.ts +1 -6
  114. package/lib/typescript/commonjs/native.d.ts.map +1 -1
  115. package/lib/typescript/commonjs/notifyAppReadyInsights.d.ts +1 -1
  116. package/lib/typescript/commonjs/notifyAppReadyInsights.d.ts.map +1 -1
  117. package/lib/typescript/commonjs/sdkVersion.d.ts +1 -1
  118. package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts +8 -35
  119. package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts.map +1 -1
  120. package/lib/typescript/commonjs/store.d.ts +1 -3
  121. package/lib/typescript/commonjs/store.d.ts.map +1 -1
  122. package/lib/typescript/commonjs/wrap.d.ts.map +1 -1
  123. package/lib/typescript/commonjs/wrap.types.d.ts +0 -2
  124. package/lib/typescript/commonjs/wrap.types.d.ts.map +1 -1
  125. package/lib/typescript/module/checkForUpdate.d.ts +1 -2
  126. package/lib/typescript/module/checkForUpdate.d.ts.map +1 -1
  127. package/lib/typescript/module/error.d.ts +4 -13
  128. package/lib/typescript/module/error.d.ts.map +1 -1
  129. package/lib/typescript/module/fetchJSON.d.ts +4 -0
  130. package/lib/typescript/module/fetchJSON.d.ts.map +1 -1
  131. package/lib/typescript/module/httpClient.d.ts.map +1 -1
  132. package/lib/typescript/module/index.d.ts +0 -2
  133. package/lib/typescript/module/index.d.ts.map +1 -1
  134. package/lib/typescript/module/native.d.ts +1 -6
  135. package/lib/typescript/module/native.d.ts.map +1 -1
  136. package/lib/typescript/module/notifyAppReadyInsights.d.ts +1 -1
  137. package/lib/typescript/module/notifyAppReadyInsights.d.ts.map +1 -1
  138. package/lib/typescript/module/sdkVersion.d.ts +1 -1
  139. package/lib/typescript/module/specs/NativeHotUpdater.d.ts +8 -35
  140. package/lib/typescript/module/specs/NativeHotUpdater.d.ts.map +1 -1
  141. package/lib/typescript/module/store.d.ts +1 -3
  142. package/lib/typescript/module/store.d.ts.map +1 -1
  143. package/lib/typescript/module/wrap.d.ts.map +1 -1
  144. package/lib/typescript/module/wrap.types.d.ts +0 -2
  145. package/lib/typescript/module/wrap.types.d.ts.map +1 -1
  146. package/package.json +3 -3
  147. package/src/checkForUpdate.releaseCatalog.spec.ts +10 -4
  148. package/src/checkForUpdate.ts +5 -11
  149. package/src/error.ts +4 -14
  150. package/src/fetchJSON.ts +12 -1
  151. package/src/httpClient.spec.ts +70 -5
  152. package/src/httpClient.ts +67 -53
  153. package/src/index.ts +1 -5
  154. package/src/native.spec.ts +23 -16
  155. package/src/native.ts +12 -24
  156. package/src/notifyAppReadyInsights.boundary.spec.ts +8 -0
  157. package/src/notifyAppReadyInsights.spec.ts +60 -0
  158. package/src/notifyAppReadyInsights.transport.spec.ts +8 -0
  159. package/src/notifyAppReadyInsights.ts +13 -1
  160. package/src/sdkVersion.ts +1 -1
  161. package/src/specs/NativeHotUpdater.ts +8 -36
  162. package/src/store.notification.spec.ts +13 -3
  163. package/src/store.spec.ts +0 -157
  164. package/src/store.ts +2 -23
  165. package/src/wrap.spec.ts +8 -0
  166. package/src/wrap.tsx +0 -2
  167. package/src/wrap.types.ts +0 -2
  168. package/android/src/main/java/com/hotupdater/DecompressService.kt +0 -89
  169. package/android/src/main/java/com/hotupdater/DecompressionStrategy.kt +0 -26
  170. package/android/src/main/java/com/hotupdater/TarBrDecompressionStrategy.kt +0 -117
  171. package/android/src/main/java/com/hotupdater/TarGzDecompressionStrategy.kt +0 -117
  172. package/android/src/main/java/com/hotupdater/ZipDecompressionStrategy.kt +0 -192
  173. package/android/src/test/java/com/hotupdater/TarArchiveInputStreamTest.kt +0 -68
  174. package/ios/HotUpdater/Internal/ArchiveExtractionUtilities.swift +0 -178
  175. package/ios/HotUpdater/Internal/DecompressService.swift +0 -112
  176. package/ios/HotUpdater/Internal/DecompressionStrategy.swift +0 -22
  177. package/ios/HotUpdater/Internal/StreamingTarArchiveExtractor.swift +0 -370
  178. package/ios/HotUpdater/Internal/TarBrDecompressionStrategy.swift +0 -39
  179. package/ios/HotUpdater/Internal/TarGzDecompressionStrategy.swift +0 -59
  180. package/ios/HotUpdater/Internal/ZipArchiveExtractor.swift +0 -482
  181. package/ios/HotUpdater/Internal/ZipDecompressionStrategy.swift +0 -56
@@ -1,10 +1,8 @@
1
1
  import type { HotUpdaterDiffProgressDetails } from "./native";
2
2
  export type HotUpdaterState = {
3
3
  progress: number;
4
- downloadedBytes: number | undefined;
5
- totalBytes: number | undefined;
6
4
  isUpdateDownloaded: boolean;
7
- artifactType: "archive" | "diff" | null;
5
+ artifactType: "diff" | null;
8
6
  details: HotUpdaterDiffProgressDetails | null;
9
7
  };
10
8
  export declare const hotUpdaterStore: {
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,6BAA6B,EAE9B,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,YAAY,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;IACxC,OAAO,EAAE,6BAA6B,GAAG,IAAI,CAAC;CAC/C,CAAC;AAkMF,eAAO,MAAM,eAAe;;yBAnEE,OAAO,CAAC,eAAe,CAAC;0BAuDvB,MAAM,IAAI;CAYa,CAAC;AAEvD,eAAO,MAAM,kBAAkB,GAAI,CAAC,GAAG,eAAe,aAC1C,CAAC,QAAQ,EAAE,eAAe,KAAK,CAAC,MAQ3C,CAAC"}
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,6BAA6B,EAE9B,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,6BAA6B,GAAG,IAAI,CAAC;CAC/C,CAAC;AA+KF,eAAO,MAAM,eAAe;;yBApDE,OAAO,CAAC,eAAe,CAAC;0BAwCvB,MAAM,IAAI;CAYa,CAAC;AAEvD,eAAO,MAAM,kBAAkB,GAAI,CAAC,GAAG,eAAe,aAC1C,CAAC,QAAQ,EAAE,eAAe,KAAK,CAAC,MAQ3C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../../src/wrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAOnD,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EAEpB,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,iBAAiB,EACjB,gCAAgC,EAChC,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AAEtB,wBAAgB,IAAI,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAEvD;AAED,wBAAgB,IAAI,CAClB,OAAO,EAAE,mBAAmB,GAC3B,CAAC,CAAC,SAAS,MAAM,EAClB,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KACrC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAyH1B"}
1
+ {"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../../src/wrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAOnD,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EAEpB,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,iBAAiB,EACjB,gCAAgC,EAChC,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AAEtB,wBAAgB,IAAI,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAEvD;AAED,wBAAgB,IAAI,CAClB,OAAO,EAAE,mBAAmB,GAC3B,CAAC,CAAC,SAAS,MAAM,EAClB,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KACrC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAuH1B"}
@@ -14,8 +14,6 @@ export type UpdateStatus = "CHECK_FOR_UPDATE" | "UPDATING" | "UPDATE_PROCESS_COM
14
14
  export type HotUpdaterFallbackComponentProps = {
15
15
  status: Exclude<UpdateStatus, "UPDATE_PROCESS_COMPLETED">;
16
16
  progress: number;
17
- downloadedBytes: HotUpdaterState["downloadedBytes"];
18
- totalBytes: HotUpdaterState["totalBytes"];
19
17
  message: string | null;
20
18
  artifactType: HotUpdaterState["artifactType"];
21
19
  details: HotUpdaterState["details"];
@@ -1 +1 @@
1
- {"version":3,"file":"wrap.types.d.ts","sourceRoot":"","sources":["../../../src/wrap.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,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,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,wBAAwB,CAAC,EAAE,CAAC,QAAQ,EAAE,wBAAwB,KAAK,IAAI,CAAC;CACzE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAExD,MAAM,MAAM,mBAAmB,GAAG,yBAAyB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/react-native",
3
- "version": "1.0.0-rc.14",
3
+ "version": "1.0.0-rc.15",
4
4
  "description": "React Native OTA solution for self-hosted",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/commonjs/index.js",
@@ -120,8 +120,8 @@
120
120
  },
121
121
  "dependencies": {
122
122
  "use-sync-external-store": "1.5.0",
123
- "@hot-updater/core": "1.0.0-rc.14",
124
- "@hot-updater/plugin-core": "1.0.0-rc.14"
123
+ "@hot-updater/core": "1.0.0-rc.15",
124
+ "@hot-updater/plugin-core": "1.0.0-rc.15"
125
125
  },
126
126
  "scripts": {
127
127
  "build": "node ./scripts/sync-sdk-version.mjs run -- bob build",
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  createReleaseCatalogScopeKey,
3
3
  encodeChannelKey,
4
+ type ArtifactInfo,
4
5
  type PersistedSelectionReceipt,
5
6
  type ReleaseCatalog,
6
7
  } from "@hot-updater/core";
@@ -77,10 +78,14 @@ const createCatalog = (
77
78
 
78
79
  const createClient = (catalog = createCatalog()) => {
79
80
  const fetchReleaseCatalog = vi.fn(async () => catalog);
80
- const resolveArtifact = vi.fn(async () => ({
81
- fileHash: "bundle-hash",
82
- fileUrl: "https://updates.example.com/bundle.zip",
83
- }));
81
+ const artifact: ArtifactInfo = {
82
+ artifactProtocolVersion: 1,
83
+ assets: {},
84
+ manifestFileHash: "manifest-hash",
85
+ manifestUrl: "https://updates.example.com/manifest.json",
86
+ archiveUrl: "https://updates.example.com/bundle.tar.br",
87
+ };
88
+ const resolveArtifact = vi.fn(async () => artifact);
84
89
  const sendInsightsEvent = vi.fn(async () => undefined);
85
90
  const session = {
86
91
  fetchReleaseCatalog,
@@ -199,6 +204,7 @@ describe("checkForUpdate Release catalog protocol", () => {
199
204
  expect(mocks.updateBundle).toHaveBeenCalledWith(
200
205
  expect.objectContaining({
201
206
  bundleId: TARGET_BUNDLE_ID,
207
+ archiveUrl: "https://updates.example.com/bundle.tar.br",
202
208
  selection: expect.objectContaining({
203
209
  catalogId: CATALOG_ID,
204
210
  releaseId: RELEASE_ID,
@@ -3,7 +3,6 @@ import {
3
3
  createReleaseSelectionContextHash,
4
4
  encodeChannelKey,
5
5
  selectDesiredRelease,
6
- type ArtifactInfo,
7
6
  type PersistedSelectionReceipt,
8
7
  type ReleaseCatalog,
9
8
  } from "@hot-updater/core";
@@ -61,7 +60,7 @@ export interface CheckForUpdateOptions {
61
60
  requestTimeout?: number;
62
61
  }
63
62
 
64
- export type CheckForUpdateResult = ArtifactInfo & {
63
+ export type CheckForUpdateResult = {
65
64
  readonly id: string;
66
65
  readonly message: string | null;
67
66
  readonly rolloutCohortCount: number;
@@ -122,10 +121,8 @@ const resetProgress = () => {
122
121
  hotUpdaterStore.setState({
123
122
  artifactType: null,
124
123
  details: null,
125
- downloadedBytes: undefined,
126
124
  isUpdateDownloaded: false,
127
125
  progress: 0,
128
- totalBytes: undefined,
129
126
  });
130
127
  };
131
128
 
@@ -367,13 +364,12 @@ async function checkForReleaseCatalogUpdate(input: {
367
364
  throw new StaleReleaseCatalogError();
368
365
  }
369
366
  const downloaded = await updateBundle({
367
+ assets: artifact.assets,
370
368
  bundleId: desired.bundleId,
371
- changedAssets: artifact.changedAssets ?? null,
372
369
  channel: input.targetChannel,
373
- fileHash: artifact.fileHash,
374
- fileUrl: artifact.fileUrl,
375
- manifestFileHash: artifact.manifestFileHash ?? null,
376
- manifestUrl: artifact.manifestUrl ?? null,
370
+ manifestFileHash: artifact.manifestFileHash,
371
+ manifestUrl: artifact.manifestUrl,
372
+ ...(artifact.archiveUrl ? { archiveUrl: artifact.archiveUrl } : {}),
377
373
  selection: receipt,
378
374
  shouldSkipCurrentBundleIdCheck: true,
379
375
  status: desired.status,
@@ -397,8 +393,6 @@ async function checkForReleaseCatalogUpdate(input: {
397
393
  };
398
394
 
399
395
  return {
400
- fileHash: null,
401
- fileUrl: null,
402
396
  id: desired.releaseId ?? desired.bundleId,
403
397
  message: release?.message ?? null,
404
398
  releaseId: desired.releaseId,
package/src/error.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Error Classification:
9
9
  * - Parameter Validation: Invalid or missing function parameters
10
- * - Bundle Storage: Errors during download, extraction, and storage
10
+ * - Bundle Storage: Errors during download, verification, and storage
11
11
  * - Signature Verification: Cryptographic verification failures (collapsed to a single public code)
12
12
  * - Internal: Platform-specific or unexpected errors
13
13
  *
@@ -27,8 +27,7 @@ export enum HotUpdaterErrorCode {
27
27
  MISSING_BUNDLE_ID = "MISSING_BUNDLE_ID",
28
28
 
29
29
  /**
30
- * File URL is invalid or malformed.
31
- * Thrown when fileUrl parameter cannot be parsed as a valid URL.
30
+ * Manifest or asset URL is invalid or malformed.
32
31
  * @retryable false
33
32
  */
34
33
  INVALID_FILE_URL = "INVALID_FILE_URL",
@@ -58,25 +57,16 @@ export enum HotUpdaterErrorCode {
58
57
  */
59
58
  INCOMPLETE_DOWNLOAD = "INCOMPLETE_DOWNLOAD",
60
59
 
61
- /**
62
- * Bundle archive format is invalid or corrupted.
63
- * Thrown when ZIP file has wrong magic bytes, invalid structure, or unsupported format.
64
- * Also thrown for path traversal attempts during extraction.
65
- * @retryable false - Indicates corrupted or malicious bundle
66
- */
67
- EXTRACTION_FORMAT_ERROR = "EXTRACTION_FORMAT_ERROR",
68
-
69
60
  /**
70
61
  * Bundle missing required platform files.
71
- * Thrown when extracted bundle doesn't contain index.android.bundle (Android)
62
+ * Thrown when the staged bundle doesn't contain index.android.bundle (Android)
72
63
  * or main.jsbundle (iOS).
73
64
  * @retryable false - Indicates incorrectly built bundle
74
65
  */
75
66
  INVALID_BUNDLE = "INVALID_BUNDLE",
76
67
 
77
68
  /**
78
- * Insufficient disk space for bundle download and extraction.
79
- * Thrown when available disk space is less than required (file size * 2).
69
+ * Insufficient disk space for bundle staging.
80
70
  * Error message includes required and available bytes.
81
71
  * @retryable false - User must free up disk space
82
72
  */
package/src/fetchJSON.ts CHANGED
@@ -1,3 +1,14 @@
1
+ export class FetchJSONResponseError extends Error {
2
+ constructor(
3
+ readonly status: number,
4
+ statusText: string,
5
+ ) {
6
+ super(
7
+ `Request failed with HTTP ${status}${statusText ? ` ${statusText}` : ""}`,
8
+ );
9
+ }
10
+ }
11
+
1
12
  export const fetchJSON = async <T>({
2
13
  url,
3
14
  requestHeaders,
@@ -19,7 +30,7 @@ export const fetchJSON = async <T>({
19
30
  signal: controller.signal,
20
31
  });
21
32
  if (response.status !== 200) {
22
- throw new Error(response.statusText);
33
+ throw new FetchJSONResponseError(response.status, response.statusText);
23
34
  }
24
35
  return (await response.json()) as T;
25
36
  } catch (error: unknown) {
@@ -1,6 +1,7 @@
1
1
  import type { ArtifactInfo, ReleaseCatalog } from "@hot-updater/core";
2
2
  import { beforeEach, describe, expect, it, vi } from "vitest";
3
3
 
4
+ import { FetchJSONResponseError } from "./fetchJSON";
4
5
  import { createHttpClient } from "./httpClient";
5
6
 
6
7
  const mocks = vi.hoisted(() => {
@@ -18,12 +19,28 @@ vi.mock("./releaseCatalogCache", () => ({
18
19
  }));
19
20
 
20
21
  vi.mock("./fetchJSON", () => ({
22
+ FetchJSONResponseError: class FetchJSONResponseError extends Error {
23
+ constructor(
24
+ readonly status: number,
25
+ statusText: string,
26
+ ) {
27
+ super(statusText);
28
+ }
29
+ },
21
30
  fetchJSON: mocks.fetchJSON,
22
31
  }));
23
32
 
24
33
  const artifact: ArtifactInfo = {
25
- fileHash: "bundle-hash",
26
- fileUrl: "/storage/bundle.zip",
34
+ artifactProtocolVersion: 1,
35
+ assets: {
36
+ "index.ios.bundle": {
37
+ file: { url: "/storage/index.bundle.br" },
38
+ fileHash: "bundle-hash",
39
+ },
40
+ },
41
+ manifestFileHash: "manifest-hash",
42
+ manifestUrl: "/storage/manifest.json",
43
+ archiveUrl: "/storage/bundle.tar.br",
27
44
  };
28
45
 
29
46
  const catalog: ReleaseCatalog = {
@@ -93,14 +110,24 @@ describe("private HotUpdater HTTP client", () => {
93
110
  }),
94
111
  ).resolves.toEqual({
95
112
  ...artifact,
96
- fileUrl: "https://first.example.com/hot-updater/storage/bundle.zip",
113
+ assets: {
114
+ "index.ios.bundle": {
115
+ file: {
116
+ url: "https://first.example.com/hot-updater/storage/index.bundle.br",
117
+ },
118
+ fileHash: "bundle-hash",
119
+ },
120
+ },
121
+ manifestUrl:
122
+ "https://first.example.com/hot-updater/storage/manifest.json",
123
+ archiveUrl: "https://first.example.com/hot-updater/storage/bundle.tar.br",
97
124
  });
98
125
 
99
126
  expect(resolveBaseURL).toHaveBeenCalledOnce();
100
127
  expect(mocks.fetchJSON).toHaveBeenCalledWith({
101
128
  requestHeaders: undefined,
102
129
  requestTimeout: undefined,
103
- url: "https://first.example.com/hot-updater/artifacts/target/from/current",
130
+ url: "https://first.example.com/hot-updater/artifacts/v1/target/from/current",
104
131
  });
105
132
 
106
133
  await client.createSession();
@@ -110,7 +137,12 @@ describe("private HotUpdater HTTP client", () => {
110
137
  it("rejects non-storage relative artifact URLs", async () => {
111
138
  mocks.fetchJSON.mockResolvedValue({
112
139
  ...artifact,
113
- fileUrl: "/private/bundle.zip",
140
+ assets: {
141
+ "index.ios.bundle": {
142
+ file: { url: "/private/index.bundle.br" },
143
+ fileHash: "bundle-hash",
144
+ },
145
+ },
114
146
  });
115
147
  const session = await createHttpClient(
116
148
  "https://updates.example.com",
@@ -124,6 +156,39 @@ describe("private HotUpdater HTTP client", () => {
124
156
  ).rejects.toThrow("client-relative storage paths");
125
157
  });
126
158
 
159
+ it("rejects a legacy artifact response", async () => {
160
+ mocks.fetchJSON.mockResolvedValue({
161
+ fileHash: "archive-hash",
162
+ fileUrl: "/storage/bundle.zip",
163
+ });
164
+ const session = await createHttpClient(
165
+ "https://updates.example.com",
166
+ ).createSession();
167
+
168
+ await expect(
169
+ session.resolveArtifact({
170
+ currentBundleId: "current",
171
+ targetBundleId: "target",
172
+ }),
173
+ ).rejects.toThrow("does not support artifact protocol 1");
174
+ });
175
+
176
+ it("reports an old server without the v1 endpoint explicitly", async () => {
177
+ mocks.fetchJSON.mockRejectedValue(
178
+ new FetchJSONResponseError(404, "Not Found"),
179
+ );
180
+ const session = await createHttpClient(
181
+ "https://updates.example.com",
182
+ ).createSession();
183
+
184
+ await expect(
185
+ session.resolveArtifact({
186
+ currentBundleId: "current",
187
+ targetBundleId: "target",
188
+ }),
189
+ ).rejects.toThrow("does not support artifact protocol 1");
190
+ });
191
+
127
192
  it("requires a functional baseURL to resolve to a non-empty string", async () => {
128
193
  await expect(createHttpClient(() => "").createSession()).rejects.toThrow(
129
194
  "baseURL function must return a non-empty string",
package/src/httpClient.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import {
2
+ ARTIFACT_PROTOCOL_VERSION,
2
3
  encodeChannelKey,
3
4
  type ArtifactInfo,
4
5
  type ReleaseCatalog,
5
6
  } from "@hot-updater/core";
6
7
  import { canonicalizeAppVersion } from "@hot-updater/plugin-core";
7
8
 
8
- import { fetchJSON } from "./fetchJSON";
9
+ import { fetchJSON, FetchJSONResponseError } from "./fetchJSON";
9
10
  import { fetchReleaseCatalogWithCache } from "./releaseCatalogCache";
10
11
  import { HOT_UPDATER_SDK_VERSION } from "./sdkVersion";
11
12
  import type { HotUpdaterBaseURL } from "./types";
@@ -101,52 +102,54 @@ const resolveArtifactUrls = (
101
102
  info: ArtifactInfo,
102
103
  ): ArtifactInfo => ({
103
104
  ...info,
104
- fileUrl:
105
- info.fileUrl === null ? null : resolveArtifactUrl(baseURL, info.fileUrl),
106
- ...(info.manifestUrl === undefined
107
- ? {}
108
- : {
109
- manifestUrl:
110
- info.manifestUrl === null
111
- ? null
112
- : resolveArtifactUrl(baseURL, info.manifestUrl),
113
- }),
114
- ...(info.changedAssets === undefined
115
- ? {}
116
- : {
117
- changedAssets:
118
- info.changedAssets === null
119
- ? null
120
- : Object.fromEntries(
121
- Object.entries(info.changedAssets).map(([path, asset]) => [
122
- path,
123
- {
124
- ...asset,
125
- ...(asset.file
126
- ? {
127
- file: {
128
- ...asset.file,
129
- url: resolveArtifactUrl(baseURL, asset.file.url),
130
- },
131
- }
132
- : {}),
133
- ...(asset.patch
134
- ? {
135
- patch: {
136
- ...asset.patch,
137
- patchUrl: resolveArtifactUrl(
138
- baseURL,
139
- asset.patch.patchUrl,
140
- ),
141
- },
142
- }
143
- : {}),
144
- },
145
- ]),
146
- ),
147
- }),
105
+ manifestUrl: resolveArtifactUrl(baseURL, info.manifestUrl),
106
+ ...(info.archiveUrl
107
+ ? { archiveUrl: resolveArtifactUrl(baseURL, info.archiveUrl) }
108
+ : {}),
109
+ assets: Object.fromEntries(
110
+ Object.entries(info.assets).map(([path, asset]) => [
111
+ path,
112
+ {
113
+ ...asset,
114
+ file: {
115
+ ...asset.file,
116
+ url: resolveArtifactUrl(baseURL, asset.file.url),
117
+ },
118
+ ...(asset.patch
119
+ ? {
120
+ patch: {
121
+ ...asset.patch,
122
+ patchUrl: resolveArtifactUrl(baseURL, asset.patch.patchUrl),
123
+ },
124
+ }
125
+ : {}),
126
+ },
127
+ ]),
128
+ ),
148
129
  });
149
130
 
131
+ const requireArtifactProtocolV1 = (info: ArtifactInfo): ArtifactInfo => {
132
+ if (
133
+ info.artifactProtocolVersion !== ARTIFACT_PROTOCOL_VERSION ||
134
+ !info.assets ||
135
+ !info.manifestUrl ||
136
+ !info.manifestFileHash ||
137
+ (info.archiveUrl !== undefined && typeof info.archiveUrl !== "string")
138
+ ) {
139
+ throw new Error(
140
+ `Server does not support artifact protocol ${ARTIFACT_PROTOCOL_VERSION}.`,
141
+ );
142
+ }
143
+ for (const asset of Object.values(info.assets)) {
144
+ if (!asset.file?.url || !asset.fileHash) {
145
+ throw new Error(
146
+ "Artifact protocol 1 requires an original file for every asset.",
147
+ );
148
+ }
149
+ }
150
+ return info;
151
+ };
152
+
150
153
  const sendInsightsEvent = async (
151
154
  baseURL: string,
152
155
  params: InsightsEventParams,
@@ -241,14 +244,25 @@ const createSession = (baseURL: string): HotUpdaterHttpSession => ({
241
244
  });
242
245
  },
243
246
  resolveArtifact: async (params): Promise<ArtifactInfo> => {
244
- const info = await fetchJSON<ArtifactInfo>({
245
- requestHeaders: params.requestHeaders,
246
- requestTimeout: params.requestTimeout,
247
- url: `${baseURL}/artifacts/${encodeURIComponent(
248
- params.targetBundleId,
249
- )}/from/${encodeURIComponent(params.currentBundleId)}`,
250
- });
251
- return resolveArtifactUrls(baseURL, info);
247
+ let info: ArtifactInfo;
248
+ try {
249
+ info = await fetchJSON<ArtifactInfo>({
250
+ requestHeaders: params.requestHeaders,
251
+ requestTimeout: params.requestTimeout,
252
+ url: `${baseURL}/artifacts/v1/${encodeURIComponent(
253
+ params.targetBundleId,
254
+ )}/from/${encodeURIComponent(params.currentBundleId)}`,
255
+ });
256
+ } catch (error) {
257
+ if (error instanceof FetchJSONResponseError && error.status === 404) {
258
+ throw new Error(
259
+ `Server does not support artifact protocol ${ARTIFACT_PROTOCOL_VERSION}.`,
260
+ { cause: error },
261
+ );
262
+ }
263
+ throw error;
264
+ }
265
+ return resolveArtifactUrls(baseURL, requireArtifactProtocolV1(info));
252
266
  },
253
267
  sendInsightsEvent: (params) => sendInsightsEvent(baseURL, params),
254
268
  });
package/src/index.ts CHANGED
@@ -469,8 +469,6 @@ function createHotUpdaterClient() {
469
469
  *
470
470
  * @param {UpdateBundleParams} params - Parameters object required for bundle update
471
471
  * @param {string} params.bundleId - The bundle ID of the app
472
- * @param {string|null} params.fileUrl - The URL of the zip file
473
- *
474
472
  * @returns {Promise<boolean>} Whether the update was successful
475
473
  *
476
474
  * @example
@@ -500,7 +498,7 @@ function createHotUpdaterClient() {
500
498
  const state = getActiveUpdateState();
501
499
  const active = state.activeSelection;
502
500
  const downloaded = await updateBundle(params);
503
- if (downloaded && params.fileUrl !== null) {
501
+ if (downloaded) {
504
502
  const selection = getActiveUpdateState().activeSelection;
505
503
  await reportBundleDownloaded(
506
504
  { ...globalConfig, client },
@@ -535,10 +533,8 @@ function createHotUpdaterClient() {
535
533
  hotUpdaterStore.setState({
536
534
  artifactType: null,
537
535
  details: null,
538
- downloadedBytes: undefined,
539
536
  isUpdateDownloaded: false,
540
537
  progress: 0,
541
- totalBytes: undefined,
542
538
  });
543
539
  }
544
540
  return ok;
@@ -538,13 +538,20 @@ describe("notifyAppReady", () => {
538
538
  expect(getBaseURL()).toBe("file:///bundle-123");
539
539
 
540
540
  await updateBundle({
541
+ assets: {},
541
542
  bundleId: "bundle-456",
542
- fileHash: null,
543
- fileUrl: "https://example.com/bundle.zip",
543
+ archiveUrl: "https://example.com/bundle.tar.br",
544
+ manifestFileHash: "manifest-hash",
545
+ manifestUrl: "https://example.com/manifest.json",
544
546
  status: "UPDATE",
545
547
  });
546
548
 
547
549
  expect(getBundleId()).toBe("bundle-123");
550
+ expect(nativeModuleMock.updateBundle).toHaveBeenCalledWith(
551
+ expect.objectContaining({
552
+ archiveUrl: "https://example.com/bundle.tar.br",
553
+ }),
554
+ );
548
555
  expect(getManifest()).toEqual({
549
556
  assets: {},
550
557
  bundleId: "bundle-123",
@@ -571,9 +578,10 @@ describe("notifyAppReady", () => {
571
578
  const { getBundleId, updateBundle } = await import("./native");
572
579
 
573
580
  await updateBundle({
581
+ assets: {},
574
582
  bundleId: "00000000-0000-0000-0000-000000000003",
575
- fileHash: null,
576
- fileUrl: "https://example.com/bundle.zip",
583
+ manifestFileHash: "manifest-hash",
584
+ manifestUrl: "https://example.com/manifest.json",
577
585
  status: "UPDATE",
578
586
  });
579
587
 
@@ -586,9 +594,10 @@ describe("notifyAppReady", () => {
586
594
 
587
595
  await expect(
588
596
  updateBundle({
597
+ assets: {},
589
598
  bundleId: "00000000-0000-0000-0000-000000000003",
590
- fileHash: null,
591
- fileUrl: "https://example.com/bundle.zip",
599
+ manifestFileHash: "manifest-hash",
600
+ manifestUrl: "https://example.com/manifest.json",
592
601
  status: "UPDATE",
593
602
  }),
594
603
  ).resolves.toBe(true);
@@ -612,9 +621,10 @@ describe("notifyAppReady", () => {
612
621
  const { updateBundle } = await import("./native");
613
622
 
614
623
  await updateBundle({
624
+ assets: {},
615
625
  bundleId: "00000000-0000-0000-0000-000000000003",
616
- fileHash: null,
617
- fileUrl: "https://example.com/bundle.zip",
626
+ manifestFileHash: "manifest-hash",
627
+ manifestUrl: "https://example.com/manifest.json",
618
628
  status: "UPDATE",
619
629
  });
620
630
 
@@ -624,9 +634,10 @@ describe("notifyAppReady", () => {
624
634
 
625
635
  await expect(
626
636
  updateBundle({
637
+ assets: {},
627
638
  bundleId: "00000000-0000-0000-0000-000000000003",
628
- fileHash: null,
629
- fileUrl: "https://example.com/bundle.zip",
639
+ manifestFileHash: "manifest-hash",
640
+ manifestUrl: "https://example.com/manifest.json",
630
641
  status: "UPDATE",
631
642
  }),
632
643
  ).resolves.toBe(true);
@@ -642,7 +653,7 @@ describe("notifyAppReady", () => {
642
653
 
643
654
  await updateBundle({
644
655
  bundleId: "bundle-789",
645
- changedAssets: {
656
+ assets: {
646
657
  "index.ios.bundle": {
647
658
  file: {
648
659
  compression: "br",
@@ -658,8 +669,6 @@ describe("notifyAppReady", () => {
658
669
  },
659
670
  },
660
671
  },
661
- fileHash: "sig:archive",
662
- fileUrl: "https://example.com/bundle.zip",
663
672
  manifestFileHash: "sig:manifest",
664
673
  manifestUrl: "https://example.com/manifest.json",
665
674
  status: "UPDATE",
@@ -667,7 +676,7 @@ describe("notifyAppReady", () => {
667
676
 
668
677
  expect(nativeModuleMock.updateBundle).toHaveBeenCalledWith({
669
678
  bundleId: "bundle-789",
670
- changedAssets: {
679
+ assets: {
671
680
  "index.ios.bundle": {
672
681
  file: {
673
682
  compression: "br",
@@ -684,8 +693,6 @@ describe("notifyAppReady", () => {
684
693
  },
685
694
  },
686
695
  channel: undefined,
687
- fileHash: "sig:archive",
688
- fileUrl: "https://example.com/bundle.zip",
689
696
  manifestFileHash: "sig:manifest",
690
697
  manifestUrl: "https://example.com/manifest.json",
691
698
  });