@hot-updater/protocol 1.2.0-rc.6 → 1.2.0-rc.61

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 CHANGED
@@ -277,14 +277,14 @@ function modularInverse(value, modulus) {
277
277
  if (r > 1) throw new Error(`No modular inverse for ${value} mod ${modulus}`);
278
278
  return positiveMod(t, modulus);
279
279
  }
280
- function getRolloutShuffleParameters(bundleId) {
281
- let multiplier = positiveMod(hashString(`${bundleId}:multiplier`), 997);
280
+ function getRolloutShuffleParameters(releaseId) {
281
+ let multiplier = positiveMod(hashString(`${releaseId}:multiplier`), 997);
282
282
  if (multiplier === 0) multiplier = 1;
283
283
  while (gcd(multiplier, NUMERIC_COHORT_SIZE) !== 1) {
284
284
  multiplier = positiveMod(multiplier + 1, NUMERIC_COHORT_SIZE);
285
285
  if (multiplier === 0) multiplier = 1;
286
286
  }
287
- const offset = positiveMod(hashString(`${bundleId}:offset`), NUMERIC_COHORT_SIZE);
287
+ const offset = positiveMod(hashString(`${releaseId}:offset`), NUMERIC_COHORT_SIZE);
288
288
  return {
289
289
  multiplier,
290
290
  offset,
@@ -321,19 +321,19 @@ function getDefaultNumericCohort(identifier) {
321
321
  const cohortValue = positiveMod(hashString(identifier), NUMERIC_COHORT_SIZE) + 1;
322
322
  return String(cohortValue);
323
323
  }
324
- function getNumericCohortRolloutPosition(bundleId, cohortValue) {
324
+ function getNumericCohortRolloutPosition(releaseId, cohortValue) {
325
325
  if (cohortValue < 1 || cohortValue > 1e3) throw new Error(`Invalid numeric cohort: ${cohortValue}`);
326
- const { offset, inverseMultiplier } = getRolloutShuffleParameters(bundleId);
326
+ const { offset, inverseMultiplier } = getRolloutShuffleParameters(releaseId);
327
327
  return positiveMod(inverseMultiplier * (cohortValue - 1 - offset), NUMERIC_COHORT_SIZE);
328
328
  }
329
- function getRolledOutNumericCohorts(bundleId, rolloutCohortCount) {
329
+ function getRolledOutNumericCohorts(releaseId, rolloutCohortCount) {
330
330
  const normalizedRolloutCount = normalizeRolloutCohortCount(rolloutCohortCount);
331
331
  if (normalizedRolloutCount <= 0) return [];
332
332
  if (normalizedRolloutCount >= 1e3) return Array.from({ length: NUMERIC_COHORT_SIZE }, (_, index) => index + 1);
333
- const { multiplier, offset } = getRolloutShuffleParameters(bundleId);
333
+ const { multiplier, offset } = getRolloutShuffleParameters(releaseId);
334
334
  return Array.from({ length: normalizedRolloutCount }, (_, position) => positiveMod(multiplier * position + offset, NUMERIC_COHORT_SIZE)).map((zeroBasedCohort) => zeroBasedCohort + 1).sort((left, right) => left - right);
335
335
  }
336
- function isCohortEligibleForUpdate(bundleId, cohort, rolloutCohortCount, targetCohorts) {
336
+ function isCohortEligibleForUpdate(releaseId, cohort, rolloutCohortCount, targetCohorts) {
337
337
  const normalizedCohort = cohort === null || cohort === void 0 ? void 0 : normalizeCohortValue(cohort);
338
338
  const normalizedTargetCohorts = targetCohorts?.map((targetCohort) => normalizeCohortValue(targetCohort)) ?? [];
339
339
  if (normalizedCohort !== void 0 && normalizedTargetCohorts.includes(normalizedCohort)) return true;
@@ -343,7 +343,7 @@ function isCohortEligibleForUpdate(bundleId, cohort, rolloutCohortCount, targetC
343
343
  const numericCohort = getNumericCohortValue(normalizedCohort);
344
344
  if (numericCohort === null) return false;
345
345
  if (normalizedRolloutCount >= 1e3) return true;
346
- return getNumericCohortRolloutPosition(bundleId, numericCohort) < normalizedRolloutCount;
346
+ return getNumericCohortRolloutPosition(releaseId, numericCohort) < normalizedRolloutCount;
347
347
  }
348
348
  //#endregion
349
349
  //#region src/releaseCatalog.ts
@@ -370,7 +370,7 @@ function createReleaseSelectionContextHash(input) {
370
370
  activeReleaseId: input.activeReleaseId ?? null,
371
371
  cohort: normalizeCohortValue(input.cohort ?? ""),
372
372
  crashedBundleIds,
373
- minimumReleaseId: input.minimumReleaseId,
373
+ minimumReleaseId: input.minBundleId,
374
374
  selectorSchemaVersion: 1,
375
375
  strategy: input.strategy,
376
376
  strategyValue: input.strategyValue
@@ -385,10 +385,10 @@ function selectDesiredRelease(catalog, input) {
385
385
  const crashedBundleIds = new Set(input.crashedBundleIds);
386
386
  const activeReleaseId = input.activeReleaseId ?? null;
387
387
  const hasActiveBundle = input.currentBundleId !== input.builtInBundleId;
388
- const isSafeBundleRelease = (release) => release.bundleId !== null && !crashedBundleIds.has(release.bundleId) && release.bundleId >= input.minimumReleaseId;
388
+ const isSafeBundleRelease = (release) => release.bundleId !== null && !crashedBundleIds.has(release.bundleId) && release.bundleId >= input.minBundleId;
389
389
  const runningReleaseId = input.runningReleaseId === void 0 ? activeReleaseId : input.runningReleaseId;
390
390
  const isNewerThanRunning = (release) => runningReleaseId !== null ? release.releaseId > runningReleaseId : release.bundleId !== null && release.bundleId > input.currentBundleId;
391
- const passesForcedRelease = (selected) => [selected, ...catalog.rollbackReleases].some((passed) => passed.shouldForceUpdate && passed.bundleId !== null && passed.bundleId >= input.minimumReleaseId && passed.bundleId !== input.currentBundleId && passed.releaseId <= selected.releaseId && isNewerThanRunning(passed) && isReleaseEligibleForCohort(passed, input.cohort));
391
+ const passesForcedRelease = (selected) => [selected, ...catalog.rollbackReleases].some((passed) => passed.shouldForceUpdate && passed.bundleId !== null && passed.bundleId >= input.minBundleId && passed.bundleId !== input.currentBundleId && passed.releaseId <= selected.releaseId && isNewerThanRunning(passed) && isReleaseEligibleForCohort(passed, input.cohort));
392
392
  const desiredBundle = (release, status) => ({
393
393
  bundleId: release.bundleId,
394
394
  kind: "BUNDLE",
@@ -408,7 +408,7 @@ function selectDesiredRelease(catalog, input) {
408
408
  if (current !== void 0 && isSafeBundleRelease(current) && isReleaseEligibleForCohort(current, input.cohort)) return desiredBundle(current, "UPDATE");
409
409
  const rollback = rollbackReleases.find((release) => isSafeBundleRelease(release) && (activeReleaseId !== null ? release.releaseId < activeReleaseId : release.bundleId < input.currentBundleId));
410
410
  if (rollback !== void 0 && isSafeBundleRelease(rollback)) return desiredBundle(rollback, "ROLLBACK");
411
- if (input.currentBundleId <= input.minimumReleaseId) return null;
411
+ if (input.currentBundleId <= input.minBundleId) return null;
412
412
  }
413
413
  if (catalog.fallbackPolicy !== "BUILTIN_IF_ACTIVE_INELIGIBLE") return null;
414
414
  return {
@@ -493,6 +493,17 @@ const getUtf8ByteLength = (value) => {
493
493
  }
494
494
  return bytes;
495
495
  };
496
+ /**
497
+ * A release label as it crosses the device boundary: a positive safe
498
+ * integer, or null for anything else, such as a server before labels or a
499
+ * label in a form a later release may send. A label is for display only, so
500
+ * one in another form never makes a catalog or a receipt invalid.
501
+ */
502
+ const readReleaseLabel = (value) => Number.isSafeInteger(value) && value >= 1 ? value : null;
503
+ /** Drops a descriptor's label that `readReleaseLabel` reads as none. */
504
+ const keepValidLabel = (descriptor) => {
505
+ if ("label" in descriptor && readReleaseLabel(descriptor.label) === null) delete descriptor.label;
506
+ };
496
507
  const isStringArray = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string");
497
508
  const isValidReleaseDescriptor = (value) => {
498
509
  if (value === null || typeof value !== "object") return false;
@@ -520,6 +531,7 @@ const parseReleaseCatalog = (body, expectedScope) => {
520
531
  const catalog = JSON.parse(body);
521
532
  if (catalog.schemaVersion !== 1 || typeof catalog.catalogId !== "string" || catalog.catalogId.length === 0 || typeof catalog.scopeKey !== "string" || !Number.isSafeInteger(catalog.generation) || (catalog.generation ?? 0) < 1 || typeof catalog.catalogHash !== "string" || !/^sha256:[0-9a-f]{64}$/.test(catalog.catalogHash) || catalog.fallbackPolicy !== "BUILTIN_IF_ACTIVE_INELIGIBLE" || !Array.isArray(catalog.releases) || !catalog.releases.every(isValidReleaseDescriptor) || !Array.isArray(catalog.rollbackReleases) || !catalog.rollbackReleases.every(isValidReleaseDescriptor)) return null;
522
533
  if (!hasExpectedReleaseCatalogScope(catalog, expectedScope)) return null;
534
+ for (const descriptor of [...catalog.releases, ...catalog.rollbackReleases]) keepValidLabel(descriptor);
523
535
  if (new Set([...catalog.releases, ...catalog.rollbackReleases].flatMap((release) => release.targetCohorts)).size > 512) return null;
524
536
  return catalog;
525
537
  } catch {
@@ -589,5 +601,6 @@ exports.normalizeRolloutCohortCount = normalizeRolloutCohortCount;
589
601
  exports.parseReleaseCatalog = parseReleaseCatalog;
590
602
  exports.parseReleaseCatalogScopeKey = require_uuid.parseReleaseCatalogScopeKey;
591
603
  exports.pluginStorageKey = pluginStorageKey;
604
+ exports.readReleaseLabel = readReleaseLabel;
592
605
  exports.resolveBaseURL = resolveBaseURL;
593
606
  exports.selectDesiredRelease = selectDesiredRelease;
package/dist/index.d.cts CHANGED
@@ -361,7 +361,13 @@ interface HotUpdaterClientContext {
361
361
  readonly minBundleId: string;
362
362
  /** Whether this is a debug build (`__DEV__`). */
363
363
  readonly isDebugBuild: boolean;
364
- /** The bundle native reports as current. */
364
+ /**
365
+ * The same ID as `hotUpdater.getBundleId()`: the selected release's ID, the
366
+ * one the Console shows. It names a staged update before the app reloads,
367
+ * `minBundleId` for the built-in bundle, and the artifact ID only for a
368
+ * bundle installed without a release. A plugin that needs the artifact reads
369
+ * the hooks' `bundleId`, `fromBundleId`, `toBundleId`, and `targetBundleId`.
370
+ */
365
371
  getBundleId(): string;
366
372
  getChannel(): string;
367
373
  getCohort(): string;
@@ -429,6 +435,7 @@ interface PluginHostEnvironment {
429
435
  getInstallId(): string;
430
436
  getAppVersion(): string | null;
431
437
  getMinBundleId(): string;
438
+ /** The selected release's ID, as `hotUpdater.getBundleId()` returns it. */
432
439
  getBundleId(): string;
433
440
  getChannel(): string;
434
441
  getCohort(): string;
@@ -494,6 +501,12 @@ interface Release {
494
501
  readonly sourceReleaseId: string | null;
495
502
  readonly createdAtMs: number;
496
503
  readonly updatedAtMs: number;
504
+ /**
505
+ * The release's label, `v<label>` in the CLI and the Console: sequential
506
+ * per channel and platform, never changed or reused. Null or left out
507
+ * until the database assigns one.
508
+ */
509
+ readonly label?: number | null;
497
510
  }
498
511
  interface ReleaseCatalogDescriptor {
499
512
  readonly releaseId: string;
@@ -503,6 +516,12 @@ interface ReleaseCatalogDescriptor {
503
516
  readonly targetCohorts: readonly string[];
504
517
  readonly shouldForceUpdate: boolean;
505
518
  readonly message: string | null;
519
+ /**
520
+ * The release's label, when it has one. Optional on the wire: a server
521
+ * before labels, or a catalog too large to carry them, leaves it out, and
522
+ * clients read a missing or malformed one as none.
523
+ */
524
+ readonly label?: number;
506
525
  }
507
526
  interface ReleaseCatalog {
508
527
  readonly schemaVersion: typeof RELEASE_CATALOG_SCHEMA_VERSION;
@@ -533,6 +552,13 @@ interface PersistedSelectionReceipt {
533
552
  readonly catalogHash: string | null;
534
553
  readonly channel: string;
535
554
  readonly selectionContextHash: string | null;
555
+ /**
556
+ * The selected release's label, which native keeps with the receipt so the
557
+ * app reads it after a restart and offline. Left out or null for the
558
+ * built-in bundle, a release without one, and native built from an SDK
559
+ * before labels, which drops it.
560
+ */
561
+ readonly label?: number | null;
536
562
  }
537
563
  interface ReleaseSelectionInput {
538
564
  readonly builtInBundleId: string;
@@ -544,7 +570,11 @@ interface ReleaseSelectionInput {
544
570
  * Defaults to `activeReleaseId`; null compares by `currentBundleId`.
545
571
  */
546
572
  readonly runningReleaseId?: string | null;
547
- readonly minimumReleaseId: string;
573
+ /**
574
+ * The selection floor: the built-in bundle's ID (MIN_BUNDLE_ID), or the
575
+ * nil UUID when bundles older than it may be selected.
576
+ */
577
+ readonly minBundleId: string;
548
578
  readonly cohort: string | null | undefined;
549
579
  readonly crashedBundleIds: readonly string[];
550
580
  }
@@ -552,7 +582,11 @@ interface ReleaseSelectionContextInput {
552
582
  readonly activeBundleId?: string | null;
553
583
  readonly activeReleaseId?: string | null;
554
584
  readonly cohort: string | null | undefined;
555
- readonly minimumReleaseId: string;
585
+ /**
586
+ * The selection floor: the built-in bundle's ID (MIN_BUNDLE_ID), or the
587
+ * nil UUID when bundles older than it may be selected.
588
+ */
589
+ readonly minBundleId: string;
556
590
  readonly strategy: ReleaseStrategy;
557
591
  readonly strategyValue: string;
558
592
  readonly crashedBundleIds: readonly string[];
@@ -630,6 +664,13 @@ type ExpectedReleaseCatalogScope = {
630
664
  });
631
665
  /** The length of `value` in UTF-8 bytes, without an encoder the device may lack. */
632
666
  declare const getUtf8ByteLength: (value: string) => number;
667
+ /**
668
+ * A release label as it crosses the device boundary: a positive safe
669
+ * integer, or null for anything else, such as a server before labels or a
670
+ * label in a form a later release may send. A label is for display only, so
671
+ * one in another form never makes a catalog or a receipt invalid.
672
+ */
673
+ declare const readReleaseLabel: (value: unknown) => number | null;
633
674
  /** Whether the catalog is the expected scope's. */
634
675
  declare const hasExpectedReleaseCatalogScope: (catalog: Pick<ReleaseCatalog, "scopeKey">, expected: ExpectedReleaseCatalogScope) => boolean;
635
676
  /**
@@ -652,12 +693,12 @@ declare function isNumericCohort(cohort: string): boolean;
652
693
  declare function isCustomCohort(cohort: string): boolean;
653
694
  declare function isValidCohort(cohort: string): boolean;
654
695
  declare function getDefaultNumericCohort(identifier: string): string;
655
- declare function getNumericCohortRolloutPosition(bundleId: string, cohortValue: number): number;
656
- declare function getRolledOutNumericCohorts(bundleId: string, rolloutCohortCount: number | null | undefined): number[];
657
- declare function isCohortEligibleForUpdate(bundleId: string, cohort: string | null | undefined, rolloutCohortCount: number | null | undefined, targetCohorts: readonly string[] | null | undefined): boolean;
696
+ declare function getNumericCohortRolloutPosition(releaseId: string, cohortValue: number): number;
697
+ declare function getRolledOutNumericCohorts(releaseId: string, rolloutCohortCount: number | null | undefined): number[];
698
+ declare function isCohortEligibleForUpdate(releaseId: string, cohort: string | null | undefined, rolloutCohortCount: number | null | undefined, targetCohorts: readonly string[] | null | undefined): boolean;
658
699
  //#endregion
659
700
  //#region src/uuid.d.ts
660
701
  declare const NIL_UUID = "00000000-0000-0000-0000-000000000000";
661
702
  declare const isUUIDv7: (value: unknown) => value is string;
662
703
  //#endregion
663
- export { ARTIFACT_FILES_PROTOCOL_VERSION, ARTIFACT_FILES_REQUEST_LIMIT, ARTIFACT_PROTOCOL_VERSION, AppReadyResult, ArtifactAsset, ArtifactAssetFile, ArtifactFiles, ArtifactFilesRequest, ArtifactInfo, ArtifactInfoV2, Bundle, BundleDownloadedInfo, BundleMetadata, BundlePatchArtifact, CatalogAcceptance, CatalogHighWater, ChangedAssetPatch, ClientPluginApi, ClientPluginApis, DEFAULT_ROLLOUT_COHORT_COUNT, DesiredRelease, ExpectedReleaseCatalogScope, HotUpdaterBaseURL, HotUpdaterClientContext, HotUpdaterClientHooks, HotUpdaterClientPlugin, HotUpdaterClientSetup, HotUpdaterClientStorage, INVALID_COHORT_ERROR_MESSAGE, MAX_COHORT_LENGTH, MAX_COMPILED_CATALOG_BYTES, MAX_CRASHED_BUNDLES, MAX_DISTINCT_TARGET_COHORTS_PER_SCOPE, MAX_RELEASE_CATALOG_WIRE_BYTES, MAX_TARGET_COHORTS_PER_RELEASE, ManifestArchive, NIL_UUID, NUMERIC_COHORT_SIZE, PersistedSelectionReceipt, Platform, PluginHookName, PluginHookPayload, PluginHost, PluginHostConfig, PluginHostEnvironment, RELEASE_CATALOG_FALLBACK_POLICY, RELEASE_CATALOG_SCHEMA_VERSION, Release, ReleaseCatalog, ReleaseCatalogDescriptor, ReleaseCatalogScopeKeyInput, ReleaseKind, ReleaseOperation, ReleaseSelectionContextInput, ReleaseSelectionInput, ReleaseStrategy, ReleaseTransitionAuthorization, ReleaseTransitionKind, SelectionKind, UpdateCheckResult, UpdateError, UpdateErrorReason, UpdateErrorResource, UpdateErrorStage, UpdateErrorTransport, UpdateHttpResponse, UpdateStatus, UpdateStrategy, assertCanonicalChannelName, assessCatalogAcceptance, authorizeReleaseTransition, canonicalizeAppVersion, createPluginHost, createReleaseCatalogScopeKey, createReleaseSelectionContextHash, decodeChannelKey, defineClientPlugin, encodeChannelKey, getAssetBaseStorageUri, getBundlePatch, getBundlePatches, getDefaultNumericCohort, getManifestFileHash, getManifestStorageUri, getNumericCohortRolloutPosition, getNumericCohortValue, getPatchBaseBundleId, getPatchBaseFileHash, getPatchFileHash, getPatchStorageUri, getRolledOutNumericCohorts, getUtf8ByteLength, hasExpectedReleaseCatalogScope, isCohortEligibleForUpdate, isCustomCohort, isNumericCohort, isReleaseEligibleForCohort, isUUIDv7, isValidCohort, normalizeChannelName, normalizeCohortValue, normalizeRolloutCohortCount, parseReleaseCatalog, parseReleaseCatalogScopeKey, pluginStorageKey, resolveBaseURL, selectDesiredRelease };
704
+ export { ARTIFACT_FILES_PROTOCOL_VERSION, ARTIFACT_FILES_REQUEST_LIMIT, ARTIFACT_PROTOCOL_VERSION, AppReadyResult, ArtifactAsset, ArtifactAssetFile, ArtifactFiles, ArtifactFilesRequest, ArtifactInfo, ArtifactInfoV2, Bundle, BundleDownloadedInfo, BundleMetadata, BundlePatchArtifact, CatalogAcceptance, CatalogHighWater, ChangedAssetPatch, ClientPluginApi, ClientPluginApis, DEFAULT_ROLLOUT_COHORT_COUNT, DesiredRelease, ExpectedReleaseCatalogScope, HotUpdaterBaseURL, HotUpdaterClientContext, HotUpdaterClientHooks, HotUpdaterClientPlugin, HotUpdaterClientSetup, HotUpdaterClientStorage, INVALID_COHORT_ERROR_MESSAGE, MAX_COHORT_LENGTH, MAX_COMPILED_CATALOG_BYTES, MAX_CRASHED_BUNDLES, MAX_DISTINCT_TARGET_COHORTS_PER_SCOPE, MAX_RELEASE_CATALOG_WIRE_BYTES, MAX_TARGET_COHORTS_PER_RELEASE, ManifestArchive, NIL_UUID, NUMERIC_COHORT_SIZE, PersistedSelectionReceipt, Platform, PluginHookName, PluginHookPayload, PluginHost, PluginHostConfig, PluginHostEnvironment, RELEASE_CATALOG_FALLBACK_POLICY, RELEASE_CATALOG_SCHEMA_VERSION, Release, ReleaseCatalog, ReleaseCatalogDescriptor, ReleaseCatalogScopeKeyInput, ReleaseKind, ReleaseOperation, ReleaseSelectionContextInput, ReleaseSelectionInput, ReleaseStrategy, ReleaseTransitionAuthorization, ReleaseTransitionKind, SelectionKind, UpdateCheckResult, UpdateError, UpdateErrorReason, UpdateErrorResource, UpdateErrorStage, UpdateErrorTransport, UpdateHttpResponse, UpdateStatus, UpdateStrategy, assertCanonicalChannelName, assessCatalogAcceptance, authorizeReleaseTransition, canonicalizeAppVersion, createPluginHost, createReleaseCatalogScopeKey, createReleaseSelectionContextHash, decodeChannelKey, defineClientPlugin, encodeChannelKey, getAssetBaseStorageUri, getBundlePatch, getBundlePatches, getDefaultNumericCohort, getManifestFileHash, getManifestStorageUri, getNumericCohortRolloutPosition, getNumericCohortValue, getPatchBaseBundleId, getPatchBaseFileHash, getPatchFileHash, getPatchStorageUri, getRolledOutNumericCohorts, getUtf8ByteLength, hasExpectedReleaseCatalogScope, isCohortEligibleForUpdate, isCustomCohort, isNumericCohort, isReleaseEligibleForCohort, isUUIDv7, isValidCohort, normalizeChannelName, normalizeCohortValue, normalizeRolloutCohortCount, parseReleaseCatalog, parseReleaseCatalogScopeKey, pluginStorageKey, readReleaseLabel, resolveBaseURL, selectDesiredRelease };
package/dist/index.d.mts CHANGED
@@ -361,7 +361,13 @@ interface HotUpdaterClientContext {
361
361
  readonly minBundleId: string;
362
362
  /** Whether this is a debug build (`__DEV__`). */
363
363
  readonly isDebugBuild: boolean;
364
- /** The bundle native reports as current. */
364
+ /**
365
+ * The same ID as `hotUpdater.getBundleId()`: the selected release's ID, the
366
+ * one the Console shows. It names a staged update before the app reloads,
367
+ * `minBundleId` for the built-in bundle, and the artifact ID only for a
368
+ * bundle installed without a release. A plugin that needs the artifact reads
369
+ * the hooks' `bundleId`, `fromBundleId`, `toBundleId`, and `targetBundleId`.
370
+ */
365
371
  getBundleId(): string;
366
372
  getChannel(): string;
367
373
  getCohort(): string;
@@ -429,6 +435,7 @@ interface PluginHostEnvironment {
429
435
  getInstallId(): string;
430
436
  getAppVersion(): string | null;
431
437
  getMinBundleId(): string;
438
+ /** The selected release's ID, as `hotUpdater.getBundleId()` returns it. */
432
439
  getBundleId(): string;
433
440
  getChannel(): string;
434
441
  getCohort(): string;
@@ -494,6 +501,12 @@ interface Release {
494
501
  readonly sourceReleaseId: string | null;
495
502
  readonly createdAtMs: number;
496
503
  readonly updatedAtMs: number;
504
+ /**
505
+ * The release's label, `v<label>` in the CLI and the Console: sequential
506
+ * per channel and platform, never changed or reused. Null or left out
507
+ * until the database assigns one.
508
+ */
509
+ readonly label?: number | null;
497
510
  }
498
511
  interface ReleaseCatalogDescriptor {
499
512
  readonly releaseId: string;
@@ -503,6 +516,12 @@ interface ReleaseCatalogDescriptor {
503
516
  readonly targetCohorts: readonly string[];
504
517
  readonly shouldForceUpdate: boolean;
505
518
  readonly message: string | null;
519
+ /**
520
+ * The release's label, when it has one. Optional on the wire: a server
521
+ * before labels, or a catalog too large to carry them, leaves it out, and
522
+ * clients read a missing or malformed one as none.
523
+ */
524
+ readonly label?: number;
506
525
  }
507
526
  interface ReleaseCatalog {
508
527
  readonly schemaVersion: typeof RELEASE_CATALOG_SCHEMA_VERSION;
@@ -533,6 +552,13 @@ interface PersistedSelectionReceipt {
533
552
  readonly catalogHash: string | null;
534
553
  readonly channel: string;
535
554
  readonly selectionContextHash: string | null;
555
+ /**
556
+ * The selected release's label, which native keeps with the receipt so the
557
+ * app reads it after a restart and offline. Left out or null for the
558
+ * built-in bundle, a release without one, and native built from an SDK
559
+ * before labels, which drops it.
560
+ */
561
+ readonly label?: number | null;
536
562
  }
537
563
  interface ReleaseSelectionInput {
538
564
  readonly builtInBundleId: string;
@@ -544,7 +570,11 @@ interface ReleaseSelectionInput {
544
570
  * Defaults to `activeReleaseId`; null compares by `currentBundleId`.
545
571
  */
546
572
  readonly runningReleaseId?: string | null;
547
- readonly minimumReleaseId: string;
573
+ /**
574
+ * The selection floor: the built-in bundle's ID (MIN_BUNDLE_ID), or the
575
+ * nil UUID when bundles older than it may be selected.
576
+ */
577
+ readonly minBundleId: string;
548
578
  readonly cohort: string | null | undefined;
549
579
  readonly crashedBundleIds: readonly string[];
550
580
  }
@@ -552,7 +582,11 @@ interface ReleaseSelectionContextInput {
552
582
  readonly activeBundleId?: string | null;
553
583
  readonly activeReleaseId?: string | null;
554
584
  readonly cohort: string | null | undefined;
555
- readonly minimumReleaseId: string;
585
+ /**
586
+ * The selection floor: the built-in bundle's ID (MIN_BUNDLE_ID), or the
587
+ * nil UUID when bundles older than it may be selected.
588
+ */
589
+ readonly minBundleId: string;
556
590
  readonly strategy: ReleaseStrategy;
557
591
  readonly strategyValue: string;
558
592
  readonly crashedBundleIds: readonly string[];
@@ -630,6 +664,13 @@ type ExpectedReleaseCatalogScope = {
630
664
  });
631
665
  /** The length of `value` in UTF-8 bytes, without an encoder the device may lack. */
632
666
  declare const getUtf8ByteLength: (value: string) => number;
667
+ /**
668
+ * A release label as it crosses the device boundary: a positive safe
669
+ * integer, or null for anything else, such as a server before labels or a
670
+ * label in a form a later release may send. A label is for display only, so
671
+ * one in another form never makes a catalog or a receipt invalid.
672
+ */
673
+ declare const readReleaseLabel: (value: unknown) => number | null;
633
674
  /** Whether the catalog is the expected scope's. */
634
675
  declare const hasExpectedReleaseCatalogScope: (catalog: Pick<ReleaseCatalog, "scopeKey">, expected: ExpectedReleaseCatalogScope) => boolean;
635
676
  /**
@@ -652,12 +693,12 @@ declare function isNumericCohort(cohort: string): boolean;
652
693
  declare function isCustomCohort(cohort: string): boolean;
653
694
  declare function isValidCohort(cohort: string): boolean;
654
695
  declare function getDefaultNumericCohort(identifier: string): string;
655
- declare function getNumericCohortRolloutPosition(bundleId: string, cohortValue: number): number;
656
- declare function getRolledOutNumericCohorts(bundleId: string, rolloutCohortCount: number | null | undefined): number[];
657
- declare function isCohortEligibleForUpdate(bundleId: string, cohort: string | null | undefined, rolloutCohortCount: number | null | undefined, targetCohorts: readonly string[] | null | undefined): boolean;
696
+ declare function getNumericCohortRolloutPosition(releaseId: string, cohortValue: number): number;
697
+ declare function getRolledOutNumericCohorts(releaseId: string, rolloutCohortCount: number | null | undefined): number[];
698
+ declare function isCohortEligibleForUpdate(releaseId: string, cohort: string | null | undefined, rolloutCohortCount: number | null | undefined, targetCohorts: readonly string[] | null | undefined): boolean;
658
699
  //#endregion
659
700
  //#region src/uuid.d.ts
660
701
  declare const NIL_UUID = "00000000-0000-0000-0000-000000000000";
661
702
  declare const isUUIDv7: (value: unknown) => value is string;
662
703
  //#endregion
663
- export { ARTIFACT_FILES_PROTOCOL_VERSION, ARTIFACT_FILES_REQUEST_LIMIT, ARTIFACT_PROTOCOL_VERSION, AppReadyResult, ArtifactAsset, ArtifactAssetFile, ArtifactFiles, ArtifactFilesRequest, ArtifactInfo, ArtifactInfoV2, Bundle, BundleDownloadedInfo, BundleMetadata, BundlePatchArtifact, CatalogAcceptance, CatalogHighWater, ChangedAssetPatch, ClientPluginApi, ClientPluginApis, DEFAULT_ROLLOUT_COHORT_COUNT, DesiredRelease, ExpectedReleaseCatalogScope, HotUpdaterBaseURL, HotUpdaterClientContext, HotUpdaterClientHooks, HotUpdaterClientPlugin, HotUpdaterClientSetup, HotUpdaterClientStorage, INVALID_COHORT_ERROR_MESSAGE, MAX_COHORT_LENGTH, MAX_COMPILED_CATALOG_BYTES, MAX_CRASHED_BUNDLES, MAX_DISTINCT_TARGET_COHORTS_PER_SCOPE, MAX_RELEASE_CATALOG_WIRE_BYTES, MAX_TARGET_COHORTS_PER_RELEASE, ManifestArchive, NIL_UUID, NUMERIC_COHORT_SIZE, PersistedSelectionReceipt, Platform, PluginHookName, PluginHookPayload, PluginHost, PluginHostConfig, PluginHostEnvironment, RELEASE_CATALOG_FALLBACK_POLICY, RELEASE_CATALOG_SCHEMA_VERSION, Release, ReleaseCatalog, ReleaseCatalogDescriptor, ReleaseCatalogScopeKeyInput, ReleaseKind, ReleaseOperation, ReleaseSelectionContextInput, ReleaseSelectionInput, ReleaseStrategy, ReleaseTransitionAuthorization, ReleaseTransitionKind, SelectionKind, UpdateCheckResult, UpdateError, UpdateErrorReason, UpdateErrorResource, UpdateErrorStage, UpdateErrorTransport, UpdateHttpResponse, UpdateStatus, UpdateStrategy, assertCanonicalChannelName, assessCatalogAcceptance, authorizeReleaseTransition, canonicalizeAppVersion, createPluginHost, createReleaseCatalogScopeKey, createReleaseSelectionContextHash, decodeChannelKey, defineClientPlugin, encodeChannelKey, getAssetBaseStorageUri, getBundlePatch, getBundlePatches, getDefaultNumericCohort, getManifestFileHash, getManifestStorageUri, getNumericCohortRolloutPosition, getNumericCohortValue, getPatchBaseBundleId, getPatchBaseFileHash, getPatchFileHash, getPatchStorageUri, getRolledOutNumericCohorts, getUtf8ByteLength, hasExpectedReleaseCatalogScope, isCohortEligibleForUpdate, isCustomCohort, isNumericCohort, isReleaseEligibleForCohort, isUUIDv7, isValidCohort, normalizeChannelName, normalizeCohortValue, normalizeRolloutCohortCount, parseReleaseCatalog, parseReleaseCatalogScopeKey, pluginStorageKey, resolveBaseURL, selectDesiredRelease };
704
+ export { ARTIFACT_FILES_PROTOCOL_VERSION, ARTIFACT_FILES_REQUEST_LIMIT, ARTIFACT_PROTOCOL_VERSION, AppReadyResult, ArtifactAsset, ArtifactAssetFile, ArtifactFiles, ArtifactFilesRequest, ArtifactInfo, ArtifactInfoV2, Bundle, BundleDownloadedInfo, BundleMetadata, BundlePatchArtifact, CatalogAcceptance, CatalogHighWater, ChangedAssetPatch, ClientPluginApi, ClientPluginApis, DEFAULT_ROLLOUT_COHORT_COUNT, DesiredRelease, ExpectedReleaseCatalogScope, HotUpdaterBaseURL, HotUpdaterClientContext, HotUpdaterClientHooks, HotUpdaterClientPlugin, HotUpdaterClientSetup, HotUpdaterClientStorage, INVALID_COHORT_ERROR_MESSAGE, MAX_COHORT_LENGTH, MAX_COMPILED_CATALOG_BYTES, MAX_CRASHED_BUNDLES, MAX_DISTINCT_TARGET_COHORTS_PER_SCOPE, MAX_RELEASE_CATALOG_WIRE_BYTES, MAX_TARGET_COHORTS_PER_RELEASE, ManifestArchive, NIL_UUID, NUMERIC_COHORT_SIZE, PersistedSelectionReceipt, Platform, PluginHookName, PluginHookPayload, PluginHost, PluginHostConfig, PluginHostEnvironment, RELEASE_CATALOG_FALLBACK_POLICY, RELEASE_CATALOG_SCHEMA_VERSION, Release, ReleaseCatalog, ReleaseCatalogDescriptor, ReleaseCatalogScopeKeyInput, ReleaseKind, ReleaseOperation, ReleaseSelectionContextInput, ReleaseSelectionInput, ReleaseStrategy, ReleaseTransitionAuthorization, ReleaseTransitionKind, SelectionKind, UpdateCheckResult, UpdateError, UpdateErrorReason, UpdateErrorResource, UpdateErrorStage, UpdateErrorTransport, UpdateHttpResponse, UpdateStatus, UpdateStrategy, assertCanonicalChannelName, assessCatalogAcceptance, authorizeReleaseTransition, canonicalizeAppVersion, createPluginHost, createReleaseCatalogScopeKey, createReleaseSelectionContextHash, decodeChannelKey, defineClientPlugin, encodeChannelKey, getAssetBaseStorageUri, getBundlePatch, getBundlePatches, getDefaultNumericCohort, getManifestFileHash, getManifestStorageUri, getNumericCohortRolloutPosition, getNumericCohortValue, getPatchBaseBundleId, getPatchBaseFileHash, getPatchFileHash, getPatchStorageUri, getRolledOutNumericCohorts, getUtf8ByteLength, hasExpectedReleaseCatalogScope, isCohortEligibleForUpdate, isCustomCohort, isNumericCohort, isReleaseEligibleForCohort, isUUIDv7, isValidCohort, normalizeChannelName, normalizeCohortValue, normalizeRolloutCohortCount, parseReleaseCatalog, parseReleaseCatalogScopeKey, pluginStorageKey, readReleaseLabel, resolveBaseURL, selectDesiredRelease };
package/dist/index.mjs CHANGED
@@ -276,14 +276,14 @@ function modularInverse(value, modulus) {
276
276
  if (r > 1) throw new Error(`No modular inverse for ${value} mod ${modulus}`);
277
277
  return positiveMod(t, modulus);
278
278
  }
279
- function getRolloutShuffleParameters(bundleId) {
280
- let multiplier = positiveMod(hashString(`${bundleId}:multiplier`), 997);
279
+ function getRolloutShuffleParameters(releaseId) {
280
+ let multiplier = positiveMod(hashString(`${releaseId}:multiplier`), 997);
281
281
  if (multiplier === 0) multiplier = 1;
282
282
  while (gcd(multiplier, NUMERIC_COHORT_SIZE) !== 1) {
283
283
  multiplier = positiveMod(multiplier + 1, NUMERIC_COHORT_SIZE);
284
284
  if (multiplier === 0) multiplier = 1;
285
285
  }
286
- const offset = positiveMod(hashString(`${bundleId}:offset`), NUMERIC_COHORT_SIZE);
286
+ const offset = positiveMod(hashString(`${releaseId}:offset`), NUMERIC_COHORT_SIZE);
287
287
  return {
288
288
  multiplier,
289
289
  offset,
@@ -320,19 +320,19 @@ function getDefaultNumericCohort(identifier) {
320
320
  const cohortValue = positiveMod(hashString(identifier), NUMERIC_COHORT_SIZE) + 1;
321
321
  return String(cohortValue);
322
322
  }
323
- function getNumericCohortRolloutPosition(bundleId, cohortValue) {
323
+ function getNumericCohortRolloutPosition(releaseId, cohortValue) {
324
324
  if (cohortValue < 1 || cohortValue > 1e3) throw new Error(`Invalid numeric cohort: ${cohortValue}`);
325
- const { offset, inverseMultiplier } = getRolloutShuffleParameters(bundleId);
325
+ const { offset, inverseMultiplier } = getRolloutShuffleParameters(releaseId);
326
326
  return positiveMod(inverseMultiplier * (cohortValue - 1 - offset), NUMERIC_COHORT_SIZE);
327
327
  }
328
- function getRolledOutNumericCohorts(bundleId, rolloutCohortCount) {
328
+ function getRolledOutNumericCohorts(releaseId, rolloutCohortCount) {
329
329
  const normalizedRolloutCount = normalizeRolloutCohortCount(rolloutCohortCount);
330
330
  if (normalizedRolloutCount <= 0) return [];
331
331
  if (normalizedRolloutCount >= 1e3) return Array.from({ length: NUMERIC_COHORT_SIZE }, (_, index) => index + 1);
332
- const { multiplier, offset } = getRolloutShuffleParameters(bundleId);
332
+ const { multiplier, offset } = getRolloutShuffleParameters(releaseId);
333
333
  return Array.from({ length: normalizedRolloutCount }, (_, position) => positiveMod(multiplier * position + offset, NUMERIC_COHORT_SIZE)).map((zeroBasedCohort) => zeroBasedCohort + 1).sort((left, right) => left - right);
334
334
  }
335
- function isCohortEligibleForUpdate(bundleId, cohort, rolloutCohortCount, targetCohorts) {
335
+ function isCohortEligibleForUpdate(releaseId, cohort, rolloutCohortCount, targetCohorts) {
336
336
  const normalizedCohort = cohort === null || cohort === void 0 ? void 0 : normalizeCohortValue(cohort);
337
337
  const normalizedTargetCohorts = targetCohorts?.map((targetCohort) => normalizeCohortValue(targetCohort)) ?? [];
338
338
  if (normalizedCohort !== void 0 && normalizedTargetCohorts.includes(normalizedCohort)) return true;
@@ -342,7 +342,7 @@ function isCohortEligibleForUpdate(bundleId, cohort, rolloutCohortCount, targetC
342
342
  const numericCohort = getNumericCohortValue(normalizedCohort);
343
343
  if (numericCohort === null) return false;
344
344
  if (normalizedRolloutCount >= 1e3) return true;
345
- return getNumericCohortRolloutPosition(bundleId, numericCohort) < normalizedRolloutCount;
345
+ return getNumericCohortRolloutPosition(releaseId, numericCohort) < normalizedRolloutCount;
346
346
  }
347
347
  //#endregion
348
348
  //#region src/releaseCatalog.ts
@@ -369,7 +369,7 @@ function createReleaseSelectionContextHash(input) {
369
369
  activeReleaseId: input.activeReleaseId ?? null,
370
370
  cohort: normalizeCohortValue(input.cohort ?? ""),
371
371
  crashedBundleIds,
372
- minimumReleaseId: input.minimumReleaseId,
372
+ minimumReleaseId: input.minBundleId,
373
373
  selectorSchemaVersion: 1,
374
374
  strategy: input.strategy,
375
375
  strategyValue: input.strategyValue
@@ -384,10 +384,10 @@ function selectDesiredRelease(catalog, input) {
384
384
  const crashedBundleIds = new Set(input.crashedBundleIds);
385
385
  const activeReleaseId = input.activeReleaseId ?? null;
386
386
  const hasActiveBundle = input.currentBundleId !== input.builtInBundleId;
387
- const isSafeBundleRelease = (release) => release.bundleId !== null && !crashedBundleIds.has(release.bundleId) && release.bundleId >= input.minimumReleaseId;
387
+ const isSafeBundleRelease = (release) => release.bundleId !== null && !crashedBundleIds.has(release.bundleId) && release.bundleId >= input.minBundleId;
388
388
  const runningReleaseId = input.runningReleaseId === void 0 ? activeReleaseId : input.runningReleaseId;
389
389
  const isNewerThanRunning = (release) => runningReleaseId !== null ? release.releaseId > runningReleaseId : release.bundleId !== null && release.bundleId > input.currentBundleId;
390
- const passesForcedRelease = (selected) => [selected, ...catalog.rollbackReleases].some((passed) => passed.shouldForceUpdate && passed.bundleId !== null && passed.bundleId >= input.minimumReleaseId && passed.bundleId !== input.currentBundleId && passed.releaseId <= selected.releaseId && isNewerThanRunning(passed) && isReleaseEligibleForCohort(passed, input.cohort));
390
+ const passesForcedRelease = (selected) => [selected, ...catalog.rollbackReleases].some((passed) => passed.shouldForceUpdate && passed.bundleId !== null && passed.bundleId >= input.minBundleId && passed.bundleId !== input.currentBundleId && passed.releaseId <= selected.releaseId && isNewerThanRunning(passed) && isReleaseEligibleForCohort(passed, input.cohort));
391
391
  const desiredBundle = (release, status) => ({
392
392
  bundleId: release.bundleId,
393
393
  kind: "BUNDLE",
@@ -407,7 +407,7 @@ function selectDesiredRelease(catalog, input) {
407
407
  if (current !== void 0 && isSafeBundleRelease(current) && isReleaseEligibleForCohort(current, input.cohort)) return desiredBundle(current, "UPDATE");
408
408
  const rollback = rollbackReleases.find((release) => isSafeBundleRelease(release) && (activeReleaseId !== null ? release.releaseId < activeReleaseId : release.bundleId < input.currentBundleId));
409
409
  if (rollback !== void 0 && isSafeBundleRelease(rollback)) return desiredBundle(rollback, "ROLLBACK");
410
- if (input.currentBundleId <= input.minimumReleaseId) return null;
410
+ if (input.currentBundleId <= input.minBundleId) return null;
411
411
  }
412
412
  if (catalog.fallbackPolicy !== "BUILTIN_IF_ACTIVE_INELIGIBLE") return null;
413
413
  return {
@@ -492,6 +492,17 @@ const getUtf8ByteLength = (value) => {
492
492
  }
493
493
  return bytes;
494
494
  };
495
+ /**
496
+ * A release label as it crosses the device boundary: a positive safe
497
+ * integer, or null for anything else, such as a server before labels or a
498
+ * label in a form a later release may send. A label is for display only, so
499
+ * one in another form never makes a catalog or a receipt invalid.
500
+ */
501
+ const readReleaseLabel = (value) => Number.isSafeInteger(value) && value >= 1 ? value : null;
502
+ /** Drops a descriptor's label that `readReleaseLabel` reads as none. */
503
+ const keepValidLabel = (descriptor) => {
504
+ if ("label" in descriptor && readReleaseLabel(descriptor.label) === null) delete descriptor.label;
505
+ };
495
506
  const isStringArray = (value) => Array.isArray(value) && value.every((entry) => typeof entry === "string");
496
507
  const isValidReleaseDescriptor = (value) => {
497
508
  if (value === null || typeof value !== "object") return false;
@@ -519,6 +530,7 @@ const parseReleaseCatalog = (body, expectedScope) => {
519
530
  const catalog = JSON.parse(body);
520
531
  if (catalog.schemaVersion !== 1 || typeof catalog.catalogId !== "string" || catalog.catalogId.length === 0 || typeof catalog.scopeKey !== "string" || !Number.isSafeInteger(catalog.generation) || (catalog.generation ?? 0) < 1 || typeof catalog.catalogHash !== "string" || !/^sha256:[0-9a-f]{64}$/.test(catalog.catalogHash) || catalog.fallbackPolicy !== "BUILTIN_IF_ACTIVE_INELIGIBLE" || !Array.isArray(catalog.releases) || !catalog.releases.every(isValidReleaseDescriptor) || !Array.isArray(catalog.rollbackReleases) || !catalog.rollbackReleases.every(isValidReleaseDescriptor)) return null;
521
532
  if (!hasExpectedReleaseCatalogScope(catalog, expectedScope)) return null;
533
+ for (const descriptor of [...catalog.releases, ...catalog.rollbackReleases]) keepValidLabel(descriptor);
522
534
  if (new Set([...catalog.releases, ...catalog.rollbackReleases].flatMap((release) => release.targetCohorts)).size > 512) return null;
523
535
  return catalog;
524
536
  } catch {
@@ -536,4 +548,4 @@ const ARTIFACT_FILES_PROTOCOL_VERSION = 2;
536
548
  /** Paths one artifact files request may resolve; a device splits more. */
537
549
  const ARTIFACT_FILES_REQUEST_LIMIT = 100;
538
550
  //#endregion
539
- export { ARTIFACT_FILES_PROTOCOL_VERSION, ARTIFACT_FILES_REQUEST_LIMIT, ARTIFACT_PROTOCOL_VERSION, DEFAULT_ROLLOUT_COHORT_COUNT, INVALID_COHORT_ERROR_MESSAGE, MAX_COHORT_LENGTH, MAX_COMPILED_CATALOG_BYTES, MAX_CRASHED_BUNDLES, MAX_DISTINCT_TARGET_COHORTS_PER_SCOPE, MAX_RELEASE_CATALOG_WIRE_BYTES, MAX_TARGET_COHORTS_PER_RELEASE, NIL_UUID, NUMERIC_COHORT_SIZE, RELEASE_CATALOG_FALLBACK_POLICY, RELEASE_CATALOG_SCHEMA_VERSION, assertCanonicalChannelName, assessCatalogAcceptance, authorizeReleaseTransition, canonicalizeAppVersion, createPluginHost, createReleaseCatalogScopeKey, createReleaseSelectionContextHash, decodeChannelKey, defineClientPlugin, encodeChannelKey, getAssetBaseStorageUri, getBundlePatch, getBundlePatches, getDefaultNumericCohort, getManifestFileHash, getManifestStorageUri, getNumericCohortRolloutPosition, getNumericCohortValue, getPatchBaseBundleId, getPatchBaseFileHash, getPatchFileHash, getPatchStorageUri, getRolledOutNumericCohorts, getUtf8ByteLength, hasExpectedReleaseCatalogScope, isCohortEligibleForUpdate, isCustomCohort, isNumericCohort, isReleaseEligibleForCohort, isUUIDv7, isValidCohort, normalizeChannelName, normalizeCohortValue, normalizeRolloutCohortCount, parseReleaseCatalog, parseReleaseCatalogScopeKey, pluginStorageKey, resolveBaseURL, selectDesiredRelease };
551
+ export { ARTIFACT_FILES_PROTOCOL_VERSION, ARTIFACT_FILES_REQUEST_LIMIT, ARTIFACT_PROTOCOL_VERSION, DEFAULT_ROLLOUT_COHORT_COUNT, INVALID_COHORT_ERROR_MESSAGE, MAX_COHORT_LENGTH, MAX_COMPILED_CATALOG_BYTES, MAX_CRASHED_BUNDLES, MAX_DISTINCT_TARGET_COHORTS_PER_SCOPE, MAX_RELEASE_CATALOG_WIRE_BYTES, MAX_TARGET_COHORTS_PER_RELEASE, NIL_UUID, NUMERIC_COHORT_SIZE, RELEASE_CATALOG_FALLBACK_POLICY, RELEASE_CATALOG_SCHEMA_VERSION, assertCanonicalChannelName, assessCatalogAcceptance, authorizeReleaseTransition, canonicalizeAppVersion, createPluginHost, createReleaseCatalogScopeKey, createReleaseSelectionContextHash, decodeChannelKey, defineClientPlugin, encodeChannelKey, getAssetBaseStorageUri, getBundlePatch, getBundlePatches, getDefaultNumericCohort, getManifestFileHash, getManifestStorageUri, getNumericCohortRolloutPosition, getNumericCohortValue, getPatchBaseBundleId, getPatchBaseFileHash, getPatchFileHash, getPatchStorageUri, getRolledOutNumericCohorts, getUtf8ByteLength, hasExpectedReleaseCatalogScope, isCohortEligibleForUpdate, isCustomCohort, isNumericCohort, isReleaseEligibleForCohort, isUUIDv7, isValidCohort, normalizeChannelName, normalizeCohortValue, normalizeRolloutCohortCount, parseReleaseCatalog, parseReleaseCatalogScopeKey, pluginStorageKey, readReleaseLabel, resolveBaseURL, selectDesiredRelease };