@gfean/react-native-bundle-drop 0.4.6 → 0.6.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.
- package/README.md +168 -4
- package/android/build.gradle +1 -0
- package/android/src/main/java/com/bundledrop/BundleDropBoundedDownloader.kt +86 -0
- package/android/src/main/java/com/bundledrop/BundleDropModule.kt +69 -0
- package/android/src/main/java/com/bundledrop/BundleDropRuntimeCrypto.kt +81 -0
- package/ios/BundleDropBridge.m +18 -0
- package/ios/BundleDropLocator.swift +48 -2
- package/ios/BundleDropModule.swift +75 -0
- package/ios/BundleDropRuntimeCrypto.swift +45 -0
- package/lib/CLI/cli.d.ts +1 -0
- package/lib/CLI/cli.js +166 -79
- package/lib/CLI/scripts/aipowered/apply-setup-plan.js +7 -17
- package/lib/CLI/scripts/aipowered/backend-client.js +29 -4
- package/lib/CLI/scripts/aipowered/code-push-residue.d.ts +5 -0
- package/lib/CLI/scripts/aipowered/code-push-residue.js +126 -0
- package/lib/CLI/scripts/aipowered/credential-safety.d.ts +1 -0
- package/lib/CLI/scripts/aipowered/credential-safety.js +14 -0
- package/lib/CLI/scripts/aipowered/diff-preview.js +12 -4
- package/lib/CLI/scripts/aipowered/init-project-config.d.ts +4 -0
- package/lib/CLI/scripts/aipowered/init-project-config.js +228 -43
- package/lib/CLI/scripts/aipowered/scanner.d.ts +1 -0
- package/lib/CLI/scripts/aipowered/scanner.js +164 -32
- package/lib/CLI/scripts/aipowered/terminal-safety.d.ts +4 -0
- package/lib/CLI/scripts/aipowered/terminal-safety.js +124 -0
- package/lib/CLI/scripts/aipowered/validate-plan.d.ts +3 -0
- package/lib/CLI/scripts/aipowered/validate-plan.js +1080 -19
- package/lib/CLI/scripts/bare-metro-config.d.ts +1 -1
- package/lib/CLI/scripts/bare-metro-config.js +24 -32
- package/lib/CLI/scripts/doctor.js +143 -22
- package/lib/CLI/scripts/expo/configure-expo.js +51 -60
- package/lib/CLI/scripts/expo/package-manager.d.ts +2 -0
- package/lib/CLI/scripts/expo/package-manager.js +63 -25
- package/lib/CLI/scripts/init-config.d.ts +7 -7
- package/lib/CLI/scripts/init-config.js +246 -32
- package/lib/CLI/scripts/login-cli.js +35 -10
- package/lib/CLI/scripts/metro-config-authority.d.ts +8 -0
- package/lib/CLI/scripts/metro-config-authority.js +303 -0
- package/lib/CLI/scripts/native-entrypoint-authority.d.ts +2 -0
- package/lib/CLI/scripts/native-entrypoint-authority.js +378 -0
- package/lib/CLI/scripts/native-setup-contract.d.ts +2 -2
- package/lib/CLI/scripts/native-setup-contract.js +63 -33
- package/lib/CLI/scripts/native-startup-validator.d.ts +3 -0
- package/lib/CLI/scripts/native-startup-validator.js +964 -0
- package/lib/CLI/scripts/safe-file-transaction.d.ts +12 -0
- package/lib/CLI/scripts/safe-file-transaction.js +159 -0
- package/lib/CLI/scripts/sight-artifacts.d.ts +17 -0
- package/lib/CLI/scripts/sight-artifacts.js +204 -0
- package/lib/CLI/scripts/sight-cli.d.ts +10 -0
- package/lib/CLI/scripts/sight-cli.js +127 -0
- package/lib/CLI/scripts/sight-session.d.ts +14 -0
- package/lib/CLI/scripts/sight-session.js +192 -0
- package/lib/api/clientApi.d.ts +3 -1
- package/lib/api/clientApi.js +14 -0
- package/lib/api/types.d.ts +39 -0
- package/lib/context.d.ts +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -1
- package/lib/install/installFromZip.d.ts +3 -0
- package/lib/install/installFromZip.js +10 -1
- package/lib/loadConfig.d.ts +17 -1
- package/lib/loadConfig.js +16 -0
- package/lib/manager/downloadAndInstall.d.ts +3 -2
- package/lib/manager/downloadAndInstall.js +111 -46
- package/lib/manager/rollbackState.d.ts +3 -1
- package/lib/manager/rollbackState.js +2 -2
- package/lib/manager/updateCheck.d.ts +1 -0
- package/lib/manager/updateCheck.js +218 -78
- package/lib/metro.d.ts +8 -1
- package/lib/metro.js +68 -19
- package/lib/native/bundleDropNative.js +2 -1
- package/lib/native/fs.d.ts +6 -0
- package/lib/native/fs.js +24 -0
- package/lib/patch-engine/installFromPatchSet.d.ts +2 -0
- package/lib/patch-engine/installFromPatchSet.js +14 -3
- package/lib/patch-engine/patchTransport.d.ts +2 -0
- package/lib/patch-engine/patchTransport.js +9 -0
- package/lib/runtime/initState.d.ts +5 -0
- package/lib/runtime/initState.js +4 -0
- package/lib/runtime/service.js +60 -3
- package/lib/runtime-delivery/artifactCapability.d.ts +1 -0
- package/lib/runtime-delivery/artifactCapability.js +32 -0
- package/lib/runtime-delivery/authorityLeaseVerifier.d.ts +3 -0
- package/lib/runtime-delivery/authorityLeaseVerifier.js +106 -0
- package/lib/runtime-delivery/bootstrapConfig.d.ts +50 -0
- package/lib/runtime-delivery/bootstrapConfig.js +217 -0
- package/lib/runtime-delivery/diagnostics.d.ts +17 -0
- package/lib/runtime-delivery/diagnostics.js +58 -0
- package/lib/runtime-delivery/encoding.d.ts +5 -0
- package/lib/runtime-delivery/encoding.js +132 -0
- package/lib/runtime-delivery/heartbeat.d.ts +3 -0
- package/lib/runtime-delivery/heartbeat.js +88 -0
- package/lib/runtime-delivery/localResolver.d.ts +23 -0
- package/lib/runtime-delivery/localResolver.js +81 -0
- package/lib/runtime-delivery/manifestState.d.ts +9 -0
- package/lib/runtime-delivery/manifestState.js +102 -0
- package/lib/runtime-delivery/manifestVerifier.d.ts +13 -0
- package/lib/runtime-delivery/manifestVerifier.js +329 -0
- package/lib/runtime-delivery/runtimeDelivery.d.ts +19 -0
- package/lib/runtime-delivery/runtimeDelivery.js +375 -0
- package/lib/runtime-delivery/types.d.ts +87 -0
- package/lib/runtime-delivery/types.js +6 -0
- package/package.json +2 -2
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.openSightInBrowser = openSightInBrowser;
|
|
7
|
+
exports.startSightSession = startSightSession;
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const crypto_1 = require("crypto");
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
|
+
const http_1 = __importDefault(require("http"));
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
13
|
+
const SESSION_TIMEOUT_MS = 5 * 60 * 1000;
|
|
14
|
+
const LOOPBACK_HOST = '127.0.0.1';
|
|
15
|
+
function sessionFragment(port, token) {
|
|
16
|
+
const payload = Buffer.from(JSON.stringify({ version: 1, port, token }), 'utf8')
|
|
17
|
+
.toString('base64url');
|
|
18
|
+
return `sight-session=${payload}`;
|
|
19
|
+
}
|
|
20
|
+
function multipartHeader(boundary, field, filePath) {
|
|
21
|
+
const filename = path_1.default.basename(filePath).replace(/["\r\n]/g, '_');
|
|
22
|
+
return Buffer.from(`--${boundary}\r\n` +
|
|
23
|
+
`Content-Disposition: form-data; name="${field}"; filename="${filename}"\r\n` +
|
|
24
|
+
'Content-Type: application/octet-stream\r\n\r\n', 'utf8');
|
|
25
|
+
}
|
|
26
|
+
function writeFilePart(response, header, filePath, signal) {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
const input = fs_1.default.createReadStream(filePath);
|
|
29
|
+
const cleanup = () => signal.removeEventListener('abort', abort);
|
|
30
|
+
const abort = () => {
|
|
31
|
+
const reason = signal.reason instanceof Error
|
|
32
|
+
? signal.reason
|
|
33
|
+
: new Error('Sight closed the local artifact transfer.');
|
|
34
|
+
input.destroy(reason);
|
|
35
|
+
};
|
|
36
|
+
input.once('error', error => {
|
|
37
|
+
cleanup();
|
|
38
|
+
reject(error);
|
|
39
|
+
});
|
|
40
|
+
input.once('end', () => {
|
|
41
|
+
cleanup();
|
|
42
|
+
resolve();
|
|
43
|
+
});
|
|
44
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
45
|
+
response.write(header);
|
|
46
|
+
input.pipe(response, { end: false });
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function closeServer(server, sockets, force = false) {
|
|
50
|
+
return new Promise(resolve => {
|
|
51
|
+
if (!server.listening) {
|
|
52
|
+
resolve();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
server.close(() => resolve());
|
|
56
|
+
if (force) {
|
|
57
|
+
sockets.forEach(socket => socket.destroy());
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function openSightInBrowser(url) {
|
|
62
|
+
const command = process.platform === 'darwin'
|
|
63
|
+
? { file: 'open', args: [url] }
|
|
64
|
+
: process.platform === 'win32'
|
|
65
|
+
? { file: 'explorer.exe', args: [url] }
|
|
66
|
+
: { file: 'xdg-open', args: [url] };
|
|
67
|
+
return new Promise((resolve, reject) => {
|
|
68
|
+
const child = (0, child_process_1.spawn)(command.file, command.args, {
|
|
69
|
+
detached: true,
|
|
70
|
+
stdio: 'ignore',
|
|
71
|
+
windowsHide: true,
|
|
72
|
+
});
|
|
73
|
+
child.once('error', reject);
|
|
74
|
+
child.once('spawn', () => {
|
|
75
|
+
child.unref();
|
|
76
|
+
resolve();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
async function startSightSession({ artifacts, sightPageUrl, timeoutMs = SESSION_TIMEOUT_MS, }) {
|
|
81
|
+
const pageUrl = new URL(sightPageUrl);
|
|
82
|
+
const isOfficialSightPage = pageUrl.origin === 'https://bundledrop.app' && pageUrl.pathname === '/sight';
|
|
83
|
+
const isLocalSightPage = ['http:', 'https:'].includes(pageUrl.protocol) &&
|
|
84
|
+
['localhost', LOOPBACK_HOST].includes(pageUrl.hostname) &&
|
|
85
|
+
pageUrl.pathname === '/sight';
|
|
86
|
+
if (!isOfficialSightPage && !isLocalSightPage) {
|
|
87
|
+
throw new Error('Sight URL must be https://bundledrop.app/sight or a localhost development page.');
|
|
88
|
+
}
|
|
89
|
+
const allowedOrigin = pageUrl.origin;
|
|
90
|
+
const token = (0, crypto_1.randomBytes)(32).toString('hex');
|
|
91
|
+
const boundary = `bundle-drop-sight-${(0, crypto_1.randomBytes)(12).toString('hex')}`;
|
|
92
|
+
const sockets = new Set();
|
|
93
|
+
let consumed = false;
|
|
94
|
+
let settleTransfer;
|
|
95
|
+
let rejectTransfer;
|
|
96
|
+
const transfer = new Promise((resolve, reject) => {
|
|
97
|
+
settleTransfer = resolve;
|
|
98
|
+
rejectTransfer = reject;
|
|
99
|
+
});
|
|
100
|
+
const server = http_1.default.createServer(async (request, response) => {
|
|
101
|
+
const origin = request.headers.origin;
|
|
102
|
+
const isAllowedOrigin = origin === allowedOrigin;
|
|
103
|
+
if (origin && !isAllowedOrigin) {
|
|
104
|
+
response.writeHead(403).end('Origin not allowed');
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (request.method === 'OPTIONS') {
|
|
108
|
+
if (!isAllowedOrigin) {
|
|
109
|
+
response.writeHead(403).end('Origin not allowed');
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
response.writeHead(204, {
|
|
113
|
+
'Access-Control-Allow-Origin': allowedOrigin,
|
|
114
|
+
'Access-Control-Allow-Methods': 'GET, OPTIONS',
|
|
115
|
+
'Access-Control-Allow-Headers': 'Authorization',
|
|
116
|
+
'Access-Control-Allow-Private-Network': 'true',
|
|
117
|
+
Vary: 'Origin',
|
|
118
|
+
}).end();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (request.method !== 'GET' || request.url !== '/session') {
|
|
122
|
+
response.writeHead(404).end('Not found');
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (!isAllowedOrigin) {
|
|
126
|
+
response.writeHead(403).end('Origin not allowed');
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (request.headers.authorization !== `Bearer ${token}`) {
|
|
130
|
+
response.writeHead(401).end('Unauthorized');
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (consumed) {
|
|
134
|
+
response.writeHead(410).end('Session already used');
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
consumed = true;
|
|
138
|
+
const transferAbort = new AbortController();
|
|
139
|
+
const rejectPrematureClose = () => {
|
|
140
|
+
const error = new Error('Bundle Drop Sight closed before the generated files finished loading.');
|
|
141
|
+
transferAbort.abort(error);
|
|
142
|
+
rejectTransfer?.(error);
|
|
143
|
+
void closeServer(server, sockets, true);
|
|
144
|
+
};
|
|
145
|
+
request.once('aborted', rejectPrematureClose);
|
|
146
|
+
response.once('close', rejectPrematureClose);
|
|
147
|
+
response.writeHead(200, {
|
|
148
|
+
'Access-Control-Allow-Origin': allowedOrigin,
|
|
149
|
+
'Cache-Control': 'no-store',
|
|
150
|
+
Connection: 'close',
|
|
151
|
+
'Content-Type': `multipart/form-data; boundary=${boundary}`,
|
|
152
|
+
Vary: 'Origin',
|
|
153
|
+
'X-Content-Type-Options': 'nosniff',
|
|
154
|
+
});
|
|
155
|
+
try {
|
|
156
|
+
await writeFilePart(response, multipartHeader(boundary, 'bundle', artifacts.bundlePath), artifacts.bundlePath, transferAbort.signal);
|
|
157
|
+
response.write('\r\n');
|
|
158
|
+
await writeFilePart(response, multipartHeader(boundary, 'sourceMap', artifacts.sourceMapPath), artifacts.sourceMapPath, transferAbort.signal);
|
|
159
|
+
response.once('finish', () => {
|
|
160
|
+
request.removeListener('aborted', rejectPrematureClose);
|
|
161
|
+
response.removeListener('close', rejectPrematureClose);
|
|
162
|
+
settleTransfer?.();
|
|
163
|
+
});
|
|
164
|
+
response.end(`\r\n--${boundary}--\r\n`);
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
response.destroy(error instanceof Error ? error : undefined);
|
|
168
|
+
rejectTransfer?.(error instanceof Error ? error : new Error('Failed to transfer Sight artifacts.'));
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
server.on('connection', socket => {
|
|
172
|
+
sockets.add(socket);
|
|
173
|
+
socket.once('close', () => sockets.delete(socket));
|
|
174
|
+
});
|
|
175
|
+
await new Promise((resolve, reject) => {
|
|
176
|
+
server.once('error', reject);
|
|
177
|
+
server.listen(0, LOOPBACK_HOST, resolve);
|
|
178
|
+
});
|
|
179
|
+
const timeout = setTimeout(() => {
|
|
180
|
+
rejectTransfer?.(new Error('Timed out waiting for Bundle Drop Sight to load the generated files.'));
|
|
181
|
+
void closeServer(server, sockets, true);
|
|
182
|
+
}, timeoutMs);
|
|
183
|
+
timeout.unref();
|
|
184
|
+
void transfer.finally(() => clearTimeout(timeout)).catch(() => undefined);
|
|
185
|
+
const address = server.address();
|
|
186
|
+
pageUrl.hash = sessionFragment(address.port, token);
|
|
187
|
+
return {
|
|
188
|
+
sightUrl: pageUrl.toString(),
|
|
189
|
+
waitForTransfer: () => transfer,
|
|
190
|
+
close: () => closeServer(server, sockets),
|
|
191
|
+
};
|
|
192
|
+
}
|
package/lib/api/clientApi.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { AxiosResponse } from 'axios';
|
|
2
|
-
import { OtaResolveRequest, OtaResolveResponse, PublicChannelsParams, ReportInstalledPayload, ReportPatchApplyFailurePayload, ReportLocalRollbackPayload, BundleListParams, BundleListResponse } from './types';
|
|
2
|
+
import { OtaResolveRequest, OtaResolveResponse, PublicChannelsParams, ReportInstalledPayload, ReportPatchApplyFailurePayload, ReportLocalRollbackPayload, BundleListParams, BundleListResponse, OtaArtifactAuthorizationRequest, OtaActiveInstallHeartbeat } from './types';
|
|
3
|
+
export declare function postOtaActiveInstallHeartbeat(projectSlug: string, payload: OtaActiveInstallHeartbeat): Promise<AxiosResponse<void>>;
|
|
4
|
+
export declare function postOtaArtifactAuthorization(projectSlug: string, payload: OtaArtifactAuthorizationRequest): Promise<AxiosResponse<OtaResolveResponse>>;
|
|
3
5
|
export declare function postOtaResolve(projectSlug: string, payload: OtaResolveRequest): Promise<AxiosResponse<OtaResolveResponse>>;
|
|
4
6
|
export declare function getPublicChannels(params: PublicChannelsParams): Promise<AxiosResponse<string[]>>;
|
|
5
7
|
export declare function reportInstalled(projectSlug: string, hash: string, payload: ReportInstalledPayload): Promise<AxiosResponse<void>>;
|
package/lib/api/clientApi.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.postOtaActiveInstallHeartbeat = postOtaActiveInstallHeartbeat;
|
|
4
|
+
exports.postOtaArtifactAuthorization = postOtaArtifactAuthorization;
|
|
3
5
|
exports.postOtaResolve = postOtaResolve;
|
|
4
6
|
exports.getPublicChannels = getPublicChannels;
|
|
5
7
|
exports.reportInstalled = reportInstalled;
|
|
@@ -7,6 +9,18 @@ exports.reportPatchApplyFailure = reportPatchApplyFailure;
|
|
|
7
9
|
exports.reportLocalRollback = reportLocalRollback;
|
|
8
10
|
exports.getBundleList = getBundleList;
|
|
9
11
|
const client_1 = require("./client");
|
|
12
|
+
function postOtaActiveInstallHeartbeat(projectSlug, payload) {
|
|
13
|
+
return client_1.apiClient.post(`/projects/${encodeURIComponent(projectSlug)}/ota/active-install`, payload, {
|
|
14
|
+
headers: { Accept: 'application/json' },
|
|
15
|
+
timeout: 3000,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function postOtaArtifactAuthorization(projectSlug, payload) {
|
|
19
|
+
return client_1.apiClient.post(`/projects/${encodeURIComponent(projectSlug)}/ota/artifacts/authorize`, payload, {
|
|
20
|
+
headers: { Accept: 'application/json' },
|
|
21
|
+
timeout: 15000,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
10
24
|
function postOtaResolve(projectSlug, payload) {
|
|
11
25
|
return client_1.apiClient.post(`/projects/${encodeURIComponent(projectSlug)}/ota/resolve`, payload, {
|
|
12
26
|
headers: {
|
package/lib/api/types.d.ts
CHANGED
|
@@ -13,8 +13,33 @@ export type OtaResolveRequest = {
|
|
|
13
13
|
manifestVersion: 1;
|
|
14
14
|
patchAlgorithms: string[];
|
|
15
15
|
supportsContentAddressedAssets: boolean;
|
|
16
|
+
/** Present only when this runtime sends the dedicated active-install heartbeat. */
|
|
17
|
+
activeInstallHeartbeatVersion?: 1;
|
|
16
18
|
};
|
|
17
19
|
};
|
|
20
|
+
export type OtaArtifactAuthorizationRequest = {
|
|
21
|
+
channelName: string;
|
|
22
|
+
platform: string;
|
|
23
|
+
runtimeVersion: string;
|
|
24
|
+
generation: number;
|
|
25
|
+
targetReleaseRef: string;
|
|
26
|
+
targetHash: string;
|
|
27
|
+
mode: 'full' | 'patch';
|
|
28
|
+
patchArtifactRef: string | null;
|
|
29
|
+
currentHash: string | null;
|
|
30
|
+
rejectedHashes: string[];
|
|
31
|
+
installId: string;
|
|
32
|
+
transport: OtaResolveRequest['transport'];
|
|
33
|
+
};
|
|
34
|
+
export type OtaActiveInstallHeartbeat = {
|
|
35
|
+
channelName: string;
|
|
36
|
+
platform: string;
|
|
37
|
+
runtimeVersion: string;
|
|
38
|
+
installId: string;
|
|
39
|
+
currentHash: string | null;
|
|
40
|
+
environment?: string;
|
|
41
|
+
userProperties?: UserProperties;
|
|
42
|
+
};
|
|
18
43
|
export type OtaInstallTarget = {
|
|
19
44
|
bundleHash: string;
|
|
20
45
|
downloadUrl?: string;
|
|
@@ -105,6 +130,20 @@ export type UpdateCheckResponse = {
|
|
|
105
130
|
requestedRuntimeVersion?: string;
|
|
106
131
|
/** Latest runtime version available on the channel when the current runtime is incompatible. */
|
|
107
132
|
latestRuntimeVersionOnChannel?: string;
|
|
133
|
+
/** Internal runtime-delivery authorization context. */
|
|
134
|
+
runtimeDelivery?: {
|
|
135
|
+
generation: number;
|
|
136
|
+
targetReleaseRef: string;
|
|
137
|
+
selectedMode: 'full' | 'patch';
|
|
138
|
+
baseHash?: string;
|
|
139
|
+
patchAlgorithm?: string;
|
|
140
|
+
patchSetHash?: string;
|
|
141
|
+
patchArtifactRef?: string;
|
|
142
|
+
missingAssetsHash?: string | null;
|
|
143
|
+
manifestHash?: string;
|
|
144
|
+
jsBundleHash?: string;
|
|
145
|
+
fullBundleHash?: string;
|
|
146
|
+
};
|
|
108
147
|
};
|
|
109
148
|
export type ReportPatchApplyFailurePayload = {
|
|
110
149
|
platform: string;
|
package/lib/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const config: import("./loadConfig").
|
|
1
|
+
export declare const config: import("./loadConfig").ResolvedBundleDropProjectConfig;
|
|
2
2
|
export declare const platform: string;
|
|
3
3
|
export declare const isIOS: boolean;
|
|
4
4
|
export declare const runtimeVersion: string;
|
package/lib/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export type { BundleListItem } from './api/types';
|
|
|
13
13
|
export type { BundleDropProjectConfig } from './loadConfig';
|
|
14
14
|
export type { BundleDropConfig } from './context';
|
|
15
15
|
export type { BundleDropInitOptions, BundleDropRuntimeConfig } from './runtime/initState';
|
|
16
|
+
export { getRuntimeDeliveryDiagnosticCounters } from './runtime-delivery/diagnostics';
|
|
17
|
+
export type { RuntimeDeliveryDiagnosticCounters, RuntimeDeliveryDiagnosticDetails, RuntimeDeliveryDiagnosticEvent, RuntimeDeliveryDiagnosticName, } from './runtime-delivery/diagnostics';
|
|
16
18
|
export { useBundleDrop } from './useBundleDrop';
|
|
17
19
|
export type { UseBundleDropReturn } from './useBundleDrop';
|
|
18
20
|
export { bundleDropConfig } from './context';
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BundleDrop = exports.bundleDropConfig = exports.useBundleDrop = exports.resetUserProperties = exports.removeUserProperty = exports.setUserProperty = exports.getUserProperties = exports.getCurrentUserProperties = exports.isBundleDropError = exports.BundleDropError = exports.reportHealthy = exports.getChannelName = exports.setChannel = exports.applyUpdate = exports.getUpdateState = exports.installBundle = exports.downloadUpdate = exports.getAvailableBundles = exports.getObservabilityContext = exports.getInstalledBundleInfo = exports.checkForUpdate = exports.getAvailableChannels = void 0;
|
|
3
|
+
exports.BundleDrop = exports.bundleDropConfig = exports.useBundleDrop = exports.getRuntimeDeliveryDiagnosticCounters = exports.resetUserProperties = exports.removeUserProperty = exports.setUserProperty = exports.getUserProperties = exports.getCurrentUserProperties = exports.isBundleDropError = exports.BundleDropError = exports.reportHealthy = exports.getChannelName = exports.setChannel = exports.applyUpdate = exports.getUpdateState = exports.installBundle = exports.downloadUpdate = exports.getAvailableBundles = exports.getObservabilityContext = exports.getInstalledBundleInfo = exports.checkForUpdate = exports.getAvailableChannels = void 0;
|
|
4
4
|
require("./bootstrap");
|
|
5
5
|
const service_1 = require("./runtime/service");
|
|
6
6
|
var service_2 = require("./runtime/service");
|
|
@@ -26,6 +26,8 @@ Object.defineProperty(exports, "getUserProperties", { enumerable: true, get: fun
|
|
|
26
26
|
Object.defineProperty(exports, "setUserProperty", { enumerable: true, get: function () { return userProperties_1.setUserProperty; } });
|
|
27
27
|
Object.defineProperty(exports, "removeUserProperty", { enumerable: true, get: function () { return userProperties_1.removeUserProperty; } });
|
|
28
28
|
Object.defineProperty(exports, "resetUserProperties", { enumerable: true, get: function () { return userProperties_1.resetUserProperties; } });
|
|
29
|
+
var diagnostics_1 = require("./runtime-delivery/diagnostics");
|
|
30
|
+
Object.defineProperty(exports, "getRuntimeDeliveryDiagnosticCounters", { enumerable: true, get: function () { return diagnostics_1.getRuntimeDeliveryDiagnosticCounters; } });
|
|
29
31
|
var useBundleDrop_1 = require("./useBundleDrop");
|
|
30
32
|
Object.defineProperty(exports, "useBundleDrop", { enumerable: true, get: function () { return useBundleDrop_1.useBundleDrop; } });
|
|
31
33
|
var context_1 = require("./context");
|
|
@@ -4,6 +4,9 @@ type InstallFromZipParams = {
|
|
|
4
4
|
hash?: string;
|
|
5
5
|
platform?: 'ios' | 'android';
|
|
6
6
|
statusCb?: (status: string) => void;
|
|
7
|
+
expectedArchiveHash?: string;
|
|
8
|
+
expectedManifestHash?: string;
|
|
9
|
+
expectedJsBundleHash?: string;
|
|
7
10
|
};
|
|
8
11
|
export declare function installFromZip(params: InstallFromZipParams): Promise<InstallResult>;
|
|
9
12
|
export {};
|
|
@@ -12,7 +12,7 @@ const bundleManifest_1 = require("../manifest/bundleManifest");
|
|
|
12
12
|
const bundleVerification_1 = require("./bundleVerification");
|
|
13
13
|
const bundleInstallShared_1 = require("./bundleInstallShared");
|
|
14
14
|
async function installFromZip(params) {
|
|
15
|
-
const { downloadUrl, hash, statusCb, platform = context_1.platform } = params;
|
|
15
|
+
const { downloadUrl, hash, statusCb, platform = context_1.platform, expectedArchiveHash, expectedManifestHash, expectedJsBundleHash, } = params;
|
|
16
16
|
if (!hash) {
|
|
17
17
|
throw new Error('Missing bundle hash');
|
|
18
18
|
}
|
|
@@ -33,6 +33,9 @@ async function installFromZip(params) {
|
|
|
33
33
|
catch (e) {
|
|
34
34
|
throw new errors_1.InstallPhaseError('download', e);
|
|
35
35
|
}
|
|
36
|
+
if (expectedArchiveHash && (await fs_1.default.sha256File(tempZipPath)) !== expectedArchiveHash) {
|
|
37
|
+
throw new errors_1.InstallPhaseError('install', new Error('Full bundle archive hash mismatch'));
|
|
38
|
+
}
|
|
36
39
|
try {
|
|
37
40
|
fileNames = await fs_1.default.unzip(tempZipPath, tempDir);
|
|
38
41
|
}
|
|
@@ -47,6 +50,12 @@ async function installFromZip(params) {
|
|
|
47
50
|
if (!manifest) {
|
|
48
51
|
throw new Error('Bundle manifest is missing');
|
|
49
52
|
}
|
|
53
|
+
if (expectedManifestHash && manifest.manifestHash !== expectedManifestHash) {
|
|
54
|
+
throw new Error('Signed manifest hash does not match downloaded bundle manifest');
|
|
55
|
+
}
|
|
56
|
+
if (expectedJsBundleHash && manifest.jsBundleHash !== expectedJsBundleHash) {
|
|
57
|
+
throw new Error('Signed JavaScript bundle hash does not match downloaded bundle manifest');
|
|
58
|
+
}
|
|
50
59
|
verifiedHash = manifest.bundleHash;
|
|
51
60
|
}
|
|
52
61
|
catch (e) {
|
package/lib/loadConfig.d.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shape of `bundle.drop.config.js` after it is loaded through Metro.
|
|
3
3
|
*/
|
|
4
|
+
export type RuntimeDeliveryConfig = {
|
|
5
|
+
manifestBaseUrl: string;
|
|
6
|
+
manifestAccessId: string;
|
|
7
|
+
publicKeys: Record<string, {
|
|
8
|
+
kty: 'EC';
|
|
9
|
+
crv: 'P-256';
|
|
10
|
+
x: string;
|
|
11
|
+
y: string;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
/** Returns true only for a complete package-managed trust configuration. */
|
|
15
|
+
export declare function isRuntimeDeliveryConfigured(value: unknown): value is RuntimeDeliveryConfig;
|
|
4
16
|
export type BundleDropProjectConfig = {
|
|
5
17
|
/** Persisted project shape used to keep Expo and bare runtime behavior distinct. */
|
|
6
18
|
projectType?: 'expo' | 'bare';
|
|
@@ -51,4 +63,8 @@ export type BundleDropProjectConfig = {
|
|
|
51
63
|
healthyAfterSec?: number;
|
|
52
64
|
};
|
|
53
65
|
};
|
|
54
|
-
|
|
66
|
+
/** Internal Metro-resolved config. Generated trust data is deliberately absent from the public type. */
|
|
67
|
+
export type ResolvedBundleDropProjectConfig = BundleDropProjectConfig & {
|
|
68
|
+
runtimeDelivery?: RuntimeDeliveryConfig;
|
|
69
|
+
};
|
|
70
|
+
export declare function loadConfig(): ResolvedBundleDropProjectConfig;
|
package/lib/loadConfig.js
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRuntimeDeliveryConfigured = isRuntimeDeliveryConfigured;
|
|
3
4
|
exports.loadConfig = loadConfig;
|
|
5
|
+
/** Returns true only for a complete package-managed trust configuration. */
|
|
6
|
+
function isRuntimeDeliveryConfigured(value) {
|
|
7
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
8
|
+
return false;
|
|
9
|
+
const candidate = value;
|
|
10
|
+
if (candidate.mode === 'v1' || candidate.mode === 'shadow')
|
|
11
|
+
return false;
|
|
12
|
+
return (typeof candidate.manifestBaseUrl === 'string' &&
|
|
13
|
+
Boolean(candidate.manifestBaseUrl) &&
|
|
14
|
+
typeof candidate.manifestAccessId === 'string' &&
|
|
15
|
+
Boolean(candidate.manifestAccessId) &&
|
|
16
|
+
Boolean(candidate.publicKeys) &&
|
|
17
|
+
typeof candidate.publicKeys === 'object' &&
|
|
18
|
+
!Array.isArray(candidate.publicKeys));
|
|
19
|
+
}
|
|
4
20
|
function loadConfig() {
|
|
5
21
|
try {
|
|
6
22
|
// ✅ Resolved via Metro alias in the host app (extraNodeModules)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OtaPatchSet } from '../api/types';
|
|
1
|
+
import type { OtaPatchSet, UpdateCheckResponse } from '../api/types';
|
|
2
2
|
export type DownloadUpdateResult = {
|
|
3
3
|
status: 'staged';
|
|
4
4
|
bundlePath: string;
|
|
@@ -20,7 +20,7 @@ type DownloadOptions = {
|
|
|
20
20
|
channelName?: string;
|
|
21
21
|
resolvedTarget?: {
|
|
22
22
|
hash: string;
|
|
23
|
-
downloadUrl
|
|
23
|
+
downloadUrl?: string;
|
|
24
24
|
bundleVersion?: number;
|
|
25
25
|
version?: string;
|
|
26
26
|
runtimeVersion?: string;
|
|
@@ -32,6 +32,7 @@ type DownloadOptions = {
|
|
|
32
32
|
mode: 'full';
|
|
33
33
|
downloadUrl: string;
|
|
34
34
|
};
|
|
35
|
+
runtimeDelivery?: UpdateCheckResponse['runtimeDelivery'];
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
38
|
export declare const downloadUpdate: (options?: DownloadOptions, onStatusUpdate?: (status: string) => void) => Promise<DownloadUpdateResult>;
|
|
@@ -10,6 +10,7 @@ const bundleDropNative_1 = require("../native/bundleDropNative");
|
|
|
10
10
|
const updateCheck_1 = require("./updateCheck");
|
|
11
11
|
const errors_1 = require("../errors");
|
|
12
12
|
const rollbackState_1 = require("./rollbackState");
|
|
13
|
+
const artifactCapability_1 = require("../runtime-delivery/artifactCapability");
|
|
13
14
|
async function restoreCurrentPointer(pointer) {
|
|
14
15
|
if (pointer) {
|
|
15
16
|
await (0, bundlePointer_1.writeCurrentBundlePointer)({ ...pointer, updatedAt: new Date().toISOString() });
|
|
@@ -17,6 +18,29 @@ async function restoreCurrentPointer(pointer) {
|
|
|
17
18
|
}
|
|
18
19
|
await (0, bundlePointer_1.deleteCurrentBundlePointer)();
|
|
19
20
|
}
|
|
21
|
+
function isSameRuntimeDeliverySelection(selected, refreshed) {
|
|
22
|
+
if (!refreshed ||
|
|
23
|
+
refreshed.action !== 'INSTALL' ||
|
|
24
|
+
refreshed.hash !== selected.hash ||
|
|
25
|
+
refreshed.runtimeVersion !== selected.runtimeVersion ||
|
|
26
|
+
!selected.runtimeDelivery ||
|
|
27
|
+
!refreshed.runtimeDelivery) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
const before = selected.runtimeDelivery;
|
|
31
|
+
const after = refreshed.runtimeDelivery;
|
|
32
|
+
return before.generation === after.generation &&
|
|
33
|
+
before.targetReleaseRef === after.targetReleaseRef &&
|
|
34
|
+
before.selectedMode === after.selectedMode &&
|
|
35
|
+
(before.baseHash ?? null) === (after.baseHash ?? null) &&
|
|
36
|
+
(before.patchAlgorithm ?? null) === (after.patchAlgorithm ?? null) &&
|
|
37
|
+
(before.patchSetHash ?? null) === (after.patchSetHash ?? null) &&
|
|
38
|
+
(before.patchArtifactRef ?? null) === (after.patchArtifactRef ?? null) &&
|
|
39
|
+
(before.missingAssetsHash ?? null) === (after.missingAssetsHash ?? null) &&
|
|
40
|
+
(before.manifestHash ?? null) === (after.manifestHash ?? null) &&
|
|
41
|
+
(before.jsBundleHash ?? null) === (after.jsBundleHash ?? null) &&
|
|
42
|
+
(before.fullBundleHash ?? null) === (after.fullBundleHash ?? null);
|
|
43
|
+
}
|
|
20
44
|
async function downloadAndStageUpdate(options, onStatusUpdate) {
|
|
21
45
|
const { project } = context_1.config;
|
|
22
46
|
const channelName = options?.channelName || context_1.defaultChannel;
|
|
@@ -24,9 +48,10 @@ async function downloadAndStageUpdate(options, onStatusUpdate) {
|
|
|
24
48
|
const statusCb = onStatusUpdate;
|
|
25
49
|
const resolvedTarget = options?.resolvedTarget;
|
|
26
50
|
// Resolve target via /ota/resolve unless the caller already provided it.
|
|
27
|
-
const
|
|
51
|
+
const unresolvedCheckResult = resolvedTarget
|
|
28
52
|
? {
|
|
29
53
|
action: 'INSTALL',
|
|
54
|
+
channelName,
|
|
30
55
|
hash: resolvedTarget.hash,
|
|
31
56
|
bundleHash: resolvedTarget.hash,
|
|
32
57
|
downloadUrl: resolvedTarget.downloadUrl,
|
|
@@ -38,8 +63,12 @@ async function downloadAndStageUpdate(options, onStatusUpdate) {
|
|
|
38
63
|
baseHash: resolvedTarget.baseHash,
|
|
39
64
|
patchSet: resolvedTarget.patchSet,
|
|
40
65
|
fallback: resolvedTarget.fallback,
|
|
66
|
+
runtimeDelivery: resolvedTarget.runtimeDelivery,
|
|
41
67
|
}
|
|
42
68
|
: await (0, updateCheck_1.checkForUpdate)(channelName, statusCb);
|
|
69
|
+
let checkResult = unresolvedCheckResult
|
|
70
|
+
? await (0, updateCheck_1.authorizeRuntimeDeliveryUpdate)(unresolvedCheckResult)
|
|
71
|
+
: null;
|
|
43
72
|
if (!checkResult) {
|
|
44
73
|
throw new errors_1.BundleDropError({
|
|
45
74
|
message: 'Failed to resolve update decision',
|
|
@@ -73,9 +102,6 @@ async function downloadAndStageUpdate(options, onStatusUpdate) {
|
|
|
73
102
|
const serverBundleVersion = checkResult.bundleVersion;
|
|
74
103
|
const serverVersion = checkResult.version;
|
|
75
104
|
const serverRuntimeVersion = checkResult.runtimeVersion;
|
|
76
|
-
const fullBundleZipUrl = checkResult.mode === 'patch'
|
|
77
|
-
? checkResult.fallback?.downloadUrl || null
|
|
78
|
-
: checkResult.downloadUrl || null;
|
|
79
105
|
try {
|
|
80
106
|
if (!serverHash) {
|
|
81
107
|
throw new errors_1.BundleDropError({
|
|
@@ -85,18 +111,6 @@ async function downloadAndStageUpdate(options, onStatusUpdate) {
|
|
|
85
111
|
context: { channelName, platform, projectSlug: project.slug },
|
|
86
112
|
});
|
|
87
113
|
}
|
|
88
|
-
if (!fullBundleZipUrl) {
|
|
89
|
-
throw new errors_1.BundleDropError({
|
|
90
|
-
message: 'Missing downloadUrl from ota resolve response',
|
|
91
|
-
code: 'DOWNLOAD_URL_MISSING',
|
|
92
|
-
step: 'resolve',
|
|
93
|
-
context: {
|
|
94
|
-
channelName,
|
|
95
|
-
platform,
|
|
96
|
-
projectSlug: project.slug,
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
114
|
const hash = serverHash;
|
|
101
115
|
if (await (0, rollbackState_1.isBundleHashFailed)(hash)) {
|
|
102
116
|
statusCb?.('✅ Current bundle retained; selected update previously failed on this device');
|
|
@@ -107,40 +121,91 @@ async function downloadAndStageUpdate(options, onStatusUpdate) {
|
|
|
107
121
|
skippedHash: hash,
|
|
108
122
|
};
|
|
109
123
|
}
|
|
110
|
-
let installResult
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
installResult = await (0,
|
|
127
|
-
|
|
128
|
-
|
|
124
|
+
let installResult;
|
|
125
|
+
let capabilityRefreshAttempted = false;
|
|
126
|
+
let patchFallbackSelected = false;
|
|
127
|
+
while (true) {
|
|
128
|
+
const fullBundleZipUrl = checkResult.mode === 'patch'
|
|
129
|
+
? checkResult.fallback?.downloadUrl || null
|
|
130
|
+
: checkResult.downloadUrl || null;
|
|
131
|
+
if (!fullBundleZipUrl) {
|
|
132
|
+
throw new errors_1.BundleDropError({
|
|
133
|
+
message: 'Missing downloadUrl from ota resolve response',
|
|
134
|
+
code: 'DOWNLOAD_URL_MISSING',
|
|
135
|
+
step: 'resolve',
|
|
136
|
+
context: { channelName, platform, projectSlug: project.slug },
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
installResult = patchFallbackSelected ? null : await (0, patchTransport_1.tryInstallPatchTransport)({
|
|
141
|
+
target: {
|
|
142
|
+
mode: checkResult.mode,
|
|
143
|
+
hash,
|
|
144
|
+
manifestUrl: checkResult.manifestUrl,
|
|
145
|
+
baseHash: checkResult.baseHash,
|
|
146
|
+
patchSet: checkResult.patchSet,
|
|
147
|
+
...(checkResult.runtimeDelivery?.manifestHash
|
|
148
|
+
? { expectedManifestHash: checkResult.runtimeDelivery.manifestHash }
|
|
149
|
+
: {}),
|
|
150
|
+
...(checkResult.runtimeDelivery?.jsBundleHash
|
|
151
|
+
? { expectedJsBundleHash: checkResult.runtimeDelivery.jsBundleHash }
|
|
152
|
+
: {}),
|
|
153
|
+
},
|
|
154
|
+
projectSlug: project.slug,
|
|
129
155
|
platform,
|
|
156
|
+
runtimeVersionValue: serverRuntimeVersion,
|
|
130
157
|
statusCb,
|
|
131
158
|
});
|
|
159
|
+
if (!installResult) {
|
|
160
|
+
patchFallbackSelected = checkResult.mode === 'patch';
|
|
161
|
+
statusCb?.('⬇️ Downloading full bundle ZIP!...');
|
|
162
|
+
installResult = await (0, installFromZip_1.installFromZip)({
|
|
163
|
+
downloadUrl: fullBundleZipUrl,
|
|
164
|
+
hash,
|
|
165
|
+
platform,
|
|
166
|
+
statusCb,
|
|
167
|
+
...(checkResult.runtimeDelivery?.fullBundleHash
|
|
168
|
+
? { expectedArchiveHash: checkResult.runtimeDelivery.fullBundleHash }
|
|
169
|
+
: {}),
|
|
170
|
+
...(checkResult.runtimeDelivery?.manifestHash
|
|
171
|
+
? { expectedManifestHash: checkResult.runtimeDelivery.manifestHash }
|
|
172
|
+
: {}),
|
|
173
|
+
...(checkResult.runtimeDelivery?.jsBundleHash
|
|
174
|
+
? { expectedJsBundleHash: checkResult.runtimeDelivery.jsBundleHash }
|
|
175
|
+
: {}),
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
catch (e) {
|
|
181
|
+
if (!capabilityRefreshAttempted &&
|
|
182
|
+
unresolvedCheckResult.runtimeDelivery &&
|
|
183
|
+
(0, artifactCapability_1.isArtifactCapabilityRejected)(e)) {
|
|
184
|
+
capabilityRefreshAttempted = true;
|
|
185
|
+
statusCb?.('🔐 Download authorization expired; refreshing once...');
|
|
186
|
+
const refreshed = await (0, updateCheck_1.authorizeRuntimeDeliveryUpdate)(unresolvedCheckResult);
|
|
187
|
+
if (!isSameRuntimeDeliverySelection(unresolvedCheckResult, refreshed)) {
|
|
188
|
+
throw new errors_1.BundleDropError({
|
|
189
|
+
message: 'Refreshed download authorization changed update identity',
|
|
190
|
+
code: 'DOWNLOAD_FAILED',
|
|
191
|
+
step: 'download',
|
|
192
|
+
context: { channelName, platform, hash },
|
|
193
|
+
cause: e,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
checkResult = refreshed;
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
const phaseErr = (0, errors_1.isInstallPhaseError)(e);
|
|
200
|
+
const isDownload = phaseErr && e.phase === 'download';
|
|
201
|
+
throw new errors_1.BundleDropError({
|
|
202
|
+
message: isDownload ? 'Failed to download update ZIP' : 'Failed to install update ZIP',
|
|
203
|
+
code: isDownload ? 'DOWNLOAD_FAILED' : 'INSTALL_FAILED',
|
|
204
|
+
step: isDownload ? 'download' : 'install',
|
|
205
|
+
context: { channelName, platform, hash },
|
|
206
|
+
cause: phaseErr ? e.originalCause : e,
|
|
207
|
+
});
|
|
132
208
|
}
|
|
133
|
-
}
|
|
134
|
-
catch (e) {
|
|
135
|
-
const phaseErr = (0, errors_1.isInstallPhaseError)(e);
|
|
136
|
-
const isDownload = phaseErr && e.phase === 'download';
|
|
137
|
-
throw new errors_1.BundleDropError({
|
|
138
|
-
message: isDownload ? 'Failed to download update ZIP' : 'Failed to install update ZIP',
|
|
139
|
-
code: isDownload ? 'DOWNLOAD_FAILED' : 'INSTALL_FAILED',
|
|
140
|
-
step: isDownload ? 'download' : 'install',
|
|
141
|
-
context: { channelName, platform, hash },
|
|
142
|
-
cause: phaseErr ? e.originalCause : e,
|
|
143
|
-
});
|
|
144
209
|
}
|
|
145
210
|
const { bundlePath, metadataFromZip } = installResult;
|
|
146
211
|
const installedHash = hash;
|
|
@@ -52,7 +52,9 @@ export declare function rollbackToPreviousIfNeeded(policy: Required<RollbackPoli
|
|
|
52
52
|
reason?: FailedBundleReason;
|
|
53
53
|
}>;
|
|
54
54
|
export declare function getRollbackPolicy(): Required<RollbackPolicy>;
|
|
55
|
-
export declare function rollbackToPreviousOrNative(
|
|
55
|
+
export declare function rollbackToPreviousOrNative(options?: {
|
|
56
|
+
forceNative?: boolean;
|
|
57
|
+
}): Promise<{
|
|
56
58
|
rolledBack: boolean;
|
|
57
59
|
toNative?: boolean;
|
|
58
60
|
}>;
|