@cloudflare/deploy-helpers 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,25 +1,27 @@
1
- import { __commonJS, __name, __require, __toESM, fetchResult, __export, fetchListResult, logger, confirm, fetchPagedListResult, prompt, select } from './chunk-E3FPD2SU.mjs';
2
- export { initDeployHelpersContext } from './chunk-E3FPD2SU.mjs';
3
- import assert4 from 'node:assert';
1
+ import { fetchResult, fetchPagedListResult, logger, confirm, fetchListResult, prompt, select } from './chunk-Z4LB73IF.mjs';
2
+ export { initDeployHelpersContext } from './chunk-Z4LB73IF.mjs';
3
+ import { extractBindingsOfType, isUnsafeBindingType, getBindings, createWorkerUploadForm, moduleTypeMimeType } from './chunk-EE2VTGDT.mjs';
4
+ export { convertConfigToBindings, createWorkerUploadForm, extractBindingsOfType, fromMimeType, getBindings, handleUnsafeCapnp, isUnsafeBindingType, moduleTypeMimeType } from './chunk-EE2VTGDT.mjs';
5
+ import { __commonJS, __name, __require, __toESM, __export } from './chunk-Q72B4Q5Z.mjs';
6
+ import assert3 from 'node:assert';
4
7
  import { readFileSync, mkdirSync, writeFileSync, createReadStream } from 'node:fs';
5
8
  import * as path from 'node:path';
6
9
  import path__default, { resolve, extname, isAbsolute, sep } from 'node:path';
7
10
  import url, { URLSearchParams as URLSearchParams$1 } from 'node:url';
8
11
  import * as cli from '@cloudflare/cli-shared-helpers';
9
12
  import { cancel } from '@cloudflare/cli-shared-helpers';
10
- import { INHERIT_SYMBOL, APIError, UserError, getEnvironmentVariableFactory, getHostFromRoute, retryOnAPIFailure, ParseError, getComplianceRegionSubdomain, configFileName, formatTime, getSubdomainMixedStateCheckDisabled, isNonInteractiveOrCI, LOGGER_LEVELS, SERVICE_TAG_PREFIX, ENVIRONMENT_TAG_PREFIX, getDurableObjectExports, partitionExports, getWranglerTmpDir, parsePackageJSON, getInstalledPackageVersion, FatalError, readFileSync as readFileSync$1, parseJSON, getBindingTypeFriendlyName, getBindingLocalSupport, assertNever as assertNever$1, experimental_readRawConfig, experimental_patchConfig, PatchConfigError, COMPLIANCE_REGION_CONFIG_UNKNOWN, constructWranglerConfig, getCIMatchTag, formatConfigSnippet, getTodaysCompatDate, hasDurableObjectExports, getDockerPath, parseNonHyphenedUuid, getWorkersCIBranchName } from '@cloudflare/workers-utils';
11
- import { spawnSync, execSync, spawn } from 'node:child_process';
12
- import { FormData, Response } from 'undici';
13
+ import { INHERIT_SYMBOL, APIError, UserError, getEnvironmentVariableFactory, isNonInteractiveOrCI, getHostFromRoute, retryOnAPIFailure, ParseError, getComplianceRegionSubdomain, configFileName, formatTime, getSubdomainMixedStateCheckDisabled, LOGGER_LEVELS, SERVICE_TAG_PREFIX, ENVIRONMENT_TAG_PREFIX, getDurableObjectExports, partitionExports, getWranglerTmpDir, parsePackageJSON, getInstalledPackageVersion, FatalError, readFileSync as readFileSync$1, parseJSON, getBindingTypeFriendlyName, getBindingLocalSupport, assertNever, experimental_readRawConfig, experimental_patchConfig, PatchConfigError, COMPLIANCE_REGION_CONFIG_UNKNOWN, constructWranglerConfig, getCIMatchTag, formatConfigSnippet, getTodaysCompatDate, hasDurableObjectExports, getDockerPath, parseNonHyphenedUuid, getWorkersCIBranchName } from '@cloudflare/workers-utils';
14
+ import { execSync, spawn } from 'node:child_process';
15
+ import { Response, FormData } from 'undici';
13
16
  import chalk5 from 'chalk';
14
17
  import PQueue from 'p-queue';
18
+ import { spinner, inputPrompt, leftT } from '@cloudflare/cli-shared-helpers/interactive';
15
19
  import { writeFile, access, readFile, readdir, stat } from 'node:fs/promises';
16
20
  import prettyBytes from 'pretty-bytes';
17
21
  import { hash } from 'blake3-wasm';
18
22
  import { Blob } from 'node:buffer';
19
23
  import { gzipSync } from 'node:zlib';
20
24
  import { brandColor, white, gray, bold, yellow, dim, red, blue } from '@cloudflare/cli-shared-helpers/colors';
21
- import { inputPrompt, leftT } from '@cloudflare/cli-shared-helpers/interactive';
22
- import { sync } from 'command-exists';
23
25
  import readline from 'node:readline';
24
26
  import { parse } from 'dotenv';
25
27
  import { stripVTControlCharacters } from 'node:util';
@@ -253,17 +255,17 @@ var require_ignore = __commonJS({
253
255
  var throwError = /* @__PURE__ */ __name((message, Ctor) => {
254
256
  throw new Ctor(message);
255
257
  }, "throwError");
256
- var checkPath = /* @__PURE__ */ __name((path10, originalPath, doThrow) => {
257
- if (!isString(path10)) {
258
+ var checkPath = /* @__PURE__ */ __name((path9, originalPath, doThrow) => {
259
+ if (!isString(path9)) {
258
260
  return doThrow(
259
261
  `path must be a string, but got \`${originalPath}\``,
260
262
  TypeError
261
263
  );
262
264
  }
263
- if (!path10) {
265
+ if (!path9) {
264
266
  return doThrow(`path must not be empty`, TypeError);
265
267
  }
266
- if (checkPath.isNotRelative(path10)) {
268
+ if (checkPath.isNotRelative(path9)) {
267
269
  const r = "`path.relative()`d";
268
270
  return doThrow(
269
271
  `path should be a ${r} string, but got "${originalPath}"`,
@@ -272,7 +274,7 @@ var require_ignore = __commonJS({
272
274
  }
273
275
  return true;
274
276
  }, "checkPath");
275
- var isNotRelative = /* @__PURE__ */ __name((path10) => REGEX_TEST_INVALID_PATH.test(path10), "isNotRelative");
277
+ var isNotRelative = /* @__PURE__ */ __name((path9) => REGEX_TEST_INVALID_PATH.test(path9), "isNotRelative");
276
278
  checkPath.isNotRelative = isNotRelative;
277
279
  checkPath.convert = (p) => p;
278
280
  var Ignore = class {
@@ -334,7 +336,7 @@ var require_ignore = __commonJS({
334
336
  // setting `checkUnignored` to `false` could reduce additional
335
337
  // path matching.
336
338
  // @returns {TestResult} true if a file is ignored
337
- _testOne(path10, checkUnignored) {
339
+ _testOne(path9, checkUnignored) {
338
340
  let ignored = false;
339
341
  let unignored = false;
340
342
  this._rules.forEach((rule) => {
@@ -342,7 +344,7 @@ var require_ignore = __commonJS({
342
344
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
343
345
  return;
344
346
  }
345
- const matched = rule.regex.test(path10);
347
+ const matched = rule.regex.test(path9);
346
348
  if (matched) {
347
349
  ignored = !negative;
348
350
  unignored = negative;
@@ -355,24 +357,24 @@ var require_ignore = __commonJS({
355
357
  }
356
358
  // @returns {TestResult}
357
359
  _test(originalPath, cache, checkUnignored, slices) {
358
- const path10 = originalPath && checkPath.convert(originalPath);
360
+ const path9 = originalPath && checkPath.convert(originalPath);
359
361
  checkPath(
360
- path10,
362
+ path9,
361
363
  originalPath,
362
364
  this._allowRelativePaths ? RETURN_FALSE : throwError
363
365
  );
364
- return this._t(path10, cache, checkUnignored, slices);
366
+ return this._t(path9, cache, checkUnignored, slices);
365
367
  }
366
- _t(path10, cache, checkUnignored, slices) {
367
- if (path10 in cache) {
368
- return cache[path10];
368
+ _t(path9, cache, checkUnignored, slices) {
369
+ if (path9 in cache) {
370
+ return cache[path9];
369
371
  }
370
372
  if (!slices) {
371
- slices = path10.split(SLASH);
373
+ slices = path9.split(SLASH);
372
374
  }
373
375
  slices.pop();
374
376
  if (!slices.length) {
375
- return cache[path10] = this._testOne(path10, checkUnignored);
377
+ return cache[path9] = this._testOne(path9, checkUnignored);
376
378
  }
377
379
  const parent = this._t(
378
380
  slices.join(SLASH) + SLASH,
@@ -380,24 +382,24 @@ var require_ignore = __commonJS({
380
382
  checkUnignored,
381
383
  slices
382
384
  );
383
- return cache[path10] = parent.ignored ? parent : this._testOne(path10, checkUnignored);
385
+ return cache[path9] = parent.ignored ? parent : this._testOne(path9, checkUnignored);
384
386
  }
385
- ignores(path10) {
386
- return this._test(path10, this._ignoreCache, false).ignored;
387
+ ignores(path9) {
388
+ return this._test(path9, this._ignoreCache, false).ignored;
387
389
  }
388
390
  createFilter() {
389
- return (path10) => !this.ignores(path10);
391
+ return (path9) => !this.ignores(path9);
390
392
  }
391
393
  filter(paths) {
392
394
  return makeArray(paths).filter(this.createFilter());
393
395
  }
394
396
  // @returns {TestResult}
395
- test(path10) {
396
- return this._test(path10, this._testCache, true);
397
+ test(path9) {
398
+ return this._test(path9, this._testCache, true);
397
399
  }
398
400
  };
399
401
  var factory = /* @__PURE__ */ __name((options) => new Ignore(options), "factory");
400
- var isPathValid = /* @__PURE__ */ __name((path10) => checkPath(path10 && checkPath.convert(path10), path10, RETURN_FALSE), "isPathValid");
402
+ var isPathValid = /* @__PURE__ */ __name((path9) => checkPath(path9 && checkPath.convert(path9), path9, RETURN_FALSE), "isPathValid");
401
403
  factory.isPathValid = isPathValid;
402
404
  factory.default = factory;
403
405
  module.exports = factory;
@@ -408,7 +410,7 @@ var require_ignore = __commonJS({
408
410
  const makePosix = /* @__PURE__ */ __name((str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/"), "makePosix");
409
411
  checkPath.convert = makePosix;
410
412
  const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
411
- checkPath.isNotRelative = (path10) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path10) || isNotRelative(path10);
413
+ checkPath.isNotRelative = (path9) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path9) || isNotRelative(path9);
412
414
  }
413
415
  }
414
416
  });
@@ -700,10 +702,10 @@ var require_heap2 = __commonJS({
700
702
  var require_difflib = __commonJS({
701
703
  "../../node_modules/.pnpm/@ewoudenberg+difflib@0.1.0/node_modules/@ewoudenberg/difflib/lib/difflib.js"(exports) {
702
704
  (function() {
703
- var Differ, Heap, IS_CHARACTER_JUNK, IS_LINE_JUNK, SequenceMatcher, _any, _arrayCmp, _calculateRatio, _countLeading, _formatRangeContext, _formatRangeUnified, _has, assert10, contextDiff, floor, getCloseMatches, max, min, ndiff, restore, unifiedDiff, indexOf = [].indexOf;
705
+ var Differ, Heap, IS_CHARACTER_JUNK, IS_LINE_JUNK, SequenceMatcher, _any, _arrayCmp, _calculateRatio, _countLeading, _formatRangeContext, _formatRangeUnified, _has, assert9, contextDiff, floor, getCloseMatches, max, min, ndiff, restore, unifiedDiff, indexOf = [].indexOf;
704
706
  ({ floor, max, min } = Math);
705
707
  Heap = require_heap2();
706
- assert10 = __require("assert");
708
+ assert9 = __require("assert");
707
709
  _calculateRatio = /* @__PURE__ */ __name(function(matches, length) {
708
710
  if (length) {
709
711
  return 2 * matches / length;
@@ -1274,7 +1276,7 @@ var require_difflib = __commonJS({
1274
1276
  }
1275
1277
  _plainReplace(a, alo, ahi, b, blo, bhi) {
1276
1278
  var first, g, l, len, len1, line, lines, m, ref, second;
1277
- assert10(alo < ahi && blo < bhi);
1279
+ assert9(alo < ahi && blo < bhi);
1278
1280
  if (bhi - blo < ahi - alo) {
1279
1281
  first = this._dump("+", b, blo, bhi);
1280
1282
  second = this._dump("-", a, alo, ahi);
@@ -2912,10 +2914,10 @@ var UpdateApplicationRolloutRequest;
2912
2914
  // ../containers-shared/src/utils.ts
2913
2915
  var runDockerCmd = /* @__PURE__ */ __name((dockerPath, args, stdio) => {
2914
2916
  let aborted = false;
2915
- let resolve3;
2917
+ let resolve2;
2916
2918
  let reject;
2917
2919
  const ready = new Promise((res, rej) => {
2918
- resolve3 = res;
2920
+ resolve2 = res;
2919
2921
  reject = rej;
2920
2922
  });
2921
2923
  const child = spawn(dockerPath, args, {
@@ -2933,7 +2935,7 @@ var runDockerCmd = /* @__PURE__ */ __name((dockerPath, args, stdio) => {
2933
2935
  let errorHandled = false;
2934
2936
  child.on("close", (code) => {
2935
2937
  if (code === 0 || aborted) {
2936
- resolve3({ aborted });
2938
+ resolve2({ aborted });
2937
2939
  } else if (!errorHandled) {
2938
2940
  errorHandled = true;
2939
2941
  reject(
@@ -3038,6 +3040,401 @@ var EXPORTS_RECONCILIATION_ERROR_CODE = 100402;
3038
3040
  var INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE = 100405;
3039
3041
  var ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE = 100406;
3040
3042
  var WORKFLOW_CRON_REQUIRES_PAID_PLAN_CODE = 10208;
3043
+
3044
+ // src/deploy/helpers/worker-not-found-error.ts
3045
+ var WORKER_NOT_FOUND_ERR_CODE = 10007;
3046
+ var WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE = 10090;
3047
+ var workerNotFoundErrorMessage = "This Worker does not exist on your account.";
3048
+ function isWorkerNotFoundError(error) {
3049
+ return typeof error === "object" && error !== null && "code" in error && (error.code === WORKER_NOT_FOUND_ERR_CODE || error.code === WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE);
3050
+ }
3051
+ __name(isWorkerNotFoundError, "isWorkerNotFoundError");
3052
+
3053
+ // src/triggers/email-routing-plan.ts
3054
+ function isCatchAllAddress(address) {
3055
+ return address.startsWith("*@") && address.length > "*@".length;
3056
+ }
3057
+ __name(isCatchAllAddress, "isCatchAllAddress");
3058
+ function ruleShapeForTarget(target, workerName) {
3059
+ const actions = [
3060
+ { type: "worker", value: [workerName] }
3061
+ ];
3062
+ if (isCatchAllAddress(target)) {
3063
+ return { matchers: [{ type: "all" }], actions };
3064
+ }
3065
+ return {
3066
+ matchers: [{ type: "literal", field: "to", value: target }],
3067
+ actions
3068
+ };
3069
+ }
3070
+ __name(ruleShapeForTarget, "ruleShapeForTarget");
3071
+ function buildEmailRoutingPlanRequest(addresses, workerName, ownerWorkerTag) {
3072
+ const rules = [];
3073
+ const catchAllRules = [];
3074
+ for (const address of addresses) {
3075
+ const rule = ruleShapeForTarget(address, workerName);
3076
+ if (isCatchAllAddress(address)) {
3077
+ catchAllRules.push({ target: address, rule });
3078
+ } else {
3079
+ rules.push(rule);
3080
+ }
3081
+ }
3082
+ return {
3083
+ owner_worker_tag: ownerWorkerTag,
3084
+ rules,
3085
+ catch_all_rules: catchAllRules
3086
+ };
3087
+ }
3088
+ __name(buildEmailRoutingPlanRequest, "buildEmailRoutingPlanRequest");
3089
+ function isDestructiveChange(change) {
3090
+ return change.type === "deleted" || change.type === "conflict";
3091
+ }
3092
+ __name(isDestructiveChange, "isDestructiveChange");
3093
+ function planHasChanges(plan) {
3094
+ return plan.zones.some((zone) => zone.changes.length > 0);
3095
+ }
3096
+ __name(planHasChanges, "planHasChanges");
3097
+ function planHasDestructiveChanges(plan) {
3098
+ return plan.zones.some((zone) => zone.changes.some(isDestructiveChange));
3099
+ }
3100
+ __name(planHasDestructiveChanges, "planHasDestructiveChanges");
3101
+ var CHANGE_MARKERS = {
3102
+ added: "+",
3103
+ updated: "~",
3104
+ deleted: "-",
3105
+ conflict: "!"
3106
+ };
3107
+ function describeRemoteAction(remote) {
3108
+ const action = remote.actions[0];
3109
+ if (!action) {
3110
+ return "no action";
3111
+ }
3112
+ const value = action.value?.join(", ");
3113
+ switch (action.type) {
3114
+ case "forward":
3115
+ return value ? `forward to ${value}` : "forward";
3116
+ case "worker":
3117
+ return value ? `worker ${value}` : "worker";
3118
+ case "drop":
3119
+ return "drop";
3120
+ default:
3121
+ return action.type;
3122
+ }
3123
+ }
3124
+ __name(describeRemoteAction, "describeRemoteAction");
3125
+ function describeConflictOwner(remote) {
3126
+ if (remote.source === "wrangler") {
3127
+ return remote.owner_worker_name ? `owned by worker "${remote.owner_worker_name}"` : "owned by another Worker";
3128
+ }
3129
+ return "managed outside Wrangler";
3130
+ }
3131
+ __name(describeConflictOwner, "describeConflictOwner");
3132
+ function renderEmailRoutingPlan(plan, workerName) {
3133
+ const lines = [];
3134
+ const counts = {
3135
+ added: 0,
3136
+ updated: 0,
3137
+ deleted: 0,
3138
+ conflict: 0
3139
+ };
3140
+ let zonesWithChanges = 0;
3141
+ for (const zone of plan.zones) {
3142
+ if (zone.changes.length === 0) {
3143
+ continue;
3144
+ }
3145
+ zonesWithChanges++;
3146
+ lines.push(zone.zone_name ?? zone.zone_id);
3147
+ for (const change of zone.changes) {
3148
+ counts[change.type]++;
3149
+ const marker = CHANGE_MARKERS[change.type];
3150
+ switch (change.type) {
3151
+ case "added":
3152
+ case "updated":
3153
+ lines.push(` ${marker} ${change.target} -> worker (${workerName})`);
3154
+ break;
3155
+ case "deleted":
3156
+ lines.push(` ${marker} ${change.target} (removed from config)`);
3157
+ break;
3158
+ case "conflict": {
3159
+ const remote = change.remote;
3160
+ const detail = remote ? `conflict: ${describeConflictOwner(remote)} (${describeRemoteAction(remote)})` : "conflict";
3161
+ lines.push(` ${marker} ${change.target} -> ${detail}`);
3162
+ break;
3163
+ }
3164
+ }
3165
+ }
3166
+ }
3167
+ const total = counts.added + counts.updated + counts.deleted + counts.conflict;
3168
+ const parts = [];
3169
+ if (counts.added) {
3170
+ parts.push(`${counts.added} added`);
3171
+ }
3172
+ if (counts.updated) {
3173
+ parts.push(`${counts.updated} updated`);
3174
+ }
3175
+ if (counts.deleted) {
3176
+ parts.push(`${counts.deleted} deleted`);
3177
+ }
3178
+ if (counts.conflict) {
3179
+ parts.push(`${counts.conflict} conflict`);
3180
+ }
3181
+ lines.push(
3182
+ `${total} ${total === 1 ? "change" : "changes"} across ${zonesWithChanges} ${zonesWithChanges === 1 ? "zone" : "zones"}${parts.length ? ` (${parts.join(", ")})` : ""}`
3183
+ );
3184
+ return lines;
3185
+ }
3186
+ __name(renderEmailRoutingPlan, "renderEmailRoutingPlan");
3187
+
3188
+ // src/triggers/email-routing.ts
3189
+ var PLAN_RETRY_WORKER_NOT_FOUND_CODE = 2016;
3190
+ var PLAN_RETRY_TIMEOUT_MS = 3e4;
3191
+ var PLAN_RETRY_DELAY_MS = 3e3;
3192
+ var NON_INTERACTIVE_PROGRESS_INTERVAL = 10;
3193
+ function applyProgressMessage(done, total) {
3194
+ return `Applying Email Routing changes (${done}/${total}, ${Math.floor(
3195
+ done * 100 / total
3196
+ )}%)`;
3197
+ }
3198
+ __name(applyProgressMessage, "applyProgressMessage");
3199
+ function startApplyProgress(total) {
3200
+ if (!isNonInteractiveOrCI()) {
3201
+ const progress = spinner();
3202
+ progress.start(applyProgressMessage(0, total));
3203
+ return {
3204
+ update: /* @__PURE__ */ __name((done) => progress.update(applyProgressMessage(done, total)), "update"),
3205
+ stop: /* @__PURE__ */ __name(() => progress.stop(), "stop")
3206
+ };
3207
+ }
3208
+ logger.log(applyProgressMessage(0, total));
3209
+ return {
3210
+ update(done) {
3211
+ if (done === total || done % NON_INTERACTIVE_PROGRESS_INTERVAL === 0) {
3212
+ logger.log(applyProgressMessage(done, total));
3213
+ }
3214
+ },
3215
+ stop() {
3216
+ }
3217
+ };
3218
+ }
3219
+ __name(startApplyProgress, "startApplyProgress");
3220
+ function postJson(body) {
3221
+ return {
3222
+ method: "POST",
3223
+ headers: { "Content-Type": "application/json" },
3224
+ body: JSON.stringify(body)
3225
+ };
3226
+ }
3227
+ __name(postJson, "postJson");
3228
+ function desiredRuleBody(target, workerName, ownerWorkerTag) {
3229
+ return {
3230
+ ...ruleShapeForTarget(target, workerName),
3231
+ enabled: true,
3232
+ source: "wrangler",
3233
+ owner_worker_tag: ownerWorkerTag
3234
+ };
3235
+ }
3236
+ __name(desiredRuleBody, "desiredRuleBody");
3237
+ var RESET_CATCH_ALL_BODY = {
3238
+ matchers: [{ type: "all" }],
3239
+ actions: [{ type: "drop" }],
3240
+ enabled: false,
3241
+ name: "",
3242
+ source: "api"
3243
+ };
3244
+ async function resolveOwnerWorkerTag(config, accountId, scriptName) {
3245
+ const deadline = Date.now() + PLAN_RETRY_TIMEOUT_MS;
3246
+ for (; ; ) {
3247
+ try {
3248
+ const { default_environment } = await fetchResult(config, `/accounts/${accountId}/workers/services/${scriptName}`);
3249
+ return default_environment.script.tag;
3250
+ } catch (error) {
3251
+ if (!isWorkerNotFoundError(error)) {
3252
+ throw error;
3253
+ }
3254
+ if (Date.now() + PLAN_RETRY_DELAY_MS >= deadline) {
3255
+ throw new UserError(
3256
+ "Email Routing could not find the deployed Worker yet. Re-run the deployment.",
3257
+ { telemetryMessage: "email routing worker metadata not found" }
3258
+ );
3259
+ }
3260
+ await new Promise((resolve2) => setTimeout(resolve2, PLAN_RETRY_DELAY_MS));
3261
+ }
3262
+ }
3263
+ }
3264
+ __name(resolveOwnerWorkerTag, "resolveOwnerWorkerTag");
3265
+ async function fetchEmailRoutingPlan(config, accountId, request2) {
3266
+ const deadline = Date.now() + PLAN_RETRY_TIMEOUT_MS;
3267
+ for (; ; ) {
3268
+ try {
3269
+ return await fetchResult(
3270
+ config,
3271
+ `/accounts/${accountId}/email/routing/rules/plan`,
3272
+ postJson(request2)
3273
+ );
3274
+ } catch (e) {
3275
+ const isWorkerNotFound = e instanceof APIError && e.code === PLAN_RETRY_WORKER_NOT_FOUND_CODE;
3276
+ if (!isWorkerNotFound) {
3277
+ throw e;
3278
+ }
3279
+ if (Date.now() + PLAN_RETRY_DELAY_MS >= deadline) {
3280
+ throw new UserError(
3281
+ "Email Routing could not find the deployed Worker yet. Re-run the deployment.",
3282
+ { telemetryMessage: "email routing plan worker not found" }
3283
+ );
3284
+ }
3285
+ await new Promise((resolve2) => setTimeout(resolve2, PLAN_RETRY_DELAY_MS));
3286
+ }
3287
+ }
3288
+ }
3289
+ __name(fetchEmailRoutingPlan, "fetchEmailRoutingPlan");
3290
+ function putJson(config, path9, body) {
3291
+ return fetchResult(config, path9, {
3292
+ method: "PUT",
3293
+ headers: { "Content-Type": "application/json" },
3294
+ body: JSON.stringify(body)
3295
+ });
3296
+ }
3297
+ __name(putJson, "putJson");
3298
+ async function applyChange(config, zoneId, change, workerName, ownerWorkerTag) {
3299
+ if (isCatchAllAddress(change.target)) {
3300
+ await putJson(
3301
+ config,
3302
+ `/zones/${zoneId}/email/routing/rules/catch_all`,
3303
+ change.type === "deleted" ? RESET_CATCH_ALL_BODY : desiredRuleBody(change.target, workerName, ownerWorkerTag)
3304
+ );
3305
+ return;
3306
+ }
3307
+ switch (change.type) {
3308
+ case "added":
3309
+ await fetchResult(
3310
+ config,
3311
+ `/zones/${zoneId}/email/routing/rules`,
3312
+ postJson(desiredRuleBody(change.target, workerName, ownerWorkerTag))
3313
+ );
3314
+ return;
3315
+ // `conflict` only reaches here once the user accepted the takeover; it is
3316
+ // applied the same way as an update: overwrite the existing rule.
3317
+ case "updated":
3318
+ case "conflict": {
3319
+ const id = change.remote?.id;
3320
+ if (!id) {
3321
+ throw new UserError(
3322
+ `Email Routing plan was missing the rule id for "${change.target}"; re-run the deployment.`,
3323
+ { telemetryMessage: "email routing plan missing rule id" }
3324
+ );
3325
+ }
3326
+ await putJson(
3327
+ config,
3328
+ `/zones/${zoneId}/email/routing/rules/${id}`,
3329
+ desiredRuleBody(change.target, workerName, ownerWorkerTag)
3330
+ );
3331
+ return;
3332
+ }
3333
+ case "deleted": {
3334
+ const id = change.remote?.id;
3335
+ if (!id) {
3336
+ throw new UserError(
3337
+ `Email Routing plan was missing the rule id for "${change.target}"; re-run the deployment.`,
3338
+ { telemetryMessage: "email routing plan missing rule id" }
3339
+ );
3340
+ }
3341
+ await fetchResult(config, `/zones/${zoneId}/email/routing/rules/${id}`, {
3342
+ method: "DELETE"
3343
+ });
3344
+ return;
3345
+ }
3346
+ }
3347
+ }
3348
+ __name(applyChange, "applyChange");
3349
+ async function applyEmailRoutingAddresses({
3350
+ config,
3351
+ accountId,
3352
+ scriptName,
3353
+ workerTag
3354
+ }) {
3355
+ const { addresses } = config;
3356
+ if (addresses === void 0) {
3357
+ return;
3358
+ }
3359
+ const ownerWorkerTag = workerTag ?? await resolveOwnerWorkerTag(config, accountId, scriptName);
3360
+ const request2 = buildEmailRoutingPlanRequest(
3361
+ addresses,
3362
+ scriptName,
3363
+ ownerWorkerTag
3364
+ );
3365
+ const plan = await fetchEmailRoutingPlan(config, accountId, request2);
3366
+ if (!planHasChanges(plan)) {
3367
+ logger.log("Email Routing rules are up to date.");
3368
+ return;
3369
+ }
3370
+ logger.log(
3371
+ ["Email Routing plan:", ...renderEmailRoutingPlan(plan, scriptName)].join(
3372
+ "\n"
3373
+ )
3374
+ );
3375
+ if (planHasDestructiveChanges(plan)) {
3376
+ if (isNonInteractiveOrCI()) {
3377
+ throw new UserError(
3378
+ "The Worker is deployed, but Email Routing has destructive changes (deletes or takeover conflicts) that need confirmation. Re-run the deployment interactively, or remove the conflicting entries from `addresses`.",
3379
+ {
3380
+ telemetryMessage: "email routing destructive changes need confirmation"
3381
+ }
3382
+ );
3383
+ }
3384
+ const accepted = await confirm(
3385
+ "Apply these Email Routing changes (including the destructive ones above)?",
3386
+ { defaultValue: false }
3387
+ );
3388
+ if (!accepted) {
3389
+ throw new UserError(
3390
+ "The Worker is deployed, but the Email Routing changes were declined; no rules were modified.",
3391
+ { telemetryMessage: "email routing changes declined" }
3392
+ );
3393
+ }
3394
+ }
3395
+ const failures = [];
3396
+ const totalChanges = plan.zones.reduce(
3397
+ (total, zone) => total + zone.changes.length,
3398
+ 0
3399
+ );
3400
+ const progress = startApplyProgress(totalChanges);
3401
+ let completedChanges = 0;
3402
+ try {
3403
+ for (const zone of plan.zones) {
3404
+ for (const change of zone.changes) {
3405
+ try {
3406
+ await applyChange(
3407
+ config,
3408
+ zone.zone_id,
3409
+ change,
3410
+ scriptName,
3411
+ ownerWorkerTag
3412
+ );
3413
+ } catch (e) {
3414
+ failures.push(
3415
+ `${change.target}: ${e instanceof Error ? e.message : String(e)}`
3416
+ );
3417
+ } finally {
3418
+ completedChanges++;
3419
+ progress.update(completedChanges);
3420
+ }
3421
+ }
3422
+ }
3423
+ } finally {
3424
+ progress.stop();
3425
+ }
3426
+ if (failures.length > 0) {
3427
+ for (const failure of failures) {
3428
+ logger.error(`Email Routing change failed: ${failure}`);
3429
+ }
3430
+ throw new UserError(
3431
+ `The Worker is deployed, but Email Routing was not fully applied (${failures.length} change(s) failed). Re-run the deployment to retry.`,
3432
+ { telemetryMessage: "email routing apply partial failure" }
3433
+ );
3434
+ }
3435
+ logger.log("Email Routing addresses applied.");
3436
+ }
3437
+ __name(applyEmailRoutingAddresses, "applyEmailRoutingAddresses");
3041
3438
  async function getZoneForRoute(complianceConfig, from, zoneIdCache = /* @__PURE__ */ new Map()) {
3042
3439
  const { route, accountId } = from;
3043
3440
  const host = getHostFromRoute(route);
@@ -3564,13 +3961,21 @@ var queuesUrl = /* @__PURE__ */ __name((accountId, queueId) => {
3564
3961
  }
3565
3962
  return url2;
3566
3963
  }, "queuesUrl");
3567
- async function ensureQueuesExistByConfig(config, accountId) {
3568
- const producers = (config.queues.producers || []).map(
3569
- (producer) => producer.queue
3570
- );
3571
- const consumers = (config.queues.consumers || []).map(
3572
- (consumer) => consumer.queue
3573
- );
3964
+ async function ensureQueuesExistByConfig(config, accountId, includeProducers = true, scriptName) {
3965
+ const producerNames = (config.queues.producers || []).flatMap((producer) => {
3966
+ if (producer.queue) {
3967
+ return [producer.queue];
3968
+ }
3969
+ if (!includeProducers && scriptName) {
3970
+ return [
3971
+ `${scriptName}-${producer.binding.toLowerCase().replaceAll("_", "-")}`
3972
+ ];
3973
+ }
3974
+ return [];
3975
+ });
3976
+ const producers = includeProducers ? producerNames : [];
3977
+ const provisionableQueues = new Set(producerNames);
3978
+ const consumers = (config.queues.consumers || []).map((consumer) => consumer.queue).filter((queue) => includeProducers || !provisionableQueues.has(queue));
3574
3979
  const queueNames = producers.concat(consumers);
3575
3980
  if (queueNames.length > 0) {
3576
3981
  const params = new URLSearchParams();
@@ -3902,7 +4307,9 @@ ${dashLink}`, {
3902
4307
  if (config.queues.producers && config.queues.producers.length) {
3903
4308
  deployments.push(
3904
4309
  ...config.queues.producers.map(
3905
- (producer) => Promise.resolve({ targets: [`Producer for ${producer.queue}`] })
4310
+ (producer) => Promise.resolve({
4311
+ targets: [`Producer for ${producer.queue ?? producer.binding}`]
4312
+ })
3906
4313
  )
3907
4314
  );
3908
4315
  }
@@ -3992,6 +4399,19 @@ ${dashLink}`, {
3992
4399
  logger.log("No targets deployed for", workerName, formatTime(deployMs));
3993
4400
  }
3994
4401
  const errors = completedDeployments.map((deployment) => deployment.error).filter((error) => error !== void 0);
4402
+ try {
4403
+ await applyEmailRoutingAddresses({
4404
+ config,
4405
+ accountId,
4406
+ scriptName,
4407
+ workerTag: props.workerTag
4408
+ });
4409
+ } catch (error) {
4410
+ if (errors.length === 0) {
4411
+ throw error;
4412
+ }
4413
+ errors.push(error instanceof Error ? error : new Error(String(error)));
4414
+ }
3995
4415
  if (errors.length > 0) {
3996
4416
  throw new UserError(
3997
4417
  `Some triggers failed to deploy for ${workerName}:
@@ -5387,12 +5807,12 @@ var Mime = class {
5387
5807
  }
5388
5808
  return this;
5389
5809
  }
5390
- getType(path10) {
5391
- if (typeof path10 !== "string")
5810
+ getType(path9) {
5811
+ if (typeof path9 !== "string")
5392
5812
  return null;
5393
- const last = path10.replace(/^.*[/\\]/s, "").toLowerCase();
5813
+ const last = path9.replace(/^.*[/\\]/s, "").toLowerCase();
5394
5814
  const ext = last.replace(/^.*\./s, "").toLowerCase();
5395
- const hasPath = last.length < path10.length;
5815
+ const hasPath = last.length < path9.length;
5396
5816
  const hasDot = ext.length < last.length - 1;
5397
5817
  if (!hasDot && hasPath)
5398
5818
  return null;
@@ -5523,7 +5943,7 @@ var MAX_UPLOAD_ATTEMPTS = 5;
5523
5943
  var MAX_UPLOAD_GATEWAY_ERRORS = 5;
5524
5944
  var MAX_DIFF_LINES = 100;
5525
5945
  var syncAssets = /* @__PURE__ */ __name(async (complianceConfig, accountId, assetDirectory, scriptName, dispatchNamespace) => {
5526
- assert4(accountId, "Missing accountId");
5946
+ assert3(accountId, "Missing accountId");
5527
5947
  logger.info("\u{1F300} Building list of assets...");
5528
5948
  const manifest = await buildAssetManifest(assetDirectory);
5529
5949
  const url2 = dispatchNamespace ? `/accounts/${accountId}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${scriptName}/assets-upload-session` : `/accounts/${accountId}/workers/scripts/${scriptName}/assets-upload-session`;
@@ -5897,378 +6317,37 @@ function resolveAssetOptions({ assetsDir, main }, config) {
5897
6317
  };
5898
6318
  }
5899
6319
  __name(resolveAssetOptions, "resolveAssetOptions");
6320
+ var ONE_KIB_BYTES = 1024;
6321
+ var MAX_GZIP_SIZE_BYTES = 3 * ONE_KIB_BYTES * ONE_KIB_BYTES;
6322
+ async function getSize(modules) {
6323
+ const gzipSize = gzipSync(
6324
+ await new Blob(modules.map((file) => file.content)).arrayBuffer()
6325
+ ).byteLength;
6326
+ const aggregateSize = new Blob(modules.map((file) => file.content)).size;
6327
+ return { size: aggregateSize, gzipSize };
6328
+ }
6329
+ __name(getSize, "getSize");
6330
+ async function printBundleSize(main, modules) {
6331
+ const { size, gzipSize } = await getSize([...modules, main]);
6332
+ const bundleReport = `${(size / ONE_KIB_BYTES).toFixed(2)} KiB / gzip: ${(gzipSize / ONE_KIB_BYTES).toFixed(2)} KiB`;
6333
+ const percentage = gzipSize / MAX_GZIP_SIZE_BYTES * 100;
6334
+ const colorizedReport = percentage > 90 ? chalk5.red(bundleReport) : percentage > 70 ? chalk5.yellow(bundleReport) : chalk5.green(bundleReport);
6335
+ logger.log(`Total Upload: ${colorizedReport}`);
6336
+ }
6337
+ __name(printBundleSize, "printBundleSize");
5900
6338
 
5901
- // src/deploy/helpers/binding-utils.ts
5902
- function assertNever(_value) {
5903
- }
5904
- __name(assertNever, "assertNever");
5905
- function convertConfigToBindings(config, options) {
5906
- const { usePreviewIds = false, pages = false } = options ?? {};
5907
- const output = {};
5908
- const configIterable = Object.entries(config);
5909
- for (const [type, info] of configIterable) {
5910
- if (info === void 0) {
5911
- continue;
5912
- }
5913
- switch (type) {
5914
- case "vars": {
5915
- for (const [key, value] of Object.entries(info)) {
5916
- if (typeof value === "string") {
5917
- output[key] = { type: "plain_text", value };
5918
- } else {
5919
- output[key] = { type: "json", value };
5920
- }
5921
- }
5922
- break;
5923
- }
5924
- case "kv_namespaces": {
5925
- for (const { binding, ...x } of info) {
5926
- output[binding] = {
5927
- type: "kv_namespace",
5928
- ...x,
5929
- id: usePreviewIds ? x.preview_id ?? x.id : x.id
5930
- };
5931
- }
5932
- break;
5933
- }
5934
- case "send_email": {
5935
- if (pages) {
5936
- break;
5937
- }
5938
- for (const { name, ...x } of info) {
5939
- output[name] = { type: "send_email", ...x };
5940
- }
5941
- break;
5942
- }
5943
- case "wasm_modules": {
5944
- if (pages) {
5945
- break;
5946
- }
5947
- for (const [key, value] of Object.entries(info)) {
5948
- if (typeof value === "string") {
5949
- output[key] = { type: "wasm_module", source: { path: value } };
5950
- } else {
5951
- output[key] = { type: "wasm_module", source: { contents: value } };
5952
- }
5953
- }
5954
- break;
5955
- }
5956
- case "text_blobs": {
5957
- if (pages) {
5958
- break;
5959
- }
5960
- for (const [key, value] of Object.entries(info)) {
5961
- output[key] = { type: "text_blob", source: { path: value } };
5962
- }
5963
- break;
5964
- }
5965
- case "data_blobs": {
5966
- if (pages) {
5967
- break;
5968
- }
5969
- for (const [key, value] of Object.entries(info)) {
5970
- if (typeof value === "string") {
5971
- output[key] = { type: "data_blob", source: { path: value } };
5972
- } else {
5973
- output[key] = { type: "data_blob", source: { contents: value } };
5974
- }
5975
- }
5976
- break;
5977
- }
5978
- case "browser": {
5979
- const { binding, ...x } = info;
5980
- output[binding] = { type: "browser", ...x };
5981
- break;
5982
- }
5983
- case "durable_objects": {
5984
- for (const { name, ...x } of info.bindings ?? []) {
5985
- output[name] = { type: "durable_object_namespace", ...x };
5986
- }
5987
- break;
5988
- }
5989
- case "workflows": {
5990
- for (const { binding, ...x } of info) {
5991
- output[binding] = { type: "workflow", ...x };
5992
- }
5993
- break;
5994
- }
5995
- case "queues": {
5996
- for (const { binding, ...x } of info.producers ?? []) {
5997
- output[binding] = {
5998
- type: "queue",
5999
- queue_name: x.queue,
6000
- ...x
6001
- };
6002
- }
6003
- break;
6004
- }
6005
- case "r2_buckets": {
6006
- for (const { binding, ...x } of info) {
6007
- output[binding] = {
6008
- type: "r2_bucket",
6009
- ...x,
6010
- bucket_name: usePreviewIds ? x.preview_bucket_name ?? x.bucket_name : x.bucket_name
6011
- };
6012
- }
6013
- break;
6014
- }
6015
- case "d1_databases": {
6016
- for (const { binding, ...x } of info) {
6017
- output[binding] = {
6018
- type: "d1",
6019
- ...x,
6020
- database_id: usePreviewIds ? x.preview_database_id ?? x.database_id : x.database_id
6021
- };
6022
- }
6023
- break;
6024
- }
6025
- case "services": {
6026
- for (const { binding, ...x } of info) {
6027
- output[binding] = { type: "service", ...x };
6028
- }
6029
- break;
6030
- }
6031
- case "analytics_engine_datasets": {
6032
- for (const { binding, ...x } of info) {
6033
- output[binding] = { type: "analytics_engine", ...x };
6034
- }
6035
- break;
6036
- }
6037
- case "dispatch_namespaces": {
6038
- if (pages) {
6039
- break;
6040
- }
6041
- for (const { binding, ...x } of info) {
6042
- output[binding] = { type: "dispatch_namespace", ...x };
6043
- }
6044
- break;
6045
- }
6046
- case "mtls_certificates": {
6047
- for (const { binding, ...x } of info) {
6048
- output[binding] = { type: "mtls_certificate", ...x };
6049
- }
6050
- break;
6051
- }
6052
- case "logfwdr": {
6053
- if (pages) {
6054
- break;
6055
- }
6056
- for (const { name, ...x } of info.bindings ?? []) {
6057
- output[name] = { type: "logfwdr", ...x };
6058
- }
6059
- break;
6060
- }
6061
- case "ai": {
6062
- const { binding, ...x } = info;
6063
- output[binding] = { type: "ai", ...x };
6064
- break;
6065
- }
6066
- case "images": {
6067
- const { binding, ...x } = info;
6068
- output[binding] = { type: "images", ...x };
6069
- break;
6070
- }
6071
- case "stream": {
6072
- const { binding, ...x } = info;
6073
- output[binding] = { type: "stream", ...x };
6074
- break;
6075
- }
6076
- case "version_metadata": {
6077
- const { binding, ...x } = info;
6078
- output[binding] = { type: "version_metadata", ...x };
6079
- break;
6080
- }
6081
- case "hyperdrive": {
6082
- for (const { binding, ...x } of info) {
6083
- output[binding] = { type: "hyperdrive", ...x };
6084
- }
6085
- break;
6086
- }
6087
- case "vectorize": {
6088
- for (const { binding, ...x } of info) {
6089
- output[binding] = { type: "vectorize", ...x };
6090
- }
6091
- break;
6092
- }
6093
- case "ai_search_namespaces": {
6094
- for (const { binding, ...x } of info) {
6095
- output[binding] = { type: "ai_search_namespace", ...x };
6096
- }
6097
- break;
6098
- }
6099
- case "ai_search": {
6100
- for (const { binding, ...x } of info) {
6101
- output[binding] = { type: "ai_search", ...x };
6102
- }
6103
- break;
6104
- }
6105
- case "websearch": {
6106
- const { binding, ...x } = info;
6107
- output[binding] = { type: "websearch", ...x };
6108
- break;
6109
- }
6110
- case "agent_memory": {
6111
- for (const { binding, ...x } of info) {
6112
- output[binding] = { type: "agent_memory", ...x };
6113
- }
6114
- break;
6115
- }
6116
- case "unsafe": {
6117
- if (pages) {
6118
- break;
6119
- }
6120
- for (const { type: unsafeType, name, ...data } of info.bindings ?? []) {
6121
- output[name] = { type: `unsafe_${unsafeType}`, ...data };
6122
- }
6123
- break;
6124
- }
6125
- case "assets": {
6126
- if (pages) {
6127
- break;
6128
- }
6129
- if (info.binding) {
6130
- output[info.binding] = { type: "assets" };
6131
- }
6132
- break;
6133
- }
6134
- case "pipelines": {
6135
- if (pages) {
6136
- break;
6137
- }
6138
- for (const { binding, ...x } of info) {
6139
- output[binding] = { type: "pipeline", ...x };
6140
- }
6141
- break;
6142
- }
6143
- case "secrets_store_secrets": {
6144
- for (const { binding, ...x } of info) {
6145
- output[binding] = { type: "secrets_store_secret", ...x };
6146
- }
6147
- break;
6148
- }
6149
- case "artifacts": {
6150
- for (const { binding, ...x } of info) {
6151
- output[binding] = { type: "artifacts", ...x };
6152
- }
6153
- break;
6154
- }
6155
- case "unsafe_hello_world": {
6156
- if (pages) {
6157
- break;
6158
- }
6159
- for (const { binding, ...x } of info) {
6160
- output[binding] = { type: "unsafe_hello_world", ...x };
6161
- }
6162
- break;
6163
- }
6164
- case "flagship": {
6165
- for (const { binding, ...x } of info) {
6166
- output[binding] = { type: "flagship", ...x };
6167
- }
6168
- break;
6169
- }
6170
- case "ratelimits": {
6171
- for (const { name, ...x } of info) {
6172
- output[name] = { type: "ratelimit", ...x };
6173
- }
6174
- break;
6175
- }
6176
- case "worker_loaders": {
6177
- for (const { binding, ...x } of info) {
6178
- output[binding] = { type: "worker_loader", ...x };
6179
- }
6180
- break;
6181
- }
6182
- case "vpc_services": {
6183
- for (const { binding, ...x } of info) {
6184
- output[binding] = { type: "vpc_service", ...x };
6185
- }
6186
- break;
6187
- }
6188
- case "vpc_networks": {
6189
- for (const { binding, ...x } of info) {
6190
- output[binding] = { type: "vpc_network", ...x };
6191
- }
6192
- break;
6193
- }
6194
- case "media": {
6195
- const { binding, ...x } = info;
6196
- output[binding] = { type: "media", ...x };
6197
- break;
6198
- }
6199
- }
6200
- }
6201
- return output;
6202
- }
6203
- __name(convertConfigToBindings, "convertConfigToBindings");
6204
- function isUnsafeBindingType(type) {
6205
- return type.startsWith("unsafe_");
6206
- }
6207
- __name(isUnsafeBindingType, "isUnsafeBindingType");
6208
- var nameBindings = [
6209
- "durable_object_namespace",
6210
- "logfwdr",
6211
- "ratelimit",
6212
- "unsafe_ratelimit",
6213
- "send_email"
6214
- ];
6215
- function getBindingKey(type) {
6216
- if (nameBindings.includes(type)) {
6217
- return "name";
6218
- }
6219
- return "binding";
6220
- }
6221
- __name(getBindingKey, "getBindingKey");
6222
- function extractBindingsOfType(type, bindings) {
6223
- return Object.entries(bindings ?? {}).filter(
6224
- (binding) => binding[1].type === type
6225
- ).map((binding) => ({
6226
- ...binding[1],
6227
- [getBindingKey(type)]: binding[0]
6228
- }));
6229
- }
6230
- __name(extractBindingsOfType, "extractBindingsOfType");
6231
- function getBindings(config, options) {
6232
- if (!config) {
6233
- return {};
6234
- }
6235
- return convertConfigToBindings(config, {
6236
- usePreviewIds: false,
6237
- pages: options?.pages
6238
- });
6239
- }
6240
- __name(getBindings, "getBindings");
6241
- var ONE_KIB_BYTES = 1024;
6242
- var MAX_GZIP_SIZE_BYTES = 3 * ONE_KIB_BYTES * ONE_KIB_BYTES;
6243
- async function getSize(modules) {
6244
- const gzipSize = gzipSync(
6245
- await new Blob(modules.map((file) => file.content)).arrayBuffer()
6246
- ).byteLength;
6247
- const aggregateSize = new Blob(modules.map((file) => file.content)).size;
6248
- return { size: aggregateSize, gzipSize };
6249
- }
6250
- __name(getSize, "getSize");
6251
- async function printBundleSize(main, modules) {
6252
- const { size, gzipSize } = await getSize([...modules, main]);
6253
- const bundleReport = `${(size / ONE_KIB_BYTES).toFixed(2)} KiB / gzip: ${(gzipSize / ONE_KIB_BYTES).toFixed(2)} KiB`;
6254
- const percentage = gzipSize / MAX_GZIP_SIZE_BYTES * 100;
6255
- const colorizedReport = percentage > 90 ? chalk5.red(bundleReport) : percentage > 70 ? chalk5.yellow(bundleReport) : chalk5.green(bundleReport);
6256
- logger.log(`Total Upload: ${colorizedReport}`);
6257
- }
6258
- __name(printBundleSize, "printBundleSize");
6259
-
6260
- // src/deploy/helpers/versions-api.ts
6261
- async function fetchVersion(complianceConfig, accountId, workerName, versionId, versionCache) {
6262
- const cachedVersion = versionCache?.get(versionId);
6263
- if (cachedVersion) {
6264
- return cachedVersion;
6265
- }
6266
- const version = await fetchResult(
6267
- complianceConfig,
6268
- `/accounts/${accountId}/workers/scripts/${workerName}/versions/${versionId}`
6269
- );
6270
- versionCache?.set(version.id, version);
6271
- return version;
6339
+ // src/deploy/helpers/versions-api.ts
6340
+ async function fetchVersion(complianceConfig, accountId, workerName, versionId, versionCache) {
6341
+ const cachedVersion = versionCache?.get(versionId);
6342
+ if (cachedVersion) {
6343
+ return cachedVersion;
6344
+ }
6345
+ const version = await fetchResult(
6346
+ complianceConfig,
6347
+ `/accounts/${accountId}/workers/scripts/${workerName}/versions/${versionId}`
6348
+ );
6349
+ versionCache?.set(version.id, version);
6350
+ return version;
6272
6351
  }
6273
6352
  __name(fetchVersion, "fetchVersion");
6274
6353
  async function fetchVersions(complianceConfig, accountId, workerName, versionCache, versionIds) {
@@ -6364,15 +6443,6 @@ async function patchNonVersionedScriptSettings(complianceConfig, accountId, work
6364
6443
  }
6365
6444
  __name(patchNonVersionedScriptSettings, "patchNonVersionedScriptSettings");
6366
6445
 
6367
- // src/deploy/helpers/worker-not-found-error.ts
6368
- var WORKER_NOT_FOUND_ERR_CODE = 10007;
6369
- var WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE = 10090;
6370
- var workerNotFoundErrorMessage = "This Worker does not exist on your account.";
6371
- function isWorkerNotFoundError(error) {
6372
- return typeof error === "object" && error !== null && "code" in error && (error.code === WORKER_NOT_FOUND_ERR_CODE || error.code === WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE);
6373
- }
6374
- __name(isWorkerNotFoundError, "isWorkerNotFoundError");
6375
-
6376
6446
  // src/deploy/helpers/confirm-latest-deployment-overwrite.ts
6377
6447
  var BLANK_INPUT = "-";
6378
6448
  async function confirmLatestDeploymentOverwrite(config, accountId, scriptName) {
@@ -6393,802 +6463,54 @@ async function confirmLatestDeploymentOverwrite(config, accountId, scriptName) {
6393
6463
  "last",
6394
6464
  versionCache
6395
6465
  );
6396
- return inputPrompt({
6397
- type: "confirm",
6398
- question: `"wrangler deploy" will upload a new version and deploy it globally immediately.
6399
- Are you sure you want to continue?`,
6400
- label: "",
6401
- defaultValue: isNonInteractiveOrCI(),
6402
- acceptDefault: isNonInteractiveOrCI()
6403
- });
6404
- }
6405
- } catch (e) {
6406
- if (!isWorkerNotFoundError(e)) {
6407
- throw e;
6408
- }
6409
- }
6410
- return true;
6411
- }
6412
- __name(confirmLatestDeploymentOverwrite, "confirmLatestDeploymentOverwrite");
6413
- async function printDeployment(config, accountId, workerName, deployment, adjective, versionCache) {
6414
- const [versions, traffic] = await fetchDeploymentVersions(
6415
- config,
6416
- accountId,
6417
- workerName,
6418
- deployment,
6419
- versionCache
6420
- );
6421
- cli.logRaw(
6422
- `${leftT} Your ${adjective} deployment has ${versions.length} version(s):`
6423
- );
6424
- printVersions(versions, traffic);
6425
- }
6426
- __name(printDeployment, "printDeployment");
6427
- function printVersions(versions, traffic) {
6428
- cli.newline();
6429
- cli.log(formatVersions(versions, traffic));
6430
- cli.newline();
6431
- }
6432
- __name(printVersions, "printVersions");
6433
- function formatVersions(versions, traffic) {
6434
- return versions.map((version) => {
6435
- const trafficString = brandColor(`(${traffic.get(version.id)}%)`);
6436
- const versionIdString = white(version.id);
6437
- return gray(`${trafficString} ${versionIdString}
6438
- Created: ${version.metadata.created_on}
6439
- Tag: ${version.annotations?.["workers/tag"] ?? BLANK_INPUT}
6440
- Message: ${version.annotations?.["workers/message"] ?? BLANK_INPUT}`);
6441
- }).join("\n\n");
6442
- }
6443
- __name(formatVersions, "formatVersions");
6444
- function handleUnsafeCapnp(capnp) {
6445
- if (capnp.compiled_schema) {
6446
- return readFileSync(resolve(capnp.compiled_schema));
6447
- }
6448
- const { base_path, source_schemas } = capnp;
6449
- const capnpSchemas = (source_schemas ?? []).map(
6450
- (x) => resolve(base_path, x)
6451
- );
6452
- if (!sync("capnp")) {
6453
- throw new UserError(
6454
- "The capnp compiler is required to upload capnp schemas, but is not present.",
6455
- { telemetryMessage: "capnp compiler missing" }
6456
- );
6457
- }
6458
- const srcPrefix = resolve(base_path ?? ".");
6459
- const capnpProcess = spawnSync(
6460
- "capnp",
6461
- ["compile", "-o-", `--src-prefix=${srcPrefix}`, ...capnpSchemas],
6462
- // This number was chosen arbitrarily. If you get ENOBUFS because your compiled schema is still
6463
- // too large, then we may need to bump this again or figure out another approach.
6464
- // https://github.com/cloudflare/workers-sdk/pull/10217
6465
- { maxBuffer: 3 * 1024 * 1024 }
6466
- );
6467
- if (capnpProcess.error) {
6468
- throw capnpProcess.error;
6469
- }
6470
- if (capnpProcess.stderr.length) {
6471
- throw new Error(capnpProcess.stderr.toString());
6472
- }
6473
- return capnpProcess.stdout;
6474
- }
6475
- __name(handleUnsafeCapnp, "handleUnsafeCapnp");
6476
-
6477
- // src/deploy/helpers/create-worker-upload-form.ts
6478
- var moduleTypeMimeType = {
6479
- esm: "application/javascript+module",
6480
- commonjs: "application/javascript",
6481
- "compiled-wasm": "application/wasm",
6482
- buffer: "application/octet-stream",
6483
- text: "text/plain",
6484
- python: "text/x-python",
6485
- "python-requirement": "text/x-python-requirement"
6486
- };
6487
- function toMimeType(type) {
6488
- const mimeType = moduleTypeMimeType[type];
6489
- if (mimeType === void 0) {
6490
- throw new TypeError("Unsupported module: " + type);
6491
- }
6492
- return mimeType;
6493
- }
6494
- __name(toMimeType, "toMimeType");
6495
- function fromMimeType(mimeType) {
6496
- const moduleType = Object.keys(moduleTypeMimeType).find(
6497
- (type) => moduleTypeMimeType[type] === mimeType
6498
- );
6499
- if (moduleType === void 0) {
6500
- throw new TypeError("Unsupported mime type: " + mimeType);
6501
- }
6502
- return moduleType;
6503
- }
6504
- __name(fromMimeType, "fromMimeType");
6505
- function createWorkerUploadForm(worker, bindings, options) {
6506
- const formData = new FormData();
6507
- const {
6508
- main,
6509
- sourceMaps,
6510
- migrations,
6511
- exports: configuredExports,
6512
- compatibility_date,
6513
- compatibility_flags,
6514
- keepVars,
6515
- keepSecrets,
6516
- keepBindings,
6517
- logpush,
6518
- placement,
6519
- tail_consumers,
6520
- streaming_tail_consumers,
6521
- limits,
6522
- annotations,
6523
- keep_assets,
6524
- assets,
6525
- observability,
6526
- cache,
6527
- package_dependencies
6528
- } = worker;
6529
- const assetConfig = {
6530
- html_handling: assets?.assetConfig?.html_handling,
6531
- not_found_handling: assets?.assetConfig?.not_found_handling,
6532
- run_worker_first: assets?.run_worker_first,
6533
- _redirects: assets?._redirects,
6534
- _headers: assets?._headers
6535
- };
6536
- if (assets && !assets.routerConfig.has_user_worker) {
6537
- formData.set(
6538
- "metadata",
6539
- JSON.stringify({
6540
- assets: {
6541
- jwt: assets.jwt,
6542
- config: assetConfig
6543
- },
6544
- ...annotations && { annotations },
6545
- ...compatibility_date && { compatibility_date },
6546
- ...compatibility_flags && { compatibility_flags }
6547
- })
6548
- );
6549
- return formData;
6550
- }
6551
- let { modules } = worker;
6552
- const metadataBindings = [];
6553
- const plain_text = extractBindingsOfType("plain_text", bindings);
6554
- const json_bindings = extractBindingsOfType("json", bindings);
6555
- const secret_text = extractBindingsOfType("secret_text", bindings);
6556
- const kv_namespaces = extractBindingsOfType("kv_namespace", bindings);
6557
- const send_email = extractBindingsOfType("send_email", bindings);
6558
- const durable_objects = extractBindingsOfType(
6559
- "durable_object_namespace",
6560
- bindings
6561
- );
6562
- const workflows = extractBindingsOfType("workflow", bindings);
6563
- const queues = extractBindingsOfType("queue", bindings);
6564
- const r2_buckets = extractBindingsOfType("r2_bucket", bindings);
6565
- const d1_databases = extractBindingsOfType("d1", bindings);
6566
- const vectorize = extractBindingsOfType("vectorize", bindings);
6567
- const ai_search_namespaces = extractBindingsOfType(
6568
- "ai_search_namespace",
6569
- bindings
6570
- );
6571
- const ai_search = extractBindingsOfType("ai_search", bindings);
6572
- const websearch = extractBindingsOfType("websearch", bindings)[0];
6573
- const agent_memory = extractBindingsOfType("agent_memory", bindings);
6574
- const hyperdrive = extractBindingsOfType("hyperdrive", bindings);
6575
- const secrets_store_secrets = extractBindingsOfType(
6576
- "secrets_store_secret",
6577
- bindings
6578
- );
6579
- const artifacts = extractBindingsOfType("artifacts", bindings);
6580
- const unsafe_hello_world = extractBindingsOfType(
6581
- "unsafe_hello_world",
6582
- bindings
6583
- );
6584
- const flagship = extractBindingsOfType("flagship", bindings);
6585
- const ratelimits = extractBindingsOfType("ratelimit", bindings);
6586
- const vpc_services = extractBindingsOfType("vpc_service", bindings);
6587
- const vpc_networks = extractBindingsOfType("vpc_network", bindings);
6588
- const services = extractBindingsOfType("service", bindings);
6589
- const analytics_engine_datasets = extractBindingsOfType(
6590
- "analytics_engine",
6591
- bindings
6592
- );
6593
- const dispatch_namespaces = extractBindingsOfType(
6594
- "dispatch_namespace",
6595
- bindings
6596
- );
6597
- const mtls_certificates = extractBindingsOfType("mtls_certificate", bindings);
6598
- const pipelines = extractBindingsOfType("pipeline", bindings);
6599
- const worker_loaders = extractBindingsOfType("worker_loader", bindings);
6600
- const logfwdr = extractBindingsOfType("logfwdr", bindings);
6601
- const wasm_modules = extractBindingsOfType("wasm_module", bindings);
6602
- const browser = extractBindingsOfType("browser", bindings)[0];
6603
- const ai = extractBindingsOfType("ai", bindings)[0];
6604
- const images = extractBindingsOfType("images", bindings)[0];
6605
- const stream = extractBindingsOfType("stream", bindings)[0];
6606
- const media = extractBindingsOfType("media", bindings)[0];
6607
- const version_metadata = extractBindingsOfType(
6608
- "version_metadata",
6609
- bindings
6610
- )[0];
6611
- const assetsBinding = extractBindingsOfType("assets", bindings)[0];
6612
- const text_blobs = extractBindingsOfType("text_blob", bindings);
6613
- const data_blobs = extractBindingsOfType("data_blob", bindings);
6614
- const inherit_bindings = extractBindingsOfType("inherit", bindings);
6615
- inherit_bindings.forEach(({ binding }) => {
6616
- metadataBindings.push({ name: binding, type: "inherit" });
6617
- });
6618
- plain_text.forEach(({ binding, value }) => {
6619
- metadataBindings.push({ name: binding, type: "plain_text", text: value });
6620
- });
6621
- json_bindings.forEach(({ binding, value }) => {
6622
- metadataBindings.push({ name: binding, type: "json", json: value });
6623
- });
6624
- secret_text.forEach(({ binding, value }) => {
6625
- metadataBindings.push({ name: binding, type: "secret_text", text: value });
6626
- });
6627
- kv_namespaces.forEach(({ id, binding, raw }) => {
6628
- if (options?.dryRun) {
6629
- id ??= INHERIT_SYMBOL;
6630
- }
6631
- if (id === void 0) {
6632
- throw new UserError(`${binding} bindings must have an "id" field`, {
6633
- telemetryMessage: "kv namespace binding missing id"
6634
- });
6635
- }
6636
- if (id === INHERIT_SYMBOL) {
6637
- metadataBindings.push({
6638
- name: binding,
6639
- type: "inherit"
6640
- });
6641
- } else {
6642
- metadataBindings.push({
6643
- name: binding,
6644
- type: "kv_namespace",
6645
- namespace_id: id,
6646
- raw
6647
- });
6648
- }
6649
- });
6650
- send_email.forEach((emailBinding) => {
6651
- const destination_address = "destination_address" in emailBinding ? emailBinding.destination_address : void 0;
6652
- const allowed_destination_addresses = "allowed_destination_addresses" in emailBinding ? emailBinding.allowed_destination_addresses : void 0;
6653
- const allowed_sender_addresses = "allowed_sender_addresses" in emailBinding ? emailBinding.allowed_sender_addresses : void 0;
6654
- metadataBindings.push({
6655
- name: emailBinding.name,
6656
- type: "send_email",
6657
- destination_address,
6658
- allowed_destination_addresses,
6659
- allowed_sender_addresses
6660
- });
6661
- });
6662
- durable_objects.forEach(({ name, class_name, script_name, environment }) => {
6663
- metadataBindings.push({
6664
- name,
6665
- type: "durable_object_namespace",
6666
- class_name,
6667
- ...script_name && { script_name },
6668
- ...environment && { environment }
6669
- });
6670
- });
6671
- workflows.forEach(({ binding, name, class_name, script_name, raw }) => {
6672
- metadataBindings.push({
6673
- type: "workflow",
6674
- name: binding,
6675
- workflow_name: name,
6676
- class_name,
6677
- script_name,
6678
- raw
6679
- });
6680
- });
6681
- queues.forEach(({ binding, queue_name, delivery_delay, raw }) => {
6682
- metadataBindings.push({
6683
- type: "queue",
6684
- name: binding,
6685
- queue_name,
6686
- delivery_delay,
6687
- raw
6688
- });
6689
- });
6690
- r2_buckets.forEach(({ binding, bucket_name, jurisdiction, raw }) => {
6691
- if (options?.dryRun) {
6692
- bucket_name ??= INHERIT_SYMBOL;
6693
- }
6694
- if (bucket_name === void 0) {
6695
- throw new UserError(
6696
- `${binding} bindings must have a "bucket_name" field`,
6697
- { telemetryMessage: "r2 bucket binding missing bucket_name" }
6698
- );
6699
- }
6700
- if (bucket_name === INHERIT_SYMBOL) {
6701
- metadataBindings.push({
6702
- name: binding,
6703
- type: "inherit"
6704
- });
6705
- } else {
6706
- metadataBindings.push({
6707
- name: binding,
6708
- type: "r2_bucket",
6709
- bucket_name,
6710
- jurisdiction,
6711
- raw
6712
- });
6713
- }
6714
- });
6715
- d1_databases.forEach(
6716
- ({ binding, database_id, database_internal_env, raw }) => {
6717
- if (options?.dryRun) {
6718
- database_id ??= INHERIT_SYMBOL;
6719
- }
6720
- if (database_id === void 0) {
6721
- throw new UserError(
6722
- `${binding} bindings must have a "database_id" field`,
6723
- { telemetryMessage: "d1 database binding missing database_id" }
6724
- );
6725
- }
6726
- if (database_id === INHERIT_SYMBOL) {
6727
- metadataBindings.push({
6728
- name: binding,
6729
- type: "inherit"
6730
- });
6731
- } else {
6732
- metadataBindings.push({
6733
- name: binding,
6734
- type: "d1",
6735
- id: database_id,
6736
- internalEnv: database_internal_env,
6737
- raw
6738
- });
6739
- }
6740
- }
6741
- );
6742
- vectorize.forEach(({ binding, index_name, raw }) => {
6743
- metadataBindings.push({
6744
- name: binding,
6745
- type: "vectorize",
6746
- index_name,
6747
- raw
6748
- });
6749
- });
6750
- ai_search_namespaces.forEach(({ binding, namespace }) => {
6751
- if (options?.dryRun) {
6752
- namespace ??= INHERIT_SYMBOL;
6753
- }
6754
- if (namespace === void 0) {
6755
- throw new UserError(`${binding} bindings must have a "namespace" field`, {
6756
- telemetryMessage: "ai search namespace binding missing namespace"
6757
- });
6758
- }
6759
- if (namespace === INHERIT_SYMBOL) {
6760
- metadataBindings.push({
6761
- name: binding,
6762
- type: "inherit"
6763
- });
6764
- } else {
6765
- metadataBindings.push({
6766
- name: binding,
6767
- type: "ai_search_namespace",
6768
- namespace
6769
- });
6770
- }
6771
- });
6772
- ai_search.forEach(({ binding, instance_name }) => {
6773
- metadataBindings.push({
6774
- name: binding,
6775
- type: "ai_search",
6776
- instance_name
6777
- });
6778
- });
6779
- if (websearch !== void 0) {
6780
- metadataBindings.push({
6781
- name: websearch.binding,
6782
- type: "websearch"
6783
- });
6784
- }
6785
- agent_memory.forEach(({ binding, namespace }) => {
6786
- if (options?.dryRun) {
6787
- namespace ??= INHERIT_SYMBOL;
6788
- }
6789
- if (namespace === void 0) {
6790
- throw new UserError(`${binding} bindings must have a "namespace" field`, {
6791
- telemetryMessage: false
6792
- });
6793
- }
6794
- if (namespace === INHERIT_SYMBOL) {
6795
- metadataBindings.push({
6796
- name: binding,
6797
- type: "inherit"
6798
- });
6799
- } else {
6800
- metadataBindings.push({
6801
- name: binding,
6802
- type: "agent_memory",
6803
- namespace
6804
- });
6805
- }
6806
- });
6807
- hyperdrive.forEach(({ binding, id }) => {
6808
- metadataBindings.push({
6809
- name: binding,
6810
- type: "hyperdrive",
6811
- id
6812
- });
6813
- });
6814
- secrets_store_secrets.forEach(({ binding, store_id, secret_name }) => {
6815
- metadataBindings.push({
6816
- name: binding,
6817
- type: "secrets_store_secret",
6818
- store_id,
6819
- secret_name
6820
- });
6821
- });
6822
- artifacts.forEach(({ binding, namespace }) => {
6823
- metadataBindings.push({
6824
- name: binding,
6825
- type: "artifacts",
6826
- namespace
6827
- });
6828
- });
6829
- unsafe_hello_world.forEach(({ binding, enable_timer }) => {
6830
- metadataBindings.push({
6831
- name: binding,
6832
- type: "unsafe_hello_world",
6833
- enable_timer
6834
- });
6835
- });
6836
- flagship.forEach(({ binding, app_id }) => {
6837
- metadataBindings.push({
6838
- name: binding,
6839
- type: "flagship",
6840
- app_id
6841
- });
6842
- });
6843
- ratelimits.forEach(({ name, namespace_id, simple }) => {
6844
- metadataBindings.push({
6845
- name,
6846
- type: "ratelimit",
6847
- namespace_id,
6848
- simple
6849
- });
6850
- });
6851
- vpc_services.forEach(({ binding, service_id }) => {
6852
- metadataBindings.push({
6853
- name: binding,
6854
- type: "vpc_service",
6855
- service_id
6856
- });
6857
- });
6858
- vpc_networks.forEach(({ binding, tunnel_id, network_id }) => {
6859
- metadataBindings.push({
6860
- name: binding,
6861
- type: "vpc_network",
6862
- ...tunnel_id !== void 0 ? { tunnel_id } : { network_id }
6863
- });
6864
- });
6865
- services.forEach(
6866
- ({
6867
- binding,
6868
- service,
6869
- environment,
6870
- entrypoint,
6871
- props,
6872
- cross_account_grant
6873
- }) => {
6874
- metadataBindings.push({
6875
- name: binding,
6876
- type: "service",
6877
- service,
6878
- cross_account_grant,
6879
- ...environment && { environment },
6880
- ...entrypoint && { entrypoint },
6881
- ...props && { props }
6882
- });
6883
- }
6884
- );
6885
- analytics_engine_datasets.forEach(({ binding, dataset }) => {
6886
- metadataBindings.push({
6887
- name: binding,
6888
- type: "analytics_engine",
6889
- dataset
6890
- });
6891
- });
6892
- dispatch_namespaces.forEach(({ binding, namespace, outbound }) => {
6893
- metadataBindings.push({
6894
- name: binding,
6895
- type: "dispatch_namespace",
6896
- namespace,
6897
- ...outbound && {
6898
- outbound: {
6899
- worker: {
6900
- service: outbound.service,
6901
- environment: outbound.environment
6902
- },
6903
- params: outbound.parameters?.map((p) => ({ name: p }))
6904
- }
6905
- }
6906
- });
6907
- });
6908
- mtls_certificates.forEach(({ binding, certificate_id }) => {
6909
- metadataBindings.push({
6910
- name: binding,
6911
- type: "mtls_certificate",
6912
- certificate_id
6913
- });
6914
- });
6915
- pipelines.forEach(({ binding, stream: pipelineStream, pipeline }) => {
6916
- if (pipelineStream) {
6917
- metadataBindings.push({
6918
- name: binding,
6919
- type: "pipelines",
6920
- stream: pipelineStream
6921
- });
6922
- } else if (pipeline) {
6923
- metadataBindings.push({
6924
- name: binding,
6925
- type: "pipelines",
6926
- pipeline
6927
- });
6928
- } else {
6929
- throw new Error("Pipeline binding must specify a stream or pipeline");
6930
- }
6931
- });
6932
- worker_loaders.forEach(({ binding }) => {
6933
- metadataBindings.push({
6934
- name: binding,
6935
- type: "worker_loader"
6936
- });
6937
- });
6938
- logfwdr.forEach(({ name, destination }) => {
6939
- metadataBindings.push({
6940
- name,
6941
- type: "logfwdr",
6942
- destination
6943
- });
6944
- });
6945
- wasm_modules.forEach(({ binding: name, source }) => {
6946
- metadataBindings.push({
6947
- name,
6948
- type: "wasm_module",
6949
- part: name
6950
- });
6951
- formData.set(
6952
- name,
6953
- new File(
6954
- [
6955
- "contents" in source ? source.contents : readFileSync(source.path)
6956
- ],
6957
- "path" in source ? source.path ?? name : name,
6958
- { type: "application/wasm" }
6959
- )
6960
- );
6961
- });
6962
- if (browser !== void 0) {
6963
- metadataBindings.push({
6964
- name: browser.binding,
6965
- type: "browser",
6966
- raw: browser.raw
6967
- });
6968
- }
6969
- if (ai !== void 0) {
6970
- metadataBindings.push({
6971
- name: ai.binding,
6972
- staging: ai.staging,
6973
- type: "ai",
6974
- raw: ai.raw
6975
- });
6976
- }
6977
- if (images !== void 0) {
6978
- metadataBindings.push({
6979
- name: images.binding,
6980
- type: "images",
6981
- raw: images.raw
6982
- });
6983
- }
6984
- if (stream !== void 0) {
6985
- metadataBindings.push({
6986
- name: stream.binding,
6987
- type: "stream"
6988
- });
6989
- }
6990
- if (media !== void 0) {
6991
- metadataBindings.push({
6992
- name: media.binding,
6993
- type: "media"
6994
- });
6995
- }
6996
- if (version_metadata !== void 0) {
6997
- metadataBindings.push({
6998
- name: version_metadata.binding,
6999
- type: "version_metadata"
7000
- });
7001
- }
7002
- if (assetsBinding !== void 0) {
7003
- metadataBindings.push({
7004
- name: assetsBinding.binding,
7005
- type: "assets"
7006
- });
7007
- }
7008
- text_blobs.forEach(({ binding: name, source }) => {
7009
- metadataBindings.push({
7010
- name,
7011
- type: "text_blob",
7012
- part: name
7013
- });
7014
- if (name !== "__STATIC_CONTENT_MANIFEST") {
7015
- if ("contents" in source) {
7016
- formData.set(
7017
- name,
7018
- new File([source.contents], source.path ?? name, {
7019
- type: "text/plain"
7020
- })
7021
- );
7022
- } else {
7023
- formData.set(
7024
- name,
7025
- new File([readFileSync(source.path)], source.path, {
7026
- type: "text/plain"
7027
- })
7028
- );
7029
- }
7030
- }
7031
- });
7032
- data_blobs.forEach(({ binding: name, source }) => {
7033
- metadataBindings.push({
7034
- name,
7035
- type: "data_blob",
7036
- part: name
7037
- });
7038
- formData.set(
7039
- name,
7040
- new File(
7041
- [
7042
- "contents" in source ? source.contents : readFileSync(source.path)
7043
- ],
7044
- "path" in source ? source.path ?? name : name,
7045
- { type: "application/octet-stream" }
7046
- )
7047
- );
7048
- });
7049
- for (const [bindingName, config] of Object.entries(bindings ?? {})) {
7050
- if (isUnsafeBindingType(config.type) && config.type !== "unsafe_hello_world") {
7051
- const { type, ...data } = config;
7052
- metadataBindings.push({
7053
- name: bindingName,
7054
- type: type.slice("unsafe_".length),
7055
- ...data
7056
- });
7057
- }
7058
- }
7059
- const manifestModuleName = "__STATIC_CONTENT_MANIFEST";
7060
- const hasManifest = modules?.some(({ name }) => name === manifestModuleName);
7061
- if (hasManifest && main.type === "esm") {
7062
- assert4(modules !== void 0);
7063
- const subDirs = new Set(
7064
- modules.map((module) => path__default.posix.dirname(module.name))
7065
- );
7066
- for (const subDir of subDirs) {
7067
- if (subDir === ".") {
7068
- continue;
7069
- }
7070
- const relativePath = path__default.posix.relative(subDir, manifestModuleName);
7071
- const filePath = path__default.posix.join(subDir, manifestModuleName);
7072
- modules.push({
7073
- name: filePath,
7074
- filePath,
7075
- content: `export { default } from ${JSON.stringify(relativePath)};`,
7076
- type: "esm"
6466
+ return inputPrompt({
6467
+ type: "confirm",
6468
+ question: `"wrangler deploy" will upload a new version and deploy it globally immediately.
6469
+ Are you sure you want to continue?`,
6470
+ label: "",
6471
+ defaultValue: isNonInteractiveOrCI(),
6472
+ acceptDefault: isNonInteractiveOrCI()
7077
6473
  });
7078
6474
  }
7079
- }
7080
- if (main.type === "commonjs") {
7081
- for (const module of Object.values([...modules || []])) {
7082
- if (module.name === "__STATIC_CONTENT_MANIFEST") {
7083
- formData.set(
7084
- module.name,
7085
- new File([module.content], module.name, {
7086
- type: "text/plain"
7087
- })
7088
- );
7089
- modules = modules?.filter((m) => m !== module);
7090
- } else if (module.type === "compiled-wasm" || module.type === "text" || module.type === "buffer") {
7091
- const name = module.name.replace(/[^a-zA-Z0-9_$]/g, "_");
7092
- metadataBindings.push({
7093
- name,
7094
- type: module.type === "compiled-wasm" ? "wasm_module" : module.type === "text" ? "text_blob" : "data_blob",
7095
- part: name
7096
- });
7097
- formData.set(
7098
- name,
7099
- new File([module.content], module.name, {
7100
- type: module.type === "compiled-wasm" ? "application/wasm" : module.type === "text" ? "text/plain" : "application/octet-stream"
7101
- })
7102
- );
7103
- modules = modules?.filter((m) => m !== module);
7104
- }
7105
- }
7106
- }
7107
- let capnpSchemaOutputFile;
7108
- if (options?.unsafe?.capnp) {
7109
- const capnpOutput = handleUnsafeCapnp(options.unsafe.capnp);
7110
- capnpSchemaOutputFile = `./capnp-${Date.now()}.compiled`;
7111
- formData.set(
7112
- capnpSchemaOutputFile,
7113
- new File([capnpOutput], capnpSchemaOutputFile, {
7114
- type: "application/octet-stream"
7115
- })
7116
- );
7117
- }
7118
- let keep_bindings = void 0;
7119
- if (keepVars) {
7120
- keep_bindings ??= [];
7121
- keep_bindings.push("plain_text", "json");
7122
- }
7123
- if (keepSecrets) {
7124
- keep_bindings ??= [];
7125
- keep_bindings.push("secret_text", "secret_key");
7126
- }
7127
- if (keepBindings) {
7128
- keep_bindings ??= [];
7129
- keep_bindings.push(...keepBindings);
7130
- }
7131
- const metadata = {
7132
- ...main.type !== "commonjs" ? { main_module: main.name } : { body_part: main.name },
7133
- bindings: metadataBindings,
7134
- containers: worker.containers === void 0 ? void 0 : worker.containers.map((c) => ({ class_name: c.class_name })),
7135
- ...compatibility_date && { compatibility_date },
7136
- ...compatibility_flags && {
7137
- compatibility_flags
7138
- },
7139
- ...migrations && { migrations },
7140
- ...configuredExports && Object.keys(configuredExports).length > 0 && {
7141
- exports: configuredExports
7142
- },
7143
- capnp_schema: capnpSchemaOutputFile,
7144
- ...keep_bindings && { keep_bindings },
7145
- ...logpush !== void 0 && { logpush },
7146
- ...placement && { placement },
7147
- ...tail_consumers && { tail_consumers },
7148
- ...streaming_tail_consumers && { streaming_tail_consumers },
7149
- ...limits && { limits },
7150
- ...annotations && { annotations },
7151
- ...keep_assets !== void 0 && { keep_assets },
7152
- ...assets && {
7153
- assets: {
7154
- jwt: assets.jwt,
7155
- config: assetConfig
7156
- }
7157
- },
7158
- ...observability && { observability },
7159
- ...cache && { cache_options: cache },
7160
- ...package_dependencies?.length && { package_dependencies }
7161
- };
7162
- if (options?.unsafe?.metadata !== void 0) {
7163
- for (const key of Object.keys(options.unsafe.metadata)) {
7164
- metadata[key] = options.unsafe.metadata[key];
6475
+ } catch (e) {
6476
+ if (!isWorkerNotFoundError(e)) {
6477
+ throw e;
7165
6478
  }
7166
6479
  }
7167
- formData.set("metadata", JSON.stringify(metadata));
7168
- if (main.type === "commonjs" && modules && modules.length > 0) {
7169
- throw new TypeError(
7170
- "More than one module can only be specified when type = 'esm'"
7171
- );
7172
- }
7173
- for (const module of [main].concat(modules || [])) {
7174
- formData.set(
7175
- module.name,
7176
- new File([module.content], module.name, {
7177
- type: toMimeType(module.type ?? main.type ?? "esm")
7178
- })
7179
- );
7180
- }
7181
- for (const sourceMap of sourceMaps || []) {
7182
- formData.set(
7183
- sourceMap.name,
7184
- new File([sourceMap.content], sourceMap.name, {
7185
- type: "application/source-map"
7186
- })
7187
- );
7188
- }
7189
- return formData;
6480
+ return true;
6481
+ }
6482
+ __name(confirmLatestDeploymentOverwrite, "confirmLatestDeploymentOverwrite");
6483
+ async function printDeployment(config, accountId, workerName, deployment, adjective, versionCache) {
6484
+ const [versions, traffic] = await fetchDeploymentVersions(
6485
+ config,
6486
+ accountId,
6487
+ workerName,
6488
+ deployment,
6489
+ versionCache
6490
+ );
6491
+ cli.logRaw(
6492
+ `${leftT} Your ${adjective} deployment has ${versions.length} version(s):`
6493
+ );
6494
+ printVersions(versions, traffic);
6495
+ }
6496
+ __name(printDeployment, "printDeployment");
6497
+ function printVersions(versions, traffic) {
6498
+ cli.newline();
6499
+ cli.log(formatVersions(versions, traffic));
6500
+ cli.newline();
6501
+ }
6502
+ __name(printVersions, "printVersions");
6503
+ function formatVersions(versions, traffic) {
6504
+ return versions.map((version) => {
6505
+ const trafficString = brandColor(`(${traffic.get(version.id)}%)`);
6506
+ const versionIdString = white(version.id);
6507
+ return gray(`${trafficString} ${versionIdString}
6508
+ Created: ${version.metadata.created_on}
6509
+ Tag: ${version.annotations?.["workers/tag"] ?? BLANK_INPUT}
6510
+ Message: ${version.annotations?.["workers/message"] ?? BLANK_INPUT}`);
6511
+ }).join("\n\n");
7190
6512
  }
7191
- __name(createWorkerUploadForm, "createWorkerUploadForm");
6513
+ __name(formatVersions, "formatVersions");
7192
6514
 
7193
6515
  // src/deploy/helpers/deploy-wfp.ts
7194
6516
  function deployWfpUserWorker(dispatchNamespace, versionId) {
@@ -7235,7 +6557,7 @@ function tagsAreEqual(a, b) {
7235
6557
  __name(tagsAreEqual, "tagsAreEqual");
7236
6558
  async function getMigrationsToUpload(scriptName, props) {
7237
6559
  const { config, accountId } = props;
7238
- assert4(accountId, "Missing accountId");
6560
+ assert3(accountId, "Missing accountId");
7239
6561
  let migrations;
7240
6562
  if (config.migrations.length > 0) {
7241
6563
  let script;
@@ -7567,7 +6889,19 @@ function errIsStartupErr(err) {
7567
6889
  }
7568
6890
  __name(errIsStartupErr, "errIsStartupErr");
7569
6891
  var MAX_PACKAGE_DEPENDENCIES = 200;
7570
- async function collectPackageDependencies(projectPath) {
6892
+ function globPatternToRegExp(pattern) {
6893
+ const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
6894
+ const regexStr = escaped.replace(/\*/g, ".*");
6895
+ return new RegExp(`^${regexStr}$`);
6896
+ }
6897
+ __name(globPatternToRegExp, "globPatternToRegExp");
6898
+ function isExcludedPackage(name, excludePatterns) {
6899
+ return excludePatterns.some(
6900
+ (pattern) => globPatternToRegExp(pattern).test(name)
6901
+ );
6902
+ }
6903
+ __name(isExcludedPackage, "isExcludedPackage");
6904
+ async function collectPackageDependencies(projectPath, excludePackages) {
7571
6905
  const packageJsonPath = path__default.join(projectPath, "package.json");
7572
6906
  try {
7573
6907
  await access(packageJsonPath);
@@ -7591,6 +6925,9 @@ async function collectPackageDependencies(projectPath) {
7591
6925
  if (packageJsonVersion.startsWith("workspace:") || packageJsonVersion.startsWith("catalog:") || packageJsonVersion.startsWith("file:") || packageJsonVersion.startsWith("link:")) {
7592
6926
  continue;
7593
6927
  }
6928
+ if (excludePackages?.length && isExcludedPackage(dependencyName, excludePackages)) {
6929
+ continue;
6930
+ }
7594
6931
  const installedVersion = getInstalledPackageVersion(
7595
6932
  dependencyName,
7596
6933
  projectPath
@@ -8324,7 +7661,7 @@ function printBindings(bindings, tailConsumers = [], streamingTailConsumers = []
8324
7661
  return {
8325
7662
  name: binding,
8326
7663
  type: getBindingTypeFriendlyName("dispatch_namespace"),
8327
- value: outbound ? `${namespace} (outbound -> ${outbound.service})` : namespace,
7664
+ value: typeof namespace === "symbol" ? namespace : outbound ? `${namespace} (outbound -> ${outbound.service})` : namespace,
8328
7665
  mode: getMode({
8329
7666
  isSimulatedLocally: remote && !context.remoteBindingsDisabled ? false : void 0
8330
7667
  })
@@ -8367,7 +7704,7 @@ function printBindings(bindings, tailConsumers = [], streamingTailConsumers = []
8367
7704
  } else {
8368
7705
  let title2;
8369
7706
  if (context.provisioning) {
8370
- title2 = `${chalk5.red("Experimental:")} The following bindings need to be provisioned:`;
7707
+ title2 = "The following bindings need to be provisioned:";
8371
7708
  } else if (context.name && isMultiWorker) {
8372
7709
  title2 = `${chalk5.blue(context.name)} has access to the following bindings:`;
8373
7710
  } else {
@@ -8550,7 +7887,7 @@ function warnOrError(type, remote) {
8550
7887
  }
8551
7888
  return;
8552
7889
  default:
8553
- assertNever$1(support);
7890
+ assertNever(support);
8554
7891
  }
8555
7892
  }
8556
7893
  __name(warnOrError, "warnOrError");
@@ -8652,7 +7989,7 @@ var R2Handler = class extends ProvisionResourceHandler {
8652
7989
  );
8653
7990
  }
8654
7991
  async isConnectedToExistingResource() {
8655
- assert4(typeof this.binding.bucket_name !== "symbol");
7992
+ assert3(typeof this.binding.bucket_name !== "symbol");
8656
7993
  if (!this.binding.bucket_name) {
8657
7994
  return false;
8658
7995
  }
@@ -8699,7 +8036,7 @@ var AISearchNamespaceHandler = class extends ProvisionResourceHandler {
8699
8036
  );
8700
8037
  }
8701
8038
  async isConnectedToExistingResource() {
8702
- assert4(typeof this.binding.namespace !== "symbol");
8039
+ assert3(typeof this.binding.namespace !== "symbol");
8703
8040
  if (!this.binding.namespace) {
8704
8041
  return false;
8705
8042
  }
@@ -8742,7 +8079,7 @@ var AgentMemoryNamespaceHandler = class extends ProvisionResourceHandler {
8742
8079
  );
8743
8080
  }
8744
8081
  async isConnectedToExistingResource() {
8745
- assert4(typeof this.binding.namespace !== "symbol");
8082
+ assert3(typeof this.binding.namespace !== "symbol");
8746
8083
  if (!this.binding.namespace) {
8747
8084
  return false;
8748
8085
  }
@@ -8754,6 +8091,156 @@ var AgentMemoryNamespaceHandler = class extends ProvisionResourceHandler {
8754
8091
  return namespace !== null;
8755
8092
  }
8756
8093
  };
8094
+ var QueueHandler = class extends ProvisionResourceHandler {
8095
+ static {
8096
+ __name(this, "QueueHandler");
8097
+ }
8098
+ get name() {
8099
+ return this.binding.queue_name;
8100
+ }
8101
+ async create(name) {
8102
+ await fetchResult(
8103
+ this.complianceConfig,
8104
+ `/accounts/${this.accountId}/queues`,
8105
+ {
8106
+ method: "POST",
8107
+ headers: { "Content-Type": "application/json" },
8108
+ body: JSON.stringify({ queue_name: name })
8109
+ }
8110
+ );
8111
+ return name;
8112
+ }
8113
+ constructor(bindingName, binding, complianceConfig, accountId) {
8114
+ super(
8115
+ "queue",
8116
+ bindingName,
8117
+ binding,
8118
+ "queue_name",
8119
+ complianceConfig,
8120
+ accountId
8121
+ );
8122
+ }
8123
+ canInherit(settings) {
8124
+ const existing = settings?.bindings.find(
8125
+ (candidate) => candidate.type === this.type && candidate.name === this.bindingName && (this.binding.queue_name ? this.binding.queue_name === candidate.queue_name : true)
8126
+ );
8127
+ if (existing?.type !== this.type) {
8128
+ return false;
8129
+ }
8130
+ if (this.binding.delivery_delay !== void 0 || this.binding.raw !== void 0) {
8131
+ this.connect(existing.queue_name);
8132
+ return false;
8133
+ }
8134
+ return true;
8135
+ }
8136
+ async isConnectedToExistingResource() {
8137
+ assert3(typeof this.binding.queue_name !== "symbol");
8138
+ if (!this.binding.queue_name) {
8139
+ return false;
8140
+ }
8141
+ const queues = await fetchPagedListResult(
8142
+ this.complianceConfig,
8143
+ `/accounts/${this.accountId}/queues`,
8144
+ {},
8145
+ new URLSearchParams({ name: this.binding.queue_name })
8146
+ );
8147
+ return queues.some((queue) => queue.queue_name === this.binding.queue_name);
8148
+ }
8149
+ };
8150
+ var DispatchNamespaceHandler = class extends ProvisionResourceHandler {
8151
+ static {
8152
+ __name(this, "DispatchNamespaceHandler");
8153
+ }
8154
+ get name() {
8155
+ return this.binding.namespace;
8156
+ }
8157
+ async create(name) {
8158
+ await fetchResult(
8159
+ this.complianceConfig,
8160
+ `/accounts/${this.accountId}/workers/dispatch/namespaces`,
8161
+ {
8162
+ method: "POST",
8163
+ headers: { "Content-Type": "application/json" },
8164
+ body: JSON.stringify({ name })
8165
+ }
8166
+ );
8167
+ return name;
8168
+ }
8169
+ constructor(bindingName, binding, complianceConfig, accountId) {
8170
+ super(
8171
+ "dispatch_namespace",
8172
+ bindingName,
8173
+ binding,
8174
+ "namespace",
8175
+ complianceConfig,
8176
+ accountId
8177
+ );
8178
+ }
8179
+ canInherit(settings) {
8180
+ const existing = settings?.bindings.find(
8181
+ (candidate) => candidate.type === this.type && candidate.name === this.bindingName && (this.binding.namespace ? this.binding.namespace === candidate.namespace : true)
8182
+ );
8183
+ if (existing?.type !== this.type) {
8184
+ return false;
8185
+ }
8186
+ if (this.binding.outbound !== void 0) {
8187
+ this.connect(existing.namespace);
8188
+ return false;
8189
+ }
8190
+ return true;
8191
+ }
8192
+ async isConnectedToExistingResource() {
8193
+ assert3(typeof this.binding.namespace !== "symbol");
8194
+ if (!this.binding.namespace) {
8195
+ return false;
8196
+ }
8197
+ const namespaces = await listDispatchNamespaces(
8198
+ this.complianceConfig,
8199
+ this.accountId
8200
+ );
8201
+ return namespaces.some(
8202
+ (namespace) => namespace.namespace_name === this.binding.namespace
8203
+ );
8204
+ }
8205
+ };
8206
+ var FlagshipHandler = class extends ProvisionResourceHandler {
8207
+ static {
8208
+ __name(this, "FlagshipHandler");
8209
+ }
8210
+ get name() {
8211
+ return void 0;
8212
+ }
8213
+ async create(name) {
8214
+ const app = await fetchResult(
8215
+ this.complianceConfig,
8216
+ `/accounts/${this.accountId}/flagship/apps`,
8217
+ {
8218
+ method: "POST",
8219
+ headers: { "Content-Type": "application/json" },
8220
+ body: JSON.stringify({ name })
8221
+ }
8222
+ );
8223
+ return app.id;
8224
+ }
8225
+ constructor(bindingName, binding, complianceConfig, accountId) {
8226
+ super(
8227
+ "flagship",
8228
+ bindingName,
8229
+ binding,
8230
+ "app_id",
8231
+ complianceConfig,
8232
+ accountId
8233
+ );
8234
+ }
8235
+ canInherit(settings) {
8236
+ return !!settings?.bindings.find(
8237
+ (existing) => existing.type === this.type && existing.name === this.bindingName
8238
+ );
8239
+ }
8240
+ isFullySpecified() {
8241
+ return !!this.binding.app_id;
8242
+ }
8243
+ };
8757
8244
  var KVHandler = class extends ProvisionResourceHandler {
8758
8245
  static {
8759
8246
  __name(this, "KVHandler");
@@ -8828,7 +8315,7 @@ var D1Handler = class extends ProvisionResourceHandler {
8828
8315
  return false;
8829
8316
  }
8830
8317
  async isConnectedToExistingResource() {
8831
- assert4(typeof this.binding.database_name !== "symbol");
8318
+ assert3(typeof this.binding.database_name !== "symbol");
8832
8319
  if (!this.binding.database_name) {
8833
8320
  return false;
8834
8321
  }
@@ -8950,8 +8437,94 @@ var HANDLERS = {
8950
8437
  binding: bindingName
8951
8438
  };
8952
8439
  }, "toConfig")
8440
+ },
8441
+ queue: {
8442
+ Handler: QueueHandler,
8443
+ sort: 5,
8444
+ name: "Queue",
8445
+ keyDescription: "name",
8446
+ configField: "queues",
8447
+ load: /* @__PURE__ */ __name(async (complianceConfig, accountId) => {
8448
+ const queues = await fetchPagedListResult(
8449
+ complianceConfig,
8450
+ `/accounts/${accountId}/queues`
8451
+ );
8452
+ return queues.map((queue) => ({
8453
+ title: queue.queue_name,
8454
+ value: queue.queue_name
8455
+ }));
8456
+ }, "load"),
8457
+ toConfig: /* @__PURE__ */ __name((bindingName, binding) => ({
8458
+ binding: bindingName,
8459
+ queue: typeof binding.queue_name === "string" ? binding.queue_name : void 0,
8460
+ delivery_delay: binding.delivery_delay,
8461
+ remote: binding.remote
8462
+ }), "toConfig")
8463
+ },
8464
+ dispatch_namespace: {
8465
+ Handler: DispatchNamespaceHandler,
8466
+ sort: 6,
8467
+ name: "Dispatch Namespace",
8468
+ keyDescription: "name",
8469
+ configField: "dispatch_namespaces",
8470
+ load: /* @__PURE__ */ __name(async (complianceConfig, accountId) => {
8471
+ const namespaces = await listDispatchNamespaces(
8472
+ complianceConfig,
8473
+ accountId
8474
+ );
8475
+ return namespaces.map((namespace) => ({
8476
+ title: namespace.namespace_name,
8477
+ value: namespace.namespace_name
8478
+ }));
8479
+ }, "load"),
8480
+ toConfig: /* @__PURE__ */ __name((bindingName, binding) => {
8481
+ const { type: _, ...rest } = binding;
8482
+ return { ...rest, binding: bindingName };
8483
+ }, "toConfig")
8484
+ },
8485
+ flagship: {
8486
+ Handler: FlagshipHandler,
8487
+ sort: 7,
8488
+ name: "Flagship App",
8489
+ keyDescription: "name or id",
8490
+ configField: "flagship",
8491
+ load: /* @__PURE__ */ __name(async (complianceConfig, accountId) => {
8492
+ const apps = await listFlagshipApps(complianceConfig, accountId);
8493
+ return apps.map((app) => ({ title: app.name, value: app.id }));
8494
+ }, "load"),
8495
+ toConfig: /* @__PURE__ */ __name((bindingName, binding) => {
8496
+ const { type: _, ...rest } = binding;
8497
+ return { ...rest, binding: bindingName };
8498
+ }, "toConfig")
8953
8499
  }
8954
8500
  };
8501
+ function getRawConfigBindings(config, resourceType) {
8502
+ if (resourceType === "queue") {
8503
+ return config.queues?.producers ?? [];
8504
+ }
8505
+ const configField = HANDLERS[resourceType].configField;
8506
+ return config[configField] ?? [];
8507
+ }
8508
+ __name(getRawConfigBindings, "getRawConfigBindings");
8509
+ function addBindingToPatch(patch, resourceType, binding) {
8510
+ const serialisableBinding = Object.fromEntries(
8511
+ Object.entries(binding).filter(
8512
+ ([_, value]) => value !== void 0 && typeof value !== "symbol"
8513
+ )
8514
+ );
8515
+ if (resourceType === "queue") {
8516
+ patch.queues ??= {};
8517
+ patch.queues.producers ??= [];
8518
+ patch.queues.producers.push(serialisableBinding);
8519
+ return;
8520
+ }
8521
+ const configField = HANDLERS[resourceType].configField;
8522
+ patch[configField] ??= [];
8523
+ patch[configField].push(
8524
+ serialisableBinding
8525
+ );
8526
+ }
8527
+ __name(addBindingToPatch, "addBindingToPatch");
8955
8528
  function isProvisionableBinding(binding) {
8956
8529
  return binding.type in HANDLERS;
8957
8530
  }
@@ -8978,6 +8551,27 @@ function createHandler(bindingName, binding, complianceConfig, accountId) {
8978
8551
  complianceConfig,
8979
8552
  accountId
8980
8553
  );
8554
+ case "queue":
8555
+ return new QueueHandler(
8556
+ bindingName,
8557
+ binding,
8558
+ complianceConfig,
8559
+ accountId
8560
+ );
8561
+ case "dispatch_namespace":
8562
+ return new DispatchNamespaceHandler(
8563
+ bindingName,
8564
+ binding,
8565
+ complianceConfig,
8566
+ accountId
8567
+ );
8568
+ case "flagship":
8569
+ return new FlagshipHandler(
8570
+ bindingName,
8571
+ binding,
8572
+ complianceConfig,
8573
+ accountId
8574
+ );
8981
8575
  }
8982
8576
  }
8983
8577
  __name(createHandler, "createHandler");
@@ -8993,6 +8587,12 @@ function toConfigBinding(bindingName, binding) {
8993
8587
  return HANDLERS.ai_search_namespace.toConfig(bindingName, binding);
8994
8588
  case "agent_memory":
8995
8589
  return HANDLERS.agent_memory.toConfig(bindingName, binding);
8590
+ case "queue":
8591
+ return HANDLERS.queue.toConfig(bindingName, binding);
8592
+ case "dispatch_namespace":
8593
+ return HANDLERS.dispatch_namespace.toConfig(bindingName, binding);
8594
+ case "flagship":
8595
+ return HANDLERS.flagship.toConfig(bindingName, binding);
8996
8596
  }
8997
8597
  }
8998
8598
  __name(toConfigBinding, "toConfigBinding");
@@ -9036,7 +8636,7 @@ async function provisionBindings(bindings, accountId, scriptName, autoCreate, co
9036
8636
  bindings
9037
8637
  );
9038
8638
  if (pendingResources.length > 0) {
9039
- assert4(
8639
+ assert3(
9040
8640
  configPath,
9041
8641
  "Provisioning resources is not possible without a config file"
9042
8642
  );
@@ -9065,8 +8665,18 @@ async function provisionBindings(bindings, accountId, scriptName, autoCreate, co
9065
8665
  autoCreate
9066
8666
  );
9067
8667
  }
8668
+ for (const [bindingName, binding] of Object.entries(bindings ?? {})) {
8669
+ if (binding.type === "queue" && typeof binding.queue_name === "string") {
8670
+ const producer = config.queues.producers?.find(
8671
+ (candidate) => candidate.binding === bindingName
8672
+ );
8673
+ if (producer) {
8674
+ producer.queue = binding.queue_name;
8675
+ }
8676
+ }
8677
+ }
9068
8678
  const patch = {};
9069
- const existingBindingNames = /* @__PURE__ */ new Set();
8679
+ const existingBindingNames = /* @__PURE__ */ new Map();
9070
8680
  const isUsingRedirectedConfig = config.userConfigPath && config.userConfigPath !== config.configPath;
9071
8681
  if (isUsingRedirectedConfig) {
9072
8682
  const { rawConfig: unredirectedConfig } = await experimental_readRawConfig(
@@ -9076,31 +8686,25 @@ async function provisionBindings(bindings, accountId, scriptName, autoCreate, co
9076
8686
  for (const resourceType of Object.keys(
9077
8687
  HANDLERS
9078
8688
  )) {
9079
- const configField = HANDLERS[resourceType].configField;
9080
- for (const binding of unredirectedConfig[configField] ?? []) {
9081
- existingBindingNames.add(binding.binding);
8689
+ const bindingNames = /* @__PURE__ */ new Set();
8690
+ for (const binding of getRawConfigBindings(
8691
+ unredirectedConfig,
8692
+ resourceType
8693
+ )) {
8694
+ bindingNames.add(binding.binding);
9082
8695
  }
8696
+ existingBindingNames.set(resourceType, bindingNames);
9083
8697
  }
9084
8698
  }
9085
8699
  for (const [bindingName, binding] of Object.entries(bindings ?? {})) {
9086
8700
  if (!isProvisionableBinding(binding)) {
9087
8701
  continue;
9088
8702
  }
9089
- if (isUsingRedirectedConfig && !existingBindingNames.has(bindingName)) {
8703
+ if (isUsingRedirectedConfig && !existingBindingNames.get(binding.type)?.has(bindingName)) {
9090
8704
  continue;
9091
8705
  }
9092
- const resourceType = HANDLERS[binding.type].configField;
9093
- patch[resourceType] ??= [];
9094
8706
  const bindingToWrite = toConfigBinding(bindingName, binding);
9095
- patch[resourceType].push(
9096
- Object.fromEntries(
9097
- Object.entries(bindingToWrite).filter(
9098
- // Make sure all the values are JSON serialisable.
9099
- // Otherwise we end up with "undefined" in the config.
9100
- ([_, value]) => typeof value === "string"
9101
- )
9102
- )
9103
- );
8707
+ addBindingToPatch(patch, binding.type, bindingToWrite);
9104
8708
  }
9105
8709
  if (options.skipConfigWriteback) {
9106
8710
  logger.log(
@@ -9253,6 +8857,20 @@ async function listKVNamespaces(complianceConfig, accountId, limitCalls = false)
9253
8857
  return results;
9254
8858
  }
9255
8859
  __name(listKVNamespaces, "listKVNamespaces");
8860
+ async function listDispatchNamespaces(complianceConfig, accountId) {
8861
+ return await fetchPagedListResult(
8862
+ complianceConfig,
8863
+ `/accounts/${accountId}/workers/dispatch/namespaces`
8864
+ );
8865
+ }
8866
+ __name(listDispatchNamespaces, "listDispatchNamespaces");
8867
+ async function listFlagshipApps(complianceConfig, accountId) {
8868
+ return await fetchListResult(
8869
+ complianceConfig,
8870
+ `/accounts/${accountId}/flagship/apps`
8871
+ );
8872
+ }
8873
+ __name(listFlagshipApps, "listFlagshipApps");
9256
8874
  async function createD1Database(complianceConfig, accountId, name) {
9257
8875
  try {
9258
8876
  return await fetchResult(
@@ -9585,11 +9203,11 @@ var util;
9585
9203
  }
9586
9204
  __name(assertIs, "assertIs");
9587
9205
  util2.assertIs = assertIs;
9588
- function assertNever3(_x) {
9206
+ function assertNever2(_x) {
9589
9207
  throw new Error();
9590
9208
  }
9591
- __name(assertNever3, "assertNever");
9592
- util2.assertNever = assertNever3;
9209
+ __name(assertNever2, "assertNever");
9210
+ util2.assertNever = assertNever2;
9593
9211
  util2.arrayToEnum = (items) => {
9594
9212
  const obj = {};
9595
9213
  for (const item of items) {
@@ -9950,8 +9568,8 @@ __name(getErrorMap, "getErrorMap");
9950
9568
 
9951
9569
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
9952
9570
  var makeIssue = /* @__PURE__ */ __name((params) => {
9953
- const { data, path: path10, errorMaps, issueData } = params;
9954
- const fullPath = [...path10, ...issueData.path || []];
9571
+ const { data, path: path9, errorMaps, issueData } = params;
9572
+ const fullPath = [...path9, ...issueData.path || []];
9955
9573
  const fullIssue = {
9956
9574
  ...issueData,
9957
9575
  path: fullPath
@@ -10074,11 +9692,11 @@ var ParseInputLazyPath = class {
10074
9692
  static {
10075
9693
  __name(this, "ParseInputLazyPath");
10076
9694
  }
10077
- constructor(parent, value, path10, key) {
9695
+ constructor(parent, value, path9, key) {
10078
9696
  this._cachedPath = [];
10079
9697
  this.parent = parent;
10080
9698
  this.data = value;
10081
- this._path = path10;
9699
+ this._path = path9;
10082
9700
  this._key = key;
10083
9701
  }
10084
9702
  get path() {
@@ -13757,12 +13375,12 @@ function getSourceMappingPrepareStackTrace(retrieveSourceMap) {
13757
13375
  // Make sure we're using fresh copies of files each time we source map
13758
13376
  emptyCacheBetweenOperations: true,
13759
13377
  // Allow retriever to be overridden at prepare stack trace time
13760
- retrieveSourceMap(path10) {
13761
- return retrieveSourceMapOverride?.(path10) ?? null;
13378
+ retrieveSourceMap(path9) {
13379
+ return retrieveSourceMapOverride?.(path9) ?? null;
13762
13380
  }
13763
13381
  });
13764
13382
  sourceMappingPrepareStackTrace = Error.prepareStackTrace;
13765
- assert4(sourceMappingPrepareStackTrace !== void 0);
13383
+ assert3(sourceMappingPrepareStackTrace !== void 0);
13766
13384
  Error.prepareStackTrace = originalPrepareStackTrace;
13767
13385
  return sourceMappingPrepareStackTrace;
13768
13386
  }
@@ -13824,7 +13442,7 @@ function getSourceMappedString(value, retrieveSourceMap) {
13824
13442
  }
13825
13443
  const callSiteLine = callSiteLines[i][0];
13826
13444
  const callSiteAtIndex = callSiteLine.indexOf("at");
13827
- assert4(callSiteAtIndex !== -1);
13445
+ assert3(callSiteAtIndex !== -1);
13828
13446
  const callSiteLineLeftPad = callSiteLine.substring(0, callSiteAtIndex);
13829
13447
  value = value.replace(
13830
13448
  callSiteLine,
@@ -14467,7 +14085,7 @@ function normalizeRemoteConfigAsResolvedLocal(remoteConfig, localConfig) {
14467
14085
  return normalizedRemote;
14468
14086
  }
14469
14087
  __name(normalizeRemoteConfigAsResolvedLocal, "normalizeRemoteConfigAsResolvedLocal");
14470
- function getBindingKey2(obj) {
14088
+ function getBindingKey(obj) {
14471
14089
  return JSON.stringify(
14472
14090
  obj,
14473
14091
  (_, v) => v && typeof v === "object" && !Array.isArray(v) ? Object.fromEntries(
@@ -14475,13 +14093,13 @@ function getBindingKey2(obj) {
14475
14093
  ) : v
14476
14094
  );
14477
14095
  }
14478
- __name(getBindingKey2, "getBindingKey");
14096
+ __name(getBindingKey, "getBindingKey");
14479
14097
  function reorderBindings(remote, local) {
14480
- const remoteByKey = new Map(remote.map((el) => [getBindingKey2(el), el]));
14098
+ const remoteByKey = new Map(remote.map((el) => [getBindingKey(el), el]));
14481
14099
  const used = /* @__PURE__ */ new Set();
14482
14100
  const result = [];
14483
14101
  for (const binding of local) {
14484
- const key = getBindingKey2(binding);
14102
+ const key = getBindingKey(binding);
14485
14103
  const remoteEl = remoteByKey.get(key);
14486
14104
  if (remoteEl !== void 0) {
14487
14105
  result.push(remoteEl);
@@ -14489,7 +14107,7 @@ function reorderBindings(remote, local) {
14489
14107
  }
14490
14108
  }
14491
14109
  for (const binding of remote) {
14492
- if (!used.has(getBindingKey2(binding))) {
14110
+ if (!used.has(getBindingKey(binding))) {
14493
14111
  result.push(binding);
14494
14112
  }
14495
14113
  }
@@ -14548,10 +14166,10 @@ function populateConfigPatch(diff, patchObj, targetEnvironment) {
14548
14166
  return;
14549
14167
  }
14550
14168
  if (Array.isArray(diff)) {
14551
- assert4(Array.isArray(patchObj));
14169
+ assert3(Array.isArray(patchObj));
14552
14170
  return populateConfigPatchArray(diff, patchObj);
14553
14171
  }
14554
- assert4(!Array.isArray(patchObj));
14172
+ assert3(!Array.isArray(patchObj));
14555
14173
  return populateConfigPatchObject(diff, patchObj, targetEnvironment);
14556
14174
  }
14557
14175
  __name(populateConfigPatch, "populateConfigPatch");
@@ -14884,7 +14502,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
14884
14502
  }
14885
14503
  if (props.command === "deploy") {
14886
14504
  validateRoutes(props.routes, props.assetsOptions);
14887
- assert4(
14505
+ assert3(
14888
14506
  !config.site || config.site.bucket,
14889
14507
  "A [site] definition requires a `bucket` field with a path to the site's assets directory."
14890
14508
  );
@@ -15023,7 +14641,12 @@ Edits that have been made via the script API will be overridden by your local co
15023
14641
  }
15024
14642
  }
15025
14643
  }
15026
- await ensureQueuesExistByConfig(config, accountId);
14644
+ await ensureQueuesExistByConfig(
14645
+ config,
14646
+ accountId,
14647
+ !props.resourcesProvision,
14648
+ name
14649
+ );
15027
14650
  const wantsWorkersDev = props.command === "deploy" && getSubdomainValues(config.workers_dev, config.preview_urls, props.routes).workers_dev;
15028
14651
  if (!workerExists && wantsWorkersDev) {
15029
14652
  await getWorkersDevSubdomain(config, accountId, {
@@ -15193,7 +14816,10 @@ async function deploy(props, config, buildResult, callbacks) {
15193
14816
  } : void 0,
15194
14817
  observability: config.observability,
15195
14818
  cache: config.cache,
15196
- package_dependencies: config.dependencies_instrumentation?.enabled !== false && projectRoot ? await collectPackageDependencies(projectRoot) : void 0
14819
+ package_dependencies: config.dependencies_instrumentation?.enabled !== false && projectRoot ? await collectPackageDependencies(
14820
+ projectRoot,
14821
+ config.dependencies_instrumentation?.exclude_packages
14822
+ ) : void 0
15197
14823
  };
15198
14824
  const sourceMapSize = worker.sourceMaps?.reduce(
15199
14825
  (acc, m) => acc + m.content.length,
@@ -15254,7 +14880,7 @@ async function deploy(props, config, buildResult, callbacks) {
15254
14880
  { warnIfNoBindings: true, unsafeMetadata: config.unsafe?.metadata }
15255
14881
  );
15256
14882
  } else {
15257
- assert4(accountId, "Missing accountId");
14883
+ assert3(accountId, "Missing accountId");
15258
14884
  if (assetsOptions?.routerConfig.has_user_worker === false) {
15259
14885
  logger.debug("skipping provisioning on assets-only project");
15260
14886
  } else if (props.resourcesProvision) {
@@ -15475,7 +15101,7 @@ async function deploy(props, config, buildResult, callbacks) {
15475
15101
  const uploadMs = Date.now() - start;
15476
15102
  logger.log("Uploaded", workerName, formatTime(uploadMs));
15477
15103
  if (normalisedContainerConfig.length && props.containersRollout !== "none" && callbacks.deployContainers) {
15478
- assert4(versionId && accountId);
15104
+ assert3(versionId && accountId);
15479
15105
  await callbacks.deployContainers(config, normalisedContainerConfig, {
15480
15106
  versionId,
15481
15107
  accountId,
@@ -15486,11 +15112,12 @@ async function deploy(props, config, buildResult, callbacks) {
15486
15112
  deployWfpUserWorker(props.dispatchNamespace, versionId);
15487
15113
  return { versionId, workerTag, assetUploadStats };
15488
15114
  }
15489
- assert4(accountId);
15115
+ assert3(accountId);
15490
15116
  const targets = await triggersDeploy({
15491
15117
  config,
15492
15118
  accountId,
15493
15119
  scriptName,
15120
+ workerTag,
15494
15121
  env: props.env,
15495
15122
  crons: props.triggers,
15496
15123
  firstDeploy: !workerExists,
@@ -15581,6 +15208,7 @@ async function versionsUpload(props, config, buildResult, callbacks) {
15581
15208
  type: bundleType
15582
15209
  };
15583
15210
  const worker = {
15211
+ name: scriptName,
15584
15212
  main,
15585
15213
  migrations,
15586
15214
  exports,
@@ -15614,7 +15242,10 @@ async function versionsUpload(props, config, buildResult, callbacks) {
15614
15242
  observability: void 0,
15615
15243
  cache: config.cache,
15616
15244
  // cache is a versioned setting
15617
- package_dependencies: config.dependencies_instrumentation?.enabled !== false && projectRoot ? await collectPackageDependencies(projectRoot) : void 0
15245
+ package_dependencies: config.dependencies_instrumentation?.enabled !== false && projectRoot ? await collectPackageDependencies(
15246
+ projectRoot,
15247
+ config.dependencies_instrumentation?.exclude_packages
15248
+ ) : void 0
15618
15249
  };
15619
15250
  await printBundleSize(
15620
15251
  { name: path__default.basename(resolvedEntryPointPath), content },
@@ -15634,7 +15265,7 @@ async function versionsUpload(props, config, buildResult, callbacks) {
15634
15265
  { unsafeMetadata: config.unsafe?.metadata }
15635
15266
  );
15636
15267
  } else {
15637
- assert4(accountId, "Missing accountId");
15268
+ assert3(accountId, "Missing accountId");
15638
15269
  if (assetsOptions?.routerConfig.has_user_worker === false) {
15639
15270
  logger.debug("skipping provisioning on assets-only project");
15640
15271
  } else if (props.resourcesProvision) {
@@ -15748,7 +15379,7 @@ async function versionsUpload(props, config, buildResult, callbacks) {
15748
15379
  logger.log(`--dry-run: exiting now.`);
15749
15380
  return { versionId, workerTag };
15750
15381
  }
15751
- assert4(accountId);
15382
+ assert3(accountId);
15752
15383
  const uploadMs = Date.now() - start;
15753
15384
  logger.log("Uploaded", workerName, formatTime(uploadMs));
15754
15385
  logger.log("Worker Version ID:", versionId);
@@ -17148,4 +16779,4 @@ __name(previewSettingsUpdate, "previewSettingsUpdate");
17148
16779
  * THE SOFTWARE.
17149
16780
  */
17150
16781
 
17151
- export { ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, EXPORTS_RECONCILIATION_ERROR_CODE, INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE, INVALID_INHERIT_BINDING_CODE, 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, assemblePreviewDefaults, assemblePreviewScriptSettings, buildAssetManifest, checkRemoteSecretsOverride, checkWorkflowConflicts, collectPackageDependencies, confirmLatestDeploymentOverwrite, convertConfigToBindings, createDeployment, createPreview, createPreviewDeployment, createTruncatedAlias, createWorkerUploadForm, decodeJwtPayload, deletePreview, deletePullConsumer, deleteWorkerConsumer, deploy, deployWfpUserWorker, diagnoseScriptSizeError, diagnoseStartupError, diffJsonObjects, downloadWorkerConfig, drawBox, drawConnectedChildBox, editPreview, editWorkerPreviewDefaults, ensureQueuesExistByConfig, extractBindingsOfType, extractConfigBindings, fetchDeployableVersions, fetchDeploymentVersions, fetchLatestDeployment, fetchLatestDeployments, fetchSecrets, fetchVersion, fetchVersions, fetchWorkerConfig, formatAlignedRows, formatBindings, formatPreviewsSettings, fromMimeType, generatePreviewAlias, getBindingValue, getBindings, getBranchName2 as getBranchName, getConfigPatch, getDeployConfirmFunction, getEdgeKvUploadConcurrency, getHeadCommitMessage, getHeadCommitRef, getMigrationsToUpload, getPreview, getPreviewDeployment, getQueue, getRemoteConfigDiff, getSettings, getSourceMappedStack, getSourceMappedString, getSubdomainValues, getSubdomainValuesAPIMock, getWorkerPreviewDefaults, getWorkersDevSubdomain, getZoneForRoute, getZoneIdFromHost, handleMissingSecretsError, handleUnsafeCapnp, hasDefinedEnvironments, hashFile, helpIfErrorIsSizeOrScriptStartup, isExportsReconciliationErrorDetails, isJwtExpired, isModifiedDiffValue, isNonDestructive, isUnsafeBindingType, isWorkerNotFoundError, listConsumers, listQueues, maybeRetrieveFileSourceMap, mergeDeep, moduleTypeMimeType, padToVisibleWidth, parseBulkInputToObject, parseConfigPlacement, patchNonVersionedScriptSettings, postConsumer, preview, previewDelete, previewSettingsGet, previewSettingsUpdate, printBindings, printBundleSize, printVersions, provisionBindings, publishCustomDomains, publishRoutes, putConsumer, putConsumerById, renderBindingDependsOnExportError, renderExportsReconciliationError, renderExportsReconciliationSuccess, renderInconsistentExportsAcrossVersionsError, renderRoute, resolveAssetOptions, resolveDoLifecyclePayload, resolveExportsUploadPayload, resolveWorkerName, sanitizeBranchName, shouldUseCIMetadataFallback, stripAnsi, syncAssets, tagsAreEqual, triggersDeploy, updateQueueConsumers, validateFileSecrets, validateNodeCompatMode, validateRoutes, verifyWorkerMatchesCITag, versionsUpload, visibleLength, warnOnErrorUpdatingServiceAndEnvironmentTags, warnOrError, workerNotFoundErrorMessage };
16782
+ export { ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, EXPORTS_RECONCILIATION_ERROR_CODE, INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE, INVALID_INHERIT_BINDING_CODE, 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, assemblePreviewDefaults, assemblePreviewScriptSettings, buildAssetManifest, checkRemoteSecretsOverride, checkWorkflowConflicts, collectPackageDependencies, confirmLatestDeploymentOverwrite, createDeployment, createPreview, createPreviewDeployment, createTruncatedAlias, decodeJwtPayload, deletePreview, deletePullConsumer, deleteWorkerConsumer, deploy, deployWfpUserWorker, diagnoseScriptSizeError, diagnoseStartupError, diffJsonObjects, downloadWorkerConfig, drawBox, drawConnectedChildBox, editPreview, editWorkerPreviewDefaults, ensureQueuesExistByConfig, extractConfigBindings, fetchDeployableVersions, fetchDeploymentVersions, fetchLatestDeployment, fetchLatestDeployments, fetchSecrets, fetchVersion, fetchVersions, fetchWorkerConfig, formatAlignedRows, formatBindings, formatPreviewsSettings, generatePreviewAlias, getBindingValue, getBranchName2 as getBranchName, getConfigPatch, getDeployConfirmFunction, getEdgeKvUploadConcurrency, getHeadCommitMessage, getHeadCommitRef, getMigrationsToUpload, getPreview, getPreviewDeployment, getQueue, getRemoteConfigDiff, getSettings, getSourceMappedStack, getSourceMappedString, getSubdomainValues, getSubdomainValuesAPIMock, getWorkerPreviewDefaults, getWorkersDevSubdomain, getZoneForRoute, getZoneIdFromHost, handleMissingSecretsError, hasDefinedEnvironments, hashFile, helpIfErrorIsSizeOrScriptStartup, isExportsReconciliationErrorDetails, isJwtExpired, isModifiedDiffValue, isNonDestructive, isWorkerNotFoundError, listConsumers, listQueues, maybeRetrieveFileSourceMap, mergeDeep, padToVisibleWidth, parseBulkInputToObject, parseConfigPlacement, patchNonVersionedScriptSettings, postConsumer, preview, previewDelete, previewSettingsGet, previewSettingsUpdate, printBindings, printBundleSize, printVersions, provisionBindings, publishCustomDomains, publishRoutes, putConsumer, putConsumerById, renderBindingDependsOnExportError, renderExportsReconciliationError, renderExportsReconciliationSuccess, renderInconsistentExportsAcrossVersionsError, renderRoute, resolveAssetOptions, resolveDoLifecyclePayload, resolveExportsUploadPayload, resolveWorkerName, sanitizeBranchName, shouldUseCIMetadataFallback, stripAnsi, syncAssets, tagsAreEqual, triggersDeploy, updateQueueConsumers, validateFileSecrets, validateNodeCompatMode, validateRoutes, verifyWorkerMatchesCITag, versionsUpload, visibleLength, warnOnErrorUpdatingServiceAndEnvironmentTags, warnOrError, workerNotFoundErrorMessage };