@hot-updater/protocol 1.0.5 → 1.0.7

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
@@ -773,7 +773,16 @@ const parseReleaseCatalog = (body, expectedScope) => {
773
773
  //#endregion
774
774
  //#region src/types.ts
775
775
  const ARTIFACT_PROTOCOL_VERSION = 1;
776
+ /**
777
+ * Artifact protocol in which a device asks for the URLs of only the files it
778
+ * downloads one by one, after reusing local files and choosing the archive.
779
+ */
780
+ const ARTIFACT_FILES_PROTOCOL_VERSION = 2;
781
+ /** Paths one artifact files request may resolve; a device splits more. */
782
+ const ARTIFACT_FILES_REQUEST_LIMIT = 100;
776
783
  //#endregion
784
+ exports.ARTIFACT_FILES_PROTOCOL_VERSION = ARTIFACT_FILES_PROTOCOL_VERSION;
785
+ exports.ARTIFACT_FILES_REQUEST_LIMIT = ARTIFACT_FILES_REQUEST_LIMIT;
777
786
  exports.ARTIFACT_PROTOCOL_VERSION = ARTIFACT_PROTOCOL_VERSION;
778
787
  exports.DEFAULT_ROLLOUT_COHORT_COUNT = DEFAULT_ROLLOUT_COHORT_COUNT;
779
788
  exports.INVALID_COHORT_ERROR_MESSAGE = INVALID_COHORT_ERROR_MESSAGE;
package/dist/index.d.cts CHANGED
@@ -50,6 +50,13 @@ interface ArtifactAsset {
50
50
  patch?: ChangedAssetPatch | null;
51
51
  }
52
52
  declare const ARTIFACT_PROTOCOL_VERSION: 1;
53
+ /**
54
+ * Artifact protocol in which a device asks for the URLs of only the files it
55
+ * downloads one by one, after reusing local files and choosing the archive.
56
+ */
57
+ declare const ARTIFACT_FILES_PROTOCOL_VERSION: 2;
58
+ /** Paths one artifact files request may resolve; a device splits more. */
59
+ declare const ARTIFACT_FILES_REQUEST_LIMIT = 100;
53
60
  interface Bundle {
54
61
  /**
55
62
  * The unique identifier for the bundle. uuidv7
@@ -106,6 +113,31 @@ interface ArtifactInfo {
106
113
  */
107
114
  assets: Record<string, ArtifactAsset>;
108
115
  }
116
+ /**
117
+ * How a device downloads a Bundle in artifact protocol v2: no URL per file,
118
+ * so the response and its signing stay the same size for any number of files.
119
+ */
120
+ interface ArtifactInfoV2 {
121
+ artifactProtocolVersion: typeof ARTIFACT_FILES_PROTOCOL_VERSION;
122
+ manifestUrl: string;
123
+ /** SHA256 hash of the manifest file, optionally `sig:<base64_signature>`. */
124
+ manifestFileHash: string;
125
+ /** Optional bulk transport. Hash and sizes come from the verified manifest. */
126
+ archiveUrl?: string;
127
+ /** The Hermes bytecode patch from the device's current Bundle, if smaller than its file. */
128
+ patch?: ChangedAssetPatch & {
129
+ assetPath: string;
130
+ };
131
+ }
132
+ /** The request body of `POST /artifacts/v2/:bundleId/files`. */
133
+ interface ArtifactFilesRequest {
134
+ /** Manifest asset paths, unique, at most {@link ARTIFACT_FILES_REQUEST_LIMIT}. */
135
+ paths: string[];
136
+ }
137
+ /** Download URLs for the requested manifest asset paths. */
138
+ interface ArtifactFiles {
139
+ files: Record<string, ArtifactAssetFile>;
140
+ }
109
141
  //#endregion
110
142
  //#region src/bundleArtifacts.d.ts
111
143
  declare const getManifestStorageUri: (bundle: Pick<Bundle, "manifestStorageUri">) => string;
@@ -592,4 +624,4 @@ declare function isCohortEligibleForUpdate(bundleId: string, cohort: string | nu
592
624
  declare const NIL_UUID = "00000000-0000-0000-0000-000000000000";
593
625
  declare const isUUIDv7: (value: unknown) => value is string;
594
626
  //#endregion
595
- export { ARTIFACT_PROTOCOL_VERSION, AppReadyResult, ArtifactAsset, ArtifactAssetFile, ArtifactInfo, 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 };
627
+ 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 };
package/dist/index.d.mts CHANGED
@@ -50,6 +50,13 @@ interface ArtifactAsset {
50
50
  patch?: ChangedAssetPatch | null;
51
51
  }
52
52
  declare const ARTIFACT_PROTOCOL_VERSION: 1;
53
+ /**
54
+ * Artifact protocol in which a device asks for the URLs of only the files it
55
+ * downloads one by one, after reusing local files and choosing the archive.
56
+ */
57
+ declare const ARTIFACT_FILES_PROTOCOL_VERSION: 2;
58
+ /** Paths one artifact files request may resolve; a device splits more. */
59
+ declare const ARTIFACT_FILES_REQUEST_LIMIT = 100;
53
60
  interface Bundle {
54
61
  /**
55
62
  * The unique identifier for the bundle. uuidv7
@@ -106,6 +113,31 @@ interface ArtifactInfo {
106
113
  */
107
114
  assets: Record<string, ArtifactAsset>;
108
115
  }
116
+ /**
117
+ * How a device downloads a Bundle in artifact protocol v2: no URL per file,
118
+ * so the response and its signing stay the same size for any number of files.
119
+ */
120
+ interface ArtifactInfoV2 {
121
+ artifactProtocolVersion: typeof ARTIFACT_FILES_PROTOCOL_VERSION;
122
+ manifestUrl: string;
123
+ /** SHA256 hash of the manifest file, optionally `sig:<base64_signature>`. */
124
+ manifestFileHash: string;
125
+ /** Optional bulk transport. Hash and sizes come from the verified manifest. */
126
+ archiveUrl?: string;
127
+ /** The Hermes bytecode patch from the device's current Bundle, if smaller than its file. */
128
+ patch?: ChangedAssetPatch & {
129
+ assetPath: string;
130
+ };
131
+ }
132
+ /** The request body of `POST /artifacts/v2/:bundleId/files`. */
133
+ interface ArtifactFilesRequest {
134
+ /** Manifest asset paths, unique, at most {@link ARTIFACT_FILES_REQUEST_LIMIT}. */
135
+ paths: string[];
136
+ }
137
+ /** Download URLs for the requested manifest asset paths. */
138
+ interface ArtifactFiles {
139
+ files: Record<string, ArtifactAssetFile>;
140
+ }
109
141
  //#endregion
110
142
  //#region src/bundleArtifacts.d.ts
111
143
  declare const getManifestStorageUri: (bundle: Pick<Bundle, "manifestStorageUri">) => string;
@@ -592,4 +624,4 @@ declare function isCohortEligibleForUpdate(bundleId: string, cohort: string | nu
592
624
  declare const NIL_UUID = "00000000-0000-0000-0000-000000000000";
593
625
  declare const isUUIDv7: (value: unknown) => value is string;
594
626
  //#endregion
595
- export { ARTIFACT_PROTOCOL_VERSION, AppReadyResult, ArtifactAsset, ArtifactAssetFile, ArtifactInfo, 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 };
627
+ 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 };
package/dist/index.mjs CHANGED
@@ -772,5 +772,12 @@ const parseReleaseCatalog = (body, expectedScope) => {
772
772
  //#endregion
773
773
  //#region src/types.ts
774
774
  const ARTIFACT_PROTOCOL_VERSION = 1;
775
+ /**
776
+ * Artifact protocol in which a device asks for the URLs of only the files it
777
+ * downloads one by one, after reusing local files and choosing the archive.
778
+ */
779
+ const ARTIFACT_FILES_PROTOCOL_VERSION = 2;
780
+ /** Paths one artifact files request may resolve; a device splits more. */
781
+ const ARTIFACT_FILES_REQUEST_LIMIT = 100;
775
782
  //#endregion
776
- export { 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 };
783
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/protocol",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
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,