wrangler 4.97.0 → 4.99.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/config-schema.json +23 -8
- package/package.json +11 -10
- package/wrangler-dist/cli.d.ts +231 -10
- package/wrangler-dist/cli.js +169966 -166090
- package/wrangler-dist/metafile-cjs.json +1 -1
package/config-schema.json
CHANGED
|
@@ -719,6 +719,11 @@
|
|
|
719
719
|
"description": "The path to the directory of migrations for this D1 database (defaults to './migrations').",
|
|
720
720
|
"markdownDescription": "The path to the directory of migrations for this D1 database (defaults to './migrations')."
|
|
721
721
|
},
|
|
722
|
+
"migrations_pattern": {
|
|
723
|
+
"type": "string",
|
|
724
|
+
"description": "A glob pattern (relative to the Wrangler config file) used to discover migration files for this D1 database. Defaults to `${migrations_dir}/*.sql` if not specified.\n\nUse this to opt in to nested layouts such as `migrations/*\\/migration.sql` (as produced by some ORMs).\n\nWhen `migrations_pattern` is set, `migrations_dir` must also be set, and `migrations_pattern` must start with `${migrations_dir}/`. This keeps the relationship between the two settings explicit and lets Wrangler record each migration's name in the migrations table as a path relative to `migrations_dir`.",
|
|
725
|
+
"markdownDescription": "A glob pattern (relative to the Wrangler config file) used to discover\nmigration files for this D1 database. Defaults to `${migrations_dir}/*.sql`\nif not specified.\n\nUse this to opt in to nested layouts such as `migrations/*\\/migration.sql`\n(as produced by some ORMs).\n\nWhen `migrations_pattern` is set, `migrations_dir` must also be set, and\n`migrations_pattern` must start with `${migrations_dir}/`. This keeps the\nrelationship between the two settings explicit and lets Wrangler record\neach migration's name in the migrations table as a path relative to\n`migrations_dir`."
|
|
726
|
+
},
|
|
722
727
|
"database_internal_env": {
|
|
723
728
|
"type": "string",
|
|
724
729
|
"description": "Internal use only.",
|
|
@@ -863,7 +868,7 @@
|
|
|
863
868
|
"markdownDescription": "Specifies Agent Memory namespace bindings that are bound to this Worker environment.\n\nNOTE: This field is not automatically inherited from the top level environment,\nand so must be specified in every named environment.",
|
|
864
869
|
"default": []
|
|
865
870
|
},
|
|
866
|
-
"
|
|
871
|
+
"websearch": {
|
|
867
872
|
"type": "object",
|
|
868
873
|
"properties": {
|
|
869
874
|
"binding": {
|
|
@@ -2426,6 +2431,11 @@
|
|
|
2426
2431
|
"description": "The path to the directory of migrations for this D1 database (defaults to './migrations').",
|
|
2427
2432
|
"markdownDescription": "The path to the directory of migrations for this D1 database (defaults to './migrations')."
|
|
2428
2433
|
},
|
|
2434
|
+
"migrations_pattern": {
|
|
2435
|
+
"type": "string",
|
|
2436
|
+
"description": "A glob pattern (relative to the Wrangler config file) used to discover migration files for this D1 database. Defaults to `${migrations_dir}/*.sql` if not specified.\n\nUse this to opt in to nested layouts such as `migrations/*\\/migration.sql` (as produced by some ORMs).\n\nWhen `migrations_pattern` is set, `migrations_dir` must also be set, and `migrations_pattern` must start with `${migrations_dir}/`. This keeps the relationship between the two settings explicit and lets Wrangler record each migration's name in the migrations table as a path relative to `migrations_dir`.",
|
|
2437
|
+
"markdownDescription": "A glob pattern (relative to the Wrangler config file) used to discover\nmigration files for this D1 database. Defaults to `${migrations_dir}/*.sql`\nif not specified.\n\nUse this to opt in to nested layouts such as `migrations/*\\/migration.sql`\n(as produced by some ORMs).\n\nWhen `migrations_pattern` is set, `migrations_dir` must also be set, and\n`migrations_pattern` must start with `${migrations_dir}/`. This keeps the\nrelationship between the two settings explicit and lets Wrangler record\neach migration's name in the migrations table as a path relative to\n`migrations_dir`."
|
|
2438
|
+
},
|
|
2429
2439
|
"database_internal_env": {
|
|
2430
2440
|
"type": "string",
|
|
2431
2441
|
"description": "Internal use only.",
|
|
@@ -2570,7 +2580,7 @@
|
|
|
2570
2580
|
"markdownDescription": "Specifies Agent Memory namespace bindings that are bound to this Worker environment.\n\nNOTE: This field is not automatically inherited from the top level environment,\nand so must be specified in every named environment.",
|
|
2571
2581
|
"default": []
|
|
2572
2582
|
},
|
|
2573
|
-
"
|
|
2583
|
+
"websearch": {
|
|
2574
2584
|
"type": "object",
|
|
2575
2585
|
"properties": {
|
|
2576
2586
|
"binding": {
|
|
@@ -3675,16 +3685,16 @@
|
|
|
3675
3685
|
"additionalProperties": false,
|
|
3676
3686
|
"properties": {
|
|
3677
3687
|
"logpush": {
|
|
3678
|
-
"$ref": "#/definitions/interface-769040647-
|
|
3688
|
+
"$ref": "#/definitions/interface-769040647-8409-18279-769040647-0-501432004818536"
|
|
3679
3689
|
},
|
|
3680
3690
|
"observability": {
|
|
3681
|
-
"$ref": "#/definitions/interface-769040647-
|
|
3691
|
+
"$ref": "#/definitions/interface-769040647-8409-18279-769040647-0-501432004818536"
|
|
3682
3692
|
},
|
|
3683
3693
|
"limits": {
|
|
3684
|
-
"$ref": "#/definitions/interface-769040647-
|
|
3694
|
+
"$ref": "#/definitions/interface-769040647-8409-18279-769040647-0-501432004818536"
|
|
3685
3695
|
},
|
|
3686
3696
|
"cache": {
|
|
3687
|
-
"$ref": "#/definitions/interface-769040647-
|
|
3697
|
+
"$ref": "#/definitions/interface-769040647-8409-18279-769040647-0-501432004818536"
|
|
3688
3698
|
},
|
|
3689
3699
|
"define": {
|
|
3690
3700
|
"type": "object",
|
|
@@ -4034,6 +4044,11 @@
|
|
|
4034
4044
|
"description": "The path to the directory of migrations for this D1 database (defaults to './migrations').",
|
|
4035
4045
|
"markdownDescription": "The path to the directory of migrations for this D1 database (defaults to './migrations')."
|
|
4036
4046
|
},
|
|
4047
|
+
"migrations_pattern": {
|
|
4048
|
+
"type": "string",
|
|
4049
|
+
"description": "A glob pattern (relative to the Wrangler config file) used to discover migration files for this D1 database. Defaults to `${migrations_dir}/*.sql` if not specified.\n\nUse this to opt in to nested layouts such as `migrations/*\\/migration.sql` (as produced by some ORMs).\n\nWhen `migrations_pattern` is set, `migrations_dir` must also be set, and `migrations_pattern` must start with `${migrations_dir}/`. This keeps the relationship between the two settings explicit and lets Wrangler record each migration's name in the migrations table as a path relative to `migrations_dir`.",
|
|
4050
|
+
"markdownDescription": "A glob pattern (relative to the Wrangler config file) used to discover\nmigration files for this D1 database. Defaults to `${migrations_dir}/*.sql`\nif not specified.\n\nUse this to opt in to nested layouts such as `migrations/*\\/migration.sql`\n(as produced by some ORMs).\n\nWhen `migrations_pattern` is set, `migrations_dir` must also be set, and\n`migrations_pattern` must start with `${migrations_dir}/`. This keeps the\nrelationship between the two settings explicit and lets Wrangler record\neach migration's name in the migrations table as a path relative to\n`migrations_dir`."
|
|
4051
|
+
},
|
|
4037
4052
|
"database_internal_env": {
|
|
4038
4053
|
"type": "string",
|
|
4039
4054
|
"description": "Internal use only.",
|
|
@@ -4178,7 +4193,7 @@
|
|
|
4178
4193
|
"markdownDescription": "Specifies Agent Memory namespace bindings that are bound to this Worker environment.\n\nNOTE: This field is not automatically inherited from the top level environment,\nand so must be specified in every named environment.",
|
|
4179
4194
|
"default": []
|
|
4180
4195
|
},
|
|
4181
|
-
"
|
|
4196
|
+
"websearch": {
|
|
4182
4197
|
"type": "object",
|
|
4183
4198
|
"properties": {
|
|
4184
4199
|
"binding": {
|
|
@@ -4941,7 +4956,7 @@
|
|
|
4941
4956
|
"description": "Configuration for Worker Previews.\n\nThis defines the settings used when creating Preview deployments. Previews are branches of your Worker's main instance used to test features during feature development outside of production.\n\nThe `previews` block contains any intentionally divergent configuration intended solely for Previews, including:\n- All non-inheritable properties (environment variables and bindings like KV, D1, R2, etc.)\n- Select inheritable properties: `logpush`, `observability`, `limits`, `cache`",
|
|
4942
4957
|
"markdownDescription": "Configuration for Worker Previews.\n\nThis defines the settings used when creating Preview deployments.\nPreviews are branches of your Worker's main instance used to test features\nduring feature development outside of production.\n\nThe `previews` block contains any intentionally divergent configuration intended solely for Previews, including:\n- All non-inheritable properties (environment variables and bindings like KV, D1, R2, etc.)\n- Select inheritable properties: `logpush`, `observability`, `limits`, `cache`"
|
|
4943
4958
|
},
|
|
4944
|
-
"interface-769040647-
|
|
4959
|
+
"interface-769040647-8409-18279-769040647-0-501432004818536": {
|
|
4945
4960
|
"type": "object",
|
|
4946
4961
|
"properties": {
|
|
4947
4962
|
"name": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.99.0",
|
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"assembly",
|
|
@@ -54,16 +54,16 @@
|
|
|
54
54
|
"esbuild": "0.27.3",
|
|
55
55
|
"path-to-regexp": "6.3.0",
|
|
56
56
|
"unenv": "2.0.0-rc.24",
|
|
57
|
-
"workerd": "1.
|
|
57
|
+
"workerd": "1.20260609.1",
|
|
58
|
+
"@cloudflare/unenv-preset": "2.16.1",
|
|
58
59
|
"@cloudflare/kv-asset-handler": "0.5.0",
|
|
59
|
-
"miniflare": "4.
|
|
60
|
-
"@cloudflare/unenv-preset": "2.16.1"
|
|
60
|
+
"miniflare": "4.20260609.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@aws-sdk/client-s3": "^3.721.0",
|
|
64
64
|
"@bomb.sh/tab": "^0.0.12",
|
|
65
65
|
"@cloudflare/types": "6.18.4",
|
|
66
|
-
"@cloudflare/workers-types": "^4.
|
|
66
|
+
"@cloudflare/workers-types": "^4.20260609.1",
|
|
67
67
|
"@cspotcode/source-map-support": "0.8.1",
|
|
68
68
|
"@netlify/build-info": "^10.5.1",
|
|
69
69
|
"@sentry/node": "^7.86.0",
|
|
@@ -145,18 +145,19 @@
|
|
|
145
145
|
"xxhash-wasm": "^1.0.1",
|
|
146
146
|
"yaml": "^2.8.1",
|
|
147
147
|
"yargs": "^17.7.2",
|
|
148
|
-
"@cloudflare/cli-shared-helpers": "0.1.
|
|
148
|
+
"@cloudflare/cli-shared-helpers": "0.1.7",
|
|
149
149
|
"@cloudflare/codemod": "1.1.0",
|
|
150
|
-
"@cloudflare/deploy-helpers": "0.1.1",
|
|
151
|
-
"@cloudflare/pages-shared": "^0.13.142",
|
|
152
150
|
"@cloudflare/containers-shared": "0.15.1",
|
|
151
|
+
"@cloudflare/deploy-helpers": "0.1.2",
|
|
152
|
+
"@cloudflare/pages-shared": "^0.13.144",
|
|
153
|
+
"@cloudflare/workers-auth": "0.1.1",
|
|
153
154
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
154
|
-
"@cloudflare/workers-utils": "0.
|
|
155
|
+
"@cloudflare/workers-utils": "0.23.0",
|
|
155
156
|
"@cloudflare/workflows-shared": "0.11.1",
|
|
156
157
|
"@cloudflare/workers-shared": "0.19.6"
|
|
157
158
|
},
|
|
158
159
|
"peerDependencies": {
|
|
159
|
-
"@cloudflare/workers-types": "^4.
|
|
160
|
+
"@cloudflare/workers-types": "^4.20260609.1"
|
|
160
161
|
},
|
|
161
162
|
"peerDependenciesMeta": {
|
|
162
163
|
"@cloudflare/workers-types": {
|
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Rule as Rule$1, CfModule, Environment as Environment$1, Entry, CfModuleType, ApiCredentials, Config as Config$1, Binding, DurableObjectMigration as DurableObjectMigration$1, ContainerApp as ContainerApp$1, Trigger, CfTailConsumer, ServiceFetch, ContainerEngine as ContainerEngine$1, CfUnsafe, CfScriptFormat, AssetsOptions as AssetsOptions$1, ConfigBindingFieldName,
|
|
1
|
+
import { Rule as Rule$1, CfModule, Environment as Environment$1, Entry, CfModuleType, ApiCredentials, Config as Config$1, Binding, DurableObjectMigration as DurableObjectMigration$1, ContainerApp as ContainerApp$1, Trigger, CfTailConsumer, ServiceFetch, ContainerEngine as ContainerEngine$1, CfUnsafe, CfScriptFormat, AssetsOptions as AssetsOptions$1, ConfigBindingFieldName, RawConfig as RawConfig$1, NormalizeAndValidateConfigArgs, ResolveConfigPathOptions, PackageJSON, ParseError, ComplianceConfig, UserError, FatalError } from '@cloudflare/workers-utils';
|
|
2
2
|
export { Binding, experimental_patchConfig, experimental_readRawConfig, defaultWranglerConfig as unstable_defaultWranglerConfig } from '@cloudflare/workers-utils';
|
|
3
|
-
import { Json as Json$1, WorkerRegistry, Miniflare, MiniflareOptions, Mutex, Response as Response$1, NodeJSCompatMode, DispatchFetch, RemoteProxyConnectionString, WorkerOptions, ModuleRule, Request } from 'miniflare';
|
|
3
|
+
import { Json as Json$1, WorkerRegistry, Miniflare, MiniflareOptions, Mutex, Response as Response$1, NodeJSCompatMode, WorkerdStructuredLog, DispatchFetch, RemoteProxyConnectionString, WorkerOptions, ModuleRule, Request } from 'miniflare';
|
|
4
4
|
import * as undici from 'undici';
|
|
5
5
|
import { RequestInfo, RequestInit, Response, FormData } from 'undici';
|
|
6
6
|
import { Metafile } from 'esbuild';
|
|
7
7
|
import Protocol from 'devtools-protocol/types/protocol-mapping';
|
|
8
8
|
import { EventEmitter } from 'node:events';
|
|
9
9
|
import { ContainerNormalizedConfig } from '@cloudflare/containers-shared';
|
|
10
|
+
import { FetcherScheduledOptions, FetcherScheduledResult, IncomingRequestCfProperties } from '@cloudflare/workers-types/experimental';
|
|
10
11
|
import { RouterConfig, AssetConfig } from '@cloudflare/workers-shared';
|
|
11
|
-
import { IncomingRequestCfProperties } from '@cloudflare/workers-types/experimental';
|
|
12
12
|
import { URLSearchParams } from 'node:url';
|
|
13
13
|
import { Argv, PositionalOptions, Options, ArgumentsCamelCase, InferredOptionTypes, InferredOptionType } from 'yargs';
|
|
14
14
|
import Cloudflare from 'cloudflare';
|
|
@@ -192,13 +192,13 @@ declare function deploy({ directory, accountId, projectName, branch, skipCaching
|
|
|
192
192
|
};
|
|
193
193
|
};
|
|
194
194
|
latest_stage: {
|
|
195
|
-
status: "skipped" | "active" | "canceled" | "
|
|
195
|
+
status: "skipped" | "active" | "canceled" | "idle" | "success" | "failure";
|
|
196
196
|
name: "build" | "queued" | "deploy" | "initialize" | "clone_repo";
|
|
197
197
|
started_on: string | null;
|
|
198
198
|
ended_on: string | null;
|
|
199
199
|
};
|
|
200
200
|
stages: {
|
|
201
|
-
status: "skipped" | "active" | "canceled" | "
|
|
201
|
+
status: "skipped" | "active" | "canceled" | "idle" | "success" | "failure";
|
|
202
202
|
name: "build" | "queued" | "deploy" | "initialize" | "clone_repo";
|
|
203
203
|
started_on: string | null;
|
|
204
204
|
ended_on: string | null;
|
|
@@ -470,6 +470,7 @@ declare abstract class RuntimeController extends Controller {
|
|
|
470
470
|
abstract onBundleStart(_: BundleStartEvent): void;
|
|
471
471
|
abstract onBundleComplete(_: BundleCompleteEvent): void;
|
|
472
472
|
abstract onPreviewTokenExpired(_: PreviewTokenExpiredEvent): void;
|
|
473
|
+
abstract get mf(): Miniflare | undefined;
|
|
473
474
|
protected emitReloadStartEvent(data: ReloadStartEvent): void;
|
|
474
475
|
protected emitReloadCompleteEvent(data: ReloadCompleteEvent): void;
|
|
475
476
|
protected emitDevRegistryUpdateEvent(data: DevRegistryUpdateEvent): void;
|
|
@@ -582,8 +583,8 @@ interface StartDevWorkerInput {
|
|
|
582
583
|
* This is the `main` property of a Wrangler configuration file.
|
|
583
584
|
*/
|
|
584
585
|
entrypoint?: string;
|
|
585
|
-
/** The configuration path of the worker. */
|
|
586
|
-
config?: string;
|
|
586
|
+
/** The configuration path of the worker, or a normalized configuration object. */
|
|
587
|
+
config?: string | Config$1;
|
|
587
588
|
/** The compatibility date for the workerd runtime. */
|
|
588
589
|
compatibilityDate?: string;
|
|
589
590
|
/** The compatibility flags for the workerd runtime. */
|
|
@@ -696,11 +697,15 @@ interface StartDevWorkerInput {
|
|
|
696
697
|
};
|
|
697
698
|
/** A hook for outbound fetch calls from within the worker. */
|
|
698
699
|
outboundService?: ServiceFetch;
|
|
700
|
+
/** Handles structured runtime logs. */
|
|
701
|
+
structuredLogsHandler?: (log: WorkerdStructuredLog) => void;
|
|
699
702
|
/** An undici MockAgent to declaratively mock fetch calls to particular resources. */
|
|
700
703
|
mockFetch?: undici.MockAgent;
|
|
701
704
|
testScheduled?: boolean;
|
|
702
705
|
/** Treat this as the primary worker in a multiworker setup (i.e. the first Worker in Miniflare's options) */
|
|
703
706
|
multiworkerPrimary?: boolean;
|
|
707
|
+
/** Whether to infer the local request origin from configured routes. */
|
|
708
|
+
inferOriginFromRoutes?: boolean;
|
|
704
709
|
containerBuildId?: string;
|
|
705
710
|
/** Whether to build and connect to containers during local dev. Requires Docker daemon to be running. Defaults to true. */
|
|
706
711
|
enableContainers?: boolean;
|
|
@@ -726,7 +731,9 @@ interface StartDevWorkerInput {
|
|
|
726
731
|
assets?: string;
|
|
727
732
|
experimental?: Record<string, never>;
|
|
728
733
|
}
|
|
729
|
-
type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets" | "containers" | "dev"> & {
|
|
734
|
+
type StartDevWorkerOptions = Omit<StartDevWorkerInput, "assets" | "config" | "containers" | "dev"> & {
|
|
735
|
+
/** The configuration path of the worker */
|
|
736
|
+
config?: string;
|
|
730
737
|
/** A worker's directory. Usually where the Wrangler configuration file is located */
|
|
731
738
|
projectRoot: string;
|
|
732
739
|
build: StartDevWorkerInput["build"] & {
|
|
@@ -768,6 +775,169 @@ declare function convertConfigBindingsToStartWorkerBindings(configBindings: Part
|
|
|
768
775
|
|
|
769
776
|
declare function startWorker(options: StartDevWorkerInput): Promise<Worker>;
|
|
770
777
|
|
|
778
|
+
type TestHarnessOptions = {
|
|
779
|
+
/**
|
|
780
|
+
* Base directory used to resolve relative worker config paths.
|
|
781
|
+
* Defaults to `process.cwd()`.
|
|
782
|
+
*/
|
|
783
|
+
root?: string | undefined;
|
|
784
|
+
/**
|
|
785
|
+
* Workers to run in this server. The first worker is the primary worker.
|
|
786
|
+
*/
|
|
787
|
+
workers: WorkerInput[];
|
|
788
|
+
};
|
|
789
|
+
type WorkerHandle = {
|
|
790
|
+
/**
|
|
791
|
+
* Dispatches a fetch event directly to this worker.
|
|
792
|
+
* Relative URL inputs are resolved against the URL returned by `listen()`.
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* ```ts
|
|
796
|
+
* const response = await worker.fetch("/", {
|
|
797
|
+
* method: "POST",
|
|
798
|
+
* body: "Hello, world!"
|
|
799
|
+
* });
|
|
800
|
+
* ```
|
|
801
|
+
*/
|
|
802
|
+
fetch: DispatchFetch;
|
|
803
|
+
/**
|
|
804
|
+
* Dispatches a scheduled event directly to this Worker.
|
|
805
|
+
*
|
|
806
|
+
* @example
|
|
807
|
+
* ```ts
|
|
808
|
+
* const result = await worker.scheduled({
|
|
809
|
+
* cron: "0 * * * *",
|
|
810
|
+
* scheduledTime: new Date(),
|
|
811
|
+
* });
|
|
812
|
+
* ```
|
|
813
|
+
*/
|
|
814
|
+
scheduled(options: FetcherScheduledOptions): Promise<FetcherScheduledResult>;
|
|
815
|
+
};
|
|
816
|
+
type TestHarness = {
|
|
817
|
+
/**
|
|
818
|
+
* Starts the server and returns its current URL.
|
|
819
|
+
* Calling this more than once returns the same running server session until
|
|
820
|
+
* the server is closed or reset.
|
|
821
|
+
*
|
|
822
|
+
* If no options were passed to `createTestHarness()`, call `update(options)`
|
|
823
|
+
* before starting the server.
|
|
824
|
+
*/
|
|
825
|
+
listen(): Promise<{
|
|
826
|
+
url: URL;
|
|
827
|
+
}>;
|
|
828
|
+
/**
|
|
829
|
+
* Dispatches a fetch request through the server.
|
|
830
|
+
*
|
|
831
|
+
* - Relative URLs are resolved against the current server URL. Absolute URLs
|
|
832
|
+
* are also accepted, and can be used to control the hostname seen by the Worker.
|
|
833
|
+
* - Requests are matched against each Worker's configured routes and dispatched to
|
|
834
|
+
* the first matching Worker, or to the primary Worker if no routes match.
|
|
835
|
+
* - To dispatch directly to a specific Worker, use `server.getWorker(name).fetch()`.
|
|
836
|
+
*
|
|
837
|
+
* @example
|
|
838
|
+
* ```ts
|
|
839
|
+
* const server = createTestHarness({
|
|
840
|
+
* workers: [
|
|
841
|
+
* { configPath: "./wrangler.dashboard.jsonc" }, // No route pattern
|
|
842
|
+
* { configPath: "./wrangler.api.jsonc" }, // Route pattern: "example.com/api/*"
|
|
843
|
+
* { configPath: "./wrangler.admin.jsonc" }, // Route pattern: "admin.example.com/*"
|
|
844
|
+
* ]
|
|
845
|
+
* });
|
|
846
|
+
*
|
|
847
|
+
* await server.fetch("/users");
|
|
848
|
+
* // Dispatches a request to the dashboard Worker (the first Worker) with URL "http://localhost:{port}/users"
|
|
849
|
+
*
|
|
850
|
+
* await server.fetch("http://admin.example.com/accounts");
|
|
851
|
+
* // Dispatches a request to the admin Worker with URL "http://admin.example.com/accounts"
|
|
852
|
+
*
|
|
853
|
+
* await server.fetch("http://example.com/api/data");
|
|
854
|
+
* // Dispatches a request to the API Worker with URL "http://example.com/api/data"
|
|
855
|
+
* ```
|
|
856
|
+
*/
|
|
857
|
+
fetch: DispatchFetch;
|
|
858
|
+
/**
|
|
859
|
+
* Returns a handle for dispatching events directly to a Worker.
|
|
860
|
+
* When no name is provided, this returns the primary Worker, which is the first
|
|
861
|
+
* Worker in the server's `workers` options.
|
|
862
|
+
*/
|
|
863
|
+
getWorker(name?: string): WorkerHandle;
|
|
864
|
+
/**
|
|
865
|
+
* Returns captured Workers runtime logs since the current server session
|
|
866
|
+
* started or `clearLogs()` was last called.
|
|
867
|
+
*/
|
|
868
|
+
getLogs(): WorkerdStructuredLog[];
|
|
869
|
+
/**
|
|
870
|
+
* Clears captured Workers runtime logs.
|
|
871
|
+
*/
|
|
872
|
+
clearLogs(): void;
|
|
873
|
+
/**
|
|
874
|
+
* Prints a diagnostic timeline for this test server.
|
|
875
|
+
*
|
|
876
|
+
* Use this to trace the sequence of server events and Workers runtime logs
|
|
877
|
+
* leading up to a test failure. Call `server.debug()` from your test runner's
|
|
878
|
+
* failure or cleanup hook when the current test has failed.
|
|
879
|
+
*/
|
|
880
|
+
debug(): void;
|
|
881
|
+
/**
|
|
882
|
+
* Updates the server configuration and reloads the running Workers.
|
|
883
|
+
*
|
|
884
|
+
* If the server has not started yet, this configures the options that will be
|
|
885
|
+
* used by `listen()`.
|
|
886
|
+
*/
|
|
887
|
+
update(options: TestHarnessOptions | ((currentOptions: TestHarnessOptions) => TestHarnessOptions)): Promise<void>;
|
|
888
|
+
/**
|
|
889
|
+
* Restores the server to the options used when the current session first
|
|
890
|
+
* started. Storage is recreated, and the server URL may change after reset.
|
|
891
|
+
*/
|
|
892
|
+
reset(): Promise<void>;
|
|
893
|
+
/**
|
|
894
|
+
* Stops the server and releases all runtime resources.
|
|
895
|
+
*/
|
|
896
|
+
close(): Promise<void>;
|
|
897
|
+
};
|
|
898
|
+
type InlineConfig = Omit<RawConfig$1, "env">;
|
|
899
|
+
type WorkerInput = {
|
|
900
|
+
/**
|
|
901
|
+
* Path to a Wrangler config file for this Worker.
|
|
902
|
+
* Relative paths resolve from server `root`.
|
|
903
|
+
*/
|
|
904
|
+
configPath: string | URL;
|
|
905
|
+
/**
|
|
906
|
+
* Wrangler environment to load from the config file.
|
|
907
|
+
*/
|
|
908
|
+
env?: string;
|
|
909
|
+
/**
|
|
910
|
+
* Test-only vars that override vars from the Wrangler config.
|
|
911
|
+
*/
|
|
912
|
+
vars?: Record<string, Json$1>;
|
|
913
|
+
/**
|
|
914
|
+
* Test-only secrets that override values loaded from `.dev.vars` and `.env` files.
|
|
915
|
+
*/
|
|
916
|
+
secrets?: Record<string, string>;
|
|
917
|
+
} | {
|
|
918
|
+
/**
|
|
919
|
+
* Inline Wrangler config for this Worker.
|
|
920
|
+
*/
|
|
921
|
+
config: InlineConfig;
|
|
922
|
+
};
|
|
923
|
+
/**
|
|
924
|
+
* Creates a local test server for running Workers.
|
|
925
|
+
*
|
|
926
|
+
* The server can run one or more Workers from Wrangler config files, including
|
|
927
|
+
* generated configs from Vite, or from inline configuration objects.
|
|
928
|
+
*
|
|
929
|
+
* @example
|
|
930
|
+
* ```ts
|
|
931
|
+
* const server = createTestHarness({
|
|
932
|
+
* workers: [{ configPath: "./wrangler.jsonc" }],
|
|
933
|
+
* });
|
|
934
|
+
* await server.listen();
|
|
935
|
+
* const response = await server.fetch("/api/users");
|
|
936
|
+
* await server.close();
|
|
937
|
+
* ```
|
|
938
|
+
*/
|
|
939
|
+
declare function createTestHarness(options?: TestHarnessOptions): TestHarness;
|
|
940
|
+
|
|
771
941
|
type ReadConfigCommandArgs = NormalizeAndValidateConfigArgs & {
|
|
772
942
|
config?: string;
|
|
773
943
|
script?: string;
|
|
@@ -850,6 +1020,14 @@ type AssetsOptions = {
|
|
|
850
1020
|
run_worker_first?: boolean | string[];
|
|
851
1021
|
};
|
|
852
1022
|
|
|
1023
|
+
/**
|
|
1024
|
+
* Wrangler configuration types. The JSDoc on these fields is also the source
|
|
1025
|
+
* of truth for the equivalent fields in `@cloudflare/config`
|
|
1026
|
+
* (`packages/config/src/types.ts` — `UserConfig` — and the binding option
|
|
1027
|
+
* interfaces in `packages/config/src/config.ts`). When editing prose here,
|
|
1028
|
+
* mirror the changes there.
|
|
1029
|
+
*/
|
|
1030
|
+
|
|
853
1031
|
/**
|
|
854
1032
|
* The `Environment` interface declares all the configuration fields that
|
|
855
1033
|
* can be specified for an environment.
|
|
@@ -1737,6 +1915,21 @@ interface EnvironmentNonInheritable {
|
|
|
1737
1915
|
migrations_table?: string;
|
|
1738
1916
|
/** The path to the directory of migrations for this D1 database (defaults to './migrations'). */
|
|
1739
1917
|
migrations_dir?: string;
|
|
1918
|
+
/**
|
|
1919
|
+
* A glob pattern (relative to the Wrangler config file) used to discover
|
|
1920
|
+
* migration files for this D1 database. Defaults to `${migrations_dir}/*.sql`
|
|
1921
|
+
* if not specified.
|
|
1922
|
+
*
|
|
1923
|
+
* Use this to opt in to nested layouts such as `migrations/*\/migration.sql`
|
|
1924
|
+
* (as produced by some ORMs).
|
|
1925
|
+
*
|
|
1926
|
+
* When `migrations_pattern` is set, `migrations_dir` must also be set, and
|
|
1927
|
+
* `migrations_pattern` must start with `${migrations_dir}/`. This keeps the
|
|
1928
|
+
* relationship between the two settings explicit and lets Wrangler record
|
|
1929
|
+
* each migration's name in the migrations table as a path relative to
|
|
1930
|
+
* `migrations_dir`.
|
|
1931
|
+
*/
|
|
1932
|
+
migrations_pattern?: string;
|
|
1740
1933
|
/** Internal use only. */
|
|
1741
1934
|
database_internal_env?: string;
|
|
1742
1935
|
/** Whether the D1 database should be remote or not in local development */
|
|
@@ -1825,7 +2018,7 @@ interface EnvironmentNonInheritable {
|
|
|
1825
2018
|
* @default {}
|
|
1826
2019
|
* @nonInheritable
|
|
1827
2020
|
*/
|
|
1828
|
-
|
|
2021
|
+
websearch: {
|
|
1829
2022
|
/** The binding name used to refer to Web Search in the Worker. */
|
|
1830
2023
|
binding: string;
|
|
1831
2024
|
/** Whether the Web Search binding should be remote or not in local development */
|
|
@@ -3068,6 +3261,24 @@ declare function runAutoConfig(autoConfigDetails: AutoConfigDetails, autoConfigO
|
|
|
3068
3261
|
* Make a fetch request, and extract the `result` from the JSON response.
|
|
3069
3262
|
*/
|
|
3070
3263
|
declare function fetchResult<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams, abortSignal?: AbortSignal, apiToken?: ApiCredentials): Promise<ResponseType>;
|
|
3264
|
+
/**
|
|
3265
|
+
* Make a fetch request for a list of values,
|
|
3266
|
+
* extracting the `result` from the JSON response,
|
|
3267
|
+
* and repeating the request if the results are paginated.
|
|
3268
|
+
*/
|
|
3269
|
+
declare function fetchListResult<ResponseType>(complianceConfig: ComplianceConfig, resource: string, init?: RequestInit, queryParams?: URLSearchParams): Promise<ResponseType[]>;
|
|
3270
|
+
|
|
3271
|
+
interface ConfirmOptions {
|
|
3272
|
+
defaultValue?: boolean;
|
|
3273
|
+
fallbackValue?: boolean;
|
|
3274
|
+
}
|
|
3275
|
+
declare function confirm(text: string, { defaultValue, fallbackValue }?: ConfirmOptions): Promise<boolean>;
|
|
3276
|
+
interface PromptOptions {
|
|
3277
|
+
defaultValue?: string;
|
|
3278
|
+
isSecret?: boolean;
|
|
3279
|
+
validate?: (value: string) => boolean | string | Promise<boolean | string>;
|
|
3280
|
+
}
|
|
3281
|
+
declare function prompt(text: string, options?: PromptOptions): Promise<string>;
|
|
3071
3282
|
|
|
3072
3283
|
type ExperimentalFlags = {
|
|
3073
3284
|
MULTIWORKER: boolean;
|
|
@@ -3183,6 +3394,16 @@ type HandlerContext = {
|
|
|
3183
3394
|
* Use fetchResult to make *auth'd* requests to the Cloudflare API.
|
|
3184
3395
|
*/
|
|
3185
3396
|
fetchResult: typeof fetchResult;
|
|
3397
|
+
fetchListResult: typeof fetchListResult;
|
|
3398
|
+
/**
|
|
3399
|
+
* Interactive prompts
|
|
3400
|
+
*/
|
|
3401
|
+
confirm: typeof confirm;
|
|
3402
|
+
prompt: typeof prompt;
|
|
3403
|
+
/**
|
|
3404
|
+
* Whether the process is non-interactive or running in CI.
|
|
3405
|
+
*/
|
|
3406
|
+
isNonInteractiveOrCI: () => boolean;
|
|
3186
3407
|
/**
|
|
3187
3408
|
* Error classes provided to the command implementor as a convenience
|
|
3188
3409
|
* to aid discoverability and to encourage their usage.
|
|
@@ -3455,4 +3676,4 @@ interface Unstable_ASSETSBindingsOptions {
|
|
|
3455
3676
|
}
|
|
3456
3677
|
declare const unstable_generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request) => Promise<Response$1>;
|
|
3457
3678
|
|
|
3458
|
-
export { type Experimental_GenerateTypesOptions, type Experimental_GenerateTypesResult, type GetPlatformProxyOptions, type PlatformProxy, type RemoteProxySession, type SourcelessWorkerOptions, type StartRemoteProxySessionOptions, type Unstable_ASSETSBindingsOptions, type Config as Unstable_Config, type Unstable_DevOptions, type Unstable_DevWorker, type Unstable_MiniflareWorkerOptions, type RawConfig as Unstable_RawConfig, type RawEnvironment as Unstable_RawEnvironment, Framework as experimental_AutoConfigFramework, generateTypes as experimental_generateTypes, getDetailsForAutoConfig as experimental_getDetailsForAutoConfig, experimental_getWranglerCommands, runAutoConfig as experimental_runAutoConfig, getPlatformProxy, maybeStartOrUpdateRemoteProxySession, startRemoteProxySession, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, unstable_generateASSETSBinding, unstable_getDevCompatibilityDate, getDurableObjectClassNameToUseSQLiteMap as unstable_getDurableObjectClassNameToUseSQLiteMap, unstable_getMiniflareWorkerOptions, getVarsForDev as unstable_getVarsForDev, getWorkerNameFromProject as unstable_getWorkerNameFromProject, unstable_pages, printBindings as unstable_printBindings, readConfig as unstable_readConfig, resolveNamedTunnel as unstable_resolveNamedTunnel, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };
|
|
3679
|
+
export { type Experimental_GenerateTypesOptions, type Experimental_GenerateTypesResult, type GetPlatformProxyOptions, type PlatformProxy, type RemoteProxySession, type SourcelessWorkerOptions, type StartRemoteProxySessionOptions, type TestHarness, type TestHarnessOptions, type Unstable_ASSETSBindingsOptions, type Config as Unstable_Config, type Unstable_DevOptions, type Unstable_DevWorker, type Unstable_MiniflareWorkerOptions, type RawConfig as Unstable_RawConfig, type RawEnvironment as Unstable_RawEnvironment, type WorkerHandle, createTestHarness, Framework as experimental_AutoConfigFramework, generateTypes as experimental_generateTypes, getDetailsForAutoConfig as experimental_getDetailsForAutoConfig, experimental_getWranglerCommands, runAutoConfig as experimental_runAutoConfig, getPlatformProxy, maybeStartOrUpdateRemoteProxySession, startRemoteProxySession, DevEnv as unstable_DevEnv, convertConfigBindingsToStartWorkerBindings as unstable_convertConfigBindingsToStartWorkerBindings, unstable_dev, unstable_generateASSETSBinding, unstable_getDevCompatibilityDate, getDurableObjectClassNameToUseSQLiteMap as unstable_getDurableObjectClassNameToUseSQLiteMap, unstable_getMiniflareWorkerOptions, getVarsForDev as unstable_getVarsForDev, getWorkerNameFromProject as unstable_getWorkerNameFromProject, unstable_pages, printBindings as unstable_printBindings, readConfig as unstable_readConfig, resolveNamedTunnel as unstable_resolveNamedTunnel, splitSqlQuery as unstable_splitSqlQuery, startWorker as unstable_startWorker };
|