@cloudflare/workers-utils 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.mts +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/{chunk-BLWXWFJK.mjs → chunk-AKFE3ND4.mjs} +20 -1
- package/dist/{chunk-XXCQEG76.mjs → chunk-GMTGAG26.mjs} +6 -2
- package/dist/{config-CeDY2o0q.d.mts → config-CXobNAeT.d.mts} +124 -5
- package/dist/index.d.mts +87 -7
- package/dist/index.mjs +1575 -94
- package/dist/metafile-esm.json +1 -1
- package/dist/test-helpers/index.d.mts +7 -2
- package/dist/test-helpers/index.mjs +20 -3
- package/package.json +18 -4
package/dist/browser.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TailConsumer,
|
|
1
|
+
import { T as TailConsumer, az as WorkerMetadata, R as RawConfig } from './config-CXobNAeT.mjs';
|
|
2
2
|
import { AssetConfig } from '@cloudflare/workers-shared';
|
|
3
3
|
import { Cloudflare } from 'cloudflare';
|
|
4
4
|
|
package/dist/browser.mjs
CHANGED
|
@@ -300,6 +300,23 @@ function mapWorkerMetadataBindings(bindings) {
|
|
|
300
300
|
}
|
|
301
301
|
];
|
|
302
302
|
break;
|
|
303
|
+
case "web_search":
|
|
304
|
+
{
|
|
305
|
+
configObj.web_search = {
|
|
306
|
+
binding: binding.name
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
break;
|
|
310
|
+
case "agent_memory": {
|
|
311
|
+
configObj.agent_memory = [
|
|
312
|
+
...configObj.agent_memory ?? [],
|
|
313
|
+
{
|
|
314
|
+
binding: binding.name,
|
|
315
|
+
namespace: binding.namespace
|
|
316
|
+
}
|
|
317
|
+
];
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
303
320
|
case "hyperdrive":
|
|
304
321
|
configObj.hyperdrive = [
|
|
305
322
|
...configObj.hyperdrive ?? [],
|
|
@@ -323,7 +340,9 @@ function mapWorkerMetadataBindings(bindings) {
|
|
|
323
340
|
...configObj.pipelines ?? [],
|
|
324
341
|
{
|
|
325
342
|
binding: binding.name,
|
|
326
|
-
|
|
343
|
+
// NOTE: stream is the primary field, but we also support pipeline for backward compatibility
|
|
344
|
+
...binding.stream && { stream: binding.stream },
|
|
345
|
+
...binding.pipeline && { pipeline: binding.pipeline }
|
|
327
346
|
}
|
|
328
347
|
];
|
|
329
348
|
break;
|
|
@@ -2821,8 +2821,12 @@ function findRedirectedWranglerConfig(cwd, userConfigPath) {
|
|
|
2821
2821
|
};
|
|
2822
2822
|
}
|
|
2823
2823
|
__name(findRedirectedWranglerConfig, "findRedirectedWranglerConfig");
|
|
2824
|
+
function isRedirectedConfig(config) {
|
|
2825
|
+
return config.configPath !== void 0 && config.configPath !== config.userConfigPath;
|
|
2826
|
+
}
|
|
2827
|
+
__name(isRedirectedConfig, "isRedirectedConfig");
|
|
2824
2828
|
function isRedirectedRawConfig(rawConfig, configPath, userConfigPath) {
|
|
2825
|
-
return
|
|
2829
|
+
return isRedirectedConfig({ configPath, userConfigPath });
|
|
2826
2830
|
}
|
|
2827
2831
|
__name(isRedirectedRawConfig, "isRedirectedRawConfig");
|
|
2828
2832
|
|
|
@@ -3175,4 +3179,4 @@ smol-toml/dist/index.js:
|
|
|
3175
3179
|
*)
|
|
3176
3180
|
*/
|
|
3177
3181
|
|
|
3178
|
-
export { APIError, CommandLineArgsError, DeprecationError, FatalError, JsonFriendlyFatalError, MissingConfigError, ParseError, UserError, applyEdits, configFileName, configFormat, createFatalError, dedent, dist_default, experimental_readRawConfig, findWranglerConfig, format2 as format, formatConfigSnippet, indexLocation, isDirectory, isRedirectedRawConfig, modify, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, removeDir, removeDirSync, resolveWranglerConfigPath, searchLocation };
|
|
3182
|
+
export { APIError, CommandLineArgsError, DeprecationError, FatalError, JsonFriendlyFatalError, MissingConfigError, ParseError, UserError, applyEdits, configFileName, configFormat, createFatalError, dedent, dist_default, experimental_readRawConfig, findWranglerConfig, format2 as format, formatConfigSnippet, indexLocation, isDirectory, isRedirectedConfig, isRedirectedRawConfig, modify, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, removeDir, removeDirSync, resolveWranglerConfigPath, searchLocation };
|
|
@@ -174,6 +174,7 @@ interface CfWorkflow {
|
|
|
174
174
|
limits?: {
|
|
175
175
|
steps?: number;
|
|
176
176
|
};
|
|
177
|
+
schedules?: string | string[];
|
|
177
178
|
}
|
|
178
179
|
interface CfQueue {
|
|
179
180
|
binding: string;
|
|
@@ -216,6 +217,15 @@ interface CfAISearch {
|
|
|
216
217
|
instance_name: string;
|
|
217
218
|
remote?: boolean;
|
|
218
219
|
}
|
|
220
|
+
interface CfWebSearch {
|
|
221
|
+
binding: string;
|
|
222
|
+
remote?: boolean;
|
|
223
|
+
}
|
|
224
|
+
interface CfAgentMemory {
|
|
225
|
+
binding: string;
|
|
226
|
+
namespace: string | typeof INHERIT_SYMBOL;
|
|
227
|
+
remote?: boolean;
|
|
228
|
+
}
|
|
219
229
|
interface CfSecretsStoreSecrets {
|
|
220
230
|
binding: string;
|
|
221
231
|
store_id: string;
|
|
@@ -302,7 +312,8 @@ interface CfAssetsBinding {
|
|
|
302
312
|
}
|
|
303
313
|
interface CfPipeline {
|
|
304
314
|
binding: string;
|
|
305
|
-
|
|
315
|
+
stream?: string;
|
|
316
|
+
pipeline?: string;
|
|
306
317
|
remote?: boolean;
|
|
307
318
|
}
|
|
308
319
|
interface CfUnsafeBinding {
|
|
@@ -514,6 +525,13 @@ type WorkerMetadataBinding = {
|
|
|
514
525
|
type: "ai_search";
|
|
515
526
|
name: string;
|
|
516
527
|
instance_name: string;
|
|
528
|
+
} | {
|
|
529
|
+
type: "web_search";
|
|
530
|
+
name: string;
|
|
531
|
+
} | {
|
|
532
|
+
type: "agent_memory";
|
|
533
|
+
name: string;
|
|
534
|
+
namespace: string;
|
|
517
535
|
} | {
|
|
518
536
|
type: "kv_namespace";
|
|
519
537
|
name: string;
|
|
@@ -601,7 +619,8 @@ type WorkerMetadataBinding = {
|
|
|
601
619
|
} | {
|
|
602
620
|
type: "pipelines";
|
|
603
621
|
name: string;
|
|
604
|
-
|
|
622
|
+
stream?: string;
|
|
623
|
+
pipeline?: string;
|
|
605
624
|
} | {
|
|
606
625
|
type: "secrets_store_secret";
|
|
607
626
|
name: string;
|
|
@@ -654,6 +673,38 @@ type AssetConfigMetadata = {
|
|
|
654
673
|
_redirects?: string;
|
|
655
674
|
_headers?: string;
|
|
656
675
|
};
|
|
676
|
+
type AssetsOptions = {
|
|
677
|
+
directory: string;
|
|
678
|
+
binding?: string;
|
|
679
|
+
routerConfig: RouterConfig;
|
|
680
|
+
assetConfig: AssetConfig;
|
|
681
|
+
_redirects?: string;
|
|
682
|
+
_headers?: string;
|
|
683
|
+
run_worker_first?: boolean | string[];
|
|
684
|
+
};
|
|
685
|
+
/**
|
|
686
|
+
* Information about the assets that should be uploaded
|
|
687
|
+
*/
|
|
688
|
+
interface LegacyAssetPaths {
|
|
689
|
+
/**
|
|
690
|
+
* Absolute path to the root of the project.
|
|
691
|
+
*
|
|
692
|
+
* This is the directory containing wrangler.toml or cwd if no config.
|
|
693
|
+
*/
|
|
694
|
+
baseDirectory: string;
|
|
695
|
+
/**
|
|
696
|
+
* The path to the assets directory, relative to the `baseDirectory`.
|
|
697
|
+
*/
|
|
698
|
+
assetDirectory: string;
|
|
699
|
+
/**
|
|
700
|
+
* An array of patterns that match files that should be uploaded.
|
|
701
|
+
*/
|
|
702
|
+
includePatterns: string[];
|
|
703
|
+
/**
|
|
704
|
+
* An array of patterns that match files that should not be uploaded.
|
|
705
|
+
*/
|
|
706
|
+
excludePatterns: string[];
|
|
707
|
+
}
|
|
657
708
|
type WorkerMetadataPut = {
|
|
658
709
|
/** The name of the entry point module. Only exists when the worker is in the ES module format */
|
|
659
710
|
main_module?: string;
|
|
@@ -807,6 +858,10 @@ type Binding = {
|
|
|
807
858
|
} & BindingOmit<CfAISearchNamespace>) | ({
|
|
808
859
|
type: "ai_search";
|
|
809
860
|
} & BindingOmit<CfAISearch>) | ({
|
|
861
|
+
type: "web_search";
|
|
862
|
+
} & BindingOmit<CfWebSearch>) | ({
|
|
863
|
+
type: "agent_memory";
|
|
864
|
+
} & BindingOmit<CfAgentMemory>) | ({
|
|
810
865
|
type: "hyperdrive";
|
|
811
866
|
} & BindingOmit<CfHyperdrive>) | ({
|
|
812
867
|
type: "service";
|
|
@@ -848,6 +903,29 @@ type Binding = {
|
|
|
848
903
|
} | {
|
|
849
904
|
type: "inherit";
|
|
850
905
|
};
|
|
906
|
+
/**
|
|
907
|
+
* An entry point for the Worker.
|
|
908
|
+
*
|
|
909
|
+
* It consists not just of a `file`, but also of a `directory` that is used to resolve relative paths.
|
|
910
|
+
*/
|
|
911
|
+
type Entry = {
|
|
912
|
+
/** A worker's entrypoint */
|
|
913
|
+
file: string;
|
|
914
|
+
/** A worker's directory. Usually where the Wrangler configuration file is located */
|
|
915
|
+
projectRoot: string;
|
|
916
|
+
/** The path to the config file, if it exists. */
|
|
917
|
+
configPath: string | undefined;
|
|
918
|
+
/** Is this a module worker or a service worker? */
|
|
919
|
+
format: CfScriptFormat;
|
|
920
|
+
/** The directory that contains all of a `--no-bundle` worker's modules. Usually `${directory}/src`. Defaults to path.dirname(file) */
|
|
921
|
+
moduleRoot: string;
|
|
922
|
+
/**
|
|
923
|
+
* A worker's name
|
|
924
|
+
*/
|
|
925
|
+
name?: string | undefined;
|
|
926
|
+
/** Export from a Worker's entrypoint */
|
|
927
|
+
exports: string[];
|
|
928
|
+
};
|
|
851
929
|
|
|
852
930
|
/**
|
|
853
931
|
* The `Environment` interface declares all the configuration fields that
|
|
@@ -1497,6 +1575,8 @@ type WorkflowBinding = {
|
|
|
1497
1575
|
/** Maximum number of steps a Workflow instance can execute */
|
|
1498
1576
|
steps?: number;
|
|
1499
1577
|
};
|
|
1578
|
+
/** Optional cron schedule(s) for automatically triggering workflow instances */
|
|
1579
|
+
schedules?: string | string[];
|
|
1500
1580
|
};
|
|
1501
1581
|
/**
|
|
1502
1582
|
* The `EnvironmentNonInheritable` interface declares all the configuration fields for an environment
|
|
@@ -1794,6 +1874,40 @@ interface EnvironmentNonInheritable {
|
|
|
1794
1874
|
/** Whether the AI Search instance binding should be remote in local development */
|
|
1795
1875
|
remote?: boolean;
|
|
1796
1876
|
}[];
|
|
1877
|
+
/**
|
|
1878
|
+
* Specifies Agent Memory namespace bindings that are bound to this Worker environment.
|
|
1879
|
+
*
|
|
1880
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1881
|
+
* and so must be specified in every named environment.
|
|
1882
|
+
*
|
|
1883
|
+
* @default []
|
|
1884
|
+
* @nonInheritable
|
|
1885
|
+
*/
|
|
1886
|
+
agent_memory: {
|
|
1887
|
+
/** The binding name used to refer to the Agent Memory namespace in the Worker. */
|
|
1888
|
+
binding: string;
|
|
1889
|
+
/** The user-chosen namespace name. Must exist in Cloudflare at deploy time. */
|
|
1890
|
+
namespace: string;
|
|
1891
|
+
/** Whether the Agent Memory binding should be remote in local development */
|
|
1892
|
+
remote?: boolean;
|
|
1893
|
+
}[];
|
|
1894
|
+
/**
|
|
1895
|
+
* Cloudflare Web Search binding. There is exactly one shared web corpus, so the
|
|
1896
|
+
* binding is zero-config -- only the variable name is required, declared as a
|
|
1897
|
+
* single object (not an array).
|
|
1898
|
+
*
|
|
1899
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1900
|
+
* and so must be specified in every named environment.
|
|
1901
|
+
*
|
|
1902
|
+
* @default {}
|
|
1903
|
+
* @nonInheritable
|
|
1904
|
+
*/
|
|
1905
|
+
web_search: {
|
|
1906
|
+
/** The binding name used to refer to Web Search in the Worker. */
|
|
1907
|
+
binding: string;
|
|
1908
|
+
/** Whether the Web Search binding should be remote or not in local development */
|
|
1909
|
+
remote?: boolean;
|
|
1910
|
+
} | undefined;
|
|
1797
1911
|
/**
|
|
1798
1912
|
* Specifies Hyperdrive configs that are bound to this Worker environment.
|
|
1799
1913
|
*
|
|
@@ -2055,8 +2169,13 @@ interface EnvironmentNonInheritable {
|
|
|
2055
2169
|
pipelines: {
|
|
2056
2170
|
/** The binding name used to refer to the bound service. */
|
|
2057
2171
|
binding: string;
|
|
2058
|
-
/**
|
|
2059
|
-
|
|
2172
|
+
/** Id of the Stream to bind */
|
|
2173
|
+
stream?: string;
|
|
2174
|
+
/**
|
|
2175
|
+
* Id of the Stream to bind
|
|
2176
|
+
* @deprecated Use `stream` instead.
|
|
2177
|
+
*/
|
|
2178
|
+
pipeline?: string;
|
|
2060
2179
|
/** Whether the pipeline should be remote or not in local development */
|
|
2061
2180
|
remote?: boolean;
|
|
2062
2181
|
}[];
|
|
@@ -2580,4 +2699,4 @@ interface EnvironmentMap {
|
|
|
2580
2699
|
}
|
|
2581
2700
|
declare const defaultWranglerConfig: Config;
|
|
2582
2701
|
|
|
2583
|
-
export { type
|
|
2702
|
+
export { type CfVectorize as $, type Assets as A, type Binding as B, type ComputedFields as C, type DurableObjectMigration as D, type Environment as E, type CfWasmModuleBindings as F, type CfTextBlobBindings as G, type CfBrowserBinding as H, type CfAIBinding as I, type CfImagesBinding as J, type CfMediaBinding as K, type CfStreamBinding as L, type CfVersionMetadataBinding as M, type CfDataBlobBindings as N, type Observability as O, type PreviewsConfig as P, type CfDurableObject as Q, type RawConfig as R, type StreamingTailConsumer as S, type TailConsumer as T, type UserLimits as U, type CfWorkflow as V, type WorkerMetadataBinding as W, type CfQueue as X, type CfR2Bucket as Y, type ZoneIdRoute as Z, type CfD1Database as _, type RedirectedRawConfig as a, type CfAISearchNamespace as a0, type CfAISearch as a1, type CfWebSearch as a2, type CfAgentMemory as a3, type CfSecretsStoreSecrets as a4, type CfArtifacts as a5, type CfHelloWorld as a6, type CfFlagship as a7, type CfWorkerLoader as a8, type CfRateLimit as a9, type ServiceMetadataRes as aA, type ServiceFetch as aB, type File as aC, type BinaryFile as aD, type Trigger as aE, type Entry as aF, INHERIT_SYMBOL as aG, SERVICE_TAG_PREFIX as aH, ENVIRONMENT_TAG_PREFIX as aI, PATH_TO_DEPLOY_CONFIG as aJ, JSON_CONFIG_FORMATS as aK, type CfHyperdrive as aa, type CfService as ab, type CfVpcService as ac, type CfVpcNetwork as ad, type CfAnalyticsEngineDataset as ae, type CfDispatchNamespace as af, type CfMTlsCertificate as ag, type CfLogfwdr as ah, type CfLogfwdrBinding as ai, type CfAssetsBinding as aj, type CfPipeline as ak, type CfUnsafeBinding as al, type CfCapnp as am, type CfUnsafe as an, type CfDurableObjectMigrations as ao, type CfPlacement as ap, type CfTailConsumer as aq, type CfUserLimits as ar, type CfWorkerInit as as, type CfWorkerContext as at, type CfWorkerSourceMap as au, type Json as av, type AssetConfigMetadata as aw, type AssetsOptions as ax, type LegacyAssetPaths as ay, type WorkerMetadata as az, type Config as b, type RawDevConfig as c, type ConfigFields as d, type RawEnvironment as e, defaultWranglerConfig as f, type ZoneNameRoute as g, type CustomDomainRoute as h, type Route as i, type CloudchamberConfig as j, type ContainerApp as k, type DurableObjectBindings as l, type WorkflowBinding as m, type EnvironmentNonInheritable as n, type Rule as o, type ConfigModuleRuleType as p, type DispatchNamespaceOutbound as q, type CacheOptions as r, type DockerConfiguration as s, type ContainerEngine as t, type CfScriptFormat as u, type CfModuleType as v, type CfModule as w, type CfVars as x, type CfKvNamespace as y, type CfSendEmailBindings as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as Binding, R as RawConfig,
|
|
2
|
-
export {
|
|
1
|
+
import { C as ComputedFields, B as Binding, R as RawConfig, b as Config, W as WorkerMetadataBinding } from './config-CXobNAeT.mjs';
|
|
2
|
+
export { aw as AssetConfigMetadata, A as Assets, ax as AssetsOptions, aD as BinaryFile, r as CacheOptions, I as CfAIBinding, a1 as CfAISearch, a0 as CfAISearchNamespace, a3 as CfAgentMemory, ae as CfAnalyticsEngineDataset, a5 as CfArtifacts, aj as CfAssetsBinding, H as CfBrowserBinding, am as CfCapnp, _ as CfD1Database, N as CfDataBlobBindings, af as CfDispatchNamespace, Q as CfDurableObject, ao as CfDurableObjectMigrations, a7 as CfFlagship, a6 as CfHelloWorld, aa as CfHyperdrive, J as CfImagesBinding, y as CfKvNamespace, ah as CfLogfwdr, ai as CfLogfwdrBinding, ag as CfMTlsCertificate, K as CfMediaBinding, w as CfModule, v as CfModuleType, ak as CfPipeline, ap as CfPlacement, X as CfQueue, Y as CfR2Bucket, a9 as CfRateLimit, u as CfScriptFormat, a4 as CfSecretsStoreSecrets, z as CfSendEmailBindings, ab as CfService, L as CfStreamBinding, aq as CfTailConsumer, G as CfTextBlobBindings, an as CfUnsafe, al as CfUnsafeBinding, ar as CfUserLimits, x as CfVars, $ as CfVectorize, M as CfVersionMetadataBinding, ad as CfVpcNetwork, ac as CfVpcService, F as CfWasmModuleBindings, a2 as CfWebSearch, at as CfWorkerContext, as as CfWorkerInit, a8 as CfWorkerLoader, au as CfWorkerSourceMap, V as CfWorkflow, j as CloudchamberConfig, d as ConfigFields, p as ConfigModuleRuleType, k as ContainerApp, t as ContainerEngine, h as CustomDomainRoute, q as DispatchNamespaceOutbound, s as DockerConfiguration, l as DurableObjectBindings, D as DurableObjectMigration, aI as ENVIRONMENT_TAG_PREFIX, aF as Entry, E as Environment, n as EnvironmentNonInheritable, aC as File, aG as INHERIT_SYMBOL, aK as JSON_CONFIG_FORMATS, av as Json, ay as LegacyAssetPaths, O as Observability, aJ as PATH_TO_DEPLOY_CONFIG, P as PreviewsConfig, c as RawDevConfig, e as RawEnvironment, a as RedirectedRawConfig, i as Route, o as Rule, aH as SERVICE_TAG_PREFIX, aB as ServiceFetch, aA as ServiceMetadataRes, S as StreamingTailConsumer, T as TailConsumer, aE as Trigger, U as UserLimits, az as WorkerMetadata, m as WorkflowBinding, Z as ZoneIdRoute, g as ZoneNameRoute, f as defaultWranglerConfig } from './config-CXobNAeT.mjs';
|
|
3
3
|
import * as jsoncParser from 'jsonc-parser';
|
|
4
4
|
export { constructWranglerConfig } from './browser.mjs';
|
|
5
5
|
export { Counter, MetricsRegistry } from './prometheus-metrics.mjs';
|
|
@@ -39,6 +39,7 @@ declare function resolveWranglerConfigPath({ config, script, }: {
|
|
|
39
39
|
declare function findWranglerConfig(referencePath?: string, { useRedirectIfAvailable }?: {
|
|
40
40
|
useRedirectIfAvailable?: boolean | undefined;
|
|
41
41
|
}): ConfigPaths;
|
|
42
|
+
declare function isRedirectedConfig(config: Pick<ComputedFields, "configPath" | "userConfigPath">): boolean;
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
45
|
* Diagnostic errors and warnings.
|
|
@@ -89,7 +90,7 @@ declare const bucketFormatMessage = "Bucket names must begin and end with an alp
|
|
|
89
90
|
* Config field names for bindings (e.g., "kv_namespaces", "d1_databases").
|
|
90
91
|
* These are the keys used in Wrangler's config file
|
|
91
92
|
*/
|
|
92
|
-
type ConfigBindingFieldName = "data_blobs" | "durable_objects" | "kv_namespaces" | "send_email" | "queues" | "d1_databases" | "vectorize" | "ai_search_namespaces" | "ai_search" | "hyperdrive" | "r2_buckets" | "logfwdr" | "services" | "analytics_engine_datasets" | "text_blobs" | "browser" | "ai" | "images" | "stream" | "media" | "version_metadata" | "unsafe" | "vars" | "wasm_modules" | "dispatch_namespaces" | "mtls_certificates" | "workflows" | "pipelines" | "secrets_store_secrets" | "artifacts" | "ratelimits" | "assets" | "unsafe_hello_world" | "flagship" | "worker_loaders" | "vpc_services" | "vpc_networks";
|
|
93
|
+
type ConfigBindingFieldName = "data_blobs" | "durable_objects" | "kv_namespaces" | "send_email" | "queues" | "d1_databases" | "vectorize" | "ai_search_namespaces" | "ai_search" | "web_search" | "agent_memory" | "hyperdrive" | "r2_buckets" | "logfwdr" | "services" | "analytics_engine_datasets" | "text_blobs" | "browser" | "ai" | "images" | "stream" | "media" | "version_metadata" | "unsafe" | "vars" | "wasm_modules" | "dispatch_namespaces" | "mtls_certificates" | "workflows" | "pipelines" | "secrets_store_secrets" | "artifacts" | "ratelimits" | "assets" | "unsafe_hello_world" | "flagship" | "worker_loaders" | "vpc_services" | "vpc_networks";
|
|
93
94
|
/**
|
|
94
95
|
* @deprecated new code should use getBindingTypeFriendlyName() instead
|
|
95
96
|
*/
|
|
@@ -328,6 +329,22 @@ declare function parseHumanDuration(s: string): number;
|
|
|
328
329
|
declare function parseNonHyphenedUuid(uuid: string | null): string | null;
|
|
329
330
|
declare function parseByteSize(s: string, base?: number | undefined): number;
|
|
330
331
|
|
|
332
|
+
/**
|
|
333
|
+
* Local-dev capability of each binding type. Source of truth for
|
|
334
|
+
* `pickRemoteBindings()` and `warnOrError()`.
|
|
335
|
+
*
|
|
336
|
+
* - `local-and-remote`: local simulator; `remote: true` opts into proxying.
|
|
337
|
+
* - `local-only`: local simulator only; `remote: true` is a config error.
|
|
338
|
+
* - `remote`: no local simulator *yet* — requires explicit `remote: true`.
|
|
339
|
+
* Move to `local-and-remote` once a simulator lands.
|
|
340
|
+
* - `DO-NOT-USE-this-resource-will-never-have-a-local-simulator`: no local
|
|
341
|
+
* simulator, *ever* — fundamentally remote-only. Always auto-routed; user
|
|
342
|
+
* is warned about usage charges. Adding here is permanent; prefer any
|
|
343
|
+
* other variant if a simulator is plausible.
|
|
344
|
+
*/
|
|
345
|
+
type BindingLocalSupport = "local-and-remote" | "local-only" | "remote" | "DO-NOT-USE-this-resource-will-never-have-a-local-simulator";
|
|
346
|
+
declare function getBindingLocalSupport(type: Binding["type"]): BindingLocalSupport;
|
|
347
|
+
|
|
331
348
|
/**
|
|
332
349
|
* Pages now supports configuration via a Wrangler configuration file. As opposed to
|
|
333
350
|
* Workers however, Pages only supports a limited subset of all available
|
|
@@ -568,9 +585,12 @@ declare const getC3CommandFromEnv: () => string;
|
|
|
568
585
|
*/
|
|
569
586
|
declare const getWranglerSendMetricsFromEnv: () => boolean | undefined;
|
|
570
587
|
/**
|
|
571
|
-
* `WRANGLER_SEND_ERROR_REPORTS`
|
|
588
|
+
* `WRANGLER_SEND_ERROR_REPORTS` controls whether we attempt to send error reports to Sentry.
|
|
589
|
+
*
|
|
590
|
+
* Defaults to `false` to avoid noisy false-positive reports. Users can opt in
|
|
591
|
+
* by setting `WRANGLER_SEND_ERROR_REPORTS=true`.
|
|
572
592
|
*/
|
|
573
|
-
declare const getWranglerSendErrorReportsFromEnv: () => boolean
|
|
593
|
+
declare const getWranglerSendErrorReportsFromEnv: () => boolean;
|
|
574
594
|
/**
|
|
575
595
|
* Set `WRANGLER_API_ENVIRONMENT` environment variable to "staging" to tell Wrangler to hit the staging APIs rather than production.
|
|
576
596
|
*/
|
|
@@ -837,6 +857,35 @@ declare function removeDir(dirPath: string, options?: {
|
|
|
837
857
|
*/
|
|
838
858
|
declare function removeDirSync(dirPath: string): void;
|
|
839
859
|
|
|
860
|
+
/**
|
|
861
|
+
* A short-lived directory. Automatically removed when the process exits, but
|
|
862
|
+
* can be removed earlier by calling `remove()`.
|
|
863
|
+
*/
|
|
864
|
+
interface EphemeralDirectory {
|
|
865
|
+
path: string;
|
|
866
|
+
remove(): void;
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* Gets the path to the project's `.wrangler` folder.
|
|
870
|
+
*/
|
|
871
|
+
declare function getWranglerHiddenDirPath(projectRoot: string | undefined): string;
|
|
872
|
+
/**
|
|
873
|
+
* Removes stale `.wrangler/tmp/*` entries left behind by previous wrangler
|
|
874
|
+
* sessions that exited abnormally (SIGKILL, OOM, host crash) and so missed
|
|
875
|
+
* the `signal-exit` cleanup. Runs at most once per tmp root per process.
|
|
876
|
+
*
|
|
877
|
+
* Exported for tests.
|
|
878
|
+
*/
|
|
879
|
+
declare function sweepStaleWranglerTmpDirs(tmpRoot: string): void;
|
|
880
|
+
/**
|
|
881
|
+
* Gets a temporary directory in the project's `.wrangler` folder with the
|
|
882
|
+
* specified prefix. We create temporary directories in `.wrangler` as opposed
|
|
883
|
+
* to the OS's temporary directory to avoid issues with different drive letters
|
|
884
|
+
* on Windows. For example, when `esbuild` outputs a file to a different drive
|
|
885
|
+
* than the input sources, the generated source maps are incorrect.
|
|
886
|
+
*/
|
|
887
|
+
declare function getWranglerTmpDir(projectRoot: string | undefined, prefix: string, cleanup?: boolean): EphemeralDirectory;
|
|
888
|
+
|
|
840
889
|
/**
|
|
841
890
|
* cloudflared binary management for Wrangler tunnel commands.
|
|
842
891
|
*
|
|
@@ -861,16 +910,23 @@ declare function spawnCloudflared(args: string[], options?: {
|
|
|
861
910
|
logger?: Logger;
|
|
862
911
|
}): Promise<ChildProcess>;
|
|
863
912
|
|
|
864
|
-
interface
|
|
913
|
+
interface QuickTunnelResult {
|
|
914
|
+
mode: "quick";
|
|
865
915
|
publicUrl: URL;
|
|
866
916
|
}
|
|
917
|
+
interface NamedTunnelResult {
|
|
918
|
+
mode: "named";
|
|
919
|
+
}
|
|
920
|
+
type TunnelResult = QuickTunnelResult | NamedTunnelResult;
|
|
867
921
|
interface Tunnel {
|
|
868
922
|
ready: () => Promise<TunnelResult>;
|
|
923
|
+
isOpen: () => boolean;
|
|
869
924
|
dispose: () => void;
|
|
870
925
|
extendExpiry: (ms?: number) => void;
|
|
871
926
|
}
|
|
872
927
|
interface TunnelOptions {
|
|
873
928
|
origin: URL;
|
|
929
|
+
token?: string;
|
|
874
930
|
timeoutMs?: number;
|
|
875
931
|
expiryMs?: number;
|
|
876
932
|
reminderIntervalMs?: number;
|
|
@@ -887,4 +943,28 @@ interface TunnelOptions {
|
|
|
887
943
|
*/
|
|
888
944
|
declare function startTunnel(options: TunnelOptions): Tunnel;
|
|
889
945
|
|
|
890
|
-
|
|
946
|
+
type NpmVersionCheckResult = {
|
|
947
|
+
status: "up-to-date";
|
|
948
|
+
} | {
|
|
949
|
+
status: "update-available";
|
|
950
|
+
latest: string;
|
|
951
|
+
} | {
|
|
952
|
+
status: "failed";
|
|
953
|
+
};
|
|
954
|
+
/**
|
|
955
|
+
* Checks if a newer version of a package is available on npm.
|
|
956
|
+
*
|
|
957
|
+
* Uses the `update-check` library to query the npm registry for the latest
|
|
958
|
+
* version. The dist tag used for comparison depends on the current version —
|
|
959
|
+
* "beta" for pre-release versions (0.0.0-*) and "latest" for stable versions.
|
|
960
|
+
*
|
|
961
|
+
* @param name - The npm package name to check
|
|
962
|
+
* @param version - The current version to compare against
|
|
963
|
+
* @returns A discriminated result:
|
|
964
|
+
* - `{ status: "update-available", latest: string }` if a newer version exists
|
|
965
|
+
* - `{ status: "up-to-date" }` if the installed version is already the latest
|
|
966
|
+
* - `{ status: "failed" }` if the check could not be completed (network error, timeout, etc.)
|
|
967
|
+
*/
|
|
968
|
+
declare function fetchLatestNpmVersion(name: string, version: string): Promise<NpmVersionCheckResult>;
|
|
969
|
+
|
|
970
|
+
export { APIError, Binding, type BindingLocalSupport, COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, CommandLineArgsError, type CompatDate, type ComplianceConfig, Config, type ConfigBindingFieldName, type ConfigBindingOptions, DeprecationError, Diagnostics, type EphemeralDirectory, FatalError, JsonFriendlyFatalError, type Location, type Message, MissingConfigError, type NormalizeAndValidateConfigArgs, type NpmVersionCheckResult, type PackageJSON, ParseError, type ParseFile, PatchConfigError, RawConfig, type ResolveConfigPathOptions, type TelemetryMessage, type Tunnel, type TunnelOptions, UserError, WorkerMetadataBinding, assertNever, bucketFormatMessage, configFileName, configFormat, createFatalError, experimental_patchConfig, experimental_readRawConfig, fetchLatestNpmVersion, findWranglerConfig, formatConfigSnippet, 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, getEnvironmentVariableFactory, getGlobalWranglerConfigPath, getLocalExplorerEnabledFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTodaysCompatDate, getTraceHeader, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHiddenDirPath, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, getWranglerTmpDir, hasProperty, indexLocation, isCompatDate, isDirectory, isDockerfile, isOptionalProperty, isPagesConfig, isRedirectedConfig, isRequiredProperty, isValidR2BucketName, mapWorkerMetadataBindings, normalizeAndValidateConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, readFileSync, readFileSyncToBuffer, removeDir, removeDirSync, resolveWranglerConfigPath, searchLocation, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, validatePagesConfig };
|