@void/deploy-cloudflare 0.21.3 → 0.21.4

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
@@ -310,6 +310,11 @@ type CloudflareVersionActivationOptions = {
310
310
  readinessAttempts?: number;
311
311
  /** Verify that omitted remote secrets come from the active Worker Version before uploading. */
312
312
  verifyInheritedSecrets?: boolean;
313
+ /** Pin opaque secret bindings to the live version when an unpublished upload is newer. */
314
+ pinActiveSecrets?: (activeVersionId: string, bindings: ReadonlyArray<{
315
+ name: string;
316
+ type: "secret_text" | "secret_key";
317
+ }>) => Promise<boolean> | boolean;
313
318
  /** Explicitly publish an existing Durable Object Worker in one atomic operation. */
314
319
  atomic?: boolean;
315
320
  /**
package/dist/index.mjs CHANGED
@@ -1175,6 +1175,7 @@ async function activateCloudflareVersionWithSecretsFile(options) {
1175
1175
  };
1176
1176
  const previousVersionId = previous.versionId;
1177
1177
  let inheritanceBaseline;
1178
+ let trustedCandidateChain = false;
1178
1179
  if (options.expectedPreviousVersionId !== void 0 || options.verifyInheritedSecrets === true) {
1179
1180
  const recent = await readRecentCloudflareVersionIds(options, commonArgs);
1180
1181
  if (recent === null) return {
@@ -1186,26 +1187,29 @@ async function activateCloudflareVersionWithSecretsFile(options) {
1186
1187
  const activeIndex = recent.findIndex((version) => version.id === previous.versionId);
1187
1188
  const inheritedChain = activeIndex < 0 ? [] : recent.slice(activeIndex);
1188
1189
  const inheritedCandidates = inheritedChain.slice(1).map((version) => version.id);
1189
- if (!(inheritedChain.length > 0 && inheritedChain.every((version, index) => index === 0 || version.number === inheritedChain[index - 1].number + 1) && arraysEqual(inheritedCandidates, options.trustedInheritanceVersionIds ?? []))) return {
1190
+ trustedCandidateChain = options.trustedInheritanceVersionIds !== void 0 && options.trustedInheritanceVersionIds.length > 0 && arraysEqual(inheritedCandidates, options.trustedInheritanceVersionIds);
1191
+ if (!(inheritedChain.length > 0 && inheritedChain.every((version, index) => index === 0 || version.number === inheritedChain[index - 1].number + 1) && (arraysEqual(inheritedCandidates, options.trustedInheritanceVersionIds ?? []) || options.pinActiveSecrets !== void 0))) return {
1190
1192
  ok: false,
1191
1193
  reason: "inheritance-source-changed",
1192
1194
  activeVersionId: recent.at(-1)?.id ?? null,
1193
1195
  rollback: "not-needed"
1194
1196
  };
1195
1197
  }
1196
- const trustedCandidateChain = options.trustedInheritanceVersionIds !== void 0 && options.trustedInheritanceVersionIds.length > 0 && previous.versionId !== latestVersionId;
1197
1198
  if (options.verifyInheritedSecrets === true && previous.versionId !== latestVersionId && !trustedCandidateChain) {
1198
1199
  const replacesAllRemoteSecrets = await candidateReplacesAllRemoteSecrets(options, commonArgs, previous.versionId, latestVersionId);
1199
1200
  if (replacesAllRemoteSecrets === null) return {
1200
1201
  ok: false,
1201
1202
  reason: "inheritance-source-unavailable"
1202
1203
  };
1203
- if (!replacesAllRemoteSecrets) return {
1204
- ok: false,
1205
- reason: "inheritance-source-changed",
1206
- activeVersionId: latestVersionId,
1207
- rollback: "not-needed"
1208
- };
1204
+ if (!replacesAllRemoteSecrets) {
1205
+ const activeSecrets = previous.versionId ? await readCloudflareVersionSecretBindings(options, commonArgs, previous.versionId) : null;
1206
+ if (!activeSecrets || !options.pinActiveSecrets || !await options.pinActiveSecrets(previous.versionId, activeSecrets)) return {
1207
+ ok: false,
1208
+ reason: "inheritance-source-changed",
1209
+ activeVersionId: latestVersionId,
1210
+ rollback: "not-needed"
1211
+ };
1212
+ }
1209
1213
  }
1210
1214
  inheritanceBaseline = recent;
1211
1215
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@void/deploy-cloudflare",
3
- "version": "0.21.3",
3
+ "version": "0.21.4",
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.3",
23
+ "@void/deploy-core": "0.21.4",
24
24
  "jsonc-parser": "3.3.1"
25
25
  },
26
26
  "devDependencies": {