@void/deploy-cloudflare 0.23.0 → 0.24.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 +5 -1
- package/dist/index.mjs +222 -17
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -66,6 +66,7 @@ type CloudflareOperation = ({
|
|
|
66
66
|
} & WorkerTarget) | ({
|
|
67
67
|
type: "versions.view";
|
|
68
68
|
versionId: string;
|
|
69
|
+
includeSource?: boolean;
|
|
69
70
|
} & WorkerTarget) | ({
|
|
70
71
|
type: "versions.deploy";
|
|
71
72
|
versions: Array<{
|
|
@@ -429,7 +430,7 @@ type CloudflareVersionActivationOptions = {
|
|
|
429
430
|
requirePreviewForReadiness?: boolean;
|
|
430
431
|
/** Verify that omitted remote secrets come from the active Worker Version before uploading. */
|
|
431
432
|
verifyInheritedSecrets?: boolean;
|
|
432
|
-
/** Pin opaque secret bindings to the live version
|
|
433
|
+
/** Pin inherited opaque secret bindings to the inspected live version before uploading. */
|
|
433
434
|
pinActiveSecrets?: (activeVersionId: string, bindings: ReadonlyArray<{
|
|
434
435
|
name: string;
|
|
435
436
|
type: "secret_text" | "secret_key";
|
|
@@ -477,4 +478,7 @@ export declare function createCloudflareMetadataRunner(options: {
|
|
|
477
478
|
env?: Readonly<Record<string, string | undefined>>;
|
|
478
479
|
}): CloudflareCommandRunner;
|
|
479
480
|
//#endregion
|
|
481
|
+
//#region src/secret-draft.d.ts
|
|
482
|
+
export declare const VOID_SECRET_DRAFT_SOURCE = "export default { fetch() { return new Response(\"\"); } };\n";
|
|
483
|
+
//#endregion
|
|
480
484
|
export type { ApprovedCloudflareKvBinding, CloudflareCommandResult, CloudflareCommandRunner, CloudflareDeployExecution, CloudflareFrameworkDeployConfig, CloudflareOperation, CloudflareProviderError, CloudflareStaticDeployConfig, CloudflareTrafficConfig, CloudflareTriggerConfig, CloudflareTriggerStabilization, CloudflareUploadResult, CloudflareVersionActivation, CloudflareVersionActivationOptions, CloudflareVersionMetadata, CloudflareWorkerMigrationTagOptions, ExistingCloudflareWorker };
|
package/dist/index.mjs
CHANGED
|
@@ -99,6 +99,43 @@ function isWranglerSecretOnlyDraft(entry) {
|
|
|
99
99
|
const runtimeKeys = Object.keys(scriptRuntime);
|
|
100
100
|
return scriptRuntime.usage_model === "standard" && (scriptRuntime.limits === void 0 || isRecord$1(scriptRuntime.limits) && Object.keys(scriptRuntime.limits).length === 0) && runtimeKeys.every((key) => key === "usage_model" || key === "limits");
|
|
101
101
|
}
|
|
102
|
+
const VOID_SECRET_DRAFT_SOURCE = "export default { fetch() { return new Response(\"\"); } };\n";
|
|
103
|
+
/** Prove a cf-created placeholder from the exact immutable version's source. */
|
|
104
|
+
function isVoidSecretOnlyDraft(entry) {
|
|
105
|
+
const metadataFields = /* @__PURE__ */ new Set([
|
|
106
|
+
"id",
|
|
107
|
+
"number",
|
|
108
|
+
"startup_time_ms",
|
|
109
|
+
"created_on",
|
|
110
|
+
"source",
|
|
111
|
+
"author_id",
|
|
112
|
+
"author_email",
|
|
113
|
+
"urls",
|
|
114
|
+
"annotations",
|
|
115
|
+
"compatibility_date",
|
|
116
|
+
"usage_model",
|
|
117
|
+
"main_module",
|
|
118
|
+
"modules",
|
|
119
|
+
"bindings",
|
|
120
|
+
"env",
|
|
121
|
+
"resources"
|
|
122
|
+
]);
|
|
123
|
+
if (Object.keys(entry).some((key) => !metadataFields.has(key)) || entry.source !== "cf_cli" || !isRecord$1(entry.annotations) || Object.keys(entry.annotations).length !== 1 || entry.annotations["workers/triggered_by"] !== "secret" || entry.main_module !== "index.js" || !Array.isArray(entry.urls) || entry.urls.length !== 0 || !Array.isArray(entry.modules) || entry.modules.length !== 1 || !Array.isArray(entry.bindings) || entry.bindings.length === 0) return false;
|
|
124
|
+
const module = entry.modules[0];
|
|
125
|
+
if (!isRecord$1(module) || Object.keys(module).length !== 3 || module.name !== "index.js" || module.content_type !== "application/javascript+module" || module.content_base64 !== Buffer.from("export default { fetch() { return new Response(\"\"); } };\n").toString("base64")) return false;
|
|
126
|
+
const names = /* @__PURE__ */ new Set();
|
|
127
|
+
for (const binding of entry.bindings) {
|
|
128
|
+
if (!isRecord$1(binding) || Object.keys(binding).length !== 2 || typeof binding.name !== "string" || binding.name.length === 0 || names.has(binding.name) || binding.type !== "secret_text") return false;
|
|
129
|
+
names.add(binding.name);
|
|
130
|
+
}
|
|
131
|
+
if (entry.env !== void 0 && (!isRecord$1(entry.env) || Object.keys(entry.env).length !== names.size || Object.entries(entry.env).some(([name, binding]) => !names.has(name) || !isRecord$1(binding) || Object.keys(binding).length !== 1 || binding.type !== "secret_text"))) return false;
|
|
132
|
+
if (entry.resources !== void 0) {
|
|
133
|
+
if (!isRecord$1(entry.resources) || Object.keys(entry.resources).length !== 1) return false;
|
|
134
|
+
const bindings = entry.resources.bindings;
|
|
135
|
+
if (!Array.isArray(bindings) || !isDeepStrictEqual(bindings, entry.bindings)) return false;
|
|
136
|
+
}
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
102
139
|
function isRecord$1(value) {
|
|
103
140
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
104
141
|
}
|
|
@@ -114,7 +151,7 @@ async function readExistingCloudflareWorker(options) {
|
|
|
114
151
|
if (!worker) throw new Error(`Cloudflare Worker "${options.workerName}" does not have an active version.`);
|
|
115
152
|
return worker.snapshot;
|
|
116
153
|
}
|
|
117
|
-
async function readCloudflareWorker(options, allowMissing) {
|
|
154
|
+
async function readCloudflareWorker(options, allowMissing, proveSecretDraft = false) {
|
|
118
155
|
const target = {
|
|
119
156
|
configPath: options.configPath,
|
|
120
157
|
workerName: options.workerName
|
|
@@ -151,6 +188,16 @@ async function readCloudflareWorker(options, allowMissing) {
|
|
|
151
188
|
if (version === null) throw new Error("Cloudflare did not return the existing Worker configuration.");
|
|
152
189
|
const resources = version.resources;
|
|
153
190
|
if (version.id !== versionId || !record$1(resources) || !Array.isArray(resources.bindings) || !resources.bindings.every(record$1) || !record$1(resources.script_runtime) || !record$1(resources.script)) throw new Error("Cloudflare did not return the existing Worker configuration.");
|
|
191
|
+
let isSecretOnlyDraft = isWranglerSecretOnlyDraft(version);
|
|
192
|
+
if (proveSecretDraft && !isSecretOnlyDraft && record$1(version.annotations) && Object.keys(version.annotations).length === 1 && version.annotations["workers/triggered_by"] === "secret") {
|
|
193
|
+
const source = await read({
|
|
194
|
+
type: "versions.view",
|
|
195
|
+
versionId,
|
|
196
|
+
includeSource: true,
|
|
197
|
+
...target
|
|
198
|
+
});
|
|
199
|
+
if (source?.id === versionId) isSecretOnlyDraft = isVoidSecretOnlyDraft(source);
|
|
200
|
+
}
|
|
154
201
|
const after = options.versionId ? deployment : await read({
|
|
155
202
|
type: "deployments.status",
|
|
156
203
|
...target
|
|
@@ -163,7 +210,7 @@ async function readCloudflareWorker(options, allowMissing) {
|
|
|
163
210
|
runtime: resources.script_runtime,
|
|
164
211
|
script: resources.script
|
|
165
212
|
},
|
|
166
|
-
isSecretOnlyDraft
|
|
213
|
+
isSecretOnlyDraft
|
|
167
214
|
};
|
|
168
215
|
}
|
|
169
216
|
/** Parse legacy version-detail shapes; this is not authoritative Worker migration state. */
|
|
@@ -231,7 +278,7 @@ async function readCloudflareApiAuthentication(runWrangler) {
|
|
|
231
278
|
async function assertCloudflareDurableObjectLifecycleSupported(options) {
|
|
232
279
|
const migrations = parseDurableObjectMigrations(parseRootWranglerConfig(options.configPath).migrations);
|
|
233
280
|
if (!migrations.some((migration) => migration.changesClasses)) return;
|
|
234
|
-
const existing = await readCloudflareWorker(options, true);
|
|
281
|
+
const existing = await readCloudflareWorker(options, true, true);
|
|
235
282
|
if (!existing) return;
|
|
236
283
|
const readMigrationTag = options.readMigrationTag ?? readCloudflareWorkerMigrationTag;
|
|
237
284
|
const migrationOptions = {
|
|
@@ -241,7 +288,7 @@ async function assertCloudflareDurableObjectLifecycleSupported(options) {
|
|
|
241
288
|
workerName: options.workerName
|
|
242
289
|
};
|
|
243
290
|
const activeTag = await readMigrationTag(migrationOptions);
|
|
244
|
-
const after = await readCloudflareWorker(options, false);
|
|
291
|
+
const after = await readCloudflareWorker(options, false, true);
|
|
245
292
|
const afterTag = await readMigrationTag(migrationOptions);
|
|
246
293
|
if (!after || after.snapshot.versionId !== existing.snapshot.versionId || afterTag !== activeTag) throw new Error("Cloudflare production or Durable Object migration state changed during verification. Retry from the current deployment.");
|
|
247
294
|
if (activeTag === null && existing.isSecretOnlyDraft && after.isSecretOnlyDraft) return;
|
|
@@ -1188,6 +1235,7 @@ async function activateCloudflareVersionWithSecretsFile(options) {
|
|
|
1188
1235
|
let inheritanceBaseline;
|
|
1189
1236
|
let trustedCandidateChain = false;
|
|
1190
1237
|
let activeSecretsPinned = false;
|
|
1238
|
+
let pinnedActiveSecrets;
|
|
1191
1239
|
if (options.expectedPreviousVersionId !== void 0 || options.verifyInheritedSecrets === true) {
|
|
1192
1240
|
const recent = await readRecentCloudflareVersionIds(options, configPath);
|
|
1193
1241
|
if (recent === null) return {
|
|
@@ -1222,6 +1270,7 @@ async function activateCloudflareVersionWithSecretsFile(options) {
|
|
|
1222
1270
|
rollback: "not-needed"
|
|
1223
1271
|
};
|
|
1224
1272
|
activeSecretsPinned = true;
|
|
1273
|
+
pinnedActiveSecrets = activeSecrets;
|
|
1225
1274
|
}
|
|
1226
1275
|
}
|
|
1227
1276
|
inheritanceBaseline = recent;
|
|
@@ -1263,15 +1312,106 @@ async function activateCloudflareVersionWithSecretsFile(options) {
|
|
|
1263
1312
|
} : versionedPreviousTriggerConfig;
|
|
1264
1313
|
const previousTriggerConfig = triggerConfigWithQueueConsumerCleanup(versionedPreviousTriggerConfigWithTraffic, options.queueConsumerCleanup);
|
|
1265
1314
|
const alias = `void-ready-${Date.now().toString(36)}`;
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1315
|
+
const bootstrapVoidDraft = !options.preserveTriggers && !options.requirePreviewForReadiness && previousVersion?.isVoidSecretOnlyDraft === true;
|
|
1316
|
+
if (previous.versionId !== null && (options.atomic || bootstrapVoidDraft)) {
|
|
1317
|
+
if (bootstrapVoidDraft && !activeSecretsPinned && !options.pinActiveSecrets) return {
|
|
1318
|
+
ok: false,
|
|
1319
|
+
reason: "inheritance-source-unavailable"
|
|
1320
|
+
};
|
|
1321
|
+
if (bootstrapVoidDraft || !activeSecretsPinned && options.pinActiveSecrets) {
|
|
1322
|
+
let activeSecrets;
|
|
1323
|
+
try {
|
|
1324
|
+
activeSecrets = await readCloudflareVersionSecretBindings(options, configPath, previous.versionId);
|
|
1325
|
+
} catch {
|
|
1326
|
+
return {
|
|
1327
|
+
ok: false,
|
|
1328
|
+
reason: "inheritance-source-unavailable"
|
|
1329
|
+
};
|
|
1330
|
+
}
|
|
1331
|
+
if (activeSecrets === null) return {
|
|
1332
|
+
ok: false,
|
|
1333
|
+
reason: "inheritance-source-unavailable"
|
|
1334
|
+
};
|
|
1335
|
+
if (bootstrapVoidDraft && (activeSecrets.length === 0 || activeSecrets.some((secret) => secret.type !== "secret_text") || !arraysEqual(activeSecrets.map((secret) => secret.name).sort(), [...previousVersion.voidDraftSecretNames].sort()) || activeSecretsPinned && !isDeepStrictEqual([...activeSecrets].sort((a, b) => a.name.localeCompare(b.name)), [...pinnedActiveSecrets].sort((a, b) => a.name.localeCompare(b.name))))) return {
|
|
1336
|
+
ok: false,
|
|
1337
|
+
reason: "inheritance-source-changed"
|
|
1338
|
+
};
|
|
1339
|
+
if (!activeSecretsPinned && activeSecrets.length) {
|
|
1340
|
+
let pinned;
|
|
1341
|
+
try {
|
|
1342
|
+
pinned = await options.pinActiveSecrets(previous.versionId, activeSecrets);
|
|
1343
|
+
} catch {
|
|
1344
|
+
return {
|
|
1345
|
+
ok: false,
|
|
1346
|
+
reason: "inheritance-source-unavailable"
|
|
1347
|
+
};
|
|
1348
|
+
}
|
|
1349
|
+
if (!pinned) return {
|
|
1350
|
+
ok: false,
|
|
1351
|
+
reason: "inheritance-source-changed"
|
|
1352
|
+
};
|
|
1353
|
+
}
|
|
1270
1354
|
}
|
|
1271
1355
|
return bootstrapFirstDeployment({
|
|
1272
1356
|
...options,
|
|
1273
1357
|
message
|
|
1274
|
-
}, configPath, previous.versionId, true, previousTriggerConfig);
|
|
1358
|
+
}, configPath, previous.versionId, options.atomic === true, previousTriggerConfig);
|
|
1359
|
+
}
|
|
1360
|
+
if (previous.versionId !== null && !activeSecretsPinned && options.pinActiveSecrets && options.candidateSecretsFilePath === void 0) {
|
|
1361
|
+
let activeSecrets;
|
|
1362
|
+
try {
|
|
1363
|
+
activeSecrets = await readCloudflareVersionSecretBindings(options, configPath, previous.versionId);
|
|
1364
|
+
} catch {
|
|
1365
|
+
return {
|
|
1366
|
+
ok: false,
|
|
1367
|
+
reason: "inheritance-source-unavailable"
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1370
|
+
if (activeSecrets === null) return {
|
|
1371
|
+
ok: false,
|
|
1372
|
+
reason: "inheritance-source-unavailable"
|
|
1373
|
+
};
|
|
1374
|
+
if (activeSecrets.some((secret) => !secret.name.trim() || secret.name.trim() !== secret.name) || new Set(activeSecrets.map((secret) => secret.name)).size !== activeSecrets.length) return {
|
|
1375
|
+
ok: false,
|
|
1376
|
+
reason: "inheritance-source-changed"
|
|
1377
|
+
};
|
|
1378
|
+
if (activeSecrets.length) {
|
|
1379
|
+
let pinned;
|
|
1380
|
+
try {
|
|
1381
|
+
pinned = await options.pinActiveSecrets(previous.versionId, activeSecrets);
|
|
1382
|
+
} catch {
|
|
1383
|
+
return {
|
|
1384
|
+
ok: false,
|
|
1385
|
+
reason: "inheritance-source-unavailable"
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
|
+
if (!pinned) return {
|
|
1389
|
+
ok: false,
|
|
1390
|
+
reason: "inheritance-source-changed"
|
|
1391
|
+
};
|
|
1392
|
+
activeSecretsPinned = true;
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
if (activeSecretsPinned) {
|
|
1396
|
+
if (!options.verifyUploader()) return {
|
|
1397
|
+
ok: false,
|
|
1398
|
+
reason: "uploader-changed"
|
|
1399
|
+
};
|
|
1400
|
+
const owner = await readCurrentProductionVersion(options, configPath);
|
|
1401
|
+
if (owner.kind === "failed") return {
|
|
1402
|
+
ok: false,
|
|
1403
|
+
reason: "status-failed",
|
|
1404
|
+
status: owner.status
|
|
1405
|
+
};
|
|
1406
|
+
if (owner.kind !== "ok" || owner.versionId !== previous.versionId || !productionVersionPercentagesEqual(owner.versions, [{
|
|
1407
|
+
versionId: previous.versionId,
|
|
1408
|
+
percentage: 100
|
|
1409
|
+
}])) return {
|
|
1410
|
+
ok: false,
|
|
1411
|
+
reason: "deployment-changed",
|
|
1412
|
+
activeVersionId: owner.kind === "ok" ? owner.versionId : null,
|
|
1413
|
+
rollback: "not-needed"
|
|
1414
|
+
};
|
|
1275
1415
|
}
|
|
1276
1416
|
options.onProgress?.("Uploading the Worker and assets...");
|
|
1277
1417
|
const upload = await Promise.resolve(options.runWrangler({
|
|
@@ -1647,21 +1787,25 @@ async function readCloudflareVersionInspection(options, configPath, versionId, k
|
|
|
1647
1787
|
const annotations = isRecord(entry.annotations) ? entry.annotations : void 0;
|
|
1648
1788
|
const message = annotations?.["workers/message"];
|
|
1649
1789
|
let draft = entry;
|
|
1650
|
-
if (annotations?.["workers/triggered_by"] === "secret" && Object.keys(annotations).length === 1 && !
|
|
1790
|
+
if (annotations?.["workers/triggered_by"] === "secret" && Object.keys(annotations).length === 1 && !isWranglerSecretOnlyDraft(entry)) {
|
|
1651
1791
|
const inspection = await Promise.resolve(options.runWrangler({
|
|
1652
1792
|
type: "versions.view",
|
|
1653
1793
|
versionId,
|
|
1654
1794
|
configPath,
|
|
1655
|
-
workerName: options.workerName
|
|
1795
|
+
workerName: options.workerName,
|
|
1796
|
+
includeSource: true
|
|
1656
1797
|
}, { capture: true }));
|
|
1657
1798
|
if (isCleanCommandExit(inspection)) {
|
|
1658
1799
|
const inspected = inspection.data;
|
|
1659
1800
|
if (isRecord(inspected) && inspected.id === versionId) draft = inspected;
|
|
1660
1801
|
}
|
|
1661
1802
|
}
|
|
1803
|
+
const isVoidDraft = isVoidSecretOnlyDraft(draft);
|
|
1662
1804
|
return {
|
|
1663
1805
|
metadata: typeof message === "string" ? parseCloudflareVersionMessage(message) : null,
|
|
1664
|
-
isSecretOnlyDraft: isWranglerSecretOnlyDraft(draft)
|
|
1806
|
+
isSecretOnlyDraft: isWranglerSecretOnlyDraft(draft) || isVoidSecretOnlyDraft(draft),
|
|
1807
|
+
isVoidSecretOnlyDraft: isVoidDraft,
|
|
1808
|
+
voidDraftSecretNames: isVoidDraft ? draft.bindings.map((binding) => binding.name) : null
|
|
1665
1809
|
};
|
|
1666
1810
|
}
|
|
1667
1811
|
} catch {
|
|
@@ -1742,14 +1886,17 @@ async function bootstrapFirstDeployment(options, configPath, previousVersionId,
|
|
|
1742
1886
|
ok: false,
|
|
1743
1887
|
reason: "uploader-changed"
|
|
1744
1888
|
};
|
|
1745
|
-
|
|
1889
|
+
{
|
|
1746
1890
|
const current = await readCurrentProductionVersion(options, configPath);
|
|
1747
1891
|
if (current.kind === "failed") return {
|
|
1748
1892
|
ok: false,
|
|
1749
1893
|
reason: "status-failed",
|
|
1750
1894
|
status: current.status
|
|
1751
1895
|
};
|
|
1752
|
-
if (current.kind !== "ok" || current.versionId !== previousVersionId
|
|
1896
|
+
if (current.kind !== "ok" || current.versionId !== previousVersionId || !productionVersionPercentagesEqual(current.versions, previousVersionId ? [{
|
|
1897
|
+
versionId: previousVersionId,
|
|
1898
|
+
percentage: 100
|
|
1899
|
+
}] : [])) return {
|
|
1753
1900
|
ok: false,
|
|
1754
1901
|
reason: "deployment-changed",
|
|
1755
1902
|
activeVersionId: current.kind === "ok" ? current.versionId : null,
|
|
@@ -1794,7 +1941,6 @@ async function bootstrapFirstDeployment(options, configPath, previousVersionId,
|
|
|
1794
1941
|
previousVersionId,
|
|
1795
1942
|
rollback: "unsafe"
|
|
1796
1943
|
};
|
|
1797
|
-
options.onProgress?.("Updating routes and triggers...");
|
|
1798
1944
|
const triggerOptions = {
|
|
1799
1945
|
runWrangler: options.runWrangler,
|
|
1800
1946
|
workerName: options.workerName,
|
|
@@ -1809,6 +1955,65 @@ async function bootstrapFirstDeployment(options, configPath, previousVersionId,
|
|
|
1809
1955
|
publishEmptyCustomDomains: options.publishEmptyCustomDomains,
|
|
1810
1956
|
publishEmptyCrons: options.publishEmptyCrons
|
|
1811
1957
|
};
|
|
1958
|
+
const verifyPublishedOwner = async () => {
|
|
1959
|
+
const owner = await readCurrentProductionVersion(options, configPath);
|
|
1960
|
+
if (owner.kind === "failed") return {
|
|
1961
|
+
ok: false,
|
|
1962
|
+
reason: "status-failed",
|
|
1963
|
+
status: owner.status,
|
|
1964
|
+
versionId,
|
|
1965
|
+
previousVersionId,
|
|
1966
|
+
rollback: "unsafe"
|
|
1967
|
+
};
|
|
1968
|
+
if (owner.kind !== "ok" || owner.versionId !== versionId || !productionVersionPercentagesEqual(owner.versions, [{
|
|
1969
|
+
versionId,
|
|
1970
|
+
percentage: 100
|
|
1971
|
+
}])) {
|
|
1972
|
+
const repair = owner.kind === "ok" && owner.versionId && owner.versionId !== versionId && options.verifyUploader() ? await stabilizeCloudflareVersionTriggers({
|
|
1973
|
+
...triggerOptions,
|
|
1974
|
+
targetTriggerConfig: {
|
|
1975
|
+
...desiredTriggerConfig,
|
|
1976
|
+
preserve: true
|
|
1977
|
+
}
|
|
1978
|
+
}) : null;
|
|
1979
|
+
return {
|
|
1980
|
+
ok: false,
|
|
1981
|
+
reason: "deployment-changed",
|
|
1982
|
+
versionId,
|
|
1983
|
+
previousVersionId,
|
|
1984
|
+
activeVersionId: repair?.activeVersionId ?? (owner.kind === "ok" ? owner.versionId : null),
|
|
1985
|
+
rollback: "not-needed",
|
|
1986
|
+
...repair ? { triggerRepair: repair.ok && !repair.targetOwnsTraffic ? "succeeded" : !repair.ok && repair.reason !== "metadata-unavailable" ? "failed" : "unavailable" } : {}
|
|
1987
|
+
};
|
|
1988
|
+
}
|
|
1989
|
+
return null;
|
|
1990
|
+
};
|
|
1991
|
+
const publishedOwnerFailure = await verifyPublishedOwner();
|
|
1992
|
+
if (publishedOwnerFailure) return publishedOwnerFailure;
|
|
1993
|
+
if (options.validateUploadedVersion || options.recordVerifiedCandidate) {
|
|
1994
|
+
options.onProgress?.("Verifying the uploaded Worker...");
|
|
1995
|
+
try {
|
|
1996
|
+
await options.validateUploadedVersion?.(versionId);
|
|
1997
|
+
const validatedOwnerFailure = await verifyPublishedOwner();
|
|
1998
|
+
if (validatedOwnerFailure) return validatedOwnerFailure;
|
|
1999
|
+
if (options.recordVerifiedCandidate) {
|
|
2000
|
+
if (!options.validateUploadedVersion && !options.verifyInheritedSecrets && options.expectedPreviousVersionId === void 0) throw new Error("The bootstrap upload has no verified candidate checkpoint.");
|
|
2001
|
+
await options.recordVerifiedCandidate(versionId, previousVersionId);
|
|
2002
|
+
}
|
|
2003
|
+
} catch {
|
|
2004
|
+
return {
|
|
2005
|
+
ok: false,
|
|
2006
|
+
reason: atomic ? "atomic-failed" : "bootstrap-failed",
|
|
2007
|
+
versionId,
|
|
2008
|
+
previousVersionId,
|
|
2009
|
+
rollback: "unavailable",
|
|
2010
|
+
diagnostic: `Worker version ${versionId} was published, but its upload validation or candidate checkpoint failed. Inspect the current Worker deployment before retrying.`
|
|
2011
|
+
};
|
|
2012
|
+
}
|
|
2013
|
+
const checkpointOwnerFailure = await verifyPublishedOwner();
|
|
2014
|
+
if (checkpointOwnerFailure) return checkpointOwnerFailure;
|
|
2015
|
+
}
|
|
2016
|
+
options.onProgress?.("Updating routes and triggers...");
|
|
1812
2017
|
const triggers = await stabilizeCloudflareVersionTriggers(triggerOptions);
|
|
1813
2018
|
if (!triggers.ok || !triggers.targetOwnsTraffic) {
|
|
1814
2019
|
const superseded = triggers.activeVersionId !== void 0 && triggers.activeVersionId !== null && triggers.activeVersionId !== versionId;
|
|
@@ -2153,7 +2358,7 @@ function createCloudflareMetadataRunner(options) {
|
|
|
2153
2358
|
} else if (operation.type === "versions.list") {
|
|
2154
2359
|
kind = "versions";
|
|
2155
2360
|
resource = "/versions?deployable=true";
|
|
2156
|
-
} else if (operation.type === "versions.view" && /^[0-9a-f-]{36}$/i.test(operation.versionId)) {
|
|
2361
|
+
} else if (operation.type === "versions.view" && !operation.includeSource && /^[0-9a-f-]{36}$/i.test(operation.versionId)) {
|
|
2157
2362
|
kind = "version";
|
|
2158
2363
|
resource = "/versions/" + encodeURIComponent(operation.versionId);
|
|
2159
2364
|
}
|
|
@@ -2219,4 +2424,4 @@ function record(value) {
|
|
|
2219
2424
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2220
2425
|
}
|
|
2221
2426
|
//#endregion
|
|
2222
|
-
export { CloudflareWorkerInspectionError, activateCloudflareVersion, assertCloudflareBindingsPreserved, assertCloudflareDurableObjectLifecycleSupported, assertExistingCloudflareConfig, createCloudflareMetadataRunner, deployCloudflareVersionTraffic, deployCloudflareVersionTriggers, encodeCloudflareVersionMessage, executeCloudflareDeploy, extractWorkersDevSubdomain, normalizeWorkersDevSubdomain, parseCloudflareVersionMessage, parseRootWranglerConfig, readBindingFieldPresence, readCloudflareTriggerConfig, readCloudflareVersionMigrationTag, readCloudflareWorkerMigrationTag, readConfigEntryString, readExistingCloudflareWorker, readStoredResourceName, readWranglerTopLevelString, renderCloudflareStaticEntry, resolveD1MigrateTarget, stabilizeCloudflareVersionTriggers, stageCloudflareStaticAssets, writeCloudflareFrameworkDeployConfig, writeCloudflareStaticDeployConfig };
|
|
2427
|
+
export { CloudflareWorkerInspectionError, VOID_SECRET_DRAFT_SOURCE, activateCloudflareVersion, assertCloudflareBindingsPreserved, assertCloudflareDurableObjectLifecycleSupported, assertExistingCloudflareConfig, createCloudflareMetadataRunner, deployCloudflareVersionTraffic, deployCloudflareVersionTriggers, encodeCloudflareVersionMessage, executeCloudflareDeploy, extractWorkersDevSubdomain, normalizeWorkersDevSubdomain, parseCloudflareVersionMessage, parseRootWranglerConfig, readBindingFieldPresence, readCloudflareTriggerConfig, readCloudflareVersionMigrationTag, readCloudflareWorkerMigrationTag, readConfigEntryString, readExistingCloudflareWorker, readStoredResourceName, readWranglerTopLevelString, renderCloudflareStaticEntry, resolveD1MigrateTarget, stabilizeCloudflareVersionTriggers, stageCloudflareStaticAssets, writeCloudflareFrameworkDeployConfig, writeCloudflareStaticDeployConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@void/deploy-cloudflare",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
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.
|
|
23
|
+
"@void/deploy-core": "0.24.0",
|
|
24
24
|
"jsonc-parser": "3.3.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|