@void/deploy-cloudflare 0.21.8 → 0.22.0
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 +3 -1
- package/dist/index.mjs +27 -14
- package/package.json +4 -4
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
|
-
|
|
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
|
-
|
|
794
|
+
if (!triggerConfig) return null;
|
|
795
|
+
return {
|
|
793
796
|
schema: 2,
|
|
794
797
|
migrations: value.migrations,
|
|
795
|
-
triggerConfig
|
|
796
|
-
|
|
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
|
}
|
|
@@ -1182,8 +1186,10 @@ async function activateCloudflareVersionWithSecretsFile(options) {
|
|
|
1182
1186
|
reason: "uploader-changed"
|
|
1183
1187
|
};
|
|
1184
1188
|
const previousVersionId = previous.versionId;
|
|
1189
|
+
const trustedInheritanceVersionIds = previousVersionId && options.trustedInheritanceVersionIds?.at(-1) === previousVersionId ? [] : options.trustedInheritanceVersionIds;
|
|
1185
1190
|
let inheritanceBaseline;
|
|
1186
1191
|
let trustedCandidateChain = false;
|
|
1192
|
+
let activeSecretsPinned = false;
|
|
1187
1193
|
if (options.expectedPreviousVersionId !== void 0 || options.verifyInheritedSecrets === true) {
|
|
1188
1194
|
const recent = await readRecentCloudflareVersionIds(options, commonArgs);
|
|
1189
1195
|
if (recent === null) return {
|
|
@@ -1191,12 +1197,12 @@ async function activateCloudflareVersionWithSecretsFile(options) {
|
|
|
1191
1197
|
reason: "inheritance-source-unavailable"
|
|
1192
1198
|
};
|
|
1193
1199
|
const latestVersionId = recent.at(-1)?.id ?? null;
|
|
1194
|
-
if (options.expectedPreviousVersionId !== void 0 ||
|
|
1200
|
+
if (options.expectedPreviousVersionId !== void 0 || trustedInheritanceVersionIds !== void 0) {
|
|
1195
1201
|
const activeIndex = recent.findIndex((version) => version.id === previous.versionId);
|
|
1196
1202
|
const inheritedChain = activeIndex < 0 ? [] : recent.slice(activeIndex);
|
|
1197
1203
|
const inheritedCandidates = inheritedChain.slice(1).map((version) => version.id);
|
|
1198
|
-
trustedCandidateChain =
|
|
1199
|
-
if (!(inheritedChain.length > 0 && inheritedChain.every((version, index) => index === 0 || version.number === inheritedChain[index - 1].number + 1) && (arraysEqual(inheritedCandidates,
|
|
1204
|
+
trustedCandidateChain = trustedInheritanceVersionIds !== void 0 && trustedInheritanceVersionIds.length > 0 && arraysEqual(inheritedCandidates, trustedInheritanceVersionIds);
|
|
1205
|
+
if (!(inheritedChain.length > 0 && inheritedChain.every((version, index) => index === 0 || version.number === inheritedChain[index - 1].number + 1) && (arraysEqual(inheritedCandidates, trustedInheritanceVersionIds ?? []) || options.pinActiveSecrets !== void 0))) return {
|
|
1200
1206
|
ok: false,
|
|
1201
1207
|
reason: "inheritance-source-changed",
|
|
1202
1208
|
activeVersionId: recent.at(-1)?.id ?? null,
|
|
@@ -1217,6 +1223,7 @@ async function activateCloudflareVersionWithSecretsFile(options) {
|
|
|
1217
1223
|
activeVersionId: latestVersionId,
|
|
1218
1224
|
rollback: "not-needed"
|
|
1219
1225
|
};
|
|
1226
|
+
activeSecretsPinned = true;
|
|
1220
1227
|
}
|
|
1221
1228
|
}
|
|
1222
1229
|
inheritanceBaseline = recent;
|
|
@@ -1258,10 +1265,16 @@ async function activateCloudflareVersionWithSecretsFile(options) {
|
|
|
1258
1265
|
} : versionedPreviousTriggerConfig;
|
|
1259
1266
|
const previousTriggerConfig = triggerConfigWithQueueConsumerCleanup(versionedPreviousTriggerConfigWithTraffic, options.queueConsumerCleanup);
|
|
1260
1267
|
const alias = `void-ready-${Date.now().toString(36)}`;
|
|
1261
|
-
if (options.atomic && previous.versionId !== null)
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1268
|
+
if (options.atomic && previous.versionId !== null) {
|
|
1269
|
+
if (!activeSecretsPinned && options.pinActiveSecrets) {
|
|
1270
|
+
const activeSecrets = await readCloudflareVersionSecretBindings(options, commonArgs, previous.versionId);
|
|
1271
|
+
if (activeSecrets?.length) await options.pinActiveSecrets(previous.versionId, activeSecrets);
|
|
1272
|
+
}
|
|
1273
|
+
return bootstrapFirstDeployment({
|
|
1274
|
+
...options,
|
|
1275
|
+
message
|
|
1276
|
+
}, commonArgs, previous.versionId, true);
|
|
1277
|
+
}
|
|
1265
1278
|
options.onProgress?.("Uploading the Worker and assets...");
|
|
1266
1279
|
const upload = await Promise.resolve(options.runWrangler([
|
|
1267
1280
|
"versions",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@void/deploy-cloudflare",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/voidzero-dev/void.git",
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@void/deploy-core": "0.
|
|
23
|
+
"@void/deploy-core": "0.22.0",
|
|
24
24
|
"jsonc-parser": "3.3.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@cloudflare/workers-types": "^4.20260702.1",
|
|
28
|
-
"@types/node": "^26.
|
|
28
|
+
"@types/node": "^26.6.3",
|
|
29
29
|
"pathslash": "^0.1.0",
|
|
30
30
|
"typescript": "7.0.2",
|
|
31
|
-
"vite-plus": "0.
|
|
31
|
+
"vite-plus": "1.0.0"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "vp pack",
|