wrangler 0.0.0-e6c9c5c0 → 0.0.0-e6ddf8a7
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/README.md +12 -14
- package/bin/wrangler.js +14 -75
- package/package.json +210 -194
- package/templates/__tests__/tsconfig.json +1 -1
- package/templates/checked-fetch.js +19 -4
- package/templates/facade.d.ts +4 -1
- package/templates/gitignore +1 -0
- package/templates/middleware/common.ts +9 -4
- package/templates/middleware/loader-modules.ts +64 -11
- package/templates/middleware/loader-sw.ts +2 -7
- package/templates/middleware/middleware-d1-beta.d.ts +3 -0
- package/templates/middleware/middleware-miniflare3-json-error.ts +18 -5
- package/templates/middleware/middleware-multiworker-dev.d.ts +4 -0
- package/templates/middleware/middleware-multiworker-dev.ts +68 -0
- package/templates/middleware/middleware-serve-static-assets.d.ts +6 -0
- package/templates/middleware/middleware-serve-static-assets.ts +56 -0
- package/templates/modules-watch-stub.js +4 -0
- package/templates/new-worker-scheduled.ts +1 -1
- package/templates/new-worker.ts +4 -1
- package/templates/pages-dev-util.ts +4 -1
- package/templates/pages-shim.ts +0 -3
- package/templates/pages-template-plugin.ts +19 -5
- package/templates/pages-template-worker.ts +11 -2
- package/templates/tsconfig.init.json +1 -2
- package/templates/tsconfig.json +1 -1
- package/wrangler-dist/cli.d.ts +842 -128
- package/wrangler-dist/cli.js +110076 -103044
- package/wrangler-dist/wasm-sync.wasm +0 -0
- package/import_meta_url.js +0 -3
- package/miniflare-config-stubs/.env.empty +0 -0
- package/miniflare-config-stubs/package.empty.json +0 -1
- package/miniflare-config-stubs/wrangler.empty.toml +0 -0
- package/miniflare-dist/index.mjs +0 -6364
- package/src/__tests__/access.test.ts +0 -25
- package/src/__tests__/api-dev.test.ts +0 -238
- package/src/__tests__/api-devregistry.test.js +0 -64
- package/src/__tests__/api.test.ts +0 -80
- package/src/__tests__/config-cache-without-cache-dir.test.ts +0 -38
- package/src/__tests__/config-cache.test.ts +0 -42
- package/src/__tests__/configuration.test.ts +0 -4163
- package/src/__tests__/d1/d1.test.ts +0 -127
- package/src/__tests__/d1/splitter.test.ts +0 -255
- package/src/__tests__/delete.test.ts +0 -266
- package/src/__tests__/deployments.test.ts +0 -105
- package/src/__tests__/dev.test.tsx +0 -1586
- package/src/__tests__/generate.test.ts +0 -238
- package/src/__tests__/get-host-from-url.test.ts +0 -16
- package/src/__tests__/guess-worker-format.test.ts +0 -85
- package/src/__tests__/helpers/clipboardy-mock.js +0 -4
- package/src/__tests__/helpers/cmd-shim.d.ts +0 -11
- package/src/__tests__/helpers/mock-account-id.ts +0 -48
- package/src/__tests__/helpers/mock-auth-domain.ts +0 -20
- package/src/__tests__/helpers/mock-bin.ts +0 -36
- package/src/__tests__/helpers/mock-console.ts +0 -106
- package/src/__tests__/helpers/mock-dialogs.ts +0 -139
- package/src/__tests__/helpers/mock-get-zone-from-host.ts +0 -11
- package/src/__tests__/helpers/mock-http-server.ts +0 -46
- package/src/__tests__/helpers/mock-istty.ts +0 -74
- package/src/__tests__/helpers/mock-known-routes.ts +0 -12
- package/src/__tests__/helpers/mock-kv.ts +0 -46
- package/src/__tests__/helpers/mock-oauth-flow.ts +0 -263
- package/src/__tests__/helpers/mock-process.ts +0 -34
- package/src/__tests__/helpers/mock-stdin.ts +0 -108
- package/src/__tests__/helpers/mock-web-socket.ts +0 -29
- package/src/__tests__/helpers/msw/blob-worker.cjs +0 -19
- package/src/__tests__/helpers/msw/handlers/access.ts +0 -13
- package/src/__tests__/helpers/msw/handlers/deployments.ts +0 -69
- package/src/__tests__/helpers/msw/handlers/namespaces.ts +0 -81
- package/src/__tests__/helpers/msw/handlers/oauth.ts +0 -31
- package/src/__tests__/helpers/msw/handlers/r2.ts +0 -60
- package/src/__tests__/helpers/msw/handlers/script.ts +0 -56
- package/src/__tests__/helpers/msw/handlers/user.ts +0 -52
- package/src/__tests__/helpers/msw/handlers/zones.ts +0 -20
- package/src/__tests__/helpers/msw/index.ts +0 -50
- package/src/__tests__/helpers/msw/read-file-sync.js +0 -61
- package/src/__tests__/helpers/run-in-tmp.ts +0 -38
- package/src/__tests__/helpers/run-wrangler.ts +0 -16
- package/src/__tests__/helpers/worker-scripts/child-wrangler.toml +0 -1
- package/src/__tests__/helpers/worker-scripts/hello-world-worker.js +0 -5
- package/src/__tests__/helpers/worker-scripts/hello-world-wrangler.toml +0 -1
- package/src/__tests__/helpers/worker-scripts/parent-worker.js +0 -8
- package/src/__tests__/helpers/worker-scripts/parent-wrangler.toml +0 -5
- package/src/__tests__/helpers/write-worker-source.ts +0 -31
- package/src/__tests__/helpers/write-wrangler-toml.ts +0 -17
- package/src/__tests__/https-options.test.ts +0 -163
- package/src/__tests__/index.test.ts +0 -268
- package/src/__tests__/init.test.ts +0 -3164
- package/src/__tests__/jest.setup.ts +0 -175
- package/src/__tests__/kv.test.ts +0 -1788
- package/src/__tests__/logger.test.ts +0 -141
- package/src/__tests__/logout.test.ts +0 -47
- package/src/__tests__/metrics.test.ts +0 -493
- package/src/__tests__/middleware.scheduled.test.ts +0 -145
- package/src/__tests__/middleware.test.ts +0 -750
- package/src/__tests__/package-manager.test.ts +0 -353
- package/src/__tests__/pages-deployment-tail.test.ts +0 -955
- package/src/__tests__/pages.test.ts +0 -2898
- package/src/__tests__/parse.test.ts +0 -330
- package/src/__tests__/paths.test.ts +0 -39
- package/src/__tests__/publish.test.ts +0 -8117
- package/src/__tests__/pubsub.test.ts +0 -490
- package/src/__tests__/queues.test.ts +0 -522
- package/src/__tests__/r2.test.ts +0 -369
- package/src/__tests__/route.test.ts +0 -45
- package/src/__tests__/secret.test.ts +0 -693
- package/src/__tests__/tail.test.ts +0 -958
- package/src/__tests__/test-old-node-version.js +0 -31
- package/src/__tests__/tsconfig-sanity.ts +0 -12
- package/src/__tests__/tsconfig.json +0 -8
- package/src/__tests__/tsconfig.tsbuildinfo +0 -1
- package/src/__tests__/type-generation.test.ts +0 -233
- package/src/__tests__/user.test.ts +0 -118
- package/src/__tests__/utils-collectKeyValues.test.ts +0 -47
- package/src/__tests__/validate-dev-props.test.ts +0 -56
- package/src/__tests__/version.test.ts +0 -35
- package/src/__tests__/whoami.test.tsx +0 -172
- package/src/__tests__/worker-namespace.test.ts +0 -334
- package/src/abort.d.ts +0 -3
- package/src/api/dev.ts +0 -259
- package/src/api/index.ts +0 -3
- package/src/api/pages/index.ts +0 -5
- package/src/api/pages/publish.tsx +0 -321
- package/src/bundle-reporter.ts +0 -68
- package/src/bundle.ts +0 -875
- package/src/cfetch/index.ts +0 -158
- package/src/cfetch/internal.ts +0 -258
- package/src/cli.ts +0 -28
- package/src/config/README.md +0 -107
- package/src/config/config.ts +0 -275
- package/src/config/diagnostics.ts +0 -80
- package/src/config/environment.ts +0 -579
- package/src/config/index.ts +0 -358
- package/src/config/validation-helpers.ts +0 -597
- package/src/config/validation.ts +0 -2151
- package/src/config-cache.ts +0 -85
- package/src/create-worker-preview.ts +0 -282
- package/src/create-worker-upload-form.ts +0 -325
- package/src/d1/backups.tsx +0 -219
- package/src/d1/constants.ts +0 -2
- package/src/d1/create.tsx +0 -63
- package/src/d1/delete.ts +0 -56
- package/src/d1/execute.tsx +0 -323
- package/src/d1/formatTimeAgo.ts +0 -14
- package/src/d1/index.ts +0 -101
- package/src/d1/list.tsx +0 -48
- package/src/d1/migrations/apply.tsx +0 -197
- package/src/d1/migrations/create.tsx +0 -77
- package/src/d1/migrations/helpers.ts +0 -147
- package/src/d1/migrations/index.ts +0 -3
- package/src/d1/migrations/list.tsx +0 -79
- package/src/d1/migrations/options.ts +0 -18
- package/src/d1/options.ts +0 -22
- package/src/d1/splitter.ts +0 -161
- package/src/d1/types.ts +0 -24
- package/src/d1/utils.ts +0 -48
- package/src/delete.ts +0 -103
- package/src/deployments.ts +0 -93
- package/src/deprecated/index.ts +0 -145
- package/src/dev/dev-vars.ts +0 -39
- package/src/dev/dev.tsx +0 -614
- package/src/dev/get-local-persistence-path.ts +0 -31
- package/src/dev/local.tsx +0 -923
- package/src/dev/remote.tsx +0 -632
- package/src/dev/start-server.ts +0 -538
- package/src/dev/use-esbuild.ts +0 -205
- package/src/dev/validate-dev-props.ts +0 -31
- package/src/dev-registry.ts +0 -201
- package/src/dev.tsx +0 -949
- package/src/dialogs.ts +0 -136
- package/src/dispatch-namespace.ts +0 -207
- package/src/docs/index.ts +0 -98
- package/src/durable.ts +0 -102
- package/src/entry.ts +0 -328
- package/src/environment-variables/factory.ts +0 -88
- package/src/environment-variables/misc-variables.ts +0 -30
- package/src/errors.ts +0 -11
- package/src/generate/index.ts +0 -300
- package/src/git-client.ts +0 -135
- package/src/global-wrangler-config-path.ts +0 -26
- package/src/https-options.ts +0 -127
- package/src/index.ts +0 -694
- package/src/init.ts +0 -1024
- package/src/inspect.ts +0 -767
- package/src/intl-polyfill.d.ts +0 -139
- package/src/is-ci.ts +0 -14
- package/src/is-interactive.ts +0 -16
- package/src/jest.d.ts +0 -4
- package/src/kv/helpers.ts +0 -430
- package/src/kv/index.ts +0 -596
- package/src/logger.ts +0 -104
- package/src/metrics/index.ts +0 -5
- package/src/metrics/metrics-config.ts +0 -239
- package/src/metrics/metrics-dispatcher.ts +0 -96
- package/src/metrics/metrics-usage-headers.ts +0 -24
- package/src/metrics/send-event.ts +0 -98
- package/src/miniflare-cli/README.md +0 -30
- package/src/miniflare-cli/assets.ts +0 -250
- package/src/miniflare-cli/index.ts +0 -210
- package/src/miniflare-cli/request-context.ts +0 -40
- package/src/miniflare-cli/tsconfig.json +0 -9
- package/src/miniflare-cli/tsconfig.tsbuildinfo +0 -1
- package/src/miniflare-cli/types.ts +0 -11
- package/src/module-collection.ts +0 -267
- package/src/open-in-browser.ts +0 -17
- package/src/package-manager.ts +0 -219
- package/src/pages/build.ts +0 -150
- package/src/pages/buildFunctions.ts +0 -129
- package/src/pages/constants.ts +0 -18
- package/src/pages/deployment-tails.ts +0 -284
- package/src/pages/deployments.tsx +0 -84
- package/src/pages/dev.ts +0 -716
- package/src/pages/errors.ts +0 -66
- package/src/pages/functions/buildPlugin.ts +0 -90
- package/src/pages/functions/buildWorker.ts +0 -288
- package/src/pages/functions/filepath-routing.test.ts +0 -234
- package/src/pages/functions/filepath-routing.ts +0 -189
- package/src/pages/functions/identifiers.ts +0 -78
- package/src/pages/functions/routes-consolidation.test.ts +0 -250
- package/src/pages/functions/routes-consolidation.ts +0 -73
- package/src/pages/functions/routes-transformation.test.ts +0 -282
- package/src/pages/functions/routes-transformation.ts +0 -115
- package/src/pages/functions/routes-validation.test.ts +0 -403
- package/src/pages/functions/routes-validation.ts +0 -202
- package/src/pages/functions/routes.ts +0 -151
- package/src/pages/functions/tsconfig.json +0 -8
- package/src/pages/functions/tsconfig.tsbuildinfo +0 -1
- package/src/pages/functions.ts +0 -82
- package/src/pages/hash.ts +0 -13
- package/src/pages/index.ts +0 -102
- package/src/pages/projects.tsx +0 -167
- package/src/pages/prompt-select-project.tsx +0 -31
- package/src/pages/publish.tsx +0 -263
- package/src/pages/types.ts +0 -41
- package/src/pages/upload.tsx +0 -447
- package/src/pages/utils.ts +0 -23
- package/src/parse.ts +0 -286
- package/src/paths.ts +0 -71
- package/src/proxy.ts +0 -694
- package/src/publish/index.ts +0 -270
- package/src/publish/publish.ts +0 -1064
- package/src/pubsub/index.ts +0 -286
- package/src/pubsub/pubsub-commands.ts +0 -624
- package/src/queues/cli/commands/consumer/add.ts +0 -71
- package/src/queues/cli/commands/consumer/index.ts +0 -22
- package/src/queues/cli/commands/consumer/remove.ts +0 -38
- package/src/queues/cli/commands/create.ts +0 -25
- package/src/queues/cli/commands/delete.ts +0 -26
- package/src/queues/cli/commands/index.ts +0 -36
- package/src/queues/cli/commands/list.ts +0 -25
- package/src/queues/client.ts +0 -135
- package/src/queues/utils.ts +0 -18
- package/src/r2/constants.ts +0 -4
- package/src/r2/helpers.ts +0 -131
- package/src/r2/index.ts +0 -289
- package/src/routes.ts +0 -140
- package/src/secret/index.ts +0 -379
- package/src/selfsigned.d.ts +0 -29
- package/src/sites.ts +0 -372
- package/src/tail/createTail.ts +0 -406
- package/src/tail/filters.ts +0 -277
- package/src/tail/index.ts +0 -213
- package/src/tail/printing.ts +0 -122
- package/src/tsconfig-sanity.ts +0 -16
- package/src/type-generation.ts +0 -181
- package/src/update-check.ts +0 -19
- package/src/user/access.ts +0 -68
- package/src/user/auth-variables.ts +0 -113
- package/src/user/choose-account.tsx +0 -39
- package/src/user/generate-auth-url.ts +0 -33
- package/src/user/generate-random-state.ts +0 -16
- package/src/user/index.ts +0 -2
- package/src/user/user.ts +0 -1232
- package/src/utils/collectKeyValues.ts +0 -14
- package/src/whoami.ts +0 -135
- package/src/worker.ts +0 -251
- package/src/yargs-types.ts +0 -24
- package/src/zones.ts +0 -191
- package/templates/__tests__/tsconfig.tsbuildinfo +0 -1
- package/templates/d1-beta-facade.js +0 -241
- package/templates/first-party-worker-module-facade.ts +0 -19
- package/templates/format-dev-errors.ts +0 -33
- package/templates/serve-static-assets.ts +0 -65
- package/templates/service-bindings-module-facade.js +0 -54
- package/templates/service-bindings-sw-facade.js +0 -42
- package/templates/tsconfig.tsbuildinfo +0 -1
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
|
|
3
3
|
import { Blob as Blob_2 } from 'buffer';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
4
|
+
import { ConnectionOptions } from 'tls';
|
|
5
|
+
import { Duplex } from 'stream';
|
|
6
|
+
import { EventEmitter } from 'events';
|
|
7
|
+
import { IpcNetConnectOpts } from 'net';
|
|
8
|
+
import type { Json } from 'miniflare';
|
|
9
|
+
import { Readable } from 'stream';
|
|
10
|
+
import { ReadableStream as ReadableStream_2 } from 'stream/web';
|
|
11
|
+
import { Socket as Socket_2 } from 'net';
|
|
12
|
+
import { TcpNetConnectOpts } from 'net';
|
|
13
|
+
import { TlsOptions as TlsOptions_2 } from 'tls';
|
|
14
|
+
import { TLSSocket } from 'tls';
|
|
6
15
|
import { URL as URL_2 } from 'url';
|
|
7
16
|
import { URLSearchParams as URLSearchParams_2 } from 'url';
|
|
17
|
+
import { Writable } from 'stream';
|
|
18
|
+
|
|
19
|
+
declare type AbortSignal_2 = unknown;
|
|
8
20
|
|
|
9
21
|
declare interface BlobPropertyBag {
|
|
10
22
|
type?: string
|
|
11
23
|
endings?: 'native' | 'transparent'
|
|
12
24
|
}
|
|
13
25
|
|
|
14
|
-
declare type
|
|
26
|
+
declare type BodyInit_2 =
|
|
15
27
|
| ArrayBuffer
|
|
16
28
|
| AsyncIterable<Uint8Array>
|
|
17
29
|
| Blob_2
|
|
18
|
-
|
|
|
30
|
+
| FormData_2
|
|
19
31
|
| Iterable<Uint8Array>
|
|
20
32
|
| NodeJS.ArrayBufferView
|
|
21
33
|
| URLSearchParams_2
|
|
@@ -23,16 +35,212 @@ declare type BodyInit =
|
|
|
23
35
|
| string
|
|
24
36
|
|
|
25
37
|
declare interface BodyMixin {
|
|
26
|
-
readonly body:
|
|
38
|
+
readonly body: ReadableStream_2 | null
|
|
27
39
|
readonly bodyUsed: boolean
|
|
28
40
|
|
|
29
41
|
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
30
42
|
readonly blob: () => Promise<Blob_2>
|
|
31
|
-
readonly formData: () => Promise<
|
|
43
|
+
readonly formData: () => Promise<FormData_2>
|
|
32
44
|
readonly json: () => Promise<unknown>
|
|
33
45
|
readonly text: () => Promise<string>
|
|
34
46
|
}
|
|
35
47
|
|
|
48
|
+
declare class BodyReadable extends Readable {
|
|
49
|
+
constructor(
|
|
50
|
+
resume?: (this: Readable, size: number) => void | null,
|
|
51
|
+
abort?: () => void | null,
|
|
52
|
+
contentType?: string
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
/** Consumes and returns the body as a string
|
|
56
|
+
* https://fetch.spec.whatwg.org/#dom-body-text
|
|
57
|
+
*/
|
|
58
|
+
text(): Promise<string>
|
|
59
|
+
|
|
60
|
+
/** Consumes and returns the body as a JavaScript Object
|
|
61
|
+
* https://fetch.spec.whatwg.org/#dom-body-json
|
|
62
|
+
*/
|
|
63
|
+
json(): Promise<any>
|
|
64
|
+
|
|
65
|
+
/** Consumes and returns the body as a Blob
|
|
66
|
+
* https://fetch.spec.whatwg.org/#dom-body-blob
|
|
67
|
+
*/
|
|
68
|
+
blob(): Promise<Blob_2>
|
|
69
|
+
|
|
70
|
+
/** Consumes and returns the body as an ArrayBuffer
|
|
71
|
+
* https://fetch.spec.whatwg.org/#dom-body-arraybuffer
|
|
72
|
+
*/
|
|
73
|
+
arrayBuffer(): Promise<ArrayBuffer>
|
|
74
|
+
|
|
75
|
+
/** Not implemented
|
|
76
|
+
*
|
|
77
|
+
* https://fetch.spec.whatwg.org/#dom-body-formdata
|
|
78
|
+
*/
|
|
79
|
+
formData(): Promise<never>
|
|
80
|
+
|
|
81
|
+
/** Returns true if the body is not null and the body has been consumed
|
|
82
|
+
*
|
|
83
|
+
* Otherwise, returns false
|
|
84
|
+
*
|
|
85
|
+
* https://fetch.spec.whatwg.org/#dom-body-bodyused
|
|
86
|
+
*/
|
|
87
|
+
readonly bodyUsed: boolean
|
|
88
|
+
|
|
89
|
+
/** Throws on node 16.6.0
|
|
90
|
+
*
|
|
91
|
+
* If body is null, it should return null as the body
|
|
92
|
+
*
|
|
93
|
+
* If body is not null, should return the body as a ReadableStream
|
|
94
|
+
*
|
|
95
|
+
* https://fetch.spec.whatwg.org/#dom-body-body
|
|
96
|
+
*/
|
|
97
|
+
readonly body: never | undefined
|
|
98
|
+
|
|
99
|
+
/** Dumps the response body by reading `limit` number of bytes.
|
|
100
|
+
* @param opts.limit Number of bytes to read (optional) - Default: 262144
|
|
101
|
+
*/
|
|
102
|
+
dump(opts?: { limit: number }): Promise<void>
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
declare function buildConnector (options?: buildConnector.BuildOptions): buildConnector.connector
|
|
106
|
+
|
|
107
|
+
declare namespace buildConnector {
|
|
108
|
+
type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & {
|
|
109
|
+
maxCachedSessions?: number | null;
|
|
110
|
+
socketPath?: string | null;
|
|
111
|
+
timeout?: number | null;
|
|
112
|
+
port?: number;
|
|
113
|
+
keepAlive?: boolean | null;
|
|
114
|
+
keepAliveInitialDelay?: number | null;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface Options {
|
|
118
|
+
hostname: string
|
|
119
|
+
host?: string
|
|
120
|
+
protocol: string
|
|
121
|
+
port: string
|
|
122
|
+
servername?: string
|
|
123
|
+
localAddress?: string | null
|
|
124
|
+
httpSocket?: Socket_2
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
type Callback = (...args: CallbackArgs) => void
|
|
128
|
+
type CallbackArgs = [null, Socket_2 | TLSSocket] | [Error, null]
|
|
129
|
+
|
|
130
|
+
type connector = connectorAsync | connectorSync
|
|
131
|
+
|
|
132
|
+
interface connectorSync {
|
|
133
|
+
(options: buildConnector.Options): Socket_2 | TLSSocket
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
interface connectorAsync {
|
|
137
|
+
(options: buildConnector.Options, callback: buildConnector.Callback): void
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* An imported module.
|
|
143
|
+
*/
|
|
144
|
+
declare interface CfModule {
|
|
145
|
+
/**
|
|
146
|
+
* The module name.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* './src/index.js'
|
|
150
|
+
*/
|
|
151
|
+
name: string;
|
|
152
|
+
/**
|
|
153
|
+
* The absolute path of the module on disk, or `undefined` if this is a
|
|
154
|
+
* virtual module. Used as the source URL for this module, so source maps are
|
|
155
|
+
* correctly resolved.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* '/path/to/src/index.js'
|
|
159
|
+
*/
|
|
160
|
+
filePath: string | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* The module content, usually JavaScript or WASM code.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* export default {
|
|
166
|
+
* async fetch(request) {
|
|
167
|
+
* return new Response('Ok')
|
|
168
|
+
* }
|
|
169
|
+
* }
|
|
170
|
+
*/
|
|
171
|
+
content: string | Buffer;
|
|
172
|
+
/**
|
|
173
|
+
* The module type.
|
|
174
|
+
*
|
|
175
|
+
* If absent, will default to the main module's type.
|
|
176
|
+
*/
|
|
177
|
+
type?: CfModuleType;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* A module type.
|
|
182
|
+
*/
|
|
183
|
+
declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer";
|
|
184
|
+
|
|
185
|
+
/** A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default. */
|
|
186
|
+
declare class Client extends Dispatcher {
|
|
187
|
+
constructor(url: string | URL_2, options?: Client.Options);
|
|
188
|
+
/** Property to get and set the pipelining factor. */
|
|
189
|
+
pipelining: number;
|
|
190
|
+
/** `true` after `client.close()` has been called. */
|
|
191
|
+
closed: boolean;
|
|
192
|
+
/** `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed. */
|
|
193
|
+
destroyed: boolean;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
declare namespace Client {
|
|
197
|
+
interface Options {
|
|
198
|
+
/** the timeout after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */
|
|
199
|
+
keepAliveTimeout?: number | null;
|
|
200
|
+
/** the maximum allowed `idleTimeout` when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */
|
|
201
|
+
keepAliveMaxTimeout?: number | null;
|
|
202
|
+
/** A number subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */
|
|
203
|
+
keepAliveTimeoutThreshold?: number | null;
|
|
204
|
+
/** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */
|
|
205
|
+
pipelining?: number | null;
|
|
206
|
+
/** **/
|
|
207
|
+
connect?: buildConnector.BuildOptions | buildConnector.connector | null;
|
|
208
|
+
/** The maximum length of request headers in bytes. Default: `16384` (16KiB). */
|
|
209
|
+
maxHeaderSize?: number | null;
|
|
210
|
+
/** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). */
|
|
211
|
+
bodyTimeout?: number | null;
|
|
212
|
+
/** The amount of time the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */
|
|
213
|
+
headersTimeout?: number | null;
|
|
214
|
+
/** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */
|
|
215
|
+
strictContentLength?: boolean;
|
|
216
|
+
/** @deprecated use the connect option instead */
|
|
217
|
+
tls?: TlsOptions_2 | null;
|
|
218
|
+
/** */
|
|
219
|
+
maxRequestsPerClient?: number;
|
|
220
|
+
/** Max response body size in bytes, -1 is disabled */
|
|
221
|
+
maxResponseSize?: number | null;
|
|
222
|
+
/** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */
|
|
223
|
+
autoSelectFamily?: boolean;
|
|
224
|
+
/** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */
|
|
225
|
+
autoSelectFamilyAttemptTimeout?: number;
|
|
226
|
+
|
|
227
|
+
interceptors?: {Client: readonly Dispatcher[] | undefined}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
interface SocketInfo {
|
|
231
|
+
localAddress?: string
|
|
232
|
+
localPort?: number
|
|
233
|
+
remoteAddress?: string
|
|
234
|
+
remotePort?: number
|
|
235
|
+
remoteFamily?: string
|
|
236
|
+
timeout?: number
|
|
237
|
+
bytesWritten?: number
|
|
238
|
+
bytesRead?: number
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
}
|
|
243
|
+
|
|
36
244
|
/**
|
|
37
245
|
* The possible types for a `Rule`.
|
|
38
246
|
*/
|
|
@@ -43,6 +251,74 @@ declare type CustomDomainRoute = {
|
|
|
43
251
|
custom_domain: boolean;
|
|
44
252
|
};
|
|
45
253
|
|
|
254
|
+
/**
|
|
255
|
+
* Publish a directory to an account/project.
|
|
256
|
+
* NOTE: You will need the `CLOUDFLARE_API_KEY` environment
|
|
257
|
+
* variable set
|
|
258
|
+
*/
|
|
259
|
+
declare function deploy({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, }: PagesDeployOptions): Promise<{
|
|
260
|
+
url: string;
|
|
261
|
+
environment: "production" | "preview";
|
|
262
|
+
id: string;
|
|
263
|
+
project_id: string;
|
|
264
|
+
project_name: string;
|
|
265
|
+
build_config: {
|
|
266
|
+
build_command: string;
|
|
267
|
+
destination_dir: string;
|
|
268
|
+
root_dir: string;
|
|
269
|
+
web_analytics_tag?: string | undefined;
|
|
270
|
+
web_analytics_token?: string | undefined;
|
|
271
|
+
fast_builds?: boolean | undefined;
|
|
272
|
+
};
|
|
273
|
+
created_on: string;
|
|
274
|
+
production_branch: string;
|
|
275
|
+
deployment_trigger: {
|
|
276
|
+
metadata: {
|
|
277
|
+
branch: string;
|
|
278
|
+
commit_hash: string;
|
|
279
|
+
commit_message: string;
|
|
280
|
+
};
|
|
281
|
+
type: string;
|
|
282
|
+
};
|
|
283
|
+
latest_stage: {
|
|
284
|
+
name: "build" | "deploy" | "queued" | "initialize" | "clone_repo";
|
|
285
|
+
status: "active" | "idle" | "canceled" | "success" | "failure" | "skipped";
|
|
286
|
+
started_on: string | null;
|
|
287
|
+
ended_on: string | null;
|
|
288
|
+
};
|
|
289
|
+
stages: {
|
|
290
|
+
name: "build" | "deploy" | "queued" | "initialize" | "clone_repo";
|
|
291
|
+
status: "active" | "idle" | "canceled" | "success" | "failure" | "skipped";
|
|
292
|
+
started_on: string | null;
|
|
293
|
+
ended_on: string | null;
|
|
294
|
+
}[];
|
|
295
|
+
aliases: string[];
|
|
296
|
+
modified_on: string;
|
|
297
|
+
short_id: string;
|
|
298
|
+
build_image_major_version: number;
|
|
299
|
+
kv_namespaces?: any;
|
|
300
|
+
source?: {
|
|
301
|
+
type: "github" | "gitlab";
|
|
302
|
+
config: {
|
|
303
|
+
owner: string;
|
|
304
|
+
repo_name: string;
|
|
305
|
+
production_branch?: string | undefined;
|
|
306
|
+
pr_comments_enabled?: boolean | undefined;
|
|
307
|
+
deployments_enabled?: boolean | undefined;
|
|
308
|
+
production_deployments_enabled?: boolean | undefined;
|
|
309
|
+
preview_deployment_setting?: "none" | "all" | "custom" | undefined;
|
|
310
|
+
preview_branch_includes?: string[] | undefined;
|
|
311
|
+
preview_branch_excludes?: string[] | undefined;
|
|
312
|
+
};
|
|
313
|
+
} | undefined;
|
|
314
|
+
env_vars?: any;
|
|
315
|
+
durable_object_namespaces?: any;
|
|
316
|
+
is_skipped?: boolean | undefined;
|
|
317
|
+
files?: {
|
|
318
|
+
[x: string]: string | undefined;
|
|
319
|
+
} | undefined;
|
|
320
|
+
}>;
|
|
321
|
+
|
|
46
322
|
/**
|
|
47
323
|
* Deprecated upload configuration.
|
|
48
324
|
*/
|
|
@@ -74,6 +350,240 @@ declare interface DeprecatedUpload {
|
|
|
74
350
|
rules?: Environment["rules"];
|
|
75
351
|
}
|
|
76
352
|
|
|
353
|
+
/** Dispatcher is the core API used to dispatch requests. */
|
|
354
|
+
declare class Dispatcher extends EventEmitter {
|
|
355
|
+
/** Dispatches a request. This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs. It is primarily intended for library developers who implement higher level APIs on top of this. */
|
|
356
|
+
dispatch(options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean;
|
|
357
|
+
/** Starts two-way communications with the requested resource. */
|
|
358
|
+
connect(options: Dispatcher.ConnectOptions): Promise<Dispatcher.ConnectData>;
|
|
359
|
+
connect(options: Dispatcher.ConnectOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void;
|
|
360
|
+
/** Performs an HTTP request. */
|
|
361
|
+
request(options: Dispatcher.RequestOptions): Promise<Dispatcher.ResponseData>;
|
|
362
|
+
request(options: Dispatcher.RequestOptions, callback: (err: Error | null, data: Dispatcher.ResponseData) => void): void;
|
|
363
|
+
/** For easy use with `stream.pipeline`. */
|
|
364
|
+
pipeline(options: Dispatcher.PipelineOptions, handler: Dispatcher.PipelineHandler): Duplex;
|
|
365
|
+
/** A faster version of `Dispatcher.request`. */
|
|
366
|
+
stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory): Promise<Dispatcher.StreamData>;
|
|
367
|
+
stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory, callback: (err: Error | null, data: Dispatcher.StreamData) => void): void;
|
|
368
|
+
/** Upgrade to a different protocol. */
|
|
369
|
+
upgrade(options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>;
|
|
370
|
+
upgrade(options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void;
|
|
371
|
+
/** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */
|
|
372
|
+
close(): Promise<void>;
|
|
373
|
+
close(callback: () => void): void;
|
|
374
|
+
/** Destroy the client abruptly with the given err. All the pending and running requests will be asynchronously aborted and error. Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). Since this operation is asynchronously dispatched there might still be some progress on dispatched requests. */
|
|
375
|
+
destroy(): Promise<void>;
|
|
376
|
+
destroy(err: Error | null): Promise<void>;
|
|
377
|
+
destroy(callback: () => void): void;
|
|
378
|
+
destroy(err: Error | null, callback: () => void): void;
|
|
379
|
+
|
|
380
|
+
on(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
|
|
381
|
+
on(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
382
|
+
on(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
383
|
+
on(eventName: 'drain', callback: (origin: URL_2) => void): this;
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
once(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
|
|
387
|
+
once(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
388
|
+
once(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
389
|
+
once(eventName: 'drain', callback: (origin: URL_2) => void): this;
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
off(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
|
|
393
|
+
off(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
394
|
+
off(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
395
|
+
off(eventName: 'drain', callback: (origin: URL_2) => void): this;
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
addListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
|
|
399
|
+
addListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
400
|
+
addListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
401
|
+
addListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
|
|
402
|
+
|
|
403
|
+
removeListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
|
|
404
|
+
removeListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
405
|
+
removeListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
406
|
+
removeListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
|
|
407
|
+
|
|
408
|
+
prependListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
|
|
409
|
+
prependListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
410
|
+
prependListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
411
|
+
prependListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
|
|
412
|
+
|
|
413
|
+
prependOnceListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
|
|
414
|
+
prependOnceListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
415
|
+
prependOnceListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
416
|
+
prependOnceListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
|
|
417
|
+
|
|
418
|
+
listeners(eventName: 'connect'): ((origin: URL_2, targets: readonly Dispatcher[]) => void)[]
|
|
419
|
+
listeners(eventName: 'disconnect'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
420
|
+
listeners(eventName: 'connectionError'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
421
|
+
listeners(eventName: 'drain'): ((origin: URL_2) => void)[];
|
|
422
|
+
|
|
423
|
+
rawListeners(eventName: 'connect'): ((origin: URL_2, targets: readonly Dispatcher[]) => void)[]
|
|
424
|
+
rawListeners(eventName: 'disconnect'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
425
|
+
rawListeners(eventName: 'connectionError'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
426
|
+
rawListeners(eventName: 'drain'): ((origin: URL_2) => void)[];
|
|
427
|
+
|
|
428
|
+
emit(eventName: 'connect', origin: URL_2, targets: readonly Dispatcher[]): boolean;
|
|
429
|
+
emit(eventName: 'disconnect', origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
|
|
430
|
+
emit(eventName: 'connectionError', origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
|
|
431
|
+
emit(eventName: 'drain', origin: URL_2): boolean;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
declare namespace Dispatcher {
|
|
435
|
+
interface DispatchOptions {
|
|
436
|
+
origin?: string | URL_2;
|
|
437
|
+
path: string;
|
|
438
|
+
method: HttpMethod;
|
|
439
|
+
/** Default: `null` */
|
|
440
|
+
body?: string | Buffer | Uint8Array | Readable | null | FormData_2;
|
|
441
|
+
/** Default: `null` */
|
|
442
|
+
headers?: IncomingHttpHeaders | string[] | null;
|
|
443
|
+
/** Query string params to be embedded in the request URL. Default: `null` */
|
|
444
|
+
query?: Record<string, any>;
|
|
445
|
+
/** Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline have completed. Default: `true` if `method` is `HEAD` or `GET`. */
|
|
446
|
+
idempotent?: boolean;
|
|
447
|
+
/** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. */
|
|
448
|
+
blocking?: boolean;
|
|
449
|
+
/** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */
|
|
450
|
+
upgrade?: boolean | string | null;
|
|
451
|
+
/** The amount of time the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */
|
|
452
|
+
headersTimeout?: number | null;
|
|
453
|
+
/** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use 0 to disable it entirely. Defaults to 300 seconds. */
|
|
454
|
+
bodyTimeout?: number | null;
|
|
455
|
+
/** Whether the request should stablish a keep-alive or not. Default `false` */
|
|
456
|
+
reset?: boolean;
|
|
457
|
+
/** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */
|
|
458
|
+
throwOnError?: boolean;
|
|
459
|
+
}
|
|
460
|
+
interface ConnectOptions {
|
|
461
|
+
path: string;
|
|
462
|
+
/** Default: `null` */
|
|
463
|
+
headers?: IncomingHttpHeaders | string[] | null;
|
|
464
|
+
/** Default: `null` */
|
|
465
|
+
signal?: AbortSignal_2 | EventEmitter | null;
|
|
466
|
+
/** This argument parameter is passed through to `ConnectData` */
|
|
467
|
+
opaque?: unknown;
|
|
468
|
+
/** Default: 0 */
|
|
469
|
+
maxRedirections?: number;
|
|
470
|
+
/** Default: `null` */
|
|
471
|
+
responseHeader?: 'raw' | null;
|
|
472
|
+
}
|
|
473
|
+
interface RequestOptions extends DispatchOptions {
|
|
474
|
+
/** Default: `null` */
|
|
475
|
+
opaque?: unknown;
|
|
476
|
+
/** Default: `null` */
|
|
477
|
+
signal?: AbortSignal_2 | EventEmitter | null;
|
|
478
|
+
/** Default: 0 */
|
|
479
|
+
maxRedirections?: number;
|
|
480
|
+
/** Default: `null` */
|
|
481
|
+
onInfo?: (info: { statusCode: number, headers: Record<string, string | string[]> }) => void;
|
|
482
|
+
/** Default: `null` */
|
|
483
|
+
responseHeader?: 'raw' | null;
|
|
484
|
+
}
|
|
485
|
+
interface PipelineOptions extends RequestOptions {
|
|
486
|
+
/** `true` if the `handler` will return an object stream. Default: `false` */
|
|
487
|
+
objectMode?: boolean;
|
|
488
|
+
}
|
|
489
|
+
interface UpgradeOptions {
|
|
490
|
+
path: string;
|
|
491
|
+
/** Default: `'GET'` */
|
|
492
|
+
method?: string;
|
|
493
|
+
/** Default: `null` */
|
|
494
|
+
headers?: IncomingHttpHeaders | string[] | null;
|
|
495
|
+
/** A string of comma separated protocols, in descending preference order. Default: `'Websocket'` */
|
|
496
|
+
protocol?: string;
|
|
497
|
+
/** Default: `null` */
|
|
498
|
+
signal?: AbortSignal_2 | EventEmitter | null;
|
|
499
|
+
/** Default: 0 */
|
|
500
|
+
maxRedirections?: number;
|
|
501
|
+
/** Default: `null` */
|
|
502
|
+
responseHeader?: 'raw' | null;
|
|
503
|
+
}
|
|
504
|
+
interface ConnectData {
|
|
505
|
+
statusCode: number;
|
|
506
|
+
headers: IncomingHttpHeaders;
|
|
507
|
+
socket: Duplex;
|
|
508
|
+
opaque: unknown;
|
|
509
|
+
}
|
|
510
|
+
interface ResponseData {
|
|
511
|
+
statusCode: number;
|
|
512
|
+
headers: IncomingHttpHeaders;
|
|
513
|
+
body: BodyReadable & BodyMixin;
|
|
514
|
+
trailers: Record<string, string>;
|
|
515
|
+
opaque: unknown;
|
|
516
|
+
context: object;
|
|
517
|
+
}
|
|
518
|
+
interface PipelineHandlerData {
|
|
519
|
+
statusCode: number;
|
|
520
|
+
headers: IncomingHttpHeaders;
|
|
521
|
+
opaque: unknown;
|
|
522
|
+
body: BodyReadable;
|
|
523
|
+
context: object;
|
|
524
|
+
}
|
|
525
|
+
interface StreamData {
|
|
526
|
+
opaque: unknown;
|
|
527
|
+
trailers: Record<string, string>;
|
|
528
|
+
}
|
|
529
|
+
interface UpgradeData {
|
|
530
|
+
headers: IncomingHttpHeaders;
|
|
531
|
+
socket: Duplex;
|
|
532
|
+
opaque: unknown;
|
|
533
|
+
}
|
|
534
|
+
interface StreamFactoryData {
|
|
535
|
+
statusCode: number;
|
|
536
|
+
headers: IncomingHttpHeaders;
|
|
537
|
+
opaque: unknown;
|
|
538
|
+
context: object;
|
|
539
|
+
}
|
|
540
|
+
type StreamFactory = (data: StreamFactoryData) => Writable;
|
|
541
|
+
interface DispatchHandlers {
|
|
542
|
+
/** Invoked before request is dispatched on socket. May be invoked multiple times when a request is retried when the request at the head of the pipeline fails. */
|
|
543
|
+
onConnect?(abort: () => void): void;
|
|
544
|
+
/** Invoked when an error has occurred. */
|
|
545
|
+
onError?(err: Error): void;
|
|
546
|
+
/** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
|
|
547
|
+
onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
|
|
548
|
+
/** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */
|
|
549
|
+
onHeaders?(statusCode: number, headers: Buffer[] | string[] | null, resume: () => void): boolean;
|
|
550
|
+
/** Invoked when response payload data is received. */
|
|
551
|
+
onData?(chunk: Buffer): boolean;
|
|
552
|
+
/** Invoked when response payload and trailers have been received and the request has completed. */
|
|
553
|
+
onComplete?(trailers: string[] | null): void;
|
|
554
|
+
/** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */
|
|
555
|
+
onBodySent?(chunkSize: number, totalBytesSent: number): void;
|
|
556
|
+
}
|
|
557
|
+
type PipelineHandler = (data: PipelineHandlerData) => Readable;
|
|
558
|
+
type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH';
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* @link https://fetch.spec.whatwg.org/#body-mixin
|
|
562
|
+
*/
|
|
563
|
+
interface BodyMixin {
|
|
564
|
+
readonly body?: never; // throws on node v16.6.0
|
|
565
|
+
readonly bodyUsed: boolean;
|
|
566
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
567
|
+
blob(): Promise<Blob_2>;
|
|
568
|
+
formData(): Promise<never>;
|
|
569
|
+
json(): Promise<any>;
|
|
570
|
+
text(): Promise<string>;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
interface DispatchInterceptor {
|
|
574
|
+
(dispatch: Dispatcher['dispatch']): Dispatcher['dispatch']
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
declare interface DispatchNamespaceOutbound {
|
|
579
|
+
/** Name of the service handling the outbound requests */
|
|
580
|
+
service: string;
|
|
581
|
+
/** (Optional) Name of the environment handling the outbound requests. */
|
|
582
|
+
environment?: string;
|
|
583
|
+
/** (Optional) List of parameter names, for sending context from your dispatch worker to the outbound handler */
|
|
584
|
+
parameters?: string[];
|
|
585
|
+
}
|
|
586
|
+
|
|
77
587
|
declare type DurableObjectBindings = {
|
|
78
588
|
/** The name of the binding used to refer to the Durable Object */
|
|
79
589
|
name: string;
|
|
@@ -142,11 +652,26 @@ declare interface EnvironmentInheritable {
|
|
|
142
652
|
* The entrypoint/path to the JavaScript file that will be executed.
|
|
143
653
|
*/
|
|
144
654
|
main: string | undefined;
|
|
655
|
+
/**
|
|
656
|
+
* If true then Wrangler will traverse the file tree below `base_dir`;
|
|
657
|
+
* Any files that match `rules` will be included in the deployed worker.
|
|
658
|
+
* Defaults to true if `no_bundle` is true, otherwise false.
|
|
659
|
+
*
|
|
660
|
+
* @inheritable
|
|
661
|
+
*/
|
|
662
|
+
find_additional_modules: boolean | undefined;
|
|
663
|
+
/**
|
|
664
|
+
* The directory in which module rules should be evaluated when including additional files into a worker deployment.
|
|
665
|
+
* This defaults to the directory containing the `main` entry point of the worker if not specified.
|
|
666
|
+
*
|
|
667
|
+
* @inheritable
|
|
668
|
+
*/
|
|
669
|
+
base_dir: string | undefined;
|
|
145
670
|
/**
|
|
146
671
|
* Whether we use <name>.<subdomain>.workers.dev to
|
|
147
672
|
* test and deploy your worker.
|
|
148
673
|
*
|
|
149
|
-
* @default `true` (This is a breaking change from
|
|
674
|
+
* @default `true` (This is a breaking change from Wrangler v1)
|
|
150
675
|
* @breaking
|
|
151
676
|
* @inheritable
|
|
152
677
|
*/
|
|
@@ -213,6 +738,13 @@ declare interface EnvironmentInheritable {
|
|
|
213
738
|
* @inheritable
|
|
214
739
|
*/
|
|
215
740
|
usage_model: "bundled" | "unbound" | undefined;
|
|
741
|
+
/**
|
|
742
|
+
* Specify limits for runtime behavior.
|
|
743
|
+
* Only supported for the "standard" Usage Model
|
|
744
|
+
*
|
|
745
|
+
* @inheritable
|
|
746
|
+
*/
|
|
747
|
+
limits: UserLimits | undefined;
|
|
216
748
|
/**
|
|
217
749
|
* An ordered list of rules that define which modules to import,
|
|
218
750
|
* and what type to import them as. You will need to specify rules
|
|
@@ -244,7 +776,7 @@ declare interface EnvironmentInheritable {
|
|
|
244
776
|
upload?: DeprecatedUpload;
|
|
245
777
|
};
|
|
246
778
|
/**
|
|
247
|
-
* Skip internal build steps and directly
|
|
779
|
+
* Skip internal build steps and directly deploy script
|
|
248
780
|
* @inheritable
|
|
249
781
|
*/
|
|
250
782
|
no_bundle: boolean | undefined;
|
|
@@ -272,6 +804,8 @@ declare interface EnvironmentInheritable {
|
|
|
272
804
|
binding: string;
|
|
273
805
|
/** The namespace to bind to. */
|
|
274
806
|
namespace: string;
|
|
807
|
+
/** Details about the outbound worker which will handle outbound requests from your namespace */
|
|
808
|
+
outbound?: DispatchNamespaceOutbound;
|
|
275
809
|
}[];
|
|
276
810
|
/**
|
|
277
811
|
* Designates this worker as an internal-only "first-party" worker.
|
|
@@ -285,15 +819,12 @@ declare interface EnvironmentInheritable {
|
|
|
285
819
|
*/
|
|
286
820
|
zone_id?: string;
|
|
287
821
|
/**
|
|
288
|
-
*
|
|
289
|
-
* Then add a binding per field in the top level message that you will send to logfwdr
|
|
822
|
+
* List of bindings that you will send to logfwdr
|
|
290
823
|
*
|
|
291
|
-
* @default `{
|
|
824
|
+
* @default `{bindings:[]}`
|
|
292
825
|
* @inheritable
|
|
293
826
|
*/
|
|
294
827
|
logfwdr: {
|
|
295
|
-
/** capnp schema filename */
|
|
296
|
-
schema: string | undefined;
|
|
297
828
|
bindings: {
|
|
298
829
|
/** The binding name used to refer to logfwdr */
|
|
299
830
|
name: string;
|
|
@@ -312,6 +843,14 @@ declare interface EnvironmentInheritable {
|
|
|
312
843
|
* @inheritable
|
|
313
844
|
*/
|
|
314
845
|
logpush: boolean | undefined;
|
|
846
|
+
/**
|
|
847
|
+
* Specify how the worker should be located to minimize round-trip time.
|
|
848
|
+
*
|
|
849
|
+
* More details: https://developers.cloudflare.com/workers/platform/smart-placement/
|
|
850
|
+
*/
|
|
851
|
+
placement: {
|
|
852
|
+
mode: "off" | "smart";
|
|
853
|
+
} | undefined;
|
|
315
854
|
}
|
|
316
855
|
|
|
317
856
|
/**
|
|
@@ -341,9 +880,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
341
880
|
* @default `{}`
|
|
342
881
|
* @nonInheritable
|
|
343
882
|
*/
|
|
344
|
-
vars:
|
|
345
|
-
[key: string]: unknown;
|
|
346
|
-
};
|
|
883
|
+
vars: Record<string, string | Json>;
|
|
347
884
|
/**
|
|
348
885
|
* A list of durable objects that your worker should be bound to.
|
|
349
886
|
*
|
|
@@ -380,6 +917,23 @@ declare interface EnvironmentNonInheritable {
|
|
|
380
917
|
/** The ID of the KV namespace used during `wrangler dev` */
|
|
381
918
|
preview_id?: string;
|
|
382
919
|
}[];
|
|
920
|
+
/**
|
|
921
|
+
* These specify bindings to send email from inside your Worker.
|
|
922
|
+
*
|
|
923
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
924
|
+
* and so must be specified in every named environment.
|
|
925
|
+
*
|
|
926
|
+
* @default `[]`
|
|
927
|
+
* @nonInheritable
|
|
928
|
+
*/
|
|
929
|
+
send_email: {
|
|
930
|
+
/** The binding name used to refer to the this binding */
|
|
931
|
+
name: string;
|
|
932
|
+
/** If this binding should be restricted to a specific verified address */
|
|
933
|
+
destination_address?: string;
|
|
934
|
+
/** If this binding should be restricted to a set of verified addresses */
|
|
935
|
+
allowed_destination_addresses?: string[];
|
|
936
|
+
}[];
|
|
383
937
|
/**
|
|
384
938
|
* Specifies Queues that are bound to this Worker environment.
|
|
385
939
|
*
|
|
@@ -409,6 +963,8 @@ declare interface EnvironmentNonInheritable {
|
|
|
409
963
|
max_retries?: number;
|
|
410
964
|
/** The queue to send messages that failed to be consumed. */
|
|
411
965
|
dead_letter_queue?: string;
|
|
966
|
+
/** The maximum number of concurrent consumer Worker invocations. Leaving this unset will allow your consumer to scale to the maximum concurrency needed to keep up with the message backlog. */
|
|
967
|
+
max_concurrency?: number | null;
|
|
412
968
|
}[];
|
|
413
969
|
};
|
|
414
970
|
/**
|
|
@@ -427,6 +983,8 @@ declare interface EnvironmentNonInheritable {
|
|
|
427
983
|
bucket_name: string;
|
|
428
984
|
/** The preview name of this R2 bucket at the edge. */
|
|
429
985
|
preview_bucket_name?: string;
|
|
986
|
+
/** The jurisdiction that the bucket exists in. Default if not present. */
|
|
987
|
+
jurisdiction?: string;
|
|
430
988
|
}[];
|
|
431
989
|
/**
|
|
432
990
|
* Specifies D1 databases that are bound to this Worker environment.
|
|
@@ -453,6 +1011,53 @@ declare interface EnvironmentNonInheritable {
|
|
|
453
1011
|
/** Internal use only. */
|
|
454
1012
|
database_internal_env?: string;
|
|
455
1013
|
}[];
|
|
1014
|
+
/**
|
|
1015
|
+
* Specifies Vectorize indexes that are bound to this Worker environment.
|
|
1016
|
+
*
|
|
1017
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1018
|
+
* and so must be specified in every named environment.
|
|
1019
|
+
*
|
|
1020
|
+
* @default `[]`
|
|
1021
|
+
* @nonInheritable
|
|
1022
|
+
*/
|
|
1023
|
+
vectorize: {
|
|
1024
|
+
/** The binding name used to refer to the Vectorize index in the worker. */
|
|
1025
|
+
binding: string;
|
|
1026
|
+
/** The name of the index. */
|
|
1027
|
+
index_name: string;
|
|
1028
|
+
}[];
|
|
1029
|
+
/**
|
|
1030
|
+
* Specifies Constellation projects that are bound to this Worker environment.
|
|
1031
|
+
*
|
|
1032
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1033
|
+
* and so must be specified in every named environment.
|
|
1034
|
+
*
|
|
1035
|
+
* @default `[]`
|
|
1036
|
+
* @nonInheritable
|
|
1037
|
+
*/
|
|
1038
|
+
constellation: {
|
|
1039
|
+
/** The binding name used to refer to the project in the worker. */
|
|
1040
|
+
binding: string;
|
|
1041
|
+
/** The id of the project. */
|
|
1042
|
+
project_id: string;
|
|
1043
|
+
}[];
|
|
1044
|
+
/**
|
|
1045
|
+
* Specifies Hyperdrive configs that are bound to this Worker environment.
|
|
1046
|
+
*
|
|
1047
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1048
|
+
* and so must be specified in every named environment.
|
|
1049
|
+
*
|
|
1050
|
+
* @default `[]`
|
|
1051
|
+
* @nonInheritable
|
|
1052
|
+
*/
|
|
1053
|
+
hyperdrive: {
|
|
1054
|
+
/** The binding name used to refer to the project in the worker. */
|
|
1055
|
+
binding: string;
|
|
1056
|
+
/** The id of the database. */
|
|
1057
|
+
id: string;
|
|
1058
|
+
/** The local database connection string for `wrangler dev` */
|
|
1059
|
+
localConnectionString?: string;
|
|
1060
|
+
}[];
|
|
456
1061
|
/**
|
|
457
1062
|
* Specifies service bindings (worker-to-worker) that are bound to this Worker environment.
|
|
458
1063
|
*
|
|
@@ -485,13 +1090,24 @@ declare interface EnvironmentNonInheritable {
|
|
|
485
1090
|
/** The name of this dataset to write to. */
|
|
486
1091
|
dataset?: string;
|
|
487
1092
|
}[];
|
|
1093
|
+
/**
|
|
1094
|
+
* A browser that will be usable from the worker.
|
|
1095
|
+
*/
|
|
1096
|
+
browser: {
|
|
1097
|
+
binding: string;
|
|
1098
|
+
} | undefined;
|
|
1099
|
+
/**
|
|
1100
|
+
* Binding to the AI project.
|
|
1101
|
+
*/
|
|
1102
|
+
ai: {
|
|
1103
|
+
binding: string;
|
|
1104
|
+
} | undefined;
|
|
488
1105
|
/**
|
|
489
1106
|
* "Unsafe" tables for features that aren't directly supported by wrangler.
|
|
490
1107
|
*
|
|
491
1108
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
492
1109
|
* and so must be specified in every named environment.
|
|
493
1110
|
*
|
|
494
|
-
* @default `{ bindings: [] }`
|
|
495
1111
|
* @nonInheritable
|
|
496
1112
|
*/
|
|
497
1113
|
unsafe: {
|
|
@@ -499,18 +1115,157 @@ declare interface EnvironmentNonInheritable {
|
|
|
499
1115
|
* A set of bindings that should be put into a Worker's upload metadata without changes. These
|
|
500
1116
|
* can be used to implement bindings for features that haven't released and aren't supported
|
|
501
1117
|
* directly by wrangler or miniflare.
|
|
502
|
-
*
|
|
503
|
-
* @default []
|
|
504
1118
|
*/
|
|
505
|
-
bindings
|
|
1119
|
+
bindings?: {
|
|
506
1120
|
name: string;
|
|
507
1121
|
type: string;
|
|
508
1122
|
[key: string]: unknown;
|
|
509
1123
|
}[];
|
|
1124
|
+
/**
|
|
1125
|
+
* Arbitrary key/value pairs that will be included in the uploaded metadata. Values specified
|
|
1126
|
+
* here will always be applied to metadata last, so can add new or override existing fields.
|
|
1127
|
+
*/
|
|
1128
|
+
metadata?: {
|
|
1129
|
+
[key: string]: string;
|
|
1130
|
+
};
|
|
1131
|
+
/**
|
|
1132
|
+
* Used for internal capnp uploads for the Workers runtime
|
|
1133
|
+
*/
|
|
1134
|
+
capnp?: {
|
|
1135
|
+
base_path: string;
|
|
1136
|
+
source_schemas: string[];
|
|
1137
|
+
compiled_schema?: never;
|
|
1138
|
+
} | {
|
|
1139
|
+
base_path?: never;
|
|
1140
|
+
source_schemas?: never;
|
|
1141
|
+
compiled_schema: string;
|
|
1142
|
+
};
|
|
510
1143
|
};
|
|
1144
|
+
mtls_certificates: {
|
|
1145
|
+
/** The binding name used to refer to the certificate in the worker */
|
|
1146
|
+
binding: string;
|
|
1147
|
+
/** The uuid of the uploaded mTLS certificate */
|
|
1148
|
+
certificate_id: string;
|
|
1149
|
+
}[];
|
|
1150
|
+
tail_consumers?: TailConsumer[];
|
|
511
1151
|
}
|
|
512
1152
|
|
|
513
|
-
declare
|
|
1153
|
+
declare namespace Errors {
|
|
1154
|
+
class UndiciError extends Error { }
|
|
1155
|
+
|
|
1156
|
+
/** Connect timeout error. */
|
|
1157
|
+
class ConnectTimeoutError extends UndiciError {
|
|
1158
|
+
name: 'ConnectTimeoutError';
|
|
1159
|
+
code: 'UND_ERR_CONNECT_TIMEOUT';
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
/** A header exceeds the `headersTimeout` option. */
|
|
1163
|
+
class HeadersTimeoutError extends UndiciError {
|
|
1164
|
+
name: 'HeadersTimeoutError';
|
|
1165
|
+
code: 'UND_ERR_HEADERS_TIMEOUT';
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
/** Headers overflow error. */
|
|
1169
|
+
class HeadersOverflowError extends UndiciError {
|
|
1170
|
+
name: 'HeadersOverflowError'
|
|
1171
|
+
code: 'UND_ERR_HEADERS_OVERFLOW'
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
/** A body exceeds the `bodyTimeout` option. */
|
|
1175
|
+
class BodyTimeoutError extends UndiciError {
|
|
1176
|
+
name: 'BodyTimeoutError';
|
|
1177
|
+
code: 'UND_ERR_BODY_TIMEOUT';
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
class ResponseStatusCodeError extends UndiciError {
|
|
1181
|
+
name: 'ResponseStatusCodeError';
|
|
1182
|
+
code: 'UND_ERR_RESPONSE_STATUS_CODE';
|
|
1183
|
+
body: null | Record<string, any> | string
|
|
1184
|
+
status: number
|
|
1185
|
+
statusCode: number
|
|
1186
|
+
headers: IncomingHttpHeaders | string[] | null;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/** Passed an invalid argument. */
|
|
1190
|
+
class InvalidArgumentError extends UndiciError {
|
|
1191
|
+
name: 'InvalidArgumentError';
|
|
1192
|
+
code: 'UND_ERR_INVALID_ARG';
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
/** Returned an invalid value. */
|
|
1196
|
+
class InvalidReturnValueError extends UndiciError {
|
|
1197
|
+
name: 'InvalidReturnValueError';
|
|
1198
|
+
code: 'UND_ERR_INVALID_RETURN_VALUE';
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
/** The request has been aborted by the user. */
|
|
1202
|
+
class RequestAbortedError extends UndiciError {
|
|
1203
|
+
name: 'AbortError';
|
|
1204
|
+
code: 'UND_ERR_ABORTED';
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
/** Expected error with reason. */
|
|
1208
|
+
class InformationalError extends UndiciError {
|
|
1209
|
+
name: 'InformationalError';
|
|
1210
|
+
code: 'UND_ERR_INFO';
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
/** Request body length does not match content-length header. */
|
|
1214
|
+
class RequestContentLengthMismatchError extends UndiciError {
|
|
1215
|
+
name: 'RequestContentLengthMismatchError';
|
|
1216
|
+
code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH';
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
/** Response body length does not match content-length header. */
|
|
1220
|
+
class ResponseContentLengthMismatchError extends UndiciError {
|
|
1221
|
+
name: 'ResponseContentLengthMismatchError';
|
|
1222
|
+
code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH';
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
/** Trying to use a destroyed client. */
|
|
1226
|
+
class ClientDestroyedError extends UndiciError {
|
|
1227
|
+
name: 'ClientDestroyedError';
|
|
1228
|
+
code: 'UND_ERR_DESTROYED';
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
/** Trying to use a closed client. */
|
|
1232
|
+
class ClientClosedError extends UndiciError {
|
|
1233
|
+
name: 'ClientClosedError';
|
|
1234
|
+
code: 'UND_ERR_CLOSED';
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
/** There is an error with the socket. */
|
|
1238
|
+
class SocketError extends UndiciError {
|
|
1239
|
+
name: 'SocketError';
|
|
1240
|
+
code: 'UND_ERR_SOCKET';
|
|
1241
|
+
socket: Client.SocketInfo | null
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
/** Encountered unsupported functionality. */
|
|
1245
|
+
class NotSupportedError extends UndiciError {
|
|
1246
|
+
name: 'NotSupportedError';
|
|
1247
|
+
code: 'UND_ERR_NOT_SUPPORTED';
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
/** No upstream has been added to the BalancedPool. */
|
|
1251
|
+
class BalancedPoolMissingUpstreamError extends UndiciError {
|
|
1252
|
+
name: 'MissingUpstreamError';
|
|
1253
|
+
code: 'UND_ERR_BPL_MISSING_UPSTREAM';
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
class HTTPParserError extends UndiciError {
|
|
1257
|
+
name: 'HTTPParserError';
|
|
1258
|
+
code: string;
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
/** The response exceed the length allowed. */
|
|
1262
|
+
class ResponseExceededMaxSizeError extends UndiciError {
|
|
1263
|
+
name: 'ResponseExceededMaxSizeError';
|
|
1264
|
+
code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
declare class File_2 extends Blob_2 {
|
|
514
1269
|
/**
|
|
515
1270
|
* Creates a new File instance.
|
|
516
1271
|
*
|
|
@@ -543,7 +1298,7 @@ declare interface FilePropertyBag extends BlobPropertyBag {
|
|
|
543
1298
|
/**
|
|
544
1299
|
* Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using fetch().
|
|
545
1300
|
*/
|
|
546
|
-
declare class
|
|
1301
|
+
declare class FormData_2 {
|
|
547
1302
|
/**
|
|
548
1303
|
* Appends a new value onto an existing key inside a FormData object,
|
|
549
1304
|
* or adds the key if it does not already exist.
|
|
@@ -608,7 +1363,7 @@ declare class FormData {
|
|
|
608
1363
|
* Executes given callback function for each field of the FormData instance
|
|
609
1364
|
*/
|
|
610
1365
|
forEach: (
|
|
611
|
-
callbackfn: (value: FormDataEntryValue, key: string, iterable:
|
|
1366
|
+
callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData_2) => void,
|
|
612
1367
|
thisArg?: unknown
|
|
613
1368
|
) => void
|
|
614
1369
|
|
|
@@ -641,17 +1396,18 @@ declare class FormData {
|
|
|
641
1396
|
/**
|
|
642
1397
|
* A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
|
|
643
1398
|
*/
|
|
644
|
-
declare type FormDataEntryValue = string |
|
|
1399
|
+
declare type FormDataEntryValue = string | File_2
|
|
645
1400
|
|
|
646
|
-
declare class
|
|
647
|
-
constructor (init?:
|
|
1401
|
+
declare class Headers_2 implements SpecIterable<[string, string]> {
|
|
1402
|
+
constructor (init?: HeadersInit_2)
|
|
648
1403
|
readonly append: (name: string, value: string) => void
|
|
649
1404
|
readonly delete: (name: string) => void
|
|
650
1405
|
readonly get: (name: string) => string | null
|
|
651
1406
|
readonly has: (name: string) => boolean
|
|
652
1407
|
readonly set: (name: string, value: string) => void
|
|
1408
|
+
readonly getSetCookie: () => string[]
|
|
653
1409
|
readonly forEach: (
|
|
654
|
-
callbackfn: (value: string, key: string, iterable:
|
|
1410
|
+
callbackfn: (value: string, key: string, iterable: Headers_2) => void,
|
|
655
1411
|
thisArg?: unknown
|
|
656
1412
|
) => void
|
|
657
1413
|
|
|
@@ -661,11 +1417,16 @@ declare class Headers implements SpecIterable<[string, string]> {
|
|
|
661
1417
|
readonly [Symbol.iterator]: () => SpecIterator<[string, string]>
|
|
662
1418
|
}
|
|
663
1419
|
|
|
664
|
-
declare type
|
|
1420
|
+
declare type HeadersInit_2 = string[][] | Record<string, string | ReadonlyArray<string>> | Headers_2
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* The header type declaration of `undici`.
|
|
1424
|
+
*/
|
|
1425
|
+
declare type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
|
|
665
1426
|
|
|
666
|
-
declare interface
|
|
1427
|
+
declare interface PagesDeployOptions {
|
|
667
1428
|
/**
|
|
668
|
-
* Path to static assets to
|
|
1429
|
+
* Path to static assets to deploy to Pages
|
|
669
1430
|
*/
|
|
670
1431
|
directory: string;
|
|
671
1432
|
/**
|
|
@@ -706,79 +1467,11 @@ declare interface PagesPublishOptions {
|
|
|
706
1467
|
functionsDirectory?: string;
|
|
707
1468
|
/**
|
|
708
1469
|
* Whether to run bundling on `_worker.js` before deploying.
|
|
709
|
-
* Default:
|
|
1470
|
+
* Default: true
|
|
710
1471
|
*/
|
|
711
1472
|
bundle?: boolean;
|
|
712
1473
|
}
|
|
713
1474
|
|
|
714
|
-
/**
|
|
715
|
-
* Publish a directory to an account/project.
|
|
716
|
-
* NOTE: You will need the `CLOUDFLARE_API_KEY` environment
|
|
717
|
-
* variable set
|
|
718
|
-
*/
|
|
719
|
-
declare function publish({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, }: PagesPublishOptions): Promise<{
|
|
720
|
-
environment: "production" | "preview";
|
|
721
|
-
id: string;
|
|
722
|
-
url: string;
|
|
723
|
-
project_name: string;
|
|
724
|
-
build_config: {
|
|
725
|
-
build_command: string;
|
|
726
|
-
destination_dir: string;
|
|
727
|
-
root_dir: string;
|
|
728
|
-
web_analytics_tag?: string | undefined;
|
|
729
|
-
web_analytics_token?: string | undefined;
|
|
730
|
-
fast_builds?: boolean | undefined;
|
|
731
|
-
};
|
|
732
|
-
created_on: string;
|
|
733
|
-
production_branch: string;
|
|
734
|
-
project_id: string;
|
|
735
|
-
deployment_trigger: {
|
|
736
|
-
type: string;
|
|
737
|
-
metadata: {
|
|
738
|
-
branch: string;
|
|
739
|
-
commit_hash: string;
|
|
740
|
-
commit_message: string;
|
|
741
|
-
};
|
|
742
|
-
};
|
|
743
|
-
latest_stage: {
|
|
744
|
-
name: "build" | "queued" | "initialize" | "clone_repo" | "deploy";
|
|
745
|
-
status: "active" | "canceled" | "success" | "idle" | "failure" | "skipped";
|
|
746
|
-
started_on: string | null;
|
|
747
|
-
ended_on: string | null;
|
|
748
|
-
};
|
|
749
|
-
stages: {
|
|
750
|
-
name: "build" | "queued" | "initialize" | "clone_repo" | "deploy";
|
|
751
|
-
status: "active" | "canceled" | "success" | "idle" | "failure" | "skipped";
|
|
752
|
-
started_on: string | null;
|
|
753
|
-
ended_on: string | null;
|
|
754
|
-
}[];
|
|
755
|
-
aliases: string[];
|
|
756
|
-
modified_on: string;
|
|
757
|
-
short_id: string;
|
|
758
|
-
build_image_major_version: number;
|
|
759
|
-
kv_namespaces?: any;
|
|
760
|
-
source?: {
|
|
761
|
-
type: "github" | "gitlab";
|
|
762
|
-
config: {
|
|
763
|
-
owner: string;
|
|
764
|
-
repo_name: string;
|
|
765
|
-
production_branch?: string | undefined;
|
|
766
|
-
pr_comments_enabled?: boolean | undefined;
|
|
767
|
-
deployments_enabled?: boolean | undefined;
|
|
768
|
-
production_deployments_enabled?: boolean | undefined;
|
|
769
|
-
preview_deployment_setting?: "none" | "all" | "custom" | undefined;
|
|
770
|
-
preview_branch_includes?: string[] | undefined;
|
|
771
|
-
preview_branch_excludes?: string[] | undefined;
|
|
772
|
-
};
|
|
773
|
-
} | undefined;
|
|
774
|
-
env_vars?: any;
|
|
775
|
-
durable_object_namespaces?: any;
|
|
776
|
-
is_skipped?: boolean | undefined;
|
|
777
|
-
files?: {
|
|
778
|
-
[x: string]: string | undefined;
|
|
779
|
-
} | undefined;
|
|
780
|
-
}>;
|
|
781
|
-
|
|
782
1475
|
declare type ReferrerPolicy =
|
|
783
1476
|
| ''
|
|
784
1477
|
| 'no-referrer'
|
|
@@ -790,13 +1483,13 @@ declare type ReferrerPolicy =
|
|
|
790
1483
|
| 'strict-origin-when-cross-origin'
|
|
791
1484
|
| 'unsafe-url';
|
|
792
1485
|
|
|
793
|
-
declare class
|
|
794
|
-
constructor (input:
|
|
1486
|
+
declare class Request_2 implements BodyMixin {
|
|
1487
|
+
constructor (input: RequestInfo_2, init?: RequestInit_2)
|
|
795
1488
|
|
|
796
1489
|
readonly cache: RequestCache
|
|
797
1490
|
readonly credentials: RequestCredentials
|
|
798
1491
|
readonly destination: RequestDestination
|
|
799
|
-
readonly headers:
|
|
1492
|
+
readonly headers: Headers_2
|
|
800
1493
|
readonly integrity: string
|
|
801
1494
|
readonly method: string
|
|
802
1495
|
readonly mode: RequestMode
|
|
@@ -806,17 +1499,18 @@ declare class Request implements BodyMixin {
|
|
|
806
1499
|
|
|
807
1500
|
readonly keepalive: boolean
|
|
808
1501
|
readonly signal: AbortSignal
|
|
1502
|
+
readonly duplex: RequestDuplex
|
|
809
1503
|
|
|
810
|
-
readonly body:
|
|
1504
|
+
readonly body: ReadableStream_2 | null
|
|
811
1505
|
readonly bodyUsed: boolean
|
|
812
1506
|
|
|
813
1507
|
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
814
1508
|
readonly blob: () => Promise<Blob_2>
|
|
815
|
-
readonly formData: () => Promise<
|
|
1509
|
+
readonly formData: () => Promise<FormData_2>
|
|
816
1510
|
readonly json: () => Promise<unknown>
|
|
817
1511
|
readonly text: () => Promise<string>
|
|
818
1512
|
|
|
819
|
-
readonly clone: () =>
|
|
1513
|
+
readonly clone: () => Request_2
|
|
820
1514
|
}
|
|
821
1515
|
|
|
822
1516
|
declare type RequestCache =
|
|
@@ -849,13 +1543,15 @@ declare type RequestDestination =
|
|
|
849
1543
|
| 'worker'
|
|
850
1544
|
| 'xslt'
|
|
851
1545
|
|
|
852
|
-
declare type
|
|
1546
|
+
declare type RequestDuplex = 'half'
|
|
1547
|
+
|
|
1548
|
+
declare type RequestInfo_2 = string | URL_2 | Request_2
|
|
853
1549
|
|
|
854
|
-
declare interface
|
|
1550
|
+
declare interface RequestInit_2 {
|
|
855
1551
|
method?: string
|
|
856
1552
|
keepalive?: boolean
|
|
857
|
-
headers?:
|
|
858
|
-
body?:
|
|
1553
|
+
headers?: HeadersInit_2
|
|
1554
|
+
body?: BodyInit_2
|
|
859
1555
|
redirect?: RequestRedirect
|
|
860
1556
|
integrity?: string
|
|
861
1557
|
signal?: AbortSignal
|
|
@@ -865,16 +1561,17 @@ declare interface RequestInit {
|
|
|
865
1561
|
referrerPolicy?: ReferrerPolicy
|
|
866
1562
|
window?: null
|
|
867
1563
|
dispatcher?: Dispatcher
|
|
1564
|
+
duplex?: RequestDuplex
|
|
868
1565
|
}
|
|
869
1566
|
|
|
870
1567
|
declare type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
|
|
871
1568
|
|
|
872
1569
|
declare type RequestRedirect = 'error' | 'follow' | 'manual'
|
|
873
1570
|
|
|
874
|
-
declare class
|
|
875
|
-
constructor (body?:
|
|
1571
|
+
declare class Response_2 implements BodyMixin {
|
|
1572
|
+
constructor (body?: BodyInit_2, init?: ResponseInit_2)
|
|
876
1573
|
|
|
877
|
-
readonly headers:
|
|
1574
|
+
readonly headers: Headers_2
|
|
878
1575
|
readonly ok: boolean
|
|
879
1576
|
readonly status: number
|
|
880
1577
|
readonly statusText: string
|
|
@@ -882,26 +1579,26 @@ declare class Response implements BodyMixin {
|
|
|
882
1579
|
readonly url: string
|
|
883
1580
|
readonly redirected: boolean
|
|
884
1581
|
|
|
885
|
-
readonly body:
|
|
1582
|
+
readonly body: ReadableStream_2 | null
|
|
886
1583
|
readonly bodyUsed: boolean
|
|
887
1584
|
|
|
888
1585
|
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
889
1586
|
readonly blob: () => Promise<Blob_2>
|
|
890
|
-
readonly formData: () => Promise<
|
|
1587
|
+
readonly formData: () => Promise<FormData_2>
|
|
891
1588
|
readonly json: () => Promise<unknown>
|
|
892
1589
|
readonly text: () => Promise<string>
|
|
893
1590
|
|
|
894
|
-
readonly clone: () =>
|
|
1591
|
+
readonly clone: () => Response_2
|
|
895
1592
|
|
|
896
|
-
static error ():
|
|
897
|
-
static json(data: any, init?:
|
|
898
|
-
static redirect (url: string | URL_2, status: ResponseRedirectStatus):
|
|
1593
|
+
static error (): Response_2
|
|
1594
|
+
static json(data: any, init?: ResponseInit_2): Response_2
|
|
1595
|
+
static redirect (url: string | URL_2, status: ResponseRedirectStatus): Response_2
|
|
899
1596
|
}
|
|
900
1597
|
|
|
901
|
-
declare interface
|
|
1598
|
+
declare interface ResponseInit_2 {
|
|
902
1599
|
readonly status?: number
|
|
903
1600
|
readonly statusText?: string
|
|
904
|
-
readonly headers?:
|
|
1601
|
+
readonly headers?: HeadersInit_2
|
|
905
1602
|
}
|
|
906
1603
|
|
|
907
1604
|
declare type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308
|
|
@@ -939,13 +1636,20 @@ declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
|
|
|
939
1636
|
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
|
|
940
1637
|
}
|
|
941
1638
|
|
|
1639
|
+
declare type TailConsumer = {
|
|
1640
|
+
/** The name of the service tail events will be forwarded to. */
|
|
1641
|
+
service: string;
|
|
1642
|
+
/** (Optional) The environt of the service. */
|
|
1643
|
+
environment?: string;
|
|
1644
|
+
};
|
|
1645
|
+
|
|
942
1646
|
/**
|
|
943
1647
|
* unstable_dev starts a wrangler dev server, and returns a promise that resolves with utility functions to interact with it.
|
|
944
1648
|
*/
|
|
945
1649
|
export declare function unstable_dev(script: string, options?: UnstableDevOptions, apiOptions?: unknown): Promise<UnstableDevWorker>;
|
|
946
1650
|
|
|
947
1651
|
export declare const unstable_pages: {
|
|
948
|
-
|
|
1652
|
+
deploy: typeof deploy;
|
|
949
1653
|
};
|
|
950
1654
|
|
|
951
1655
|
export declare interface UnstableDevOptions {
|
|
@@ -965,9 +1669,7 @@ export declare interface UnstableDevOptions {
|
|
|
965
1669
|
compatibilityFlags?: string[];
|
|
966
1670
|
persist?: boolean;
|
|
967
1671
|
persistTo?: string;
|
|
968
|
-
vars?:
|
|
969
|
-
[key: string]: unknown;
|
|
970
|
-
};
|
|
1672
|
+
vars?: Record<string, string | Json>;
|
|
971
1673
|
kv?: {
|
|
972
1674
|
binding: string;
|
|
973
1675
|
id: string;
|
|
@@ -979,23 +1681,30 @@ export declare interface UnstableDevOptions {
|
|
|
979
1681
|
script_name?: string | undefined;
|
|
980
1682
|
environment?: string | undefined;
|
|
981
1683
|
}[];
|
|
1684
|
+
services?: {
|
|
1685
|
+
binding: string;
|
|
1686
|
+
service: string;
|
|
1687
|
+
environment?: string | undefined;
|
|
1688
|
+
}[];
|
|
982
1689
|
r2?: {
|
|
983
1690
|
binding: string;
|
|
984
1691
|
bucket_name: string;
|
|
985
1692
|
preview_bucket_name?: string;
|
|
986
1693
|
}[];
|
|
1694
|
+
moduleRoot?: string;
|
|
1695
|
+
rules?: Rule[];
|
|
987
1696
|
logLevel?: "none" | "info" | "error" | "log" | "warn" | "debug";
|
|
988
|
-
logPrefix?: string;
|
|
989
1697
|
inspect?: boolean;
|
|
990
1698
|
local?: boolean;
|
|
991
1699
|
accountId?: string;
|
|
1700
|
+
updateCheck?: boolean;
|
|
992
1701
|
experimental?: {
|
|
1702
|
+
processEntrypoint?: boolean;
|
|
1703
|
+
additionalModules?: CfModule[];
|
|
993
1704
|
d1Databases?: Environment["d1_databases"];
|
|
994
1705
|
disableExperimentalWarning?: boolean;
|
|
995
1706
|
disableDevRegistry?: boolean;
|
|
996
1707
|
enablePagesAssetsServiceBinding?: EnablePagesAssetsServiceBindingOptions;
|
|
997
|
-
experimentalLocal?: boolean;
|
|
998
|
-
experimentalLocalRemoteKv?: boolean;
|
|
999
1708
|
forceLocal?: boolean;
|
|
1000
1709
|
liveReload?: boolean;
|
|
1001
1710
|
showInteractiveDevSession?: boolean;
|
|
@@ -1009,10 +1718,15 @@ export declare interface UnstableDevWorker {
|
|
|
1009
1718
|
port: number;
|
|
1010
1719
|
address: string;
|
|
1011
1720
|
stop: () => Promise<void>;
|
|
1012
|
-
fetch: (input?:
|
|
1721
|
+
fetch: (input?: RequestInfo_2, init?: RequestInit_2) => Promise<Response_2>;
|
|
1013
1722
|
waitUntilExit: () => Promise<void>;
|
|
1014
1723
|
}
|
|
1015
1724
|
|
|
1725
|
+
declare interface UserLimits {
|
|
1726
|
+
/** Maximum allowed CPU time for a worker's invocation in milliseconds */
|
|
1727
|
+
cpu_ms: number;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1016
1730
|
declare type ZoneIdRoute = {
|
|
1017
1731
|
pattern: string;
|
|
1018
1732
|
zone_id: string;
|