wrangler 4.140.0 → 4.141.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.
@@ -3173,6 +3173,19 @@ function indexLocation(file3, index) {
3173
3173
  }
3174
3174
  return { lineText, line, column, ...file3 };
3175
3175
  }
3176
+ function parseHumanDuration(s8) {
3177
+ const unitsMap = new Map(Object.entries(units));
3178
+ s8 = s8.trim().toLowerCase();
3179
+ let base = 1;
3180
+ for (const [name2, _5] of unitsMap) {
3181
+ if (s8.endsWith(name2)) {
3182
+ s8 = s8.substring(0, s8.length - name2.length);
3183
+ base = unitsMap.get(name2) || 1;
3184
+ break;
3185
+ }
3186
+ }
3187
+ return Number(s8) * base;
3188
+ }
3176
3189
  function parseNonHyphenedUuid(uuid3) {
3177
3190
  if (uuid3 == null || uuid3.includes("-")) {
3178
3191
  return uuid3;
@@ -3242,7 +3255,7 @@ function removeBOMAndValidate(buffer, file3) {
3242
3255
  }
3243
3256
  return content;
3244
3257
  }
3245
- var ParseError, APIError, UNSUPPORTED_BOMS;
3258
+ var ParseError, APIError, units, UNSUPPORTED_BOMS;
3246
3259
  var init_parse2 = __esm({
3247
3260
  "../workers-utils/src/parse.ts"() {
3248
3261
  init_import_meta_url();
@@ -3322,6 +3335,48 @@ var init_parse2 = __esm({
3322
3335
  __name(readFileSyncToBuffer, "readFileSyncToBuffer");
3323
3336
  __name(readFileSync, "readFileSync");
3324
3337
  __name(indexLocation, "indexLocation");
3338
+ units = {
3339
+ nanoseconds: 1e-9,
3340
+ nanosecond: 1e-9,
3341
+ microseconds: 1e-6,
3342
+ microsecond: 1e-6,
3343
+ milliseconds: 1e-3,
3344
+ millisecond: 1e-3,
3345
+ seconds: 1,
3346
+ second: 1,
3347
+ minutes: 60,
3348
+ minute: 60,
3349
+ hours: 3600,
3350
+ hour: 3600,
3351
+ days: 86400,
3352
+ day: 86400,
3353
+ weeks: 604800,
3354
+ week: 604800,
3355
+ month: 18144e3,
3356
+ year: 220752e3,
3357
+ nsecs: 1e-9,
3358
+ nsec: 1e-9,
3359
+ usecs: 1e-6,
3360
+ usec: 1e-6,
3361
+ msecs: 1e-3,
3362
+ msec: 1e-3,
3363
+ secs: 1,
3364
+ sec: 1,
3365
+ mins: 60,
3366
+ min: 60,
3367
+ ns: 1e-9,
3368
+ us: 1e-6,
3369
+ ms: 1e-3,
3370
+ mo: 18144e3,
3371
+ yr: 220752e3,
3372
+ s: 1,
3373
+ m: 60,
3374
+ h: 3600,
3375
+ d: 86400,
3376
+ w: 604800,
3377
+ y: 220752e3
3378
+ };
3379
+ __name(parseHumanDuration, "parseHumanDuration");
3325
3380
  __name(parseNonHyphenedUuid, "parseNonHyphenedUuid");
3326
3381
  __name(parseByteSize, "parseByteSize");
3327
3382
  UNSUPPORTED_BOMS = [
@@ -21205,18 +21260,22 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
21205
21260
  validateDefines(envName),
21206
21261
  {}
21207
21262
  ),
21208
- durable_objects: notInheritable(
21209
- diagnostics,
21210
- topLevelEnv,
21211
- rawConfig,
21212
- rawEnv,
21213
- envName,
21214
- "durable_objects",
21215
- validateBindingsProperty(envName, validateDurableObjectBinding),
21216
- {
21217
- bindings: []
21218
- }
21219
- ),
21263
+ durable_objects: (() => {
21264
+ const durableObjects = notInheritable(
21265
+ diagnostics,
21266
+ topLevelEnv,
21267
+ rawConfig,
21268
+ rawEnv,
21269
+ envName,
21270
+ "durable_objects",
21271
+ validateDurableObjectsProperty(envName, true),
21272
+ { bindings: [] }
21273
+ );
21274
+ return {
21275
+ ...durableObjects,
21276
+ bindings: durableObjects.bindings ?? []
21277
+ };
21278
+ })(),
21220
21279
  workflows: notInheritable(
21221
21280
  diagnostics,
21222
21281
  topLevelEnv,
@@ -23222,7 +23281,7 @@ function isDockerfile(imagePath, configPath) {
23222
23281
  }
23223
23282
  return false;
23224
23283
  }
23225
- var bucketFormatMessage, friendlyBindingNames, bindingTypeFriendlyNames, ENGLISH, ALLOWED_INSTANCE_TYPES, isRoute, isRouteArray, validateTailConsumers, validateStreamingTailConsumers, validateAndNormalizeRules, ARTIFACTS_EVENT_TYPE_SET, validateTriggers, validateRules, validateRule, validateDefines, validateVars, validateSecrets, validateBindingsProperty, validateUnsafeSettings, validateDurableObjectBinding, workflowNameFormatMessage, validateWorkflowBinding, validateCflogfwdrObject, validateCflogfwdrBinding, validateAssetsConfig, validateNamedSimpleBinding, validateAIBinding, validateVersionMetadataBinding, validateUnsafeBinding, validateBindingArray, validateCloudchamberConfig, validateKVBinding, validateSendEmailBinding, validateQueueBinding, validateR2Binding, validateD1Binding, validateVectorizeBinding, validateAISearchNamespaceBinding, validateAISearchBinding, validateAgentMemoryBinding, validateHyperdriveBinding, validateVpcServiceBinding, validateVpcNetworkBinding, validateBindingsHaveUniqueNames, validateServiceBinding, validateAnalyticsEngineBinding, validateWorkerNamespaceBinding, validateMTlsCertificateBinding, validateConsumer, validateConnectHandler, validateCompatibilityDate, validatePipelineBinding, validateSecretsStoreSecretBinding, validateArtifactsBinding, validateHelloWorldBinding, validateFlagshipBinding, validateWorkerLoaderBinding, validateRateLimitBinding, validatePreviewsConfig, validateMigrations, VALID_EXPORT_STORAGES, JS_IDENTIFIER_RE, validateExports, CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MIN, CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MAX, CONTAINER_OBSERVABILITY_TARGET_INSTANCE_COUNT_MIN, validateContainerObservability, validateObservability, validateAccess, validateCache, validatePythonModules;
23284
+ var bucketFormatMessage, friendlyBindingNames, bindingTypeFriendlyNames, ENGLISH, ALLOWED_INSTANCE_TYPES, isRoute, isRouteArray, validateTailConsumers, validateStreamingTailConsumers, validateAndNormalizeRules, ARTIFACTS_EVENT_TYPE_SET, validateTriggers, validateRules, validateRule, validateDefines, validateVars, validateSecrets, validateBindingsProperty, DURABLE_OBJECTS_CODE_UPDATE_MAX_DELAY_SECONDS, MILLISECOND_PRECISION_TOLERANCE, validateDurableObjectsProperty, validateUnsafeSettings, validateDurableObjectBinding, workflowNameFormatMessage, validateWorkflowBinding, validateCflogfwdrObject, validateCflogfwdrBinding, validateAssetsConfig, validateNamedSimpleBinding, validateAIBinding, validateVersionMetadataBinding, validateUnsafeBinding, validateBindingArray, validateCloudchamberConfig, validateKVBinding, validateSendEmailBinding, validateQueueBinding, validateR2Binding, validateD1Binding, validateVectorizeBinding, validateAISearchNamespaceBinding, validateAISearchBinding, validateAgentMemoryBinding, validateHyperdriveBinding, validateVpcServiceBinding, validateVpcNetworkBinding, validateBindingsHaveUniqueNames, validateServiceBinding, validateAnalyticsEngineBinding, validateWorkerNamespaceBinding, validateMTlsCertificateBinding, validateConsumer, validateConnectHandler, validateCompatibilityDate, validatePipelineBinding, validateSecretsStoreSecretBinding, validateArtifactsBinding, validateHelloWorldBinding, validateFlagshipBinding, validateWorkerLoaderBinding, validateRateLimitBinding, validatePreviewsConfig, validateMigrations, VALID_EXPORT_STORAGES, JS_IDENTIFIER_RE, validateExports, CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MIN, CONTAINER_OBSERVABILITY_TARGET_INSTANCE_PERCENTAGE_MAX, CONTAINER_OBSERVABILITY_TARGET_INSTANCE_COUNT_MIN, validateContainerObservability, validateObservability, validateAccess, validateCache, validatePythonModules;
23226
23285
  var init_validation = __esm({
23227
23286
  "../workers-utils/src/config/validation.ts"() {
23228
23287
  init_import_meta_url();
@@ -23765,6 +23824,85 @@ Please add a binding for each to "${fieldPath}.bindings":
23765
23824
  }
23766
23825
  return isValid;
23767
23826
  }, "validateBindingsProperty");
23827
+ DURABLE_OBJECTS_CODE_UPDATE_MAX_DELAY_SECONDS = 24 * 60 * 60;
23828
+ MILLISECOND_PRECISION_TOLERANCE = 1e-6;
23829
+ validateDurableObjectsProperty = /* @__PURE__ */ __name((envName, allowMissingBindings = false, allowCodeUpdateStrategy = true) => (diagnostics, field, value, config2) => {
23830
+ const fieldPath = config2 === void 0 ? `${field}` : `env.${envName}.${field}`;
23831
+ if (value === void 0) {
23832
+ return true;
23833
+ }
23834
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
23835
+ diagnostics.errors.push(
23836
+ `The field "${fieldPath}" should be an object but got ${JSON.stringify(value)}.`
23837
+ );
23838
+ return false;
23839
+ }
23840
+ validateAdditionalProperties(
23841
+ diagnostics,
23842
+ fieldPath,
23843
+ Object.keys(value),
23844
+ allowCodeUpdateStrategy ? ["bindings", "code_update_strategy"] : ["bindings"]
23845
+ );
23846
+ const bindingsContainer = allowMissingBindings && !hasProperty(value, "bindings") ? { ...value, bindings: [] } : value;
23847
+ let isValid = validateBindingsProperty(
23848
+ envName,
23849
+ validateDurableObjectBinding
23850
+ )(diagnostics, field, bindingsContainer, config2);
23851
+ if (!allowCodeUpdateStrategy) {
23852
+ return isValid;
23853
+ }
23854
+ if (!hasProperty(value, "code_update_strategy") || value.code_update_strategy === void 0) {
23855
+ return isValid;
23856
+ }
23857
+ const strategy = value.code_update_strategy;
23858
+ const strategyPath = `${fieldPath}.code_update_strategy`;
23859
+ if (typeof strategy !== "object" || strategy === null || Array.isArray(strategy)) {
23860
+ diagnostics.errors.push(
23861
+ `The field "${strategyPath}" should be an object but got ${JSON.stringify(strategy)}.`
23862
+ );
23863
+ return false;
23864
+ }
23865
+ validateAdditionalProperties(
23866
+ diagnostics,
23867
+ strategyPath,
23868
+ Object.keys(strategy),
23869
+ ["mode", "max_delay"]
23870
+ );
23871
+ isValid = validateRequiredProperty(
23872
+ diagnostics,
23873
+ strategyPath,
23874
+ "mode",
23875
+ hasProperty(strategy, "mode") ? strategy.mode : void 0,
23876
+ "string",
23877
+ ["immediate", "deferred"]
23878
+ ) && isValid;
23879
+ const maxDelay = hasProperty(strategy, "max_delay") ? strategy.max_delay : void 0;
23880
+ const maxDelayHasValidType = validateOptionalProperty(
23881
+ diagnostics,
23882
+ strategyPath,
23883
+ "max_delay",
23884
+ maxDelay,
23885
+ "number"
23886
+ );
23887
+ isValid = maxDelayHasValidType && isValid;
23888
+ if (maxDelayHasValidType && typeof maxDelay === "number" && (!Number.isFinite(maxDelay) || maxDelay < 0 || maxDelay > DURABLE_OBJECTS_CODE_UPDATE_MAX_DELAY_SECONDS)) {
23889
+ diagnostics.errors.push(
23890
+ `Expected "${strategyPath}.max_delay" to be between 0 and ${DURABLE_OBJECTS_CODE_UPDATE_MAX_DELAY_SECONDS} seconds but got ${JSON.stringify(maxDelay)}.`
23891
+ );
23892
+ isValid = false;
23893
+ }
23894
+ if (maxDelayHasValidType && typeof maxDelay === "number" && Number.isFinite(maxDelay) && maxDelay >= 0 && maxDelay <= DURABLE_OBJECTS_CODE_UPDATE_MAX_DELAY_SECONDS) {
23895
+ const milliseconds = maxDelay * 1e3;
23896
+ const roundedMilliseconds = Math.round(milliseconds);
23897
+ if (maxDelay > 0 && roundedMilliseconds === 0 || Math.abs(milliseconds - roundedMilliseconds) > MILLISECOND_PRECISION_TOLERANCE) {
23898
+ diagnostics.errors.push(
23899
+ `Expected "${strategyPath}.max_delay" to use millisecond precision but got ${JSON.stringify(maxDelay)}.`
23900
+ );
23901
+ isValid = false;
23902
+ }
23903
+ }
23904
+ return isValid;
23905
+ }, "validateDurableObjectsProperty");
23768
23906
  validateUnsafeSettings = /* @__PURE__ */ __name((envName) => (diagnostics, field, value, config2) => {
23769
23907
  const fieldPath = config2 === void 0 ? `${field}` : `env.${envName}.${field}`;
23770
23908
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
@@ -25630,7 +25768,7 @@ ${resolution}`);
25630
25768
  previews,
25631
25769
  `${field}.placement`
25632
25770
  );
25633
- isValid = validateBindingsProperty(envName, validateDurableObjectBinding)(
25771
+ isValid = validateDurableObjectsProperty(envName, false, false)(
25634
25772
  diagnostics,
25635
25773
  `${field}.durable_objects`,
25636
25774
  previews.durable_objects,
@@ -27183,7 +27321,7 @@ var DEFAULT_COMPAT_DATE;
27183
27321
  var init_default_compat_date = __esm({
27184
27322
  "../workers-utils/src/default-compat-date.ts"() {
27185
27323
  init_import_meta_url();
27186
- DEFAULT_COMPAT_DATE = "2026-09-23";
27324
+ DEFAULT_COMPAT_DATE = "2026-09-25";
27187
27325
  }
27188
27326
  });
27189
27327
 
@@ -62486,7 +62624,7 @@ var name, version2;
62486
62624
  var init_package = __esm({
62487
62625
  "package.json"() {
62488
62626
  name = "wrangler";
62489
- version2 = "4.140.0";
62627
+ version2 = "4.141.0";
62490
62628
  }
62491
62629
  });
62492
62630
 
@@ -124313,12 +124451,11 @@ var init_cloudflare = __esm({
124313
124451
  cloudflare_default = Cloudflare;
124314
124452
  }
124315
124453
  });
124316
-
124317
- // ../workers-auth/dist/chunk-O6YSETKJ.mjs
124318
124454
  var __defProp2, __name2;
124319
- var init_chunk_O6YSETKJ = __esm({
124320
- "../workers-auth/dist/chunk-O6YSETKJ.mjs"() {
124455
+ var init_chunk_VAZEJK55 = __esm({
124456
+ "../workers-auth/dist/chunk-VAZEJK55.mjs"() {
124321
124457
  init_import_meta_url();
124458
+ nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
124322
124459
  __defProp2 = Object.defineProperty;
124323
124460
  __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", { value, configurable: true }), "__name");
124324
124461
  }
@@ -126814,12 +126951,13 @@ function scrubEncryptedCredentials(options) {
126814
126951
  return { backendAvailable: false, encryptedFileExisted };
126815
126952
  }
126816
126953
  var import_undici3, hasWarnedAboutDeprecatedV1ApiToken, getCloudflareAPITokenFromEnv, getCloudflareGlobalAuthKeyFromEnv, getCloudflareGlobalAuthEmailFromEnv, ACCOUNT_ID_PATTERN, getAuthDomainFromEnv, getAuthUrlFromEnv, getTokenUrlFromEnv, getRevokeUrlFromEnv, readCloudflareAccountIdFromEnv, DEVICE_AUTH_PATH, getAccessClientIdFromEnv, getAccessClientSecretFromEnv, getCfAuthorizationTokenFromEnv, getCloudflareAuthUseKeyringFromEnv, headersCache, usesAccessCache, RECOMMENDED_CODE_VERIFIER_LENGTH, RECOMMENDED_STATE_LENGTH, PKCE_CHARSET, generateVerificationUrl, generateAuthUrl, POW_MAX_ITERATIONS, TEMPORARY_TERMS_URLS, TEMPORARY_TERMS_PROMPT, TEMPORARY_TERMS_NOTICE, TEMPORARY_TERMS_ERROR, EVENT_ACCOUNT_ERRORS, esm_default3, ErrorOAuth2, ErrorUnknown, ErrorNoAuthCode, ErrorInvalidReturnedStateParam, ErrorInvalidJson, ErrorInvalidScope, ErrorInvalidRequest, ErrorInvalidToken, ErrorAuthenticationGrant, ErrorUnauthorizedClient, ErrorAccessDenied, ErrorUnsupportedResponseType, ErrorServerError, ErrorTemporarilyUnavailable, ErrorAccessTokenResponse, ErrorInvalidClient, ErrorInvalidGrant, ErrorUnsupportedGrantType, DEVICE_FLOW_MAX_DURATION_SECONDS, DEVICE_FLOW_MIN_POLL_INTERVAL_SECONDS, RESERVED_PROFILE_NAMES, BARE_KEY2, HAS_WELLFORMED2, FILE_FORMATS, USER_AUTH_CONFIG_PATH, FileCredentialStore, KEY_LENGTH_BYTES, IV_LENGTH_BYTES, TAG_LENGTH_BYTES, ALGORITHM_LABEL, CIPHER_NAME, EncryptedFileCredentialStore, PINNED_KEYRING_VERSION, npmRunner, cachedBindingPathByDir, entryFactoryOverride, runner, cachedProbeResult, LinuxSecretToolKeyProvider, SECURITY_EXIT_ITEM_NOT_FOUND, runner2, MacSecurityKeyProvider, NapiKeyringKeyProvider, testProviderFactory, sessionFlags;
126817
- var init_chunk_WMSASLDV = __esm({
126818
- "../workers-auth/dist/chunk-WMSASLDV.mjs"() {
126954
+ var init_chunk_RV27PEH3 = __esm({
126955
+ "../workers-auth/dist/chunk-RV27PEH3.mjs"() {
126819
126956
  init_import_meta_url();
126820
- init_chunk_O6YSETKJ();
126957
+ init_chunk_VAZEJK55();
126821
126958
  init_src();
126822
126959
  import_undici3 = __toESM(require_undici(), 1);
126960
+ nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
126823
126961
  hasWarnedAboutDeprecatedV1ApiToken = false;
126824
126962
  __name(readStoredAuthState, "readStoredAuthState");
126825
126963
  __name2(readStoredAuthState, "readStoredAuthState");
@@ -127790,12 +127928,11 @@ var init_chunk_WMSASLDV = __esm({
127790
127928
  __name2(scrubEncryptedCredentials, "scrubEncryptedCredentials");
127791
127929
  }
127792
127930
  });
127793
-
127794
- // ../workers-auth/dist/index.mjs
127795
127931
  var init_dist2 = __esm({
127796
127932
  "../workers-auth/dist/index.mjs"() {
127797
127933
  init_import_meta_url();
127798
- init_chunk_WMSASLDV();
127934
+ init_chunk_RV27PEH3();
127935
+ nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
127799
127936
  }
127800
127937
  });
127801
127938
  function createPreferences(getConfigPath2) {
@@ -128703,12 +128840,13 @@ function createAuthConfigFileHelpers(deps) {
128703
128840
  };
128704
128841
  }
128705
128842
  var millisecondsInMinute, minutesInYear, minutesInMonth, minutesInDay, constructFromSymbol, defaultOptions2, formatDistanceLocale, formatDistance, dateFormats, timeFormats, dateTimeFormats, formatLong, formatRelativeLocale, formatRelative, eraValues, quarterValues, monthValues, dayValues, dayPeriodValues, formattingDayPeriodValues, ordinalNumber, localize, matchOrdinalNumberPattern, parseOrdinalNumberPattern, matchEraPatterns, parseEraPatterns, matchQuarterPatterns, parseQuarterPatterns, matchMonthPatterns, parseMonthPatterns, matchDayPatterns, parseDayPatterns, matchDayPeriodPatterns, parseDayPeriodPatterns, match, enUS, MEMBERSHIPS_INACCESSIBLE_CODES, DIRECTORY_BINDINGS_FILE, ENCRYPTED_PROFILE_CONFIG_EXTENSION;
128706
- var init_chunk_V6MEAFHI = __esm({
128707
- "../workers-auth/dist/chunk-V6MEAFHI.mjs"() {
128843
+ var init_chunk_2JQZNT7W = __esm({
128844
+ "../workers-auth/dist/chunk-2JQZNT7W.mjs"() {
128708
128845
  init_import_meta_url();
128709
- init_chunk_WMSASLDV();
128710
- init_chunk_O6YSETKJ();
128846
+ init_chunk_RV27PEH3();
128847
+ init_chunk_VAZEJK55();
128711
128848
  init_src();
128849
+ nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
128712
128850
  __name(createPreferences, "createPreferences");
128713
128851
  __name2(createPreferences, "createPreferences");
128714
128852
  millisecondsInMinute = 6e4;
@@ -129220,9 +129358,10 @@ var DefaultScopes, DefaultScopeKeys, WRANGLER_KEYRING_SERVICE_NAME, WRANGLER_CLI
129220
129358
  var init_wrangler = __esm({
129221
129359
  "../workers-auth/dist/wrangler/index.mjs"() {
129222
129360
  init_import_meta_url();
129223
- init_chunk_V6MEAFHI();
129224
- init_chunk_O6YSETKJ();
129361
+ init_chunk_2JQZNT7W();
129362
+ init_chunk_VAZEJK55();
129225
129363
  init_src();
129364
+ nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
129226
129365
  DefaultScopes = {
129227
129366
  "account:read": "See your account info such as account details, analytics, and memberships.",
129228
129367
  "user:read": "See your user info such as name, email address, and account memberships.",
@@ -135509,10 +135648,21 @@ function convertExports(config2, result) {
135509
135648
  const converted = {};
135510
135649
  const unknownExports = {};
135511
135650
  for (const [exportName, value] of Object.entries(exports$2)) {
135512
- if (value.type === "worker" || value.type === "workflow") {
135651
+ if (value.type === "worker") {
135513
135652
  converted[exportName] = value;
135514
135653
  continue;
135515
135654
  }
135655
+ if (value.type === "workflow") {
135656
+ const { defaultRetention, ...workflow } = value;
135657
+ converted[exportName] = {
135658
+ ...workflow,
135659
+ ...defaultRetention !== void 0 && { default_retention: {
135660
+ ...defaultRetention.successRetention !== void 0 && { success_retention: defaultRetention.successRetention },
135661
+ ...defaultRetention.errorRetention !== void 0 && { error_retention: defaultRetention.errorRetention }
135662
+ } }
135663
+ };
135664
+ continue;
135665
+ }
135516
135666
  if (value.type !== "durable-object") {
135517
135667
  unknownExports[exportName] = value;
135518
135668
  continue;
@@ -136292,9 +136442,9 @@ var init_dist3 = __esm({
136292
136442
  limits: strictObject({ steps: number2().int().min(1).optional() }).optional(),
136293
136443
  concurrency: strictObject({ limit: number2().int().min(1).optional() }).optional(),
136294
136444
  schedules: union([string2().min(1), array(string2().min(1)).min(1)]).optional(),
136295
- default_retention: strictObject({
136296
- success_retention: WorkflowRetentionSchema.optional(),
136297
- error_retention: WorkflowRetentionSchema.optional()
136445
+ defaultRetention: strictObject({
136446
+ successRetention: WorkflowRetentionSchema.optional(),
136447
+ errorRetention: WorkflowRetentionSchema.optional()
136298
136448
  }).optional()
136299
136449
  });
136300
136450
  DurableObjectCreatedSqliteExportSchema = DurableObjectCreatedExportSchema.extend({ storage: literal("sqlite") });
@@ -136516,11 +136666,13 @@ var init_dist3 = __esm({
136516
136666
  }, "../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/dist/index.js") });
136517
136667
  import_dist = require_dist2();
136518
136668
  __name(generateTypes, "generateTypes");
136669
+ nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
136519
136670
  __defProp3 = Object.defineProperty;
136520
136671
  __name3 = /* @__PURE__ */ __name((target, value) => __defProp3(target, "name", {
136521
136672
  value,
136522
136673
  configurable: true
136523
136674
  }), "__name");
136675
+ nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
136524
136676
  UserError2 = class extends Error {
136525
136677
  static {
136526
136678
  __name(this, "UserError");
@@ -136780,11 +136932,13 @@ var init_dist4 = __esm({
136780
136932
  __name(getWorkerConfigPath, "getWorkerConfigPath");
136781
136933
  __name(getWorkerBundleDir, "getWorkerBundleDir");
136782
136934
  __name(getWorkerAssetsDir, "getWorkerAssetsDir");
136935
+ nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
136783
136936
  __defProp4 = Object.defineProperty;
136784
136937
  __name4 = /* @__PURE__ */ __name((target, value) => __defProp4(target, "name", {
136785
136938
  value,
136786
136939
  configurable: true
136787
136940
  }), "__name");
136941
+ nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
136788
136942
  __name(isDirectory2, "isDirectory");
136789
136943
  __name4(isDirectory2, "isDirectory");
136790
136944
  __name(removeDir2, "removeDir");
@@ -141851,7 +142005,7 @@ async function getCreds(permissions, complianceConfig) {
141851
142005
  function isValidImageTag(value) {
141852
142006
  return IMAGE_TAG_REGEXP.test(value);
141853
142007
  }
141854
- var require$1, __create2, __defProp5, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf2, __hasOwnProp2, __name5, __require2, __commonJS3, __copyProps2, __toESM2, require_constants7, require_buffer_util, require_limiter, require_permessage_deflate2, require_validation, require_receiver2, require_sender2, require_event_target, require_extension, require_websocket2, require_stream, require_subprotocol, require_websocket_server, ApiError, CancelError2, CancelablePromise, OpenAPI, isDefined, isString2, isStringWithValue, isBlob3, isErrorResponse, base643, getQueryString, getUrl, getFormData, resolve10, getHeaders2, getRequestBody, isResponseSchemaV4, parseResponseSchemaV4, sendRequest, getResponseHeader, getResponseBody, catchErrorCodes, executeRequest, buildApiResult, request, requestPaginated, debugLogRequest, debugLogResponse, ApplicationRollout, AssignIPv4, AssignIPv6, BadRequestWithCodeError, ContainerImagePreparationStatus, CreateApplicationRolloutRequest, DeploymentMutationError, DeploymentNotFoundError, ExternalRegistryKind, ImageRegistryAlreadyExistsError, ImageRegistryIsPublic, ImageRegistryNotAllowedError, ImageRegistryNotFoundError, ImageRegistryProtocolAlreadyExists, ImageRegistryProtocolIsReferencedError, ImageRegistryProtocolNotFound, InstanceType, ProvisionerConfiguration, RolloutStep, SchedulingPolicy, SecretNameAlreadyExists, SecretNotFound, SSHPublicKeyNotFoundError, UpdateApplicationRolloutRequest, AccountService, ApplicationsService, ContainerImagePreparationsService, DeploymentsService, ImageRegistriesService, PlacementsService, RolloutsService, SshPublicKeysService, noop, logger3, fetchResult3, fetchPagedListResult3, getCloudflareRegistryWithAccountNamespace, MF_DEV_CONTAINER_PREFIX, getDevContainerImageName, runDockerCmd, runDockerCmdWithOutput, isDockerRunning, verifyDockerInstalled, cleanupContainers, getContainerIdsFromImage, DEFAULT_CONTAINER_EGRESS_INTERCEPTOR_IMAGE, getAndValidateRegistryType, MB, MiB, instanceTypes, LEGACY_TO_CANONICAL, MAX_DOCKER_REPOSITORY_NAME_LENGTH, DIGEST_SUFFIX_REGEXP, DIGEST_VALUE_REGEXP, TAG_SUFFIX_REGEXP, BUILD_OUTPUT_IMAGE_NAMESPACE, DOCKER_REPOSITORY_NAME_LENGTH, Diff, doAction, configRolloutStepsToAPI, MAX_DOCKER_REPOSITORY_NAME_LENGTH2, MAX_NAMED_IMAGE_SLUG_LENGTH, IMAGE_ID_HASH_LENGTH, import_websocket, containersSshOptions, MAX_REPOSITORY_LENGTH, REPOSITORY_COMPONENT_REGEXP, TAG_REGEXP, IMAGE_TAG_REGEXP;
142008
+ var require$13, __create2, __defProp5, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf2, __hasOwnProp2, __name5, __require2, __commonJS3, __copyProps2, __toESM2, require_constants7, require_buffer_util, require_limiter, require_permessage_deflate2, require_validation, require_receiver2, require_sender2, require_event_target, require_extension, require_websocket2, require_stream, require_subprotocol, require_websocket_server, ApiError, CancelError2, CancelablePromise, OpenAPI, isDefined, isString2, isStringWithValue, isBlob3, isErrorResponse, base643, getQueryString, getUrl, getFormData, resolve10, getHeaders2, getRequestBody, isResponseSchemaV4, parseResponseSchemaV4, sendRequest, getResponseHeader, getResponseBody, catchErrorCodes, executeRequest, buildApiResult, request, requestPaginated, debugLogRequest, debugLogResponse, ApplicationRollout, AssignIPv4, AssignIPv6, BadRequestWithCodeError, ContainerImagePreparationStatus, CreateApplicationRolloutRequest, DeploymentMutationError, DeploymentNotFoundError, ExternalRegistryKind, ImageRegistryAlreadyExistsError, ImageRegistryIsPublic, ImageRegistryNotAllowedError, ImageRegistryNotFoundError, ImageRegistryProtocolAlreadyExists, ImageRegistryProtocolIsReferencedError, ImageRegistryProtocolNotFound, InstanceType, ProvisionerConfiguration, RolloutStep, SchedulingPolicy, SecretNameAlreadyExists, SecretNotFound, SSHPublicKeyNotFoundError, UpdateApplicationRolloutRequest, AccountService, ApplicationsService, ContainerImagePreparationsService, DeploymentsService, ImageRegistriesService, PlacementsService, RolloutsService, SshPublicKeysService, noop, logger3, fetchResult3, fetchPagedListResult3, getCloudflareRegistryWithAccountNamespace, MF_DEV_CONTAINER_PREFIX, getDevContainerImageName, runDockerCmd, runDockerCmdWithOutput, isDockerRunning, verifyDockerInstalled, cleanupContainers, getContainerIdsFromImage, DEFAULT_CONTAINER_EGRESS_INTERCEPTOR_IMAGE, getAndValidateRegistryType, MB, MiB, instanceTypes, LEGACY_TO_CANONICAL, MAX_DOCKER_REPOSITORY_NAME_LENGTH, DIGEST_SUFFIX_REGEXP, DIGEST_VALUE_REGEXP, TAG_SUFFIX_REGEXP, BUILD_OUTPUT_IMAGE_NAMESPACE, DOCKER_REPOSITORY_NAME_LENGTH, Diff, doAction, configRolloutStepsToAPI, MAX_DOCKER_REPOSITORY_NAME_LENGTH2, MAX_NAMED_IMAGE_SLUG_LENGTH, IMAGE_ID_HASH_LENGTH, import_websocket, containersSshOptions, MAX_REPOSITORY_LENGTH, REPOSITORY_COMPONENT_REGEXP, TAG_REGEXP, IMAGE_TAG_REGEXP;
141855
142009
  var init_dist9 = __esm({
141856
142010
  "../containers-shared/dist/index.mjs"() {
141857
142011
  init_import_meta_url();
@@ -141864,7 +142018,7 @@ var init_dist9 = __esm({
141864
142018
  init_colors();
141865
142019
  init_src();
141866
142020
  init_interactive();
141867
- require$1 = nodeModule.createRequire(typeof __filename === "string" ? __filename : import_meta_url);
142021
+ require$13 = nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
141868
142022
  __create2 = Object.create;
141869
142023
  __defProp5 = Object.defineProperty;
141870
142024
  __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -141872,10 +142026,10 @@ var init_dist9 = __esm({
141872
142026
  __getProtoOf2 = Object.getPrototypeOf;
141873
142027
  __hasOwnProp2 = Object.prototype.hasOwnProperty;
141874
142028
  __name5 = /* @__PURE__ */ __name((target, value) => __defProp5(target, "name", { value, configurable: true }), "__name");
141875
- __require2 = /* @__PURE__ */ ((x7) => typeof require$1 !== "undefined" ? require$1 : typeof Proxy !== "undefined" ? new Proxy(x7, {
141876
- get: /* @__PURE__ */ __name((a8, b11) => (typeof require$1 !== "undefined" ? require$1 : a8)[b11], "get")
142029
+ __require2 = /* @__PURE__ */ ((x7) => typeof require$13 !== "undefined" ? require$13 : typeof Proxy !== "undefined" ? new Proxy(x7, {
142030
+ get: /* @__PURE__ */ __name((a8, b11) => (typeof require$13 !== "undefined" ? require$13 : a8)[b11], "get")
141877
142031
  }) : x7)(function(x7) {
141878
- if (typeof require$1 !== "undefined") return require$1.apply(this, arguments);
142032
+ if (typeof require$13 !== "undefined") return require$13.apply(this, arguments);
141879
142033
  throw Error('Dynamic require of "' + x7 + '" is not supported');
141880
142034
  });
141881
142035
  __commonJS3 = /* @__PURE__ */ __name((cb2, mod2) => /* @__PURE__ */ __name(function __require22() {
@@ -162523,7 +162677,7 @@ async function fetchDeployableVersions(complianceConfig, accountId, workerName,
162523
162677
  }
162524
162678
  return versions2;
162525
162679
  }
162526
- async function createDeployment(complianceConfig, accountId, workerName, versionTraffic, message, force) {
162680
+ async function createDeployment(complianceConfig, accountId, workerName, versionTraffic, message, force, codeUpdateStrategy) {
162527
162681
  return await fetchResult(
162528
162682
  complianceConfig,
162529
162683
  `/accounts/${accountId}/workers/scripts/${workerName}/deployments${force ? "?force=true" : ""}`,
@@ -162537,7 +162691,8 @@ async function createDeployment(complianceConfig, accountId, workerName, version
162537
162691
  ),
162538
162692
  annotations: {
162539
162693
  "workers/message": message
162540
- }
162694
+ },
162695
+ code_update_strategy: codeUpdateStrategy
162541
162696
  })
162542
162697
  }
162543
162698
  );
@@ -162822,6 +162977,7 @@ function createWorkerUploadForm(worker, bindings, options) {
162822
162977
  main: main2,
162823
162978
  sourceMaps,
162824
162979
  migrations,
162980
+ code_update_strategy,
162825
162981
  exports: configuredExports,
162826
162982
  compatibility_date,
162827
162983
  compatibility_flags,
@@ -163504,6 +163660,7 @@ function createWorkerUploadForm(worker, bindings, options) {
163504
163660
  compatibility_flags
163505
163661
  },
163506
163662
  ...migrations && { migrations },
163663
+ ...code_update_strategy && { code_update_strategy },
163507
163664
  ...configuredExports && Object.keys(configuredExports).length > 0 && {
163508
163665
  exports: configuredExports
163509
163666
  },
@@ -175129,6 +175286,9 @@ async function deployWorker(props, config2, buildResult, callbacks) {
175129
175286
  printBundleSize(bundleSize);
175130
175287
  const canUseNewVersionsDeploymentsApi = workerExists && props.dispatchNamespace === void 0 && format9 === "modules" && migrations === void 0 && !hasDurableObjectExports(config2.exports) && !config2.first_party_worker && props.containers.source === void 0 && // Rollout skip can recover Container metadata absent from local config.
175131
175288
  containerMetadata === void 0;
175289
+ if (!canUseNewVersionsDeploymentsApi) {
175290
+ worker.code_update_strategy = props.durableObjectsCodeUpdateStrategy;
175291
+ }
175132
175292
  let workerBundle;
175133
175293
  const dockerPath = getDockerPath();
175134
175294
  if (isDryRun) {
@@ -175201,13 +175361,16 @@ async function deployWorker(props, config2, buildResult, callbacks) {
175201
175361
  );
175202
175362
  const versionMap = /* @__PURE__ */ new Map();
175203
175363
  versionMap.set(versionResult.id, 100);
175364
+ const unsafeMetadata = config2.unsafe?.metadata;
175365
+ const codeUpdateStrategy = unsafeMetadata !== void 0 && "code_update_strategy" in unsafeMetadata ? unsafeMetadata.code_update_strategy : props.durableObjectsCodeUpdateStrategy;
175204
175366
  await createDeployment(
175205
175367
  config2,
175206
175368
  accountId,
175207
175369
  scriptName,
175208
175370
  versionMap,
175209
175371
  props.message,
175210
- void 0
175372
+ void 0,
175373
+ codeUpdateStrategy
175211
175374
  );
175212
175375
  const nextTags = applyServiceAndEnvironmentTags(config2, tags);
175213
175376
  try {
@@ -178818,9 +178981,10 @@ var CF_KEYRING_SERVICE_NAME, CF_CLI_NAME, CF_DISPLAY_NAME, CF_OAUTH_CALLBACK_URL
178818
178981
  var init_cf = __esm({
178819
178982
  "../workers-auth/dist/cf/index.mjs"() {
178820
178983
  init_import_meta_url();
178821
- init_chunk_V6MEAFHI();
178822
- init_chunk_O6YSETKJ();
178984
+ init_chunk_2JQZNT7W();
178985
+ init_chunk_VAZEJK55();
178823
178986
  init_src();
178987
+ nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
178824
178988
  CF_KEYRING_SERVICE_NAME = "cloudflare";
178825
178989
  CF_CLI_NAME = "cf";
178826
178990
  CF_DISPLAY_NAME = "cf";
@@ -179823,7 +179987,7 @@ var init_dist14 = __esm({
179823
179987
  init_wrapper();
179824
179988
  init_create_worker_upload_form();
179825
179989
  import_undici13 = __toESM(require_undici(), 1);
179826
- version3 = "0.0.35";
179990
+ version3 = "0.0.36";
179827
179991
  NoDefaultValueProvided2 = class extends UserError {
179828
179992
  static {
179829
179993
  __name(this, "NoDefaultValueProvided");
@@ -212787,6 +212951,98 @@ var init_collectKeyValues = __esm({
212787
212951
  }
212788
212952
  });
212789
212953
 
212954
+ // src/versions/deployment-args.ts
212955
+ function parseDurableObjectsCodeUpdateMode(value) {
212956
+ if (typeof value !== "string") {
212957
+ throwInvalidCodeUpdateMode();
212958
+ }
212959
+ const [mode, duration3, ...extraValues] = value.trim().split(/\s+/);
212960
+ if (mode === "immediate" && duration3 === void 0) {
212961
+ return { mode };
212962
+ }
212963
+ if (mode === "deferred" && duration3 !== void 0 && extraValues.length === 0) {
212964
+ const seconds = parseHumanDuration(duration3);
212965
+ if (/\d/.test(duration3) && Number.isFinite(seconds) && seconds >= 0 && seconds <= MAX_DURABLE_OBJECTS_CODE_UPDATE_DELAY_SECONDS && hasMillisecondPrecision(seconds)) {
212966
+ return { mode, max_delay: seconds };
212967
+ }
212968
+ throw new CommandLineArgsError(
212969
+ 'The duration passed to "--durable-objects-code-update-mode deferred" must be between 0 seconds and 24 hours and use millisecond precision.',
212970
+ { telemetryMessage: "durable objects code update delay invalid" }
212971
+ );
212972
+ }
212973
+ throwInvalidCodeUpdateMode();
212974
+ }
212975
+ function hasMillisecondPrecision(seconds) {
212976
+ const milliseconds = seconds * 1e3;
212977
+ const roundedMilliseconds = Math.round(milliseconds);
212978
+ return (seconds === 0 || roundedMilliseconds > 0) && Math.abs(milliseconds - roundedMilliseconds) <= 1e-6;
212979
+ }
212980
+ function throwInvalidCodeUpdateMode() {
212981
+ throw new CommandLineArgsError(
212982
+ 'The argument "--durable-objects-code-update-mode" must be either "immediate" or "deferred <duration>".',
212983
+ { telemetryMessage: "durable objects code update mode invalid" }
212984
+ );
212985
+ }
212986
+ function normalizeDurableObjectsCodeUpdateModeArgs(argv) {
212987
+ const normalizedArgv = [];
212988
+ for (let i8 = 0; i8 < argv.length; i8++) {
212989
+ const arg = argv[i8];
212990
+ if (arg === "--") {
212991
+ normalizedArgv.push(...argv.slice(i8));
212992
+ break;
212993
+ }
212994
+ const separateMode = arg === DURABLE_OBJECTS_CODE_UPDATE_MODE_FLAG;
212995
+ const inlineMode = arg.startsWith(
212996
+ `${DURABLE_OBJECTS_CODE_UPDATE_MODE_FLAG}=`
212997
+ ) ? arg.slice(DURABLE_OBJECTS_CODE_UPDATE_MODE_FLAG.length + 1) : void 0;
212998
+ const mode = separateMode ? argv[i8 + 1] : inlineMode;
212999
+ const durationIndex = i8 + (separateMode ? 2 : 1);
213000
+ const duration3 = argv[durationIndex];
213001
+ if (mode === "deferred" && duration3 !== void 0 && (!duration3.startsWith("-") || Number.isFinite(parseHumanDuration(duration3)))) {
213002
+ normalizedArgv.push(
213003
+ `${DURABLE_OBJECTS_CODE_UPDATE_MODE_FLAG}=deferred ${duration3}`
213004
+ );
213005
+ i8 = durationIndex;
213006
+ continue;
213007
+ }
213008
+ normalizedArgv.push(arg);
213009
+ }
213010
+ return normalizedArgv;
213011
+ }
213012
+ function resolveDurableObjectsCodeUpdateStrategy(codeUpdateMode, codeUpdateStrategy) {
213013
+ const strategy = codeUpdateMode ?? codeUpdateStrategy ?? DEFAULT_DURABLE_OBJECTS_CODE_UPDATE_STRATEGY;
213014
+ return strategy.mode === "immediate" ? { mode: "immediate" } : {
213015
+ mode: "deferred",
213016
+ max_delay: strategy.max_delay ?? DEFAULT_DURABLE_OBJECTS_CODE_UPDATE_STRATEGY.max_delay
213017
+ };
213018
+ }
213019
+ var DEFAULT_DURABLE_OBJECTS_CODE_UPDATE_STRATEGY, MAX_DURABLE_OBJECTS_CODE_UPDATE_DELAY_SECONDS, DURABLE_OBJECTS_CODE_UPDATE_MODE_FLAG, durableObjectsCodeUpdateModeArg;
213020
+ var init_deployment_args = __esm({
213021
+ "src/versions/deployment-args.ts"() {
213022
+ init_import_meta_url();
213023
+ init_src();
213024
+ DEFAULT_DURABLE_OBJECTS_CODE_UPDATE_STRATEGY = {
213025
+ mode: "deferred",
213026
+ max_delay: 300
213027
+ };
213028
+ MAX_DURABLE_OBJECTS_CODE_UPDATE_DELAY_SECONDS = 24 * 60 * 60;
213029
+ DURABLE_OBJECTS_CODE_UPDATE_MODE_FLAG = "--durable-objects-code-update-mode";
213030
+ __name(parseDurableObjectsCodeUpdateMode, "parseDurableObjectsCodeUpdateMode");
213031
+ __name(hasMillisecondPrecision, "hasMillisecondPrecision");
213032
+ __name(throwInvalidCodeUpdateMode, "throwInvalidCodeUpdateMode");
213033
+ __name(normalizeDurableObjectsCodeUpdateModeArgs, "normalizeDurableObjectsCodeUpdateModeArgs");
213034
+ __name(resolveDurableObjectsCodeUpdateStrategy, "resolveDurableObjectsCodeUpdateStrategy");
213035
+ durableObjectsCodeUpdateModeArg = {
213036
+ "durable-objects-code-update-mode": {
213037
+ describe: "How to update Durable Object code: immediate, or deferred followed by a maximum delay (for example, deferred 30s)",
213038
+ type: "string",
213039
+ requiresArg: true,
213040
+ coerce: parseDurableObjectsCodeUpdateMode
213041
+ }
213042
+ };
213043
+ }
213044
+ });
213045
+
212790
213046
  // src/deployment-bundle/merge-config-args.ts
212791
213047
  async function mergeSharedConfigArgs(command2, args, config2) {
212792
213048
  const entry = await getEntry(args, config2, command2);
@@ -212892,6 +213148,10 @@ async function mergeDeployConfigArgs(args, config2) {
212892
213148
  dispatchNamespace: args.dispatchNamespace,
212893
213149
  oldAssetTtl: args.oldAssetTtl,
212894
213150
  containersRollout: args.containersRollout,
213151
+ durableObjectsCodeUpdateStrategy: resolveDurableObjectsCodeUpdateStrategy(
213152
+ args.durableObjectsCodeUpdateMode,
213153
+ config2.durable_objects.code_update_strategy
213154
+ ),
212895
213155
  containers: {
212896
213156
  ...shared.containers,
212897
213157
  standard: {
@@ -212975,6 +213235,7 @@ var init_merge_config_args = __esm({
212975
213235
  init_user3();
212976
213236
  init_collectKeyValues();
212977
213237
  init_getScriptName();
213238
+ init_deployment_args();
212978
213239
  init_entry();
212979
213240
  init_route_zone_args();
212980
213241
  __name(mergeSharedConfigArgs, "mergeSharedConfigArgs");
@@ -264463,6 +264724,7 @@ var init_dist15 = __esm({
264463
264724
  __toESM(require_main4(), 1);
264464
264725
  esprimaParser = __toESM(require_esprima3(), 1);
264465
264726
  typescriptParser = __toESM(require_typescript2(), 1);
264727
+ nodeModule.createRequire(import_meta_url || (typeof __filename === "string" ? __filename : "/"));
264466
264728
  __defProp6 = Object.defineProperty;
264467
264729
  __name6 = /* @__PURE__ */ __name((target, value) => __defProp6(target, "name", { value, configurable: true }), "__name");
264468
264730
  __name(parseJs, "parseJs");
@@ -265302,7 +265564,7 @@ var init_packages3 = __esm({
265302
265564
  init_command2();
265303
265565
  init_src();
265304
265566
  installPackages = /* @__PURE__ */ __name(async (packageManager, packages, config2 = {}) => {
265305
- const { force, dev: dev2, startText, doneText } = config2;
265567
+ const { cwd: cwd2 = process.cwd(), force, dev: dev2, startText, doneText } = config2;
265306
265568
  const isWorkspaceRoot = config2.isWorkspaceRoot ?? false;
265307
265569
  if (packages.length === 0) {
265308
265570
  let cmd$1;
@@ -265324,7 +265586,7 @@ var init_packages3 = __esm({
265324
265586
  ...force === true ? ["--force"] : [],
265325
265587
  ...getWorkspaceInstallRootFlag(packageManager, isWorkspaceRoot)
265326
265588
  ], {
265327
- cwd: process.cwd(),
265589
+ cwd: cwd2,
265328
265590
  startText,
265329
265591
  doneText,
265330
265592
  silent: true
@@ -265358,12 +265620,13 @@ var init_packages3 = __esm({
265358
265620
  ...force === true ? ["--force"] : [],
265359
265621
  ...getWorkspaceInstallRootFlag(packageManager, isWorkspaceRoot)
265360
265622
  ], {
265623
+ cwd: cwd2,
265361
265624
  startText,
265362
265625
  doneText,
265363
265626
  silent: true
265364
265627
  });
265365
265628
  if (packageManager === "npm") {
265366
- const pkgJsonPath = path28__namespace.default.join(process.cwd(), "package.json");
265629
+ const pkgJsonPath = path28__namespace.default.join(cwd2, "package.json");
265367
265630
  const pkgJson = parsePackageJSON(readFileSync(pkgJsonPath), pkgJsonPath);
265368
265631
  const deps = config2.dev ? pkgJson.devDependencies : pkgJson.dependencies;
265369
265632
  assert38__default.default(deps, "dependencies should be defined");
@@ -288538,6 +288801,7 @@ var init_deploy3 = __esm({
288538
288801
  init_sites2();
288539
288802
  init_detect_agent();
288540
288803
  init_getScriptName();
288804
+ init_deployment_args();
288541
288805
  init_autoconfig2();
288542
288806
  init_open_next();
288543
288807
  __name(parseEventCode, "parseEventCode");
@@ -288552,6 +288816,7 @@ var init_deploy3 = __esm({
288552
288816
  args: {
288553
288817
  ...experimentalNewConfigArg,
288554
288818
  ...sharedDeployVersionsArgs,
288819
+ ...durableObjectsCodeUpdateModeArg,
288555
288820
  "event-code": {
288556
288821
  describe: "Create a temporary account for an event",
288557
288822
  type: "string",
@@ -299345,6 +299610,7 @@ async function runPagesToWorkersDeploy(delegation) {
299345
299610
  oldAssetTtl: void 0,
299346
299611
  dispatchNamespace: void 0,
299347
299612
  containersRollout: void 0,
299613
+ durableObjectsCodeUpdateMode: void 0,
299348
299614
  path: void 0,
299349
299615
  script: void 0,
299350
299616
  name: void 0,
@@ -302637,6 +302903,7 @@ async function toEnvironment(deploymentConfig, accountId) {
302637
302903
  deploymentConfig.durable_object_namespaces ?? {}
302638
302904
  )) {
302639
302905
  configObj.durable_objects ??= { bindings: [] };
302906
+ configObj.durable_objects.bindings ??= [];
302640
302907
  if (ns.class_name && ns.class_name !== "") {
302641
302908
  configObj.durable_objects.bindings.push({
302642
302909
  name: name2,
@@ -342844,6 +343111,7 @@ var init_subscription_types = __esm({
342844
343111
  EventSourceType = /* @__PURE__ */ ((EventSourceType2) => {
342845
343112
  EventSourceType2["ARTIFACTS"] = "artifacts";
342846
343113
  EventSourceType2["ARTIFACTS_REPO"] = "artifacts.repo";
343114
+ EventSourceType2["BROWSER_RUN"] = "browserRun";
342847
343115
  EventSourceType2["EMAIL_SENDING"] = "email.sending";
342848
343116
  EventSourceType2["IMAGES"] = "images";
342849
343117
  EventSourceType2["KV"] = "kv";
@@ -342866,6 +343134,8 @@ function parseSourceArgument(source, args) {
342866
343134
  return { type: "artifacts" /* ARTIFACTS */ };
342867
343135
  case "artifacts.repo" /* ARTIFACTS_REPO */:
342868
343136
  return { type: "artifacts.repo" /* ARTIFACTS_REPO */ };
343137
+ case "browserRun" /* BROWSER_RUN */:
343138
+ return { type: "browserRun" /* BROWSER_RUN */ };
342869
343139
  case "email.sending" /* EMAIL_SENDING */:
342870
343140
  if (!args.zoneId) {
342871
343141
  throw new UserError(
@@ -352165,14 +352435,15 @@ async function fetchDeployableVersions2(complianceConfig, accountId, workerName,
352165
352435
  versionCache
352166
352436
  );
352167
352437
  }
352168
- async function createDeployment2(complianceConfig, accountId, workerName, versionTraffic, message, force) {
352438
+ async function createDeployment2(complianceConfig, accountId, workerName, versionTraffic, message, force, codeUpdateStrategy) {
352169
352439
  return createDeployment(
352170
352440
  complianceConfig,
352171
352441
  accountId,
352172
352442
  workerName,
352173
352443
  versionTraffic,
352174
352444
  message,
352175
- force
352445
+ force,
352446
+ codeUpdateStrategy
352176
352447
  );
352177
352448
  }
352178
352449
  async function patchNonVersionedScriptSettings2(complianceConfig, accountId, workerName, settings) {
@@ -352631,6 +352902,7 @@ var init_deploy6 = __esm({
352631
352902
  init_user3();
352632
352903
  init_render_labelled_values();
352633
352904
  init_api4();
352905
+ init_deployment_args();
352634
352906
  init_src3();
352635
352907
  EPSILON = 1e-3;
352636
352908
  BLANK_INPUT2 = "-";
@@ -352649,6 +352921,7 @@ var init_deploy6 = __esm({
352649
352921
  },
352650
352922
  args: {
352651
352923
  ...experimentalNewConfigArg,
352924
+ ...durableObjectsCodeUpdateModeArg,
352652
352925
  name: {
352653
352926
  describe: "Name of the worker",
352654
352927
  type: "string",
@@ -352810,7 +353083,12 @@ var init_deploy6 = __esm({
352810
353083
  accountId,
352811
353084
  workerName,
352812
353085
  confirmedVersionTraffic,
352813
- message
353086
+ message,
353087
+ void 0,
353088
+ resolveDurableObjectsCodeUpdateStrategy(
353089
+ args.durableObjectsCodeUpdateMode,
353090
+ config2.durable_objects.code_update_strategy
353091
+ )
352814
353092
  );
352815
353093
  }
352816
353094
  });
@@ -353327,9 +353605,11 @@ var init_rollback = __esm({
353327
353605
  init_user3();
353328
353606
  init_api4();
353329
353607
  init_deploy6();
353608
+ init_deployment_args();
353330
353609
  CANNOT_ROLLBACK_WITH_MODIFIED_SECERT_CODE = 10220;
353331
353610
  versionsRollbackCommand = createCommand({
353332
353611
  args: {
353612
+ ...durableObjectsCodeUpdateModeArg,
353333
353613
  "version-id": {
353334
353614
  describe: "The ID of the Worker Version to rollback to",
353335
353615
  type: "string",
@@ -353414,7 +353694,12 @@ Rolling back to a previous deployment will not rollback any of the bound resourc
353414
353694
  accountId,
353415
353695
  workerName,
353416
353696
  rollbackTraffic,
353417
- message
353697
+ message,
353698
+ void 0,
353699
+ resolveDurableObjectsCodeUpdateStrategy(
353700
+ args.durableObjectsCodeUpdateMode,
353701
+ config2.durable_objects.code_update_strategy
353702
+ )
353418
353703
  );
353419
353704
  } catch (e11) {
353420
353705
  if (e11 instanceof APIError && e11.code === CANNOT_ROLLBACK_WITH_MODIFIED_SECERT_CODE) {
@@ -353435,7 +353720,11 @@ Rolling back to a previous deployment will not rollback any of the bound resourc
353435
353720
  workerName,
353436
353721
  rollbackTraffic,
353437
353722
  message,
353438
- true
353723
+ true,
353724
+ resolveDurableObjectsCodeUpdateStrategy(
353725
+ args.durableObjectsCodeUpdateMode,
353726
+ config2.durable_objects.code_update_strategy
353727
+ )
353439
353728
  );
353440
353729
  } else {
353441
353730
  cancel("Aborting rollback...");
@@ -359338,7 +359627,9 @@ function createCLIParser(argv) {
359338
359627
  requiresArg: true
359339
359628
  }
359340
359629
  };
359341
- const wrangler = yargs_default(argv).strict().showHelpOnFail(false).fail((msg, error53) => {
359630
+ const wrangler = yargs_default(
359631
+ normalizeDurableObjectsCodeUpdateModeArgs(argv)
359632
+ ).strict().showHelpOnFail(false).fail((msg, error53) => {
359342
359633
  if (!error53 || error53.name === "YError") {
359343
359634
  error53 = new CommandLineArgsError(msg, {
359344
359635
  telemetryMessage: "yargs validation error"
@@ -361565,6 +361856,7 @@ var init_src7 = __esm({
361565
361856
  init_upsert();
361566
361857
  init_versions8();
361567
361858
  init_deploy6();
361859
+ init_deployment_args();
361568
361860
  init_deployments5();
361569
361861
  init_list32();
361570
361862
  init_status3();
@@ -362839,10 +363131,11 @@ var init_DevEnv = __esm({
362839
363131
  `, event.cause);
362840
363132
  logger2.debug("=> Error contextual data:", event.data);
362841
363133
  } else if (event.source === "ProxyController" && event.reason.startsWith("Error inside ProxyWorker")) {
362842
- const detail = event.cause.message || event.cause.cause?.message || "unknown error";
362843
363134
  logger2.error(
362844
- `${event.reason} (the affected request failed; the dev server continues): ${detail}`
363135
+ `${event.reason} (the affected request failed; the dev server continues): ${event.cause.message || "unknown error"}`
362845
363136
  );
363137
+ logger2.debug(`Error in ${event.source}: ${event.reason}
363138
+ `, event.cause);
362846
363139
  logger2.debug("=> Error contextual data:", event.data);
362847
363140
  } else if (event.source === "ConfigController" && event.cause instanceof ParseError) {
362848
363141
  logger2.error(event.cause);