@cloudflare/deploy-helpers 0.11.0 → 0.11.2
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/{context-nFHuelHB.d.mts → context-CruwKULH.d.mts} +25 -2
- package/dist/context.d.mts +2 -1
- package/dist/index.d.mts +53 -34
- package/dist/index.mjs +777 -525
- package/dist/metafile-esm.json +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -3,17 +3,15 @@ export { initDeployHelpersContext } from './chunk-Z4LB73IF.mjs';
|
|
|
3
3
|
import { createWorkerUploadForm, moduleTypeMimeType } from './chunk-3G6JZQDH.mjs';
|
|
4
4
|
export { createWorkerUploadForm, fromMimeType, handleUnsafeCapnp, moduleTypeMimeType } from './chunk-3G6JZQDH.mjs';
|
|
5
5
|
import { __commonJS, __name, __require, __toESM, __export } from './chunk-Q72B4Q5Z.mjs';
|
|
6
|
-
import
|
|
6
|
+
import assert5 from 'node:assert';
|
|
7
7
|
import { readFileSync, mkdirSync, writeFileSync, createReadStream } from 'node:fs';
|
|
8
8
|
import * as path from 'node:path';
|
|
9
9
|
import path__default, { resolve, isAbsolute, sep, extname } from 'node:path';
|
|
10
10
|
import url2, { URLSearchParams as URLSearchParams$1 } from 'node:url';
|
|
11
11
|
import * as cli from '@cloudflare/cli-shared-helpers';
|
|
12
|
-
import { cancel } from '@cloudflare/cli-shared-helpers';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import '@cloudflare/workers-utils/compliance';
|
|
16
|
-
import { INHERIT_SYMBOL, APIError, UserError, getEnvironmentVariableFactory, isNonInteractiveOrCI, getHostFromRoute, retryOnAPIFailure, ParseError, getComplianceRegionSubdomain, configFileName, formatTime, getSubdomainMixedStateCheckDisabled, LOGGER_LEVELS, getDurableObjectContainerApps, CONTAINER_IMAGES_BINDING, isDurableObjectContainerApp, SERVICE_TAG_PREFIX, ENVIRONMENT_TAG_PREFIX, getDurableObjectExports, partitionExports, getWranglerTmpDir, parsePackageJSON, getInstalledPackageVersion, FatalError, readFileSync as readFileSync$1, parseJSON, printBindings, experimental_readRawConfig, experimental_patchConfig, PatchConfigError, COMPLIANCE_REGION_CONFIG_UNKNOWN, constructWranglerConfig, getCIMatchTag, formatConfigSnippet, DEFAULT_COMPAT_DATE, writeOutput, getBindings, hasDurableObjectExports, getDockerPath, parseNonHyphenedUuid, getWorkersCIBranchName, getCIOverrideName, getBindingTypeFriendlyName } from '@cloudflare/workers-utils';
|
|
12
|
+
import { updateStatus, cancel } from '@cloudflare/cli-shared-helpers';
|
|
13
|
+
import { SchedulingPolicy, ApplicationsService, listDurableObjects, resolveImageName, pushImageIfChanged, ContainerImagePreparationsService, ContainerImagePreparationStatus, createDurableObjectNamespaceResolver, initContainersSharedContext, pushBuiltContainerImage, deployContainers, verifyDockerInstalled } from '@cloudflare/containers-shared';
|
|
14
|
+
import { INHERIT_SYMBOL, APIError, UserError, getEnvironmentVariableFactory, isNonInteractiveOrCI, getHostFromRoute, retryOnAPIFailure, ParseError, getComplianceRegionSubdomain, configFileName, formatTime, getSubdomainMixedStateCheckDisabled, LOGGER_LEVELS, CONTAINER_IMAGES_BINDING, isDurableObjectContainerApp, getDockerPath, validateDurableObjectContainerApplications, getDurableObjectClassNameToUseSQLiteMap, SERVICE_TAG_PREFIX, ENVIRONMENT_TAG_PREFIX, getDurableObjectExports, partitionExports, getWranglerTmpDir, parsePackageJSON, getInstalledPackageVersion, FatalError, readFileSync as readFileSync$1, parseJSON, printBindings, experimental_readRawConfig, experimental_patchConfig, PatchConfigError, COMPLIANCE_REGION_CONFIG_UNKNOWN, constructWranglerConfig, getCIMatchTag, formatConfigSnippet, DEFAULT_COMPAT_DATE, writeOutput, getDurableObjectContainerApps, getBindings, hasDurableObjectExports, parseNonHyphenedUuid, getWorkersCIBranchName, getCIOverrideName, getBindingTypeFriendlyName } from '@cloudflare/workers-utils';
|
|
17
15
|
import { Response, FormData } from 'undici';
|
|
18
16
|
import chalk6 from 'chalk';
|
|
19
17
|
import PQueue from 'p-queue';
|
|
@@ -25,9 +23,11 @@ import { Blob } from 'node:buffer';
|
|
|
25
23
|
import { gzipSync } from 'node:zlib';
|
|
26
24
|
import { brandColor, white, gray, bold, yellow, dim, red, blue } from '@cloudflare/cli-shared-helpers/colors';
|
|
27
25
|
import { isDeepStrictEqual } from 'node:util';
|
|
26
|
+
import { setTimeout as setTimeout$1 } from 'node:timers/promises';
|
|
28
27
|
import readline from 'node:readline';
|
|
29
28
|
import { parse as parse$1 } from 'dotenv';
|
|
30
29
|
import { getFreshSourceMapSupport, getNodeCompat } from 'miniflare';
|
|
30
|
+
import { execSync } from 'node:child_process';
|
|
31
31
|
import { createHash } from 'node:crypto';
|
|
32
32
|
|
|
33
33
|
// ../../node_modules/.pnpm/ignore@5.3.1/node_modules/ignore/index.js
|
|
@@ -257,17 +257,17 @@ var require_ignore = __commonJS({
|
|
|
257
257
|
var throwError = /* @__PURE__ */ __name((message, Ctor) => {
|
|
258
258
|
throw new Ctor(message);
|
|
259
259
|
}, "throwError");
|
|
260
|
-
var checkPath = /* @__PURE__ */ __name((
|
|
261
|
-
if (!isString(
|
|
260
|
+
var checkPath = /* @__PURE__ */ __name((path10, originalPath, doThrow) => {
|
|
261
|
+
if (!isString(path10)) {
|
|
262
262
|
return doThrow(
|
|
263
263
|
`path must be a string, but got \`${originalPath}\``,
|
|
264
264
|
TypeError
|
|
265
265
|
);
|
|
266
266
|
}
|
|
267
|
-
if (!
|
|
267
|
+
if (!path10) {
|
|
268
268
|
return doThrow(`path must not be empty`, TypeError);
|
|
269
269
|
}
|
|
270
|
-
if (checkPath.isNotRelative(
|
|
270
|
+
if (checkPath.isNotRelative(path10)) {
|
|
271
271
|
const r = "`path.relative()`d";
|
|
272
272
|
return doThrow(
|
|
273
273
|
`path should be a ${r} string, but got "${originalPath}"`,
|
|
@@ -276,7 +276,7 @@ var require_ignore = __commonJS({
|
|
|
276
276
|
}
|
|
277
277
|
return true;
|
|
278
278
|
}, "checkPath");
|
|
279
|
-
var isNotRelative = /* @__PURE__ */ __name((
|
|
279
|
+
var isNotRelative = /* @__PURE__ */ __name((path10) => REGEX_TEST_INVALID_PATH.test(path10), "isNotRelative");
|
|
280
280
|
checkPath.isNotRelative = isNotRelative;
|
|
281
281
|
checkPath.convert = (p) => p;
|
|
282
282
|
var Ignore = class {
|
|
@@ -338,7 +338,7 @@ var require_ignore = __commonJS({
|
|
|
338
338
|
// setting `checkUnignored` to `false` could reduce additional
|
|
339
339
|
// path matching.
|
|
340
340
|
// @returns {TestResult} true if a file is ignored
|
|
341
|
-
_testOne(
|
|
341
|
+
_testOne(path10, checkUnignored) {
|
|
342
342
|
let ignored = false;
|
|
343
343
|
let unignored = false;
|
|
344
344
|
this._rules.forEach((rule) => {
|
|
@@ -346,7 +346,7 @@ var require_ignore = __commonJS({
|
|
|
346
346
|
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
347
347
|
return;
|
|
348
348
|
}
|
|
349
|
-
const matched = rule.regex.test(
|
|
349
|
+
const matched = rule.regex.test(path10);
|
|
350
350
|
if (matched) {
|
|
351
351
|
ignored = !negative;
|
|
352
352
|
unignored = negative;
|
|
@@ -359,24 +359,24 @@ var require_ignore = __commonJS({
|
|
|
359
359
|
}
|
|
360
360
|
// @returns {TestResult}
|
|
361
361
|
_test(originalPath, cache, checkUnignored, slices) {
|
|
362
|
-
const
|
|
362
|
+
const path10 = originalPath && checkPath.convert(originalPath);
|
|
363
363
|
checkPath(
|
|
364
|
-
|
|
364
|
+
path10,
|
|
365
365
|
originalPath,
|
|
366
366
|
this._allowRelativePaths ? RETURN_FALSE : throwError
|
|
367
367
|
);
|
|
368
|
-
return this._t(
|
|
368
|
+
return this._t(path10, cache, checkUnignored, slices);
|
|
369
369
|
}
|
|
370
|
-
_t(
|
|
371
|
-
if (
|
|
372
|
-
return cache[
|
|
370
|
+
_t(path10, cache, checkUnignored, slices) {
|
|
371
|
+
if (path10 in cache) {
|
|
372
|
+
return cache[path10];
|
|
373
373
|
}
|
|
374
374
|
if (!slices) {
|
|
375
|
-
slices =
|
|
375
|
+
slices = path10.split(SLASH);
|
|
376
376
|
}
|
|
377
377
|
slices.pop();
|
|
378
378
|
if (!slices.length) {
|
|
379
|
-
return cache[
|
|
379
|
+
return cache[path10] = this._testOne(path10, checkUnignored);
|
|
380
380
|
}
|
|
381
381
|
const parent = this._t(
|
|
382
382
|
slices.join(SLASH) + SLASH,
|
|
@@ -384,24 +384,24 @@ var require_ignore = __commonJS({
|
|
|
384
384
|
checkUnignored,
|
|
385
385
|
slices
|
|
386
386
|
);
|
|
387
|
-
return cache[
|
|
387
|
+
return cache[path10] = parent.ignored ? parent : this._testOne(path10, checkUnignored);
|
|
388
388
|
}
|
|
389
|
-
ignores(
|
|
390
|
-
return this._test(
|
|
389
|
+
ignores(path10) {
|
|
390
|
+
return this._test(path10, this._ignoreCache, false).ignored;
|
|
391
391
|
}
|
|
392
392
|
createFilter() {
|
|
393
|
-
return (
|
|
393
|
+
return (path10) => !this.ignores(path10);
|
|
394
394
|
}
|
|
395
395
|
filter(paths) {
|
|
396
396
|
return makeArray(paths).filter(this.createFilter());
|
|
397
397
|
}
|
|
398
398
|
// @returns {TestResult}
|
|
399
|
-
test(
|
|
400
|
-
return this._test(
|
|
399
|
+
test(path10) {
|
|
400
|
+
return this._test(path10, this._testCache, true);
|
|
401
401
|
}
|
|
402
402
|
};
|
|
403
403
|
var factory = /* @__PURE__ */ __name((options) => new Ignore(options), "factory");
|
|
404
|
-
var isPathValid = /* @__PURE__ */ __name((
|
|
404
|
+
var isPathValid = /* @__PURE__ */ __name((path10) => checkPath(path10 && checkPath.convert(path10), path10, RETURN_FALSE), "isPathValid");
|
|
405
405
|
factory.isPathValid = isPathValid;
|
|
406
406
|
factory.default = factory;
|
|
407
407
|
module.exports = factory;
|
|
@@ -412,7 +412,7 @@ var require_ignore = __commonJS({
|
|
|
412
412
|
const makePosix = /* @__PURE__ */ __name((str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/"), "makePosix");
|
|
413
413
|
checkPath.convert = makePosix;
|
|
414
414
|
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
415
|
-
checkPath.isNotRelative = (
|
|
415
|
+
checkPath.isNotRelative = (path10) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path10) || isNotRelative(path10);
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
});
|
|
@@ -704,10 +704,10 @@ var require_heap2 = __commonJS({
|
|
|
704
704
|
var require_difflib = __commonJS({
|
|
705
705
|
"../../node_modules/.pnpm/@ewoudenberg+difflib@0.1.0/node_modules/@ewoudenberg/difflib/lib/difflib.js"(exports$1) {
|
|
706
706
|
(function() {
|
|
707
|
-
var Differ, Heap, IS_CHARACTER_JUNK, IS_LINE_JUNK, SequenceMatcher, _any2, _arrayCmp, _calculateRatio, _countLeading, _formatRangeContext, _formatRangeUnified, _has,
|
|
707
|
+
var Differ, Heap, IS_CHARACTER_JUNK, IS_LINE_JUNK, SequenceMatcher, _any2, _arrayCmp, _calculateRatio, _countLeading, _formatRangeContext, _formatRangeUnified, _has, assert12, contextDiff, floor, getCloseMatches, max, min, ndiff, restore, unifiedDiff, indexOf = [].indexOf;
|
|
708
708
|
({ floor, max, min } = Math);
|
|
709
709
|
Heap = require_heap2();
|
|
710
|
-
|
|
710
|
+
assert12 = __require("assert");
|
|
711
711
|
_calculateRatio = /* @__PURE__ */ __name(function(matches, length) {
|
|
712
712
|
if (length) {
|
|
713
713
|
return 2 * matches / length;
|
|
@@ -1278,7 +1278,7 @@ var require_difflib = __commonJS({
|
|
|
1278
1278
|
}
|
|
1279
1279
|
_plainReplace(a, alo, ahi, b, blo, bhi) {
|
|
1280
1280
|
var first, g, l, len, len1, line, lines, m, ref, second;
|
|
1281
|
-
|
|
1281
|
+
assert12(alo < ahi && blo < bhi);
|
|
1282
1282
|
if (bhi - blo < ahi - alo) {
|
|
1283
1283
|
first = this._dump("+", b, blo, bhi);
|
|
1284
1284
|
second = this._dump("-", a, alo, ahi);
|
|
@@ -2746,296 +2746,6 @@ var require_lib = __commonJS({
|
|
|
2746
2746
|
}
|
|
2747
2747
|
});
|
|
2748
2748
|
|
|
2749
|
-
// ../containers-shared/src/client/models/ApplicationRollout.ts
|
|
2750
|
-
var ApplicationRollout;
|
|
2751
|
-
((ApplicationRollout2) => {
|
|
2752
|
-
((kind2) => {
|
|
2753
|
-
kind2["FULL_AUTO"] = "full_auto";
|
|
2754
|
-
kind2["FULL_MANUAL"] = "full_manual";
|
|
2755
|
-
kind2["DURABLE_OBJECTS_AUTO"] = "durable_objects_auto";
|
|
2756
|
-
})(ApplicationRollout2.kind || (ApplicationRollout2.kind = {}));
|
|
2757
|
-
((strategy2) => {
|
|
2758
|
-
strategy2["ROLLING"] = "rolling";
|
|
2759
|
-
})(ApplicationRollout2.strategy || (ApplicationRollout2.strategy = {}));
|
|
2760
|
-
((status2) => {
|
|
2761
|
-
status2["PENDING"] = "pending";
|
|
2762
|
-
status2["PROGRESSING"] = "progressing";
|
|
2763
|
-
status2["COMPLETED"] = "completed";
|
|
2764
|
-
status2["REVERTED"] = "reverted";
|
|
2765
|
-
status2["REPLACED"] = "replaced";
|
|
2766
|
-
})(ApplicationRollout2.status || (ApplicationRollout2.status = {}));
|
|
2767
|
-
})(ApplicationRollout || (ApplicationRollout = {}));
|
|
2768
|
-
|
|
2769
|
-
// ../containers-shared/src/client/models/BadRequestWithCodeError.ts
|
|
2770
|
-
var BadRequestWithCodeError;
|
|
2771
|
-
((BadRequestWithCodeError2) => {
|
|
2772
|
-
((error52) => {
|
|
2773
|
-
error52["VALIDATE_INPUT"] = "VALIDATE_INPUT";
|
|
2774
|
-
})(BadRequestWithCodeError2.error || (BadRequestWithCodeError2.error = {}));
|
|
2775
|
-
})(BadRequestWithCodeError || (BadRequestWithCodeError = {}));
|
|
2776
|
-
|
|
2777
|
-
// ../containers-shared/src/client/models/CreateApplicationRolloutRequest.ts
|
|
2778
|
-
var CreateApplicationRolloutRequest;
|
|
2779
|
-
((CreateApplicationRolloutRequest2) => {
|
|
2780
|
-
((strategy2) => {
|
|
2781
|
-
strategy2["ROLLING"] = "rolling";
|
|
2782
|
-
})(CreateApplicationRolloutRequest2.strategy || (CreateApplicationRolloutRequest2.strategy = {}));
|
|
2783
|
-
((step_percentage2) => {
|
|
2784
|
-
step_percentage2[step_percentage2["_5"] = 5] = "_5";
|
|
2785
|
-
step_percentage2[step_percentage2["_10"] = 10] = "_10";
|
|
2786
|
-
step_percentage2[step_percentage2["_20"] = 20] = "_20";
|
|
2787
|
-
step_percentage2[step_percentage2["_25"] = 25] = "_25";
|
|
2788
|
-
step_percentage2[step_percentage2["_50"] = 50] = "_50";
|
|
2789
|
-
step_percentage2[step_percentage2["_100"] = 100] = "_100";
|
|
2790
|
-
})(CreateApplicationRolloutRequest2.step_percentage || (CreateApplicationRolloutRequest2.step_percentage = {}));
|
|
2791
|
-
((kind2) => {
|
|
2792
|
-
kind2["FULL_AUTO"] = "full_auto";
|
|
2793
|
-
kind2["FULL_MANUAL"] = "full_manual";
|
|
2794
|
-
})(CreateApplicationRolloutRequest2.kind || (CreateApplicationRolloutRequest2.kind = {}));
|
|
2795
|
-
})(CreateApplicationRolloutRequest || (CreateApplicationRolloutRequest = {}));
|
|
2796
|
-
|
|
2797
|
-
// ../containers-shared/src/client/models/DeploymentNotFoundError.ts
|
|
2798
|
-
var DeploymentNotFoundError;
|
|
2799
|
-
((DeploymentNotFoundError2) => {
|
|
2800
|
-
((error52) => {
|
|
2801
|
-
error52["DEPLOYMENT_NOT_FOUND"] = "DEPLOYMENT_NOT_FOUND";
|
|
2802
|
-
})(DeploymentNotFoundError2.error || (DeploymentNotFoundError2.error = {}));
|
|
2803
|
-
})(DeploymentNotFoundError || (DeploymentNotFoundError = {}));
|
|
2804
|
-
|
|
2805
|
-
// ../containers-shared/src/client/models/ImageRegistryAlreadyExistsError.ts
|
|
2806
|
-
var ImageRegistryAlreadyExistsError;
|
|
2807
|
-
((ImageRegistryAlreadyExistsError2) => {
|
|
2808
|
-
((error52) => {
|
|
2809
|
-
error52["IMAGE_REGISTRY_ALREADY_EXISTS"] = "IMAGE_REGISTRY_ALREADY_EXISTS";
|
|
2810
|
-
})(ImageRegistryAlreadyExistsError2.error || (ImageRegistryAlreadyExistsError2.error = {}));
|
|
2811
|
-
})(ImageRegistryAlreadyExistsError || (ImageRegistryAlreadyExistsError = {}));
|
|
2812
|
-
|
|
2813
|
-
// ../containers-shared/src/client/models/ImageRegistryIsPublic.ts
|
|
2814
|
-
var ImageRegistryIsPublic;
|
|
2815
|
-
((ImageRegistryIsPublic2) => {
|
|
2816
|
-
((error52) => {
|
|
2817
|
-
error52["IMAGE_REGISTRY_IS_PUBLIC"] = "IMAGE_REGISTRY_IS_PUBLIC";
|
|
2818
|
-
})(ImageRegistryIsPublic2.error || (ImageRegistryIsPublic2.error = {}));
|
|
2819
|
-
})(ImageRegistryIsPublic || (ImageRegistryIsPublic = {}));
|
|
2820
|
-
|
|
2821
|
-
// ../containers-shared/src/client/models/ImageRegistryNotAllowedError.ts
|
|
2822
|
-
var ImageRegistryNotAllowedError;
|
|
2823
|
-
((ImageRegistryNotAllowedError2) => {
|
|
2824
|
-
((error52) => {
|
|
2825
|
-
error52["IMAGE_REGISTRY_NOT_ALLOWED"] = "IMAGE_REGISTRY_NOT_ALLOWED";
|
|
2826
|
-
})(ImageRegistryNotAllowedError2.error || (ImageRegistryNotAllowedError2.error = {}));
|
|
2827
|
-
})(ImageRegistryNotAllowedError || (ImageRegistryNotAllowedError = {}));
|
|
2828
|
-
|
|
2829
|
-
// ../containers-shared/src/client/models/ImageRegistryNotFoundError.ts
|
|
2830
|
-
var ImageRegistryNotFoundError;
|
|
2831
|
-
((ImageRegistryNotFoundError2) => {
|
|
2832
|
-
((error52) => {
|
|
2833
|
-
error52["IMAGE_REGISTRY_NOT_FOUND"] = "IMAGE_REGISTRY_NOT_FOUND";
|
|
2834
|
-
})(ImageRegistryNotFoundError2.error || (ImageRegistryNotFoundError2.error = {}));
|
|
2835
|
-
})(ImageRegistryNotFoundError || (ImageRegistryNotFoundError = {}));
|
|
2836
|
-
|
|
2837
|
-
// ../containers-shared/src/client/models/ImageRegistryProtocolAlreadyExists.ts
|
|
2838
|
-
var ImageRegistryProtocolAlreadyExists;
|
|
2839
|
-
((ImageRegistryProtocolAlreadyExists2) => {
|
|
2840
|
-
((error52) => {
|
|
2841
|
-
error52["IMAGE_REGISTRY_PROTOCOL_ALREADY_EXISTS"] = "IMAGE_REGISTRY_PROTOCOL_ALREADY_EXISTS";
|
|
2842
|
-
})(ImageRegistryProtocolAlreadyExists2.error || (ImageRegistryProtocolAlreadyExists2.error = {}));
|
|
2843
|
-
})(ImageRegistryProtocolAlreadyExists || (ImageRegistryProtocolAlreadyExists = {}));
|
|
2844
|
-
|
|
2845
|
-
// ../containers-shared/src/client/models/ImageRegistryProtocolIsReferencedError.ts
|
|
2846
|
-
var ImageRegistryProtocolIsReferencedError;
|
|
2847
|
-
((ImageRegistryProtocolIsReferencedError2) => {
|
|
2848
|
-
((error52) => {
|
|
2849
|
-
error52["IMAGE_REGISTRY_PROTO_IS_REFERENCED"] = "IMAGE_REGISTRY_PROTO_IS_REFERENCED";
|
|
2850
|
-
})(ImageRegistryProtocolIsReferencedError2.error || (ImageRegistryProtocolIsReferencedError2.error = {}));
|
|
2851
|
-
})(ImageRegistryProtocolIsReferencedError || (ImageRegistryProtocolIsReferencedError = {}));
|
|
2852
|
-
|
|
2853
|
-
// ../containers-shared/src/client/models/ImageRegistryProtocolNotFound.ts
|
|
2854
|
-
var ImageRegistryProtocolNotFound;
|
|
2855
|
-
((ImageRegistryProtocolNotFound2) => {
|
|
2856
|
-
((error52) => {
|
|
2857
|
-
error52["IMAGE_REGISTRY_PROTOCOL_NOT_FOUND"] = "IMAGE_REGISTRY_PROTOCOL_NOT_FOUND";
|
|
2858
|
-
})(ImageRegistryProtocolNotFound2.error || (ImageRegistryProtocolNotFound2.error = {}));
|
|
2859
|
-
})(ImageRegistryProtocolNotFound || (ImageRegistryProtocolNotFound = {}));
|
|
2860
|
-
|
|
2861
|
-
// ../containers-shared/src/client/models/ProvisionerConfiguration.ts
|
|
2862
|
-
var ProvisionerConfiguration;
|
|
2863
|
-
((ProvisionerConfiguration2) => {
|
|
2864
|
-
((type2) => {
|
|
2865
|
-
type2["NONE"] = "none";
|
|
2866
|
-
type2["CLOUDINIT"] = "cloudinit";
|
|
2867
|
-
})(ProvisionerConfiguration2.type || (ProvisionerConfiguration2.type = {}));
|
|
2868
|
-
})(ProvisionerConfiguration || (ProvisionerConfiguration = {}));
|
|
2869
|
-
|
|
2870
|
-
// ../containers-shared/src/client/models/RolloutStep.ts
|
|
2871
|
-
var RolloutStep;
|
|
2872
|
-
((RolloutStep2) => {
|
|
2873
|
-
((status2) => {
|
|
2874
|
-
status2["PENDING"] = "pending";
|
|
2875
|
-
status2["PROGRESSING"] = "progressing";
|
|
2876
|
-
status2["REVERTING"] = "reverting";
|
|
2877
|
-
status2["COMPLETED"] = "completed";
|
|
2878
|
-
status2["REVERTED"] = "reverted";
|
|
2879
|
-
})(RolloutStep2.status || (RolloutStep2.status = {}));
|
|
2880
|
-
})(RolloutStep || (RolloutStep = {}));
|
|
2881
|
-
|
|
2882
|
-
// ../containers-shared/src/client/models/SecretNameAlreadyExists.ts
|
|
2883
|
-
var SecretNameAlreadyExists;
|
|
2884
|
-
((SecretNameAlreadyExists2) => {
|
|
2885
|
-
((error52) => {
|
|
2886
|
-
error52["SECRET_NAME_ALREADY_EXISTS"] = "SECRET_NAME_ALREADY_EXISTS";
|
|
2887
|
-
})(SecretNameAlreadyExists2.error || (SecretNameAlreadyExists2.error = {}));
|
|
2888
|
-
})(SecretNameAlreadyExists || (SecretNameAlreadyExists = {}));
|
|
2889
|
-
|
|
2890
|
-
// ../containers-shared/src/client/models/SecretNotFound.ts
|
|
2891
|
-
var SecretNotFound;
|
|
2892
|
-
((SecretNotFound2) => {
|
|
2893
|
-
((error52) => {
|
|
2894
|
-
error52["SECRET_NAME_NOT_FOUND"] = "SECRET_NAME_NOT_FOUND";
|
|
2895
|
-
})(SecretNotFound2.error || (SecretNotFound2.error = {}));
|
|
2896
|
-
})(SecretNotFound || (SecretNotFound = {}));
|
|
2897
|
-
|
|
2898
|
-
// ../containers-shared/src/client/models/SSHPublicKeyNotFoundError.ts
|
|
2899
|
-
var SSHPublicKeyNotFoundError;
|
|
2900
|
-
((SSHPublicKeyNotFoundError2) => {
|
|
2901
|
-
((error52) => {
|
|
2902
|
-
error52["SSH_PUBLIC_KEY_NOT_FOUND"] = "SSH_PUBLIC_KEY_NOT_FOUND";
|
|
2903
|
-
})(SSHPublicKeyNotFoundError2.error || (SSHPublicKeyNotFoundError2.error = {}));
|
|
2904
|
-
})(SSHPublicKeyNotFoundError || (SSHPublicKeyNotFoundError = {}));
|
|
2905
|
-
|
|
2906
|
-
// ../containers-shared/src/client/models/UpdateApplicationRolloutRequest.ts
|
|
2907
|
-
var UpdateApplicationRolloutRequest;
|
|
2908
|
-
((UpdateApplicationRolloutRequest2) => {
|
|
2909
|
-
((action2) => {
|
|
2910
|
-
action2["NEXT"] = "next";
|
|
2911
|
-
action2["PREVIOUS"] = "previous";
|
|
2912
|
-
action2["REVERT"] = "revert";
|
|
2913
|
-
})(UpdateApplicationRolloutRequest2.action || (UpdateApplicationRolloutRequest2.action = {}));
|
|
2914
|
-
})(UpdateApplicationRolloutRequest || (UpdateApplicationRolloutRequest = {}));
|
|
2915
|
-
|
|
2916
|
-
// ../containers-shared/src/utils.ts
|
|
2917
|
-
var runDockerCmd = /* @__PURE__ */ __name((dockerPath, args, stdio) => {
|
|
2918
|
-
let aborted2 = false;
|
|
2919
|
-
let resolve2;
|
|
2920
|
-
let reject;
|
|
2921
|
-
const ready = new Promise((res, rej) => {
|
|
2922
|
-
resolve2 = res;
|
|
2923
|
-
reject = rej;
|
|
2924
|
-
});
|
|
2925
|
-
const child = spawn(dockerPath, args, {
|
|
2926
|
-
stdio: stdio ?? "inherit",
|
|
2927
|
-
// We need to set detached to true so that the child process
|
|
2928
|
-
// will control all of its child processes and we can kill
|
|
2929
|
-
// all of them in case we need to abort the build process.
|
|
2930
|
-
// On Windows, detached: true opens a new console window per child
|
|
2931
|
-
// process, so we only set it on non-Windows platforms.
|
|
2932
|
-
detached: process.platform !== "win32",
|
|
2933
|
-
// Prevent child processes from opening visible console windows on Windows.
|
|
2934
|
-
// This is a no-op on non-Windows platforms.
|
|
2935
|
-
windowsHide: true
|
|
2936
|
-
});
|
|
2937
|
-
let errorHandled = false;
|
|
2938
|
-
child.on("close", (code) => {
|
|
2939
|
-
if (code === 0 || aborted2) {
|
|
2940
|
-
resolve2({ aborted: aborted2 });
|
|
2941
|
-
} else if (!errorHandled) {
|
|
2942
|
-
errorHandled = true;
|
|
2943
|
-
reject(
|
|
2944
|
-
new UserError$1(`Docker command exited with code: ${code}`, {
|
|
2945
|
-
telemetryMessage: false
|
|
2946
|
-
})
|
|
2947
|
-
);
|
|
2948
|
-
}
|
|
2949
|
-
});
|
|
2950
|
-
child.on("error", (err) => {
|
|
2951
|
-
if (!errorHandled) {
|
|
2952
|
-
errorHandled = true;
|
|
2953
|
-
reject(
|
|
2954
|
-
new UserError$1(`Docker command failed: ${err.message}`, {
|
|
2955
|
-
telemetryMessage: false
|
|
2956
|
-
})
|
|
2957
|
-
);
|
|
2958
|
-
}
|
|
2959
|
-
});
|
|
2960
|
-
return {
|
|
2961
|
-
abort: /* @__PURE__ */ __name(() => {
|
|
2962
|
-
aborted2 = true;
|
|
2963
|
-
child.unref();
|
|
2964
|
-
if (child.pid !== void 0) {
|
|
2965
|
-
if (process.platform === "win32") {
|
|
2966
|
-
child.kill();
|
|
2967
|
-
} else {
|
|
2968
|
-
process.kill(-child.pid);
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
}, "abort"),
|
|
2972
|
-
ready,
|
|
2973
|
-
then: /* @__PURE__ */ __name(async (onResolve, onReject) => ready.then(onResolve).catch(onReject), "then")
|
|
2974
|
-
};
|
|
2975
|
-
}, "runDockerCmd");
|
|
2976
|
-
var isDockerRunning = /* @__PURE__ */ __name(async (dockerPath) => {
|
|
2977
|
-
try {
|
|
2978
|
-
await runDockerCmd(dockerPath, ["info"], ["inherit", "pipe", "pipe"]);
|
|
2979
|
-
} catch {
|
|
2980
|
-
return false;
|
|
2981
|
-
}
|
|
2982
|
-
return true;
|
|
2983
|
-
}, "isDockerRunning");
|
|
2984
|
-
var verifyDockerInstalled = /* @__PURE__ */ __name(async ({
|
|
2985
|
-
dockerPath,
|
|
2986
|
-
operation,
|
|
2987
|
-
imageNoun,
|
|
2988
|
-
hint
|
|
2989
|
-
}) => {
|
|
2990
|
-
const dockerIsRunning = await isDockerRunning(dockerPath);
|
|
2991
|
-
if (!dockerIsRunning) {
|
|
2992
|
-
throw new UserError$1(
|
|
2993
|
-
getFailedToRunDockerErrorMessage({
|
|
2994
|
-
operation,
|
|
2995
|
-
imageNoun,
|
|
2996
|
-
hint
|
|
2997
|
-
}),
|
|
2998
|
-
{
|
|
2999
|
-
telemetryMessage: false
|
|
3000
|
-
}
|
|
3001
|
-
);
|
|
3002
|
-
}
|
|
3003
|
-
}, "verifyDockerInstalled");
|
|
3004
|
-
function getFailedToRunDockerErrorMessage({
|
|
3005
|
-
operation,
|
|
3006
|
-
imageNoun,
|
|
3007
|
-
hint
|
|
3008
|
-
}) {
|
|
3009
|
-
const beforeOperation = operation ? ` before ${operation}` : "";
|
|
3010
|
-
const headline = `The Docker CLI is needed to build ${imageNoun}${beforeOperation} but could not be launched.`;
|
|
3011
|
-
let daemonHint;
|
|
3012
|
-
if (process.platform === "darwin") {
|
|
3013
|
-
daemonHint = "open the Docker Desktop app or run `open -a Docker`";
|
|
3014
|
-
} else if (process.platform === "win32") {
|
|
3015
|
-
daemonHint = "open the Docker Desktop app";
|
|
3016
|
-
} else {
|
|
3017
|
-
daemonHint = "run `sudo systemctl start docker`";
|
|
3018
|
-
}
|
|
3019
|
-
const steps = `To fix this, try the following:
|
|
3020
|
-
- If Docker is not installed, download it from https://docs.docker.com/get-started/get-docker/
|
|
3021
|
-
- If Docker is installed but the daemon is not running,
|
|
3022
|
-
${daemonHint}.
|
|
3023
|
-
- If you use an alternative Docker-compatible CLI (e.g. Podman),
|
|
3024
|
-
set the WRANGLER_DOCKER_BIN environment variable to its path and DOCKER_HOST to its socket.`;
|
|
3025
|
-
const alternatives = "Note: Other container tooling that is compatible with the Docker CLI and engine may work, but is not yet guaranteed to do so.";
|
|
3026
|
-
let message = `${headline}
|
|
3027
|
-
${steps}
|
|
3028
|
-
|
|
3029
|
-
${alternatives}`;
|
|
3030
|
-
if (hint) {
|
|
3031
|
-
message += `
|
|
3032
|
-
|
|
3033
|
-
${hint}`;
|
|
3034
|
-
}
|
|
3035
|
-
return message;
|
|
3036
|
-
}
|
|
3037
|
-
__name(getFailedToRunDockerErrorMessage, "getFailedToRunDockerErrorMessage");
|
|
3038
|
-
|
|
3039
2749
|
// src/deploy/helpers/error-codes.ts
|
|
3040
2750
|
var INVALID_INHERIT_BINDING_CODE = 10057;
|
|
3041
2751
|
var EXPORTS_RECONCILIATION_ERROR_CODE = 100402;
|
|
@@ -3263,14 +2973,14 @@ async function resolveOwnerWorkerTag(config2, accountId, scriptName) {
|
|
|
3263
2973
|
}
|
|
3264
2974
|
}
|
|
3265
2975
|
__name(resolveOwnerWorkerTag, "resolveOwnerWorkerTag");
|
|
3266
|
-
async function fetchEmailRoutingPlan(config2, accountId,
|
|
2976
|
+
async function fetchEmailRoutingPlan(config2, accountId, request) {
|
|
3267
2977
|
const deadline = Date.now() + PLAN_RETRY_TIMEOUT_MS;
|
|
3268
2978
|
for (; ; ) {
|
|
3269
2979
|
try {
|
|
3270
2980
|
return await fetchResult(
|
|
3271
2981
|
config2,
|
|
3272
2982
|
`/accounts/${accountId}/email/routing/rules/plan`,
|
|
3273
|
-
postJson(
|
|
2983
|
+
postJson(request)
|
|
3274
2984
|
);
|
|
3275
2985
|
} catch (e) {
|
|
3276
2986
|
const isWorkerNotFound = e instanceof APIError && e.code === PLAN_RETRY_WORKER_NOT_FOUND_CODE;
|
|
@@ -3288,8 +2998,8 @@ async function fetchEmailRoutingPlan(config2, accountId, request2) {
|
|
|
3288
2998
|
}
|
|
3289
2999
|
}
|
|
3290
3000
|
__name(fetchEmailRoutingPlan, "fetchEmailRoutingPlan");
|
|
3291
|
-
function putJson(config2,
|
|
3292
|
-
return fetchResult(config2,
|
|
3001
|
+
function putJson(config2, path10, body) {
|
|
3002
|
+
return fetchResult(config2, path10, {
|
|
3293
3003
|
method: "PUT",
|
|
3294
3004
|
headers: { "Content-Type": "application/json" },
|
|
3295
3005
|
body: JSON.stringify(body)
|
|
@@ -3358,12 +3068,12 @@ async function applyEmailRoutingAddresses({
|
|
|
3358
3068
|
return;
|
|
3359
3069
|
}
|
|
3360
3070
|
const ownerWorkerTag = workerTag ?? await resolveOwnerWorkerTag(config2, accountId, scriptName);
|
|
3361
|
-
const
|
|
3071
|
+
const request = buildEmailRoutingPlanRequest(
|
|
3362
3072
|
addresses,
|
|
3363
3073
|
scriptName,
|
|
3364
3074
|
ownerWorkerTag
|
|
3365
3075
|
);
|
|
3366
|
-
const plan = await fetchEmailRoutingPlan(config2, accountId,
|
|
3076
|
+
const plan = await fetchEmailRoutingPlan(config2, accountId, request);
|
|
3367
3077
|
if (!planHasChanges(plan)) {
|
|
3368
3078
|
logger.log("Email Routing rules are up to date.");
|
|
3369
3079
|
return;
|
|
@@ -3527,7 +3237,9 @@ function renderRoute(route) {
|
|
|
3527
3237
|
if (isCustomDomain) {
|
|
3528
3238
|
const flags = [];
|
|
3529
3239
|
if ("enabled" in route && route.enabled !== void 0) {
|
|
3530
|
-
flags.push(
|
|
3240
|
+
flags.push(
|
|
3241
|
+
route.enabled ? "production: enabled" : "production: disabled"
|
|
3242
|
+
);
|
|
3531
3243
|
}
|
|
3532
3244
|
if ("previews_enabled" in route && route.previews_enabled !== void 0) {
|
|
3533
3245
|
flags.push(
|
|
@@ -3667,7 +3379,7 @@ async function publishRoutesFallback(complianceConfig, routes, { scriptName, acc
|
|
|
3667
3379
|
return deployedRoutes;
|
|
3668
3380
|
}
|
|
3669
3381
|
__name(publishRoutesFallback, "publishRoutesFallback");
|
|
3670
|
-
async function publishCustomDomains(complianceConfig, workerUrl, accountId, domains) {
|
|
3382
|
+
async function publishCustomDomains(complianceConfig, workerUrl, accountId, scriptName, domains) {
|
|
3671
3383
|
const options = {
|
|
3672
3384
|
override_scope: true,
|
|
3673
3385
|
override_existing_origin: false,
|
|
@@ -3682,9 +3394,53 @@ async function publishCustomDomains(complianceConfig, workerUrl, accountId, doma
|
|
|
3682
3394
|
previews_enabled: "previews_enabled" in domainRoute ? domainRoute.previews_enabled : void 0
|
|
3683
3395
|
};
|
|
3684
3396
|
});
|
|
3397
|
+
let changeset;
|
|
3398
|
+
try {
|
|
3399
|
+
changeset = await fetchResult(
|
|
3400
|
+
complianceConfig,
|
|
3401
|
+
`${workerUrl}/domains/changeset?replace_state=true`,
|
|
3402
|
+
{
|
|
3403
|
+
method: "POST",
|
|
3404
|
+
body: JSON.stringify(origins),
|
|
3405
|
+
headers: {
|
|
3406
|
+
"Content-Type": "application/json"
|
|
3407
|
+
}
|
|
3408
|
+
}
|
|
3409
|
+
);
|
|
3410
|
+
} catch (error51) {
|
|
3411
|
+
if (process.stdout.isTTY) {
|
|
3412
|
+
throw error51;
|
|
3413
|
+
}
|
|
3414
|
+
changeset = { added: [], removed: [], updated: [], conflicting: [] };
|
|
3415
|
+
}
|
|
3416
|
+
const updatesRequired = changeset.updated.filter((domain2) => domain2.modified);
|
|
3417
|
+
const previewUpdates = updatesRequired.filter(
|
|
3418
|
+
(domain2) => domain2.previews_enabled === true
|
|
3419
|
+
);
|
|
3420
|
+
const fetchExistingDomain = /* @__PURE__ */ __name((domain2) => fetchResult(
|
|
3421
|
+
complianceConfig,
|
|
3422
|
+
`/accounts/${accountId}/workers/domains/records/${domain2.id}`
|
|
3423
|
+
), "fetchExistingDomain");
|
|
3424
|
+
let existing;
|
|
3425
|
+
if (process.stdout.isTTY) {
|
|
3426
|
+
existing = await Promise.all(updatesRequired.map(fetchExistingDomain));
|
|
3427
|
+
} else {
|
|
3428
|
+
const results = await Promise.allSettled(
|
|
3429
|
+
previewUpdates.map(fetchExistingDomain)
|
|
3430
|
+
);
|
|
3431
|
+
existing = results.flatMap(
|
|
3432
|
+
(result) => result.status === "fulfilled" ? [result.value] : []
|
|
3433
|
+
);
|
|
3434
|
+
}
|
|
3435
|
+
const existingById = new Map(existing.map((domain2) => [domain2.id, domain2]));
|
|
3436
|
+
const changed = changeset.added.some((domain2) => domain2.previews_enabled === true) || previewUpdates.some((domain2) => {
|
|
3437
|
+
const existingDomain = existingById.get(domain2.id);
|
|
3438
|
+
return existingDomain !== void 0 && (existingDomain.service !== scriptName || existingDomain.previews_enabled !== true);
|
|
3439
|
+
});
|
|
3685
3440
|
const fail = /* @__PURE__ */ __name(() => {
|
|
3686
3441
|
return {
|
|
3687
3442
|
targets: [],
|
|
3443
|
+
changed,
|
|
3688
3444
|
error: new UserError(
|
|
3689
3445
|
domains.length > 1 ? `Publishing to ${domains.length} Custom Domains was skipped, fix conflicts and try again` : `Publishing to Custom Domain "${domains[0].pattern}" was skipped, fix conflict and try again`,
|
|
3690
3446
|
{ telemetryMessage: "deploy custom domains skipped" }
|
|
@@ -3695,37 +3451,20 @@ async function publishCustomDomains(complianceConfig, workerUrl, accountId, doma
|
|
|
3695
3451
|
options.override_existing_origin = true;
|
|
3696
3452
|
options.override_existing_dns_record = true;
|
|
3697
3453
|
} else {
|
|
3698
|
-
const changeset = await fetchResult(
|
|
3699
|
-
complianceConfig,
|
|
3700
|
-
`${workerUrl}/domains/changeset?replace_state=true`,
|
|
3701
|
-
{
|
|
3702
|
-
method: "POST",
|
|
3703
|
-
body: JSON.stringify(origins),
|
|
3704
|
-
headers: {
|
|
3705
|
-
"Content-Type": "application/json"
|
|
3706
|
-
}
|
|
3707
|
-
}
|
|
3708
|
-
);
|
|
3709
|
-
const updatesRequired = changeset.updated.filter(
|
|
3710
|
-
(domain2) => domain2.modified
|
|
3711
|
-
);
|
|
3712
3454
|
if (updatesRequired.length > 0) {
|
|
3713
|
-
const
|
|
3714
|
-
|
|
3715
|
-
(domain2) => fetchResult(
|
|
3716
|
-
complianceConfig,
|
|
3717
|
-
`/accounts/${accountId}/workers/domains/records/${domain2.id}`
|
|
3718
|
-
)
|
|
3719
|
-
)
|
|
3455
|
+
const existingForOtherWorkers = existing.filter(
|
|
3456
|
+
(domain2) => domain2.service !== scriptName
|
|
3720
3457
|
);
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3458
|
+
if (existingForOtherWorkers.length > 0) {
|
|
3459
|
+
const existingRendered = existingForOtherWorkers.map(
|
|
3460
|
+
(domain2) => ` \u2022 ${domain2.hostname} (used as a domain for "${domain2.service}")`
|
|
3461
|
+
).join("\n");
|
|
3462
|
+
const message = `Custom Domains already exist for these domains:
|
|
3725
3463
|
${existingRendered}
|
|
3726
3464
|
Update them to point to this script instead?`;
|
|
3727
|
-
|
|
3728
|
-
|
|
3465
|
+
if (!await confirm(message)) {
|
|
3466
|
+
return fail();
|
|
3467
|
+
}
|
|
3729
3468
|
}
|
|
3730
3469
|
options.override_existing_origin = true;
|
|
3731
3470
|
}
|
|
@@ -3747,7 +3486,7 @@ Update them to point to this script instead?`;
|
|
|
3747
3486
|
"Content-Type": "application/json"
|
|
3748
3487
|
}
|
|
3749
3488
|
});
|
|
3750
|
-
return { targets: domains.map((domain2) => renderRoute(domain2)) };
|
|
3489
|
+
return { targets: domains.map((domain2) => renderRoute(domain2)), changed };
|
|
3751
3490
|
}
|
|
3752
3491
|
__name(publishCustomDomains, "publishCustomDomains");
|
|
3753
3492
|
async function listQueues(complianceConfig, accountId, page, name) {
|
|
@@ -4217,6 +3956,7 @@ async function registerSubdomain(complianceConfig, accountId, configPath, regist
|
|
|
4217
3956
|
__name(registerSubdomain, "registerSubdomain");
|
|
4218
3957
|
|
|
4219
3958
|
// src/triggers/deploy.ts
|
|
3959
|
+
var PREVIEW_DOMAIN_PROVISIONING_NOTE = "Note: DNS and TLS certificate provisioning for Preview domains may continue after this deploy. If a new Preview URL does not work immediately, wait a few minutes and retry.";
|
|
4220
3960
|
async function triggersDeploy(props) {
|
|
4221
3961
|
const { config: config2, scriptName, routes, crons } = props;
|
|
4222
3962
|
if (props.validated !== true) {
|
|
@@ -4227,7 +3967,7 @@ async function triggersDeploy(props) {
|
|
|
4227
3967
|
return;
|
|
4228
3968
|
}
|
|
4229
3969
|
const { accountId } = props;
|
|
4230
|
-
|
|
3970
|
+
assert5(accountId);
|
|
4231
3971
|
if (props.validated !== true) {
|
|
4232
3972
|
await ensureQueuesExistByConfig(config2, accountId, true, scriptName);
|
|
4233
3973
|
}
|
|
@@ -4348,6 +4088,7 @@ ${dashLink}`, {
|
|
|
4348
4088
|
config2,
|
|
4349
4089
|
workerUrl,
|
|
4350
4090
|
accountId,
|
|
4091
|
+
scriptName,
|
|
4351
4092
|
customDomainsOnly
|
|
4352
4093
|
).then(
|
|
4353
4094
|
(result) => ({ ...result, category: "Custom domains" }),
|
|
@@ -4573,6 +4314,14 @@ ${dashLink}`, {
|
|
|
4573
4314
|
} else {
|
|
4574
4315
|
logger.log("No targets deployed for", workerName, formatTime(deployMs));
|
|
4575
4316
|
}
|
|
4317
|
+
const customDomainDeployment = completedDeployments.find(
|
|
4318
|
+
(deployment) => deployment.category === "Custom domains"
|
|
4319
|
+
);
|
|
4320
|
+
if (customDomainsOnly.some(
|
|
4321
|
+
(domain2) => "previews_enabled" in domain2 && domain2.previews_enabled === true
|
|
4322
|
+
) && customDomainDeployment !== void 0 && customDomainDeployment.changed === true && customDomainDeployment.error === void 0) {
|
|
4323
|
+
logger.log(PREVIEW_DOMAIN_PROVISIONING_NOTE);
|
|
4324
|
+
}
|
|
4576
4325
|
const failedDeployments = completedDeployments.filter(
|
|
4577
4326
|
(deployment) => deployment.error !== void 0
|
|
4578
4327
|
);
|
|
@@ -6028,12 +5777,12 @@ var Mime = class {
|
|
|
6028
5777
|
}
|
|
6029
5778
|
return this;
|
|
6030
5779
|
}
|
|
6031
|
-
getType(
|
|
6032
|
-
if (typeof
|
|
5780
|
+
getType(path10) {
|
|
5781
|
+
if (typeof path10 !== "string")
|
|
6033
5782
|
return null;
|
|
6034
|
-
const last =
|
|
5783
|
+
const last = path10.replace(/^.*[/\\]/s, "").toLowerCase();
|
|
6035
5784
|
const ext = last.replace(/^.*\./s, "").toLowerCase();
|
|
6036
|
-
const hasPath = last.length <
|
|
5785
|
+
const hasPath = last.length < path10.length;
|
|
6037
5786
|
const hasDot = ext.length < last.length - 1;
|
|
6038
5787
|
if (!hasDot && hasPath)
|
|
6039
5788
|
return null;
|
|
@@ -6164,7 +5913,7 @@ var MAX_UPLOAD_ATTEMPTS = 5;
|
|
|
6164
5913
|
var MAX_UPLOAD_GATEWAY_ERRORS = 5;
|
|
6165
5914
|
var MAX_DIFF_LINES = 100;
|
|
6166
5915
|
var syncAssets = /* @__PURE__ */ __name(async (complianceConfig, accountId, assetDirectory, scriptName, dispatchNamespace) => {
|
|
6167
|
-
|
|
5916
|
+
assert5(accountId, "Missing accountId");
|
|
6168
5917
|
logger.info("\u{1F300} Building list of assets...");
|
|
6169
5918
|
const manifest = await buildAssetManifest(assetDirectory);
|
|
6170
5919
|
const url3 = dispatchNamespace ? `/accounts/${accountId}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${scriptName}/assets-upload-session` : `/accounts/${accountId}/workers/scripts/${scriptName}/assets-upload-session`;
|
|
@@ -6741,8 +6490,8 @@ function formatVersions(versions, traffic) {
|
|
|
6741
6490
|
}).join("\n\n");
|
|
6742
6491
|
}
|
|
6743
6492
|
__name(formatVersions, "formatVersions");
|
|
6744
|
-
async function clearRemovedContainerImagesBindings(config2, bindings, workerUrl) {
|
|
6745
|
-
if (
|
|
6493
|
+
async function clearRemovedContainerImagesBindings(config2, durableObjectContainerConfig, bindings, workerUrl) {
|
|
6494
|
+
if (durableObjectContainerConfig.length > 0) {
|
|
6746
6495
|
return;
|
|
6747
6496
|
}
|
|
6748
6497
|
const settings = await fetchResult(
|
|
@@ -6754,13 +6503,12 @@ async function clearRemovedContainerImagesBindings(config2, bindings, workerUrl)
|
|
|
6754
6503
|
}
|
|
6755
6504
|
}
|
|
6756
6505
|
__name(clearRemovedContainerImagesBindings, "clearRemovedContainerImagesBindings");
|
|
6757
|
-
function addContainerImagesBinding(
|
|
6758
|
-
const containers = getDurableObjectContainerApps(config2.containers);
|
|
6506
|
+
function addContainerImagesBinding(durableObjectContainerConfig, bindings, preparedContainerImages, options = {}) {
|
|
6759
6507
|
const shouldInheritExisting = options.preserveExisting && options.workerExists && options.hasExistingBinding;
|
|
6760
6508
|
if (options.preserveExisting && !shouldInheritExisting) {
|
|
6761
6509
|
return;
|
|
6762
6510
|
}
|
|
6763
|
-
if (
|
|
6511
|
+
if (durableObjectContainerConfig.length === 0 && !shouldInheritExisting) {
|
|
6764
6512
|
return;
|
|
6765
6513
|
}
|
|
6766
6514
|
if (bindings[CONTAINER_IMAGES_BINDING] !== void 0) {
|
|
@@ -6778,7 +6526,7 @@ function addContainerImagesBinding(config2, bindings, preparedContainerImages, o
|
|
|
6778
6526
|
bindings[CONTAINER_IMAGES_BINDING] = {
|
|
6779
6527
|
type: "json",
|
|
6780
6528
|
value: Object.fromEntries(
|
|
6781
|
-
|
|
6529
|
+
durableObjectContainerConfig.map((container) => {
|
|
6782
6530
|
const configuredImages = Object.keys(container.images ?? {});
|
|
6783
6531
|
const preparedImages = preparedContainerImages[container.class_name];
|
|
6784
6532
|
if (configuredImages.length > 0 && preparedImages === void 0) {
|
|
@@ -6792,8 +6540,8 @@ function addContainerImagesBinding(config2, bindings, preparedContainerImages, o
|
|
|
6792
6540
|
};
|
|
6793
6541
|
}
|
|
6794
6542
|
__name(addContainerImagesBinding, "addContainerImagesBinding");
|
|
6795
|
-
function getContainerMetadata(
|
|
6796
|
-
|
|
6543
|
+
function getContainerMetadata(containers, preparedContainerImages = {}, options = {}) {
|
|
6544
|
+
return containers?.map((container) => {
|
|
6797
6545
|
if (isDurableObjectContainerApp(container)) {
|
|
6798
6546
|
const configuredImages = Object.keys(container.images ?? {});
|
|
6799
6547
|
const images = preparedContainerImages[container.class_name];
|
|
@@ -6814,11 +6562,10 @@ function getContainerMetadata(config2, preparedContainerImages = {}, options = {
|
|
|
6814
6562
|
class_name: container.class_name
|
|
6815
6563
|
}
|
|
6816
6564
|
};
|
|
6817
|
-
})
|
|
6818
|
-
return config2.containers === void 0 ? void 0 : metadata;
|
|
6565
|
+
});
|
|
6819
6566
|
}
|
|
6820
6567
|
__name(getContainerMetadata, "getContainerMetadata");
|
|
6821
|
-
async function getContainerMetadataForRolloutSkip(config2, {
|
|
6568
|
+
async function getContainerMetadataForRolloutSkip(config2, containers, {
|
|
6822
6569
|
accountId,
|
|
6823
6570
|
scriptName,
|
|
6824
6571
|
dispatchNamespace,
|
|
@@ -6827,7 +6574,7 @@ async function getContainerMetadataForRolloutSkip(config2, {
|
|
|
6827
6574
|
dryRun = false
|
|
6828
6575
|
}) {
|
|
6829
6576
|
const configuredMetadata = getContainerMetadata(
|
|
6830
|
-
|
|
6577
|
+
containers,
|
|
6831
6578
|
{},
|
|
6832
6579
|
{
|
|
6833
6580
|
allowUnprepared: true
|
|
@@ -6914,6 +6661,355 @@ function deployWfpUserWorker(dispatchNamespace, versionId) {
|
|
|
6914
6661
|
logger.log("Current Version ID:", versionId);
|
|
6915
6662
|
}
|
|
6916
6663
|
__name(deployWfpUserWorker, "deployWfpUserWorker");
|
|
6664
|
+
var IMAGE_PREPARATION_POLL_INTERVAL_MS = 2e3;
|
|
6665
|
+
var IMAGE_PREPARATION_TIMEOUT_MS = 15 * 6e4;
|
|
6666
|
+
function isRegistryImage(image) {
|
|
6667
|
+
return typeof image.image === "string";
|
|
6668
|
+
}
|
|
6669
|
+
__name(isRegistryImage, "isRegistryImage");
|
|
6670
|
+
function toCreateApplicationRequest({ name }, namespaceId) {
|
|
6671
|
+
return {
|
|
6672
|
+
name,
|
|
6673
|
+
scheduling_policy: SchedulingPolicy.DURABLE_OBJECT,
|
|
6674
|
+
durable_objects: { namespace_id: namespaceId }
|
|
6675
|
+
};
|
|
6676
|
+
}
|
|
6677
|
+
__name(toCreateApplicationRequest, "toCreateApplicationRequest");
|
|
6678
|
+
async function createDurableObjectContainerApplication(application, namespaceId) {
|
|
6679
|
+
await ApplicationsService.createApplication(
|
|
6680
|
+
toCreateApplicationRequest(application, namespaceId)
|
|
6681
|
+
);
|
|
6682
|
+
}
|
|
6683
|
+
__name(createDurableObjectContainerApplication, "createDurableObjectContainerApplication");
|
|
6684
|
+
function getContainerImageClasses(version2) {
|
|
6685
|
+
const binding = version2.resources.bindings.find(
|
|
6686
|
+
(candidate) => candidate.name === CONTAINER_IMAGES_BINDING
|
|
6687
|
+
);
|
|
6688
|
+
if (binding === void 0) {
|
|
6689
|
+
return void 0;
|
|
6690
|
+
}
|
|
6691
|
+
if (binding.type !== "json" || typeof binding.json !== "object" || binding.json === null || Array.isArray(binding.json)) {
|
|
6692
|
+
throw new UserError(
|
|
6693
|
+
`Worker Version ${version2.id} has invalid ${CONTAINER_IMAGES_BINDING} metadata.`,
|
|
6694
|
+
{
|
|
6695
|
+
telemetryMessage: "versions deploy invalid durable object container image binding"
|
|
6696
|
+
}
|
|
6697
|
+
);
|
|
6698
|
+
}
|
|
6699
|
+
return new Set(Object.keys(binding.json));
|
|
6700
|
+
}
|
|
6701
|
+
__name(getContainerImageClasses, "getContainerImageClasses");
|
|
6702
|
+
function getNamespaceId(version2, scriptName, className) {
|
|
6703
|
+
const binding = version2.resources.bindings.find(
|
|
6704
|
+
(candidate) => candidate.type === "durable_object_namespace" && candidate.class_name === className && (candidate.script_name === void 0 || candidate.script_name === scriptName)
|
|
6705
|
+
);
|
|
6706
|
+
return binding?.type === "durable_object_namespace" ? binding.namespace_id : void 0;
|
|
6707
|
+
}
|
|
6708
|
+
__name(getNamespaceId, "getNamespaceId");
|
|
6709
|
+
function getDurableObjectContainerApplicationsFromVersion(version2, scriptName) {
|
|
6710
|
+
const containerClasses = getContainerImageClasses(version2);
|
|
6711
|
+
if (containerClasses === void 0) {
|
|
6712
|
+
return [];
|
|
6713
|
+
}
|
|
6714
|
+
const containers = version2.resources.script_runtime.containers ?? [];
|
|
6715
|
+
return [...containerClasses].sort().map((className) => {
|
|
6716
|
+
const matchingContainers = containers.filter(
|
|
6717
|
+
(container2) => container2.class_name === className
|
|
6718
|
+
);
|
|
6719
|
+
const [container] = matchingContainers;
|
|
6720
|
+
if (matchingContainers.length !== 1 || container?.name === void 0) {
|
|
6721
|
+
throw new UserError(
|
|
6722
|
+
`Worker Version ${version2.id} has invalid Durable Object-managed Container metadata for class "${className}".`,
|
|
6723
|
+
{
|
|
6724
|
+
telemetryMessage: "versions deploy invalid durable object container metadata"
|
|
6725
|
+
}
|
|
6726
|
+
);
|
|
6727
|
+
}
|
|
6728
|
+
return {
|
|
6729
|
+
class_name: className,
|
|
6730
|
+
name: container.name,
|
|
6731
|
+
namespaceId: getNamespaceId(version2, scriptName, className)
|
|
6732
|
+
};
|
|
6733
|
+
});
|
|
6734
|
+
}
|
|
6735
|
+
__name(getDurableObjectContainerApplicationsFromVersion, "getDurableObjectContainerApplicationsFromVersion");
|
|
6736
|
+
function getVersionedDurableObjectContainerApplications(versions, scriptName) {
|
|
6737
|
+
const applicationsByVersion = versions.map(
|
|
6738
|
+
(version2) => getDurableObjectContainerApplicationsFromVersion(version2, scriptName)
|
|
6739
|
+
);
|
|
6740
|
+
const [firstApplications = []] = applicationsByVersion;
|
|
6741
|
+
const expectedDefinition = JSON.stringify(
|
|
6742
|
+
firstApplications.map(({ class_name, name }) => ({ class_name, name }))
|
|
6743
|
+
);
|
|
6744
|
+
for (let index = 1; index < applicationsByVersion.length; index++) {
|
|
6745
|
+
const applications = applicationsByVersion[index] ?? [];
|
|
6746
|
+
const definition = JSON.stringify(
|
|
6747
|
+
applications.map(({ class_name, name }) => ({ class_name, name }))
|
|
6748
|
+
);
|
|
6749
|
+
if (definition !== expectedDefinition) {
|
|
6750
|
+
throw new UserError(
|
|
6751
|
+
"All Worker Versions in a multi-version deployment must declare identical Durable Object-managed Container applications.",
|
|
6752
|
+
{
|
|
6753
|
+
telemetryMessage: "versions deploy inconsistent durable object container applications"
|
|
6754
|
+
}
|
|
6755
|
+
);
|
|
6756
|
+
}
|
|
6757
|
+
}
|
|
6758
|
+
return firstApplications.map((application, applicationIndex) => {
|
|
6759
|
+
const namespaceIds = new Set(
|
|
6760
|
+
applicationsByVersion.map((applications) => applications[applicationIndex]?.namespaceId).filter((namespaceId) => Boolean(namespaceId))
|
|
6761
|
+
);
|
|
6762
|
+
if (namespaceIds.size > 1) {
|
|
6763
|
+
throw new UserError(
|
|
6764
|
+
"All Worker Versions in a multi-version deployment must reference the same Durable Object namespaces for their Container applications.",
|
|
6765
|
+
{
|
|
6766
|
+
telemetryMessage: "versions deploy inconsistent durable object container namespaces"
|
|
6767
|
+
}
|
|
6768
|
+
);
|
|
6769
|
+
}
|
|
6770
|
+
return {
|
|
6771
|
+
...application,
|
|
6772
|
+
namespaceId: namespaceIds.values().next().value
|
|
6773
|
+
};
|
|
6774
|
+
});
|
|
6775
|
+
}
|
|
6776
|
+
__name(getVersionedDurableObjectContainerApplications, "getVersionedDurableObjectContainerApplications");
|
|
6777
|
+
async function resolveVersionedDurableObjectContainerApplications(config2, {
|
|
6778
|
+
applications,
|
|
6779
|
+
accountId,
|
|
6780
|
+
scriptName,
|
|
6781
|
+
allowMissingNamespaces = false
|
|
6782
|
+
}) {
|
|
6783
|
+
if (applications.length === 0) {
|
|
6784
|
+
return [];
|
|
6785
|
+
}
|
|
6786
|
+
const namespaces = applications.some(
|
|
6787
|
+
(application) => application.namespaceId === void 0
|
|
6788
|
+
) ? await listDurableObjects(config2, accountId) : [];
|
|
6789
|
+
return applications.map((application) => {
|
|
6790
|
+
const namespaceId = application.namespaceId ?? namespaces.find(
|
|
6791
|
+
(namespace) => namespace.class === application.class_name && namespace.script === scriptName && namespace.preview === void 0 && namespace.dispatch_namespace === void 0
|
|
6792
|
+
)?.id;
|
|
6793
|
+
if (namespaceId === void 0) {
|
|
6794
|
+
if (allowMissingNamespaces) {
|
|
6795
|
+
return application;
|
|
6796
|
+
}
|
|
6797
|
+
throw new UserError(
|
|
6798
|
+
`Could not deploy Durable Object-managed Container application "${application.name}" because class "${application.class_name}" has no namespace after the Worker Version was deployed.`,
|
|
6799
|
+
{
|
|
6800
|
+
telemetryMessage: "versions deploy durable object container namespace missing"
|
|
6801
|
+
}
|
|
6802
|
+
);
|
|
6803
|
+
}
|
|
6804
|
+
return { ...application, namespaceId };
|
|
6805
|
+
});
|
|
6806
|
+
}
|
|
6807
|
+
__name(resolveVersionedDurableObjectContainerApplications, "resolveVersionedDurableObjectContainerApplications");
|
|
6808
|
+
async function deployVersionedDurableObjectContainerApplications(config2, args) {
|
|
6809
|
+
if (args.applications.length === 0) {
|
|
6810
|
+
return;
|
|
6811
|
+
}
|
|
6812
|
+
const applications = await resolveVersionedDurableObjectContainerApplications(
|
|
6813
|
+
config2,
|
|
6814
|
+
args
|
|
6815
|
+
);
|
|
6816
|
+
for (const application of applications) {
|
|
6817
|
+
if (application.namespaceId !== void 0) {
|
|
6818
|
+
await createDurableObjectContainerApplication(
|
|
6819
|
+
application,
|
|
6820
|
+
application.namespaceId
|
|
6821
|
+
);
|
|
6822
|
+
}
|
|
6823
|
+
}
|
|
6824
|
+
}
|
|
6825
|
+
__name(deployVersionedDurableObjectContainerApplications, "deployVersionedDurableObjectContainerApplications");
|
|
6826
|
+
async function buildOrResolveImage(config2, container, imageName, imageConfig, builtImages, dryRun, accountId) {
|
|
6827
|
+
if (isRegistryImage(imageConfig)) {
|
|
6828
|
+
if (dryRun) {
|
|
6829
|
+
return imageConfig.image;
|
|
6830
|
+
}
|
|
6831
|
+
assert5(accountId, "Expected accountId to resolve container image name");
|
|
6832
|
+
return resolveImageName(accountId, imageConfig.image, config2);
|
|
6833
|
+
}
|
|
6834
|
+
const builtImage = builtImages.find(
|
|
6835
|
+
(candidate) => candidate.className === container.class_name && candidate.imageName === imageName
|
|
6836
|
+
);
|
|
6837
|
+
if (builtImage === void 0) {
|
|
6838
|
+
throw new Error(
|
|
6839
|
+
`Container image "${imageName}" for Durable Object class "${container.class_name}" was not built before upload.`
|
|
6840
|
+
);
|
|
6841
|
+
}
|
|
6842
|
+
if (dryRun) {
|
|
6843
|
+
return builtImage.localTag;
|
|
6844
|
+
}
|
|
6845
|
+
try {
|
|
6846
|
+
const imageRef = await pushImageIfChanged({
|
|
6847
|
+
pathToDocker: getDockerPath(),
|
|
6848
|
+
sourceTag: builtImage.localTag,
|
|
6849
|
+
targetTag: builtImage.localTag,
|
|
6850
|
+
accountId,
|
|
6851
|
+
complianceConfig: config2,
|
|
6852
|
+
cleanupSourceTag: true
|
|
6853
|
+
});
|
|
6854
|
+
builtImage.localTagCleaned = true;
|
|
6855
|
+
return "remoteDigest" in imageRef ? imageRef.remoteDigest : imageRef.newTag;
|
|
6856
|
+
} catch (error51) {
|
|
6857
|
+
if (error51 instanceof Error) {
|
|
6858
|
+
throw new UserError(error51.message, {
|
|
6859
|
+
cause: error51,
|
|
6860
|
+
telemetryMessage: "durable object container image push failed"
|
|
6861
|
+
});
|
|
6862
|
+
}
|
|
6863
|
+
throw new UserError("An unknown error occurred", {
|
|
6864
|
+
telemetryMessage: "durable object container image push failed"
|
|
6865
|
+
});
|
|
6866
|
+
}
|
|
6867
|
+
}
|
|
6868
|
+
__name(buildOrResolveImage, "buildOrResolveImage");
|
|
6869
|
+
async function waitForImagePreparation(image) {
|
|
6870
|
+
const deadline = Date.now() + IMAGE_PREPARATION_TIMEOUT_MS;
|
|
6871
|
+
while (Date.now() < deadline) {
|
|
6872
|
+
const preparation = await ContainerImagePreparationsService.prepareContainerImage({ image });
|
|
6873
|
+
switch (preparation.status) {
|
|
6874
|
+
case ContainerImagePreparationStatus.READY:
|
|
6875
|
+
return;
|
|
6876
|
+
case ContainerImagePreparationStatus.ERROR:
|
|
6877
|
+
throw new UserError(
|
|
6878
|
+
preparation.reason ?? "Container image preparation failed",
|
|
6879
|
+
{
|
|
6880
|
+
telemetryMessage: "durable object container image preparation failed"
|
|
6881
|
+
}
|
|
6882
|
+
);
|
|
6883
|
+
case ContainerImagePreparationStatus.PENDING:
|
|
6884
|
+
await setTimeout$1(IMAGE_PREPARATION_POLL_INTERVAL_MS);
|
|
6885
|
+
break;
|
|
6886
|
+
default:
|
|
6887
|
+
throw new UserError(
|
|
6888
|
+
`Container image preparation returned an unsupported status: ${String(preparation.status)}`,
|
|
6889
|
+
{
|
|
6890
|
+
telemetryMessage: "durable object container image preparation unsupported status"
|
|
6891
|
+
}
|
|
6892
|
+
);
|
|
6893
|
+
}
|
|
6894
|
+
}
|
|
6895
|
+
throw new UserError(
|
|
6896
|
+
"Timed out while preparing the container image on Cloudflare's network.",
|
|
6897
|
+
{
|
|
6898
|
+
telemetryMessage: "durable object container image preparation timed out"
|
|
6899
|
+
}
|
|
6900
|
+
);
|
|
6901
|
+
}
|
|
6902
|
+
__name(waitForImagePreparation, "waitForImagePreparation");
|
|
6903
|
+
async function prepareDurableObjectContainerApplications(config2, durableObjectContainerConfig, builtImages, {
|
|
6904
|
+
accountId,
|
|
6905
|
+
dryRun,
|
|
6906
|
+
scriptName,
|
|
6907
|
+
dispatchNamespace
|
|
6908
|
+
}) {
|
|
6909
|
+
validateDurableObjectContainerApplications(
|
|
6910
|
+
config2,
|
|
6911
|
+
durableObjectContainerConfig
|
|
6912
|
+
);
|
|
6913
|
+
if (!dryRun) {
|
|
6914
|
+
assert5(accountId, "Expected accountId to prepare container applications");
|
|
6915
|
+
const storageByClass = getDurableObjectClassNameToUseSQLiteMap(
|
|
6916
|
+
config2.migrations,
|
|
6917
|
+
config2.exports
|
|
6918
|
+
);
|
|
6919
|
+
const unknownStorage = durableObjectContainerConfig.filter(
|
|
6920
|
+
(container) => storageByClass.get(container.class_name) === void 0
|
|
6921
|
+
);
|
|
6922
|
+
if (unknownStorage.length > 0) {
|
|
6923
|
+
const namespaces = await listDurableObjects(config2, accountId);
|
|
6924
|
+
for (const container of unknownStorage) {
|
|
6925
|
+
if (namespaces.some(
|
|
6926
|
+
(namespace) => namespace.class === container.class_name && namespace.script === scriptName && namespace.preview === void 0 && namespace.dispatch_namespace === dispatchNamespace && namespace.use_sqlite === false
|
|
6927
|
+
)) {
|
|
6928
|
+
throw new UserError(
|
|
6929
|
+
`The container ${container.name} references Durable Object class ${container.class_name}, which uses the legacy KV storage backend. Durable Object-managed Containers require SQLite-backed Durable Objects.`,
|
|
6930
|
+
{
|
|
6931
|
+
telemetryMessage: "durable object container class uses legacy storage"
|
|
6932
|
+
}
|
|
6933
|
+
);
|
|
6934
|
+
}
|
|
6935
|
+
}
|
|
6936
|
+
}
|
|
6937
|
+
}
|
|
6938
|
+
const containers = durableObjectContainerConfig.filter(
|
|
6939
|
+
(container) => Object.keys(container.images ?? {}).length > 0
|
|
6940
|
+
);
|
|
6941
|
+
if (containers.length === 0) {
|
|
6942
|
+
return {};
|
|
6943
|
+
}
|
|
6944
|
+
const imagesByClass = [];
|
|
6945
|
+
const preparedImages = /* @__PURE__ */ new Map();
|
|
6946
|
+
for (const container of containers) {
|
|
6947
|
+
const classImages = [];
|
|
6948
|
+
for (const [imageName, imageConfig] of Object.entries(
|
|
6949
|
+
container.images ?? {}
|
|
6950
|
+
)) {
|
|
6951
|
+
const source = isRegistryImage(imageConfig) ? `image:${imageConfig.image}` : `dockerfile:${path__default.resolve(
|
|
6952
|
+
config2.configPath ? path__default.dirname(config2.configPath) : process.cwd(),
|
|
6953
|
+
imageConfig.dockerfile
|
|
6954
|
+
)}`;
|
|
6955
|
+
let image = preparedImages.get(source);
|
|
6956
|
+
if (image === void 0) {
|
|
6957
|
+
image = await buildOrResolveImage(
|
|
6958
|
+
config2,
|
|
6959
|
+
container,
|
|
6960
|
+
imageName,
|
|
6961
|
+
imageConfig,
|
|
6962
|
+
builtImages,
|
|
6963
|
+
dryRun,
|
|
6964
|
+
accountId
|
|
6965
|
+
);
|
|
6966
|
+
if (!dryRun) {
|
|
6967
|
+
const imageLine = ` ${image}`;
|
|
6968
|
+
updateStatus(
|
|
6969
|
+
`Preparing ${imageName} for Cloudflare Containers
|
|
6970
|
+
${imageLine}`
|
|
6971
|
+
);
|
|
6972
|
+
await waitForImagePreparation(image);
|
|
6973
|
+
updateStatus(`${imageName} is ready to run
|
|
6974
|
+
${imageLine}`);
|
|
6975
|
+
}
|
|
6976
|
+
preparedImages.set(source, image);
|
|
6977
|
+
}
|
|
6978
|
+
classImages.push([imageName, image]);
|
|
6979
|
+
}
|
|
6980
|
+
imagesByClass.push([container.class_name, Object.fromEntries(classImages)]);
|
|
6981
|
+
}
|
|
6982
|
+
return Object.fromEntries(imagesByClass);
|
|
6983
|
+
}
|
|
6984
|
+
__name(prepareDurableObjectContainerApplications, "prepareDurableObjectContainerApplications");
|
|
6985
|
+
async function deployDurableObjectContainerApplications(config2, durableObjectContainerConfig, {
|
|
6986
|
+
versionId,
|
|
6987
|
+
accountId,
|
|
6988
|
+
scriptName,
|
|
6989
|
+
dispatchNamespace
|
|
6990
|
+
}) {
|
|
6991
|
+
const containers = durableObjectContainerConfig;
|
|
6992
|
+
if (containers.length === 0) {
|
|
6993
|
+
return;
|
|
6994
|
+
}
|
|
6995
|
+
const resolveNamespaceId = createDurableObjectNamespaceResolver(config2, {
|
|
6996
|
+
versionId,
|
|
6997
|
+
accountId,
|
|
6998
|
+
scriptName,
|
|
6999
|
+
dispatchNamespace
|
|
7000
|
+
});
|
|
7001
|
+
const applications = [];
|
|
7002
|
+
for (const container of containers) {
|
|
7003
|
+
applications.push({
|
|
7004
|
+
container,
|
|
7005
|
+
namespaceId: await resolveNamespaceId(container.class_name)
|
|
7006
|
+
});
|
|
7007
|
+
}
|
|
7008
|
+
for (const { container, namespaceId } of applications) {
|
|
7009
|
+
await createDurableObjectContainerApplication(container, namespaceId);
|
|
7010
|
+
}
|
|
7011
|
+
}
|
|
7012
|
+
__name(deployDurableObjectContainerApplications, "deployDurableObjectContainerApplications");
|
|
6917
7013
|
function hasDefinedEnvironments(config2) {
|
|
6918
7014
|
return Boolean(config2.definedEnvironments?.length);
|
|
6919
7015
|
}
|
|
@@ -6953,7 +7049,7 @@ function tagsAreEqual(a, b) {
|
|
|
6953
7049
|
__name(tagsAreEqual, "tagsAreEqual");
|
|
6954
7050
|
async function getMigrationsToUpload(scriptName, props) {
|
|
6955
7051
|
const { config: config2, accountId } = props;
|
|
6956
|
-
|
|
7052
|
+
assert5(accountId, "Missing accountId");
|
|
6957
7053
|
let migrations;
|
|
6958
7054
|
if (config2.migrations.length > 0) {
|
|
6959
7055
|
let script;
|
|
@@ -7560,7 +7656,7 @@ var R2Handler = class extends ProvisionResourceHandler {
|
|
|
7560
7656
|
);
|
|
7561
7657
|
}
|
|
7562
7658
|
async isConnectedToExistingResource() {
|
|
7563
|
-
|
|
7659
|
+
assert5(typeof this.binding.bucket_name !== "symbol");
|
|
7564
7660
|
if (!this.binding.bucket_name) {
|
|
7565
7661
|
return false;
|
|
7566
7662
|
}
|
|
@@ -7607,7 +7703,7 @@ var AISearchNamespaceHandler = class extends ProvisionResourceHandler {
|
|
|
7607
7703
|
);
|
|
7608
7704
|
}
|
|
7609
7705
|
async isConnectedToExistingResource() {
|
|
7610
|
-
|
|
7706
|
+
assert5(typeof this.binding.namespace !== "symbol");
|
|
7611
7707
|
if (!this.binding.namespace) {
|
|
7612
7708
|
return false;
|
|
7613
7709
|
}
|
|
@@ -7650,7 +7746,7 @@ var AgentMemoryNamespaceHandler = class extends ProvisionResourceHandler {
|
|
|
7650
7746
|
);
|
|
7651
7747
|
}
|
|
7652
7748
|
async isConnectedToExistingResource() {
|
|
7653
|
-
|
|
7749
|
+
assert5(typeof this.binding.namespace !== "symbol");
|
|
7654
7750
|
if (!this.binding.namespace) {
|
|
7655
7751
|
return false;
|
|
7656
7752
|
}
|
|
@@ -7705,7 +7801,7 @@ var QueueHandler = class extends ProvisionResourceHandler {
|
|
|
7705
7801
|
return true;
|
|
7706
7802
|
}
|
|
7707
7803
|
async isConnectedToExistingResource() {
|
|
7708
|
-
|
|
7804
|
+
assert5(typeof this.binding.queue_name !== "symbol");
|
|
7709
7805
|
if (!this.binding.queue_name) {
|
|
7710
7806
|
return false;
|
|
7711
7807
|
}
|
|
@@ -7761,7 +7857,7 @@ var DispatchNamespaceHandler = class extends ProvisionResourceHandler {
|
|
|
7761
7857
|
return true;
|
|
7762
7858
|
}
|
|
7763
7859
|
async isConnectedToExistingResource() {
|
|
7764
|
-
|
|
7860
|
+
assert5(typeof this.binding.namespace !== "symbol");
|
|
7765
7861
|
if (!this.binding.namespace) {
|
|
7766
7862
|
return false;
|
|
7767
7863
|
}
|
|
@@ -7886,7 +7982,7 @@ var D1Handler = class extends ProvisionResourceHandler {
|
|
|
7886
7982
|
return false;
|
|
7887
7983
|
}
|
|
7888
7984
|
async isConnectedToExistingResource() {
|
|
7889
|
-
|
|
7985
|
+
assert5(typeof this.binding.database_name !== "symbol");
|
|
7890
7986
|
if (!this.binding.database_name) {
|
|
7891
7987
|
return false;
|
|
7892
7988
|
}
|
|
@@ -8271,7 +8367,7 @@ async function provisionBindings(bindings, accountId, scriptName, autoCreate, co
|
|
|
8271
8367
|
const configPath = config2.userConfigPath ?? config2.configPath;
|
|
8272
8368
|
const { pendingResources, skippedProvisioning } = await collectPendingResources(config2, accountId, scriptName, bindings);
|
|
8273
8369
|
if (pendingResources.length > 0) {
|
|
8274
|
-
|
|
8370
|
+
assert5(
|
|
8275
8371
|
configPath,
|
|
8276
8372
|
"Provisioning resources is not possible without a config file"
|
|
8277
8373
|
);
|
|
@@ -8287,7 +8383,6 @@ async function provisionBindings(bindings, accountId, scriptName, autoCreate, co
|
|
|
8287
8383
|
log: logger.log,
|
|
8288
8384
|
tailConsumers: config2.tail_consumers,
|
|
8289
8385
|
streamingTailConsumers: config2.streaming_tail_consumers,
|
|
8290
|
-
containers: config2.containers,
|
|
8291
8386
|
provisioning: true
|
|
8292
8387
|
}
|
|
8293
8388
|
);
|
|
@@ -9368,7 +9463,7 @@ __export(util_exports, {
|
|
|
9368
9463
|
NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
|
|
9369
9464
|
aborted: () => aborted,
|
|
9370
9465
|
allowsEval: () => allowsEval,
|
|
9371
|
-
assert: () =>
|
|
9466
|
+
assert: () => assert6,
|
|
9372
9467
|
assertEqual: () => assertEqual,
|
|
9373
9468
|
assertIs: () => assertIs,
|
|
9374
9469
|
assertNever: () => assertNever,
|
|
@@ -9442,9 +9537,9 @@ function assertNever(_x) {
|
|
|
9442
9537
|
throw new Error("Unexpected value in exhaustive check");
|
|
9443
9538
|
}
|
|
9444
9539
|
__name(assertNever, "assertNever");
|
|
9445
|
-
function
|
|
9540
|
+
function assert6(_) {
|
|
9446
9541
|
}
|
|
9447
|
-
__name(
|
|
9542
|
+
__name(assert6, "assert");
|
|
9448
9543
|
function getEnumValues(entries) {
|
|
9449
9544
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
9450
9545
|
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
@@ -9542,10 +9637,10 @@ function cloneDef(schema) {
|
|
|
9542
9637
|
return mergeDefs(schema._zod.def);
|
|
9543
9638
|
}
|
|
9544
9639
|
__name(cloneDef, "cloneDef");
|
|
9545
|
-
function getElementAtPath(obj,
|
|
9546
|
-
if (!
|
|
9640
|
+
function getElementAtPath(obj, path10) {
|
|
9641
|
+
if (!path10)
|
|
9547
9642
|
return obj;
|
|
9548
|
-
return
|
|
9643
|
+
return path10.reduce((acc, key) => acc?.[key], obj);
|
|
9549
9644
|
}
|
|
9550
9645
|
__name(getElementAtPath, "getElementAtPath");
|
|
9551
9646
|
function promiseAllObject(promisesObj) {
|
|
@@ -9978,11 +10073,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
9978
10073
|
return false;
|
|
9979
10074
|
}
|
|
9980
10075
|
__name(explicitlyAborted, "explicitlyAborted");
|
|
9981
|
-
function prefixIssues(
|
|
10076
|
+
function prefixIssues(path10, issues) {
|
|
9982
10077
|
return issues.map((iss) => {
|
|
9983
10078
|
var _a3;
|
|
9984
10079
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
9985
|
-
iss.path.unshift(
|
|
10080
|
+
iss.path.unshift(path10);
|
|
9986
10081
|
return iss;
|
|
9987
10082
|
});
|
|
9988
10083
|
}
|
|
@@ -10147,16 +10242,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
10147
10242
|
__name(flattenError, "flattenError");
|
|
10148
10243
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
10149
10244
|
const fieldErrors = { _errors: [] };
|
|
10150
|
-
const processError = /* @__PURE__ */ __name((error52,
|
|
10245
|
+
const processError = /* @__PURE__ */ __name((error52, path10 = []) => {
|
|
10151
10246
|
for (const issue2 of error52.issues) {
|
|
10152
10247
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
10153
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
10248
|
+
issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
|
|
10154
10249
|
} else if (issue2.code === "invalid_key") {
|
|
10155
|
-
processError({ issues: issue2.issues }, [...
|
|
10250
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
10156
10251
|
} else if (issue2.code === "invalid_element") {
|
|
10157
|
-
processError({ issues: issue2.issues }, [...
|
|
10252
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
10158
10253
|
} else {
|
|
10159
|
-
const fullpath = [...
|
|
10254
|
+
const fullpath = [...path10, ...issue2.path];
|
|
10160
10255
|
if (fullpath.length === 0) {
|
|
10161
10256
|
fieldErrors._errors.push(mapper(issue2));
|
|
10162
10257
|
} else {
|
|
@@ -10184,17 +10279,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
10184
10279
|
__name(formatError, "formatError");
|
|
10185
10280
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
10186
10281
|
const result = { errors: [] };
|
|
10187
|
-
const processError = /* @__PURE__ */ __name((error52,
|
|
10282
|
+
const processError = /* @__PURE__ */ __name((error52, path10 = []) => {
|
|
10188
10283
|
var _a3, _b;
|
|
10189
10284
|
for (const issue2 of error52.issues) {
|
|
10190
10285
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
10191
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
10286
|
+
issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
|
|
10192
10287
|
} else if (issue2.code === "invalid_key") {
|
|
10193
|
-
processError({ issues: issue2.issues }, [...
|
|
10288
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
10194
10289
|
} else if (issue2.code === "invalid_element") {
|
|
10195
|
-
processError({ issues: issue2.issues }, [...
|
|
10290
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
10196
10291
|
} else {
|
|
10197
|
-
const fullpath = [...
|
|
10292
|
+
const fullpath = [...path10, ...issue2.path];
|
|
10198
10293
|
if (fullpath.length === 0) {
|
|
10199
10294
|
result.errors.push(mapper(issue2));
|
|
10200
10295
|
continue;
|
|
@@ -10227,8 +10322,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
10227
10322
|
__name(treeifyError, "treeifyError");
|
|
10228
10323
|
function toDotPath(_path) {
|
|
10229
10324
|
const segs = [];
|
|
10230
|
-
const
|
|
10231
|
-
for (const seg of
|
|
10325
|
+
const path10 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
10326
|
+
for (const seg of path10) {
|
|
10232
10327
|
if (typeof seg === "number")
|
|
10233
10328
|
segs.push(`[${seg}]`);
|
|
10234
10329
|
else if (typeof seg === "symbol")
|
|
@@ -23284,13 +23379,13 @@ function resolveRef(ref, ctx) {
|
|
|
23284
23379
|
if (!ref.startsWith("#")) {
|
|
23285
23380
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
23286
23381
|
}
|
|
23287
|
-
const
|
|
23288
|
-
if (
|
|
23382
|
+
const path10 = ref.slice(1).split("/").filter(Boolean);
|
|
23383
|
+
if (path10.length === 0) {
|
|
23289
23384
|
return ctx.rootSchema;
|
|
23290
23385
|
}
|
|
23291
23386
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
23292
|
-
if (
|
|
23293
|
-
const key =
|
|
23387
|
+
if (path10[0] === defsKey) {
|
|
23388
|
+
const key = path10[1];
|
|
23294
23389
|
if (!key || !ctx.defs[key]) {
|
|
23295
23390
|
throw new Error(`Reference not found: ${ref}`);
|
|
23296
23391
|
}
|
|
@@ -23820,12 +23915,12 @@ function getSourceMappingPrepareStackTrace(retrieveSourceMap) {
|
|
|
23820
23915
|
// Make sure we're using fresh copies of files each time we source map
|
|
23821
23916
|
emptyCacheBetweenOperations: true,
|
|
23822
23917
|
// Allow retriever to be overridden at prepare stack trace time
|
|
23823
|
-
retrieveSourceMap(
|
|
23824
|
-
return retrieveSourceMapOverride?.(
|
|
23918
|
+
retrieveSourceMap(path10) {
|
|
23919
|
+
return retrieveSourceMapOverride?.(path10) ?? null;
|
|
23825
23920
|
}
|
|
23826
23921
|
});
|
|
23827
23922
|
sourceMappingPrepareStackTrace = Error.prepareStackTrace;
|
|
23828
|
-
|
|
23923
|
+
assert5(sourceMappingPrepareStackTrace !== void 0);
|
|
23829
23924
|
Error.prepareStackTrace = originalPrepareStackTrace;
|
|
23830
23925
|
return sourceMappingPrepareStackTrace;
|
|
23831
23926
|
}
|
|
@@ -23887,7 +23982,7 @@ function getSourceMappedString(value, retrieveSourceMap) {
|
|
|
23887
23982
|
}
|
|
23888
23983
|
const callSiteLine = callSiteLines[i][0];
|
|
23889
23984
|
const callSiteAtIndex = callSiteLine.indexOf("at");
|
|
23890
|
-
|
|
23985
|
+
assert5(callSiteAtIndex !== -1);
|
|
23891
23986
|
const callSiteLineLeftPad = callSiteLine.substring(0, callSiteAtIndex);
|
|
23892
23987
|
value = value.replace(
|
|
23893
23988
|
callSiteLine,
|
|
@@ -24607,10 +24702,10 @@ function populateConfigPatch(diff, patchObj, targetEnvironment) {
|
|
|
24607
24702
|
return;
|
|
24608
24703
|
}
|
|
24609
24704
|
if (Array.isArray(diff)) {
|
|
24610
|
-
|
|
24705
|
+
assert5(Array.isArray(patchObj));
|
|
24611
24706
|
return populateConfigPatchArray(diff, patchObj);
|
|
24612
24707
|
}
|
|
24613
|
-
|
|
24708
|
+
assert5(!Array.isArray(patchObj));
|
|
24614
24709
|
return populateConfigPatchObject(diff, patchObj, targetEnvironment);
|
|
24615
24710
|
}
|
|
24616
24711
|
__name(populateConfigPatch, "populateConfigPatch");
|
|
@@ -24944,7 +25039,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
24944
25039
|
if (props.command === "deploy") {
|
|
24945
25040
|
validateEventTriggerTargets(config2, name);
|
|
24946
25041
|
validateRoutes(props.routes, props.assetsOptions);
|
|
24947
|
-
|
|
25042
|
+
assert5(
|
|
24948
25043
|
!config2.site || config2.site.bucket,
|
|
24949
25044
|
"A [site] definition requires a `bucket` field with a path to the site's assets directory."
|
|
24950
25045
|
);
|
|
@@ -24955,7 +25050,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
24955
25050
|
);
|
|
24956
25051
|
}
|
|
24957
25052
|
} else {
|
|
24958
|
-
if (
|
|
25053
|
+
if (props.containers.source?.some(
|
|
24959
25054
|
(container) => !isDurableObjectContainerApp(container)
|
|
24960
25055
|
)) {
|
|
24961
25056
|
logger.warn(
|
|
@@ -25185,7 +25280,12 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
25185
25280
|
}
|
|
25186
25281
|
}
|
|
25187
25282
|
const isDryRun = props.dryRun;
|
|
25188
|
-
const normalisedContainerConfig =
|
|
25283
|
+
const normalisedContainerConfig = props.containers.standard.normalized;
|
|
25284
|
+
const builtContainerImages = props.containers.standard.builtImages;
|
|
25285
|
+
const durableObjectContainerConfig = getDurableObjectContainerApps(
|
|
25286
|
+
props.containers.source
|
|
25287
|
+
);
|
|
25288
|
+
const shouldDeployContainers = normalisedContainerConfig.length > 0 && props.containersRollout !== "none";
|
|
25189
25289
|
const {
|
|
25190
25290
|
modules,
|
|
25191
25291
|
dependencies,
|
|
@@ -25195,20 +25295,30 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
25195
25295
|
sourceMaps
|
|
25196
25296
|
} = buildResult;
|
|
25197
25297
|
const skipContainerChanges = props.containersRollout === "none";
|
|
25198
|
-
const preparedContainerImages = skipContainerChanges ? void 0 : await
|
|
25199
|
-
|
|
25200
|
-
|
|
25201
|
-
|
|
25202
|
-
|
|
25203
|
-
|
|
25204
|
-
|
|
25205
|
-
|
|
25206
|
-
|
|
25207
|
-
|
|
25208
|
-
|
|
25209
|
-
|
|
25210
|
-
|
|
25211
|
-
|
|
25298
|
+
const preparedContainerImages = skipContainerChanges ? void 0 : await prepareDurableObjectContainerApplications(
|
|
25299
|
+
config2,
|
|
25300
|
+
durableObjectContainerConfig,
|
|
25301
|
+
props.containers.durableObjects.builtImages,
|
|
25302
|
+
{
|
|
25303
|
+
accountId,
|
|
25304
|
+
dryRun: Boolean(isDryRun),
|
|
25305
|
+
scriptName,
|
|
25306
|
+
dispatchNamespace: props.dispatchNamespace
|
|
25307
|
+
}
|
|
25308
|
+
);
|
|
25309
|
+
const rolloutSkipContainerState = skipContainerChanges ? await getContainerMetadataForRolloutSkip(
|
|
25310
|
+
config2,
|
|
25311
|
+
props.containers.source,
|
|
25312
|
+
{
|
|
25313
|
+
accountId,
|
|
25314
|
+
scriptName,
|
|
25315
|
+
dispatchNamespace: props.dispatchNamespace,
|
|
25316
|
+
workerExists,
|
|
25317
|
+
latestDeployment,
|
|
25318
|
+
dryRun: isDryRun
|
|
25319
|
+
}
|
|
25320
|
+
) : void 0;
|
|
25321
|
+
const containerMetadata = rolloutSkipContainerState ? rolloutSkipContainerState.containers : getContainerMetadata(props.containers.source, preparedContainerImages);
|
|
25212
25322
|
const { migrations, exports: exports$1 } = await resolveExportsUploadPayload({
|
|
25213
25323
|
scriptName,
|
|
25214
25324
|
isDryRun,
|
|
@@ -25263,13 +25373,23 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
25263
25373
|
workerExists
|
|
25264
25374
|
});
|
|
25265
25375
|
if (!skipContainerChanges && keepVars && !isDryRun && workerExists) {
|
|
25266
|
-
await clearRemovedContainerImagesBindings(
|
|
25376
|
+
await clearRemovedContainerImagesBindings(
|
|
25377
|
+
config2,
|
|
25378
|
+
durableObjectContainerConfig,
|
|
25379
|
+
bindings,
|
|
25380
|
+
workerUrl
|
|
25381
|
+
);
|
|
25267
25382
|
}
|
|
25268
|
-
addContainerImagesBinding(
|
|
25269
|
-
|
|
25270
|
-
|
|
25271
|
-
|
|
25272
|
-
|
|
25383
|
+
addContainerImagesBinding(
|
|
25384
|
+
durableObjectContainerConfig,
|
|
25385
|
+
bindings,
|
|
25386
|
+
preparedContainerImages ?? {},
|
|
25387
|
+
{
|
|
25388
|
+
preserveExisting: skipContainerChanges,
|
|
25389
|
+
workerExists,
|
|
25390
|
+
hasExistingBinding: rolloutSkipContainerState?.hasExistingContainerImagesBinding
|
|
25391
|
+
}
|
|
25392
|
+
);
|
|
25273
25393
|
if (workersSitesAssets.manifest) {
|
|
25274
25394
|
modules.push({
|
|
25275
25395
|
name: "__STATIC_CONTENT_MANIFEST",
|
|
@@ -25328,37 +25448,11 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
25328
25448
|
);
|
|
25329
25449
|
const bundleSize = await getSize([...modules, { content }]);
|
|
25330
25450
|
printBundleSize(bundleSize);
|
|
25331
|
-
const canUseNewVersionsDeploymentsApi = workerExists && props.dispatchNamespace === void 0 && format === "modules" && migrations === void 0 && !hasDurableObjectExports(config2.exports) && !config2.first_party_worker &&
|
|
25451
|
+
const canUseNewVersionsDeploymentsApi = workerExists && props.dispatchNamespace === void 0 && format === "modules" && migrations === void 0 && !hasDurableObjectExports(config2.exports) && !config2.first_party_worker && props.containers.source === void 0 && // Rollout skip can recover Container metadata absent from local config.
|
|
25332
25452
|
containerMetadata === void 0;
|
|
25333
25453
|
let workerBundle;
|
|
25334
25454
|
const dockerPath = getDockerPath();
|
|
25335
|
-
if (normalisedContainerConfig.length && props.containersRollout !== "none") {
|
|
25336
|
-
const containersWithDockerfile = normalisedContainerConfig.filter(
|
|
25337
|
-
(container) => "dockerfile" in container
|
|
25338
|
-
);
|
|
25339
|
-
if (containersWithDockerfile.length > 0) {
|
|
25340
|
-
await verifyDockerInstalled({
|
|
25341
|
-
dockerPath,
|
|
25342
|
-
operation: `deploying${isDryRun ? " (even in dry-run mode)" : ""}`,
|
|
25343
|
-
imageNoun: containersWithDockerfile.length !== 1 ? "the configured images" : "the configured image",
|
|
25344
|
-
hint: "If you cannot run Docker locally, you can still deploy your Worker by passing --containers-rollout=none. This will not deploy or update your Container."
|
|
25345
|
-
});
|
|
25346
|
-
}
|
|
25347
|
-
}
|
|
25348
25455
|
if (isDryRun) {
|
|
25349
|
-
if (normalisedContainerConfig.length) {
|
|
25350
|
-
for (const container of normalisedContainerConfig) {
|
|
25351
|
-
if ("dockerfile" in container && props.containersRollout !== "none" && callbacks.buildContainer) {
|
|
25352
|
-
await callbacks.buildContainer(
|
|
25353
|
-
container,
|
|
25354
|
-
workerTag ?? "worker-tag",
|
|
25355
|
-
isDryRun,
|
|
25356
|
-
dockerPath,
|
|
25357
|
-
false
|
|
25358
|
-
);
|
|
25359
|
-
}
|
|
25360
|
-
}
|
|
25361
|
-
}
|
|
25362
25456
|
workerBundle = createWorkerUploadForm(
|
|
25363
25457
|
worker,
|
|
25364
25458
|
addWorkersSitesBindings(
|
|
@@ -25376,12 +25470,12 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
25376
25470
|
log: logger.log,
|
|
25377
25471
|
tailConsumers: config2.tail_consumers,
|
|
25378
25472
|
streamingTailConsumers: config2.streaming_tail_consumers,
|
|
25379
|
-
containers:
|
|
25473
|
+
containers: props.containers.source,
|
|
25380
25474
|
warnIfNoBindings: true,
|
|
25381
25475
|
unsafeMetadata: config2.unsafe?.metadata
|
|
25382
25476
|
});
|
|
25383
25477
|
} else {
|
|
25384
|
-
|
|
25478
|
+
assert5(accountId, "Missing accountId");
|
|
25385
25479
|
let provisionBindingsResult;
|
|
25386
25480
|
if (assetsOptions?.routerConfig.has_user_worker === false) {
|
|
25387
25481
|
logger.debug("skipping provisioning on assets-only project");
|
|
@@ -25511,7 +25605,7 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
25511
25605
|
log: logger.log,
|
|
25512
25606
|
tailConsumers: config2.tail_consumers,
|
|
25513
25607
|
streamingTailConsumers: config2.streaming_tail_consumers,
|
|
25514
|
-
containers:
|
|
25608
|
+
containers: props.containers.source,
|
|
25515
25609
|
unsafeMetadata: config2.unsafe?.metadata
|
|
25516
25610
|
});
|
|
25517
25611
|
provisionBindingsResult?.warnOnSkippedProvisioning();
|
|
@@ -25539,7 +25633,7 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
25539
25633
|
log: logger.log,
|
|
25540
25634
|
tailConsumers: config2.tail_consumers,
|
|
25541
25635
|
streamingTailConsumers: config2.streaming_tail_consumers,
|
|
25542
|
-
containers:
|
|
25636
|
+
containers: props.containers.source,
|
|
25543
25637
|
unsafeMetadata: config2.unsafe?.metadata
|
|
25544
25638
|
});
|
|
25545
25639
|
}
|
|
@@ -25603,24 +25697,56 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
25603
25697
|
}
|
|
25604
25698
|
const uploadMs = Date.now() - start;
|
|
25605
25699
|
logger.log("Uploaded", workerName, formatTime(uploadMs));
|
|
25606
|
-
if (
|
|
25607
|
-
|
|
25608
|
-
|
|
25700
|
+
if (shouldDeployContainers) {
|
|
25701
|
+
assert5(versionId && accountId);
|
|
25702
|
+
initContainersSharedContext({ logger, fetchPagedListResult, fetchResult });
|
|
25703
|
+
const containerDeployments = [];
|
|
25704
|
+
for (const container of normalisedContainerConfig) {
|
|
25705
|
+
if ("dockerfile" in container) {
|
|
25706
|
+
const builtImage = builtContainerImages.find(
|
|
25707
|
+
(image) => image.container === container
|
|
25708
|
+
);
|
|
25709
|
+
assert5(
|
|
25710
|
+
builtImage,
|
|
25711
|
+
"Expected container image to be built before upload"
|
|
25712
|
+
);
|
|
25713
|
+
containerDeployments.push({
|
|
25714
|
+
container,
|
|
25715
|
+
imageRef: await pushBuiltContainerImage(
|
|
25716
|
+
builtImage,
|
|
25717
|
+
versionId,
|
|
25718
|
+
dockerPath,
|
|
25719
|
+
accountId,
|
|
25720
|
+
config2
|
|
25721
|
+
)
|
|
25722
|
+
});
|
|
25723
|
+
} else {
|
|
25724
|
+
containerDeployments.push({
|
|
25725
|
+
container,
|
|
25726
|
+
imageRef: { newTag: container.image_uri }
|
|
25727
|
+
});
|
|
25728
|
+
}
|
|
25729
|
+
}
|
|
25730
|
+
await deployContainers(config2, containerDeployments, {
|
|
25609
25731
|
versionId,
|
|
25610
25732
|
accountId,
|
|
25611
25733
|
scriptName,
|
|
25612
25734
|
dispatchNamespace: props.dispatchNamespace
|
|
25613
25735
|
});
|
|
25614
25736
|
}
|
|
25615
|
-
if (!skipContainerChanges &&
|
|
25616
|
-
|
|
25737
|
+
if (!skipContainerChanges && durableObjectContainerConfig.length > 0) {
|
|
25738
|
+
assert5(versionId && accountId);
|
|
25617
25739
|
try {
|
|
25618
|
-
await
|
|
25619
|
-
|
|
25620
|
-
|
|
25621
|
-
|
|
25622
|
-
|
|
25623
|
-
|
|
25740
|
+
await deployDurableObjectContainerApplications(
|
|
25741
|
+
config2,
|
|
25742
|
+
durableObjectContainerConfig,
|
|
25743
|
+
{
|
|
25744
|
+
versionId,
|
|
25745
|
+
accountId,
|
|
25746
|
+
scriptName,
|
|
25747
|
+
dispatchNamespace: props.dispatchNamespace
|
|
25748
|
+
}
|
|
25749
|
+
);
|
|
25624
25750
|
} catch (error51) {
|
|
25625
25751
|
throw new UserError(
|
|
25626
25752
|
"The Worker version was deployed, but Wrangler could not finish creating its Durable Object-managed Container applications. Re-run the same `wrangler deploy` command to retry the idempotent application creation and finish deployment.",
|
|
@@ -25635,7 +25761,7 @@ async function deployWorker(props, config2, buildResult, callbacks) {
|
|
|
25635
25761
|
deployWfpUserWorker(props.dispatchNamespace, versionId);
|
|
25636
25762
|
return { versionId, workerTag, assetUploadStats, bundleSize };
|
|
25637
25763
|
}
|
|
25638
|
-
|
|
25764
|
+
assert5(accountId);
|
|
25639
25765
|
const targets = await triggersDeploy({
|
|
25640
25766
|
config: config2,
|
|
25641
25767
|
accountId,
|
|
@@ -25742,10 +25868,19 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
|
|
|
25742
25868
|
{ telemetryMessage: "versions upload pending durable object migration" }
|
|
25743
25869
|
);
|
|
25744
25870
|
}
|
|
25745
|
-
const
|
|
25746
|
-
|
|
25747
|
-
|
|
25748
|
-
|
|
25871
|
+
const durableObjectContainerConfig = getDurableObjectContainerApps(
|
|
25872
|
+
props.containers.source
|
|
25873
|
+
);
|
|
25874
|
+
const preparedContainerImages = await prepareDurableObjectContainerApplications(
|
|
25875
|
+
config2,
|
|
25876
|
+
durableObjectContainerConfig,
|
|
25877
|
+
props.containers.durableObjects.builtImages,
|
|
25878
|
+
{
|
|
25879
|
+
accountId,
|
|
25880
|
+
dryRun: Boolean(props.dryRun),
|
|
25881
|
+
scriptName
|
|
25882
|
+
}
|
|
25883
|
+
);
|
|
25749
25884
|
const assetsUploadResult = assetsOptions && !props.dryRun ? await syncAssets(config2, accountId, assetsOptions.directory, scriptName) : void 0;
|
|
25750
25885
|
const assetsJwt = assetsUploadResult?.jwt;
|
|
25751
25886
|
if (props.secretsFile) {
|
|
@@ -25763,9 +25898,18 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
|
|
|
25763
25898
|
}
|
|
25764
25899
|
addRequiredSecretsInheritBindings(config2, bindings, { type: "upload" });
|
|
25765
25900
|
if (keepVars && !props.dryRun && workerExists) {
|
|
25766
|
-
await clearRemovedContainerImagesBindings(
|
|
25901
|
+
await clearRemovedContainerImagesBindings(
|
|
25902
|
+
config2,
|
|
25903
|
+
durableObjectContainerConfig,
|
|
25904
|
+
bindings,
|
|
25905
|
+
workerUrl
|
|
25906
|
+
);
|
|
25767
25907
|
}
|
|
25768
|
-
addContainerImagesBinding(
|
|
25908
|
+
addContainerImagesBinding(
|
|
25909
|
+
durableObjectContainerConfig,
|
|
25910
|
+
bindings,
|
|
25911
|
+
preparedContainerImages ?? {}
|
|
25912
|
+
);
|
|
25769
25913
|
const placement = parseConfigPlacement(config2);
|
|
25770
25914
|
const entryPointName = path__default.basename(resolvedEntryPointPath);
|
|
25771
25915
|
const main = {
|
|
@@ -25780,7 +25924,10 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
|
|
|
25780
25924
|
migrations,
|
|
25781
25925
|
exports: exports$1,
|
|
25782
25926
|
modules,
|
|
25783
|
-
containers: getContainerMetadata(
|
|
25927
|
+
containers: getContainerMetadata(
|
|
25928
|
+
props.containers.source,
|
|
25929
|
+
preparedContainerImages
|
|
25930
|
+
),
|
|
25784
25931
|
sourceMaps,
|
|
25785
25932
|
compatibility_date: compatibilityDate,
|
|
25786
25933
|
compatibility_flags: compatibilityFlags,
|
|
@@ -25829,7 +25976,7 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
|
|
|
25829
25976
|
unsafeMetadata: config2.unsafe?.metadata
|
|
25830
25977
|
});
|
|
25831
25978
|
} else {
|
|
25832
|
-
|
|
25979
|
+
assert5(accountId, "Missing accountId");
|
|
25833
25980
|
let provisionBindingsResult;
|
|
25834
25981
|
if (assetsOptions?.routerConfig.has_user_worker === false) {
|
|
25835
25982
|
logger.debug("skipping provisioning on assets-only project");
|
|
@@ -25943,14 +26090,18 @@ async function uploadWorkerVersion(props, config2, buildResult, callbacks) {
|
|
|
25943
26090
|
logger.log(`--dry-run: exiting now.`);
|
|
25944
26091
|
return { versionId, workerTag, bundleSize };
|
|
25945
26092
|
}
|
|
25946
|
-
|
|
25947
|
-
if (!hasDurableObjectExports(config2.exports) &&
|
|
25948
|
-
|
|
25949
|
-
await
|
|
25950
|
-
|
|
25951
|
-
|
|
25952
|
-
|
|
25953
|
-
|
|
26093
|
+
assert5(accountId);
|
|
26094
|
+
if (!hasDurableObjectExports(config2.exports) && durableObjectContainerConfig.length > 0) {
|
|
26095
|
+
assert5(versionId);
|
|
26096
|
+
await deployDurableObjectContainerApplications(
|
|
26097
|
+
config2,
|
|
26098
|
+
durableObjectContainerConfig,
|
|
26099
|
+
{
|
|
26100
|
+
versionId,
|
|
26101
|
+
accountId,
|
|
26102
|
+
scriptName
|
|
26103
|
+
}
|
|
26104
|
+
);
|
|
25954
26105
|
}
|
|
25955
26106
|
const uploadMs = Date.now() - start;
|
|
25956
26107
|
logger.log("Uploaded", workerName, formatTime(uploadMs));
|
|
@@ -26130,7 +26281,7 @@ async function getPreview(config2, accountId, workerName, previewIdentifier) {
|
|
|
26130
26281
|
);
|
|
26131
26282
|
}
|
|
26132
26283
|
__name(getPreview, "getPreview");
|
|
26133
|
-
async function createPreview(config2, accountId, workerName,
|
|
26284
|
+
async function createPreview(config2, accountId, workerName, request, options) {
|
|
26134
26285
|
const queryParams = options?.ignoreBaseConfig ? new URLSearchParams({ ignore_base_config: "true" }) : void 0;
|
|
26135
26286
|
return fetchResult(
|
|
26136
26287
|
config2,
|
|
@@ -26138,13 +26289,13 @@ async function createPreview(config2, accountId, workerName, request2, options)
|
|
|
26138
26289
|
{
|
|
26139
26290
|
method: "POST",
|
|
26140
26291
|
headers: { "Content-Type": "application/json" },
|
|
26141
|
-
body: JSON.stringify(
|
|
26292
|
+
body: JSON.stringify(request)
|
|
26142
26293
|
},
|
|
26143
26294
|
queryParams
|
|
26144
26295
|
);
|
|
26145
26296
|
}
|
|
26146
26297
|
__name(createPreview, "createPreview");
|
|
26147
|
-
async function editPreview(config2, accountId, workerName, previewIdentifier,
|
|
26298
|
+
async function editPreview(config2, accountId, workerName, previewIdentifier, request) {
|
|
26148
26299
|
return fetchResult(
|
|
26149
26300
|
config2,
|
|
26150
26301
|
`/accounts/${accountId}/workers/workers/${workerName}/previews/${encodeURIComponent(
|
|
@@ -26153,7 +26304,7 @@ async function editPreview(config2, accountId, workerName, previewIdentifier, re
|
|
|
26153
26304
|
{
|
|
26154
26305
|
method: "PATCH",
|
|
26155
26306
|
headers: { "Content-Type": "application/json" },
|
|
26156
|
-
body: JSON.stringify(
|
|
26307
|
+
body: JSON.stringify(request)
|
|
26157
26308
|
}
|
|
26158
26309
|
);
|
|
26159
26310
|
}
|
|
@@ -26179,8 +26330,8 @@ async function getPreviewDeployment(config2, accountId, workerName, previewIdent
|
|
|
26179
26330
|
);
|
|
26180
26331
|
}
|
|
26181
26332
|
__name(getPreviewDeployment, "getPreviewDeployment");
|
|
26182
|
-
function createPreviewDeploymentForm(
|
|
26183
|
-
const { modules, ...metadata } =
|
|
26333
|
+
function createPreviewDeploymentForm(request) {
|
|
26334
|
+
const { modules, ...metadata } = request;
|
|
26184
26335
|
const formData = new FormData();
|
|
26185
26336
|
formData.set("metadata", JSON.stringify(metadata));
|
|
26186
26337
|
for (const module of modules ?? []) {
|
|
@@ -26192,7 +26343,7 @@ function createPreviewDeploymentForm(request2) {
|
|
|
26192
26343
|
return formData;
|
|
26193
26344
|
}
|
|
26194
26345
|
__name(createPreviewDeploymentForm, "createPreviewDeploymentForm");
|
|
26195
|
-
async function createPreviewDeployment(config2, accountId, workerName, previewIdentifier,
|
|
26346
|
+
async function createPreviewDeployment(config2, accountId, workerName, previewIdentifier, request) {
|
|
26196
26347
|
return fetchResult(
|
|
26197
26348
|
config2,
|
|
26198
26349
|
`/accounts/${accountId}/workers/workers/${workerName}/previews/${encodeURIComponent(
|
|
@@ -26201,7 +26352,7 @@ async function createPreviewDeployment(config2, accountId, workerName, previewId
|
|
|
26201
26352
|
{
|
|
26202
26353
|
method: "POST",
|
|
26203
26354
|
// Let undici set Content-Type with the generated multipart boundary.
|
|
26204
|
-
body: createPreviewDeploymentForm(
|
|
26355
|
+
body: createPreviewDeploymentForm(request)
|
|
26205
26356
|
}
|
|
26206
26357
|
);
|
|
26207
26358
|
}
|
|
@@ -26802,7 +26953,107 @@ async function prepareContainersForPreview(config2, workerName, previewSlug, cal
|
|
|
26802
26953
|
return { scopedContainerConfig, normalisedContainerConfig };
|
|
26803
26954
|
}
|
|
26804
26955
|
__name(prepareContainersForPreview, "prepareContainersForPreview");
|
|
26805
|
-
var NO_ACTIVE_PREVIEW_URLS_MESSAGE = "Note: This Preview deployment has no active URLs.
|
|
26956
|
+
var NO_ACTIVE_PREVIEW_URLS_MESSAGE = "Note: This Preview deployment has no active URLs.";
|
|
26957
|
+
function isCustomDomainRoute(route) {
|
|
26958
|
+
return typeof route === "object" && route.custom_domain === true;
|
|
26959
|
+
}
|
|
26960
|
+
__name(isCustomDomainRoute, "isCustomDomainRoute");
|
|
26961
|
+
function formatPreviewConfigUpdate(config2, update) {
|
|
26962
|
+
const configPath = config2.userConfigPath ?? config2.configPath;
|
|
26963
|
+
if (!config2.targetEnvironment) {
|
|
26964
|
+
return formatConfigSnippet(update, configPath).trimEnd();
|
|
26965
|
+
}
|
|
26966
|
+
return formatConfigSnippet(
|
|
26967
|
+
{ env: { [config2.targetEnvironment]: update } },
|
|
26968
|
+
configPath
|
|
26969
|
+
).trimEnd();
|
|
26970
|
+
}
|
|
26971
|
+
__name(formatPreviewConfigUpdate, "formatPreviewConfigUpdate");
|
|
26972
|
+
function formatNoActivePreviewUrlsMessage(config2) {
|
|
26973
|
+
const customDomainRouteEntries = (config2.routes ?? []).filter(isCustomDomainRoute).map((route) => ({ route, singular: false }));
|
|
26974
|
+
if (config2.route && isCustomDomainRoute(config2.route)) {
|
|
26975
|
+
customDomainRouteEntries.push({ route: config2.route, singular: true });
|
|
26976
|
+
}
|
|
26977
|
+
const customDomainRouteEntry = customDomainRouteEntries.find(
|
|
26978
|
+
({ route }) => route.previews_enabled === true
|
|
26979
|
+
) ?? customDomainRouteEntries[0];
|
|
26980
|
+
const customDomainRoute = customDomainRouteEntry?.route;
|
|
26981
|
+
const customDomain = customDomainRoute?.pattern ?? "previews.example.com";
|
|
26982
|
+
const configPath = config2.userConfigPath ?? config2.configPath;
|
|
26983
|
+
const configName = configFileName(configPath);
|
|
26984
|
+
const workersDevConfig = formatPreviewConfigUpdate(config2, {
|
|
26985
|
+
preview_urls: true
|
|
26986
|
+
});
|
|
26987
|
+
const customDomainRouteConfig = {
|
|
26988
|
+
...customDomainRoute ?? {
|
|
26989
|
+
pattern: customDomain,
|
|
26990
|
+
custom_domain: true,
|
|
26991
|
+
enabled: false
|
|
26992
|
+
},
|
|
26993
|
+
previews_enabled: true
|
|
26994
|
+
};
|
|
26995
|
+
let customDomainConfigUpdate;
|
|
26996
|
+
if (customDomainRouteEntry?.singular) {
|
|
26997
|
+
customDomainConfigUpdate = { route: customDomainRouteConfig };
|
|
26998
|
+
} else if (customDomainRoute) {
|
|
26999
|
+
customDomainConfigUpdate = {
|
|
27000
|
+
routes: (config2.routes ?? []).map(
|
|
27001
|
+
(route) => route === customDomainRoute ? customDomainRouteConfig : route
|
|
27002
|
+
)
|
|
27003
|
+
};
|
|
27004
|
+
} else {
|
|
27005
|
+
const routes = config2.routes ?? (config2.route ? [config2.route] : []);
|
|
27006
|
+
customDomainConfigUpdate = {
|
|
27007
|
+
routes: [...routes, customDomainRouteConfig]
|
|
27008
|
+
};
|
|
27009
|
+
}
|
|
27010
|
+
const customDomainConfig = formatPreviewConfigUpdate(
|
|
27011
|
+
config2,
|
|
27012
|
+
customDomainConfigUpdate
|
|
27013
|
+
);
|
|
27014
|
+
let productionStatus = "disabled";
|
|
27015
|
+
if (customDomainRoute?.enabled === true) {
|
|
27016
|
+
productionStatus = "enabled";
|
|
27017
|
+
} else if (customDomainRoute?.enabled === void 0 && customDomainRoute) {
|
|
27018
|
+
productionStatus = "enabled (default)";
|
|
27019
|
+
}
|
|
27020
|
+
const workersDevAlreadyConfigured = config2.preview_urls === true;
|
|
27021
|
+
const customDomainAlreadyConfigured = customDomainRoute?.previews_enabled === true;
|
|
27022
|
+
const cautionText = workersDevAlreadyConfigured && customDomainAlreadyConfigured ? "Caution: `wrangler deploy` publishes the code in your current checkout to the deployed Worker. If you have already made this change, confirm it was applied by running `wrangler deploy` from a clean checkout of your production branch. Then return to your feature branch and run `wrangler preview` again." : "Caution: `wrangler deploy` publishes the code in your current checkout to the deployed Worker, not only these settings. If you use Git, commit the configuration change and run `wrangler deploy` from a clean checkout of your production branch. Then return to your feature branch and run `wrangler preview` again.";
|
|
27023
|
+
let workersDevInstruction = `Add this to your ${configName}:`;
|
|
27024
|
+
if (config2.preview_urls === true) {
|
|
27025
|
+
workersDevInstruction = `Your ${configName} already contains:`;
|
|
27026
|
+
} else if (config2.preview_urls === false) {
|
|
27027
|
+
workersDevInstruction = `Update this in your ${configName}:`;
|
|
27028
|
+
}
|
|
27029
|
+
let customDomainInstruction = `Add or update this route in your ${configName}:`;
|
|
27030
|
+
if (customDomainRoute?.previews_enabled === true) {
|
|
27031
|
+
customDomainInstruction = `Your ${configName} already contains:`;
|
|
27032
|
+
} else if (customDomainRoute === void 0 && config2.route !== void 0) {
|
|
27033
|
+
customDomainInstruction = `Replace \`route\` with this in your ${configName}:`;
|
|
27034
|
+
}
|
|
27035
|
+
return [
|
|
27036
|
+
NO_ACTIVE_PREVIEW_URLS_MESSAGE,
|
|
27037
|
+
"",
|
|
27038
|
+
"For a Workers.dev URL such as:",
|
|
27039
|
+
" https://<preview-name>-<worker>.<subdomain>.workers.dev",
|
|
27040
|
+
workersDevInstruction,
|
|
27041
|
+
workersDevConfig,
|
|
27042
|
+
"",
|
|
27043
|
+
"For a custom-domain URL such as:",
|
|
27044
|
+
` https://<preview-name>.${customDomain}`,
|
|
27045
|
+
customDomainInstruction,
|
|
27046
|
+
customDomainConfig,
|
|
27047
|
+
"Resulting route behavior:",
|
|
27048
|
+
` Production: ${productionStatus}`,
|
|
27049
|
+
" Previews: enabled",
|
|
27050
|
+
"",
|
|
27051
|
+
cautionText,
|
|
27052
|
+
"",
|
|
27053
|
+
"See https://developers.cloudflare.com/workers/previews/custom-domains/ for more information."
|
|
27054
|
+
].join("\n");
|
|
27055
|
+
}
|
|
27056
|
+
__name(formatNoActivePreviewUrlsMessage, "formatNoActivePreviewUrlsMessage");
|
|
26806
27057
|
function getPreviewMigrationsToUpload(workerName, config2, currentMigrationTag) {
|
|
26807
27058
|
if (config2.migrations.length === 0) {
|
|
26808
27059
|
return void 0;
|
|
@@ -26884,13 +27135,13 @@ function buildResultToDeploymentModules(buildResult, assetFiles) {
|
|
|
26884
27135
|
__name(buildResultToDeploymentModules, "buildResultToDeploymentModules");
|
|
26885
27136
|
async function assemblePreviewDeploymentSettings(config2, buildResult, accountId, workerName, previewIdentifier, options) {
|
|
26886
27137
|
const previews = config2.previews;
|
|
26887
|
-
const
|
|
27138
|
+
const request = {};
|
|
26888
27139
|
const deploymentModules = buildResultToDeploymentModules(buildResult, {
|
|
26889
27140
|
_headers: options.assetsOptions?._headers,
|
|
26890
27141
|
_redirects: options.assetsOptions?._redirects
|
|
26891
27142
|
});
|
|
26892
|
-
|
|
26893
|
-
|
|
27143
|
+
request.main_module = deploymentModules.main_module;
|
|
27144
|
+
request.modules = deploymentModules.modules;
|
|
26894
27145
|
if (options.assetsOptions) {
|
|
26895
27146
|
const assetsUploadResult = await syncAssets(
|
|
26896
27147
|
config2,
|
|
@@ -26898,7 +27149,7 @@ async function assemblePreviewDeploymentSettings(config2, buildResult, accountId
|
|
|
26898
27149
|
options.assetsOptions.directory,
|
|
26899
27150
|
workerName
|
|
26900
27151
|
);
|
|
26901
|
-
|
|
27152
|
+
request.assets = {
|
|
26902
27153
|
jwt: assetsUploadResult.jwt,
|
|
26903
27154
|
config: {
|
|
26904
27155
|
html_handling: options.assetsOptions.assetConfig.html_handling,
|
|
@@ -26908,16 +27159,16 @@ async function assemblePreviewDeploymentSettings(config2, buildResult, accountId
|
|
|
26908
27159
|
};
|
|
26909
27160
|
}
|
|
26910
27161
|
if (config2.compatibility_date) {
|
|
26911
|
-
|
|
27162
|
+
request.compatibility_date = config2.compatibility_date;
|
|
26912
27163
|
}
|
|
26913
27164
|
if (config2.compatibility_flags && config2.compatibility_flags.length > 0) {
|
|
26914
|
-
|
|
27165
|
+
request.compatibility_flags = config2.compatibility_flags;
|
|
26915
27166
|
}
|
|
26916
27167
|
const repositoryUrl = options.repositoryUrl;
|
|
26917
27168
|
const pullRequest = options.pullRequest;
|
|
26918
27169
|
const commitSha = options.commitSha;
|
|
26919
27170
|
if (options.message || options.tag || repositoryUrl || pullRequest || commitSha) {
|
|
26920
|
-
|
|
27171
|
+
request.annotations = {
|
|
26921
27172
|
...commitSha && { "workers/commit_sha": commitSha },
|
|
26922
27173
|
...options.message && { "workers/message": options.message },
|
|
26923
27174
|
...pullRequest?.number && {
|
|
@@ -26953,21 +27204,21 @@ async function assemblePreviewDeploymentSettings(config2, buildResult, accountId
|
|
|
26953
27204
|
latestDeploymentMigrationTag
|
|
26954
27205
|
);
|
|
26955
27206
|
if (migrations) {
|
|
26956
|
-
|
|
27207
|
+
request.migrations = migrations;
|
|
26957
27208
|
}
|
|
26958
27209
|
}
|
|
26959
27210
|
if (previews?.limits !== void 0) {
|
|
26960
|
-
|
|
27211
|
+
request.limits = previews.limits;
|
|
26961
27212
|
} else if (config2.limits !== void 0) {
|
|
26962
|
-
|
|
27213
|
+
request.limits = config2.limits;
|
|
26963
27214
|
}
|
|
26964
27215
|
if (previews?.cache !== void 0) {
|
|
26965
|
-
|
|
27216
|
+
request.cache = previews.cache;
|
|
26966
27217
|
} else if (config2.cache !== void 0) {
|
|
26967
|
-
|
|
27218
|
+
request.cache = config2.cache;
|
|
26968
27219
|
}
|
|
26969
27220
|
if (config2.placement) {
|
|
26970
|
-
|
|
27221
|
+
request.placement = parseConfigPlacement(config2);
|
|
26971
27222
|
}
|
|
26972
27223
|
const previewContainers = previews?.containers ?? [];
|
|
26973
27224
|
if (previewContainers.length > 0) {
|
|
@@ -26976,14 +27227,14 @@ async function assemblePreviewDeploymentSettings(config2, buildResult, accountId
|
|
|
26976
27227
|
({ class_name }) => class_name !== void 0 && ownedDOClasses.has(class_name) ? [{ class_name }] : []
|
|
26977
27228
|
);
|
|
26978
27229
|
if (containers.length > 0) {
|
|
26979
|
-
|
|
27230
|
+
request.containers = containers;
|
|
26980
27231
|
}
|
|
26981
27232
|
}
|
|
26982
27233
|
const env = extractConfigBindings(config2);
|
|
26983
27234
|
if (Object.keys(env).length > 0) {
|
|
26984
|
-
|
|
27235
|
+
request.env = env;
|
|
26985
27236
|
}
|
|
26986
|
-
return
|
|
27237
|
+
return request;
|
|
26987
27238
|
}
|
|
26988
27239
|
__name(assemblePreviewDeploymentSettings, "assemblePreviewDeploymentSettings");
|
|
26989
27240
|
function formatUrlLines(label, urls) {
|
|
@@ -27000,7 +27251,7 @@ function formatUrlLines(label, urls) {
|
|
|
27000
27251
|
];
|
|
27001
27252
|
}
|
|
27002
27253
|
__name(formatUrlLines, "formatUrlLines");
|
|
27003
|
-
function formatPreviewDeploymentSummary(previewResource, deployment, isNew, pullRequest) {
|
|
27254
|
+
function formatPreviewDeploymentSummary(config2, previewResource, deployment, isNew, pullRequest) {
|
|
27004
27255
|
const statusLabel = isNew ? chalk6.green("(new)") : chalk6.dim("(updated)");
|
|
27005
27256
|
const pullRequestUrl = deployment.annotations?.["workers/pull_request_url"] ?? pullRequest?.url;
|
|
27006
27257
|
const pullRequestNumber = deployment.annotations?.["workers/pull_request_number"] ?? pullRequest?.number;
|
|
@@ -27014,7 +27265,7 @@ function formatPreviewDeploymentSummary(previewResource, deployment, isNew, pull
|
|
|
27014
27265
|
...pullRequestUrl || pullRequestNumber ? [
|
|
27015
27266
|
`${chalk6.bold("Pull Request:")} ${pullRequestUrl ?? `#${pullRequestNumber}`}`
|
|
27016
27267
|
] : [],
|
|
27017
|
-
...hasActiveUrls ? [] : [
|
|
27268
|
+
...hasActiveUrls ? [] : [formatNoActivePreviewUrlsMessage(config2)]
|
|
27018
27269
|
].join("\n");
|
|
27019
27270
|
}
|
|
27020
27271
|
__name(formatPreviewDeploymentSummary, "formatPreviewDeploymentSummary");
|
|
@@ -27185,6 +27436,7 @@ async function preview(accountId, args, config2, buildResult, assetsOptions, cal
|
|
|
27185
27436
|
} else {
|
|
27186
27437
|
logger.log(
|
|
27187
27438
|
formatPreviewDeploymentSummary(
|
|
27439
|
+
config2,
|
|
27188
27440
|
previewResource,
|
|
27189
27441
|
deployment,
|
|
27190
27442
|
isNewPreview,
|
|
@@ -27387,4 +27639,4 @@ __name(formatBindings, "formatBindings");
|
|
|
27387
27639
|
* THE SOFTWARE.
|
|
27388
27640
|
*/
|
|
27389
27641
|
|
|
27390
|
-
export { ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, EXPORTS_RECONCILIATION_ERROR_CODE, INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE, INVALID_INHERIT_BINDING_CODE, NO_ACTIVE_PREVIEW_URLS_MESSAGE, NoInputError, WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE, WORKER_NOT_FOUND_ERR_CODE, WORKFLOW_CRON_REQUIRES_PAID_PLAN_CODE, WORKFLOW_NOT_FOUND_CODE, addRequiredSecretsInheritBindings, addWorkersSitesBindings, applyServiceAndEnvironmentTags, assemblePreviewScriptSettings, buildAssetManifest, checkRemoteSecretsOverride, checkWorkflowConflicts, collectPackageDependencies, confirmLatestDeploymentOverwrite, createDeployment, createPreview, createPreviewDeployment, createPreviewDeploymentForm, createPreviewParentWorker, createTruncatedAlias, decodeJwtPayload, deletePreview, deletePullConsumer, deleteWorkerConsumer, deploy, deployWfpUserWorker, diagnoseScriptSizeError, diagnoseStartupError, diffJsonObjects, downloadWorkerConfig, drawBox, drawConnectedChildBox, editPreview, ensureQueuesExistByConfig, extractConfigBindings, fetchDeployableVersions, fetchDeploymentVersions, fetchLatestDeployment, fetchLatestDeployments, fetchSecrets, fetchVersion, fetchVersions, fetchWorkerConfig, formatAlignedRows, formatBindings, generatePreviewAlias, getBindingValue, getBranchName2 as getBranchName, getCommitSha, getConfigPatch, getDeployConfirmFunction, getEdgeKvUploadConcurrency, getHeadCommitMessage, getHeadCommitRef, getMigrationsToUpload, getPreview, getPreviewBaseConfig, getPreviewDeployment, getPreviewOwnedContainerClassNames, getPullRequestMetadata, getQueue, getRemoteConfigDiff, getRepositoryUrl, getSettings, getSize, getSourceMappedStack, getSourceMappedString, getSubdomainValues, getSubdomainValuesAPIMock, getWorkersDevSubdomain, getZoneForRoute, getZoneIdFromHost, handleMissingSecretsError, hasDefinedEnvironments, hashFile, helpIfErrorIsSizeOrScriptStartup, isExportsReconciliationErrorDetails, isJwtExpired, isModifiedDiffValue, isNonDestructive, isWorkerNotFoundError, listConsumers, listQueues, maybeRetrieveFileSourceMap, padToVisibleWidth, parseBulkInputToObject, parseConfigPlacement, patchNonVersionedScriptSettings, patchPreviewBaseConfig, patchPreviewDeployment, postConsumer, preview, previewContainerAppName, previewDelete, printBundleSize, printVersions, provisionBindings, publishCustomDomains, publishRoutes, putConsumer, putConsumerById, renderBindingDependsOnExportError, renderExportsReconciliationError, renderExportsReconciliationSuccess, renderInconsistentExportsAcrossVersionsError, renderRoute, resolveAssetOptions, resolveDoLifecyclePayload, resolveExportsUploadPayload, resolveWorkerName, sanitizeBranchName, shouldUseCIMetadataFallback, stripAnsi, syncAssets, tagsAreEqual, triggersDeploy, updateQueueConsumers, validateEventTriggerTargets, validateFileSecrets, validateNodeCompatMode, validateRoutes, verifyWorkerMatchesCITag, versionsUpload, visibleLength, warnOnErrorUpdatingServiceAndEnvironmentTags, workerNotFoundErrorMessage };
|
|
27642
|
+
export { ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, EXPORTS_RECONCILIATION_ERROR_CODE, INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE, INVALID_INHERIT_BINDING_CODE, NO_ACTIVE_PREVIEW_URLS_MESSAGE, NoInputError, PREVIEW_DOMAIN_PROVISIONING_NOTE, WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE, WORKER_NOT_FOUND_ERR_CODE, WORKFLOW_CRON_REQUIRES_PAID_PLAN_CODE, WORKFLOW_NOT_FOUND_CODE, addRequiredSecretsInheritBindings, addWorkersSitesBindings, applyServiceAndEnvironmentTags, assemblePreviewScriptSettings, buildAssetManifest, checkRemoteSecretsOverride, checkWorkflowConflicts, collectPackageDependencies, confirmLatestDeploymentOverwrite, createDeployment, createDurableObjectContainerApplication, createPreview, createPreviewDeployment, createPreviewDeploymentForm, createPreviewParentWorker, createTruncatedAlias, decodeJwtPayload, deletePreview, deletePullConsumer, deleteWorkerConsumer, deploy, deployDurableObjectContainerApplications, deployVersionedDurableObjectContainerApplications, deployWfpUserWorker, diagnoseScriptSizeError, diagnoseStartupError, diffJsonObjects, downloadWorkerConfig, drawBox, drawConnectedChildBox, editPreview, ensureQueuesExistByConfig, extractConfigBindings, fetchDeployableVersions, fetchDeploymentVersions, fetchLatestDeployment, fetchLatestDeployments, fetchSecrets, fetchVersion, fetchVersions, fetchWorkerConfig, formatAlignedRows, formatBindings, formatNoActivePreviewUrlsMessage, generatePreviewAlias, getBindingValue, getBranchName2 as getBranchName, getCommitSha, getConfigPatch, getDeployConfirmFunction, getEdgeKvUploadConcurrency, getHeadCommitMessage, getHeadCommitRef, getMigrationsToUpload, getPreview, getPreviewBaseConfig, getPreviewDeployment, getPreviewOwnedContainerClassNames, getPullRequestMetadata, getQueue, getRemoteConfigDiff, getRepositoryUrl, getSettings, getSize, getSourceMappedStack, getSourceMappedString, getSubdomainValues, getSubdomainValuesAPIMock, getVersionedDurableObjectContainerApplications, getWorkersDevSubdomain, getZoneForRoute, getZoneIdFromHost, handleMissingSecretsError, hasDefinedEnvironments, hashFile, helpIfErrorIsSizeOrScriptStartup, isExportsReconciliationErrorDetails, isJwtExpired, isModifiedDiffValue, isNonDestructive, isWorkerNotFoundError, listConsumers, listQueues, maybeRetrieveFileSourceMap, padToVisibleWidth, parseBulkInputToObject, parseConfigPlacement, patchNonVersionedScriptSettings, patchPreviewBaseConfig, patchPreviewDeployment, postConsumer, prepareDurableObjectContainerApplications, preview, previewContainerAppName, previewDelete, printBundleSize, printVersions, provisionBindings, publishCustomDomains, publishRoutes, putConsumer, putConsumerById, renderBindingDependsOnExportError, renderExportsReconciliationError, renderExportsReconciliationSuccess, renderInconsistentExportsAcrossVersionsError, renderRoute, resolveAssetOptions, resolveDoLifecyclePayload, resolveExportsUploadPayload, resolveVersionedDurableObjectContainerApplications, resolveWorkerName, sanitizeBranchName, shouldUseCIMetadataFallback, stripAnsi, syncAssets, tagsAreEqual, triggersDeploy, updateQueueConsumers, validateEventTriggerTargets, validateFileSecrets, validateNodeCompatMode, validateRoutes, verifyWorkerMatchesCITag, versionsUpload, visibleLength, warnOnErrorUpdatingServiceAndEnvironmentTags, workerNotFoundErrorMessage };
|