@void/deploy-cloudflare 0.21.7 → 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
@@ -750,6 +750,10 @@ function cloudflareCommandDiagnostic(result) {
750
750
  break;
751
751
  }
752
752
  }
753
+ if (message === stderr && !/(?:^|\n)[ \t]*(?:[✘×X][ \t]+)?\[ERROR\]/i.test(stderr)) {
754
+ const box = /(?:^|\n)[ \t]*┌[ \t]*(?:APIError|Error)\b[^\n]*\n(?:[ \t]*│[^\n]*\n)*[ \t]*└[^\n]*/i.exec(stdout);
755
+ if (box) message = box[0].trim();
756
+ }
753
757
  message = stripVTControlCharacters(message).split(/\n\s*(?:🪵|Logs (?:were )?written|If you think this is a bug)/)[0].trim();
754
758
  if (!message) return;
755
759
  message = message.replace(/\b(Bearer|Basic)\s+\S+/gi, "$1 [redacted]").replace(/([?&](?:X-Amz-[A-Za-z0-9-]+|signature|sig|token|access_token|key)=)[^&\s]+/gi, "$1[redacted]").replace(/\b([a-z][a-z0-9+.-]*:\/\/)[^\s/@]+:[^\s/@]*@/gi, "$1[redacted]@").replace(/(\b(?:CLOUDFLARE_API_TOKEN|CF_ACCESS_CLIENT_SECRET|access_token|refresh_token|api[_-]?(?:key|token)|password|secret)\b["']?\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\s,;]+)/gi, "$1[redacted]");
@@ -764,15 +768,17 @@ const WORKERS_DEV_URL_RE = /(https:\/\/[a-z0-9.-]+\.workers\.dev(?:\/[^\s]*)?)/i
764
768
  const CLOUDFLARE_ERROR_CODE_RE = /\[code:\s*(\d+)\]/i;
765
769
  const DURABLE_MIGRATION_VERSION_ERROR = 10211;
766
770
  /** Encode migration state into Cloudflare's version annotation for safe rollback diagnostics. */
767
- function encodeCloudflareVersionMessage(migrations, triggerConfig) {
768
- return `void:${JSON.stringify(triggerConfig ? {
771
+ function encodeCloudflareVersionMessage(migrations, triggerConfig, contentHash) {
772
+ const metadata = triggerConfig ? {
769
773
  schema: 2,
770
774
  migrations,
771
- triggerConfig
775
+ triggerConfig,
776
+ ...contentHash ? { contentHash } : {}
772
777
  } : {
773
778
  schema: 1,
774
779
  migrations
775
- })}`;
780
+ };
781
+ return `void:${JSON.stringify(metadata)}`;
776
782
  }
777
783
  /** Read migration state written by {@link encodeCloudflareVersionMessage}. */
778
784
  function parseCloudflareVersionMessage(message) {
@@ -785,11 +791,13 @@ function parseCloudflareVersionMessage(message) {
785
791
  migrations: value.migrations
786
792
  };
787
793
  const triggerConfig = parseTriggerConfig(value.triggerConfig);
788
- return triggerConfig ? {
794
+ if (!triggerConfig) return null;
795
+ return {
789
796
  schema: 2,
790
797
  migrations: value.migrations,
791
- triggerConfig
792
- } : null;
798
+ triggerConfig,
799
+ ...typeof value.contentHash === "string" && /^[a-f0-9]{64}$/.test(value.contentHash) ? { contentHash: value.contentHash } : {}
800
+ };
793
801
  } catch {
794
802
  return null;
795
803
  }
@@ -1180,6 +1188,7 @@ async function activateCloudflareVersionWithSecretsFile(options) {
1180
1188
  const previousVersionId = previous.versionId;
1181
1189
  let inheritanceBaseline;
1182
1190
  let trustedCandidateChain = false;
1191
+ let activeSecretsPinned = false;
1183
1192
  if (options.expectedPreviousVersionId !== void 0 || options.verifyInheritedSecrets === true) {
1184
1193
  const recent = await readRecentCloudflareVersionIds(options, commonArgs);
1185
1194
  if (recent === null) return {
@@ -1213,6 +1222,7 @@ async function activateCloudflareVersionWithSecretsFile(options) {
1213
1222
  activeVersionId: latestVersionId,
1214
1223
  rollback: "not-needed"
1215
1224
  };
1225
+ activeSecretsPinned = true;
1216
1226
  }
1217
1227
  }
1218
1228
  inheritanceBaseline = recent;
@@ -1254,10 +1264,16 @@ async function activateCloudflareVersionWithSecretsFile(options) {
1254
1264
  } : versionedPreviousTriggerConfig;
1255
1265
  const previousTriggerConfig = triggerConfigWithQueueConsumerCleanup(versionedPreviousTriggerConfigWithTraffic, options.queueConsumerCleanup);
1256
1266
  const alias = `void-ready-${Date.now().toString(36)}`;
1257
- if (options.atomic && previous.versionId !== null) return bootstrapFirstDeployment({
1258
- ...options,
1259
- message
1260
- }, 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
+ }
1261
1277
  options.onProgress?.("Uploading the Worker and assets...");
1262
1278
  const upload = await Promise.resolve(options.runWrangler([
1263
1279
  "versions",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@void/deploy-cloudflare",
3
- "version": "0.21.7",
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.7",
23
+ "@void/deploy-core": "0.21.9",
24
24
  "jsonc-parser": "3.3.1"
25
25
  },
26
26
  "devDependencies": {