wrangler 4.108.0 → 4.109.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.
@@ -44525,7 +44525,7 @@ var name, version;
44525
44525
  var init_package = __esm({
44526
44526
  "package.json"() {
44527
44527
  name = "wrangler";
44528
- version = "4.108.0";
44528
+ version = "4.109.0";
44529
44529
  }
44530
44530
  });
44531
44531
 
@@ -124002,7 +124002,8 @@ var init_user2 = __esm({
124002
124002
  "connectivity:admin": "See, change, and bind to Connectivity Directory services, including creating services targeting Cloudflare Tunnel.",
124003
124003
  "email_routing:write": "See and change Email Routing settings, rules, and destination addresses.",
124004
124004
  "email_sending:write": "See and change Email Sending settings and configuration.",
124005
- "browser:write": "See and manage Browser Run sessions"
124005
+ "browser:write": "See and manage Browser Run sessions",
124006
+ "challenge-widgets.write": "See and change Turnstile widgets"
124006
124007
  };
124007
124008
  DefaultScopeKeys = Object.keys(DefaultScopes);
124008
124009
  __name(validateScopeKeys, "validateScopeKeys");
@@ -148087,7 +148088,22 @@ ${dashLink}`, {
148087
148088
  }
148088
148089
  ).then(
148089
148090
  () => ({ targets: [`workflow: ${workflow.name}`] }),
148090
- (error53) => ({ targets: [], error: error53 })
148091
+ (error53) => {
148092
+ if (error53 instanceof APIError && error53.code === WORKFLOW_CRON_REQUIRES_PAID_PLAN_CODE && workflow.schedules) {
148093
+ error53.preventReport();
148094
+ return {
148095
+ targets: [],
148096
+ error: new UserError(
148097
+ `Workflow "${workflow.name}" has "schedules" configured, but scheduled Workflows require a paid Workers plan.`,
148098
+ {
148099
+ cause: error53,
148100
+ telemetryMessage: "triggers deploy workflow cron requires paid plan"
148101
+ }
148102
+ )
148103
+ };
148104
+ }
148105
+ return { targets: [], error: error53 };
148106
+ }
148091
148107
  )
148092
148108
  );
148093
148109
  }
@@ -153430,7 +153446,7 @@ function renderInconsistentExportsAcrossVersionsError(serverMessage) {
153430
153446
  "Learn more: https://developers.cloudflare.com/workers/configuration/versions-and-deployments/gradual-deployments/#gradual-deployments-for-durable-objects"
153431
153447
  ].join("\n");
153432
153448
  }
153433
- var import_undici4, import_command_exists2, import_dotenv, require_ignore, require_heap, require_heap2, require_difflib, require_difflib2, require_util9, require_styles2, require_has_flag2, require_supports_colors2, require_trap2, require_zalgo2, require_america2, require_zebra2, require_rainbow2, require_random2, require_colors2, require_safe2, require_colorize, require_lib4, __getOwnPropNames4, __commonJS22, __defProp5, __name22, UserError2, FatalError2, JsonFriendlyFatalError2, CharacterCodes2, ParseOptions2, ScanError2, SyntaxKind2, parse22, ParseErrorCode2, TomlError4, DATE_TIME_RE4, TomlDate4, INT_REGEX4, FLOAT_REGEX4, LEADING_ZERO4, ESCAPE_REGEX4, ESC_MAP4, KEY_PART_RE4, BARE_KEY4, dist_default6, ParseError2, units2, UNSUPPORTED_BOMS2, PATH_TO_DEPLOY_CONFIG2, esm_default5, AssetsSchema, KnownBindingSchema, UnsafeBindingSchema, BindingSchema, CacheSchema, SINGLETON_BINDING_TYPES, listFormatter, EnvSchema, ExportSchema, LimitsSchema, ObservabilitySchema, PlacementSchema, TailConsumerSchema, TriggerSchema, UnsafeSchema, BaseWorkerSchema, InputWorkerSchema, ModuleTypeSchema, ManifestSchema, require_dist2, ApplicationRollout2, BadRequestWithCodeError2, CreateApplicationRolloutRequest2, DeploymentNotFoundError2, ImageRegistryAlreadyExistsError2, ImageRegistryIsPublic2, ImageRegistryNotAllowedError2, ImageRegistryNotFoundError2, ImageRegistryProtocolAlreadyExists2, ImageRegistryProtocolIsReferencedError2, ImageRegistryProtocolNotFound2, ProvisionerConfiguration2, RolloutStep2, SecretNameAlreadyExists2, SecretNotFound2, SSHPublicKeyNotFoundError2, UpdateApplicationRolloutRequest2, runDockerCmd2, isDockerRunning2, verifyDockerInstalled2, queuesUrl, MAX_ROUTES_RULES, MAX_ROUTES_RULE_LENGTH, formatInvalidRoutes, MAX_ASSET_SIZE, CF_ASSETS_IGNORE_FILENAME, REDIRECTS_FILENAME, HEADERS_FILENAME, import_ignore, types, other_default, types2, standard_default, __classPrivateFieldGet7, _Mime_extensionToType, _Mime_typeToExtension, _Mime_typeToExtensions, Mime, Mime_default, src_default, normalizeFilePath, getContentType, hashFile, decodeJwtPayload, isJwtExpired, BULK_UPLOAD_CONCURRENCY, EDGE_KV_UPLOAD_CONCURRENCY, MAX_UPLOAD_ATTEMPTS, MAX_UPLOAD_GATEWAY_ERRORS, MAX_DIFF_LINES, syncAssets, buildAssetManifest, WORKER_JS_FILENAME, nameBindings, ONE_KIB_BYTES, MAX_GZIP_SIZE_BYTES, WORKER_NOT_FOUND_ERR_CODE, WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE, BLANK_INPUT, moduleTypeMimeType, INVALID_INHERIT_BINDING_CODE, EXPORTS_RECONCILIATION_ERROR_CODE, INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE, ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, suppressNotFoundError, esm_default22, isConnectedStatusExplained, ProvisionResourceHandler, R2Handler, AISearchNamespaceHandler, AgentMemoryNamespaceHandler, KVHandler, D1Handler, HANDLERS, InternalConfigSchema, StaticRoutingSchema, MetadataStaticRedirectEntry, MetadataRedirectEntry, MetadataStaticRedirects, MetadataRedirects, MetadataHeaderEntry, MetadataHeaders, RedirectsSchema, HeadersSchema, sourceMappingPrepareStackTrace, retrieveSourceMapOverride, placeholderError, CALL_SITE_REGEXP, CallSite, WORKFLOW_NOT_FOUND_CODE, import_json_diff, reorderableBindings, getCloudflareAccountIdFromEnv2, validateRoutes2, MAX_DNS_LABEL_LENGTH, HASH_LENGTH, ALIAS_VALIDATION_REGEX;
153449
+ var import_undici4, import_command_exists2, import_dotenv, require_ignore, require_heap, require_heap2, require_difflib, require_difflib2, require_util9, require_styles2, require_has_flag2, require_supports_colors2, require_trap2, require_zalgo2, require_america2, require_zebra2, require_rainbow2, require_random2, require_colors2, require_safe2, require_colorize, require_lib4, __getOwnPropNames4, __commonJS22, __defProp5, __name22, UserError2, FatalError2, JsonFriendlyFatalError2, CharacterCodes2, ParseOptions2, ScanError2, SyntaxKind2, parse22, ParseErrorCode2, TomlError4, DATE_TIME_RE4, TomlDate4, INT_REGEX4, FLOAT_REGEX4, LEADING_ZERO4, ESCAPE_REGEX4, ESC_MAP4, KEY_PART_RE4, BARE_KEY4, dist_default6, ParseError2, units2, UNSUPPORTED_BOMS2, PATH_TO_DEPLOY_CONFIG2, esm_default5, AssetsSchema, KnownBindingSchema, UnsafeBindingSchema, BindingSchema, CacheSchema, SINGLETON_BINDING_TYPES, listFormatter, EnvSchema, ExportSchema, LimitsSchema, ObservabilitySchema, PlacementSchema, TailConsumerSchema, TriggerSchema, UnsafeSchema, BaseWorkerSchema, InputWorkerSchema, ModuleTypeSchema, ManifestSchema, require_dist2, ApplicationRollout2, BadRequestWithCodeError2, CreateApplicationRolloutRequest2, DeploymentNotFoundError2, ImageRegistryAlreadyExistsError2, ImageRegistryIsPublic2, ImageRegistryNotAllowedError2, ImageRegistryNotFoundError2, ImageRegistryProtocolAlreadyExists2, ImageRegistryProtocolIsReferencedError2, ImageRegistryProtocolNotFound2, ProvisionerConfiguration2, RolloutStep2, SecretNameAlreadyExists2, SecretNotFound2, SSHPublicKeyNotFoundError2, UpdateApplicationRolloutRequest2, runDockerCmd2, isDockerRunning2, verifyDockerInstalled2, INVALID_INHERIT_BINDING_CODE, EXPORTS_RECONCILIATION_ERROR_CODE, INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE, ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE, WORKFLOW_CRON_REQUIRES_PAID_PLAN_CODE, queuesUrl, MAX_ROUTES_RULES, MAX_ROUTES_RULE_LENGTH, formatInvalidRoutes, MAX_ASSET_SIZE, CF_ASSETS_IGNORE_FILENAME, REDIRECTS_FILENAME, HEADERS_FILENAME, import_ignore, types, other_default, types2, standard_default, __classPrivateFieldGet7, _Mime_extensionToType, _Mime_typeToExtension, _Mime_typeToExtensions, Mime, Mime_default, src_default, normalizeFilePath, getContentType, hashFile, decodeJwtPayload, isJwtExpired, BULK_UPLOAD_CONCURRENCY, EDGE_KV_UPLOAD_CONCURRENCY, MAX_UPLOAD_ATTEMPTS, MAX_UPLOAD_GATEWAY_ERRORS, MAX_DIFF_LINES, syncAssets, buildAssetManifest, WORKER_JS_FILENAME, nameBindings, ONE_KIB_BYTES, MAX_GZIP_SIZE_BYTES, WORKER_NOT_FOUND_ERR_CODE, WORKER_LEGACY_ENVIRONMENT_NOT_FOUND_ERR_CODE, BLANK_INPUT, moduleTypeMimeType, suppressNotFoundError, esm_default22, isConnectedStatusExplained, ProvisionResourceHandler, R2Handler, AISearchNamespaceHandler, AgentMemoryNamespaceHandler, KVHandler, D1Handler, HANDLERS, InternalConfigSchema, StaticRoutingSchema, MetadataStaticRedirectEntry, MetadataRedirectEntry, MetadataStaticRedirects, MetadataRedirects, MetadataHeaderEntry, MetadataHeaders, RedirectsSchema, HeadersSchema, sourceMappingPrepareStackTrace, retrieveSourceMapOverride, placeholderError, CALL_SITE_REGEXP, CallSite, WORKFLOW_NOT_FOUND_CODE, import_json_diff, reorderableBindings, getCloudflareAccountIdFromEnv2, validateRoutes2, MAX_DNS_LABEL_LENGTH, HASH_LENGTH, ALIAS_VALIDATION_REGEX;
153434
153450
  var init_dist9 = __esm({
153435
153451
  "../deploy-helpers/dist/index.mjs"() {
153436
153452
  init_import_meta_url();
@@ -157518,6 +157534,11 @@ ${codeblock}`, options);
157518
157534
  }, "verifyDockerInstalled");
157519
157535
  __name(getFailedToRunDockerErrorMessage2, "getFailedToRunDockerErrorMessage");
157520
157536
  __name3(getFailedToRunDockerErrorMessage2, "getFailedToRunDockerErrorMessage");
157537
+ INVALID_INHERIT_BINDING_CODE = 10057;
157538
+ EXPORTS_RECONCILIATION_ERROR_CODE = 100402;
157539
+ INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE = 100405;
157540
+ ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE = 100406;
157541
+ WORKFLOW_CRON_REQUIRES_PAID_PLAN_CODE = 10208;
157521
157542
  __name(getZoneForRoute, "getZoneForRoute");
157522
157543
  __name3(getZoneForRoute, "getZoneForRoute");
157523
157544
  __name(getZoneIdFromHost, "getZoneIdFromHost");
@@ -159193,10 +159214,6 @@ Ensure all assets in your assets directory "${dir2}" conform with the Workers ma
159193
159214
  __name3(warnOnErrorUpdatingServiceAndEnvironmentTags, "warnOnErrorUpdatingServiceAndEnvironmentTags");
159194
159215
  __name(tagsAreEqual, "tagsAreEqual");
159195
159216
  __name3(tagsAreEqual, "tagsAreEqual");
159196
- INVALID_INHERIT_BINDING_CODE = 10057;
159197
- EXPORTS_RECONCILIATION_ERROR_CODE = 100402;
159198
- INCONSISTENT_EXPORTS_ACROSS_VERSIONS_CODE = 100405;
159199
- ACTOR_BINDING_DEPENDS_ON_EXPORT_CODE = 100406;
159200
159217
  __name(getMigrationsToUpload, "getMigrationsToUpload");
159201
159218
  __name3(getMigrationsToUpload, "getMigrationsToUpload");
159202
159219
  suppressNotFoundError = /* @__PURE__ */ __name3((err) => {
@@ -166920,7 +166937,7 @@ function directoryContainsAnySkill(dirPath, skillNames) {
166920
166937
  async function computeTelemetryCurrentAgentSkillsInstalled() {
166921
166938
  let agentId = null;
166922
166939
  try {
166923
- const detection = detectAgenticEnvironment(process.env, []);
166940
+ const detection = detectAgenticEnvironment();
166924
166941
  agentId = detection.id;
166925
166942
  } catch {
166926
166943
  return null;
@@ -169118,7 +169135,7 @@ function getMetricsDispatcher(options) {
169118
169135
  let amplitude_event_id = 0;
169119
169136
  let agent = null;
169120
169137
  try {
169121
- const agentDetection = detectAgenticEnvironment(process.env, []);
169138
+ const agentDetection = detectAgenticEnvironment();
169122
169139
  agent = agentDetection.id;
169123
169140
  } catch {
169124
169141
  }
@@ -202716,17 +202733,26 @@ var init_config5 = __esm({
202716
202733
  observability: {
202717
202734
  logs_enabled: config2.observability?.logs?.enabled ?? config2.observability?.enabled === true
202718
202735
  },
202736
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- kept for backward compatibility, falls back to deprecated `wrangler_ssh` when `ssh` is not set
202719
202737
  wrangler_ssh: container.ssh ?? container.wrangler_ssh,
202720
202738
  authorized_keys: container.authorized_keys,
202721
202739
  trusted_user_ca_keys: container.trusted_user_ca_keys
202722
202740
  };
202723
202741
  let instanceTypeOrLimits;
202724
202742
  const MB2 = 1e3 * 1e3;
202725
- if (container.configuration?.disk !== void 0 || container.configuration?.vcpu !== void 0 || container.configuration?.memory_mib !== void 0) {
202743
+ if (
202744
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- kept for backward compatibility, deprecated `configuration` path for custom instance types
202745
+ container.configuration?.disk !== void 0 || // eslint-disable-next-line @typescript-eslint/no-deprecated -- kept for backward compatibility, deprecated `configuration` path for custom instance types
202746
+ container.configuration?.vcpu !== void 0 || // eslint-disable-next-line @typescript-eslint/no-deprecated -- kept for backward compatibility, deprecated `configuration` path for custom instance types
202747
+ container.configuration?.memory_mib !== void 0
202748
+ ) {
202726
202749
  instanceTypeOrLimits = {
202750
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- kept for backward compatibility, deprecated `configuration` path for custom instance types
202727
202751
  disk_bytes: (container.configuration?.disk?.size_mb ?? 2e3) * MB2,
202728
202752
  // defaults to 2GB in bytes
202753
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- kept for backward compatibility, deprecated `configuration` path for custom instance types
202729
202754
  vcpu: container.configuration?.vcpu ?? 0.0625,
202755
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- kept for backward compatibility, deprecated `configuration` path for custom instance types
202730
202756
  memory_mib: container.configuration?.memory_mib ?? 256
202731
202757
  };
202732
202758
  } else if (typeof container.instance_type === "string" || container.instance_type === void 0) {
@@ -208685,6 +208711,7 @@ function collectAllPipelines(args) {
208685
208711
  pipelinesMap.set(pipeline2.binding, {
208686
208712
  binding: pipeline2.binding,
208687
208713
  stream: pipeline2.stream,
208714
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- kept for backward compatibility, falls back to deprecated `pipeline` when `stream` is not set
208688
208715
  pipeline: pipeline2.pipeline
208689
208716
  });
208690
208717
  }
@@ -209476,6 +209503,7 @@ function collectPipelinesPerEnvironment(args) {
209476
209503
  } else if (pipeline2.pipeline) {
209477
209504
  pipelines.push({
209478
209505
  binding: pipeline2.binding,
209506
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- kept for backward compatibility, falls back to deprecated `pipeline` when `stream` is not set
209479
209507
  pipeline: pipeline2.pipeline
209480
209508
  });
209481
209509
  } else {
@@ -217861,11 +217889,12 @@ async function parseFormDataFromFile(file7) {
217861
217889
  const bundle = await fs$1.readFile(file7);
217862
217890
  const firstLine = bundle.findIndex((v7) => v7 === 10);
217863
217891
  const boundary = Uint8Array.prototype.slice.call(bundle, 2, firstLine).toString();
217864
- return await new Response(bundle, {
217892
+ const response = new Response(bundle, {
217865
217893
  headers: {
217866
217894
  "Content-Type": "multipart/form-data; boundary=" + boundary
217867
217895
  }
217868
- }).formData();
217896
+ });
217897
+ return await response.formData();
217869
217898
  }
217870
217899
  async function analyseBundle(workerBundle) {
217871
217900
  if (typeof workerBundle === "string") {
@@ -219331,6 +219360,7 @@ async function handleInteractiveCloudchamberCreateCommand(args, config2, environ
219331
219360
  const selectedLabels = await promptForLabels(labels, [], false);
219332
219361
  const account = await loadAccount();
219333
219362
  const memoryMib = resolveMemory(args, config2.cloudchamber) ?? account.defaults.memory_mib ?? Math.round(
219363
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- kept for backward compatibility, falls back to deprecated `memory` when `memory_mib` is not set
219334
219364
  parseByteSize(account.defaults.memory ?? "2000MiB", 1024) / (1024 * 1024)
219335
219365
  );
219336
219366
  const vcpu = args.vcpu ?? config2.cloudchamber.vcpu ?? account.defaults.vcpus;
@@ -219957,6 +219987,7 @@ function containerAppToCreateApplication(accountId, containerApp, observability,
219957
219987
  );
219958
219988
  const instanceType = containerAppToInstanceType(containerApp);
219959
219989
  const configuration = {
219990
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- kept for backward compatibility, reads deprecated `configuration` from API response
219960
219991
  ...containerApp.configuration,
219961
219992
  ...instanceType,
219962
219993
  observability: observabilityConfiguration
@@ -219975,6 +220006,7 @@ function containerAppToCreateApplication(accountId, containerApp, observability,
219975
220006
  // De-sugar image name
219976
220007
  image: resolveImageName(accountId, configuration.image)
219977
220008
  },
220009
+ // eslint-disable-next-line @typescript-eslint/no-deprecated -- kept for backward compatibility, `instances` is deprecated in favor of `max_instances`
219978
220010
  instances: containerApp.instances ?? 0,
219979
220011
  scheduling_policy: containerApp.scheduling_policy ?? "default" /* DEFAULT */,
219980
220012
  constraints: {
@@ -220050,7 +220082,9 @@ async function apply2(args, config2) {
220050
220082
  if (appConfigNoDefaults.scheduling_policy === void 0) {
220051
220083
  appConfig.scheduling_policy = prevApp.scheduling_policy;
220052
220084
  }
220053
- if (prevApp.durable_objects !== void 0 && appConfigNoDefaults.durable_objects !== void 0 && prevApp.durable_objects.namespace_id !== appConfigNoDefaults.durable_objects.namespace_id) {
220085
+ if (prevApp.durable_objects !== void 0 && // eslint-disable-next-line @typescript-eslint/no-deprecated -- kept for backward compatibility, reads deprecated `durable_objects` from config
220086
+ appConfigNoDefaults.durable_objects !== void 0 && prevApp.durable_objects.namespace_id !== // eslint-disable-next-line @typescript-eslint/no-deprecated -- kept for backward compatibility, reads deprecated `durable_objects` from config
220087
+ appConfigNoDefaults.durable_objects.namespace_id) {
220054
220088
  throw new UserError(
220055
220089
  `Application "${prevApp.name}" is assigned to durable object ${prevApp.durable_objects.namespace_id}, but a new DO namespace is being assigned to the application,
220056
220090
  you should delete the container application and deploy again`,
@@ -233711,8 +233745,9 @@ var init_d12 = __esm({
233711
233745
  // src/utils/add-created-resource-config.ts
233712
233746
  async function createdResourceConfig(resource, snippet, configPath, env7, defaults3) {
233713
233747
  const envString = env7 ? ` in the "${env7}" environment` : "";
233748
+ const resourceName = friendlyBindingNames2[resource];
233714
233749
  logger2.log(
233715
- `To access your new ${friendlyBindingNames2[resource]} in your Worker, add the following snippet to your configuration file${envString}:`
233750
+ `To access your new ${resourceName} in your Worker, add the following snippet to your configuration file${envString}:`
233716
233751
  );
233717
233752
  logger2.log(
233718
233753
  formatConfigSnippet(
@@ -292321,7 +292356,7 @@ async function runDeployCommandHandler(args, {
292321
292356
  config: config2,
292322
292357
  pagesToWorkersDelegation = false
292323
292358
  }) {
292324
- const nameOwnershipUnverified = !config2.configPath && isNonInteractiveOrCI2() && (pagesToWorkersDelegation || !args.name);
292359
+ const nameOwnershipUnverified = !config2.configPath && isNonInteractiveOrCI2() && pagesToWorkersDelegation;
292325
292360
  const autoConfigResult = await maybeRunAutoConfig(args, config2, {
292326
292361
  skipConfirmations: pagesToWorkersDelegation
292327
292362
  });
@@ -302713,10 +302748,10 @@ var init_friendly_validator_errors = __esm({
302713
302748
  // src/utils/detect-agent.ts
302714
302749
  function detectAgent() {
302715
302750
  try {
302716
- const detection = detectAgenticEnvironment(
302717
- process.env,
302718
- NO_PROCESS_ANCESTRY
302719
- );
302751
+ const detection = detectAgenticEnvironment({
302752
+ env: process.env,
302753
+ processAncestry: NO_PROCESS_ANCESTRY
302754
+ });
302720
302755
  return { isAgent: detection.type === "agent", id: detection.id };
302721
302756
  } catch {
302722
302757
  return { isAgent: false, id: null };
@@ -353031,6 +353066,478 @@ Try running with --log-level debug for more information.`;
353031
353066
  });
353032
353067
  }
353033
353068
  });
353069
+
353070
+ // src/turnstile/client.ts
353071
+ async function createWidget(config2, body) {
353072
+ const accountId = await requireAuth(config2);
353073
+ return await fetchResult2(
353074
+ config2,
353075
+ `/accounts/${accountId}/challenges/widgets`,
353076
+ {
353077
+ method: "POST",
353078
+ headers: JSON_HEADERS2,
353079
+ body: JSON.stringify(body)
353080
+ }
353081
+ );
353082
+ }
353083
+ async function getWidget(config2, sitekey) {
353084
+ const accountId = await requireAuth(config2);
353085
+ return await fetchResult2(
353086
+ config2,
353087
+ `/accounts/${accountId}/challenges/widgets/${sitekey}`,
353088
+ {
353089
+ method: "GET"
353090
+ }
353091
+ );
353092
+ }
353093
+ async function listWidgets(config2) {
353094
+ const accountId = await requireAuth(config2);
353095
+ return await fetchPagedListResult2(
353096
+ config2,
353097
+ `/accounts/${accountId}/challenges/widgets`,
353098
+ {
353099
+ method: "GET"
353100
+ }
353101
+ );
353102
+ }
353103
+ async function updateWidget(config2, sitekey, body) {
353104
+ const accountId = await requireAuth(config2);
353105
+ return await fetchResult2(
353106
+ config2,
353107
+ `/accounts/${accountId}/challenges/widgets/${sitekey}`,
353108
+ {
353109
+ method: "PUT",
353110
+ headers: JSON_HEADERS2,
353111
+ body: JSON.stringify(body)
353112
+ }
353113
+ );
353114
+ }
353115
+ async function deleteWidget(config2, sitekey) {
353116
+ const accountId = await requireAuth(config2);
353117
+ return await fetchResult2(
353118
+ config2,
353119
+ `/accounts/${accountId}/challenges/widgets/${sitekey}`,
353120
+ {
353121
+ method: "DELETE"
353122
+ }
353123
+ );
353124
+ }
353125
+ var WidgetModes, ClearanceLevels, WidgetRegions, JSON_HEADERS2;
353126
+ var init_client16 = __esm({
353127
+ "src/turnstile/client.ts"() {
353128
+ init_import_meta_url();
353129
+ init_cfetch();
353130
+ init_user3();
353131
+ WidgetModes = ["managed", "invisible", "non-interactive"];
353132
+ ClearanceLevels = [
353133
+ "no_clearance",
353134
+ "jschallenge",
353135
+ "managed",
353136
+ "interactive"
353137
+ ];
353138
+ WidgetRegions = ["world", "china"];
353139
+ JSON_HEADERS2 = { "Content-Type": "application/json" };
353140
+ __name(createWidget, "createWidget");
353141
+ __name(getWidget, "getWidget");
353142
+ __name(listWidgets, "listWidgets");
353143
+ __name(updateWidget, "updateWidget");
353144
+ __name(deleteWidget, "deleteWidget");
353145
+ }
353146
+ });
353147
+
353148
+ // src/turnstile/index.ts
353149
+ var turnstileNamespace, turnstileWidgetNamespace, splitCsv, sharedWidgetOptions;
353150
+ var init_turnstile2 = __esm({
353151
+ "src/turnstile/index.ts"() {
353152
+ init_import_meta_url();
353153
+ init_create_command();
353154
+ init_client16();
353155
+ turnstileNamespace = createNamespace({
353156
+ metadata: {
353157
+ description: "\u{1F6E1}\uFE0F Manage Turnstile widgets",
353158
+ status: "alpha",
353159
+ owner: "Product: Turnstile",
353160
+ category: "Networking & security"
353161
+ }
353162
+ });
353163
+ turnstileWidgetNamespace = createNamespace({
353164
+ metadata: {
353165
+ description: "Manage Turnstile widgets",
353166
+ status: "alpha",
353167
+ owner: "Product: Turnstile"
353168
+ }
353169
+ });
353170
+ splitCsv = /* @__PURE__ */ __name((values) => values.flatMap(
353171
+ (v7) => String(v7).split(",").map((s7) => s7.trim())
353172
+ ).filter(Boolean), "splitCsv");
353173
+ sharedWidgetOptions = /* @__PURE__ */ __name((options) => ({
353174
+ domain: {
353175
+ alias: "domains",
353176
+ type: "string",
353177
+ array: true,
353178
+ demandOption: options.required,
353179
+ coerce: splitCsv,
353180
+ description: "Allowed hostnames for this widget. Pass multiple times or comma-separate, e.g. --domain example.com --domain www.example.com."
353181
+ },
353182
+ mode: {
353183
+ type: "string",
353184
+ choices: WidgetModes,
353185
+ demandOption: options.required,
353186
+ description: "Widget mode"
353187
+ },
353188
+ "clearance-level": {
353189
+ type: "string",
353190
+ choices: ClearanceLevels,
353191
+ description: "Challenge clearance level granted when this widget is embedded on a Cloudflare site"
353192
+ },
353193
+ "bot-fight-mode": {
353194
+ type: "boolean",
353195
+ description: "Issue computationally expensive challenges in response to malicious bots (Enterprise only)"
353196
+ },
353197
+ "ephemeral-id": {
353198
+ type: "boolean",
353199
+ description: "Return the Ephemeral ID in /siteverify responses (Enterprise only)"
353200
+ },
353201
+ offlabel: {
353202
+ type: "boolean",
353203
+ description: "Do not show any Cloudflare branding on the widget (Enterprise only)"
353204
+ }
353205
+ }), "sharedWidgetOptions");
353206
+ }
353207
+ });
353208
+
353209
+ // src/turnstile/create.ts
353210
+ var turnstileWidgetCreateCommand;
353211
+ var init_create20 = __esm({
353212
+ "src/turnstile/create.ts"() {
353213
+ init_import_meta_url();
353214
+ init_create_command();
353215
+ init_is_interactive();
353216
+ init_logger();
353217
+ init_client16();
353218
+ init_turnstile2();
353219
+ turnstileWidgetCreateCommand = createCommand({
353220
+ metadata: {
353221
+ description: "Create a Turnstile widget",
353222
+ status: "alpha",
353223
+ owner: "Product: Turnstile"
353224
+ },
353225
+ behaviour: {
353226
+ supportTemporary: true,
353227
+ printBanner: /* @__PURE__ */ __name((args) => !args.json && !isNonInteractiveOrCI2(), "printBanner")
353228
+ },
353229
+ args: {
353230
+ name: {
353231
+ type: "string",
353232
+ demandOption: true,
353233
+ description: "Human-readable widget name"
353234
+ },
353235
+ ...sharedWidgetOptions({ required: true }),
353236
+ region: {
353237
+ type: "string",
353238
+ choices: WidgetRegions,
353239
+ description: "Region where this widget can be used. Cannot be changed after creation."
353240
+ },
353241
+ json: {
353242
+ type: "boolean",
353243
+ default: false,
353244
+ description: "Print the created widget as JSON only"
353245
+ }
353246
+ },
353247
+ positionalArgs: ["name"],
353248
+ async handler(args, { config: config2 }) {
353249
+ const widget = await createWidget(config2, {
353250
+ name: args.name,
353251
+ domains: args.domain,
353252
+ mode: args.mode,
353253
+ bot_fight_mode: args.botFightMode,
353254
+ clearance_level: args.clearanceLevel,
353255
+ ephemeral_id: args.ephemeralId,
353256
+ offlabel: args.offlabel,
353257
+ region: args.region
353258
+ });
353259
+ if (args.json) {
353260
+ logger2.log(JSON.stringify(widget, null, 2));
353261
+ return;
353262
+ }
353263
+ logger2.log(`\u2705 Created Turnstile widget '${widget.name}'`);
353264
+ logger2.log(` sitekey: ${widget.sitekey}`);
353265
+ logger2.log(` secret: ${widget.secret}`);
353266
+ logger2.log("");
353267
+ logger2.log(
353268
+ "The sitekey is public; embed it in your frontend. The secret must stay on your backend and is used for siteverify:"
353269
+ );
353270
+ logger2.log(
353271
+ " POST https://challenges.cloudflare.com/turnstile/v0/siteverify"
353272
+ );
353273
+ logger2.log(' { secret: "<secret>", response: "<turnstile-token>" }');
353274
+ logger2.log("");
353275
+ logger2.log(
353276
+ `To retrieve the secret later: \`wrangler turnstile widget get ${widget.sitekey}\`. It's redacted from \`list\` and \`update\` output but always available via \`get\`.`
353277
+ );
353278
+ }
353279
+ });
353280
+ }
353281
+ });
353282
+
353283
+ // src/turnstile/delete.ts
353284
+ var turnstileWidgetDeleteCommand;
353285
+ var init_delete19 = __esm({
353286
+ "src/turnstile/delete.ts"() {
353287
+ init_import_meta_url();
353288
+ init_dist();
353289
+ init_create_command();
353290
+ init_dialogs();
353291
+ init_is_interactive();
353292
+ init_logger();
353293
+ init_client16();
353294
+ turnstileWidgetDeleteCommand = createCommand({
353295
+ metadata: {
353296
+ description: "Delete a Turnstile widget",
353297
+ status: "alpha",
353298
+ owner: "Product: Turnstile"
353299
+ },
353300
+ behaviour: {
353301
+ supportTemporary: true,
353302
+ printBanner: /* @__PURE__ */ __name((args) => !args.json && !isNonInteractiveOrCI2(), "printBanner")
353303
+ },
353304
+ args: {
353305
+ sitekey: {
353306
+ type: "string",
353307
+ demandOption: true,
353308
+ description: "The sitekey of the widget"
353309
+ },
353310
+ "skip-confirmation": {
353311
+ type: "boolean",
353312
+ alias: "y",
353313
+ default: false,
353314
+ description: "Skip confirmation prompt"
353315
+ },
353316
+ json: {
353317
+ type: "boolean",
353318
+ default: false,
353319
+ description: "Return output as JSON. Requires --skip-confirmation."
353320
+ }
353321
+ },
353322
+ positionalArgs: ["sitekey"],
353323
+ async handler({ sitekey, skipConfirmation, json: json2 }, { config: config2 }) {
353324
+ if (json2 && !skipConfirmation) {
353325
+ throw new JsonFriendlyFatalError(
353326
+ JSON.stringify({
353327
+ error: "Pass --skip-confirmation (-y) to skip the confirmation prompt when using --json."
353328
+ }),
353329
+ { telemetryMessage: "turnstile widget delete json requires skip" }
353330
+ );
353331
+ }
353332
+ if (!skipConfirmation) {
353333
+ const proceed = await confirm2(
353334
+ `About to delete Turnstile widget ${sitekey}. This breaks any deployed Worker still using the widget's sitekey or secret. Continue?`,
353335
+ { defaultValue: false, fallbackValue: false }
353336
+ );
353337
+ if (!proceed) {
353338
+ logger2.log("Deletion cancelled.");
353339
+ return;
353340
+ }
353341
+ }
353342
+ await deleteWidget(config2, sitekey);
353343
+ if (json2) {
353344
+ logger2.log(JSON.stringify({ sitekey, success: true }, null, 2));
353345
+ return;
353346
+ }
353347
+ logger2.log(`\u2705 Deleted Turnstile widget ${sitekey}`);
353348
+ }
353349
+ });
353350
+ }
353351
+ });
353352
+
353353
+ // src/turnstile/get.ts
353354
+ function formatWidget(widget) {
353355
+ const rows = [
353356
+ ["Sitekey", widget.sitekey],
353357
+ ["Name", widget.name],
353358
+ ["Mode", widget.mode],
353359
+ ["Domains", widget.domains.join(", ")],
353360
+ ["Clearance level", widget.clearance_level],
353361
+ ["Bot fight mode", widget.bot_fight_mode ? "yes" : "no"],
353362
+ ["Region", widget.region],
353363
+ ["Off-label", widget.offlabel ? "yes" : "no"],
353364
+ ["Ephemeral ID", widget.ephemeral_id ? "yes" : "no"],
353365
+ ["Secret", widget.secret],
353366
+ ["Created", widget.created_on],
353367
+ ["Modified", widget.modified_on]
353368
+ ];
353369
+ const widest = Math.max(...rows.map(([k6]) => k6.length));
353370
+ return rows.map(([k6, v7]) => ` ${k6.padEnd(widest)} ${v7}`).join("\n");
353371
+ }
353372
+ var turnstileWidgetGetCommand;
353373
+ var init_get14 = __esm({
353374
+ "src/turnstile/get.ts"() {
353375
+ init_import_meta_url();
353376
+ init_create_command();
353377
+ init_is_interactive();
353378
+ init_logger();
353379
+ init_client16();
353380
+ __name(formatWidget, "formatWidget");
353381
+ turnstileWidgetGetCommand = createCommand({
353382
+ metadata: {
353383
+ description: "Get a Turnstile widget",
353384
+ status: "alpha",
353385
+ owner: "Product: Turnstile"
353386
+ },
353387
+ behaviour: {
353388
+ supportTemporary: true,
353389
+ printBanner: /* @__PURE__ */ __name((args) => !args.json && !isNonInteractiveOrCI2(), "printBanner")
353390
+ },
353391
+ args: {
353392
+ sitekey: {
353393
+ type: "string",
353394
+ demandOption: true,
353395
+ description: "The sitekey of the widget"
353396
+ },
353397
+ json: {
353398
+ type: "boolean",
353399
+ default: false,
353400
+ description: "Print the widget as JSON instead of a formatted view"
353401
+ }
353402
+ },
353403
+ positionalArgs: ["sitekey"],
353404
+ async handler(args, { config: config2 }) {
353405
+ const widget = await getWidget(config2, args.sitekey);
353406
+ if (args.json) {
353407
+ logger2.log(JSON.stringify(widget, null, 2));
353408
+ return;
353409
+ }
353410
+ logger2.log(formatWidget(widget));
353411
+ }
353412
+ });
353413
+ }
353414
+ });
353415
+
353416
+ // src/turnstile/list.ts
353417
+ function widgetRowForTable(widget) {
353418
+ return {
353419
+ sitekey: widget.sitekey,
353420
+ name: widget.name,
353421
+ mode: widget.mode,
353422
+ domains: widget.domains.join(", "),
353423
+ clearance_level: widget.clearance_level,
353424
+ bot_fight_mode: widget.bot_fight_mode ? "yes" : "no",
353425
+ region: widget.region,
353426
+ created_on: widget.created_on
353427
+ };
353428
+ }
353429
+ var turnstileWidgetListCommand;
353430
+ var init_list27 = __esm({
353431
+ "src/turnstile/list.ts"() {
353432
+ init_import_meta_url();
353433
+ init_create_command();
353434
+ init_is_interactive();
353435
+ init_logger();
353436
+ init_client16();
353437
+ __name(widgetRowForTable, "widgetRowForTable");
353438
+ turnstileWidgetListCommand = createCommand({
353439
+ metadata: {
353440
+ description: "List Turnstile widgets",
353441
+ status: "alpha",
353442
+ owner: "Product: Turnstile"
353443
+ },
353444
+ behaviour: {
353445
+ supportTemporary: true,
353446
+ printBanner: /* @__PURE__ */ __name((args) => !args.json && !isNonInteractiveOrCI2(), "printBanner")
353447
+ },
353448
+ args: {
353449
+ json: {
353450
+ type: "boolean",
353451
+ default: false,
353452
+ description: "Print widgets as JSON instead of a table"
353453
+ }
353454
+ },
353455
+ async handler(args, { config: config2 }) {
353456
+ const widgets = await listWidgets(config2);
353457
+ if (args.json) {
353458
+ logger2.log(JSON.stringify(widgets, null, 2));
353459
+ return;
353460
+ }
353461
+ if (widgets.length === 0) {
353462
+ logger2.log("No Turnstile widgets found.");
353463
+ return;
353464
+ }
353465
+ const label = widgets.length === 1 ? "widget" : "widgets";
353466
+ logger2.log(`Found ${widgets.length} ${label}:`);
353467
+ logger2.table(widgets.map(widgetRowForTable));
353468
+ }
353469
+ });
353470
+ }
353471
+ });
353472
+
353473
+ // src/turnstile/update.ts
353474
+ var turnstileWidgetUpdateCommand;
353475
+ var init_update11 = __esm({
353476
+ "src/turnstile/update.ts"() {
353477
+ init_import_meta_url();
353478
+ init_dist();
353479
+ init_create_command();
353480
+ init_is_interactive();
353481
+ init_logger();
353482
+ init_client16();
353483
+ init_turnstile2();
353484
+ turnstileWidgetUpdateCommand = createCommand({
353485
+ metadata: {
353486
+ description: "Update a Turnstile widget",
353487
+ status: "alpha",
353488
+ owner: "Product: Turnstile"
353489
+ },
353490
+ behaviour: {
353491
+ supportTemporary: true,
353492
+ printBanner: /* @__PURE__ */ __name((args) => !args.json && !isNonInteractiveOrCI2(), "printBanner")
353493
+ },
353494
+ args: {
353495
+ sitekey: {
353496
+ type: "string",
353497
+ demandOption: true,
353498
+ description: "The sitekey of the widget"
353499
+ },
353500
+ name: {
353501
+ type: "string",
353502
+ description: "New human-readable name for the widget"
353503
+ },
353504
+ ...sharedWidgetOptions({ required: false }),
353505
+ json: {
353506
+ type: "boolean",
353507
+ default: false,
353508
+ description: "Print the updated widget as JSON only"
353509
+ }
353510
+ },
353511
+ positionalArgs: ["sitekey"],
353512
+ async handler(args, { config: config2 }) {
353513
+ const hasChanges = args.name !== void 0 || args.domain !== void 0 || args.mode !== void 0 || args.botFightMode !== void 0 || args.clearanceLevel !== void 0 || args.ephemeralId !== void 0 || args.offlabel !== void 0;
353514
+ if (!hasChanges) {
353515
+ throw new UserError(
353516
+ "No fields to update. Pass at least one of --name, --domain, --mode, --clearance-level, --bot-fight-mode, --ephemeral-id, --offlabel.",
353517
+ { telemetryMessage: "turnstile widget update no fields" }
353518
+ );
353519
+ }
353520
+ const current = await getWidget(config2, args.sitekey);
353521
+ const updated = await updateWidget(config2, args.sitekey, {
353522
+ name: args.name ?? current.name,
353523
+ domains: args.domain ?? current.domains,
353524
+ mode: args.mode ?? current.mode,
353525
+ bot_fight_mode: args.botFightMode ?? current.bot_fight_mode,
353526
+ clearance_level: args.clearanceLevel ?? current.clearance_level,
353527
+ ephemeral_id: args.ephemeralId ?? current.ephemeral_id,
353528
+ offlabel: args.offlabel ?? current.offlabel
353529
+ });
353530
+ const { secret: _secret, ...withoutSecret } = updated;
353531
+ if (args.json) {
353532
+ logger2.log(JSON.stringify(withoutSecret, null, 2));
353533
+ return;
353534
+ }
353535
+ logger2.log(`\u2705 Updated Turnstile widget ${updated.sitekey}`);
353536
+ logger2.log(JSON.stringify(withoutSecret, null, 2));
353537
+ }
353538
+ });
353539
+ }
353540
+ });
353034
353541
  function describeProfile(profile) {
353035
353542
  return profile ?? "default";
353036
353543
  }
@@ -354231,7 +354738,7 @@ async function listVectors(config2, indexName, options) {
354231
354738
  });
354232
354739
  }
354233
354740
  var jsonContentType2;
354234
- var init_client16 = __esm({
354741
+ var init_client17 = __esm({
354235
354742
  "src/vectorize/client.ts"() {
354236
354743
  init_import_meta_url();
354237
354744
  init_cfetch();
@@ -354300,7 +354807,7 @@ var init_common3 = __esm({
354300
354807
 
354301
354808
  // src/vectorize/create.ts
354302
354809
  var vectorizeCreateCommand;
354303
- var init_create20 = __esm({
354810
+ var init_create21 = __esm({
354304
354811
  "src/vectorize/create.ts"() {
354305
354812
  init_import_meta_url();
354306
354813
  init_dist();
@@ -354308,7 +354815,7 @@ var init_create20 = __esm({
354308
354815
  init_logger();
354309
354816
  init_add_created_resource_config();
354310
354817
  init_getValidBindingName();
354311
- init_client16();
354818
+ init_client17();
354312
354819
  init_common3();
354313
354820
  vectorizeCreateCommand = createCommand({
354314
354821
  metadata: {
@@ -354432,7 +354939,7 @@ var init_createMetadataIndex = __esm({
354432
354939
  init_import_meta_url();
354433
354940
  init_create_command();
354434
354941
  init_logger();
354435
- init_client16();
354942
+ init_client17();
354436
354943
  vectorizeCreateMetadataIndexCommand = createCommand({
354437
354944
  metadata: {
354438
354945
  description: "Enable metadata filtering on the specified property",
@@ -354475,13 +354982,13 @@ var init_createMetadataIndex = __esm({
354475
354982
 
354476
354983
  // src/vectorize/delete.ts
354477
354984
  var vectorizeDeleteCommand;
354478
- var init_delete19 = __esm({
354985
+ var init_delete20 = __esm({
354479
354986
  "src/vectorize/delete.ts"() {
354480
354987
  init_import_meta_url();
354481
354988
  init_create_command();
354482
354989
  init_dialogs();
354483
354990
  init_logger();
354484
- init_client16();
354991
+ init_client17();
354485
354992
  init_common3();
354486
354993
  vectorizeDeleteCommand = createCommand({
354487
354994
  metadata: {
@@ -354538,7 +355045,7 @@ var init_deleteByIds = __esm({
354538
355045
  init_dist();
354539
355046
  init_create_command();
354540
355047
  init_logger();
354541
- init_client16();
355048
+ init_client17();
354542
355049
  vectorizeDeleteVectorsCommand = createCommand({
354543
355050
  metadata: {
354544
355051
  description: "Delete vectors in a Vectorize index",
@@ -354586,7 +355093,7 @@ var init_deleteMetadataIndex = __esm({
354586
355093
  init_import_meta_url();
354587
355094
  init_create_command();
354588
355095
  init_logger();
354589
- init_client16();
355096
+ init_client17();
354590
355097
  vectorizeDeleteMetadataIndexCommand = createCommand({
354591
355098
  metadata: {
354592
355099
  description: "Delete metadata indexes",
@@ -354622,12 +355129,12 @@ var init_deleteMetadataIndex = __esm({
354622
355129
 
354623
355130
  // src/vectorize/get.ts
354624
355131
  var vectorizeGetCommand;
354625
- var init_get14 = __esm({
355132
+ var init_get15 = __esm({
354626
355133
  "src/vectorize/get.ts"() {
354627
355134
  init_import_meta_url();
354628
355135
  init_create_command();
354629
355136
  init_logger();
354630
- init_client16();
355137
+ init_client17();
354631
355138
  init_common3();
354632
355139
  vectorizeGetCommand = createCommand({
354633
355140
  metadata: {
@@ -354685,7 +355192,7 @@ var init_getByIds = __esm({
354685
355192
  init_dist();
354686
355193
  init_create_command();
354687
355194
  init_logger();
354688
- init_client16();
355195
+ init_client17();
354689
355196
  vectorizeGetVectorsCommand = createCommand({
354690
355197
  metadata: {
354691
355198
  description: "Get vectors from a Vectorize index",
@@ -354753,7 +355260,7 @@ var init_info5 = __esm({
354753
355260
  init_import_meta_url();
354754
355261
  init_create_command();
354755
355262
  init_logger();
354756
- init_client16();
355263
+ init_client17();
354757
355264
  vectorizeInfoCommand = createCommand({
354758
355265
  metadata: {
354759
355266
  description: "Get additional details about the index",
@@ -354805,7 +355312,7 @@ var init_insert = __esm({
354805
355312
  import_undici21 = __toESM(require_undici());
354806
355313
  init_create_command();
354807
355314
  init_logger();
354808
- init_client16();
355315
+ init_client17();
354809
355316
  init_common3();
354810
355317
  vectorizeInsertCommand = createCommand({
354811
355318
  metadata: {
@@ -354919,12 +355426,12 @@ var init_insert = __esm({
354919
355426
 
354920
355427
  // src/vectorize/list.ts
354921
355428
  var vectorizeListCommand;
354922
- var init_list27 = __esm({
355429
+ var init_list28 = __esm({
354923
355430
  "src/vectorize/list.ts"() {
354924
355431
  init_import_meta_url();
354925
355432
  init_create_command();
354926
355433
  init_logger();
354927
- init_client16();
355434
+ init_client17();
354928
355435
  init_common3();
354929
355436
  vectorizeListCommand = createCommand({
354930
355437
  metadata: {
@@ -354987,7 +355494,7 @@ var init_listMetadataIndex = __esm({
354987
355494
  init_import_meta_url();
354988
355495
  init_create_command();
354989
355496
  init_logger();
354990
- init_client16();
355497
+ init_client17();
354991
355498
  vectorizeListMetadataIndexCommand = createCommand({
354992
355499
  metadata: {
354993
355500
  description: "List metadata properties on which metadata filtering is enabled",
@@ -355046,7 +355553,7 @@ var init_listVectors = __esm({
355046
355553
  init_import_meta_url();
355047
355554
  init_create_command();
355048
355555
  init_logger();
355049
- init_client16();
355556
+ init_client17();
355050
355557
  vectorizeListVectorsCommand = createCommand({
355051
355558
  metadata: {
355052
355559
  description: "List vector identifiers in a Vectorize index",
@@ -355199,7 +355706,7 @@ var init_query = __esm({
355199
355706
  init_dist();
355200
355707
  init_create_command();
355201
355708
  init_logger();
355202
- init_client16();
355709
+ init_client17();
355203
355710
  vectorizeQueryCommand = createCommand({
355204
355711
  metadata: {
355205
355712
  description: "Query a Vectorize index",
@@ -355334,7 +355841,7 @@ var init_upsert = __esm({
355334
355841
  import_undici22 = __toESM(require_undici());
355335
355842
  init_create_command();
355336
355843
  init_logger();
355337
- init_client16();
355844
+ init_client17();
355338
355845
  init_common3();
355339
355846
  vectorizeUpsertCommand = createCommand({
355340
355847
  metadata: {
@@ -356145,7 +356652,7 @@ function formatTrigger(trigger) {
356145
356652
  }
356146
356653
  }
356147
356654
  var BLANK_INPUT3, VERSION_LIST_LIMIT, versionsListCommand;
356148
- var init_list28 = __esm({
356655
+ var init_list29 = __esm({
356149
356656
  "src/versions/list.ts"() {
356150
356657
  init_import_meta_url();
356151
356658
  init_dist6();
@@ -356230,7 +356737,7 @@ function getDeploymentSource(deployment) {
356230
356737
  });
356231
356738
  }
356232
356739
  var BLANK_INPUT4, deploymentsListCommand;
356233
- var init_list29 = __esm({
356740
+ var init_list30 = __esm({
356234
356741
  "src/versions/deployments/list.ts"() {
356235
356742
  init_import_meta_url();
356236
356743
  init_dist6();
@@ -356241,7 +356748,7 @@ var init_list29 = __esm({
356241
356748
  init_user3();
356242
356749
  init_render_labelled_values();
356243
356750
  init_api2();
356244
- init_list28();
356751
+ init_list29();
356245
356752
  BLANK_INPUT4 = "-";
356246
356753
  deploymentsListCommand = createCommand({
356247
356754
  metadata: {
@@ -356348,7 +356855,7 @@ var init_status3 = __esm({
356348
356855
  init_user3();
356349
356856
  init_render_labelled_values();
356350
356857
  init_api2();
356351
- init_list29();
356858
+ init_list30();
356352
356859
  BLANK_INPUT5 = "-";
356353
356860
  deploymentsStatusCommand = createCommand({
356354
356861
  metadata: {
@@ -356969,7 +357476,7 @@ var init_bulk3 = __esm({
356969
357476
 
356970
357477
  // src/versions/secrets/delete.ts
356971
357478
  var versionsSecretDeleteCommand;
356972
- var init_delete20 = __esm({
357479
+ var init_delete21 = __esm({
356973
357480
  "src/versions/secrets/delete.ts"() {
356974
357481
  init_import_meta_url();
356975
357482
  init_dist();
@@ -357085,7 +357592,7 @@ var init_delete20 = __esm({
357085
357592
 
357086
357593
  // src/versions/secrets/list.ts
357087
357594
  var versionsSecretsListCommand;
357088
- var init_list30 = __esm({
357595
+ var init_list31 = __esm({
357089
357596
  "src/versions/secrets/list.ts"() {
357090
357597
  init_import_meta_url();
357091
357598
  init_dist();
@@ -357405,7 +357912,7 @@ var init_view3 = __esm({
357405
357912
  init_print_bindings();
357406
357913
  init_render_labelled_values();
357407
357914
  init_api2();
357408
- init_list28();
357915
+ init_list29();
357409
357916
  BLANK_INPUT6 = "-";
357410
357917
  versionsViewCommand = createCommand({
357411
357918
  metadata: {
@@ -357566,7 +358073,7 @@ async function updateService(config2, serviceId, body) {
357566
358073
  }
357567
358074
  );
357568
358075
  }
357569
- var init_client17 = __esm({
358076
+ var init_client18 = __esm({
357570
358077
  "src/vpc/client.ts"() {
357571
358078
  init_import_meta_url();
357572
358079
  init_cfetch();
@@ -357969,12 +358476,12 @@ var init_validation2 = __esm({
357969
358476
 
357970
358477
  // src/vpc/create.ts
357971
358478
  var vpcServiceCreateCommand;
357972
- var init_create21 = __esm({
358479
+ var init_create22 = __esm({
357973
358480
  "src/vpc/create.ts"() {
357974
358481
  init_import_meta_url();
357975
358482
  init_create_command();
357976
358483
  init_logger();
357977
- init_client17();
358484
+ init_client18();
357978
358485
  init_shared9();
357979
358486
  init_validation2();
357980
358487
  init_vpc();
@@ -358005,12 +358512,12 @@ var init_create21 = __esm({
358005
358512
 
358006
358513
  // src/vpc/delete.ts
358007
358514
  var vpcServiceDeleteCommand;
358008
- var init_delete21 = __esm({
358515
+ var init_delete22 = __esm({
358009
358516
  "src/vpc/delete.ts"() {
358010
358517
  init_import_meta_url();
358011
358518
  init_create_command();
358012
358519
  init_logger();
358013
- init_client17();
358520
+ init_client18();
358014
358521
  vpcServiceDeleteCommand = createCommand({
358015
358522
  metadata: {
358016
358523
  description: "Delete a VPC service",
@@ -358036,12 +358543,12 @@ var init_delete21 = __esm({
358036
358543
 
358037
358544
  // src/vpc/get.ts
358038
358545
  var vpcServiceGetCommand;
358039
- var init_get15 = __esm({
358546
+ var init_get16 = __esm({
358040
358547
  "src/vpc/get.ts"() {
358041
358548
  init_import_meta_url();
358042
358549
  init_create_command();
358043
358550
  init_logger();
358044
- init_client17();
358551
+ init_client18();
358045
358552
  init_shared9();
358046
358553
  vpcServiceGetCommand = createCommand({
358047
358554
  metadata: {
@@ -358071,12 +358578,12 @@ var init_get15 = __esm({
358071
358578
 
358072
358579
  // src/vpc/list.ts
358073
358580
  var vpcServiceListCommand;
358074
- var init_list31 = __esm({
358581
+ var init_list32 = __esm({
358075
358582
  "src/vpc/list.ts"() {
358076
358583
  init_import_meta_url();
358077
358584
  init_create_command();
358078
358585
  init_logger();
358079
- init_client17();
358586
+ init_client18();
358080
358587
  init_shared9();
358081
358588
  vpcServiceListCommand = createCommand({
358082
358589
  metadata: {
@@ -358100,12 +358607,12 @@ var init_list31 = __esm({
358100
358607
 
358101
358608
  // src/vpc/update.ts
358102
358609
  var vpcServiceUpdateCommand;
358103
- var init_update11 = __esm({
358610
+ var init_update12 = __esm({
358104
358611
  "src/vpc/update.ts"() {
358105
358612
  init_import_meta_url();
358106
358613
  init_create_command();
358107
358614
  init_logger();
358108
- init_client17();
358615
+ init_client18();
358109
358616
  init_shared9();
358110
358617
  init_validation2();
358111
358618
  init_vpc();
@@ -358170,7 +358677,7 @@ async function search(config2, body) {
358170
358677
  );
358171
358678
  }
358172
358679
  var jsonContentType3;
358173
- var init_client18 = __esm({
358680
+ var init_client19 = __esm({
358174
358681
  "src/websearch/client.ts"() {
358175
358682
  init_import_meta_url();
358176
358683
  init_cfetch();
@@ -358187,7 +358694,7 @@ var init_search3 = __esm({
358187
358694
  init_import_meta_url();
358188
358695
  init_create_command();
358189
358696
  init_logger();
358190
- init_client18();
358697
+ init_client19();
358191
358698
  websearchSearchCommand = createCommand({
358192
358699
  metadata: {
358193
358700
  description: "Run a query against Cloudflare Web Search",
@@ -358319,8 +358826,12 @@ async function getLocalInstanceIdFromArgs(port, args) {
358319
358826
  }
358320
358827
  return id;
358321
358828
  }
358322
- async function updateLocalInstanceStatus(port, workflowName, instanceId, action, from) {
358323
- const body = from ? { action, from } : { action };
358829
+ async function updateLocalInstanceStatus(port, workflowName, instanceId, action, from, rollback) {
358830
+ const body = {
358831
+ action,
358832
+ ...from ? { from } : {},
358833
+ ...action === "terminate" && rollback === true ? { rollback: true } : {}
358834
+ };
358324
358835
  await fetchLocalResult(
358325
358836
  port,
358326
358837
  `/workflows/${encodeURIComponent(workflowName)}/instances/${encodeURIComponent(instanceId)}/status`,
@@ -358359,7 +358870,7 @@ var init_local = __esm({
358359
358870
 
358360
358871
  // src/workflows/commands/delete.ts
358361
358872
  var workflowsDeleteCommand;
358362
- var init_delete22 = __esm({
358873
+ var init_delete23 = __esm({
358363
358874
  "src/workflows/commands/delete.ts"() {
358364
358875
  init_import_meta_url();
358365
358876
  init_cfetch();
@@ -358535,8 +359046,12 @@ async function getInstanceIdFromArgs(accountId, args, config2) {
358535
359046
  }
358536
359047
  return id;
358537
359048
  }
358538
- async function updateInstanceStatus(config2, accountId, workflowName, instanceId, status2, from) {
358539
- const body = from ? { status: status2, from } : { status: status2 };
359049
+ async function updateInstanceStatus(config2, accountId, workflowName, instanceId, status2, from, rollback) {
359050
+ const body = {
359051
+ status: status2,
359052
+ ...from ? { from } : {},
359053
+ ...status2 === "terminate" && rollback === true ? { rollback: true } : {}
359054
+ };
358540
359055
  await fetchResult2(
358541
359056
  config2,
358542
359057
  `/accounts/${accountId}/workflows/${workflowName}/instances/${instanceId}/status`,
@@ -358864,7 +359379,7 @@ var init_describe2 = __esm({
358864
359379
 
358865
359380
  // src/workflows/commands/instances/list.ts
358866
359381
  var workflowsInstancesListCommand;
358867
- var init_list32 = __esm({
359382
+ var init_list33 = __esm({
358868
359383
  "src/workflows/commands/instances/list.ts"() {
358869
359384
  init_import_meta_url();
358870
359385
  init_cfetch();
@@ -359306,17 +359821,37 @@ var init_terminate = __esm({
359306
359821
  describe: "ID of the instance - instead of an UUID you can type 'latest' to get the latest instance and describe it",
359307
359822
  type: "string",
359308
359823
  demandOption: true
359824
+ },
359825
+ rollback: {
359826
+ describe: "Run registered rollback handlers before terminating",
359827
+ type: "boolean",
359828
+ default: false
359309
359829
  }
359310
359830
  },
359311
359831
  async handler(args, { config: config2 }) {
359312
359832
  let id;
359313
359833
  if (args.local) {
359314
359834
  id = await getLocalInstanceIdFromArgs(args.port, args);
359315
- await updateLocalInstanceStatus(args.port, args.name, id, "terminate");
359835
+ await updateLocalInstanceStatus(
359836
+ args.port,
359837
+ args.name,
359838
+ id,
359839
+ "terminate",
359840
+ void 0,
359841
+ args.rollback
359842
+ );
359316
359843
  } else {
359317
359844
  const accountId = await requireAuth(config2);
359318
359845
  id = await getInstanceIdFromArgs(accountId, args, config2);
359319
- await updateInstanceStatus(config2, accountId, args.name, id, "terminate");
359846
+ await updateInstanceStatus(
359847
+ config2,
359848
+ accountId,
359849
+ args.name,
359850
+ id,
359851
+ "terminate",
359852
+ void 0,
359853
+ args.rollback
359854
+ );
359320
359855
  }
359321
359856
  logger2.info(
359322
359857
  `\u{1F977} The instance "${id}" from ${args.name} was terminated successfully`
@@ -359399,7 +359934,7 @@ var init_terminate_all = __esm({
359399
359934
 
359400
359935
  // src/workflows/commands/list.ts
359401
359936
  var workflowsListCommand;
359402
- var init_list33 = __esm({
359937
+ var init_list34 = __esm({
359403
359938
  "src/workflows/commands/list.ts"() {
359404
359939
  init_import_meta_url();
359405
359940
  init_cfetch();
@@ -360577,6 +361112,34 @@ function createCLIParser(argv) {
360577
361112
  }
360578
361113
  ]);
360579
361114
  registry2.registerNamespace("flagship");
361115
+ registry2.define([
361116
+ { command: "wrangler turnstile", definition: turnstileNamespace },
361117
+ {
361118
+ command: "wrangler turnstile widget",
361119
+ definition: turnstileWidgetNamespace
361120
+ },
361121
+ {
361122
+ command: "wrangler turnstile widget create",
361123
+ definition: turnstileWidgetCreateCommand
361124
+ },
361125
+ {
361126
+ command: "wrangler turnstile widget delete",
361127
+ definition: turnstileWidgetDeleteCommand
361128
+ },
361129
+ {
361130
+ command: "wrangler turnstile widget get",
361131
+ definition: turnstileWidgetGetCommand
361132
+ },
361133
+ {
361134
+ command: "wrangler turnstile widget list",
361135
+ definition: turnstileWidgetListCommand
361136
+ },
361137
+ {
361138
+ command: "wrangler turnstile widget update",
361139
+ definition: turnstileWidgetUpdateCommand
361140
+ }
361141
+ ]);
361142
+ registry2.registerNamespace("turnstile");
360580
361143
  registry2.define([
360581
361144
  { command: "wrangler tunnel", definition: tunnelNamespace },
360582
361145
  {
@@ -361753,22 +362316,28 @@ var init_src2 = __esm({
361753
362316
  init_list26();
361754
362317
  init_quick_start();
361755
362318
  init_run();
362319
+ init_create20();
362320
+ init_delete19();
362321
+ init_get14();
362322
+ init_turnstile2();
362323
+ init_list27();
362324
+ init_update11();
361756
362325
  init_type_generation();
361757
362326
  init_commands10();
361758
362327
  init_profiles3();
361759
362328
  init_constants5();
361760
362329
  init_log_file();
361761
- init_create20();
362330
+ init_create21();
361762
362331
  init_createMetadataIndex();
361763
- init_delete19();
362332
+ init_delete20();
361764
362333
  init_deleteByIds();
361765
362334
  init_deleteMetadataIndex();
361766
- init_get14();
362335
+ init_get15();
361767
362336
  init_getByIds();
361768
362337
  init_vectorize2();
361769
362338
  init_info5();
361770
362339
  init_insert();
361771
- init_list27();
362340
+ init_list28();
361772
362341
  init_listMetadataIndex();
361773
362342
  init_listVectors();
361774
362343
  init_query();
@@ -361776,38 +362345,38 @@ var init_src2 = __esm({
361776
362345
  init_versions8();
361777
362346
  init_deploy5();
361778
362347
  init_deployments5();
361779
- init_list29();
362348
+ init_list30();
361780
362349
  init_status3();
361781
362350
  init_view2();
361782
- init_list28();
362351
+ init_list29();
361783
362352
  init_rollback();
361784
362353
  init_secrets4();
361785
362354
  init_bulk3();
361786
- init_delete20();
361787
- init_list30();
362355
+ init_delete21();
362356
+ init_list31();
361788
362357
  init_put();
361789
362358
  init_upload5();
361790
362359
  init_view3();
361791
- init_create21();
361792
- init_delete21();
361793
- init_get15();
362360
+ init_create22();
362361
+ init_delete22();
362362
+ init_get16();
361794
362363
  init_vpc();
361795
- init_list31();
361796
- init_update11();
362364
+ init_list32();
362365
+ init_update12();
361797
362366
  init_websearch();
361798
362367
  init_search3();
361799
362368
  init_workflows2();
361800
- init_delete22();
362369
+ init_delete23();
361801
362370
  init_describe();
361802
362371
  init_describe2();
361803
- init_list32();
362372
+ init_list33();
361804
362373
  init_pause();
361805
362374
  init_restart();
361806
362375
  init_resume();
361807
362376
  init_send_event2();
361808
362377
  init_terminate();
361809
362378
  init_terminate_all();
361810
- init_list33();
362379
+ init_list34();
361811
362380
  init_trigger();
361812
362381
  init_wrangler_banner();
361813
362382
  if (proxy) {
@@ -369243,6 +369812,17 @@ function createTestHarness(options) {
369243
369812
  return miniflare;
369244
369813
  }
369245
369814
  __name(getRuntimeMiniflare, "getRuntimeMiniflare");
369815
+ function getWorkerDevEnv(session, workerName) {
369816
+ const devEnv = session.devEnvs.find(
369817
+ (d8) => d8.config.latestConfig?.name === workerName
369818
+ );
369819
+ assert42__default.default(
369820
+ devEnv,
369821
+ `Worker ${JSON.stringify(workerName)} config is not available.`
369822
+ );
369823
+ return devEnv;
369824
+ }
369825
+ __name(getWorkerDevEnv, "getWorkerDevEnv");
369246
369826
  function getInputUrl(input) {
369247
369827
  if (typeof input === "string") {
369248
369828
  return input;
@@ -369303,10 +369883,7 @@ function createTestHarness(options) {
369303
369883
  const session = await resolveSession();
369304
369884
  const miniflare = await getRuntimeMiniflare(session);
369305
369885
  const workerName = resolveWorkerName2(session, name2);
369306
- const devEnv = session.devEnvs.find(
369307
- (d8) => d8.config.latestConfig?.name === workerName
369308
- );
369309
- const bindingConfig = devEnv?.config.latestConfig?.bindings?.[bindingName];
369886
+ const bindingConfig = getWorkerDevEnv(session, workerName).config.latestConfig?.bindings?.[bindingName];
369310
369887
  if (bindingConfig?.type !== "workflow") {
369311
369888
  throw new TypeError(
369312
369889
  `No Workflow binding named ${JSON.stringify(bindingName)} found in ${JSON.stringify(workerName)} worker.`
@@ -369365,13 +369942,34 @@ function createTestHarness(options) {
369365
369942
  const result = await response.json();
369366
369943
  return result;
369367
369944
  },
369945
+ async listDurableObjectIds(bindingName) {
369946
+ const session = await resolveSession();
369947
+ const miniflare = await getRuntimeMiniflare(session);
369948
+ const workerName = resolveWorkerName2(session, name2);
369949
+ debugLog(`durable object ids - ${bindingName} - started`, workerName);
369950
+ try {
369951
+ const ids = await miniflare.listDurableObjectIds(
369952
+ bindingName,
369953
+ workerName
369954
+ );
369955
+ debugLog(
369956
+ `durable object ids - ${bindingName} - completed (${ids.length} found)`,
369957
+ workerName
369958
+ );
369959
+ return ids;
369960
+ } catch (error53) {
369961
+ debugLog(
369962
+ `durable object ids - ${bindingName} - failed`,
369963
+ workerName
369964
+ );
369965
+ throw error53;
369966
+ }
369967
+ },
369368
369968
  async applyD1Migrations(bindingName) {
369369
369969
  const session = await resolveSession();
369370
369970
  const miniflare = await getRuntimeMiniflare(session);
369371
369971
  const workerName = resolveWorkerName2(session, name2);
369372
- const workerConfig = session.devEnvs.find(
369373
- (devEnv) => devEnv.config.latestConfig?.name === workerName
369374
- )?.config.latestWranglerConfig;
369972
+ const workerConfig = getWorkerDevEnv(session, workerName).config.latestWranglerConfig;
369375
369973
  assert42__default.default(
369376
369974
  workerConfig,
369377
369975
  `Worker ${JSON.stringify(workerName)} config is not available.`