@gfean/react-native-bundle-drop 0.5.1 → 0.7.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/BundleDrop.podspec +96 -0
- package/README.md +194 -5
- package/android/build.gradle +66 -0
- package/android/src/main/java/com/bundledrop/BundleDropBoundedDownloader.kt +86 -0
- package/android/src/main/java/com/bundledrop/BundleDropModule.kt +206 -13
- package/android/src/main/java/com/bundledrop/BundleDropNativePaths.kt +43 -13
- package/android/src/main/java/com/bundledrop/BundleDropOtaResolver.kt +35 -0
- package/android/src/main/java/com/bundledrop/BundleDropRuntimeCrypto.kt +81 -0
- package/android/src/main/java/com/bundledrop/BundleDropStartupRecovery.kt +1117 -0
- package/ios/BundleDropBridge.m +45 -0
- package/ios/BundleDropLocator.swift +66 -4
- package/ios/BundleDropModule.swift +181 -3
- package/ios/BundleDropOtaResolver.swift +137 -29
- package/ios/BundleDropRuntimeCrypto.swift +45 -0
- package/ios/BundleDropStartupRecovery.swift +1108 -0
- package/ios/BundleDropStartupRecoveryAdapter.swift +301 -0
- package/lib/CLI/cli.d.ts +1 -0
- package/lib/CLI/cli.js +57 -6
- 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 +221 -45
- 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 +162 -22
- package/lib/CLI/scripts/expo/configure-expo.js +52 -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 +198 -14
- package/lib/CLI/scripts/login-cli.js +31 -7
- 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/write-runtime-identity.d.ts +19 -0
- package/lib/CLI/scripts/native/write-runtime-identity.js +92 -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/upload-cli.d.ts +12 -2
- package/lib/CLI/scripts/upload-cli.js +74 -11
- package/lib/CLI/serverUrl.d.ts +3 -0
- package/lib/CLI/serverUrl.js +31 -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/bundleInfo.d.ts +2 -0
- package/lib/bundleInfo.js +16 -1
- package/lib/context.d.ts +1 -1
- package/lib/context.js +12 -2
- package/lib/fs/bundlePointer.d.ts +1 -17
- package/lib/fs/bundlePointer.js +5 -93
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -1
- package/lib/install/bundleInstallShared.js +4 -4
- 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 +134 -66
- package/lib/manager/reporting.d.ts +8 -1
- package/lib/manager/reporting.js +17 -22
- package/lib/manager/rollbackState.d.ts +18 -52
- package/lib/manager/rollbackState.js +115 -216
- package/lib/manager/updateCheck.d.ts +1 -0
- package/lib/manager/updateCheck.js +224 -78
- package/lib/manager/updateState.d.ts +2 -1
- package/lib/manager/updateState.js +59 -6
- package/lib/metro.d.ts +8 -1
- package/lib/metro.js +69 -19
- package/lib/native/bundleDropNative.d.ts +62 -0
- package/lib/native/bundleDropNative.js +268 -2
- 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 +16 -5
- 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 +82 -67
- 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 +68 -0
- package/lib/runtime-delivery/bootstrapConfig.js +278 -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 +11 -0
- package/lib/runtime-delivery/manifestState.js +123 -0
- package/lib/runtime-delivery/manifestVerifier.d.ts +13 -0
- package/lib/runtime-delivery/manifestVerifier.js +335 -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/lib/scripts/bundle.d.ts +9 -2
- package/lib/scripts/bundle.js +68 -18
- package/lib/scripts/download-bundle.d.ts +1 -0
- package/lib/scripts/download-bundle.js +2 -2
- package/lib/scripts/resolveModule.d.ts +2 -0
- package/lib/scripts/resolveModule.js +5 -0
- package/package.json +5 -2
- package/plugin/xcodeBuildPhase.js +2 -1
|
@@ -0,0 +1,278 @@
|
|
|
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.LEGACY_RUNTIME_DELIVERY_BOOTSTRAP_GITIGNORE_MARKER = exports.RUNTIME_DELIVERY_BOOTSTRAP_GITIGNORE_MARKER = exports.LEGACY_RUNTIME_DELIVERY_BOOTSTRAP_PATH = exports.RUNTIME_DELIVERY_BOOTSTRAP_PATH = exports.RUNTIME_DELIVERY_BOOTSTRAP_SCHEMA_VERSION = void 0;
|
|
7
|
+
exports.normalizeRuntimeDeliveryBootstrap = normalizeRuntimeDeliveryBootstrap;
|
|
8
|
+
exports.createRuntimeDeliveryBootstrapLockfile = createRuntimeDeliveryBootstrapLockfile;
|
|
9
|
+
exports.parseRuntimeDeliveryBootstrapLockfile = parseRuntimeDeliveryBootstrapLockfile;
|
|
10
|
+
exports.runtimeDeliveryBootstrapPath = runtimeDeliveryBootstrapPath;
|
|
11
|
+
exports.legacyRuntimeDeliveryBootstrapPath = legacyRuntimeDeliveryBootstrapPath;
|
|
12
|
+
exports.addRuntimeDeliveryBootstrapGitignoreRules = addRuntimeDeliveryBootstrapGitignoreRules;
|
|
13
|
+
exports.readRuntimeDeliveryLockfile = readRuntimeDeliveryLockfile;
|
|
14
|
+
exports.inspectRuntimeDeliveryBootstrap = inspectRuntimeDeliveryBootstrap;
|
|
15
|
+
exports.readRuntimeDeliveryBootstrap = readRuntimeDeliveryBootstrap;
|
|
16
|
+
exports.serializeRuntimeDeliveryBootstrapLockfile = serializeRuntimeDeliveryBootstrapLockfile;
|
|
17
|
+
exports.writeRuntimeDeliveryBootstrapLockfile = writeRuntimeDeliveryBootstrapLockfile;
|
|
18
|
+
exports.removeRuntimeDeliveryBootstrapLockfile = removeRuntimeDeliveryBootstrapLockfile;
|
|
19
|
+
exports.removeLegacyRuntimeDeliveryBootstrap = removeLegacyRuntimeDeliveryBootstrap;
|
|
20
|
+
exports.removeAllRuntimeDeliveryBootstraps = removeAllRuntimeDeliveryBootstraps;
|
|
21
|
+
exports.ensureRuntimeDeliveryBootstrapGitignore = ensureRuntimeDeliveryBootstrapGitignore;
|
|
22
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
23
|
+
const path_1 = __importDefault(require("path"));
|
|
24
|
+
const util_1 = require("util");
|
|
25
|
+
const safe_file_transaction_1 = require("../CLI/scripts/safe-file-transaction");
|
|
26
|
+
exports.RUNTIME_DELIVERY_BOOTSTRAP_SCHEMA_VERSION = 1;
|
|
27
|
+
exports.RUNTIME_DELIVERY_BOOTSTRAP_PATH = path_1.default.join('.bundle-drop', 'runtime-delivery.lock.json');
|
|
28
|
+
exports.LEGACY_RUNTIME_DELIVERY_BOOTSTRAP_PATH = path_1.default.join('.bundle-drop', 'runtime-delivery.generated.json');
|
|
29
|
+
exports.RUNTIME_DELIVERY_BOOTSTRAP_GITIGNORE_MARKER = '!.bundle-drop/runtime-delivery.lock.json';
|
|
30
|
+
exports.LEGACY_RUNTIME_DELIVERY_BOOTSTRAP_GITIGNORE_MARKER = '!.bundle-drop/runtime-delivery.generated.json';
|
|
31
|
+
const RUNTIME_DELIVERY_BOOTSTRAP_GITIGNORE_BLOCK = [
|
|
32
|
+
'# Bundle Drop: commit the public trust bootstrap; ignore generated runtime artifacts.',
|
|
33
|
+
'!.bundle-drop/',
|
|
34
|
+
'.bundle-drop/*',
|
|
35
|
+
exports.RUNTIME_DELIVERY_BOOTSTRAP_GITIGNORE_MARKER,
|
|
36
|
+
].join('\n');
|
|
37
|
+
const isRecord = (value) => Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
38
|
+
const normalizeUrl = (value) => value.trim().replace(/\/+$/, '');
|
|
39
|
+
const isP256Coordinate = (value) => typeof value === 'string' &&
|
|
40
|
+
/^[A-Za-z0-9_-]{43}$/.test(value) &&
|
|
41
|
+
Buffer.from(value, 'base64url').length === 32;
|
|
42
|
+
const normalizeHttpUrl = (value) => {
|
|
43
|
+
if (typeof value !== 'string' || !value.trim())
|
|
44
|
+
return null;
|
|
45
|
+
try {
|
|
46
|
+
const url = new URL(value);
|
|
47
|
+
if (url.protocol !== 'https:' && url.protocol !== 'http:')
|
|
48
|
+
return null;
|
|
49
|
+
return normalizeUrl(value);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const normalizePublicKeys = (value) => {
|
|
56
|
+
if (!isRecord(value))
|
|
57
|
+
return null;
|
|
58
|
+
const entries = Object.entries(value);
|
|
59
|
+
if (!entries.length)
|
|
60
|
+
return null;
|
|
61
|
+
const publicKeys = {};
|
|
62
|
+
for (const [kid, candidate] of entries) {
|
|
63
|
+
if (!kid.trim() || !isRecord(candidate))
|
|
64
|
+
return null;
|
|
65
|
+
if (Object.keys(candidate).sort().join(',') !== 'crv,kty,x,y')
|
|
66
|
+
return null;
|
|
67
|
+
if (candidate.kty !== 'EC' ||
|
|
68
|
+
candidate.crv !== 'P-256' ||
|
|
69
|
+
!isP256Coordinate(candidate.x) ||
|
|
70
|
+
!isP256Coordinate(candidate.y)) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
publicKeys[kid] = {
|
|
74
|
+
kty: 'EC',
|
|
75
|
+
crv: 'P-256',
|
|
76
|
+
x: candidate.x,
|
|
77
|
+
y: candidate.y,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return publicKeys;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Accepts the current backend-authorized trust shape and the temporary legacy
|
|
84
|
+
* wire shape. Explicit legacy non-authoritative modes must never create a
|
|
85
|
+
* package-managed bootstrap.
|
|
86
|
+
*/
|
|
87
|
+
function normalizeRuntimeDeliveryBootstrap(value) {
|
|
88
|
+
if (!isRecord(value))
|
|
89
|
+
return undefined;
|
|
90
|
+
if (value.mode !== undefined && value.mode !== 'v2')
|
|
91
|
+
return undefined;
|
|
92
|
+
const manifestBaseUrl = normalizeHttpUrl(value.manifestBaseUrl);
|
|
93
|
+
if (!manifestBaseUrl)
|
|
94
|
+
return undefined;
|
|
95
|
+
if (typeof value.manifestAccessId !== 'string' ||
|
|
96
|
+
!/^[A-Za-z0-9_-]{22,128}$/.test(value.manifestAccessId)) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
const publicKeys = normalizePublicKeys(value.publicKeys);
|
|
100
|
+
if (!publicKeys)
|
|
101
|
+
return undefined;
|
|
102
|
+
return {
|
|
103
|
+
manifestBaseUrl,
|
|
104
|
+
manifestAccessId: value.manifestAccessId,
|
|
105
|
+
publicKeys,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function createRuntimeDeliveryBootstrapLockfile(params) {
|
|
109
|
+
const runtimeDelivery = normalizeRuntimeDeliveryBootstrap(params.runtimeDelivery);
|
|
110
|
+
const serverUrl = normalizeHttpUrl(params.identity.serverUrl);
|
|
111
|
+
const orgSlug = params.identity.orgSlug.trim();
|
|
112
|
+
const projectSlug = params.identity.projectSlug.trim();
|
|
113
|
+
const projectId = params.identity.projectId?.trim();
|
|
114
|
+
const orgId = params.identity.orgId?.trim();
|
|
115
|
+
if (!runtimeDelivery || !serverUrl || !orgSlug || !projectSlug)
|
|
116
|
+
return undefined;
|
|
117
|
+
if (Boolean(projectId) !== Boolean(orgId))
|
|
118
|
+
return undefined;
|
|
119
|
+
return {
|
|
120
|
+
schemaVersion: exports.RUNTIME_DELIVERY_BOOTSTRAP_SCHEMA_VERSION,
|
|
121
|
+
project: {
|
|
122
|
+
serverUrl,
|
|
123
|
+
orgSlug,
|
|
124
|
+
projectSlug,
|
|
125
|
+
...(projectId && orgId ? { projectId, orgId } : {}),
|
|
126
|
+
},
|
|
127
|
+
runtimeDelivery,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function parseRuntimeDeliveryBootstrapLockfile(value, expectedIdentity) {
|
|
131
|
+
if (!isRecord(value) || value.schemaVersion !== exports.RUNTIME_DELIVERY_BOOTSTRAP_SCHEMA_VERSION) {
|
|
132
|
+
throw new Error(`Runtime delivery bootstrap must use schemaVersion ${exports.RUNTIME_DELIVERY_BOOTSTRAP_SCHEMA_VERSION}.`);
|
|
133
|
+
}
|
|
134
|
+
if (!isRecord(value.project)) {
|
|
135
|
+
throw new Error('Runtime delivery bootstrap is missing its project identity.');
|
|
136
|
+
}
|
|
137
|
+
const hasProjectId = Object.prototype.hasOwnProperty.call(value.project, 'projectId');
|
|
138
|
+
const hasOrgId = Object.prototype.hasOwnProperty.call(value.project, 'orgId');
|
|
139
|
+
if (hasProjectId !== hasOrgId ||
|
|
140
|
+
(hasProjectId &&
|
|
141
|
+
(typeof value.project.projectId !== 'string' ||
|
|
142
|
+
!value.project.projectId.trim() ||
|
|
143
|
+
typeof value.project.orgId !== 'string' ||
|
|
144
|
+
!value.project.orgId.trim()))) {
|
|
145
|
+
throw new Error('Runtime delivery bootstrap contains an invalid stable project identity.');
|
|
146
|
+
}
|
|
147
|
+
const bootstrap = createRuntimeDeliveryBootstrapLockfile({
|
|
148
|
+
identity: {
|
|
149
|
+
serverUrl: typeof value.project.serverUrl === 'string' ? value.project.serverUrl : '',
|
|
150
|
+
orgSlug: typeof value.project.orgSlug === 'string' ? value.project.orgSlug : '',
|
|
151
|
+
projectSlug: typeof value.project.projectSlug === 'string' ? value.project.projectSlug : '',
|
|
152
|
+
projectId: typeof value.project.projectId === 'string' ? value.project.projectId : undefined,
|
|
153
|
+
orgId: typeof value.project.orgId === 'string' ? value.project.orgId : undefined,
|
|
154
|
+
},
|
|
155
|
+
runtimeDelivery: value.runtimeDelivery,
|
|
156
|
+
});
|
|
157
|
+
if (!bootstrap) {
|
|
158
|
+
throw new Error('Runtime delivery bootstrap contains invalid trust configuration.');
|
|
159
|
+
}
|
|
160
|
+
if (expectedIdentity) {
|
|
161
|
+
const expected = {
|
|
162
|
+
serverUrl: normalizeUrl(expectedIdentity.serverUrl),
|
|
163
|
+
orgSlug: expectedIdentity.orgSlug.trim(),
|
|
164
|
+
projectSlug: expectedIdentity.projectSlug.trim(),
|
|
165
|
+
};
|
|
166
|
+
if (bootstrap.project.serverUrl !== expected.serverUrl ||
|
|
167
|
+
bootstrap.project.orgSlug !== expected.orgSlug ||
|
|
168
|
+
bootstrap.project.projectSlug !== expected.projectSlug ||
|
|
169
|
+
(expectedIdentity.projectId !== undefined &&
|
|
170
|
+
bootstrap.project.projectId !== expectedIdentity.projectId.trim()) ||
|
|
171
|
+
(expectedIdentity.orgId !== undefined &&
|
|
172
|
+
bootstrap.project.orgId !== expectedIdentity.orgId.trim())) {
|
|
173
|
+
throw new Error('Runtime delivery bootstrap belongs to a different server, organization, or project.');
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return bootstrap;
|
|
177
|
+
}
|
|
178
|
+
function runtimeDeliveryBootstrapPath(projectRoot) {
|
|
179
|
+
return path_1.default.join(projectRoot, exports.RUNTIME_DELIVERY_BOOTSTRAP_PATH);
|
|
180
|
+
}
|
|
181
|
+
function legacyRuntimeDeliveryBootstrapPath(projectRoot) {
|
|
182
|
+
return path_1.default.join(projectRoot, exports.LEGACY_RUNTIME_DELIVERY_BOOTSTRAP_PATH);
|
|
183
|
+
}
|
|
184
|
+
const RUNTIME_DELIVERY_MANAGED_GITIGNORE_LINES = new Set([
|
|
185
|
+
'# Bundle Drop: commit the public trust bootstrap; ignore generated runtime artifacts.',
|
|
186
|
+
'!.bundle-drop/',
|
|
187
|
+
'.bundle-drop/*',
|
|
188
|
+
exports.RUNTIME_DELIVERY_BOOTSTRAP_GITIGNORE_MARKER,
|
|
189
|
+
exports.LEGACY_RUNTIME_DELIVERY_BOOTSTRAP_GITIGNORE_MARKER,
|
|
190
|
+
]);
|
|
191
|
+
function addRuntimeDeliveryBootstrapGitignoreRules(content) {
|
|
192
|
+
const prefix = content
|
|
193
|
+
.split('\n')
|
|
194
|
+
.filter(line => !RUNTIME_DELIVERY_MANAGED_GITIGNORE_LINES.has(line.trim()))
|
|
195
|
+
.join('\n')
|
|
196
|
+
.trimEnd();
|
|
197
|
+
return `${prefix}${prefix ? '\n\n' : ''}${RUNTIME_DELIVERY_BOOTSTRAP_GITIGNORE_BLOCK}\n`;
|
|
198
|
+
}
|
|
199
|
+
function readRuntimeDeliveryBootstrapFile(params) {
|
|
200
|
+
const bootstrapPath = path_1.default.join(params.projectRoot, params.relativePath);
|
|
201
|
+
if (!fs_extra_1.default.existsSync(bootstrapPath))
|
|
202
|
+
return null;
|
|
203
|
+
let value;
|
|
204
|
+
try {
|
|
205
|
+
value = fs_extra_1.default.readJsonSync(bootstrapPath);
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
throw new Error(`Runtime delivery bootstrap is not valid JSON: ${bootstrapPath}`);
|
|
209
|
+
}
|
|
210
|
+
return parseRuntimeDeliveryBootstrapLockfile(value, params.expectedIdentity);
|
|
211
|
+
}
|
|
212
|
+
function readRuntimeDeliveryLockfile(params) {
|
|
213
|
+
return readRuntimeDeliveryBootstrapFile({
|
|
214
|
+
...params,
|
|
215
|
+
relativePath: exports.RUNTIME_DELIVERY_BOOTSTRAP_PATH,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
function inspectRuntimeDeliveryBootstrap(params) {
|
|
219
|
+
const current = readRuntimeDeliveryLockfile(params);
|
|
220
|
+
const legacy = readRuntimeDeliveryBootstrapFile({
|
|
221
|
+
...params,
|
|
222
|
+
relativePath: exports.LEGACY_RUNTIME_DELIVERY_BOOTSTRAP_PATH,
|
|
223
|
+
});
|
|
224
|
+
if (current && legacy) {
|
|
225
|
+
if (!(0, util_1.isDeepStrictEqual)(current, legacy)) {
|
|
226
|
+
throw new Error('Runtime delivery lockfile and legacy bootstrap differ. Run `bundle-drop sync` to repair them.');
|
|
227
|
+
}
|
|
228
|
+
return { bootstrap: current, source: 'matching-dual' };
|
|
229
|
+
}
|
|
230
|
+
if (current)
|
|
231
|
+
return { bootstrap: current, source: 'lock' };
|
|
232
|
+
if (legacy)
|
|
233
|
+
return { bootstrap: legacy, source: 'legacy' };
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
function readRuntimeDeliveryBootstrap(params) {
|
|
237
|
+
return inspectRuntimeDeliveryBootstrap(params)?.bootstrap ?? null;
|
|
238
|
+
}
|
|
239
|
+
function serializeRuntimeDeliveryBootstrapLockfile(bootstrap) {
|
|
240
|
+
return `${JSON.stringify(bootstrap, null, 2)}\n`;
|
|
241
|
+
}
|
|
242
|
+
async function writeRuntimeDeliveryBootstrapLockfile(params) {
|
|
243
|
+
const bootstrapPath = runtimeDeliveryBootstrapPath(params.projectRoot);
|
|
244
|
+
(0, safe_file_transaction_1.writeProjectFileAtomically)(params.projectRoot, exports.RUNTIME_DELIVERY_BOOTSTRAP_PATH, serializeRuntimeDeliveryBootstrapLockfile(params.bootstrap));
|
|
245
|
+
return bootstrapPath;
|
|
246
|
+
}
|
|
247
|
+
async function removeRuntimeDeliveryBootstrapLockfile(projectRoot) {
|
|
248
|
+
const bootstrapPath = runtimeDeliveryBootstrapPath(projectRoot);
|
|
249
|
+
if (!(0, safe_file_transaction_1.inspectProjectFile)(projectRoot, exports.RUNTIME_DELIVERY_BOOTSTRAP_PATH).exists)
|
|
250
|
+
return null;
|
|
251
|
+
(0, safe_file_transaction_1.removeProjectFile)(projectRoot, exports.RUNTIME_DELIVERY_BOOTSTRAP_PATH);
|
|
252
|
+
return bootstrapPath;
|
|
253
|
+
}
|
|
254
|
+
async function removeLegacyRuntimeDeliveryBootstrap(projectRoot) {
|
|
255
|
+
const bootstrapPath = legacyRuntimeDeliveryBootstrapPath(projectRoot);
|
|
256
|
+
if (!(0, safe_file_transaction_1.inspectProjectFile)(projectRoot, exports.LEGACY_RUNTIME_DELIVERY_BOOTSTRAP_PATH).exists)
|
|
257
|
+
return null;
|
|
258
|
+
(0, safe_file_transaction_1.removeProjectFile)(projectRoot, exports.LEGACY_RUNTIME_DELIVERY_BOOTSTRAP_PATH);
|
|
259
|
+
return bootstrapPath;
|
|
260
|
+
}
|
|
261
|
+
async function removeAllRuntimeDeliveryBootstraps(projectRoot) {
|
|
262
|
+
const removed = await Promise.all([
|
|
263
|
+
removeRuntimeDeliveryBootstrapLockfile(projectRoot),
|
|
264
|
+
removeLegacyRuntimeDeliveryBootstrap(projectRoot),
|
|
265
|
+
]);
|
|
266
|
+
return removed.filter((file) => Boolean(file));
|
|
267
|
+
}
|
|
268
|
+
async function ensureRuntimeDeliveryBootstrapGitignore(projectRoot) {
|
|
269
|
+
const gitignorePath = path_1.default.join(projectRoot, '.gitignore');
|
|
270
|
+
const original = fs_extra_1.default.existsSync(gitignorePath)
|
|
271
|
+
? await fs_extra_1.default.readFile(gitignorePath, 'utf8')
|
|
272
|
+
: '';
|
|
273
|
+
const updated = addRuntimeDeliveryBootstrapGitignoreRules(original);
|
|
274
|
+
if (updated !== original) {
|
|
275
|
+
(0, safe_file_transaction_1.writeProjectFileAtomically)(projectRoot, '.gitignore', updated);
|
|
276
|
+
}
|
|
277
|
+
return gitignorePath;
|
|
278
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const RUNTIME_DELIVERY_DIAGNOSTIC_NAMES: readonly ["manifest_hit", "dynamic_manifest", "origin_fallback", "invalid_signature", "unknown_key", "lane_mismatch", "generation_regression", "generation_equivocation", "manifest_http_error", "manifest_network_error", "manifest_timeout", "manifest_too_large", "manifest_invalid", "manifest_stream_unavailable", "authority_lease_http_error", "authority_lease_network_error", "authority_lease_timeout", "authority_lease_too_large", "authority_lease_invalid", "authority_lease_invalid_signature", "authority_lease_unknown_key", "authority_lease_expired", "authority_lease_origin_mismatch", "authority_lease_disabled"];
|
|
2
|
+
export type RuntimeDeliveryDiagnosticName = typeof RUNTIME_DELIVERY_DIAGNOSTIC_NAMES[number];
|
|
3
|
+
export type RuntimeDeliveryDiagnosticDetails = {
|
|
4
|
+
channelName?: string;
|
|
5
|
+
reason?: string;
|
|
6
|
+
status?: number;
|
|
7
|
+
};
|
|
8
|
+
export type RuntimeDeliveryDiagnosticEvent = {
|
|
9
|
+
name: RuntimeDeliveryDiagnosticName;
|
|
10
|
+
count: number;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
details?: RuntimeDeliveryDiagnosticDetails;
|
|
13
|
+
};
|
|
14
|
+
export type RuntimeDeliveryDiagnosticCounters = Record<RuntimeDeliveryDiagnosticName, number>;
|
|
15
|
+
export declare function recordRuntimeDeliveryDiagnostic(name: RuntimeDeliveryDiagnosticName, details?: RuntimeDeliveryDiagnosticDetails): void;
|
|
16
|
+
export declare function getRuntimeDeliveryDiagnosticCounters(): RuntimeDeliveryDiagnosticCounters;
|
|
17
|
+
export declare function resetRuntimeDeliveryDiagnosticsForTests(): void;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RUNTIME_DELIVERY_DIAGNOSTIC_NAMES = void 0;
|
|
4
|
+
exports.recordRuntimeDeliveryDiagnostic = recordRuntimeDeliveryDiagnostic;
|
|
5
|
+
exports.getRuntimeDeliveryDiagnosticCounters = getRuntimeDeliveryDiagnosticCounters;
|
|
6
|
+
exports.resetRuntimeDeliveryDiagnosticsForTests = resetRuntimeDeliveryDiagnosticsForTests;
|
|
7
|
+
const initState_1 = require("../runtime/initState");
|
|
8
|
+
exports.RUNTIME_DELIVERY_DIAGNOSTIC_NAMES = [
|
|
9
|
+
'manifest_hit',
|
|
10
|
+
'dynamic_manifest',
|
|
11
|
+
'origin_fallback',
|
|
12
|
+
'invalid_signature',
|
|
13
|
+
'unknown_key',
|
|
14
|
+
'lane_mismatch',
|
|
15
|
+
'generation_regression',
|
|
16
|
+
'generation_equivocation',
|
|
17
|
+
'manifest_http_error',
|
|
18
|
+
'manifest_network_error',
|
|
19
|
+
'manifest_timeout',
|
|
20
|
+
'manifest_too_large',
|
|
21
|
+
'manifest_invalid',
|
|
22
|
+
'manifest_stream_unavailable',
|
|
23
|
+
'authority_lease_http_error',
|
|
24
|
+
'authority_lease_network_error',
|
|
25
|
+
'authority_lease_timeout',
|
|
26
|
+
'authority_lease_too_large',
|
|
27
|
+
'authority_lease_invalid',
|
|
28
|
+
'authority_lease_invalid_signature',
|
|
29
|
+
'authority_lease_unknown_key',
|
|
30
|
+
'authority_lease_expired',
|
|
31
|
+
'authority_lease_origin_mismatch',
|
|
32
|
+
'authority_lease_disabled',
|
|
33
|
+
];
|
|
34
|
+
const counters = Object.fromEntries(exports.RUNTIME_DELIVERY_DIAGNOSTIC_NAMES.map(name => [name, 0]));
|
|
35
|
+
function recordRuntimeDeliveryDiagnostic(name, details) {
|
|
36
|
+
counters[name] += 1;
|
|
37
|
+
const listener = (0, initState_1.getBundleDropRuntimeConfig)()?.onRuntimeDeliveryDiagnostic;
|
|
38
|
+
if (!listener)
|
|
39
|
+
return;
|
|
40
|
+
try {
|
|
41
|
+
listener({
|
|
42
|
+
name,
|
|
43
|
+
count: counters[name],
|
|
44
|
+
timestamp: new Date().toISOString(),
|
|
45
|
+
...(details ? { details } : {}),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
console.warn('[BundleDrop] runtime-delivery diagnostic listener failed:', error);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function getRuntimeDeliveryDiagnosticCounters() {
|
|
53
|
+
return { ...counters };
|
|
54
|
+
}
|
|
55
|
+
function resetRuntimeDeliveryDiagnosticsForTests() {
|
|
56
|
+
for (const name of exports.RUNTIME_DELIVERY_DIAGNOSTIC_NAMES)
|
|
57
|
+
counters[name] = 0;
|
|
58
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function encodeBase64UrlUtf8(value: string): string;
|
|
2
|
+
export declare function decodeBase64UrlBytes(value: string): number[];
|
|
3
|
+
export declare function decodeBase64UrlUtf8(value: string): string;
|
|
4
|
+
export declare function decodeUtf8Bytes(bytes: ArrayLike<number>): string;
|
|
5
|
+
export declare function utf8ByteLength(value: string): number;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encodeBase64UrlUtf8 = encodeBase64UrlUtf8;
|
|
4
|
+
exports.decodeBase64UrlBytes = decodeBase64UrlBytes;
|
|
5
|
+
exports.decodeBase64UrlUtf8 = decodeBase64UrlUtf8;
|
|
6
|
+
exports.decodeUtf8Bytes = decodeUtf8Bytes;
|
|
7
|
+
exports.utf8ByteLength = utf8ByteLength;
|
|
8
|
+
const BASE64_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
9
|
+
function utf8Bytes(value) {
|
|
10
|
+
const bytes = [];
|
|
11
|
+
for (const character of value) {
|
|
12
|
+
const codePoint = character.codePointAt(0);
|
|
13
|
+
if (codePoint <= 0x7f) {
|
|
14
|
+
bytes.push(codePoint);
|
|
15
|
+
}
|
|
16
|
+
else if (codePoint <= 0x7ff) {
|
|
17
|
+
bytes.push(0xc0 | (codePoint >> 6), 0x80 | (codePoint & 0x3f));
|
|
18
|
+
}
|
|
19
|
+
else if (codePoint <= 0xffff) {
|
|
20
|
+
bytes.push(0xe0 | (codePoint >> 12), 0x80 | ((codePoint >> 6) & 0x3f), 0x80 | (codePoint & 0x3f));
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
bytes.push(0xf0 | (codePoint >> 18), 0x80 | ((codePoint >> 12) & 0x3f), 0x80 | ((codePoint >> 6) & 0x3f), 0x80 | (codePoint & 0x3f));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return bytes;
|
|
27
|
+
}
|
|
28
|
+
function bytesToBase64(bytes) {
|
|
29
|
+
let result = '';
|
|
30
|
+
for (let index = 0; index < bytes.length; index += 3) {
|
|
31
|
+
const first = bytes[index];
|
|
32
|
+
const second = bytes[index + 1];
|
|
33
|
+
const third = bytes[index + 2];
|
|
34
|
+
const triple = (first << 16) | ((second || 0) << 8) | (third || 0);
|
|
35
|
+
result += BASE64_ALPHABET[(triple >> 18) & 0x3f];
|
|
36
|
+
result += BASE64_ALPHABET[(triple >> 12) & 0x3f];
|
|
37
|
+
result += second === undefined ? '=' : BASE64_ALPHABET[(triple >> 6) & 0x3f];
|
|
38
|
+
result += third === undefined ? '=' : BASE64_ALPHABET[triple & 0x3f];
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
function encodeBase64UrlUtf8(value) {
|
|
43
|
+
return bytesToBase64(utf8Bytes(value))
|
|
44
|
+
.replace(/=/g, '')
|
|
45
|
+
.replace(/\+/g, '-')
|
|
46
|
+
.replace(/\//g, '_');
|
|
47
|
+
}
|
|
48
|
+
function decodeBase64UrlBytes(value) {
|
|
49
|
+
if (!/^[A-Za-z0-9_-]*$/.test(value)) {
|
|
50
|
+
throw new Error('Invalid base64url value');
|
|
51
|
+
}
|
|
52
|
+
const normalized = value.replace(/-/g, '+').replace(/_/g, '/');
|
|
53
|
+
const padded = normalized + '='.repeat((4 - (normalized.length % 4)) % 4);
|
|
54
|
+
const bytes = [];
|
|
55
|
+
for (let index = 0; index < padded.length; index += 4) {
|
|
56
|
+
const a = BASE64_ALPHABET.indexOf(padded[index]);
|
|
57
|
+
const b = BASE64_ALPHABET.indexOf(padded[index + 1]);
|
|
58
|
+
const c = padded[index + 2] === '=' ? 0 : BASE64_ALPHABET.indexOf(padded[index + 2]);
|
|
59
|
+
const d = padded[index + 3] === '=' ? 0 : BASE64_ALPHABET.indexOf(padded[index + 3]);
|
|
60
|
+
if (a < 0 || b < 0 || c < 0 || d < 0)
|
|
61
|
+
throw new Error('Invalid base64url value');
|
|
62
|
+
const triple = (a << 18) | (b << 12) | (c << 6) | d;
|
|
63
|
+
bytes.push((triple >> 16) & 0xff);
|
|
64
|
+
if (padded[index + 2] !== '=')
|
|
65
|
+
bytes.push((triple >> 8) & 0xff);
|
|
66
|
+
if (padded[index + 3] !== '=')
|
|
67
|
+
bytes.push(triple & 0xff);
|
|
68
|
+
}
|
|
69
|
+
return bytes;
|
|
70
|
+
}
|
|
71
|
+
function decodeBase64UrlUtf8(value) {
|
|
72
|
+
return decodeUtf8Bytes(decodeBase64UrlBytes(value));
|
|
73
|
+
}
|
|
74
|
+
function decodeUtf8Bytes(bytes) {
|
|
75
|
+
let result = '';
|
|
76
|
+
let segment = '';
|
|
77
|
+
const flush = () => {
|
|
78
|
+
result += segment;
|
|
79
|
+
segment = '';
|
|
80
|
+
};
|
|
81
|
+
for (let index = 0; index < bytes.length;) {
|
|
82
|
+
const first = bytes[index];
|
|
83
|
+
let codePoint;
|
|
84
|
+
let width;
|
|
85
|
+
let minimum;
|
|
86
|
+
if (first <= 0x7f) {
|
|
87
|
+
codePoint = first;
|
|
88
|
+
width = 1;
|
|
89
|
+
minimum = 0;
|
|
90
|
+
}
|
|
91
|
+
else if (first >= 0xc2 && first <= 0xdf) {
|
|
92
|
+
codePoint = first & 0x1f;
|
|
93
|
+
width = 2;
|
|
94
|
+
minimum = 0x80;
|
|
95
|
+
}
|
|
96
|
+
else if (first >= 0xe0 && first <= 0xef) {
|
|
97
|
+
codePoint = first & 0x0f;
|
|
98
|
+
width = 3;
|
|
99
|
+
minimum = 0x800;
|
|
100
|
+
}
|
|
101
|
+
else if (first >= 0xf0 && first <= 0xf4) {
|
|
102
|
+
codePoint = first & 0x07;
|
|
103
|
+
width = 4;
|
|
104
|
+
minimum = 0x10000;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
throw new Error('Invalid UTF-8 payload');
|
|
108
|
+
}
|
|
109
|
+
if (index + width > bytes.length)
|
|
110
|
+
throw new Error('Invalid UTF-8 payload');
|
|
111
|
+
for (let offset = 1; offset < width; offset += 1) {
|
|
112
|
+
const continuation = bytes[index + offset];
|
|
113
|
+
if ((continuation & 0xc0) !== 0x80)
|
|
114
|
+
throw new Error('Invalid UTF-8 payload');
|
|
115
|
+
codePoint = (codePoint << 6) | (continuation & 0x3f);
|
|
116
|
+
}
|
|
117
|
+
if (codePoint < minimum ||
|
|
118
|
+
codePoint > 0x10ffff ||
|
|
119
|
+
(codePoint >= 0xd800 && codePoint <= 0xdfff)) {
|
|
120
|
+
throw new Error('Invalid UTF-8 payload');
|
|
121
|
+
}
|
|
122
|
+
segment += String.fromCodePoint(codePoint);
|
|
123
|
+
if (segment.length >= 8192)
|
|
124
|
+
flush();
|
|
125
|
+
index += width;
|
|
126
|
+
}
|
|
127
|
+
flush();
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
function utf8ByteLength(value) {
|
|
131
|
+
return utf8Bytes(value).length;
|
|
132
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
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.reportActiveInstallWhenDue = reportActiveInstallWhenDue;
|
|
7
|
+
exports.resetRuntimeDeliveryHeartbeatForTests = resetRuntimeDeliveryHeartbeatForTests;
|
|
8
|
+
const clientApi_1 = require("../api/clientApi");
|
|
9
|
+
const context_1 = require("../context");
|
|
10
|
+
const fsUtils_1 = require("../fs/fsUtils");
|
|
11
|
+
const fs_1 = __importDefault(require("../native/fs"));
|
|
12
|
+
const HEARTBEAT_STATE_PATH = `${context_1.BUNDLE_DROP_ROOT}/runtime-delivery-heartbeats.json`;
|
|
13
|
+
const STABLE_HEARTBEAT_INTERVAL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
14
|
+
const inFlight = new Set();
|
|
15
|
+
let stateMutation = Promise.resolve();
|
|
16
|
+
async function readState() {
|
|
17
|
+
try {
|
|
18
|
+
const parsed = JSON.parse(await fs_1.default.readFile(HEARTBEAT_STATE_PATH, 'utf8'));
|
|
19
|
+
if (parsed.schemaVersion === 1 && parsed.reportedAt && typeof parsed.reportedAt === 'object') {
|
|
20
|
+
return {
|
|
21
|
+
schemaVersion: 1,
|
|
22
|
+
reportedAt: parsed.reportedAt,
|
|
23
|
+
fingerprints: parsed.fingerprints && typeof parsed.fingerprints === 'object'
|
|
24
|
+
? parsed.fingerprints
|
|
25
|
+
: {},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// A missing heartbeat cache means this install may report once.
|
|
31
|
+
}
|
|
32
|
+
return { schemaVersion: 1, reportedAt: {}, fingerprints: {} };
|
|
33
|
+
}
|
|
34
|
+
async function heartbeatFingerprint(payload) {
|
|
35
|
+
const userProperties = payload.userProperties
|
|
36
|
+
? Object.fromEntries(Object.entries(payload.userProperties).sort(([left], [right]) => left.localeCompare(right)))
|
|
37
|
+
: null;
|
|
38
|
+
return fs_1.default.sha256String(JSON.stringify({
|
|
39
|
+
currentHash: payload.currentHash,
|
|
40
|
+
environment: payload.environment ?? null,
|
|
41
|
+
userProperties,
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
function heartbeatKey(projectSlug, payload) {
|
|
45
|
+
return [
|
|
46
|
+
projectSlug,
|
|
47
|
+
payload.channelName,
|
|
48
|
+
payload.platform,
|
|
49
|
+
payload.runtimeVersion,
|
|
50
|
+
payload.installId,
|
|
51
|
+
].map(encodeURIComponent).join('/');
|
|
52
|
+
}
|
|
53
|
+
function reportActiveInstallWhenDue(projectSlug, payload) {
|
|
54
|
+
const key = heartbeatKey(projectSlug, payload);
|
|
55
|
+
if (inFlight.has(key))
|
|
56
|
+
return;
|
|
57
|
+
inFlight.add(key);
|
|
58
|
+
void (async () => {
|
|
59
|
+
try {
|
|
60
|
+
const state = await readState();
|
|
61
|
+
const now = Date.now();
|
|
62
|
+
const fingerprint = await heartbeatFingerprint(payload);
|
|
63
|
+
if (state.fingerprints[key] === fingerprint &&
|
|
64
|
+
now - (state.reportedAt[key] || 0) < STABLE_HEARTBEAT_INTERVAL_MS) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
await (0, clientApi_1.postOtaActiveInstallHeartbeat)(projectSlug, payload);
|
|
68
|
+
const mutation = stateMutation.then(async () => {
|
|
69
|
+
const latest = await readState();
|
|
70
|
+
latest.reportedAt[key] = now;
|
|
71
|
+
latest.fingerprints[key] = fingerprint;
|
|
72
|
+
await (0, fsUtils_1.atomicWriteJson)(HEARTBEAT_STATE_PATH, latest);
|
|
73
|
+
});
|
|
74
|
+
stateMutation = mutation.then(() => undefined, () => undefined);
|
|
75
|
+
await mutation;
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
console.warn('⚠️ BundleDrop active-install heartbeat failed:', error);
|
|
79
|
+
}
|
|
80
|
+
finally {
|
|
81
|
+
inFlight.delete(key);
|
|
82
|
+
}
|
|
83
|
+
})();
|
|
84
|
+
}
|
|
85
|
+
function resetRuntimeDeliveryHeartbeatForTests() {
|
|
86
|
+
inFlight.clear();
|
|
87
|
+
stateMutation = Promise.resolve();
|
|
88
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { RuntimeDeliveryLaneManifest, RuntimeDeliveryPatchEdge, RuntimeDeliveryRelease } from './types';
|
|
2
|
+
export type LocalResolution = {
|
|
3
|
+
action: 'NOOP';
|
|
4
|
+
reason: string;
|
|
5
|
+
} | {
|
|
6
|
+
action: 'ROLLBACK';
|
|
7
|
+
reason: string;
|
|
8
|
+
} | {
|
|
9
|
+
action: 'INSTALL';
|
|
10
|
+
target: RuntimeDeliveryRelease;
|
|
11
|
+
mode: 'full' | 'patch';
|
|
12
|
+
patchEdge?: RuntimeDeliveryPatchEdge;
|
|
13
|
+
};
|
|
14
|
+
export type LocalResolutionInput = {
|
|
15
|
+
currentHash: string | null;
|
|
16
|
+
rejectedHashes: string[];
|
|
17
|
+
installId: string;
|
|
18
|
+
patchAlgorithms: string[];
|
|
19
|
+
supportsContentAddressedAssets: boolean;
|
|
20
|
+
now?: number;
|
|
21
|
+
};
|
|
22
|
+
export declare function rolloutBucket(installId: string): Promise<number>;
|
|
23
|
+
export declare function resolveRuntimeDeliveryLane(manifest: RuntimeDeliveryLaneManifest, input: LocalResolutionInput): Promise<LocalResolution>;
|