@cloudflare/workers-utils 0.29.0 → 0.31.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.
@@ -1,4 +1,4 @@
1
- import { T as TailConsumer, aL as WorkerMetadata, R as RawConfig } from './config-BEcnaWpD.mjs';
1
+ import { T as TailConsumer, aL as WorkerMetadata, R as RawConfig } from './config-StQFc4Vs.mjs';
2
2
  import { AssetConfig } from '@cloudflare/workers-shared';
3
3
  import { Cloudflare } from 'cloudflare';
4
4
  import 'node:url';
@@ -201,7 +201,7 @@ declare const getCloudflareEnv: () => string | undefined;
201
201
  */
202
202
  declare const getOpenNextDeployFromEnv: () => string | undefined;
203
203
  /**
204
- * `X_LOCAL_EXPLORER` enables the local explorer UI at /cdn-cgi/explorer.
204
+ * `X_LOCAL_EXPLORER` enables the local explorer UI at /cdn-cgi/local/explorer.
205
205
  */
206
206
  declare const getLocalExplorerEnabledFromEnv: () => boolean;
207
207
  /**
package/dist/index.d.mts CHANGED
@@ -1,11 +1,12 @@
1
- import { C as ComputedFields, B as Binding, R as RawConfig, b as Config, E as Exports, D as DurableObjectExport, W as WorkerEntrypointExport, c as WorkerMetadataBinding, L as Logger, d as Route } from './config-BEcnaWpD.mjs';
2
- export { bM as ApiCredentials, aH as AssetConfigMetadata, A as Assets, aI as AssetsOptions, b0 as AsyncHook, aX as BinaryFile, bf as COMPLIANCE_REGION_CONFIG_PUBLIC, bg as COMPLIANCE_REGION_CONFIG_UNKNOWN, z as CacheOptions, Y as CfAIBinding, aa as CfAISearch, a9 as CfAISearchNamespace, aZ as CfAccount, ac as CfAgentMemory, ao as CfAnalyticsEngineDataset, ae as CfArtifacts, at as CfAssetsBinding, X as CfBrowserBinding, aw as CfCapnp, a7 as CfD1Database, a2 as CfDataBlobBindings, ak as CfDevPluginCfg, ap as CfDispatchNamespace, a3 as CfDurableObject, ay as CfDurableObjectMigrations, az as CfExports, ag as CfFlagship, af as CfHelloWorld, aj as CfHyperdrive, _ as CfImagesBinding, M as CfKvNamespace, ar as CfLogfwdr, as as CfLogfwdrBinding, aq as CfMTlsCertificate, $ as CfMediaBinding, J as CfModule, I as CfModuleType, au as CfPipeline, aA as CfPlacement, a5 as CfQueue, a6 as CfR2Bucket, ai as CfRateLimit, H as CfScriptFormat, ad as CfSecretsStoreSecrets, N as CfSendEmailBindings, al as CfService, a0 as CfStreamBinding, aB as CfTailConsumer, V as CfTextBlobBindings, ax as CfUnsafe, av as CfUnsafeBinding, aC as CfUserLimits, K as CfVars, a8 as CfVectorize, a1 as CfVersionMetadataBinding, an as CfVpcNetwork, am as CfVpcService, Q as CfWasmModuleBindings, ab as CfWebSearch, aE as CfWorkerContext, aD as CfWorkerInit, ah as CfWorkerLoader, aF as CfWorkerSourceMap, a4 as CfWorkflow, o as CloudchamberConfig, be as ComplianceConfig, f as ConfigFields, x as ConfigModuleRuleType, s as ConfiguredExport, p as ContainerApp, G as ContainerEngine, n as CustomDomainRoute, y as DispatchNamespaceOutbound, F as DockerConfiguration, t as DurableObjectBindings, r as DurableObjectExportStorage, q as DurableObjectMigration, b7 as ENVIRONMENT_TAG_PREFIX, b4 as Entry, k as Environment, v as EnvironmentNonInheritable, aM as ExportsReconciliationEntryBase, aP as ExportsReconciliationErrorDetail, aN as ExportsReconciliationInfo, aQ as ExportsReconciliationRename, aT as ExportsReconciliationResult, aR as ExportsReconciliationTransfer, aS as ExportsReconciliationTransferPending, aO as ExportsReconciliationWarning, c4 as FetchKVGetValueFetcher, bP as FetchListResultFetcher, bQ as FetchPagedListResultFetcher, bN as FetchResult, bO as FetchResultFetcher, aW as File, a$ as Hook, a_ as HookValues, b5 as INHERIT_SYMBOL, b9 as JSON_CONFIG_FORMATS, aG as Json, i as LOGGER_LEVELS, aK as LegacyAssetPaths, l as LocalS3Credentials, b1 as LogLevel, j as LoggerLevel, b2 as NodeJSCompatMode, O as Observability, b8 as PATH_TO_DEPLOY_CONFIG, P as PreviewsConfig, e as RawDevConfig, g as RawEnvironment, a as RedirectedRawConfig, w as Rule, b6 as SERVICE_TAG_PREFIX, aV as ServiceFetch, aU as ServiceMetadataRes, b3 as StartDevWorkerInput, S as StreamingTailConsumer, T as TailConsumer, aY as Trigger, U as UserLimits, aJ as ValidatedAssetsOptions, aL as WorkerMetadata, u as WorkflowBinding, Z as ZoneIdRoute, m as ZoneNameRoute, c1 as addAuthorizationHeader, h as defaultWranglerConfig, b_ as extractAccountTag, bZ as extractWAFBlockRayId, bS as fetchInternalBase, c3 as fetchKVGetValueBase, bU as fetchListResultBase, bT as fetchResultBase, bH as getBrowserRenderingHeadfulFromEnv, bs as getBuildConditionsFromEnv, bt as getBuildPlatformFromEnv, ba as getC3CommandFromEnv, bq as getCIGeneratePreviewAlias, bn as getCIMatchTag, bo as getCIOverrideName, bp as getCIOverrideNetworkModeHost, bI as getCfFetchEnabledFromEnv, bJ as getCfFetchPathFromEnv, bi as getCloudflareApiBaseUrl, bd as getCloudflareApiEnvironmentFromEnv, bh as getCloudflareComplianceRegion, bD as getCloudflareEnv, bz as getCloudflareIncludeProcessEnvFromEnv, by as getCloudflareLoadDevVarsFromDotEnv, bL as getCloudflaredPathFromEnv, bj as getComplianceRegionSubdomain, bv as getD1ExtraLocationChoices, bB as getDisableConfigWatching, bw as getDockerPath, bF as getLocalExplorerEnabledFromEnv, bG as getLocalObservabilityEnabledFromEnv, bE as getOpenNextDeployFromEnv, bl as getOutputFileDirectoryFromEnv, bm as getOutputFilePathFromEnv, bu as getRegistryPath, bk as getSanitizeLogs, bx as getSubdomainMixedStateCheckDisabled, bA as getTraceHeader, br as getWorkersCIBranchName, bK as getWranglerCacheDirFromEnv, bC as getWranglerHideBanner, bc as getWranglerSendErrorReportsFromEnv, bb as getWranglerSendMetricsFromEnv, c5 as hasCursor, b$ as hasMorePages, bW as isWAFBlockResponse, c6 as maybeAddTraceHeader, bY as parseRetryAfterMs, bX as parseRetryAfterValue, bR as performApiFetchBase, c0 as renderError, c2 as throwFetchError, bV as truncate } from './config-BEcnaWpD.mjs';
1
+ import { C as ComputedFields, B as Binding, R as RawConfig, b as Config, E as Exports, D as DurableObjectExport, W as WorkerEntrypointExport, c as WorkerMetadataBinding, L as Logger, d as Route } from './config-StQFc4Vs.mjs';
2
+ export { bM as ApiCredentials, aH as AssetConfigMetadata, A as Assets, aI as AssetsOptions, b0 as AsyncHook, aX as BinaryFile, bf as COMPLIANCE_REGION_CONFIG_PUBLIC, bg as COMPLIANCE_REGION_CONFIG_UNKNOWN, z as CacheOptions, Y as CfAIBinding, aa as CfAISearch, a9 as CfAISearchNamespace, aZ as CfAccount, ac as CfAgentMemory, ao as CfAnalyticsEngineDataset, ae as CfArtifacts, at as CfAssetsBinding, X as CfBrowserBinding, aw as CfCapnp, a7 as CfD1Database, a2 as CfDataBlobBindings, ak as CfDevPluginCfg, ap as CfDispatchNamespace, a3 as CfDurableObject, ay as CfDurableObjectMigrations, az as CfExports, ag as CfFlagship, af as CfHelloWorld, aj as CfHyperdrive, _ as CfImagesBinding, M as CfKvNamespace, ar as CfLogfwdr, as as CfLogfwdrBinding, aq as CfMTlsCertificate, $ as CfMediaBinding, J as CfModule, I as CfModuleType, au as CfPipeline, aA as CfPlacement, a5 as CfQueue, a6 as CfR2Bucket, ai as CfRateLimit, H as CfScriptFormat, ad as CfSecretsStoreSecrets, N as CfSendEmailBindings, al as CfService, a0 as CfStreamBinding, aB as CfTailConsumer, V as CfTextBlobBindings, ax as CfUnsafe, av as CfUnsafeBinding, aC as CfUserLimits, K as CfVars, a8 as CfVectorize, a1 as CfVersionMetadataBinding, an as CfVpcNetwork, am as CfVpcService, Q as CfWasmModuleBindings, ab as CfWebSearch, aE as CfWorkerContext, aD as CfWorkerInit, ah as CfWorkerLoader, aF as CfWorkerSourceMap, a4 as CfWorkflow, o as CloudchamberConfig, be as ComplianceConfig, f as ConfigFields, x as ConfigModuleRuleType, s as ConfiguredExport, p as ContainerApp, G as ContainerEngine, n as CustomDomainRoute, y as DispatchNamespaceOutbound, F as DockerConfiguration, t as DurableObjectBindings, r as DurableObjectExportStorage, q as DurableObjectMigration, b7 as ENVIRONMENT_TAG_PREFIX, b4 as Entry, k as Environment, v as EnvironmentNonInheritable, aM as ExportsReconciliationEntryBase, aP as ExportsReconciliationErrorDetail, aN as ExportsReconciliationInfo, aQ as ExportsReconciliationRename, aT as ExportsReconciliationResult, aR as ExportsReconciliationTransfer, aS as ExportsReconciliationTransferPending, aO as ExportsReconciliationWarning, c4 as FetchKVGetValueFetcher, bP as FetchListResultFetcher, bQ as FetchPagedListResultFetcher, bN as FetchResult, bO as FetchResultFetcher, aW as File, a$ as Hook, a_ as HookValues, b5 as INHERIT_SYMBOL, b9 as JSON_CONFIG_FORMATS, aG as Json, i as LOGGER_LEVELS, aK as LegacyAssetPaths, l as LocalS3Credentials, b1 as LogLevel, j as LoggerLevel, b2 as NodeJSCompatMode, O as Observability, b8 as PATH_TO_DEPLOY_CONFIG, P as PreviewsConfig, e as RawDevConfig, g as RawEnvironment, a as RedirectedRawConfig, w as Rule, b6 as SERVICE_TAG_PREFIX, aV as ServiceFetch, aU as ServiceMetadataRes, b3 as StartDevWorkerInput, S as StreamingTailConsumer, T as TailConsumer, aY as Trigger, U as UserLimits, aJ as ValidatedAssetsOptions, aL as WorkerMetadata, u as WorkflowBinding, Z as ZoneIdRoute, m as ZoneNameRoute, c1 as addAuthorizationHeader, h as defaultWranglerConfig, b_ as extractAccountTag, bZ as extractWAFBlockRayId, bS as fetchInternalBase, c3 as fetchKVGetValueBase, bU as fetchListResultBase, bT as fetchResultBase, bH as getBrowserRenderingHeadfulFromEnv, bs as getBuildConditionsFromEnv, bt as getBuildPlatformFromEnv, ba as getC3CommandFromEnv, bq as getCIGeneratePreviewAlias, bn as getCIMatchTag, bo as getCIOverrideName, bp as getCIOverrideNetworkModeHost, bI as getCfFetchEnabledFromEnv, bJ as getCfFetchPathFromEnv, bi as getCloudflareApiBaseUrl, bd as getCloudflareApiEnvironmentFromEnv, bh as getCloudflareComplianceRegion, bD as getCloudflareEnv, bz as getCloudflareIncludeProcessEnvFromEnv, by as getCloudflareLoadDevVarsFromDotEnv, bL as getCloudflaredPathFromEnv, bj as getComplianceRegionSubdomain, bv as getD1ExtraLocationChoices, bB as getDisableConfigWatching, bw as getDockerPath, bF as getLocalExplorerEnabledFromEnv, bG as getLocalObservabilityEnabledFromEnv, bE as getOpenNextDeployFromEnv, bl as getOutputFileDirectoryFromEnv, bm as getOutputFilePathFromEnv, bu as getRegistryPath, bk as getSanitizeLogs, bx as getSubdomainMixedStateCheckDisabled, bA as getTraceHeader, br as getWorkersCIBranchName, bK as getWranglerCacheDirFromEnv, bC as getWranglerHideBanner, bc as getWranglerSendErrorReportsFromEnv, bb as getWranglerSendMetricsFromEnv, c5 as hasCursor, b$ as hasMorePages, bW as isWAFBlockResponse, c6 as maybeAddTraceHeader, bY as parseRetryAfterMs, bX as parseRetryAfterValue, bR as performApiFetchBase, c0 as renderError, c2 as throwFetchError, bV as truncate } from './config-StQFc4Vs.mjs';
3
3
  import * as jsoncParser from 'jsonc-parser';
4
4
  export { constructWranglerConfig } from './browser.mjs';
5
5
  export { GetGlobalConfigPathOptions, getGlobalConfigPath, getGlobalWranglerCachePath } from './global-wrangler-config-path.mjs';
6
6
  export { isDirectory, removeDir, removeDirSync } from './fs-helpers.mjs';
7
7
  export { Counter, MetricsRegistry } from './prometheus-metrics.mjs';
8
8
  import { ChildProcess } from 'node:child_process';
9
+ import { z } from 'zod';
9
10
  import 'node:url';
10
11
  import 'undici';
11
12
  import '@cloudflare/workers-shared';
@@ -564,7 +565,7 @@ type VariableNames =
564
565
  * `wrangler login --use-keyring`.
565
566
  */
566
567
  | "CLOUDFLARE_AUTH_USE_KEYRING"
567
- /** Enable the local explorer UI at /cdn-cgi/explorer (experimental, default: false). */
568
+ /** Enable the local explorer UI at /cdn-cgi/local/explorer (experimental, default: false). */
568
569
  | "X_LOCAL_EXPLORER"
569
570
  /** Enable local-dev observability capture (experimental, default: false). */
570
571
  | "X_LOCAL_OBSERVABILITY"
@@ -1024,9 +1025,32 @@ declare function getWorkerName(projectOrWorkerName: string | undefined, projectP
1024
1025
  */
1025
1026
  declare function getWorkerNameFromProject(projectPath: string): string;
1026
1027
 
1028
+ declare function _forceColour(enabled?: boolean): void;
1029
+ declare function formatZodError(error: z.ZodError, input: unknown): string;
1030
+
1031
+ type DiscriminatedPath<Discriminator extends string> = string & {
1032
+ _discriminator: Discriminator;
1033
+ };
1034
+ /**
1035
+ * A branded string that expects to be URL compatible.
1036
+ *
1037
+ * Require this type when you want callers to ensure that they have converted file-path strings into URL-safe paths.
1038
+ */
1039
+ type UrlPath = DiscriminatedPath<"UrlPath">;
1040
+ /**
1041
+ * Convert a file-path string to a URL-path string.
1042
+ *
1043
+ * Use this helper to convert a `string` to a `UrlPath` when it is not clear whether the string needs normalizing.
1044
+ * Replaces all back-slashes with forward-slashes, and throws an error if the path contains a drive letter (e.g. `C:`).
1045
+ *
1046
+ * @param filePath - The file path to convert
1047
+ * @returns The URL-safe path
1048
+ */
1049
+ declare function toUrlPath(filePath: string): UrlPath;
1050
+
1027
1051
  /**
1028
1052
  * @deprecated new code should use getBindingTypeFriendlyName() instead
1029
1053
  */
1030
1054
  declare const friendlyBindingNames: Record<ConfigBindingFieldName, string>;
1031
1055
 
1032
- export { APIError, Binding, type BindingLocalSupport, BunPackageManager, CommandLineArgsError, type CompatDate, Config, type ConfigBindingFieldName, type ConfigBindingOptions, type ConfigCache, type ConfigCacheOptions, DeprecationError, Diagnostics, DurableObjectExport, type EphemeralDirectory, type ExportType, Exports, FatalError, JsonFriendlyFatalError, type Location, Logger, type Message, MissingConfigError, type NormalizeAndValidateConfigArgs, NpmPackageManager, type NpmVersionCheckResult, NubPackageManager, type PackageJSON, type PackageManager, ParseError, type ParseFile, type PartitionedExports, PatchConfigError, PnpmPackageManager, RawConfig, type ResolveConfigPathOptions, Route, type TelemetryMessage, type Tunnel, type TunnelOptions, UserError, WorkerEntrypointExport, WorkerMetadataBinding, YarnPackageManager, assertNever, bucketFormatMessage, checkWorkerNameValidity, configFileName, configFormat, createConfigCache, createFatalError, experimental_patchConfig, experimental_readRawConfig, fetchLatestNpmVersion, findWranglerConfig, formatConfigSnippet, formatTime, friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getDurableObjectExports, getEnvironmentVariableFactory, getHostFromRoute, getHostFromUrl, getInstalledPackageVersion, getPackagePath, getTodaysCompatDate, getWorkerName, getWorkerNameFromProject, getWranglerHiddenDirPath, getWranglerTmpDir, getZoneFromRoute, hasDurableObjectExports, hasProperty, indexLocation, isCI, isCompatDate, isDockerfile, isInteractive, isNonInteractiveOrCI, isOptionalProperty, isPackageInstalled, isPagesConfig, isRedirectedConfig, isRequiredProperty, isValidR2BucketName, mapWorkerMetadataBindings, normalizeAndValidateConfig, openInBrowser, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, retryOnAPIFailure, searchLocation, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, toValidWorkerName, validatePagesConfig };
1056
+ export { APIError, Binding, type BindingLocalSupport, BunPackageManager, CommandLineArgsError, type CompatDate, Config, type ConfigBindingFieldName, type ConfigBindingOptions, type ConfigCache, type ConfigCacheOptions, DeprecationError, Diagnostics, DurableObjectExport, type EphemeralDirectory, type ExportType, Exports, FatalError, JsonFriendlyFatalError, type Location, Logger, type Message, MissingConfigError, type NormalizeAndValidateConfigArgs, NpmPackageManager, type NpmVersionCheckResult, NubPackageManager, type PackageJSON, type PackageManager, ParseError, type ParseFile, type PartitionedExports, PatchConfigError, PnpmPackageManager, RawConfig, type ResolveConfigPathOptions, Route, type TelemetryMessage, type Tunnel, type TunnelOptions, type UrlPath, UserError, WorkerEntrypointExport, WorkerMetadataBinding, YarnPackageManager, _forceColour, assertNever, bucketFormatMessage, checkWorkerNameValidity, configFileName, configFormat, createConfigCache, createFatalError, experimental_patchConfig, experimental_readRawConfig, fetchLatestNpmVersion, findWranglerConfig, formatConfigSnippet, formatTime, formatZodError, friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getDurableObjectExports, getEnvironmentVariableFactory, getHostFromRoute, getHostFromUrl, getInstalledPackageVersion, getPackagePath, getTodaysCompatDate, getWorkerName, getWorkerNameFromProject, getWranglerHiddenDirPath, getWranglerTmpDir, getZoneFromRoute, hasDurableObjectExports, hasProperty, indexLocation, isCI, isCompatDate, isDockerfile, isInteractive, isNonInteractiveOrCI, isOptionalProperty, isPackageInstalled, isPagesConfig, isRedirectedConfig, isRequiredProperty, isValidR2BucketName, mapWorkerMetadataBindings, normalizeAndValidateConfig, openInBrowser, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, retryOnAPIFailure, searchLocation, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, toUrlPath, toValidWorkerName, validatePagesConfig };
package/dist/index.mjs CHANGED
@@ -18,6 +18,8 @@ import { fetch, Headers, FormData, Response } from 'undici';
18
18
  import { URLSearchParams } from 'node:url';
19
19
  import * as timersPromises from 'node:timers/promises';
20
20
  import { setTimeout as setTimeout$1 } from 'node:timers/promises';
21
+ import util from 'node:util';
22
+ import { assert as assert$1 } from 'node:console';
21
23
 
22
24
  // ../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json
23
25
  var require_vendors = __commonJS({
@@ -2336,7 +2338,7 @@ var NEVER = /* @__PURE__ */ Object.freeze({
2336
2338
  });
2337
2339
  // @__NO_SIDE_EFFECTS__
2338
2340
  function $constructor(name, initializer3, params) {
2339
- function init(inst, def) {
2341
+ function init2(inst, def) {
2340
2342
  if (!inst._zod) {
2341
2343
  Object.defineProperty(inst, "_zod", {
2342
2344
  value: {
@@ -2361,7 +2363,7 @@ function $constructor(name, initializer3, params) {
2361
2363
  }
2362
2364
  }
2363
2365
  }
2364
- __name(init, "init");
2366
+ __name(init2, "init");
2365
2367
  const Parent = params?.Parent ?? Object;
2366
2368
  class Definition extends Parent {
2367
2369
  static {
@@ -2372,7 +2374,7 @@ function $constructor(name, initializer3, params) {
2372
2374
  function _(def) {
2373
2375
  var _a3;
2374
2376
  const inst = params?.Parent ? new Definition() : this;
2375
- init(inst, def);
2377
+ init2(inst, def);
2376
2378
  (_a3 = inst._zod).deferred ?? (_a3.deferred = []);
2377
2379
  for (const fn of inst._zod.deferred) {
2378
2380
  fn();
@@ -2380,7 +2382,7 @@ function $constructor(name, initializer3, params) {
2380
2382
  return inst;
2381
2383
  }
2382
2384
  __name(_, "_");
2383
- Object.defineProperty(_, "init", { value: init });
2385
+ Object.defineProperty(_, "init", { value: init2 });
2384
2386
  Object.defineProperty(_, Symbol.hasInstance, {
2385
2387
  value: /* @__PURE__ */ __name((inst) => {
2386
2388
  if (params?.Parent && inst instanceof params.Parent)
@@ -24034,14 +24036,14 @@ function logHeaders(headers, logger) {
24034
24036
  );
24035
24037
  }
24036
24038
  __name(logHeaders, "logHeaders");
24037
- async function performApiFetchBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, abortSignal, credentials) {
24039
+ async function performApiFetchBase(complianceConfig, resource, init2 = {}, userAgent, logger, queryParams, abortSignal, credentials) {
24038
24040
  assert2(credentials, "credentials are required for performApiFetch");
24039
- const method = init.method ?? "GET";
24041
+ const method = init2.method ?? "GET";
24040
24042
  assert2(
24041
24043
  resource.startsWith("/"),
24042
24044
  `CF API fetch - resource path must start with a "/" but got "${resource}"`
24043
24045
  );
24044
- const headers = cloneHeaders(new Headers(init.headers));
24046
+ const headers = cloneHeaders(new Headers(init2.headers));
24045
24047
  addAuthorizationHeader(headers, credentials);
24046
24048
  headers.set("User-Agent", userAgent);
24047
24049
  maybeAddTraceHeader(headers);
@@ -24051,11 +24053,11 @@ async function performApiFetchBase(complianceConfig, resource, init = {}, userAg
24051
24053
  );
24052
24054
  logger.debugWithSanitization?.("QUERY STRING:", queryString);
24053
24055
  logHeaders(headers, logger);
24054
- logger.debugWithSanitization?.("INIT:", JSON.stringify({ ...init }, null, 2));
24055
- if (init.body instanceof FormData) {
24056
+ logger.debugWithSanitization?.("INIT:", JSON.stringify({ ...init2 }, null, 2));
24057
+ if (init2.body instanceof FormData) {
24056
24058
  logger.debugWithSanitization?.(
24057
24059
  "BODY:",
24058
- await new Response(init.body).text(),
24060
+ await new Response(init2.body).text(),
24059
24061
  null,
24060
24062
  2
24061
24063
  );
@@ -24065,19 +24067,19 @@ async function performApiFetchBase(complianceConfig, resource, init = {}, userAg
24065
24067
  `${getCloudflareApiBaseUrl(complianceConfig)}${resource}${queryString}`,
24066
24068
  {
24067
24069
  method,
24068
- ...init,
24070
+ ...init2,
24069
24071
  headers,
24070
24072
  signal: abortSignal
24071
24073
  }
24072
24074
  );
24073
24075
  }
24074
24076
  __name(performApiFetchBase, "performApiFetchBase");
24075
- async function fetchInternalBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, abortSignal, credentials) {
24076
- const method = init.method ?? "GET";
24077
+ async function fetchInternalBase(complianceConfig, resource, init2 = {}, userAgent, logger, queryParams, abortSignal, credentials) {
24078
+ const method = init2.method ?? "GET";
24077
24079
  const response = await performApiFetchBase(
24078
24080
  complianceConfig,
24079
24081
  resource,
24080
- init,
24082
+ init2,
24081
24083
  userAgent,
24082
24084
  logger,
24083
24085
  queryParams,
@@ -24139,7 +24141,7 @@ async function fetchInternalBase(complianceConfig, resource, init = {}, userAgen
24139
24141
  }
24140
24142
  }
24141
24143
  __name(fetchInternalBase, "fetchInternalBase");
24142
- async function fetchResultBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, abortSignal, credentials) {
24144
+ async function fetchResultBase(complianceConfig, resource, init2 = {}, userAgent, logger, queryParams, abortSignal, credentials) {
24143
24145
  const {
24144
24146
  response: json2,
24145
24147
  status,
@@ -24147,7 +24149,7 @@ async function fetchResultBase(complianceConfig, resource, init = {}, userAgent,
24147
24149
  } = await fetchInternalBase(
24148
24150
  complianceConfig,
24149
24151
  resource,
24150
- init,
24152
+ init2,
24151
24153
  userAgent,
24152
24154
  logger,
24153
24155
  queryParams,
@@ -24161,7 +24163,7 @@ async function fetchResultBase(complianceConfig, resource, init = {}, userAgent,
24161
24163
  }
24162
24164
  }
24163
24165
  __name(fetchResultBase, "fetchResultBase");
24164
- async function fetchListResultBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, credentials) {
24166
+ async function fetchListResultBase(complianceConfig, resource, init2 = {}, userAgent, logger, queryParams, credentials) {
24165
24167
  const results = [];
24166
24168
  let getMoreResults = true;
24167
24169
  let cursor;
@@ -24177,7 +24179,7 @@ async function fetchListResultBase(complianceConfig, resource, init = {}, userAg
24177
24179
  } = await fetchInternalBase(
24178
24180
  complianceConfig,
24179
24181
  resource,
24180
- init,
24182
+ init2,
24181
24183
  userAgent,
24182
24184
  logger,
24183
24185
  queryParams,
@@ -24664,6 +24666,274 @@ function getWorkerNameFromProject(projectPath) {
24664
24666
  }
24665
24667
  __name(getWorkerNameFromProject, "getWorkerNameFromProject");
24666
24668
 
24669
+ // ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs
24670
+ var FORCE_COLOR;
24671
+ var NODE_DISABLE_COLORS;
24672
+ var NO_COLOR;
24673
+ var TERM;
24674
+ var isTTY = true;
24675
+ if (typeof process !== "undefined") {
24676
+ ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
24677
+ isTTY = process.stdout && process.stdout.isTTY;
24678
+ }
24679
+ var $ = {
24680
+ enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
24681
+ };
24682
+ function init(x, y) {
24683
+ let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
24684
+ let open = `\x1B[${x}m`, close = `\x1B[${y}m`;
24685
+ return function(txt) {
24686
+ if (!$.enabled || txt == null) return txt;
24687
+ return open + (!!~("" + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
24688
+ };
24689
+ }
24690
+ __name(init, "init");
24691
+ var dim = init(2, 22);
24692
+ var red = init(31, 39);
24693
+ var green = init(32, 39);
24694
+ var yellow = init(33, 39);
24695
+ var blue = init(34, 39);
24696
+ var magenta = init(35, 39);
24697
+ var cyan = init(36, 39);
24698
+
24699
+ // src/zod-format.ts
24700
+ var originalEnabled = $.enabled;
24701
+ function _forceColour(enabled = originalEnabled) {
24702
+ $.enabled = enabled;
24703
+ }
24704
+ __name(_forceColour, "_forceColour");
24705
+ var kMessages = Symbol("kMessages");
24706
+ var kActual = Symbol("kActual");
24707
+ var kGroupId = Symbol("kGroupId");
24708
+ var groupColours = [
24709
+ yellow,
24710
+ /* (green) */
24711
+ cyan,
24712
+ blue,
24713
+ magenta,
24714
+ green
24715
+ ];
24716
+ var GroupCountsMap = Map;
24717
+ function isAnnotation(value) {
24718
+ return typeof value === "object" && value !== null && kMessages in value && kActual in value;
24719
+ }
24720
+ __name(isAnnotation, "isAnnotation");
24721
+ function isRecord2(value) {
24722
+ return typeof value === "object" && value !== null;
24723
+ }
24724
+ __name(isRecord2, "isRecord");
24725
+ function arrayShallowEqual(a, b) {
24726
+ if (a.length !== b.length) {
24727
+ return false;
24728
+ }
24729
+ for (let i = 0; i < a.length; i++) {
24730
+ if (a[i] !== b[i]) {
24731
+ return false;
24732
+ }
24733
+ }
24734
+ return true;
24735
+ }
24736
+ __name(arrayShallowEqual, "arrayShallowEqual");
24737
+ function issueEqual(a, b) {
24738
+ return a.message === b.message && arrayShallowEqual(a.path, b.path);
24739
+ }
24740
+ __name(issueEqual, "issueEqual");
24741
+ function hasMultipleDistinctMessages(issues, atDepth) {
24742
+ let firstIssue;
24743
+ for (const issue2 of issues) {
24744
+ if (issue2.path.length < atDepth) {
24745
+ continue;
24746
+ }
24747
+ if (firstIssue === void 0) {
24748
+ firstIssue = issue2;
24749
+ } else if (!issueEqual(firstIssue, issue2)) {
24750
+ return true;
24751
+ }
24752
+ }
24753
+ return false;
24754
+ }
24755
+ __name(hasMultipleDistinctMessages, "hasMultipleDistinctMessages");
24756
+ function annotate(groupCounts, annotated, input, issue2, path6, groupId) {
24757
+ if (path6.length === 0) {
24758
+ if (issue2.code === "invalid_union") {
24759
+ const allBranchIssues = issue2.errors;
24760
+ const unionIssues = allBranchIssues.flat();
24761
+ if (unionIssues.length > 0) {
24762
+ const multipleDistinct = hasMultipleDistinctMessages(unionIssues, 1);
24763
+ let newGroupId;
24764
+ if (isRecord2(input) && multipleDistinct) {
24765
+ newGroupId = groupCounts.size;
24766
+ groupCounts.set(newGroupId, 0);
24767
+ }
24768
+ for (const branchIssues of allBranchIssues) {
24769
+ for (const unionIssue of branchIssues) {
24770
+ const unionPath = unionIssue.path;
24771
+ if (multipleDistinct && unionPath.length === 0) {
24772
+ continue;
24773
+ }
24774
+ annotated = annotate(
24775
+ groupCounts,
24776
+ annotated,
24777
+ input,
24778
+ unionIssue,
24779
+ unionPath,
24780
+ newGroupId
24781
+ );
24782
+ }
24783
+ }
24784
+ return annotated;
24785
+ }
24786
+ }
24787
+ const message = issue2.message;
24788
+ if (annotated !== void 0) {
24789
+ if (isAnnotation(annotated) && !annotated[kMessages].includes(message)) {
24790
+ annotated[kMessages].push(message);
24791
+ }
24792
+ return annotated;
24793
+ }
24794
+ if (groupId !== void 0) {
24795
+ const current = groupCounts.get(groupId);
24796
+ assert2(current !== void 0);
24797
+ groupCounts.set(groupId, current + 1);
24798
+ }
24799
+ return {
24800
+ [kMessages]: [message],
24801
+ [kActual]: input,
24802
+ [kGroupId]: groupId
24803
+ };
24804
+ }
24805
+ const [head, ...tail] = path6;
24806
+ assert2(isRecord2(input), "Expected object/array input for nested issue");
24807
+ if (annotated === void 0) {
24808
+ if (Array.isArray(input)) {
24809
+ annotated = new Array(input.length);
24810
+ } else {
24811
+ const entries = Object.keys(input).map((key) => [key, void 0]);
24812
+ annotated = Object.fromEntries(entries);
24813
+ }
24814
+ }
24815
+ assert2(isRecord2(annotated), "Expected object/array for nested issue");
24816
+ annotated[head] = annotate(
24817
+ groupCounts,
24818
+ annotated[head],
24819
+ input[head],
24820
+ issue2,
24821
+ tail,
24822
+ groupId
24823
+ );
24824
+ return annotated;
24825
+ }
24826
+ __name(annotate, "annotate");
24827
+ function print(inspectOptions, groupCounts, annotated, indent = "", extras) {
24828
+ const prefix = extras?.prefix ?? "";
24829
+ const suffix = extras?.suffix ?? "";
24830
+ if (isAnnotation(annotated)) {
24831
+ const prefixIndent = indent + " ".repeat(prefix.length);
24832
+ const actual = util.inspect(annotated[kActual], inspectOptions);
24833
+ const actualIndented = actual.split("\n").map((line, i) => i > 0 ? prefixIndent + line : line).join("\n");
24834
+ let messageColour = red;
24835
+ let messagePrefix = prefixIndent + "^";
24836
+ let groupOr = "";
24837
+ if (annotated[kGroupId] !== void 0) {
24838
+ messageColour = groupColours[annotated[kGroupId] % groupColours.length];
24839
+ messagePrefix += annotated[kGroupId] + 1;
24840
+ const remaining = groupCounts.get(annotated[kGroupId]);
24841
+ assert2(remaining !== void 0);
24842
+ if (remaining > 1) {
24843
+ groupOr = " *or*";
24844
+ }
24845
+ groupCounts.set(annotated[kGroupId], remaining - 1);
24846
+ }
24847
+ messagePrefix += " ";
24848
+ const messageIndent = " ".repeat(messagePrefix.length);
24849
+ const messageIndented = annotated[kMessages].flatMap((m) => m.split("\n")).map((line, i) => i > 0 ? messageIndent + line : line).join("\n");
24850
+ const error51 = messageColour(`${messagePrefix}${messageIndented}${groupOr}`);
24851
+ return `${indent}${dim(prefix)}${actualIndented}${dim(suffix)}
24852
+ ${error51}`;
24853
+ } else if (Array.isArray(annotated)) {
24854
+ let result = `${indent}${dim(`${prefix}[`)}
24855
+ `;
24856
+ const arrayIndent = indent + " ";
24857
+ for (let i = 0; i < annotated.length; i++) {
24858
+ const value = annotated[i];
24859
+ if (value === void 0 && (i === 0 || annotated[i - 1] !== void 0)) {
24860
+ result += `${arrayIndent}${dim("...,")}
24861
+ `;
24862
+ }
24863
+ if (value !== void 0) {
24864
+ result += print(inspectOptions, groupCounts, value, arrayIndent, {
24865
+ prefix: `/* [${i}] */ `,
24866
+ suffix: ","
24867
+ });
24868
+ result += "\n";
24869
+ }
24870
+ }
24871
+ result += `${indent}${dim(`]${suffix}`)}`;
24872
+ return result;
24873
+ } else if (isRecord2(annotated)) {
24874
+ let result = `${indent}${dim(`${prefix}{`)}
24875
+ `;
24876
+ const objectIndent = indent + " ";
24877
+ const entries = Object.entries(annotated);
24878
+ for (let i = 0; i < entries.length; i++) {
24879
+ const [key, value] = entries[i];
24880
+ if (value === void 0 && (i === 0 || entries[i - 1][1] !== void 0)) {
24881
+ result += `${objectIndent}${dim("...,")}
24882
+ `;
24883
+ }
24884
+ if (value !== void 0) {
24885
+ result += print(inspectOptions, groupCounts, value, objectIndent, {
24886
+ prefix: `${key}: `,
24887
+ suffix: ","
24888
+ });
24889
+ result += "\n";
24890
+ }
24891
+ }
24892
+ result += `${indent}${dim(`}${suffix}`)}`;
24893
+ return result;
24894
+ }
24895
+ return "";
24896
+ }
24897
+ __name(print, "print");
24898
+ function formatZodError(error51, input) {
24899
+ const sortedIssues = Array.from(error51.issues).sort((a, b) => {
24900
+ if (a.code !== b.code) {
24901
+ if (a.code === "invalid_union") {
24902
+ return -1;
24903
+ }
24904
+ if (b.code === "invalid_union") {
24905
+ return 1;
24906
+ }
24907
+ }
24908
+ return 0;
24909
+ });
24910
+ let annotated;
24911
+ const groupCounts = new GroupCountsMap();
24912
+ for (const issue2 of sortedIssues) {
24913
+ annotated = annotate(
24914
+ groupCounts,
24915
+ annotated,
24916
+ input,
24917
+ issue2,
24918
+ issue2.path
24919
+ );
24920
+ }
24921
+ const inspectOptions = {
24922
+ depth: 0,
24923
+ colors: $.enabled
24924
+ };
24925
+ return print(inspectOptions, groupCounts, annotated);
24926
+ }
24927
+ __name(formatZodError, "formatZodError");
24928
+ function toUrlPath(filePath) {
24929
+ assert$1(
24930
+ !/^[a-z]:/i.test(filePath),
24931
+ "Tried to convert a Windows file path with a drive to a URL path."
24932
+ );
24933
+ return filePath.replace(/\\/g, "/");
24934
+ }
24935
+ __name(toUrlPath, "toUrlPath");
24936
+
24667
24937
  // src/index.ts
24668
24938
  var friendlyBindingNames2 = friendlyBindingNames;
24669
24939
  /*! Bundled license information:
@@ -24700,4 +24970,4 @@ safe-buffer/index.js:
24700
24970
  (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
24701
24971
  */
24702
24972
 
24703
- export { BunPackageManager, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, Diagnostics, LOGGER_LEVELS, NpmPackageManager, NubPackageManager, PatchConfigError, PnpmPackageManager, YarnPackageManager, addAuthorizationHeader, bucketFormatMessage, checkWorkerNameValidity, createConfigCache, defaultWranglerConfig, experimental_patchConfig, extractAccountTag, extractWAFBlockRayId, fetchInternalBase, fetchKVGetValueBase, fetchLatestNpmVersion, fetchListResultBase, fetchResultBase, formatTime, friendlyBindingNames2 as friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getDurableObjectExports, getEnvironmentVariableFactory, getHostFromRoute, getHostFromUrl, getInstalledPackageVersion, getLocalExplorerEnabledFromEnv, getLocalObservabilityEnabledFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getPackagePath, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkerName, getWorkerNameFromProject, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHiddenDirPath, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, getWranglerTmpDir, getZoneFromRoute, hasCursor, hasDurableObjectExports, hasMorePages, hasProperty, isCI, isDockerfile, isInteractive, isNonInteractiveOrCI, isOptionalProperty, isPackageInstalled, isPagesConfig, isRequiredProperty, isValidR2BucketName, isWAFBlockResponse, maybeAddTraceHeader, normalizeAndValidateConfig, openInBrowser, parseRetryAfterMs, parseRetryAfterValue, performApiFetchBase, renderError, retryOnAPIFailure, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, throwFetchError, toValidWorkerName, truncate, validatePagesConfig };
24973
+ export { BunPackageManager, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, Diagnostics, LOGGER_LEVELS, NpmPackageManager, NubPackageManager, PatchConfigError, PnpmPackageManager, YarnPackageManager, _forceColour, addAuthorizationHeader, bucketFormatMessage, checkWorkerNameValidity, createConfigCache, defaultWranglerConfig, experimental_patchConfig, extractAccountTag, extractWAFBlockRayId, fetchInternalBase, fetchKVGetValueBase, fetchLatestNpmVersion, fetchListResultBase, fetchResultBase, formatTime, formatZodError, friendlyBindingNames2 as friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getDockerPath, getDurableObjectExports, getEnvironmentVariableFactory, getHostFromRoute, getHostFromUrl, getInstalledPackageVersion, getLocalExplorerEnabledFromEnv, getLocalObservabilityEnabledFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getPackagePath, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkerName, getWorkerNameFromProject, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHiddenDirPath, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, getWranglerTmpDir, getZoneFromRoute, hasCursor, hasDurableObjectExports, hasMorePages, hasProperty, isCI, isDockerfile, isInteractive, isNonInteractiveOrCI, isOptionalProperty, isPackageInstalled, isPagesConfig, isRequiredProperty, isValidR2BucketName, isWAFBlockResponse, maybeAddTraceHeader, normalizeAndValidateConfig, openInBrowser, parseRetryAfterMs, parseRetryAfterValue, performApiFetchBase, renderError, retryOnAPIFailure, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, throwFetchError, toUrlPath, toValidWorkerName, truncate, validatePagesConfig };