wrangler 0.0.0-e7a0cd5b → 0.0.0-e81b1611
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 +19 -65
- package/package.json +209 -191
- package/templates/__tests__/tsconfig-sanity.ts +12 -0
- package/templates/__tests__/tsconfig.json +8 -0
- package/templates/checked-fetch.js +19 -6
- package/templates/facade.d.ts +17 -0
- package/templates/gitignore +1 -0
- package/templates/init-tests/test-jest-new-worker.js +3 -5
- package/templates/init-tests/test-vitest-new-worker.js +3 -5
- package/templates/init-tests/test-vitest-new-worker.ts +25 -0
- package/templates/middleware/common.ts +9 -4
- package/templates/middleware/loader-modules.ts +64 -11
- package/templates/middleware/loader-sw.ts +47 -32
- package/templates/middleware/middleware-d1-beta.d.ts +3 -0
- package/templates/middleware/middleware-miniflare3-json-error.ts +33 -0
- 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-pipeline.ts +4 -1
- package/templates/pages-dev-util.ts +4 -1
- package/templates/pages-shim.ts +1 -1
- package/templates/pages-template-plugin.ts +31 -12
- package/templates/pages-template-worker.ts +11 -2
- package/templates/tsconfig-sanity.ts +11 -0
- package/templates/tsconfig.init.json +105 -0
- package/templates/tsconfig.json +5 -103
- package/wrangler-dist/cli.d.ts +951 -121
- package/wrangler-dist/cli.js +133766 -143686
- 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 -6316
- package/src/__tests__/access.test.ts +0 -25
- package/src/__tests__/api-dev.test.ts +0 -209
- package/src/__tests__/api-devregistry.test.js +0 -57
- 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 -4028
- package/src/__tests__/d1.test.ts +0 -72
- package/src/__tests__/delete.test.ts +0 -230
- package/src/__tests__/deployments.test.ts +0 -95
- package/src/__tests__/dev.test.tsx +0 -1509
- package/src/__tests__/dialogs.test.tsx +0 -40
- package/src/__tests__/generate.test.ts +0 -235
- 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-bin.ts +0 -36
- package/src/__tests__/helpers/mock-cfetch.ts +0 -333
- package/src/__tests__/helpers/mock-console.ts +0 -106
- package/src/__tests__/helpers/mock-dialogs.ts +0 -153
- package/src/__tests__/helpers/mock-get-zone-from-host.ts +0 -8
- 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 -7
- package/src/__tests__/helpers/mock-kv.ts +0 -33
- package/src/__tests__/helpers/mock-oauth-flow.ts +0 -252
- package/src/__tests__/helpers/mock-process.ts +0 -39
- package/src/__tests__/helpers/mock-stdin.ts +0 -108
- package/src/__tests__/helpers/mock-web-socket.ts +0 -29
- package/src/__tests__/helpers/msw/handlers/access.ts +0 -13
- package/src/__tests__/helpers/msw/handlers/deployments.ts +0 -59
- package/src/__tests__/helpers/msw/handlers/namespaces.ts +0 -104
- package/src/__tests__/helpers/msw/handlers/oauth.ts +0 -36
- package/src/__tests__/helpers/msw/handlers/r2.ts +0 -80
- package/src/__tests__/helpers/msw/handlers/script.ts +0 -75
- package/src/__tests__/helpers/msw/handlers/user.ts +0 -63
- package/src/__tests__/helpers/msw/handlers/zones.ts +0 -22
- package/src/__tests__/helpers/msw/index.ts +0 -21
- 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 -262
- package/src/__tests__/init.test.ts +0 -2900
- package/src/__tests__/jest.setup.ts +0 -202
- package/src/__tests__/kv.test.ts +0 -1675
- package/src/__tests__/logger.test.ts +0 -141
- package/src/__tests__/metrics.test.ts +0 -450
- package/src/__tests__/middleware.scheduled.test.ts +0 -135
- package/src/__tests__/middleware.test.ts +0 -726
- package/src/__tests__/package-manager.test.ts +0 -353
- package/src/__tests__/pages.test.ts +0 -2223
- package/src/__tests__/parse.test.ts +0 -330
- package/src/__tests__/paths.test.ts +0 -39
- package/src/__tests__/publish.test.ts +0 -7660
- package/src/__tests__/pubsub.test.ts +0 -370
- package/src/__tests__/queues.test.ts +0 -371
- package/src/__tests__/r2.test.ts +0 -376
- package/src/__tests__/route.test.ts +0 -45
- package/src/__tests__/secret.test.ts +0 -644
- package/src/__tests__/tail.test.ts +0 -800
- package/src/__tests__/test-old-node-version.js +0 -31
- package/src/__tests__/type-generation.test.ts +0 -217
- package/src/__tests__/user.test.ts +0 -155
- 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 -278
- package/src/__tests__/worker-namespace.test.ts +0 -326
- package/src/abort.d.ts +0 -3
- package/src/api/dev.ts +0 -208
- package/src/api/index.ts +0 -2
- package/src/bundle-reporter.tsx +0 -68
- package/src/bundle.ts +0 -785
- package/src/cfetch/index.ts +0 -160
- package/src/cfetch/internal.ts +0 -263
- 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 -563
- package/src/config/index.ts +0 -342
- package/src/config/validation-helpers.ts +0 -597
- package/src/config/validation.ts +0 -2113
- package/src/config-cache.ts +0 -85
- package/src/create-worker-preview.ts +0 -282
- package/src/create-worker-upload-form.ts +0 -321
- package/src/d1/backups.tsx +0 -218
- package/src/d1/create.tsx +0 -54
- package/src/d1/delete.tsx +0 -56
- package/src/d1/execute.tsx +0 -299
- package/src/d1/formatTimeAgo.ts +0 -14
- package/src/d1/index.ts +0 -76
- package/src/d1/list.tsx +0 -48
- package/src/d1/options.ts +0 -12
- package/src/d1/types.tsx +0 -14
- package/src/d1/utils.ts +0 -39
- package/src/delete.ts +0 -108
- package/src/deployments.ts +0 -74
- package/src/deprecated/index.ts +0 -438
- package/src/dev/dev-vars.ts +0 -39
- package/src/dev/dev.tsx +0 -587
- package/src/dev/get-local-persistence-path.tsx +0 -31
- package/src/dev/local.tsx +0 -717
- package/src/dev/remote.tsx +0 -603
- package/src/dev/start-server.ts +0 -513
- package/src/dev/use-esbuild.ts +0 -204
- package/src/dev/validate-dev-props.ts +0 -31
- package/src/dev-registry.tsx +0 -201
- package/src/dev.tsx +0 -869
- package/src/dialogs.tsx +0 -163
- package/src/dispatch-namespace.ts +0 -207
- package/src/durable.ts +0 -102
- package/src/entry.ts +0 -329
- package/src/environment-variables.ts +0 -50
- package/src/errors.ts +0 -11
- package/src/git-client.ts +0 -124
- package/src/global-wrangler-config-path.ts +0 -26
- package/src/https-options.ts +0 -127
- package/src/index.tsx +0 -684
- package/src/init.ts +0 -970
- 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/kv/helpers.ts +0 -430
- package/src/kv/index.ts +0 -596
- package/src/logger.ts +0 -92
- 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 -94
- package/src/miniflare-cli/README.md +0 -30
- package/src/miniflare-cli/assets.ts +0 -215
- package/src/miniflare-cli/index.ts +0 -213
- package/src/miniflare-cli/request-context.ts +0 -40
- 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.tsx +0 -238
- package/src/pages/constants.ts +0 -18
- package/src/pages/deployments.tsx +0 -106
- package/src/pages/dev.tsx +0 -693
- package/src/pages/errors.ts +0 -66
- package/src/pages/functions/buildPlugin.ts +0 -110
- package/src/pages/functions/buildWorker.ts +0 -156
- 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.tsx +0 -82
- package/src/pages/hash.tsx +0 -13
- package/src/pages/index.tsx +0 -94
- package/src/pages/projects.tsx +0 -169
- package/src/pages/publish.tsx +0 -436
- package/src/pages/types.ts +0 -49
- package/src/pages/upload.tsx +0 -425
- package/src/pages/utils.ts +0 -12
- package/src/parse.ts +0 -286
- package/src/paths.ts +0 -71
- package/src/proxy.ts +0 -689
- package/src/publish/index.ts +0 -270
- package/src/publish/publish.ts +0 -1035
- package/src/pubsub/index.ts +0 -286
- package/src/pubsub/pubsub-commands.tsx +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 -33
- package/src/queues/cli/commands/list.ts +0 -25
- package/src/queues/client.ts +0 -135
- package/src/r2/helpers.ts +0 -131
- package/src/r2/index.ts +0 -277
- package/src/routes.ts +0 -140
- package/src/secret/index.ts +0 -379
- package/src/selfsigned.d.ts +0 -29
- package/src/sites.tsx +0 -372
- package/src/tail/createTail.ts +0 -315
- package/src/tail/filters.ts +0 -277
- package/src/tail/index.ts +0 -214
- package/src/tail/printing.ts +0 -107
- package/src/type-generation.ts +0 -159
- package/src/update-check.ts +0 -19
- package/src/user/access.ts +0 -69
- package/src/user/choose-account.tsx +0 -69
- package/src/user/env-vars.ts +0 -46
- package/src/user/generate-auth-url.ts +0 -33
- package/src/user/generate-random-state.ts +0 -16
- package/src/user/index.ts +0 -3
- package/src/user/user.tsx +0 -1192
- package/src/utils/collectKeyValues.ts +0 -14
- package/src/whoami.tsx +0 -169
- package/src/worker.ts +0 -242
- package/src/yargs-types.ts +0 -20
- package/src/zones.ts +0 -191
- package/templates/d1-beta-facade.js +0 -174
- package/templates/experimental-local-cache-stubs.js +0 -27
- package/templates/first-party-worker-module-facade.ts +0 -18
- package/templates/format-dev-errors.ts +0 -32
- package/templates/serve-static-assets.ts +0 -63
- package/templates/service-bindings-module-facade.js +0 -54
- package/templates/service-bindings-sw-facade.js +0 -42
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
|
+
type: string;
|
|
277
|
+
metadata: {
|
|
278
|
+
branch: string;
|
|
279
|
+
commit_hash: string;
|
|
280
|
+
commit_message: string;
|
|
281
|
+
};
|
|
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,63 +350,251 @@ declare interface DeprecatedUpload {
|
|
|
74
350
|
rules?: Environment["rules"];
|
|
75
351
|
}
|
|
76
352
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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;
|
|
80
432
|
}
|
|
81
433
|
|
|
82
|
-
declare
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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[];
|
|
132
585
|
}
|
|
133
586
|
|
|
587
|
+
declare type DurableObjectBindings = {
|
|
588
|
+
/** The name of the binding used to refer to the Durable Object */
|
|
589
|
+
name: string;
|
|
590
|
+
/** The exported class name of the Durable Object */
|
|
591
|
+
class_name: string;
|
|
592
|
+
/** The script where the Durable Object is defined (if it's external to this worker) */
|
|
593
|
+
script_name?: string;
|
|
594
|
+
/** The service environment of the script_name to bind to */
|
|
595
|
+
environment?: string;
|
|
596
|
+
}[];
|
|
597
|
+
|
|
134
598
|
declare interface EnablePagesAssetsServiceBindingOptions {
|
|
135
599
|
proxyPort?: number;
|
|
136
600
|
directory?: string;
|
|
@@ -188,11 +652,26 @@ declare interface EnvironmentInheritable {
|
|
|
188
652
|
* The entrypoint/path to the JavaScript file that will be executed.
|
|
189
653
|
*/
|
|
190
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;
|
|
191
670
|
/**
|
|
192
671
|
* Whether we use <name>.<subdomain>.workers.dev to
|
|
193
672
|
* test and deploy your worker.
|
|
194
673
|
*
|
|
195
|
-
* @default `true` (This is a breaking change from
|
|
674
|
+
* @default `true` (This is a breaking change from Wrangler v1)
|
|
196
675
|
* @breaking
|
|
197
676
|
* @inheritable
|
|
198
677
|
*/
|
|
@@ -290,7 +769,7 @@ declare interface EnvironmentInheritable {
|
|
|
290
769
|
upload?: DeprecatedUpload;
|
|
291
770
|
};
|
|
292
771
|
/**
|
|
293
|
-
* Skip internal build steps and directly
|
|
772
|
+
* Skip internal build steps and directly deploy script
|
|
294
773
|
* @inheritable
|
|
295
774
|
*/
|
|
296
775
|
no_bundle: boolean | undefined;
|
|
@@ -318,6 +797,8 @@ declare interface EnvironmentInheritable {
|
|
|
318
797
|
binding: string;
|
|
319
798
|
/** The namespace to bind to. */
|
|
320
799
|
namespace: string;
|
|
800
|
+
/** Details about the outbound worker which will handle outbound requests from your namespace */
|
|
801
|
+
outbound?: DispatchNamespaceOutbound;
|
|
321
802
|
}[];
|
|
322
803
|
/**
|
|
323
804
|
* Designates this worker as an internal-only "first-party" worker.
|
|
@@ -331,15 +812,12 @@ declare interface EnvironmentInheritable {
|
|
|
331
812
|
*/
|
|
332
813
|
zone_id?: string;
|
|
333
814
|
/**
|
|
334
|
-
*
|
|
335
|
-
* Then add a binding per field in the top level message that you will send to logfwdr
|
|
815
|
+
* List of bindings that you will send to logfwdr
|
|
336
816
|
*
|
|
337
|
-
* @default `{
|
|
817
|
+
* @default `{bindings:[]}`
|
|
338
818
|
* @inheritable
|
|
339
819
|
*/
|
|
340
820
|
logfwdr: {
|
|
341
|
-
/** capnp schema filename */
|
|
342
|
-
schema: string | undefined;
|
|
343
821
|
bindings: {
|
|
344
822
|
/** The binding name used to refer to logfwdr */
|
|
345
823
|
name: string;
|
|
@@ -358,6 +836,14 @@ declare interface EnvironmentInheritable {
|
|
|
358
836
|
* @inheritable
|
|
359
837
|
*/
|
|
360
838
|
logpush: boolean | undefined;
|
|
839
|
+
/**
|
|
840
|
+
* Specify how the worker should be located to minimize round-trip time.
|
|
841
|
+
*
|
|
842
|
+
* More details: https://developers.cloudflare.com/workers/platform/smart-placement/
|
|
843
|
+
*/
|
|
844
|
+
placement: {
|
|
845
|
+
mode: "off" | "smart";
|
|
846
|
+
} | undefined;
|
|
361
847
|
}
|
|
362
848
|
|
|
363
849
|
/**
|
|
@@ -387,16 +873,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
387
873
|
* @default `{}`
|
|
388
874
|
* @nonInheritable
|
|
389
875
|
*/
|
|
390
|
-
vars:
|
|
391
|
-
[key: string]: unknown;
|
|
392
|
-
};
|
|
393
|
-
/**
|
|
394
|
-
* Specifies namespace binding that is bound to this Worker environment.
|
|
395
|
-
* It allows for access at runtime to the Workers metadata.
|
|
396
|
-
* @default `undefined`
|
|
397
|
-
* @nonInheritable
|
|
398
|
-
**/
|
|
399
|
-
metadata_binding: string | undefined;
|
|
876
|
+
vars: Record<string, string | Json>;
|
|
400
877
|
/**
|
|
401
878
|
* A list of durable objects that your worker should be bound to.
|
|
402
879
|
*
|
|
@@ -410,16 +887,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
410
887
|
* @nonInheritable
|
|
411
888
|
*/
|
|
412
889
|
durable_objects: {
|
|
413
|
-
bindings:
|
|
414
|
-
/** The name of the binding used to refer to the Durable Object */
|
|
415
|
-
name: string;
|
|
416
|
-
/** The exported class name of the Durable Object */
|
|
417
|
-
class_name: string;
|
|
418
|
-
/** The script where the Durable Object is defined (if it's external to this worker) */
|
|
419
|
-
script_name?: string;
|
|
420
|
-
/** The service environment of the script_name to bind to */
|
|
421
|
-
environment?: string;
|
|
422
|
-
}[];
|
|
890
|
+
bindings: DurableObjectBindings;
|
|
423
891
|
};
|
|
424
892
|
/**
|
|
425
893
|
* These specify any Workers KV Namespaces you want to
|
|
@@ -442,6 +910,23 @@ declare interface EnvironmentNonInheritable {
|
|
|
442
910
|
/** The ID of the KV namespace used during `wrangler dev` */
|
|
443
911
|
preview_id?: string;
|
|
444
912
|
}[];
|
|
913
|
+
/**
|
|
914
|
+
* These specify bindings to send email from inside your Worker.
|
|
915
|
+
*
|
|
916
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
917
|
+
* and so must be specified in every named environment.
|
|
918
|
+
*
|
|
919
|
+
* @default `[]`
|
|
920
|
+
* @nonInheritable
|
|
921
|
+
*/
|
|
922
|
+
send_email: {
|
|
923
|
+
/** The binding name used to refer to the this binding */
|
|
924
|
+
name: string;
|
|
925
|
+
/** If this binding should be restricted to a specific verified address */
|
|
926
|
+
destination_address?: string;
|
|
927
|
+
/** If this binding should be restricted to a set of verified addresses */
|
|
928
|
+
allowed_destination_addresses?: string[];
|
|
929
|
+
}[];
|
|
445
930
|
/**
|
|
446
931
|
* Specifies Queues that are bound to this Worker environment.
|
|
447
932
|
*
|
|
@@ -471,6 +956,8 @@ declare interface EnvironmentNonInheritable {
|
|
|
471
956
|
max_retries?: number;
|
|
472
957
|
/** The queue to send messages that failed to be consumed. */
|
|
473
958
|
dead_letter_queue?: string;
|
|
959
|
+
/** 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. */
|
|
960
|
+
max_concurrency?: number | null;
|
|
474
961
|
}[];
|
|
475
962
|
};
|
|
476
963
|
/**
|
|
@@ -489,6 +976,8 @@ declare interface EnvironmentNonInheritable {
|
|
|
489
976
|
bucket_name: string;
|
|
490
977
|
/** The preview name of this R2 bucket at the edge. */
|
|
491
978
|
preview_bucket_name?: string;
|
|
979
|
+
/** The jurisdiction that the bucket exists in. Default if not present. */
|
|
980
|
+
jurisdiction?: string;
|
|
492
981
|
}[];
|
|
493
982
|
/**
|
|
494
983
|
* Specifies D1 databases that are bound to this Worker environment.
|
|
@@ -508,6 +997,57 @@ declare interface EnvironmentNonInheritable {
|
|
|
508
997
|
database_id: string;
|
|
509
998
|
/** The UUID of this D1 database for Wrangler Dev (if specified). */
|
|
510
999
|
preview_database_id?: string;
|
|
1000
|
+
/** The name of the migrations table for this D1 database (defaults to 'd1_migrations'). */
|
|
1001
|
+
migrations_table?: string;
|
|
1002
|
+
/** The path to the directory of migrations for this D1 database (defaults to './migrations'). */
|
|
1003
|
+
migrations_dir?: string;
|
|
1004
|
+
/** Internal use only. */
|
|
1005
|
+
database_internal_env?: string;
|
|
1006
|
+
}[];
|
|
1007
|
+
/**
|
|
1008
|
+
* Specifies Vectorize indexes that are bound to this Worker environment.
|
|
1009
|
+
*
|
|
1010
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1011
|
+
* and so must be specified in every named environment.
|
|
1012
|
+
*
|
|
1013
|
+
* @default `[]`
|
|
1014
|
+
* @nonInheritable
|
|
1015
|
+
*/
|
|
1016
|
+
vectorize: {
|
|
1017
|
+
/** The binding name used to refer to the Vectorize index in the worker. */
|
|
1018
|
+
binding: string;
|
|
1019
|
+
/** The name of the index. */
|
|
1020
|
+
index_name: string;
|
|
1021
|
+
}[];
|
|
1022
|
+
/**
|
|
1023
|
+
* Specifies Constellation projects that are bound to this Worker environment.
|
|
1024
|
+
*
|
|
1025
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1026
|
+
* and so must be specified in every named environment.
|
|
1027
|
+
*
|
|
1028
|
+
* @default `[]`
|
|
1029
|
+
* @nonInheritable
|
|
1030
|
+
*/
|
|
1031
|
+
constellation: {
|
|
1032
|
+
/** The binding name used to refer to the project in the worker. */
|
|
1033
|
+
binding: string;
|
|
1034
|
+
/** The id of the project. */
|
|
1035
|
+
project_id: string;
|
|
1036
|
+
}[];
|
|
1037
|
+
/**
|
|
1038
|
+
* Specifies Hyperdrive configs that are bound to this Worker environment.
|
|
1039
|
+
*
|
|
1040
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1041
|
+
* and so must be specified in every named environment.
|
|
1042
|
+
*
|
|
1043
|
+
* @default `[]`
|
|
1044
|
+
* @nonInheritable
|
|
1045
|
+
*/
|
|
1046
|
+
hyperdrive: {
|
|
1047
|
+
/** The binding name used to refer to the project in the worker. */
|
|
1048
|
+
binding: string;
|
|
1049
|
+
/** The id of the database. */
|
|
1050
|
+
id: string;
|
|
511
1051
|
}[];
|
|
512
1052
|
/**
|
|
513
1053
|
* Specifies service bindings (worker-to-worker) that are bound to this Worker environment.
|
|
@@ -526,13 +1066,39 @@ declare interface EnvironmentNonInheritable {
|
|
|
526
1066
|
/** The environment of the service (e.g. production, staging, etc). */
|
|
527
1067
|
environment?: string;
|
|
528
1068
|
}[] | undefined;
|
|
1069
|
+
/**
|
|
1070
|
+
* Specifies analytics engine datasets that are bound to this Worker environment.
|
|
1071
|
+
*
|
|
1072
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1073
|
+
* and so must be specified in every named environment.
|
|
1074
|
+
*
|
|
1075
|
+
* @default `[]`
|
|
1076
|
+
* @nonInheritable
|
|
1077
|
+
*/
|
|
1078
|
+
analytics_engine_datasets: {
|
|
1079
|
+
/** The binding name used to refer to the dataset in the worker. */
|
|
1080
|
+
binding: string;
|
|
1081
|
+
/** The name of this dataset to write to. */
|
|
1082
|
+
dataset?: string;
|
|
1083
|
+
}[];
|
|
1084
|
+
/**
|
|
1085
|
+
* A browser that will be usable from the worker.
|
|
1086
|
+
*/
|
|
1087
|
+
browser: {
|
|
1088
|
+
binding: string;
|
|
1089
|
+
} | undefined;
|
|
1090
|
+
/**
|
|
1091
|
+
* Binding to the AI project.
|
|
1092
|
+
*/
|
|
1093
|
+
ai: {
|
|
1094
|
+
binding: string;
|
|
1095
|
+
} | undefined;
|
|
529
1096
|
/**
|
|
530
1097
|
* "Unsafe" tables for features that aren't directly supported by wrangler.
|
|
531
1098
|
*
|
|
532
1099
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
533
1100
|
* and so must be specified in every named environment.
|
|
534
1101
|
*
|
|
535
|
-
* @default `{ bindings: [] }`
|
|
536
1102
|
* @nonInheritable
|
|
537
1103
|
*/
|
|
538
1104
|
unsafe: {
|
|
@@ -540,18 +1106,157 @@ declare interface EnvironmentNonInheritable {
|
|
|
540
1106
|
* A set of bindings that should be put into a Worker's upload metadata without changes. These
|
|
541
1107
|
* can be used to implement bindings for features that haven't released and aren't supported
|
|
542
1108
|
* directly by wrangler or miniflare.
|
|
543
|
-
*
|
|
544
|
-
* @default []
|
|
545
1109
|
*/
|
|
546
|
-
bindings
|
|
1110
|
+
bindings?: {
|
|
547
1111
|
name: string;
|
|
548
1112
|
type: string;
|
|
549
1113
|
[key: string]: unknown;
|
|
550
1114
|
}[];
|
|
1115
|
+
/**
|
|
1116
|
+
* Arbitrary key/value pairs that will be included in the uploaded metadata. Values specified
|
|
1117
|
+
* here will always be applied to metadata last, so can add new or override existing fields.
|
|
1118
|
+
*/
|
|
1119
|
+
metadata?: {
|
|
1120
|
+
[key: string]: string;
|
|
1121
|
+
};
|
|
1122
|
+
/**
|
|
1123
|
+
* Used for internal capnp uploads for the Workers runtime
|
|
1124
|
+
*/
|
|
1125
|
+
capnp?: {
|
|
1126
|
+
base_path: string;
|
|
1127
|
+
source_schemas: string[];
|
|
1128
|
+
compiled_schema?: never;
|
|
1129
|
+
} | {
|
|
1130
|
+
base_path?: never;
|
|
1131
|
+
source_schemas?: never;
|
|
1132
|
+
compiled_schema: string;
|
|
1133
|
+
};
|
|
551
1134
|
};
|
|
1135
|
+
mtls_certificates: {
|
|
1136
|
+
/** The binding name used to refer to the certificate in the worker */
|
|
1137
|
+
binding: string;
|
|
1138
|
+
/** The uuid of the uploaded mTLS certificate */
|
|
1139
|
+
certificate_id: string;
|
|
1140
|
+
}[];
|
|
1141
|
+
tail_consumers?: TailConsumer[];
|
|
552
1142
|
}
|
|
553
1143
|
|
|
554
|
-
declare
|
|
1144
|
+
declare namespace Errors {
|
|
1145
|
+
class UndiciError extends Error { }
|
|
1146
|
+
|
|
1147
|
+
/** Connect timeout error. */
|
|
1148
|
+
class ConnectTimeoutError extends UndiciError {
|
|
1149
|
+
name: 'ConnectTimeoutError';
|
|
1150
|
+
code: 'UND_ERR_CONNECT_TIMEOUT';
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
/** A header exceeds the `headersTimeout` option. */
|
|
1154
|
+
class HeadersTimeoutError extends UndiciError {
|
|
1155
|
+
name: 'HeadersTimeoutError';
|
|
1156
|
+
code: 'UND_ERR_HEADERS_TIMEOUT';
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
/** Headers overflow error. */
|
|
1160
|
+
class HeadersOverflowError extends UndiciError {
|
|
1161
|
+
name: 'HeadersOverflowError'
|
|
1162
|
+
code: 'UND_ERR_HEADERS_OVERFLOW'
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
/** A body exceeds the `bodyTimeout` option. */
|
|
1166
|
+
class BodyTimeoutError extends UndiciError {
|
|
1167
|
+
name: 'BodyTimeoutError';
|
|
1168
|
+
code: 'UND_ERR_BODY_TIMEOUT';
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
class ResponseStatusCodeError extends UndiciError {
|
|
1172
|
+
name: 'ResponseStatusCodeError';
|
|
1173
|
+
code: 'UND_ERR_RESPONSE_STATUS_CODE';
|
|
1174
|
+
body: null | Record<string, any> | string
|
|
1175
|
+
status: number
|
|
1176
|
+
statusCode: number
|
|
1177
|
+
headers: IncomingHttpHeaders | string[] | null;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
/** Passed an invalid argument. */
|
|
1181
|
+
class InvalidArgumentError extends UndiciError {
|
|
1182
|
+
name: 'InvalidArgumentError';
|
|
1183
|
+
code: 'UND_ERR_INVALID_ARG';
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
/** Returned an invalid value. */
|
|
1187
|
+
class InvalidReturnValueError extends UndiciError {
|
|
1188
|
+
name: 'InvalidReturnValueError';
|
|
1189
|
+
code: 'UND_ERR_INVALID_RETURN_VALUE';
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
/** The request has been aborted by the user. */
|
|
1193
|
+
class RequestAbortedError extends UndiciError {
|
|
1194
|
+
name: 'AbortError';
|
|
1195
|
+
code: 'UND_ERR_ABORTED';
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
/** Expected error with reason. */
|
|
1199
|
+
class InformationalError extends UndiciError {
|
|
1200
|
+
name: 'InformationalError';
|
|
1201
|
+
code: 'UND_ERR_INFO';
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
/** Request body length does not match content-length header. */
|
|
1205
|
+
class RequestContentLengthMismatchError extends UndiciError {
|
|
1206
|
+
name: 'RequestContentLengthMismatchError';
|
|
1207
|
+
code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH';
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
/** Response body length does not match content-length header. */
|
|
1211
|
+
class ResponseContentLengthMismatchError extends UndiciError {
|
|
1212
|
+
name: 'ResponseContentLengthMismatchError';
|
|
1213
|
+
code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH';
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
/** Trying to use a destroyed client. */
|
|
1217
|
+
class ClientDestroyedError extends UndiciError {
|
|
1218
|
+
name: 'ClientDestroyedError';
|
|
1219
|
+
code: 'UND_ERR_DESTROYED';
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/** Trying to use a closed client. */
|
|
1223
|
+
class ClientClosedError extends UndiciError {
|
|
1224
|
+
name: 'ClientClosedError';
|
|
1225
|
+
code: 'UND_ERR_CLOSED';
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
/** There is an error with the socket. */
|
|
1229
|
+
class SocketError extends UndiciError {
|
|
1230
|
+
name: 'SocketError';
|
|
1231
|
+
code: 'UND_ERR_SOCKET';
|
|
1232
|
+
socket: Client.SocketInfo | null
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
/** Encountered unsupported functionality. */
|
|
1236
|
+
class NotSupportedError extends UndiciError {
|
|
1237
|
+
name: 'NotSupportedError';
|
|
1238
|
+
code: 'UND_ERR_NOT_SUPPORTED';
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
/** No upstream has been added to the BalancedPool. */
|
|
1242
|
+
class BalancedPoolMissingUpstreamError extends UndiciError {
|
|
1243
|
+
name: 'MissingUpstreamError';
|
|
1244
|
+
code: 'UND_ERR_BPL_MISSING_UPSTREAM';
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
class HTTPParserError extends UndiciError {
|
|
1248
|
+
name: 'HTTPParserError';
|
|
1249
|
+
code: string;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
/** The response exceed the length allowed. */
|
|
1253
|
+
class ResponseExceededMaxSizeError extends UndiciError {
|
|
1254
|
+
name: 'ResponseExceededMaxSizeError';
|
|
1255
|
+
code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
declare class File_2 extends Blob_2 {
|
|
555
1260
|
/**
|
|
556
1261
|
* Creates a new File instance.
|
|
557
1262
|
*
|
|
@@ -584,7 +1289,7 @@ declare interface FilePropertyBag extends BlobPropertyBag {
|
|
|
584
1289
|
/**
|
|
585
1290
|
* 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().
|
|
586
1291
|
*/
|
|
587
|
-
declare class
|
|
1292
|
+
declare class FormData_2 {
|
|
588
1293
|
/**
|
|
589
1294
|
* Appends a new value onto an existing key inside a FormData object,
|
|
590
1295
|
* or adds the key if it does not already exist.
|
|
@@ -649,7 +1354,7 @@ declare class FormData {
|
|
|
649
1354
|
* Executes given callback function for each field of the FormData instance
|
|
650
1355
|
*/
|
|
651
1356
|
forEach: (
|
|
652
|
-
callbackfn: (value: FormDataEntryValue, key: string, iterable:
|
|
1357
|
+
callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData_2) => void,
|
|
653
1358
|
thisArg?: unknown
|
|
654
1359
|
) => void
|
|
655
1360
|
|
|
@@ -682,17 +1387,18 @@ declare class FormData {
|
|
|
682
1387
|
/**
|
|
683
1388
|
* A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
|
|
684
1389
|
*/
|
|
685
|
-
declare type FormDataEntryValue = string |
|
|
1390
|
+
declare type FormDataEntryValue = string | File_2
|
|
686
1391
|
|
|
687
|
-
declare class
|
|
688
|
-
constructor (init?:
|
|
1392
|
+
declare class Headers_2 implements SpecIterable<[string, string]> {
|
|
1393
|
+
constructor (init?: HeadersInit_2)
|
|
689
1394
|
readonly append: (name: string, value: string) => void
|
|
690
1395
|
readonly delete: (name: string) => void
|
|
691
1396
|
readonly get: (name: string) => string | null
|
|
692
1397
|
readonly has: (name: string) => boolean
|
|
693
1398
|
readonly set: (name: string, value: string) => void
|
|
1399
|
+
readonly getSetCookie: () => string[]
|
|
694
1400
|
readonly forEach: (
|
|
695
|
-
callbackfn: (value: string, key: string, iterable:
|
|
1401
|
+
callbackfn: (value: string, key: string, iterable: Headers_2) => void,
|
|
696
1402
|
thisArg?: unknown
|
|
697
1403
|
) => void
|
|
698
1404
|
|
|
@@ -702,7 +1408,60 @@ declare class Headers implements SpecIterable<[string, string]> {
|
|
|
702
1408
|
readonly [Symbol.iterator]: () => SpecIterator<[string, string]>
|
|
703
1409
|
}
|
|
704
1410
|
|
|
705
|
-
declare type
|
|
1411
|
+
declare type HeadersInit_2 = string[][] | Record<string, string | ReadonlyArray<string>> | Headers_2
|
|
1412
|
+
|
|
1413
|
+
/**
|
|
1414
|
+
* The header type declaration of `undici`.
|
|
1415
|
+
*/
|
|
1416
|
+
declare type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
|
|
1417
|
+
|
|
1418
|
+
declare interface PagesDeployOptions {
|
|
1419
|
+
/**
|
|
1420
|
+
* Path to static assets to deploy to Pages
|
|
1421
|
+
*/
|
|
1422
|
+
directory: string;
|
|
1423
|
+
/**
|
|
1424
|
+
* The Cloudflare Account ID that owns the project that's
|
|
1425
|
+
* being published
|
|
1426
|
+
*/
|
|
1427
|
+
accountId: string;
|
|
1428
|
+
/**
|
|
1429
|
+
* The name of the project to be published
|
|
1430
|
+
*/
|
|
1431
|
+
projectName: string;
|
|
1432
|
+
/**
|
|
1433
|
+
* Branch name to use. Defaults to production branch
|
|
1434
|
+
*/
|
|
1435
|
+
branch?: string;
|
|
1436
|
+
/**
|
|
1437
|
+
* Whether or not to skip local file upload result caching
|
|
1438
|
+
*/
|
|
1439
|
+
skipCaching?: boolean;
|
|
1440
|
+
/**
|
|
1441
|
+
* Commit message associated to deployment
|
|
1442
|
+
*/
|
|
1443
|
+
commitMessage?: string;
|
|
1444
|
+
/**
|
|
1445
|
+
* Commit hash associated to deployment
|
|
1446
|
+
*/
|
|
1447
|
+
commitHash?: string;
|
|
1448
|
+
/**
|
|
1449
|
+
* Whether or not the deployment should be considered to be
|
|
1450
|
+
* in a dirty commit state
|
|
1451
|
+
*/
|
|
1452
|
+
commitDirty?: boolean;
|
|
1453
|
+
/**
|
|
1454
|
+
* Path to the project's functions directory. Default uses
|
|
1455
|
+
* the current working directory + /functions since this is
|
|
1456
|
+
* typically called in a CLI
|
|
1457
|
+
*/
|
|
1458
|
+
functionsDirectory?: string;
|
|
1459
|
+
/**
|
|
1460
|
+
* Whether to run bundling on `_worker.js` before deploying.
|
|
1461
|
+
* Default: true
|
|
1462
|
+
*/
|
|
1463
|
+
bundle?: boolean;
|
|
1464
|
+
}
|
|
706
1465
|
|
|
707
1466
|
declare type ReferrerPolicy =
|
|
708
1467
|
| ''
|
|
@@ -715,13 +1474,13 @@ declare type ReferrerPolicy =
|
|
|
715
1474
|
| 'strict-origin-when-cross-origin'
|
|
716
1475
|
| 'unsafe-url';
|
|
717
1476
|
|
|
718
|
-
declare class
|
|
719
|
-
constructor (input:
|
|
1477
|
+
declare class Request_2 implements BodyMixin {
|
|
1478
|
+
constructor (input: RequestInfo_2, init?: RequestInit_2)
|
|
720
1479
|
|
|
721
1480
|
readonly cache: RequestCache
|
|
722
1481
|
readonly credentials: RequestCredentials
|
|
723
1482
|
readonly destination: RequestDestination
|
|
724
|
-
readonly headers:
|
|
1483
|
+
readonly headers: Headers_2
|
|
725
1484
|
readonly integrity: string
|
|
726
1485
|
readonly method: string
|
|
727
1486
|
readonly mode: RequestMode
|
|
@@ -731,17 +1490,18 @@ declare class Request implements BodyMixin {
|
|
|
731
1490
|
|
|
732
1491
|
readonly keepalive: boolean
|
|
733
1492
|
readonly signal: AbortSignal
|
|
1493
|
+
readonly duplex: RequestDuplex
|
|
734
1494
|
|
|
735
|
-
readonly body:
|
|
1495
|
+
readonly body: ReadableStream_2 | null
|
|
736
1496
|
readonly bodyUsed: boolean
|
|
737
1497
|
|
|
738
1498
|
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
739
1499
|
readonly blob: () => Promise<Blob_2>
|
|
740
|
-
readonly formData: () => Promise<
|
|
1500
|
+
readonly formData: () => Promise<FormData_2>
|
|
741
1501
|
readonly json: () => Promise<unknown>
|
|
742
1502
|
readonly text: () => Promise<string>
|
|
743
1503
|
|
|
744
|
-
readonly clone: () =>
|
|
1504
|
+
readonly clone: () => Request_2
|
|
745
1505
|
}
|
|
746
1506
|
|
|
747
1507
|
declare type RequestCache =
|
|
@@ -774,13 +1534,15 @@ declare type RequestDestination =
|
|
|
774
1534
|
| 'worker'
|
|
775
1535
|
| 'xslt'
|
|
776
1536
|
|
|
777
|
-
declare type
|
|
1537
|
+
declare type RequestDuplex = 'half'
|
|
778
1538
|
|
|
779
|
-
declare
|
|
1539
|
+
declare type RequestInfo_2 = string | URL_2 | Request_2
|
|
1540
|
+
|
|
1541
|
+
declare interface RequestInit_2 {
|
|
780
1542
|
method?: string
|
|
781
1543
|
keepalive?: boolean
|
|
782
|
-
headers?:
|
|
783
|
-
body?:
|
|
1544
|
+
headers?: HeadersInit_2
|
|
1545
|
+
body?: BodyInit_2
|
|
784
1546
|
redirect?: RequestRedirect
|
|
785
1547
|
integrity?: string
|
|
786
1548
|
signal?: AbortSignal
|
|
@@ -790,16 +1552,17 @@ declare interface RequestInit {
|
|
|
790
1552
|
referrerPolicy?: ReferrerPolicy
|
|
791
1553
|
window?: null
|
|
792
1554
|
dispatcher?: Dispatcher
|
|
1555
|
+
duplex?: RequestDuplex
|
|
793
1556
|
}
|
|
794
1557
|
|
|
795
1558
|
declare type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
|
|
796
1559
|
|
|
797
1560
|
declare type RequestRedirect = 'error' | 'follow' | 'manual'
|
|
798
1561
|
|
|
799
|
-
declare class
|
|
800
|
-
constructor (body?:
|
|
1562
|
+
declare class Response_2 implements BodyMixin {
|
|
1563
|
+
constructor (body?: BodyInit_2, init?: ResponseInit_2)
|
|
801
1564
|
|
|
802
|
-
readonly headers:
|
|
1565
|
+
readonly headers: Headers_2
|
|
803
1566
|
readonly ok: boolean
|
|
804
1567
|
readonly status: number
|
|
805
1568
|
readonly statusText: string
|
|
@@ -807,26 +1570,26 @@ declare class Response implements BodyMixin {
|
|
|
807
1570
|
readonly url: string
|
|
808
1571
|
readonly redirected: boolean
|
|
809
1572
|
|
|
810
|
-
readonly body:
|
|
1573
|
+
readonly body: ReadableStream_2 | null
|
|
811
1574
|
readonly bodyUsed: boolean
|
|
812
1575
|
|
|
813
1576
|
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
814
1577
|
readonly blob: () => Promise<Blob_2>
|
|
815
|
-
readonly formData: () => Promise<
|
|
1578
|
+
readonly formData: () => Promise<FormData_2>
|
|
816
1579
|
readonly json: () => Promise<unknown>
|
|
817
1580
|
readonly text: () => Promise<string>
|
|
818
1581
|
|
|
819
|
-
readonly clone: () =>
|
|
1582
|
+
readonly clone: () => Response_2
|
|
820
1583
|
|
|
821
|
-
static error ():
|
|
822
|
-
static json(data: any, init?:
|
|
823
|
-
static redirect (url: string | URL_2, status: ResponseRedirectStatus):
|
|
1584
|
+
static error (): Response_2
|
|
1585
|
+
static json(data: any, init?: ResponseInit_2): Response_2
|
|
1586
|
+
static redirect (url: string | URL_2, status: ResponseRedirectStatus): Response_2
|
|
824
1587
|
}
|
|
825
1588
|
|
|
826
|
-
declare interface
|
|
1589
|
+
declare interface ResponseInit_2 {
|
|
827
1590
|
readonly status?: number
|
|
828
1591
|
readonly statusText?: string
|
|
829
|
-
readonly headers?:
|
|
1592
|
+
readonly headers?: HeadersInit_2
|
|
830
1593
|
}
|
|
831
1594
|
|
|
832
1595
|
declare type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308
|
|
@@ -864,16 +1627,83 @@ declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
|
|
|
864
1627
|
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
|
|
865
1628
|
}
|
|
866
1629
|
|
|
1630
|
+
declare type TailConsumer = {
|
|
1631
|
+
/** The name of the service tail events will be forwarded to. */
|
|
1632
|
+
service: string;
|
|
1633
|
+
/** (Optional) The environt of the service. */
|
|
1634
|
+
environment?: string;
|
|
1635
|
+
};
|
|
1636
|
+
|
|
867
1637
|
/**
|
|
868
1638
|
* unstable_dev starts a wrangler dev server, and returns a promise that resolves with utility functions to interact with it.
|
|
869
1639
|
*/
|
|
870
|
-
export declare function unstable_dev(script: string, options?:
|
|
1640
|
+
export declare function unstable_dev(script: string, options?: UnstableDevOptions, apiOptions?: unknown): Promise<UnstableDevWorker>;
|
|
1641
|
+
|
|
1642
|
+
export declare const unstable_pages: {
|
|
1643
|
+
deploy: typeof deploy;
|
|
1644
|
+
};
|
|
1645
|
+
|
|
1646
|
+
export declare interface UnstableDevOptions {
|
|
1647
|
+
config?: string;
|
|
1648
|
+
env?: string;
|
|
1649
|
+
ip?: string;
|
|
1650
|
+
port?: number;
|
|
1651
|
+
bundle?: boolean;
|
|
1652
|
+
inspectorPort?: number;
|
|
1653
|
+
localProtocol?: "http" | "https";
|
|
1654
|
+
assets?: string;
|
|
1655
|
+
site?: string;
|
|
1656
|
+
siteInclude?: string[];
|
|
1657
|
+
siteExclude?: string[];
|
|
1658
|
+
nodeCompat?: boolean;
|
|
1659
|
+
compatibilityDate?: string;
|
|
1660
|
+
compatibilityFlags?: string[];
|
|
1661
|
+
persist?: boolean;
|
|
1662
|
+
persistTo?: string;
|
|
1663
|
+
vars?: Record<string, string | Json>;
|
|
1664
|
+
kv?: {
|
|
1665
|
+
binding: string;
|
|
1666
|
+
id: string;
|
|
1667
|
+
preview_id?: string;
|
|
1668
|
+
}[];
|
|
1669
|
+
durableObjects?: {
|
|
1670
|
+
name: string;
|
|
1671
|
+
class_name: string;
|
|
1672
|
+
script_name?: string | undefined;
|
|
1673
|
+
environment?: string | undefined;
|
|
1674
|
+
}[];
|
|
1675
|
+
r2?: {
|
|
1676
|
+
binding: string;
|
|
1677
|
+
bucket_name: string;
|
|
1678
|
+
preview_bucket_name?: string;
|
|
1679
|
+
}[];
|
|
1680
|
+
moduleRoot?: string;
|
|
1681
|
+
rules?: Rule[];
|
|
1682
|
+
logLevel?: "none" | "info" | "error" | "log" | "warn" | "debug";
|
|
1683
|
+
inspect?: boolean;
|
|
1684
|
+
local?: boolean;
|
|
1685
|
+
accountId?: string;
|
|
1686
|
+
experimental?: {
|
|
1687
|
+
processEntrypoint?: boolean;
|
|
1688
|
+
additionalModules?: CfModule[];
|
|
1689
|
+
d1Databases?: Environment["d1_databases"];
|
|
1690
|
+
disableExperimentalWarning?: boolean;
|
|
1691
|
+
disableDevRegistry?: boolean;
|
|
1692
|
+
enablePagesAssetsServiceBinding?: EnablePagesAssetsServiceBindingOptions;
|
|
1693
|
+
forceLocal?: boolean;
|
|
1694
|
+
liveReload?: boolean;
|
|
1695
|
+
showInteractiveDevSession?: boolean;
|
|
1696
|
+
testMode?: boolean;
|
|
1697
|
+
testScheduled?: boolean;
|
|
1698
|
+
watch?: boolean;
|
|
1699
|
+
};
|
|
1700
|
+
}
|
|
871
1701
|
|
|
872
1702
|
export declare interface UnstableDevWorker {
|
|
873
1703
|
port: number;
|
|
874
1704
|
address: string;
|
|
875
1705
|
stop: () => Promise<void>;
|
|
876
|
-
fetch: (input?:
|
|
1706
|
+
fetch: (input?: RequestInfo_2, init?: RequestInit_2) => Promise<Response_2>;
|
|
877
1707
|
waitUntilExit: () => Promise<void>;
|
|
878
1708
|
}
|
|
879
1709
|
|