@hot-updater/protocol 1.2.0-rc.6 → 1.2.0-rc.60
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/dist/index.cjs +26 -13
- package/dist/index.d.cts +48 -7
- package/dist/index.d.mts +48 -7
- package/dist/index.mjs +26 -14
- package/dist/native-artifact.cjs +484 -19
- package/dist/native-artifact.d.cts +219 -2
- package/dist/native-artifact.d.mts +219 -2
- package/dist/native-artifact.mjs +466 -21
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@ declare class NativeArtifactError extends Error {
|
|
|
22
22
|
* What can keep an artifact from being imported as a native build: the
|
|
23
23
|
* codes `native-build import --json` reports.
|
|
24
24
|
*/
|
|
25
|
-
type NativeArtifactProblemCode = "UNSUPPORTED_FILE" | "UNREADABLE" | "NO_BUILT_IN_BUNDLE" | "NO_MIN_BUNDLE_ID" | "AMBIGUOUS_MIN_BUNDLE_ID" | "NO_FINGERPRINT" | "AMBIGUOUS_FINGERPRINT" | "NO_APP_VERSION" | "INVALID_SCOPE" | "APP_ID_MISMATCH" | "ALREADY_IMPORTED";
|
|
25
|
+
type NativeArtifactProblemCode = "UNSUPPORTED_FILE" | "UNREADABLE" | "NO_BUILT_IN_BUNDLE" | "NO_MIN_BUNDLE_ID" | "AMBIGUOUS_MIN_BUNDLE_ID" | "NO_FINGERPRINT" | "AMBIGUOUS_FINGERPRINT" | "NO_APP_VERSION" | "INVALID_SCOPE" | "SANDBOX_MISMATCH" | "APP_ID_MISMATCH" | "ALREADY_IMPORTED";
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/nativeArtifact/readNativeArtifact.d.ts
|
|
28
28
|
/**
|
|
@@ -63,6 +63,23 @@ interface NativeArtifactInfo {
|
|
|
63
63
|
* with fingerprint.json compiles its fingerprint in as one.
|
|
64
64
|
*/
|
|
65
65
|
readonly fingerprintCandidates: readonly string[];
|
|
66
|
+
/**
|
|
67
|
+
* The sandbox layer in the artifact: `code` when the app's code holds its
|
|
68
|
+
* literal, and `declared` when the Info.plist or the manifest says so. A
|
|
69
|
+
* sandbox build has both, and a normal build neither.
|
|
70
|
+
*/
|
|
71
|
+
readonly sandbox: {
|
|
72
|
+
readonly code: boolean;
|
|
73
|
+
readonly declared: boolean;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* How the app is entered, which a sandbox build changes: its launcher
|
|
77
|
+
* components (empty on iOS), and the sandbox URL scheme it registers.
|
|
78
|
+
*/
|
|
79
|
+
readonly entry: {
|
|
80
|
+
readonly launchers: readonly string[];
|
|
81
|
+
readonly sandboxUrlScheme: string | null;
|
|
82
|
+
};
|
|
66
83
|
/** The JavaScript bundle the build packed, the built-in bundle. */
|
|
67
84
|
readonly builtInBundle: {
|
|
68
85
|
readonly path: string;
|
|
@@ -99,9 +116,20 @@ interface ImportableNativeBuild {
|
|
|
99
116
|
/** The channel the app reports: its own, or `production` without one. */
|
|
100
117
|
readonly channel: string;
|
|
101
118
|
readonly fingerprintHash: string | null;
|
|
119
|
+
/** The version OTAs target: null under the fingerprint strategy. */
|
|
102
120
|
readonly appVersion: string | null;
|
|
121
|
+
/**
|
|
122
|
+
* The app version the artifact reports, its `CFBundleShortVersionString`
|
|
123
|
+
* or `versionName`, whatever the update strategy: null when it has none
|
|
124
|
+
* or it can't be read.
|
|
125
|
+
*/
|
|
126
|
+
readonly nativeAppVersion: string | null;
|
|
103
127
|
/** The built-in bundle's entry in the archive. */
|
|
104
128
|
readonly builtInBundlePath: string;
|
|
129
|
+
/** Whether the artifact holds the sandbox layer: a sandbox build. */
|
|
130
|
+
readonly sandbox: boolean;
|
|
131
|
+
/** The URL scheme a sandbox build registers; null for any other build. */
|
|
132
|
+
readonly sandboxUrlScheme: string | null;
|
|
105
133
|
}
|
|
106
134
|
type NativeArtifactCheck = ({
|
|
107
135
|
readonly ok: true;
|
|
@@ -116,6 +144,13 @@ type NativeArtifactCheck = ({
|
|
|
116
144
|
*/
|
|
117
145
|
readonly warnings: readonly NativeArtifactProblem[];
|
|
118
146
|
};
|
|
147
|
+
/**
|
|
148
|
+
* Why an artifact can't register as what it is: the sandbox layer must be
|
|
149
|
+
* whole or absent, and a sandbox build must have the URL scheme its links
|
|
150
|
+
* open and the launcher its screen takes. A sandbox build registers on any
|
|
151
|
+
* channel, as any build does.
|
|
152
|
+
*/
|
|
153
|
+
declare const sandboxArtifactProblem: ({ kind, platform, sandbox, entry }: NativeArtifactInfo) => NativeArtifactProblem | null;
|
|
119
154
|
/**
|
|
120
155
|
* Whether a read artifact can be imported as a native build, whose built-in
|
|
121
156
|
* bundle OTAs patch from, and what it registers as. It refuses an artifact
|
|
@@ -142,6 +177,80 @@ declare const checkNativeArtifact: (info: NativeArtifactInfo, { updateStrategy,
|
|
|
142
177
|
*/
|
|
143
178
|
declare const alreadyImportedProblem: (minBundleId: string, nativeBuildId: string | null) => NativeArtifactProblem;
|
|
144
179
|
//#endregion
|
|
180
|
+
//#region src/nativeArtifact/iosInstall.d.ts
|
|
181
|
+
/**
|
|
182
|
+
* How an `.ipa`'s profile lets it install: on the devices it lists (`ad-hoc`,
|
|
183
|
+
* `development`), on any device of the team's company (`enterprise`), or only
|
|
184
|
+
* through a store, as an App Store export's has no device list (`store`).
|
|
185
|
+
*/
|
|
186
|
+
type IpaDistribution = "ad-hoc" | "development" | "enterprise" | "store";
|
|
187
|
+
/** What installing an `.ipa` over the air needs to know, read from the `.ipa`. */
|
|
188
|
+
interface IpaInstallInfo {
|
|
189
|
+
/** `CFBundleIdentifier`. */
|
|
190
|
+
readonly bundleId: string;
|
|
191
|
+
/** `CFBundleVersion`. */
|
|
192
|
+
readonly bundleVersion: string;
|
|
193
|
+
/** The name an install shows: `CFBundleDisplayName`, or `CFBundleName`. */
|
|
194
|
+
readonly title: string;
|
|
195
|
+
readonly distribution: IpaDistribution;
|
|
196
|
+
/**
|
|
197
|
+
* The normalized UDIDs that every profile of the app lists, so a device
|
|
198
|
+
* here installs all of it. Empty for `enterprise` and `store`.
|
|
199
|
+
*/
|
|
200
|
+
readonly devices: readonly string[];
|
|
201
|
+
/** When the first of the app's profiles expires, or null with none. */
|
|
202
|
+
readonly expiresAtMs: number | null;
|
|
203
|
+
/**
|
|
204
|
+
* The bundle ID of the app and of each extension with a profile of its own,
|
|
205
|
+
* the app's first: what signing a new `.ipa` needs a profile for.
|
|
206
|
+
*/
|
|
207
|
+
readonly profileBundleIds: readonly string[];
|
|
208
|
+
/**
|
|
209
|
+
* The Apple Developer team the app's profile belongs to, its
|
|
210
|
+
* `TeamIdentifier`: null for an IPA with no profile.
|
|
211
|
+
*/
|
|
212
|
+
readonly teamId: string | null;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* The form two UDIDs compare in, or null for text that isn't one. Apple writes
|
|
216
|
+
* them in either case, and App Store Connect takes the device's own.
|
|
217
|
+
*/
|
|
218
|
+
declare const normalizeIosUdid: (value: string) => string | null;
|
|
219
|
+
/**
|
|
220
|
+
* The UDID in a Profile Service answer's body, or null when it has no one
|
|
221
|
+
* well-formed UDID. It only finds the text: nothing here verifies the signature
|
|
222
|
+
* around it, so nothing automated may trust the result.
|
|
223
|
+
*/
|
|
224
|
+
declare const readProfileServiceUdid: (body: Uint8Array) => string | null;
|
|
225
|
+
/** What a provisioning profile file says it is for and whom it lists. */
|
|
226
|
+
interface ProvisioningProfileInfo {
|
|
227
|
+
/** Its `UUID`, which Xcode names the file it saves after. */
|
|
228
|
+
readonly uuid: string | null;
|
|
229
|
+
readonly distribution: IpaDistribution;
|
|
230
|
+
/** The first of its `TeamIdentifier`s. */
|
|
231
|
+
readonly teamId: string | null;
|
|
232
|
+
/** Its `application-identifier` entitlement, such as `ABCDE12345.com.example.app`. */
|
|
233
|
+
readonly applicationIdentifier: string | null;
|
|
234
|
+
/** Whether Xcode made it and manages it: `IsXcodeManaged`. */
|
|
235
|
+
readonly xcodeManaged: boolean;
|
|
236
|
+
/** The normalized UDIDs it lists: empty for one that lists none. */
|
|
237
|
+
readonly devices: readonly string[];
|
|
238
|
+
readonly expiresAtMs: number | null;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* What a provisioning profile's bytes (a `.mobileprovision`, a CMS message
|
|
242
|
+
* around a plist) say: the same reading an `.ipa`'s profiles get. It verifies
|
|
243
|
+
* no signature. Throws `NativeArtifactError` for one it can't read.
|
|
244
|
+
*/
|
|
245
|
+
declare const readProvisioningProfile: (bytes: Uint8Array) => ProvisioningProfileInfo;
|
|
246
|
+
/**
|
|
247
|
+
* What an `.ipa` installs as, reading only its directory, its app's Info.plist
|
|
248
|
+
* and its provisioning profiles: a few requests of a remote file, whatever its
|
|
249
|
+
* size. The `.ipa` is untrusted, and each part is bounded before it is read.
|
|
250
|
+
* Throws `NativeArtifactError` for one it can't read.
|
|
251
|
+
*/
|
|
252
|
+
declare const readIpaInstallInfo: (source: ByteSource) => Promise<IpaInstallInfo>;
|
|
253
|
+
//#endregion
|
|
145
254
|
//#region src/nativeArtifact/zip.d.ts
|
|
146
255
|
/** One file of a zip archive, from its central directory. */
|
|
147
256
|
interface ZipEntry {
|
|
@@ -176,4 +285,112 @@ declare const openZipEntry: (source: ByteSource, entry: ZipEntry, { maxBytes }?:
|
|
|
176
285
|
readonly maxBytes?: number;
|
|
177
286
|
}) => Promise<ReadableStream<Uint8Array>>;
|
|
178
287
|
//#endregion
|
|
179
|
-
|
|
288
|
+
//#region src/nativeArtifact/sandbox.d.ts
|
|
289
|
+
/**
|
|
290
|
+
* The literal the sandbox layer's code holds, in `ios/HotUpdater/Sandbox` and
|
|
291
|
+
* `android/src/sandbox`: reading an artifact's strings finds it. Its length
|
|
292
|
+
* is its own among the lengths those reads keep.
|
|
293
|
+
*/
|
|
294
|
+
declare const SANDBOX_CODE_MARKER = "HOT_UPDATER_SANDBOX_NATIVE_LAYER";
|
|
295
|
+
/** The Info.plist key an iOS sandbox build declares itself with. */
|
|
296
|
+
declare const SANDBOX_INFO_PLIST_KEY = "HOT_UPDATER_SANDBOX";
|
|
297
|
+
/**
|
|
298
|
+
* The Info.plist key that records the URL scheme an iOS sandbox build
|
|
299
|
+
* registers in its `SANDBOX_URL_TYPE_NAME` URL type: the build reads its own
|
|
300
|
+
* scheme from it, and a later patch knows which scheme is the sandbox's.
|
|
301
|
+
*/
|
|
302
|
+
declare const SANDBOX_URL_SCHEME_INFO_PLIST_KEY = "HOT_UPDATER_SANDBOX_URL_SCHEME";
|
|
303
|
+
/**
|
|
304
|
+
* Whether a value is a URL scheme in lower-case ASCII, as written: what a
|
|
305
|
+
* build records, read before any lower-casing.
|
|
306
|
+
*/
|
|
307
|
+
declare const isRecordedUrlSchemeSyntax: (value: unknown) => value is string;
|
|
308
|
+
/**
|
|
309
|
+
* The URL scheme an iOS sandbox build registers, by one rule its patch, its
|
|
310
|
+
* reader, and its own code apply alike. `recorded` is the Info.plist's
|
|
311
|
+
* `SANDBOX_URL_SCHEME_INFO_PLIST_KEY`, undefined when the key is absent, and
|
|
312
|
+
* `namedTypes` its URL types named `SANDBOX_URL_TYPE_NAME`.
|
|
313
|
+
* - Absent: a prerelease's build, which recorded none. Undefined: the caller
|
|
314
|
+
* reads it the way that build was read.
|
|
315
|
+
* - Present: a scheme in lower-case ASCII, as written, that the one URL type
|
|
316
|
+
* of the name holds alone. Anything else is null, with no fallback.
|
|
317
|
+
*/
|
|
318
|
+
declare const recordedSandboxUrlScheme: (recorded: unknown, namedTypes: readonly unknown[]) => string | null | undefined;
|
|
319
|
+
/** The `<meta-data>` an Android sandbox build declares itself with. */
|
|
320
|
+
declare const SANDBOX_META_DATA = "com.hotupdater.SANDBOX";
|
|
321
|
+
/** The activity that takes an Android sandbox build's launcher entry and links. */
|
|
322
|
+
declare const SANDBOX_ACTIVITY = "com.hotupdater.HotUpdaterSandboxActivity";
|
|
323
|
+
/** The `applicationIdSuffix` an Android sandbox build appends. */
|
|
324
|
+
declare const SANDBOX_APPLICATION_ID_SUFFIX = ".sandbox";
|
|
325
|
+
/**
|
|
326
|
+
* The `CFBundleURLName` of the URL type an iOS sandbox build registers its URL
|
|
327
|
+
* scheme with, which the build reads its own scheme from.
|
|
328
|
+
*/
|
|
329
|
+
declare const SANDBOX_URL_TYPE_NAME = "hot-updater-sandbox";
|
|
330
|
+
/**
|
|
331
|
+
* The `<meta-data>` of `SANDBOX_ACTIVITY` that names the URL scheme an Android
|
|
332
|
+
* sandbox build registers, which the build reads its own scheme from.
|
|
333
|
+
*/
|
|
334
|
+
declare const SANDBOX_URL_SCHEME_META_DATA = "com.hotupdater.sandbox.URL_SCHEME";
|
|
335
|
+
/**
|
|
336
|
+
* The URL scheme a sandbox build registers when its scheme sets none, derived
|
|
337
|
+
* from the app's ID: the app's own scheme would ask which app to open beside
|
|
338
|
+
* the store app.
|
|
339
|
+
*/
|
|
340
|
+
declare const sandboxUrlSchemeOf: (appId: string) => string;
|
|
341
|
+
/**
|
|
342
|
+
* Whether a URL scheme has the prefix of the derived one: how an artifact built
|
|
343
|
+
* before the URL scheme could be set is read, which registered no other.
|
|
344
|
+
*/
|
|
345
|
+
declare const isSandboxUrlScheme: (scheme: string) => boolean;
|
|
346
|
+
/**
|
|
347
|
+
* Whether `sandbox: { urlScheme }` can name a URL scheme: lower case, a letter
|
|
348
|
+
* then up to 63 letters, digits, `+`, `.` or `-`, none the system or a browser
|
|
349
|
+
* owns, and neither `true` nor `false`, which Android's manifest can't hold as
|
|
350
|
+
* a string.
|
|
351
|
+
*/
|
|
352
|
+
declare const isConfigurableSandboxUrlScheme: (urlScheme: string) => boolean;
|
|
353
|
+
/** The platform a preview link is for. */
|
|
354
|
+
type PreviewLinkPlatform = "ios" | "android";
|
|
355
|
+
/** What a preview link asks a sandbox build to run. */
|
|
356
|
+
interface PreviewLink {
|
|
357
|
+
/** The sandbox's URL scheme, in lower case. */
|
|
358
|
+
readonly urlScheme: string;
|
|
359
|
+
readonly channel: string;
|
|
360
|
+
/** The fingerprint the channel's bundles need; another build refuses them. */
|
|
361
|
+
readonly fingerprintHash: string;
|
|
362
|
+
/**
|
|
363
|
+
* The platform the link is for, absent from a link that names none: the
|
|
364
|
+
* other platform's sandbox build, which both can register the same scheme
|
|
365
|
+
* for, says which QR code to scan instead.
|
|
366
|
+
*/
|
|
367
|
+
readonly platform?: PreviewLinkPlatform;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* The link a preview QR holds. `urlScheme` is the one the sandbox build
|
|
371
|
+
* registered; without it, the one derived from `appId`, the scheme's
|
|
372
|
+
* `bundleIdentifier` or `packageName`: the ID before the Android sandbox's
|
|
373
|
+
* `.sandbox` suffix.
|
|
374
|
+
*/
|
|
375
|
+
declare const createPreviewLink: ({ urlScheme, appId, channel, fingerprintHash, platform }: {
|
|
376
|
+
readonly channel: string;
|
|
377
|
+
readonly fingerprintHash: string;
|
|
378
|
+
readonly platform?: PreviewLinkPlatform;
|
|
379
|
+
} & ({
|
|
380
|
+
readonly urlScheme: string;
|
|
381
|
+
readonly appId?: string;
|
|
382
|
+
} | {
|
|
383
|
+
readonly urlScheme?: undefined;
|
|
384
|
+
readonly appId: string;
|
|
385
|
+
})) => string;
|
|
386
|
+
/**
|
|
387
|
+
* What a preview link says, or null for anything else: another shape, a
|
|
388
|
+
* repeated or missing parameter, or a channel no release can target. It takes
|
|
389
|
+
* any URL scheme: a sandbox build refuses a link of another scheme than its
|
|
390
|
+
* own. A `platform` other than `ios` or `android` reads as none. Native code
|
|
391
|
+
* parses it the same way before any JavaScript runs, in HotUpdaterSandboxLink,
|
|
392
|
+
* and shares the vectors in test-utils' `sandbox-preview-links.json`.
|
|
393
|
+
*/
|
|
394
|
+
declare const parsePreviewLink: (link: string) => PreviewLink | null;
|
|
395
|
+
//#endregion
|
|
396
|
+
export { type ByteSource, type ImportableNativeBuild, type IpaDistribution, type IpaInstallInfo, type NativeArtifactCheck, NativeArtifactError, type NativeArtifactInfo, type NativeArtifactKind, type NativeArtifactProblem, type NativeArtifactProblemCode, type PreviewLink, type PreviewLinkPlatform, type ProvisioningProfileInfo, SANDBOX_ACTIVITY, SANDBOX_APPLICATION_ID_SUFFIX, SANDBOX_CODE_MARKER, SANDBOX_INFO_PLIST_KEY, SANDBOX_META_DATA, SANDBOX_URL_SCHEME_INFO_PLIST_KEY, SANDBOX_URL_SCHEME_META_DATA, SANDBOX_URL_TYPE_NAME, type UnreadableValue, type ZipEntry, alreadyImportedProblem, blobSource, checkNativeArtifact, createPreviewLink, findZipEntry, isConfigurableSandboxUrlScheme, isRecordedUrlSchemeSyntax, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readProvisioningProfile, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxUrlSchemeOf };
|
|
@@ -22,7 +22,7 @@ declare class NativeArtifactError extends Error {
|
|
|
22
22
|
* What can keep an artifact from being imported as a native build: the
|
|
23
23
|
* codes `native-build import --json` reports.
|
|
24
24
|
*/
|
|
25
|
-
type NativeArtifactProblemCode = "UNSUPPORTED_FILE" | "UNREADABLE" | "NO_BUILT_IN_BUNDLE" | "NO_MIN_BUNDLE_ID" | "AMBIGUOUS_MIN_BUNDLE_ID" | "NO_FINGERPRINT" | "AMBIGUOUS_FINGERPRINT" | "NO_APP_VERSION" | "INVALID_SCOPE" | "APP_ID_MISMATCH" | "ALREADY_IMPORTED";
|
|
25
|
+
type NativeArtifactProblemCode = "UNSUPPORTED_FILE" | "UNREADABLE" | "NO_BUILT_IN_BUNDLE" | "NO_MIN_BUNDLE_ID" | "AMBIGUOUS_MIN_BUNDLE_ID" | "NO_FINGERPRINT" | "AMBIGUOUS_FINGERPRINT" | "NO_APP_VERSION" | "INVALID_SCOPE" | "SANDBOX_MISMATCH" | "APP_ID_MISMATCH" | "ALREADY_IMPORTED";
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/nativeArtifact/readNativeArtifact.d.ts
|
|
28
28
|
/**
|
|
@@ -63,6 +63,23 @@ interface NativeArtifactInfo {
|
|
|
63
63
|
* with fingerprint.json compiles its fingerprint in as one.
|
|
64
64
|
*/
|
|
65
65
|
readonly fingerprintCandidates: readonly string[];
|
|
66
|
+
/**
|
|
67
|
+
* The sandbox layer in the artifact: `code` when the app's code holds its
|
|
68
|
+
* literal, and `declared` when the Info.plist or the manifest says so. A
|
|
69
|
+
* sandbox build has both, and a normal build neither.
|
|
70
|
+
*/
|
|
71
|
+
readonly sandbox: {
|
|
72
|
+
readonly code: boolean;
|
|
73
|
+
readonly declared: boolean;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* How the app is entered, which a sandbox build changes: its launcher
|
|
77
|
+
* components (empty on iOS), and the sandbox URL scheme it registers.
|
|
78
|
+
*/
|
|
79
|
+
readonly entry: {
|
|
80
|
+
readonly launchers: readonly string[];
|
|
81
|
+
readonly sandboxUrlScheme: string | null;
|
|
82
|
+
};
|
|
66
83
|
/** The JavaScript bundle the build packed, the built-in bundle. */
|
|
67
84
|
readonly builtInBundle: {
|
|
68
85
|
readonly path: string;
|
|
@@ -99,9 +116,20 @@ interface ImportableNativeBuild {
|
|
|
99
116
|
/** The channel the app reports: its own, or `production` without one. */
|
|
100
117
|
readonly channel: string;
|
|
101
118
|
readonly fingerprintHash: string | null;
|
|
119
|
+
/** The version OTAs target: null under the fingerprint strategy. */
|
|
102
120
|
readonly appVersion: string | null;
|
|
121
|
+
/**
|
|
122
|
+
* The app version the artifact reports, its `CFBundleShortVersionString`
|
|
123
|
+
* or `versionName`, whatever the update strategy: null when it has none
|
|
124
|
+
* or it can't be read.
|
|
125
|
+
*/
|
|
126
|
+
readonly nativeAppVersion: string | null;
|
|
103
127
|
/** The built-in bundle's entry in the archive. */
|
|
104
128
|
readonly builtInBundlePath: string;
|
|
129
|
+
/** Whether the artifact holds the sandbox layer: a sandbox build. */
|
|
130
|
+
readonly sandbox: boolean;
|
|
131
|
+
/** The URL scheme a sandbox build registers; null for any other build. */
|
|
132
|
+
readonly sandboxUrlScheme: string | null;
|
|
105
133
|
}
|
|
106
134
|
type NativeArtifactCheck = ({
|
|
107
135
|
readonly ok: true;
|
|
@@ -116,6 +144,13 @@ type NativeArtifactCheck = ({
|
|
|
116
144
|
*/
|
|
117
145
|
readonly warnings: readonly NativeArtifactProblem[];
|
|
118
146
|
};
|
|
147
|
+
/**
|
|
148
|
+
* Why an artifact can't register as what it is: the sandbox layer must be
|
|
149
|
+
* whole or absent, and a sandbox build must have the URL scheme its links
|
|
150
|
+
* open and the launcher its screen takes. A sandbox build registers on any
|
|
151
|
+
* channel, as any build does.
|
|
152
|
+
*/
|
|
153
|
+
declare const sandboxArtifactProblem: ({ kind, platform, sandbox, entry }: NativeArtifactInfo) => NativeArtifactProblem | null;
|
|
119
154
|
/**
|
|
120
155
|
* Whether a read artifact can be imported as a native build, whose built-in
|
|
121
156
|
* bundle OTAs patch from, and what it registers as. It refuses an artifact
|
|
@@ -142,6 +177,80 @@ declare const checkNativeArtifact: (info: NativeArtifactInfo, { updateStrategy,
|
|
|
142
177
|
*/
|
|
143
178
|
declare const alreadyImportedProblem: (minBundleId: string, nativeBuildId: string | null) => NativeArtifactProblem;
|
|
144
179
|
//#endregion
|
|
180
|
+
//#region src/nativeArtifact/iosInstall.d.ts
|
|
181
|
+
/**
|
|
182
|
+
* How an `.ipa`'s profile lets it install: on the devices it lists (`ad-hoc`,
|
|
183
|
+
* `development`), on any device of the team's company (`enterprise`), or only
|
|
184
|
+
* through a store, as an App Store export's has no device list (`store`).
|
|
185
|
+
*/
|
|
186
|
+
type IpaDistribution = "ad-hoc" | "development" | "enterprise" | "store";
|
|
187
|
+
/** What installing an `.ipa` over the air needs to know, read from the `.ipa`. */
|
|
188
|
+
interface IpaInstallInfo {
|
|
189
|
+
/** `CFBundleIdentifier`. */
|
|
190
|
+
readonly bundleId: string;
|
|
191
|
+
/** `CFBundleVersion`. */
|
|
192
|
+
readonly bundleVersion: string;
|
|
193
|
+
/** The name an install shows: `CFBundleDisplayName`, or `CFBundleName`. */
|
|
194
|
+
readonly title: string;
|
|
195
|
+
readonly distribution: IpaDistribution;
|
|
196
|
+
/**
|
|
197
|
+
* The normalized UDIDs that every profile of the app lists, so a device
|
|
198
|
+
* here installs all of it. Empty for `enterprise` and `store`.
|
|
199
|
+
*/
|
|
200
|
+
readonly devices: readonly string[];
|
|
201
|
+
/** When the first of the app's profiles expires, or null with none. */
|
|
202
|
+
readonly expiresAtMs: number | null;
|
|
203
|
+
/**
|
|
204
|
+
* The bundle ID of the app and of each extension with a profile of its own,
|
|
205
|
+
* the app's first: what signing a new `.ipa` needs a profile for.
|
|
206
|
+
*/
|
|
207
|
+
readonly profileBundleIds: readonly string[];
|
|
208
|
+
/**
|
|
209
|
+
* The Apple Developer team the app's profile belongs to, its
|
|
210
|
+
* `TeamIdentifier`: null for an IPA with no profile.
|
|
211
|
+
*/
|
|
212
|
+
readonly teamId: string | null;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* The form two UDIDs compare in, or null for text that isn't one. Apple writes
|
|
216
|
+
* them in either case, and App Store Connect takes the device's own.
|
|
217
|
+
*/
|
|
218
|
+
declare const normalizeIosUdid: (value: string) => string | null;
|
|
219
|
+
/**
|
|
220
|
+
* The UDID in a Profile Service answer's body, or null when it has no one
|
|
221
|
+
* well-formed UDID. It only finds the text: nothing here verifies the signature
|
|
222
|
+
* around it, so nothing automated may trust the result.
|
|
223
|
+
*/
|
|
224
|
+
declare const readProfileServiceUdid: (body: Uint8Array) => string | null;
|
|
225
|
+
/** What a provisioning profile file says it is for and whom it lists. */
|
|
226
|
+
interface ProvisioningProfileInfo {
|
|
227
|
+
/** Its `UUID`, which Xcode names the file it saves after. */
|
|
228
|
+
readonly uuid: string | null;
|
|
229
|
+
readonly distribution: IpaDistribution;
|
|
230
|
+
/** The first of its `TeamIdentifier`s. */
|
|
231
|
+
readonly teamId: string | null;
|
|
232
|
+
/** Its `application-identifier` entitlement, such as `ABCDE12345.com.example.app`. */
|
|
233
|
+
readonly applicationIdentifier: string | null;
|
|
234
|
+
/** Whether Xcode made it and manages it: `IsXcodeManaged`. */
|
|
235
|
+
readonly xcodeManaged: boolean;
|
|
236
|
+
/** The normalized UDIDs it lists: empty for one that lists none. */
|
|
237
|
+
readonly devices: readonly string[];
|
|
238
|
+
readonly expiresAtMs: number | null;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* What a provisioning profile's bytes (a `.mobileprovision`, a CMS message
|
|
242
|
+
* around a plist) say: the same reading an `.ipa`'s profiles get. It verifies
|
|
243
|
+
* no signature. Throws `NativeArtifactError` for one it can't read.
|
|
244
|
+
*/
|
|
245
|
+
declare const readProvisioningProfile: (bytes: Uint8Array) => ProvisioningProfileInfo;
|
|
246
|
+
/**
|
|
247
|
+
* What an `.ipa` installs as, reading only its directory, its app's Info.plist
|
|
248
|
+
* and its provisioning profiles: a few requests of a remote file, whatever its
|
|
249
|
+
* size. The `.ipa` is untrusted, and each part is bounded before it is read.
|
|
250
|
+
* Throws `NativeArtifactError` for one it can't read.
|
|
251
|
+
*/
|
|
252
|
+
declare const readIpaInstallInfo: (source: ByteSource) => Promise<IpaInstallInfo>;
|
|
253
|
+
//#endregion
|
|
145
254
|
//#region src/nativeArtifact/zip.d.ts
|
|
146
255
|
/** One file of a zip archive, from its central directory. */
|
|
147
256
|
interface ZipEntry {
|
|
@@ -176,4 +285,112 @@ declare const openZipEntry: (source: ByteSource, entry: ZipEntry, { maxBytes }?:
|
|
|
176
285
|
readonly maxBytes?: number;
|
|
177
286
|
}) => Promise<ReadableStream<Uint8Array>>;
|
|
178
287
|
//#endregion
|
|
179
|
-
|
|
288
|
+
//#region src/nativeArtifact/sandbox.d.ts
|
|
289
|
+
/**
|
|
290
|
+
* The literal the sandbox layer's code holds, in `ios/HotUpdater/Sandbox` and
|
|
291
|
+
* `android/src/sandbox`: reading an artifact's strings finds it. Its length
|
|
292
|
+
* is its own among the lengths those reads keep.
|
|
293
|
+
*/
|
|
294
|
+
declare const SANDBOX_CODE_MARKER = "HOT_UPDATER_SANDBOX_NATIVE_LAYER";
|
|
295
|
+
/** The Info.plist key an iOS sandbox build declares itself with. */
|
|
296
|
+
declare const SANDBOX_INFO_PLIST_KEY = "HOT_UPDATER_SANDBOX";
|
|
297
|
+
/**
|
|
298
|
+
* The Info.plist key that records the URL scheme an iOS sandbox build
|
|
299
|
+
* registers in its `SANDBOX_URL_TYPE_NAME` URL type: the build reads its own
|
|
300
|
+
* scheme from it, and a later patch knows which scheme is the sandbox's.
|
|
301
|
+
*/
|
|
302
|
+
declare const SANDBOX_URL_SCHEME_INFO_PLIST_KEY = "HOT_UPDATER_SANDBOX_URL_SCHEME";
|
|
303
|
+
/**
|
|
304
|
+
* Whether a value is a URL scheme in lower-case ASCII, as written: what a
|
|
305
|
+
* build records, read before any lower-casing.
|
|
306
|
+
*/
|
|
307
|
+
declare const isRecordedUrlSchemeSyntax: (value: unknown) => value is string;
|
|
308
|
+
/**
|
|
309
|
+
* The URL scheme an iOS sandbox build registers, by one rule its patch, its
|
|
310
|
+
* reader, and its own code apply alike. `recorded` is the Info.plist's
|
|
311
|
+
* `SANDBOX_URL_SCHEME_INFO_PLIST_KEY`, undefined when the key is absent, and
|
|
312
|
+
* `namedTypes` its URL types named `SANDBOX_URL_TYPE_NAME`.
|
|
313
|
+
* - Absent: a prerelease's build, which recorded none. Undefined: the caller
|
|
314
|
+
* reads it the way that build was read.
|
|
315
|
+
* - Present: a scheme in lower-case ASCII, as written, that the one URL type
|
|
316
|
+
* of the name holds alone. Anything else is null, with no fallback.
|
|
317
|
+
*/
|
|
318
|
+
declare const recordedSandboxUrlScheme: (recorded: unknown, namedTypes: readonly unknown[]) => string | null | undefined;
|
|
319
|
+
/** The `<meta-data>` an Android sandbox build declares itself with. */
|
|
320
|
+
declare const SANDBOX_META_DATA = "com.hotupdater.SANDBOX";
|
|
321
|
+
/** The activity that takes an Android sandbox build's launcher entry and links. */
|
|
322
|
+
declare const SANDBOX_ACTIVITY = "com.hotupdater.HotUpdaterSandboxActivity";
|
|
323
|
+
/** The `applicationIdSuffix` an Android sandbox build appends. */
|
|
324
|
+
declare const SANDBOX_APPLICATION_ID_SUFFIX = ".sandbox";
|
|
325
|
+
/**
|
|
326
|
+
* The `CFBundleURLName` of the URL type an iOS sandbox build registers its URL
|
|
327
|
+
* scheme with, which the build reads its own scheme from.
|
|
328
|
+
*/
|
|
329
|
+
declare const SANDBOX_URL_TYPE_NAME = "hot-updater-sandbox";
|
|
330
|
+
/**
|
|
331
|
+
* The `<meta-data>` of `SANDBOX_ACTIVITY` that names the URL scheme an Android
|
|
332
|
+
* sandbox build registers, which the build reads its own scheme from.
|
|
333
|
+
*/
|
|
334
|
+
declare const SANDBOX_URL_SCHEME_META_DATA = "com.hotupdater.sandbox.URL_SCHEME";
|
|
335
|
+
/**
|
|
336
|
+
* The URL scheme a sandbox build registers when its scheme sets none, derived
|
|
337
|
+
* from the app's ID: the app's own scheme would ask which app to open beside
|
|
338
|
+
* the store app.
|
|
339
|
+
*/
|
|
340
|
+
declare const sandboxUrlSchemeOf: (appId: string) => string;
|
|
341
|
+
/**
|
|
342
|
+
* Whether a URL scheme has the prefix of the derived one: how an artifact built
|
|
343
|
+
* before the URL scheme could be set is read, which registered no other.
|
|
344
|
+
*/
|
|
345
|
+
declare const isSandboxUrlScheme: (scheme: string) => boolean;
|
|
346
|
+
/**
|
|
347
|
+
* Whether `sandbox: { urlScheme }` can name a URL scheme: lower case, a letter
|
|
348
|
+
* then up to 63 letters, digits, `+`, `.` or `-`, none the system or a browser
|
|
349
|
+
* owns, and neither `true` nor `false`, which Android's manifest can't hold as
|
|
350
|
+
* a string.
|
|
351
|
+
*/
|
|
352
|
+
declare const isConfigurableSandboxUrlScheme: (urlScheme: string) => boolean;
|
|
353
|
+
/** The platform a preview link is for. */
|
|
354
|
+
type PreviewLinkPlatform = "ios" | "android";
|
|
355
|
+
/** What a preview link asks a sandbox build to run. */
|
|
356
|
+
interface PreviewLink {
|
|
357
|
+
/** The sandbox's URL scheme, in lower case. */
|
|
358
|
+
readonly urlScheme: string;
|
|
359
|
+
readonly channel: string;
|
|
360
|
+
/** The fingerprint the channel's bundles need; another build refuses them. */
|
|
361
|
+
readonly fingerprintHash: string;
|
|
362
|
+
/**
|
|
363
|
+
* The platform the link is for, absent from a link that names none: the
|
|
364
|
+
* other platform's sandbox build, which both can register the same scheme
|
|
365
|
+
* for, says which QR code to scan instead.
|
|
366
|
+
*/
|
|
367
|
+
readonly platform?: PreviewLinkPlatform;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* The link a preview QR holds. `urlScheme` is the one the sandbox build
|
|
371
|
+
* registered; without it, the one derived from `appId`, the scheme's
|
|
372
|
+
* `bundleIdentifier` or `packageName`: the ID before the Android sandbox's
|
|
373
|
+
* `.sandbox` suffix.
|
|
374
|
+
*/
|
|
375
|
+
declare const createPreviewLink: ({ urlScheme, appId, channel, fingerprintHash, platform }: {
|
|
376
|
+
readonly channel: string;
|
|
377
|
+
readonly fingerprintHash: string;
|
|
378
|
+
readonly platform?: PreviewLinkPlatform;
|
|
379
|
+
} & ({
|
|
380
|
+
readonly urlScheme: string;
|
|
381
|
+
readonly appId?: string;
|
|
382
|
+
} | {
|
|
383
|
+
readonly urlScheme?: undefined;
|
|
384
|
+
readonly appId: string;
|
|
385
|
+
})) => string;
|
|
386
|
+
/**
|
|
387
|
+
* What a preview link says, or null for anything else: another shape, a
|
|
388
|
+
* repeated or missing parameter, or a channel no release can target. It takes
|
|
389
|
+
* any URL scheme: a sandbox build refuses a link of another scheme than its
|
|
390
|
+
* own. A `platform` other than `ios` or `android` reads as none. Native code
|
|
391
|
+
* parses it the same way before any JavaScript runs, in HotUpdaterSandboxLink,
|
|
392
|
+
* and shares the vectors in test-utils' `sandbox-preview-links.json`.
|
|
393
|
+
*/
|
|
394
|
+
declare const parsePreviewLink: (link: string) => PreviewLink | null;
|
|
395
|
+
//#endregion
|
|
396
|
+
export { type ByteSource, type ImportableNativeBuild, type IpaDistribution, type IpaInstallInfo, type NativeArtifactCheck, NativeArtifactError, type NativeArtifactInfo, type NativeArtifactKind, type NativeArtifactProblem, type NativeArtifactProblemCode, type PreviewLink, type PreviewLinkPlatform, type ProvisioningProfileInfo, SANDBOX_ACTIVITY, SANDBOX_APPLICATION_ID_SUFFIX, SANDBOX_CODE_MARKER, SANDBOX_INFO_PLIST_KEY, SANDBOX_META_DATA, SANDBOX_URL_SCHEME_INFO_PLIST_KEY, SANDBOX_URL_SCHEME_META_DATA, SANDBOX_URL_TYPE_NAME, type UnreadableValue, type ZipEntry, alreadyImportedProblem, blobSource, checkNativeArtifact, createPreviewLink, findZipEntry, isConfigurableSandboxUrlScheme, isRecordedUrlSchemeSyntax, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readProvisioningProfile, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxUrlSchemeOf };
|