@void/deploy-cloudflare 0.21.8 → 0.21.9

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.d.mts CHANGED
@@ -168,6 +168,8 @@ type CloudflareVersionMetadata = Readonly<{
168
168
  schema: 2;
169
169
  migrations: ReadonlyArray<string>;
170
170
  triggerConfig: CloudflareTriggerConfig;
171
+ /** Digest of the complete Worker upload input, when supplied by the caller. */
172
+ contentHash?: string;
171
173
  }>;
172
174
  type CloudflareTriggerConfig = Readonly<{
173
175
  /** This version retained the existing triggers instead of publishing a snapshot. */
@@ -218,7 +220,7 @@ type CloudflareVersionActivation = {
218
220
  triggerRepair?: "succeeded" | "failed" | "unavailable";
219
221
  };
220
222
  /** Encode migration state into Cloudflare's version annotation for safe rollback diagnostics. */
221
- export declare function encodeCloudflareVersionMessage(migrations: ReadonlyArray<string>, triggerConfig?: CloudflareTriggerConfig): string;
223
+ export declare function encodeCloudflareVersionMessage(migrations: ReadonlyArray<string>, triggerConfig?: CloudflareTriggerConfig, contentHash?: string): string;
222
224
  /** Read migration state written by {@link encodeCloudflareVersionMessage}. */
223
225
  export declare function parseCloudflareVersionMessage(message: string | null | undefined): CloudflareVersionMetadata | null;
224
226
  /**
package/dist/index.mjs CHANGED
@@ -768,15 +768,17 @@ const WORKERS_DEV_URL_RE = /(https:\/\/[a-z0-9.-]+\.workers\.dev(?:\/[^\s]*)?)/i
768
768
  const CLOUDFLARE_ERROR_CODE_RE = /\[code:\s*(\d+)\]/i;
769
769
  const DURABLE_MIGRATION_VERSION_ERROR = 10211;
770
770
  /** Encode migration state into Cloudflare's version annotation for safe rollback diagnostics. */
771
- function encodeCloudflareVersionMessage(migrations, triggerConfig) {
772
- return `void:${JSON.stringify(triggerConfig ? {
771
+ function encodeCloudflareVersionMessage(migrations, triggerConfig, contentHash) {
772
+ const metadata = triggerConfig ? {
773
773
  schema: 2,
774
774
  migrations,
775
- triggerConfig
775
+ triggerConfig,
776
+ ...contentHash ? { contentHash } : {}
776
777
  } : {
777
778
  schema: 1,
778
779
  migrations
779
- })}`;
780
+ };
781
+ return `void:${JSON.stringify(metadata)}`;
780
782
  }
781
783
  /** Read migration state written by {@link encodeCloudflareVersionMessage}. */
782
784
  function parseCloudflareVersionMessage(message) {
@@ -789,11 +791,13 @@ function parseCloudflareVersionMessage(message) {
789
791
  migrations: value.migrations
790
792
  };
791
793
  const triggerConfig = parseTriggerConfig(value.triggerConfig);
792
- return triggerConfig ? {
794
+ if (!triggerConfig) return null;
795
+ return {
793
796
  schema: 2,
794
797
  migrations: value.migrations,
795
- triggerConfig
796
- } : null;
798
+ triggerConfig,
799
+ ...typeof value.contentHash === "string" && /^[a-f0-9]{64}$/.test(value.contentHash) ? { contentHash: value.contentHash } : {}
800
+ };
797
801
  } catch {
798
802
  return null;
799
803
  }
@@ -1184,6 +1188,7 @@ async function activateCloudflareVersionWithSecretsFile(options) {
1184
1188
  const previousVersionId = previous.versionId;
1185
1189
  let inheritanceBaseline;
1186
1190
  let trustedCandidateChain = false;
1191
+ let activeSecretsPinned = false;
1187
1192
  if (options.expectedPreviousVersionId !== void 0 || options.verifyInheritedSecrets === true) {
1188
1193
  const recent = await readRecentCloudflareVersionIds(options, commonArgs);
1189
1194
  if (recent === null) return {
@@ -1217,6 +1222,7 @@ async function activateCloudflareVersionWithSecretsFile(options) {
1217
1222
  activeVersionId: latestVersionId,
1218
1223
  rollback: "not-needed"
1219
1224
  };
1225
+ activeSecretsPinned = true;
1220
1226
  }
1221
1227
  }
1222
1228
  inheritanceBaseline = recent;
@@ -1258,10 +1264,16 @@ async function activateCloudflareVersionWithSecretsFile(options) {
1258
1264
  } : versionedPreviousTriggerConfig;
1259
1265
  const previousTriggerConfig = triggerConfigWithQueueConsumerCleanup(versionedPreviousTriggerConfigWithTraffic, options.queueConsumerCleanup);
1260
1266
  const alias = `void-ready-${Date.now().toString(36)}`;
1261
- if (options.atomic && previous.versionId !== null) return bootstrapFirstDeployment({
1262
- ...options,
1263
- message
1264
- }, commonArgs, previous.versionId, true);
1267
+ if (options.atomic && previous.versionId !== null) {
1268
+ if (!activeSecretsPinned && options.pinActiveSecrets) {
1269
+ const activeSecrets = await readCloudflareVersionSecretBindings(options, commonArgs, previous.versionId);
1270
+ if (activeSecrets?.length) await options.pinActiveSecrets(previous.versionId, activeSecrets);
1271
+ }
1272
+ return bootstrapFirstDeployment({
1273
+ ...options,
1274
+ message
1275
+ }, commonArgs, previous.versionId, true);
1276
+ }
1265
1277
  options.onProgress?.("Uploading the Worker and assets...");
1266
1278
  const upload = await Promise.resolve(options.runWrangler([
1267
1279
  "versions",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@void/deploy-cloudflare",
3
- "version": "0.21.8",
3
+ "version": "0.21.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/voidzero-dev/void.git",
@@ -20,7 +20,7 @@
20
20
  "access": "public"
21
21
  },
22
22
  "dependencies": {
23
- "@void/deploy-core": "0.21.8",
23
+ "@void/deploy-core": "0.21.9",
24
24
  "jsonc-parser": "3.3.1"
25
25
  },
26
26
  "devDependencies": {