@hot-updater/protocol 1.2.0-rc.40 → 1.2.0-rc.42

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.
@@ -624,17 +624,8 @@ const SANDBOX_URL_TYPE_NAME = "hot-updater-sandbox";
624
624
  * sandbox build registers, which the build reads its own scheme from.
625
625
  */
626
626
  const SANDBOX_URL_SCHEME_META_DATA = "com.hotupdater.sandbox.URL_SCHEME";
627
- const SANDBOX_CHANNEL_PREFIX = "sandbox-";
628
627
  const SANDBOX_URL_SCHEME_PREFIX = "hu-sandbox-";
629
628
  /**
630
- * The channel a scheme's sandbox build registers on. `sandbox-*` is reserved:
631
- * only a sandbox build registers there, and the registry records `sandbox` on
632
- * it.
633
- */
634
- const sandboxChannelOf = (scheme) => `${SANDBOX_CHANNEL_PREFIX}${scheme}`;
635
- /** Whether a channel is reserved for sandbox builds. */
636
- const isSandboxChannel = (channel) => channel.startsWith(SANDBOX_CHANNEL_PREFIX);
637
- /**
638
629
  * The URL scheme a sandbox build registers when its scheme sets none, derived
639
630
  * from the app's ID: the app's own scheme would ask which app to open beside
640
631
  * the store app.
@@ -1274,10 +1265,12 @@ const readNativeArtifact = async (source, fileName, { timeoutMs = DEFAULT_TIMEOU
1274
1265
  /** The channel an app without a default channel reports. */
1275
1266
  const DEFAULT_CHANNEL = "production";
1276
1267
  /**
1277
- * Why an artifact can't register on `channel`: the sandbox layer must be whole
1278
- * or absent, and only a sandbox build registers on a `sandbox-*` channel.
1268
+ * Why an artifact can't register as what it is: the sandbox layer must be
1269
+ * whole or absent, and a sandbox build must have the URL scheme its links
1270
+ * open and the launcher its screen takes. A sandbox build registers on any
1271
+ * channel, as any build does.
1279
1272
  */
1280
- const sandboxArtifactProblem = ({ kind, platform, sandbox, entry }, channel) => {
1273
+ const sandboxArtifactProblem = ({ kind, platform, sandbox, entry }) => {
1281
1274
  const declaration = platform === "ios" ? "Info.plist key" : "manifest meta-data";
1282
1275
  if (sandbox.code !== sandbox.declared) return {
1283
1276
  code: "SANDBOX_MISMATCH",
@@ -1291,14 +1284,6 @@ const sandboxArtifactProblem = ({ kind, platform, sandbox, entry }, channel) =>
1291
1284
  code: "SANDBOX_MISMATCH",
1292
1285
  message: `The .${kind} is a sandbox build, but its launcher is ${entry.launchers.join(", ") || "missing"}.\nBuild it again with hot-updater native-build.`
1293
1286
  };
1294
- if (sandbox.code && !isSandboxChannel(channel)) return {
1295
- code: "SANDBOX_MISMATCH",
1296
- message: `The .${kind} is a sandbox build, which can't register on channel ${channel}.\nUse a sandbox-<scheme> channel.`
1297
- };
1298
- if (!sandbox.code && isSandboxChannel(channel)) return {
1299
- code: "SANDBOX_MISMATCH",
1300
- message: `Channel ${channel} is reserved for sandbox builds, and the .${kind} isn't one.\nUse another channel, or build it with sandbox: true.`
1301
- };
1302
1287
  return null;
1303
1288
  };
1304
1289
  const isUnreadable = (value) => typeof value === "object" && value !== null && "unreadable" in value;
@@ -1351,7 +1336,7 @@ const checkNativeArtifact = (info, { updateStrategy, appIds = [], channel: chann
1351
1336
  refuse("INVALID_SCOPE", `The app's channel ${JSON.stringify(channel)} is no channel a release can target: ${error instanceof Error ? error.message : String(error)}.`);
1352
1337
  }
1353
1338
  }
1354
- const sandboxProblem = sandboxArtifactProblem(info, channel);
1339
+ const sandboxProblem = sandboxArtifactProblem(info);
1355
1340
  if (sandboxProblem !== null) problems.push(sandboxProblem);
1356
1341
  if (appIds.length > 0 && info.appId !== null && !appIds.includes(info.appId)) warnings.push({
1357
1342
  code: "APP_ID_MISMATCH",
@@ -1564,7 +1549,6 @@ exports.createPreviewLink = createPreviewLink;
1564
1549
  exports.findZipEntry = findZipEntry;
1565
1550
  exports.isConfigurableSandboxUrlScheme = isConfigurableSandboxUrlScheme;
1566
1551
  exports.isRecordedUrlSchemeSyntax = isRecordedUrlSchemeSyntax;
1567
- exports.isSandboxChannel = isSandboxChannel;
1568
1552
  exports.isSandboxUrlScheme = isSandboxUrlScheme;
1569
1553
  exports.normalizeIosUdid = normalizeIosUdid;
1570
1554
  exports.openZipEntry = openZipEntry;
@@ -1576,5 +1560,4 @@ exports.readProvisioningProfile = readProvisioningProfile;
1576
1560
  exports.readZipDirectory = readZipDirectory;
1577
1561
  exports.recordedSandboxUrlScheme = recordedSandboxUrlScheme;
1578
1562
  exports.sandboxArtifactProblem = sandboxArtifactProblem;
1579
- exports.sandboxChannelOf = sandboxChannelOf;
1580
1563
  exports.sandboxUrlSchemeOf = sandboxUrlSchemeOf;
@@ -145,10 +145,12 @@ type NativeArtifactCheck = ({
145
145
  readonly warnings: readonly NativeArtifactProblem[];
146
146
  };
147
147
  /**
148
- * Why an artifact can't register on `channel`: the sandbox layer must be whole
149
- * or absent, and only a sandbox build registers on a `sandbox-*` channel.
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.
150
152
  */
151
- declare const sandboxArtifactProblem: ({ kind, platform, sandbox, entry }: NativeArtifactInfo, channel: string) => NativeArtifactProblem | null;
153
+ declare const sandboxArtifactProblem: ({ kind, platform, sandbox, entry }: NativeArtifactInfo) => NativeArtifactProblem | null;
152
154
  /**
153
155
  * Whether a read artifact can be imported as a native build, whose built-in
154
156
  * bundle OTAs patch from, and what it registers as. It refuses an artifact
@@ -330,14 +332,6 @@ declare const SANDBOX_URL_TYPE_NAME = "hot-updater-sandbox";
330
332
  * sandbox build registers, which the build reads its own scheme from.
331
333
  */
332
334
  declare const SANDBOX_URL_SCHEME_META_DATA = "com.hotupdater.sandbox.URL_SCHEME";
333
- /**
334
- * The channel a scheme's sandbox build registers on. `sandbox-*` is reserved:
335
- * only a sandbox build registers there, and the registry records `sandbox` on
336
- * it.
337
- */
338
- declare const sandboxChannelOf: (scheme: string) => string;
339
- /** Whether a channel is reserved for sandbox builds. */
340
- declare const isSandboxChannel: (channel: string) => boolean;
341
335
  /**
342
336
  * The URL scheme a sandbox build registers when its scheme sets none, derived
343
337
  * from the app's ID: the app's own scheme would ask which app to open beside
@@ -399,4 +393,4 @@ declare const createPreviewLink: ({ urlScheme, appId, channel, fingerprintHash,
399
393
  */
400
394
  declare const parsePreviewLink: (link: string) => PreviewLink | null;
401
395
  //#endregion
402
- 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, isSandboxChannel, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readProvisioningProfile, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxChannelOf, sandboxUrlSchemeOf };
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 };
@@ -145,10 +145,12 @@ type NativeArtifactCheck = ({
145
145
  readonly warnings: readonly NativeArtifactProblem[];
146
146
  };
147
147
  /**
148
- * Why an artifact can't register on `channel`: the sandbox layer must be whole
149
- * or absent, and only a sandbox build registers on a `sandbox-*` channel.
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.
150
152
  */
151
- declare const sandboxArtifactProblem: ({ kind, platform, sandbox, entry }: NativeArtifactInfo, channel: string) => NativeArtifactProblem | null;
153
+ declare const sandboxArtifactProblem: ({ kind, platform, sandbox, entry }: NativeArtifactInfo) => NativeArtifactProblem | null;
152
154
  /**
153
155
  * Whether a read artifact can be imported as a native build, whose built-in
154
156
  * bundle OTAs patch from, and what it registers as. It refuses an artifact
@@ -330,14 +332,6 @@ declare const SANDBOX_URL_TYPE_NAME = "hot-updater-sandbox";
330
332
  * sandbox build registers, which the build reads its own scheme from.
331
333
  */
332
334
  declare const SANDBOX_URL_SCHEME_META_DATA = "com.hotupdater.sandbox.URL_SCHEME";
333
- /**
334
- * The channel a scheme's sandbox build registers on. `sandbox-*` is reserved:
335
- * only a sandbox build registers there, and the registry records `sandbox` on
336
- * it.
337
- */
338
- declare const sandboxChannelOf: (scheme: string) => string;
339
- /** Whether a channel is reserved for sandbox builds. */
340
- declare const isSandboxChannel: (channel: string) => boolean;
341
335
  /**
342
336
  * The URL scheme a sandbox build registers when its scheme sets none, derived
343
337
  * from the app's ID: the app's own scheme would ask which app to open beside
@@ -399,4 +393,4 @@ declare const createPreviewLink: ({ urlScheme, appId, channel, fingerprintHash,
399
393
  */
400
394
  declare const parsePreviewLink: (link: string) => PreviewLink | null;
401
395
  //#endregion
402
- 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, isSandboxChannel, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readProvisioningProfile, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxChannelOf, sandboxUrlSchemeOf };
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 };
@@ -623,17 +623,8 @@ const SANDBOX_URL_TYPE_NAME = "hot-updater-sandbox";
623
623
  * sandbox build registers, which the build reads its own scheme from.
624
624
  */
625
625
  const SANDBOX_URL_SCHEME_META_DATA = "com.hotupdater.sandbox.URL_SCHEME";
626
- const SANDBOX_CHANNEL_PREFIX = "sandbox-";
627
626
  const SANDBOX_URL_SCHEME_PREFIX = "hu-sandbox-";
628
627
  /**
629
- * The channel a scheme's sandbox build registers on. `sandbox-*` is reserved:
630
- * only a sandbox build registers there, and the registry records `sandbox` on
631
- * it.
632
- */
633
- const sandboxChannelOf = (scheme) => `${SANDBOX_CHANNEL_PREFIX}${scheme}`;
634
- /** Whether a channel is reserved for sandbox builds. */
635
- const isSandboxChannel = (channel) => channel.startsWith(SANDBOX_CHANNEL_PREFIX);
636
- /**
637
628
  * The URL scheme a sandbox build registers when its scheme sets none, derived
638
629
  * from the app's ID: the app's own scheme would ask which app to open beside
639
630
  * the store app.
@@ -1273,10 +1264,12 @@ const readNativeArtifact = async (source, fileName, { timeoutMs = DEFAULT_TIMEOU
1273
1264
  /** The channel an app without a default channel reports. */
1274
1265
  const DEFAULT_CHANNEL = "production";
1275
1266
  /**
1276
- * Why an artifact can't register on `channel`: the sandbox layer must be whole
1277
- * or absent, and only a sandbox build registers on a `sandbox-*` channel.
1267
+ * Why an artifact can't register as what it is: the sandbox layer must be
1268
+ * whole or absent, and a sandbox build must have the URL scheme its links
1269
+ * open and the launcher its screen takes. A sandbox build registers on any
1270
+ * channel, as any build does.
1278
1271
  */
1279
- const sandboxArtifactProblem = ({ kind, platform, sandbox, entry }, channel) => {
1272
+ const sandboxArtifactProblem = ({ kind, platform, sandbox, entry }) => {
1280
1273
  const declaration = platform === "ios" ? "Info.plist key" : "manifest meta-data";
1281
1274
  if (sandbox.code !== sandbox.declared) return {
1282
1275
  code: "SANDBOX_MISMATCH",
@@ -1290,14 +1283,6 @@ const sandboxArtifactProblem = ({ kind, platform, sandbox, entry }, channel) =>
1290
1283
  code: "SANDBOX_MISMATCH",
1291
1284
  message: `The .${kind} is a sandbox build, but its launcher is ${entry.launchers.join(", ") || "missing"}.\nBuild it again with hot-updater native-build.`
1292
1285
  };
1293
- if (sandbox.code && !isSandboxChannel(channel)) return {
1294
- code: "SANDBOX_MISMATCH",
1295
- message: `The .${kind} is a sandbox build, which can't register on channel ${channel}.\nUse a sandbox-<scheme> channel.`
1296
- };
1297
- if (!sandbox.code && isSandboxChannel(channel)) return {
1298
- code: "SANDBOX_MISMATCH",
1299
- message: `Channel ${channel} is reserved for sandbox builds, and the .${kind} isn't one.\nUse another channel, or build it with sandbox: true.`
1300
- };
1301
1286
  return null;
1302
1287
  };
1303
1288
  const isUnreadable = (value) => typeof value === "object" && value !== null && "unreadable" in value;
@@ -1350,7 +1335,7 @@ const checkNativeArtifact = (info, { updateStrategy, appIds = [], channel: chann
1350
1335
  refuse("INVALID_SCOPE", `The app's channel ${JSON.stringify(channel)} is no channel a release can target: ${error instanceof Error ? error.message : String(error)}.`);
1351
1336
  }
1352
1337
  }
1353
- const sandboxProblem = sandboxArtifactProblem(info, channel);
1338
+ const sandboxProblem = sandboxArtifactProblem(info);
1354
1339
  if (sandboxProblem !== null) problems.push(sandboxProblem);
1355
1340
  if (appIds.length > 0 && info.appId !== null && !appIds.includes(info.appId)) warnings.push({
1356
1341
  code: "APP_ID_MISMATCH",
@@ -1547,4 +1532,4 @@ const readIpaInstallInfo = async (source) => {
1547
1532
  };
1548
1533
  };
1549
1534
  //#endregion
1550
- export { NativeArtifactError, 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, alreadyImportedProblem, blobSource, checkNativeArtifact, createPreviewLink, findZipEntry, isConfigurableSandboxUrlScheme, isRecordedUrlSchemeSyntax, isSandboxChannel, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readProvisioningProfile, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxChannelOf, sandboxUrlSchemeOf };
1535
+ export { NativeArtifactError, 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, alreadyImportedProblem, blobSource, checkNativeArtifact, createPreviewLink, findZipEntry, isConfigurableSandboxUrlScheme, isRecordedUrlSchemeSyntax, isSandboxUrlScheme, normalizeIosUdid, openZipEntry, parsePreviewLink, readIpaInstallInfo, readNativeArtifact, readProfileServiceUdid, readProvisioningProfile, readZipDirectory, recordedSandboxUrlScheme, sandboxArtifactProblem, sandboxUrlSchemeOf };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/protocol",
3
- "version": "1.2.0-rc.40",
3
+ "version": "1.2.0-rc.42",
4
4
  "type": "module",
5
5
  "description": "The data formats and pure computations that Hot Updater's app and server share",
6
6
  "sideEffects": false,