@hot-updater/protocol 1.2.0-rc.25 → 1.2.0-rc.26
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/native-artifact.cjs +11 -6
- package/dist/native-artifact.d.cts +14 -5
- package/dist/native-artifact.d.mts +14 -5
- package/dist/native-artifact.mjs +11 -6
- package/package.json +1 -1
package/dist/native-artifact.cjs
CHANGED
|
@@ -668,9 +668,11 @@ const isConfigurableSandboxUrlScheme = (urlScheme) => CONFIGURED_URL_SCHEME.test
|
|
|
668
668
|
* `bundleIdentifier` or `packageName`: the ID before the Android sandbox's
|
|
669
669
|
* `.sandbox` suffix.
|
|
670
670
|
*/
|
|
671
|
-
const createPreviewLink = ({ urlScheme, appId, channel, fingerprintHash }) => {
|
|
671
|
+
const createPreviewLink = ({ urlScheme, appId, channel, fingerprintHash, platform }) => {
|
|
672
672
|
require_uuid.assertCanonicalChannelName(channel);
|
|
673
|
-
|
|
673
|
+
if (platform !== void 0 && !PREVIEW_LINK_PLATFORMS.has(platform)) throw new Error(`A preview link's platform is ios or android, not ${platform}.`);
|
|
674
|
+
const link = `${(urlScheme ?? sandboxUrlSchemeOf(appId)).toLowerCase()}://hot-updater/preview?channel=${encodeURIComponent(channel)}&fingerprint=${encodeURIComponent(fingerprintHash)}`;
|
|
675
|
+
return platform === void 0 ? link : `${link}&platform=${platform}`;
|
|
674
676
|
};
|
|
675
677
|
/** Any URL scheme: which app's it is, the app that opens the link decides. */
|
|
676
678
|
const PREVIEW_LINK = /^([a-z][a-z0-9+.-]*):\/\/hot-updater\/preview\?([^#]*)$/iu;
|
|
@@ -680,13 +682,14 @@ const PREVIEW_LINK = /^([a-z][a-z0-9+.-]*):\/\/hot-updater\/preview\?([^#]*)$/iu
|
|
|
680
682
|
*/
|
|
681
683
|
const ASCII_URL_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/;
|
|
682
684
|
const MAX_FINGERPRINT_LENGTH = 256;
|
|
685
|
+
const PREVIEW_LINK_PLATFORMS = /* @__PURE__ */ new Set(["ios", "android"]);
|
|
683
686
|
/**
|
|
684
687
|
* What a preview link says, or null for anything else: another shape, a
|
|
685
688
|
* repeated or missing parameter, or a channel no release can target. It takes
|
|
686
689
|
* any URL scheme: a sandbox build refuses a link of another scheme than its
|
|
687
|
-
* own.
|
|
688
|
-
*
|
|
689
|
-
* `sandbox-preview-links.json`.
|
|
690
|
+
* own. A `platform` other than `ios` or `android` reads as none. Native code
|
|
691
|
+
* parses it the same way before any JavaScript runs, in HotUpdaterSandboxLink,
|
|
692
|
+
* and shares the vectors in test-utils' `sandbox-preview-links.json`.
|
|
690
693
|
*/
|
|
691
694
|
const parsePreviewLink = (link) => {
|
|
692
695
|
const match = PREVIEW_LINK.exec(link);
|
|
@@ -713,10 +716,12 @@ const parsePreviewLink = (link) => {
|
|
|
713
716
|
} catch {
|
|
714
717
|
return null;
|
|
715
718
|
}
|
|
719
|
+
const platform = parameters.get("platform");
|
|
716
720
|
return {
|
|
717
721
|
urlScheme: match[1].toLowerCase(),
|
|
718
722
|
channel,
|
|
719
|
-
fingerprintHash
|
|
723
|
+
fingerprintHash,
|
|
724
|
+
...platform !== void 0 && PREVIEW_LINK_PLATFORMS.has(platform) ? { platform } : {}
|
|
720
725
|
};
|
|
721
726
|
};
|
|
722
727
|
//#endregion
|
|
@@ -323,6 +323,8 @@ declare const isSandboxUrlScheme: (scheme: string) => boolean;
|
|
|
323
323
|
* a string.
|
|
324
324
|
*/
|
|
325
325
|
declare const isConfigurableSandboxUrlScheme: (urlScheme: string) => boolean;
|
|
326
|
+
/** The platform a preview link is for. */
|
|
327
|
+
type PreviewLinkPlatform = "ios" | "android";
|
|
326
328
|
/** What a preview link asks a sandbox build to run. */
|
|
327
329
|
interface PreviewLink {
|
|
328
330
|
/** The sandbox's URL scheme, in lower case. */
|
|
@@ -330,6 +332,12 @@ interface PreviewLink {
|
|
|
330
332
|
readonly channel: string;
|
|
331
333
|
/** The fingerprint the channel's bundles need; another build refuses them. */
|
|
332
334
|
readonly fingerprintHash: string;
|
|
335
|
+
/**
|
|
336
|
+
* The platform the link is for, absent from a link that names none: the
|
|
337
|
+
* other platform's sandbox build, which both can register the same scheme
|
|
338
|
+
* for, says which QR code to scan instead.
|
|
339
|
+
*/
|
|
340
|
+
readonly platform?: PreviewLinkPlatform;
|
|
333
341
|
}
|
|
334
342
|
/**
|
|
335
343
|
* The link a preview QR holds. `urlScheme` is the one the sandbox build
|
|
@@ -337,9 +345,10 @@ interface PreviewLink {
|
|
|
337
345
|
* `bundleIdentifier` or `packageName`: the ID before the Android sandbox's
|
|
338
346
|
* `.sandbox` suffix.
|
|
339
347
|
*/
|
|
340
|
-
declare const createPreviewLink: ({ urlScheme, appId, channel, fingerprintHash }: {
|
|
348
|
+
declare const createPreviewLink: ({ urlScheme, appId, channel, fingerprintHash, platform }: {
|
|
341
349
|
readonly channel: string;
|
|
342
350
|
readonly fingerprintHash: string;
|
|
351
|
+
readonly platform?: PreviewLinkPlatform;
|
|
343
352
|
} & ({
|
|
344
353
|
readonly urlScheme: string;
|
|
345
354
|
readonly appId?: string;
|
|
@@ -351,10 +360,10 @@ declare const createPreviewLink: ({ urlScheme, appId, channel, fingerprintHash }
|
|
|
351
360
|
* What a preview link says, or null for anything else: another shape, a
|
|
352
361
|
* repeated or missing parameter, or a channel no release can target. It takes
|
|
353
362
|
* any URL scheme: a sandbox build refuses a link of another scheme than its
|
|
354
|
-
* own.
|
|
355
|
-
*
|
|
356
|
-
* `sandbox-preview-links.json`.
|
|
363
|
+
* own. A `platform` other than `ios` or `android` reads as none. Native code
|
|
364
|
+
* parses it the same way before any JavaScript runs, in HotUpdaterSandboxLink,
|
|
365
|
+
* and shares the vectors in test-utils' `sandbox-preview-links.json`.
|
|
357
366
|
*/
|
|
358
367
|
declare const parsePreviewLink: (link: string) => PreviewLink | null;
|
|
359
368
|
//#endregion
|
|
360
|
-
export { type ByteSource, type ImportableNativeBuild, type IpaDistribution, type IpaInstallInfo, type NativeArtifactCheck, NativeArtifactError, type NativeArtifactInfo, type NativeArtifactKind, type NativeArtifactProblem, type NativeArtifactProblemCode, type PreviewLink, 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, isSandboxChannel, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxChannelOf, sandboxUrlSchemeOf };
|
|
369
|
+
export { type ByteSource, type ImportableNativeBuild, type IpaDistribution, type IpaInstallInfo, type NativeArtifactCheck, NativeArtifactError, type NativeArtifactInfo, type NativeArtifactKind, type NativeArtifactProblem, type NativeArtifactProblemCode, type PreviewLink, type PreviewLinkPlatform, 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, isSandboxChannel, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxChannelOf, sandboxUrlSchemeOf };
|
|
@@ -323,6 +323,8 @@ declare const isSandboxUrlScheme: (scheme: string) => boolean;
|
|
|
323
323
|
* a string.
|
|
324
324
|
*/
|
|
325
325
|
declare const isConfigurableSandboxUrlScheme: (urlScheme: string) => boolean;
|
|
326
|
+
/** The platform a preview link is for. */
|
|
327
|
+
type PreviewLinkPlatform = "ios" | "android";
|
|
326
328
|
/** What a preview link asks a sandbox build to run. */
|
|
327
329
|
interface PreviewLink {
|
|
328
330
|
/** The sandbox's URL scheme, in lower case. */
|
|
@@ -330,6 +332,12 @@ interface PreviewLink {
|
|
|
330
332
|
readonly channel: string;
|
|
331
333
|
/** The fingerprint the channel's bundles need; another build refuses them. */
|
|
332
334
|
readonly fingerprintHash: string;
|
|
335
|
+
/**
|
|
336
|
+
* The platform the link is for, absent from a link that names none: the
|
|
337
|
+
* other platform's sandbox build, which both can register the same scheme
|
|
338
|
+
* for, says which QR code to scan instead.
|
|
339
|
+
*/
|
|
340
|
+
readonly platform?: PreviewLinkPlatform;
|
|
333
341
|
}
|
|
334
342
|
/**
|
|
335
343
|
* The link a preview QR holds. `urlScheme` is the one the sandbox build
|
|
@@ -337,9 +345,10 @@ interface PreviewLink {
|
|
|
337
345
|
* `bundleIdentifier` or `packageName`: the ID before the Android sandbox's
|
|
338
346
|
* `.sandbox` suffix.
|
|
339
347
|
*/
|
|
340
|
-
declare const createPreviewLink: ({ urlScheme, appId, channel, fingerprintHash }: {
|
|
348
|
+
declare const createPreviewLink: ({ urlScheme, appId, channel, fingerprintHash, platform }: {
|
|
341
349
|
readonly channel: string;
|
|
342
350
|
readonly fingerprintHash: string;
|
|
351
|
+
readonly platform?: PreviewLinkPlatform;
|
|
343
352
|
} & ({
|
|
344
353
|
readonly urlScheme: string;
|
|
345
354
|
readonly appId?: string;
|
|
@@ -351,10 +360,10 @@ declare const createPreviewLink: ({ urlScheme, appId, channel, fingerprintHash }
|
|
|
351
360
|
* What a preview link says, or null for anything else: another shape, a
|
|
352
361
|
* repeated or missing parameter, or a channel no release can target. It takes
|
|
353
362
|
* any URL scheme: a sandbox build refuses a link of another scheme than its
|
|
354
|
-
* own.
|
|
355
|
-
*
|
|
356
|
-
* `sandbox-preview-links.json`.
|
|
363
|
+
* own. A `platform` other than `ios` or `android` reads as none. Native code
|
|
364
|
+
* parses it the same way before any JavaScript runs, in HotUpdaterSandboxLink,
|
|
365
|
+
* and shares the vectors in test-utils' `sandbox-preview-links.json`.
|
|
357
366
|
*/
|
|
358
367
|
declare const parsePreviewLink: (link: string) => PreviewLink | null;
|
|
359
368
|
//#endregion
|
|
360
|
-
export { type ByteSource, type ImportableNativeBuild, type IpaDistribution, type IpaInstallInfo, type NativeArtifactCheck, NativeArtifactError, type NativeArtifactInfo, type NativeArtifactKind, type NativeArtifactProblem, type NativeArtifactProblemCode, type PreviewLink, 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, isSandboxChannel, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxChannelOf, sandboxUrlSchemeOf };
|
|
369
|
+
export { type ByteSource, type ImportableNativeBuild, type IpaDistribution, type IpaInstallInfo, type NativeArtifactCheck, NativeArtifactError, type NativeArtifactInfo, type NativeArtifactKind, type NativeArtifactProblem, type NativeArtifactProblemCode, type PreviewLink, type PreviewLinkPlatform, 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, isSandboxChannel, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxChannelOf, sandboxUrlSchemeOf };
|
package/dist/native-artifact.mjs
CHANGED
|
@@ -667,9 +667,11 @@ const isConfigurableSandboxUrlScheme = (urlScheme) => CONFIGURED_URL_SCHEME.test
|
|
|
667
667
|
* `bundleIdentifier` or `packageName`: the ID before the Android sandbox's
|
|
668
668
|
* `.sandbox` suffix.
|
|
669
669
|
*/
|
|
670
|
-
const createPreviewLink = ({ urlScheme, appId, channel, fingerprintHash }) => {
|
|
670
|
+
const createPreviewLink = ({ urlScheme, appId, channel, fingerprintHash, platform }) => {
|
|
671
671
|
assertCanonicalChannelName(channel);
|
|
672
|
-
|
|
672
|
+
if (platform !== void 0 && !PREVIEW_LINK_PLATFORMS.has(platform)) throw new Error(`A preview link's platform is ios or android, not ${platform}.`);
|
|
673
|
+
const link = `${(urlScheme ?? sandboxUrlSchemeOf(appId)).toLowerCase()}://hot-updater/preview?channel=${encodeURIComponent(channel)}&fingerprint=${encodeURIComponent(fingerprintHash)}`;
|
|
674
|
+
return platform === void 0 ? link : `${link}&platform=${platform}`;
|
|
673
675
|
};
|
|
674
676
|
/** Any URL scheme: which app's it is, the app that opens the link decides. */
|
|
675
677
|
const PREVIEW_LINK = /^([a-z][a-z0-9+.-]*):\/\/hot-updater\/preview\?([^#]*)$/iu;
|
|
@@ -679,13 +681,14 @@ const PREVIEW_LINK = /^([a-z][a-z0-9+.-]*):\/\/hot-updater\/preview\?([^#]*)$/iu
|
|
|
679
681
|
*/
|
|
680
682
|
const ASCII_URL_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/;
|
|
681
683
|
const MAX_FINGERPRINT_LENGTH = 256;
|
|
684
|
+
const PREVIEW_LINK_PLATFORMS = /* @__PURE__ */ new Set(["ios", "android"]);
|
|
682
685
|
/**
|
|
683
686
|
* What a preview link says, or null for anything else: another shape, a
|
|
684
687
|
* repeated or missing parameter, or a channel no release can target. It takes
|
|
685
688
|
* any URL scheme: a sandbox build refuses a link of another scheme than its
|
|
686
|
-
* own.
|
|
687
|
-
*
|
|
688
|
-
* `sandbox-preview-links.json`.
|
|
689
|
+
* own. A `platform` other than `ios` or `android` reads as none. Native code
|
|
690
|
+
* parses it the same way before any JavaScript runs, in HotUpdaterSandboxLink,
|
|
691
|
+
* and shares the vectors in test-utils' `sandbox-preview-links.json`.
|
|
689
692
|
*/
|
|
690
693
|
const parsePreviewLink = (link) => {
|
|
691
694
|
const match = PREVIEW_LINK.exec(link);
|
|
@@ -712,10 +715,12 @@ const parsePreviewLink = (link) => {
|
|
|
712
715
|
} catch {
|
|
713
716
|
return null;
|
|
714
717
|
}
|
|
718
|
+
const platform = parameters.get("platform");
|
|
715
719
|
return {
|
|
716
720
|
urlScheme: match[1].toLowerCase(),
|
|
717
721
|
channel,
|
|
718
|
-
fingerprintHash
|
|
722
|
+
fingerprintHash,
|
|
723
|
+
...platform !== void 0 && PREVIEW_LINK_PLATFORMS.has(platform) ? { platform } : {}
|
|
719
724
|
};
|
|
720
725
|
};
|
|
721
726
|
//#endregion
|