wrangler 0.0.0-e93063e9 → 0.0.0-e93d240f
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 +10 -76
- package/package.json +207 -194
- package/templates/__tests__/tsconfig.json +1 -1
- package/templates/checked-fetch.js +19 -6
- package/templates/facade.d.ts +4 -1
- package/templates/gitignore +1 -0
- package/templates/init-tests/test-vitest-new-worker.ts +1 -1
- package/templates/middleware/common.ts +9 -4
- package/templates/middleware/loader-modules.ts +64 -9
- 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 +59 -0
- package/templates/middleware/middleware-serve-static-assets.d.ts +6 -0
- package/templates/middleware/middleware-serve-static-assets.ts +56 -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 +909 -66
- package/wrangler-dist/cli.js +105289 -97941
- 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 -123
- 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-cfetch.ts +0 -278
- package/src/__tests__/helpers/mock-console.ts +0 -106
- package/src/__tests__/helpers/mock-dialogs.ts +0 -137
- 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 -271
- 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 -59
- package/src/__tests__/helpers/msw/handlers/namespaces.ts +0 -104
- package/src/__tests__/helpers/msw/handlers/oauth.ts +0 -31
- 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/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 -3147
- package/src/__tests__/jest.setup.ts +0 -198
- 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 -884
- package/src/__tests__/pages.test.ts +0 -2899
- package/src/__tests__/parse.test.ts +0 -330
- package/src/__tests__/paths.test.ts +0 -39
- package/src/__tests__/publish.test.ts +0 -7769
- package/src/__tests__/pubsub.test.ts +0 -490
- package/src/__tests__/queues.test.ts +0 -522
- package/src/__tests__/r2.test.ts +0 -393
- package/src/__tests__/route.test.ts +0 -45
- package/src/__tests__/secret.test.ts +0 -701
- package/src/__tests__/tail.test.ts +0 -905
- 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 -129
- 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 -183
- package/src/__tests__/worker-namespace.test.ts +0 -326
- package/src/abort.d.ts +0 -3
- package/src/api/dev.ts +0 -247
- package/src/api/index.ts +0 -2
- package/src/bundle-reporter.ts +0 -68
- package/src/bundle.ts +0 -823
- package/src/cfetch/index.ts +0 -158
- package/src/cfetch/internal.ts +0 -261
- 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 -577
- 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 -223
- 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 -83
- 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 -932
- package/src/dev/remote.tsx +0 -630
- package/src/dev/start-server.ts +0 -543
- package/src/dev/use-esbuild.ts +0 -204
- 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 -97
- package/src/durable.ts +0 -102
- package/src/entry.ts +0 -329
- 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 -1023
- 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 -97
- 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 -270
- 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 -711
- package/src/pages/errors.ts +0 -66
- package/src/pages/functions/buildPlugin.ts +0 -107
- package/src/pages/functions/buildWorker.ts +0 -166
- 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 -462
- 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 -1038
- 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 -379
- package/src/tail/filters.ts +0 -277
- package/src/tail/index.ts +0 -213
- package/src/tail/printing.ts +0 -107
- 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,76 @@ declare type CustomDomainRoute = {
|
|
|
43
251
|
custom_domain: boolean;
|
|
44
252
|
};
|
|
45
253
|
|
|
254
|
+
export declare function deleteMTlsCertificate(accountId: string, certificateId: string): Promise<unknown>;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Publish a directory to an account/project.
|
|
258
|
+
* NOTE: You will need the `CLOUDFLARE_API_KEY` environment
|
|
259
|
+
* variable set
|
|
260
|
+
*/
|
|
261
|
+
declare function deploy({ directory, accountId, projectName, branch, skipCaching, commitMessage, commitHash, commitDirty, functionsDirectory: customFunctionsDirectory, bundle, }: PagesDeployOptions): Promise<{
|
|
262
|
+
url: string;
|
|
263
|
+
environment: "production" | "preview";
|
|
264
|
+
id: string;
|
|
265
|
+
project_id: string;
|
|
266
|
+
project_name: string;
|
|
267
|
+
build_config: {
|
|
268
|
+
build_command: string;
|
|
269
|
+
destination_dir: string;
|
|
270
|
+
root_dir: string;
|
|
271
|
+
web_analytics_tag?: string | undefined;
|
|
272
|
+
web_analytics_token?: string | undefined;
|
|
273
|
+
fast_builds?: boolean | undefined;
|
|
274
|
+
};
|
|
275
|
+
created_on: string;
|
|
276
|
+
production_branch: string;
|
|
277
|
+
deployment_trigger: {
|
|
278
|
+
type: string;
|
|
279
|
+
metadata: {
|
|
280
|
+
branch: string;
|
|
281
|
+
commit_hash: string;
|
|
282
|
+
commit_message: string;
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
latest_stage: {
|
|
286
|
+
name: "build" | "deploy" | "queued" | "initialize" | "clone_repo";
|
|
287
|
+
status: "active" | "idle" | "canceled" | "success" | "failure" | "skipped";
|
|
288
|
+
started_on: string | null;
|
|
289
|
+
ended_on: string | null;
|
|
290
|
+
};
|
|
291
|
+
stages: {
|
|
292
|
+
name: "build" | "deploy" | "queued" | "initialize" | "clone_repo";
|
|
293
|
+
status: "active" | "idle" | "canceled" | "success" | "failure" | "skipped";
|
|
294
|
+
started_on: string | null;
|
|
295
|
+
ended_on: string | null;
|
|
296
|
+
}[];
|
|
297
|
+
aliases: string[];
|
|
298
|
+
modified_on: string;
|
|
299
|
+
short_id: string;
|
|
300
|
+
build_image_major_version: number;
|
|
301
|
+
kv_namespaces?: any;
|
|
302
|
+
source?: {
|
|
303
|
+
type: "github" | "gitlab";
|
|
304
|
+
config: {
|
|
305
|
+
owner: string;
|
|
306
|
+
repo_name: string;
|
|
307
|
+
production_branch?: string | undefined;
|
|
308
|
+
pr_comments_enabled?: boolean | undefined;
|
|
309
|
+
deployments_enabled?: boolean | undefined;
|
|
310
|
+
production_deployments_enabled?: boolean | undefined;
|
|
311
|
+
preview_deployment_setting?: "none" | "all" | "custom" | undefined;
|
|
312
|
+
preview_branch_includes?: string[] | undefined;
|
|
313
|
+
preview_branch_excludes?: string[] | undefined;
|
|
314
|
+
};
|
|
315
|
+
} | undefined;
|
|
316
|
+
env_vars?: any;
|
|
317
|
+
durable_object_namespaces?: any;
|
|
318
|
+
is_skipped?: boolean | undefined;
|
|
319
|
+
files?: {
|
|
320
|
+
[x: string]: string | undefined;
|
|
321
|
+
} | undefined;
|
|
322
|
+
}>;
|
|
323
|
+
|
|
46
324
|
/**
|
|
47
325
|
* Deprecated upload configuration.
|
|
48
326
|
*/
|
|
@@ -74,6 +352,251 @@ declare interface DeprecatedUpload {
|
|
|
74
352
|
rules?: Environment["rules"];
|
|
75
353
|
}
|
|
76
354
|
|
|
355
|
+
/** Dispatcher is the core API used to dispatch requests. */
|
|
356
|
+
declare class Dispatcher extends EventEmitter {
|
|
357
|
+
/** 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. */
|
|
358
|
+
dispatch(options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean;
|
|
359
|
+
/** Starts two-way communications with the requested resource. */
|
|
360
|
+
connect(options: Dispatcher.ConnectOptions): Promise<Dispatcher.ConnectData>;
|
|
361
|
+
connect(options: Dispatcher.ConnectOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void;
|
|
362
|
+
/** Performs an HTTP request. */
|
|
363
|
+
request(options: Dispatcher.RequestOptions): Promise<Dispatcher.ResponseData>;
|
|
364
|
+
request(options: Dispatcher.RequestOptions, callback: (err: Error | null, data: Dispatcher.ResponseData) => void): void;
|
|
365
|
+
/** For easy use with `stream.pipeline`. */
|
|
366
|
+
pipeline(options: Dispatcher.PipelineOptions, handler: Dispatcher.PipelineHandler): Duplex;
|
|
367
|
+
/** A faster version of `Dispatcher.request`. */
|
|
368
|
+
stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory): Promise<Dispatcher.StreamData>;
|
|
369
|
+
stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory, callback: (err: Error | null, data: Dispatcher.StreamData) => void): void;
|
|
370
|
+
/** Upgrade to a different protocol. */
|
|
371
|
+
upgrade(options: Dispatcher.UpgradeOptions): Promise<Dispatcher.UpgradeData>;
|
|
372
|
+
upgrade(options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void;
|
|
373
|
+
/** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */
|
|
374
|
+
close(): Promise<void>;
|
|
375
|
+
close(callback: () => void): void;
|
|
376
|
+
/** 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. */
|
|
377
|
+
destroy(): Promise<void>;
|
|
378
|
+
destroy(err: Error | null): Promise<void>;
|
|
379
|
+
destroy(callback: () => void): void;
|
|
380
|
+
destroy(err: Error | null, callback: () => void): void;
|
|
381
|
+
|
|
382
|
+
on(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
|
|
383
|
+
on(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
384
|
+
on(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
385
|
+
on(eventName: 'drain', callback: (origin: URL_2) => void): this;
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
once(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
|
|
389
|
+
once(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
390
|
+
once(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
391
|
+
once(eventName: 'drain', callback: (origin: URL_2) => void): this;
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
off(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
|
|
395
|
+
off(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
396
|
+
off(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
397
|
+
off(eventName: 'drain', callback: (origin: URL_2) => void): this;
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
addListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
|
|
401
|
+
addListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
402
|
+
addListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
403
|
+
addListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
|
|
404
|
+
|
|
405
|
+
removeListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
|
|
406
|
+
removeListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
407
|
+
removeListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
408
|
+
removeListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
|
|
409
|
+
|
|
410
|
+
prependListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
|
|
411
|
+
prependListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
412
|
+
prependListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
413
|
+
prependListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
|
|
414
|
+
|
|
415
|
+
prependOnceListener(eventName: 'connect', callback: (origin: URL_2, targets: readonly Dispatcher[]) => void): this;
|
|
416
|
+
prependOnceListener(eventName: 'disconnect', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
417
|
+
prependOnceListener(eventName: 'connectionError', callback: (origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this;
|
|
418
|
+
prependOnceListener(eventName: 'drain', callback: (origin: URL_2) => void): this;
|
|
419
|
+
|
|
420
|
+
listeners(eventName: 'connect'): ((origin: URL_2, targets: readonly Dispatcher[]) => void)[]
|
|
421
|
+
listeners(eventName: 'disconnect'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
422
|
+
listeners(eventName: 'connectionError'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
423
|
+
listeners(eventName: 'drain'): ((origin: URL_2) => void)[];
|
|
424
|
+
|
|
425
|
+
rawListeners(eventName: 'connect'): ((origin: URL_2, targets: readonly Dispatcher[]) => void)[]
|
|
426
|
+
rawListeners(eventName: 'disconnect'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
427
|
+
rawListeners(eventName: 'connectionError'): ((origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[];
|
|
428
|
+
rawListeners(eventName: 'drain'): ((origin: URL_2) => void)[];
|
|
429
|
+
|
|
430
|
+
emit(eventName: 'connect', origin: URL_2, targets: readonly Dispatcher[]): boolean;
|
|
431
|
+
emit(eventName: 'disconnect', origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
|
|
432
|
+
emit(eventName: 'connectionError', origin: URL_2, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean;
|
|
433
|
+
emit(eventName: 'drain', origin: URL_2): boolean;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
declare namespace Dispatcher {
|
|
437
|
+
interface DispatchOptions {
|
|
438
|
+
origin?: string | URL_2;
|
|
439
|
+
path: string;
|
|
440
|
+
method: HttpMethod;
|
|
441
|
+
/** Default: `null` */
|
|
442
|
+
body?: string | Buffer | Uint8Array | Readable | null | FormData_2;
|
|
443
|
+
/** Default: `null` */
|
|
444
|
+
headers?: IncomingHttpHeaders | string[] | null;
|
|
445
|
+
/** Query string params to be embedded in the request URL. Default: `null` */
|
|
446
|
+
query?: Record<string, any>;
|
|
447
|
+
/** 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`. */
|
|
448
|
+
idempotent?: boolean;
|
|
449
|
+
/** 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. */
|
|
450
|
+
blocking?: boolean;
|
|
451
|
+
/** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */
|
|
452
|
+
upgrade?: boolean | string | null;
|
|
453
|
+
/** The amount of time the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */
|
|
454
|
+
headersTimeout?: number | null;
|
|
455
|
+
/** 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. */
|
|
456
|
+
bodyTimeout?: number | null;
|
|
457
|
+
/** Whether the request should stablish a keep-alive or not. Default `false` */
|
|
458
|
+
reset?: boolean;
|
|
459
|
+
/** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */
|
|
460
|
+
throwOnError?: boolean;
|
|
461
|
+
}
|
|
462
|
+
interface ConnectOptions {
|
|
463
|
+
path: string;
|
|
464
|
+
/** Default: `null` */
|
|
465
|
+
headers?: IncomingHttpHeaders | string[] | null;
|
|
466
|
+
/** Default: `null` */
|
|
467
|
+
signal?: AbortSignal_2 | EventEmitter | null;
|
|
468
|
+
/** This argument parameter is passed through to `ConnectData` */
|
|
469
|
+
opaque?: unknown;
|
|
470
|
+
/** Default: 0 */
|
|
471
|
+
maxRedirections?: number;
|
|
472
|
+
/** Default: `null` */
|
|
473
|
+
responseHeader?: 'raw' | null;
|
|
474
|
+
}
|
|
475
|
+
interface RequestOptions extends DispatchOptions {
|
|
476
|
+
/** Default: `null` */
|
|
477
|
+
opaque?: unknown;
|
|
478
|
+
/** Default: `null` */
|
|
479
|
+
signal?: AbortSignal_2 | EventEmitter | null;
|
|
480
|
+
/** Default: 0 */
|
|
481
|
+
maxRedirections?: number;
|
|
482
|
+
/** Default: `null` */
|
|
483
|
+
onInfo?: (info: { statusCode: number, headers: Record<string, string | string[]> }) => void;
|
|
484
|
+
/** Default: `null` */
|
|
485
|
+
responseHeader?: 'raw' | null;
|
|
486
|
+
}
|
|
487
|
+
interface PipelineOptions extends RequestOptions {
|
|
488
|
+
/** `true` if the `handler` will return an object stream. Default: `false` */
|
|
489
|
+
objectMode?: boolean;
|
|
490
|
+
}
|
|
491
|
+
interface UpgradeOptions {
|
|
492
|
+
path: string;
|
|
493
|
+
/** Default: `'GET'` */
|
|
494
|
+
method?: string;
|
|
495
|
+
/** Default: `null` */
|
|
496
|
+
headers?: IncomingHttpHeaders | string[] | null;
|
|
497
|
+
/** A string of comma separated protocols, in descending preference order. Default: `'Websocket'` */
|
|
498
|
+
protocol?: string;
|
|
499
|
+
/** Default: `null` */
|
|
500
|
+
signal?: AbortSignal_2 | EventEmitter | null;
|
|
501
|
+
/** Default: 0 */
|
|
502
|
+
maxRedirections?: number;
|
|
503
|
+
/** Default: `null` */
|
|
504
|
+
responseHeader?: 'raw' | null;
|
|
505
|
+
}
|
|
506
|
+
interface ConnectData {
|
|
507
|
+
statusCode: number;
|
|
508
|
+
headers: IncomingHttpHeaders;
|
|
509
|
+
socket: Duplex;
|
|
510
|
+
opaque: unknown;
|
|
511
|
+
}
|
|
512
|
+
interface ResponseData {
|
|
513
|
+
statusCode: number;
|
|
514
|
+
headers: IncomingHttpHeaders;
|
|
515
|
+
body: BodyReadable & BodyMixin;
|
|
516
|
+
trailers: Record<string, string>;
|
|
517
|
+
opaque: unknown;
|
|
518
|
+
context: object;
|
|
519
|
+
}
|
|
520
|
+
interface PipelineHandlerData {
|
|
521
|
+
statusCode: number;
|
|
522
|
+
headers: IncomingHttpHeaders;
|
|
523
|
+
opaque: unknown;
|
|
524
|
+
body: BodyReadable;
|
|
525
|
+
context: object;
|
|
526
|
+
}
|
|
527
|
+
interface StreamData {
|
|
528
|
+
opaque: unknown;
|
|
529
|
+
trailers: Record<string, string>;
|
|
530
|
+
}
|
|
531
|
+
interface UpgradeData {
|
|
532
|
+
headers: IncomingHttpHeaders;
|
|
533
|
+
socket: Duplex;
|
|
534
|
+
opaque: unknown;
|
|
535
|
+
}
|
|
536
|
+
interface StreamFactoryData {
|
|
537
|
+
statusCode: number;
|
|
538
|
+
headers: IncomingHttpHeaders;
|
|
539
|
+
opaque: unknown;
|
|
540
|
+
context: object;
|
|
541
|
+
}
|
|
542
|
+
type StreamFactory = (data: StreamFactoryData) => Writable;
|
|
543
|
+
interface DispatchHandlers {
|
|
544
|
+
/** 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. */
|
|
545
|
+
onConnect?(abort: () => void): void;
|
|
546
|
+
/** Invoked when an error has occurred. */
|
|
547
|
+
onError?(err: Error): void;
|
|
548
|
+
/** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */
|
|
549
|
+
onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void;
|
|
550
|
+
/** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */
|
|
551
|
+
onHeaders?(statusCode: number, headers: Buffer[] | string[] | null, resume: () => void): boolean;
|
|
552
|
+
/** Invoked when response payload data is received. */
|
|
553
|
+
onData?(chunk: Buffer): boolean;
|
|
554
|
+
/** Invoked when response payload and trailers have been received and the request has completed. */
|
|
555
|
+
onComplete?(trailers: string[] | null): void;
|
|
556
|
+
/** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */
|
|
557
|
+
onBodySent?(chunkSize: number, totalBytesSent: number): void;
|
|
558
|
+
}
|
|
559
|
+
type PipelineHandler = (data: PipelineHandlerData) => Readable;
|
|
560
|
+
type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH';
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* @link https://fetch.spec.whatwg.org/#body-mixin
|
|
564
|
+
*/
|
|
565
|
+
interface BodyMixin {
|
|
566
|
+
readonly body?: never; // throws on node v16.6.0
|
|
567
|
+
readonly bodyUsed: boolean;
|
|
568
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
569
|
+
blob(): Promise<Blob_2>;
|
|
570
|
+
formData(): Promise<never>;
|
|
571
|
+
json(): Promise<any>;
|
|
572
|
+
text(): Promise<string>;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
interface DispatchInterceptor {
|
|
576
|
+
(dispatch: Dispatcher['dispatch']): Dispatcher['dispatch']
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
declare interface DispatchNamespaceOutbound {
|
|
581
|
+
/** Name of the service handling the outbound requests */
|
|
582
|
+
service: string;
|
|
583
|
+
/** (Optional) Name of the environment handling the outbound requests. */
|
|
584
|
+
environment?: string;
|
|
585
|
+
/** (Optional) List of parameter names, for sending context from your dispatch worker to the outbound handler */
|
|
586
|
+
parameters?: string[];
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
declare type DurableObjectBindings = {
|
|
590
|
+
/** The name of the binding used to refer to the Durable Object */
|
|
591
|
+
name: string;
|
|
592
|
+
/** The exported class name of the Durable Object */
|
|
593
|
+
class_name: string;
|
|
594
|
+
/** The script where the Durable Object is defined (if it's external to this worker) */
|
|
595
|
+
script_name?: string;
|
|
596
|
+
/** The service environment of the script_name to bind to */
|
|
597
|
+
environment?: string;
|
|
598
|
+
}[];
|
|
599
|
+
|
|
77
600
|
declare interface EnablePagesAssetsServiceBindingOptions {
|
|
78
601
|
proxyPort?: number;
|
|
79
602
|
directory?: string;
|
|
@@ -131,11 +654,16 @@ declare interface EnvironmentInheritable {
|
|
|
131
654
|
* The entrypoint/path to the JavaScript file that will be executed.
|
|
132
655
|
*/
|
|
133
656
|
main: string | undefined;
|
|
657
|
+
/**
|
|
658
|
+
* The directory in which module rules should be evaluated in a `--no-bundle` worker
|
|
659
|
+
* This defaults to dirname(main) when left undefined
|
|
660
|
+
*/
|
|
661
|
+
base_dir: string | undefined;
|
|
134
662
|
/**
|
|
135
663
|
* Whether we use <name>.<subdomain>.workers.dev to
|
|
136
664
|
* test and deploy your worker.
|
|
137
665
|
*
|
|
138
|
-
* @default `true` (This is a breaking change from
|
|
666
|
+
* @default `true` (This is a breaking change from Wrangler v1)
|
|
139
667
|
* @breaking
|
|
140
668
|
* @inheritable
|
|
141
669
|
*/
|
|
@@ -233,7 +761,7 @@ declare interface EnvironmentInheritable {
|
|
|
233
761
|
upload?: DeprecatedUpload;
|
|
234
762
|
};
|
|
235
763
|
/**
|
|
236
|
-
* Skip internal build steps and directly
|
|
764
|
+
* Skip internal build steps and directly deploy script
|
|
237
765
|
* @inheritable
|
|
238
766
|
*/
|
|
239
767
|
no_bundle: boolean | undefined;
|
|
@@ -261,6 +789,8 @@ declare interface EnvironmentInheritable {
|
|
|
261
789
|
binding: string;
|
|
262
790
|
/** The namespace to bind to. */
|
|
263
791
|
namespace: string;
|
|
792
|
+
/** Details about the outbound worker which will handle outbound requests from your namespace */
|
|
793
|
+
outbound?: DispatchNamespaceOutbound;
|
|
264
794
|
}[];
|
|
265
795
|
/**
|
|
266
796
|
* Designates this worker as an internal-only "first-party" worker.
|
|
@@ -274,15 +804,12 @@ declare interface EnvironmentInheritable {
|
|
|
274
804
|
*/
|
|
275
805
|
zone_id?: string;
|
|
276
806
|
/**
|
|
277
|
-
*
|
|
278
|
-
* Then add a binding per field in the top level message that you will send to logfwdr
|
|
807
|
+
* List of bindings that you will send to logfwdr
|
|
279
808
|
*
|
|
280
|
-
* @default `{
|
|
809
|
+
* @default `{bindings:[]}`
|
|
281
810
|
* @inheritable
|
|
282
811
|
*/
|
|
283
812
|
logfwdr: {
|
|
284
|
-
/** capnp schema filename */
|
|
285
|
-
schema: string | undefined;
|
|
286
813
|
bindings: {
|
|
287
814
|
/** The binding name used to refer to logfwdr */
|
|
288
815
|
name: string;
|
|
@@ -301,6 +828,14 @@ declare interface EnvironmentInheritable {
|
|
|
301
828
|
* @inheritable
|
|
302
829
|
*/
|
|
303
830
|
logpush: boolean | undefined;
|
|
831
|
+
/**
|
|
832
|
+
* Specify how the worker should be located to minimize round-trip time.
|
|
833
|
+
*
|
|
834
|
+
* More details: https://developers.cloudflare.com/workers/platform/smart-placement/
|
|
835
|
+
*/
|
|
836
|
+
placement: {
|
|
837
|
+
mode: "off" | "smart";
|
|
838
|
+
} | undefined;
|
|
304
839
|
}
|
|
305
840
|
|
|
306
841
|
/**
|
|
@@ -330,9 +865,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
330
865
|
* @default `{}`
|
|
331
866
|
* @nonInheritable
|
|
332
867
|
*/
|
|
333
|
-
vars:
|
|
334
|
-
[key: string]: unknown;
|
|
335
|
-
};
|
|
868
|
+
vars: Record<string, string | Json>;
|
|
336
869
|
/**
|
|
337
870
|
* A list of durable objects that your worker should be bound to.
|
|
338
871
|
*
|
|
@@ -346,16 +879,7 @@ declare interface EnvironmentNonInheritable {
|
|
|
346
879
|
* @nonInheritable
|
|
347
880
|
*/
|
|
348
881
|
durable_objects: {
|
|
349
|
-
bindings:
|
|
350
|
-
/** The name of the binding used to refer to the Durable Object */
|
|
351
|
-
name: string;
|
|
352
|
-
/** The exported class name of the Durable Object */
|
|
353
|
-
class_name: string;
|
|
354
|
-
/** The script where the Durable Object is defined (if it's external to this worker) */
|
|
355
|
-
script_name?: string;
|
|
356
|
-
/** The service environment of the script_name to bind to */
|
|
357
|
-
environment?: string;
|
|
358
|
-
}[];
|
|
882
|
+
bindings: DurableObjectBindings;
|
|
359
883
|
};
|
|
360
884
|
/**
|
|
361
885
|
* These specify any Workers KV Namespaces you want to
|
|
@@ -378,6 +902,23 @@ declare interface EnvironmentNonInheritable {
|
|
|
378
902
|
/** The ID of the KV namespace used during `wrangler dev` */
|
|
379
903
|
preview_id?: string;
|
|
380
904
|
}[];
|
|
905
|
+
/**
|
|
906
|
+
* These specify bindings to send email from inside your Worker.
|
|
907
|
+
*
|
|
908
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
909
|
+
* and so must be specified in every named environment.
|
|
910
|
+
*
|
|
911
|
+
* @default `[]`
|
|
912
|
+
* @nonInheritable
|
|
913
|
+
*/
|
|
914
|
+
send_email: {
|
|
915
|
+
/** The binding name used to refer to the this binding */
|
|
916
|
+
name: string;
|
|
917
|
+
/** If this binding should be restricted to a specific verified address */
|
|
918
|
+
destination_address?: string;
|
|
919
|
+
/** If this binding should be restricted to a set of verified addresses */
|
|
920
|
+
allowed_destination_addresses?: string[];
|
|
921
|
+
}[];
|
|
381
922
|
/**
|
|
382
923
|
* Specifies Queues that are bound to this Worker environment.
|
|
383
924
|
*
|
|
@@ -407,6 +948,8 @@ declare interface EnvironmentNonInheritable {
|
|
|
407
948
|
max_retries?: number;
|
|
408
949
|
/** The queue to send messages that failed to be consumed. */
|
|
409
950
|
dead_letter_queue?: string;
|
|
951
|
+
/** 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. */
|
|
952
|
+
max_concurrency?: number | null;
|
|
410
953
|
}[];
|
|
411
954
|
};
|
|
412
955
|
/**
|
|
@@ -425,6 +968,8 @@ declare interface EnvironmentNonInheritable {
|
|
|
425
968
|
bucket_name: string;
|
|
426
969
|
/** The preview name of this R2 bucket at the edge. */
|
|
427
970
|
preview_bucket_name?: string;
|
|
971
|
+
/** The jurisdiction that the bucket exists in. Default if not present. */
|
|
972
|
+
jurisdiction?: string;
|
|
428
973
|
}[];
|
|
429
974
|
/**
|
|
430
975
|
* Specifies D1 databases that are bound to this Worker environment.
|
|
@@ -451,6 +996,21 @@ declare interface EnvironmentNonInheritable {
|
|
|
451
996
|
/** Internal use only. */
|
|
452
997
|
database_internal_env?: string;
|
|
453
998
|
}[];
|
|
999
|
+
/**
|
|
1000
|
+
* Specifies Constellation projects that are bound to this Worker environment.
|
|
1001
|
+
*
|
|
1002
|
+
* NOTE: This field is not automatically inherited from the top level environment,
|
|
1003
|
+
* and so must be specified in every named environment.
|
|
1004
|
+
*
|
|
1005
|
+
* @default `[]`
|
|
1006
|
+
* @nonInheritable
|
|
1007
|
+
*/
|
|
1008
|
+
constellation: {
|
|
1009
|
+
/** The binding name used to refer to the project in the worker. */
|
|
1010
|
+
binding: string;
|
|
1011
|
+
/** The id of the project. */
|
|
1012
|
+
project_id: string;
|
|
1013
|
+
}[];
|
|
454
1014
|
/**
|
|
455
1015
|
* Specifies service bindings (worker-to-worker) that are bound to this Worker environment.
|
|
456
1016
|
*
|
|
@@ -483,13 +1043,24 @@ declare interface EnvironmentNonInheritable {
|
|
|
483
1043
|
/** The name of this dataset to write to. */
|
|
484
1044
|
dataset?: string;
|
|
485
1045
|
}[];
|
|
1046
|
+
/**
|
|
1047
|
+
* A browser that will be usable from the worker.
|
|
1048
|
+
*/
|
|
1049
|
+
browser: {
|
|
1050
|
+
binding: string;
|
|
1051
|
+
} | undefined;
|
|
1052
|
+
/**
|
|
1053
|
+
* Binding to the AI project.
|
|
1054
|
+
*/
|
|
1055
|
+
ai: {
|
|
1056
|
+
binding: string;
|
|
1057
|
+
} | undefined;
|
|
486
1058
|
/**
|
|
487
1059
|
* "Unsafe" tables for features that aren't directly supported by wrangler.
|
|
488
1060
|
*
|
|
489
1061
|
* NOTE: This field is not automatically inherited from the top level environment,
|
|
490
1062
|
* and so must be specified in every named environment.
|
|
491
1063
|
*
|
|
492
|
-
* @default `{ bindings: [] }`
|
|
493
1064
|
* @nonInheritable
|
|
494
1065
|
*/
|
|
495
1066
|
unsafe: {
|
|
@@ -497,18 +1068,157 @@ declare interface EnvironmentNonInheritable {
|
|
|
497
1068
|
* A set of bindings that should be put into a Worker's upload metadata without changes. These
|
|
498
1069
|
* can be used to implement bindings for features that haven't released and aren't supported
|
|
499
1070
|
* directly by wrangler or miniflare.
|
|
500
|
-
*
|
|
501
|
-
* @default []
|
|
502
1071
|
*/
|
|
503
|
-
bindings
|
|
1072
|
+
bindings?: {
|
|
504
1073
|
name: string;
|
|
505
1074
|
type: string;
|
|
506
1075
|
[key: string]: unknown;
|
|
507
1076
|
}[];
|
|
1077
|
+
/**
|
|
1078
|
+
* Arbitrary key/value pairs that will be included in the uploaded metadata. Values specified
|
|
1079
|
+
* here will always be applied to metadata last, so can add new or override existing fields.
|
|
1080
|
+
*/
|
|
1081
|
+
metadata?: {
|
|
1082
|
+
[key: string]: string;
|
|
1083
|
+
};
|
|
1084
|
+
/**
|
|
1085
|
+
* Used for internal capnp uploads for the Workers runtime
|
|
1086
|
+
*/
|
|
1087
|
+
capnp?: {
|
|
1088
|
+
base_path: string;
|
|
1089
|
+
source_schemas: string[];
|
|
1090
|
+
compiled_schema?: never;
|
|
1091
|
+
} | {
|
|
1092
|
+
base_path?: never;
|
|
1093
|
+
source_schemas?: never;
|
|
1094
|
+
compiled_schema: string;
|
|
1095
|
+
};
|
|
508
1096
|
};
|
|
1097
|
+
mtls_certificates: {
|
|
1098
|
+
/** The binding name used to refer to the certificate in the worker */
|
|
1099
|
+
binding: string;
|
|
1100
|
+
/** The uuid of the uploaded mTLS certificate */
|
|
1101
|
+
certificate_id: string;
|
|
1102
|
+
}[];
|
|
1103
|
+
tail_consumers?: TailConsumer[];
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
declare namespace Errors {
|
|
1107
|
+
class UndiciError extends Error { }
|
|
1108
|
+
|
|
1109
|
+
/** Connect timeout error. */
|
|
1110
|
+
class ConnectTimeoutError extends UndiciError {
|
|
1111
|
+
name: 'ConnectTimeoutError';
|
|
1112
|
+
code: 'UND_ERR_CONNECT_TIMEOUT';
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
/** A header exceeds the `headersTimeout` option. */
|
|
1116
|
+
class HeadersTimeoutError extends UndiciError {
|
|
1117
|
+
name: 'HeadersTimeoutError';
|
|
1118
|
+
code: 'UND_ERR_HEADERS_TIMEOUT';
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
/** Headers overflow error. */
|
|
1122
|
+
class HeadersOverflowError extends UndiciError {
|
|
1123
|
+
name: 'HeadersOverflowError'
|
|
1124
|
+
code: 'UND_ERR_HEADERS_OVERFLOW'
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
/** A body exceeds the `bodyTimeout` option. */
|
|
1128
|
+
class BodyTimeoutError extends UndiciError {
|
|
1129
|
+
name: 'BodyTimeoutError';
|
|
1130
|
+
code: 'UND_ERR_BODY_TIMEOUT';
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
class ResponseStatusCodeError extends UndiciError {
|
|
1134
|
+
name: 'ResponseStatusCodeError';
|
|
1135
|
+
code: 'UND_ERR_RESPONSE_STATUS_CODE';
|
|
1136
|
+
body: null | Record<string, any> | string
|
|
1137
|
+
status: number
|
|
1138
|
+
statusCode: number
|
|
1139
|
+
headers: IncomingHttpHeaders | string[] | null;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
/** Passed an invalid argument. */
|
|
1143
|
+
class InvalidArgumentError extends UndiciError {
|
|
1144
|
+
name: 'InvalidArgumentError';
|
|
1145
|
+
code: 'UND_ERR_INVALID_ARG';
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/** Returned an invalid value. */
|
|
1149
|
+
class InvalidReturnValueError extends UndiciError {
|
|
1150
|
+
name: 'InvalidReturnValueError';
|
|
1151
|
+
code: 'UND_ERR_INVALID_RETURN_VALUE';
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
/** The request has been aborted by the user. */
|
|
1155
|
+
class RequestAbortedError extends UndiciError {
|
|
1156
|
+
name: 'AbortError';
|
|
1157
|
+
code: 'UND_ERR_ABORTED';
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
/** Expected error with reason. */
|
|
1161
|
+
class InformationalError extends UndiciError {
|
|
1162
|
+
name: 'InformationalError';
|
|
1163
|
+
code: 'UND_ERR_INFO';
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
/** Request body length does not match content-length header. */
|
|
1167
|
+
class RequestContentLengthMismatchError extends UndiciError {
|
|
1168
|
+
name: 'RequestContentLengthMismatchError';
|
|
1169
|
+
code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH';
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
/** Response body length does not match content-length header. */
|
|
1173
|
+
class ResponseContentLengthMismatchError extends UndiciError {
|
|
1174
|
+
name: 'ResponseContentLengthMismatchError';
|
|
1175
|
+
code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH';
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
/** Trying to use a destroyed client. */
|
|
1179
|
+
class ClientDestroyedError extends UndiciError {
|
|
1180
|
+
name: 'ClientDestroyedError';
|
|
1181
|
+
code: 'UND_ERR_DESTROYED';
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
/** Trying to use a closed client. */
|
|
1185
|
+
class ClientClosedError extends UndiciError {
|
|
1186
|
+
name: 'ClientClosedError';
|
|
1187
|
+
code: 'UND_ERR_CLOSED';
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
/** There is an error with the socket. */
|
|
1191
|
+
class SocketError extends UndiciError {
|
|
1192
|
+
name: 'SocketError';
|
|
1193
|
+
code: 'UND_ERR_SOCKET';
|
|
1194
|
+
socket: Client.SocketInfo | null
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
/** Encountered unsupported functionality. */
|
|
1198
|
+
class NotSupportedError extends UndiciError {
|
|
1199
|
+
name: 'NotSupportedError';
|
|
1200
|
+
code: 'UND_ERR_NOT_SUPPORTED';
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
/** No upstream has been added to the BalancedPool. */
|
|
1204
|
+
class BalancedPoolMissingUpstreamError extends UndiciError {
|
|
1205
|
+
name: 'MissingUpstreamError';
|
|
1206
|
+
code: 'UND_ERR_BPL_MISSING_UPSTREAM';
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
class HTTPParserError extends UndiciError {
|
|
1210
|
+
name: 'HTTPParserError';
|
|
1211
|
+
code: string;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
/** The response exceed the length allowed. */
|
|
1215
|
+
class ResponseExceededMaxSizeError extends UndiciError {
|
|
1216
|
+
name: 'ResponseExceededMaxSizeError';
|
|
1217
|
+
code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE';
|
|
1218
|
+
}
|
|
509
1219
|
}
|
|
510
1220
|
|
|
511
|
-
declare class
|
|
1221
|
+
declare class File_2 extends Blob_2 {
|
|
512
1222
|
/**
|
|
513
1223
|
* Creates a new File instance.
|
|
514
1224
|
*
|
|
@@ -541,7 +1251,7 @@ declare interface FilePropertyBag extends BlobPropertyBag {
|
|
|
541
1251
|
/**
|
|
542
1252
|
* 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().
|
|
543
1253
|
*/
|
|
544
|
-
declare class
|
|
1254
|
+
declare class FormData_2 {
|
|
545
1255
|
/**
|
|
546
1256
|
* Appends a new value onto an existing key inside a FormData object,
|
|
547
1257
|
* or adds the key if it does not already exist.
|
|
@@ -606,7 +1316,7 @@ declare class FormData {
|
|
|
606
1316
|
* Executes given callback function for each field of the FormData instance
|
|
607
1317
|
*/
|
|
608
1318
|
forEach: (
|
|
609
|
-
callbackfn: (value: FormDataEntryValue, key: string, iterable:
|
|
1319
|
+
callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData_2) => void,
|
|
610
1320
|
thisArg?: unknown
|
|
611
1321
|
) => void
|
|
612
1322
|
|
|
@@ -639,17 +1349,28 @@ declare class FormData {
|
|
|
639
1349
|
/**
|
|
640
1350
|
* A `string` or `File` that represents a single value from a set of `FormData` key-value pairs.
|
|
641
1351
|
*/
|
|
642
|
-
declare type FormDataEntryValue = string |
|
|
1352
|
+
declare type FormDataEntryValue = string | File_2
|
|
1353
|
+
|
|
1354
|
+
/**
|
|
1355
|
+
* fetches an mTLS certificate from the account mTLS certificate store by ID
|
|
1356
|
+
*/
|
|
1357
|
+
export declare function getMTlsCertificate(accountId: string, id: string): Promise<MTlsCertificateResponse>;
|
|
643
1358
|
|
|
644
|
-
|
|
645
|
-
|
|
1359
|
+
/**
|
|
1360
|
+
* fetches an mTLS certificate from the account mTLS certificate store by name. will throw an error if no certificates are found, or multiple are found with that name
|
|
1361
|
+
*/
|
|
1362
|
+
export declare function getMTlsCertificateByName(accountId: string, name: string): Promise<MTlsCertificateResponse>;
|
|
1363
|
+
|
|
1364
|
+
declare class Headers_2 implements SpecIterable<[string, string]> {
|
|
1365
|
+
constructor (init?: HeadersInit_2)
|
|
646
1366
|
readonly append: (name: string, value: string) => void
|
|
647
1367
|
readonly delete: (name: string) => void
|
|
648
1368
|
readonly get: (name: string) => string | null
|
|
649
1369
|
readonly has: (name: string) => boolean
|
|
650
1370
|
readonly set: (name: string, value: string) => void
|
|
1371
|
+
readonly getSetCookie: () => string[]
|
|
651
1372
|
readonly forEach: (
|
|
652
|
-
callbackfn: (value: string, key: string, iterable:
|
|
1373
|
+
callbackfn: (value: string, key: string, iterable: Headers_2) => void,
|
|
653
1374
|
thisArg?: unknown
|
|
654
1375
|
) => void
|
|
655
1376
|
|
|
@@ -659,7 +1380,105 @@ declare class Headers implements SpecIterable<[string, string]> {
|
|
|
659
1380
|
readonly [Symbol.iterator]: () => SpecIterator<[string, string]>
|
|
660
1381
|
}
|
|
661
1382
|
|
|
662
|
-
declare type
|
|
1383
|
+
declare type HeadersInit_2 = string[][] | Record<string, string | ReadonlyArray<string>> | Headers_2
|
|
1384
|
+
|
|
1385
|
+
/**
|
|
1386
|
+
* The header type declaration of `undici`.
|
|
1387
|
+
*/
|
|
1388
|
+
declare type IncomingHttpHeaders = Record<string, string | string[] | undefined>;
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* lists mTLS certificates for an account. filtering by name is supported
|
|
1392
|
+
*/
|
|
1393
|
+
export declare function listMTlsCertificates(accountId: string, filter: MTlsCertificateListFilter): Promise<MTlsCertificateResponse[]>;
|
|
1394
|
+
|
|
1395
|
+
/**
|
|
1396
|
+
* details for uploading an mTLS certificate via the ssl api
|
|
1397
|
+
*/
|
|
1398
|
+
declare interface MTlsCertificateBody {
|
|
1399
|
+
certificateChain: string;
|
|
1400
|
+
privateKey: string;
|
|
1401
|
+
name?: string;
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
/**
|
|
1405
|
+
* supported filters for listing mTLS certificates via the ssl api
|
|
1406
|
+
*/
|
|
1407
|
+
declare interface MTlsCertificateListFilter {
|
|
1408
|
+
name?: string;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
/**
|
|
1412
|
+
* the representation of an mTLS certificate in the account certificate store
|
|
1413
|
+
*/
|
|
1414
|
+
declare interface MTlsCertificateResponse {
|
|
1415
|
+
id: string;
|
|
1416
|
+
name?: string;
|
|
1417
|
+
ca: boolean;
|
|
1418
|
+
certificates: string;
|
|
1419
|
+
expires_on: string;
|
|
1420
|
+
issuer: string;
|
|
1421
|
+
serial_number: string;
|
|
1422
|
+
signature: string;
|
|
1423
|
+
uploaded_on: string;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* details for uploading an mTLS certificate from disk
|
|
1428
|
+
*/
|
|
1429
|
+
declare interface MTlsCertificateUploadDetails {
|
|
1430
|
+
certificateChainFilename: string;
|
|
1431
|
+
privateKeyFilename: string;
|
|
1432
|
+
name?: string;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
declare interface PagesDeployOptions {
|
|
1436
|
+
/**
|
|
1437
|
+
* Path to static assets to deploy to Pages
|
|
1438
|
+
*/
|
|
1439
|
+
directory: string;
|
|
1440
|
+
/**
|
|
1441
|
+
* The Cloudflare Account ID that owns the project that's
|
|
1442
|
+
* being published
|
|
1443
|
+
*/
|
|
1444
|
+
accountId: string;
|
|
1445
|
+
/**
|
|
1446
|
+
* The name of the project to be published
|
|
1447
|
+
*/
|
|
1448
|
+
projectName: string;
|
|
1449
|
+
/**
|
|
1450
|
+
* Branch name to use. Defaults to production branch
|
|
1451
|
+
*/
|
|
1452
|
+
branch?: string;
|
|
1453
|
+
/**
|
|
1454
|
+
* Whether or not to skip local file upload result caching
|
|
1455
|
+
*/
|
|
1456
|
+
skipCaching?: boolean;
|
|
1457
|
+
/**
|
|
1458
|
+
* Commit message associated to deployment
|
|
1459
|
+
*/
|
|
1460
|
+
commitMessage?: string;
|
|
1461
|
+
/**
|
|
1462
|
+
* Commit hash associated to deployment
|
|
1463
|
+
*/
|
|
1464
|
+
commitHash?: string;
|
|
1465
|
+
/**
|
|
1466
|
+
* Whether or not the deployment should be considered to be
|
|
1467
|
+
* in a dirty commit state
|
|
1468
|
+
*/
|
|
1469
|
+
commitDirty?: boolean;
|
|
1470
|
+
/**
|
|
1471
|
+
* Path to the project's functions directory. Default uses
|
|
1472
|
+
* the current working directory + /functions since this is
|
|
1473
|
+
* typically called in a CLI
|
|
1474
|
+
*/
|
|
1475
|
+
functionsDirectory?: string;
|
|
1476
|
+
/**
|
|
1477
|
+
* Whether to run bundling on `_worker.js` before deploying.
|
|
1478
|
+
* Default: true
|
|
1479
|
+
*/
|
|
1480
|
+
bundle?: boolean;
|
|
1481
|
+
}
|
|
663
1482
|
|
|
664
1483
|
declare type ReferrerPolicy =
|
|
665
1484
|
| ''
|
|
@@ -672,13 +1491,13 @@ declare type ReferrerPolicy =
|
|
|
672
1491
|
| 'strict-origin-when-cross-origin'
|
|
673
1492
|
| 'unsafe-url';
|
|
674
1493
|
|
|
675
|
-
declare class
|
|
676
|
-
constructor (input:
|
|
1494
|
+
declare class Request_2 implements BodyMixin {
|
|
1495
|
+
constructor (input: RequestInfo_2, init?: RequestInit_2)
|
|
677
1496
|
|
|
678
1497
|
readonly cache: RequestCache
|
|
679
1498
|
readonly credentials: RequestCredentials
|
|
680
1499
|
readonly destination: RequestDestination
|
|
681
|
-
readonly headers:
|
|
1500
|
+
readonly headers: Headers_2
|
|
682
1501
|
readonly integrity: string
|
|
683
1502
|
readonly method: string
|
|
684
1503
|
readonly mode: RequestMode
|
|
@@ -688,17 +1507,18 @@ declare class Request implements BodyMixin {
|
|
|
688
1507
|
|
|
689
1508
|
readonly keepalive: boolean
|
|
690
1509
|
readonly signal: AbortSignal
|
|
1510
|
+
readonly duplex: RequestDuplex
|
|
691
1511
|
|
|
692
|
-
readonly body:
|
|
1512
|
+
readonly body: ReadableStream_2 | null
|
|
693
1513
|
readonly bodyUsed: boolean
|
|
694
1514
|
|
|
695
1515
|
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
696
1516
|
readonly blob: () => Promise<Blob_2>
|
|
697
|
-
readonly formData: () => Promise<
|
|
1517
|
+
readonly formData: () => Promise<FormData_2>
|
|
698
1518
|
readonly json: () => Promise<unknown>
|
|
699
1519
|
readonly text: () => Promise<string>
|
|
700
1520
|
|
|
701
|
-
readonly clone: () =>
|
|
1521
|
+
readonly clone: () => Request_2
|
|
702
1522
|
}
|
|
703
1523
|
|
|
704
1524
|
declare type RequestCache =
|
|
@@ -731,13 +1551,15 @@ declare type RequestDestination =
|
|
|
731
1551
|
| 'worker'
|
|
732
1552
|
| 'xslt'
|
|
733
1553
|
|
|
734
|
-
declare type
|
|
1554
|
+
declare type RequestDuplex = 'half'
|
|
1555
|
+
|
|
1556
|
+
declare type RequestInfo_2 = string | URL_2 | Request_2
|
|
735
1557
|
|
|
736
|
-
declare interface
|
|
1558
|
+
declare interface RequestInit_2 {
|
|
737
1559
|
method?: string
|
|
738
1560
|
keepalive?: boolean
|
|
739
|
-
headers?:
|
|
740
|
-
body?:
|
|
1561
|
+
headers?: HeadersInit_2
|
|
1562
|
+
body?: BodyInit_2
|
|
741
1563
|
redirect?: RequestRedirect
|
|
742
1564
|
integrity?: string
|
|
743
1565
|
signal?: AbortSignal
|
|
@@ -747,16 +1569,17 @@ declare interface RequestInit {
|
|
|
747
1569
|
referrerPolicy?: ReferrerPolicy
|
|
748
1570
|
window?: null
|
|
749
1571
|
dispatcher?: Dispatcher
|
|
1572
|
+
duplex?: RequestDuplex
|
|
750
1573
|
}
|
|
751
1574
|
|
|
752
1575
|
declare type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin'
|
|
753
1576
|
|
|
754
1577
|
declare type RequestRedirect = 'error' | 'follow' | 'manual'
|
|
755
1578
|
|
|
756
|
-
declare class
|
|
757
|
-
constructor (body?:
|
|
1579
|
+
declare class Response_2 implements BodyMixin {
|
|
1580
|
+
constructor (body?: BodyInit_2, init?: ResponseInit_2)
|
|
758
1581
|
|
|
759
|
-
readonly headers:
|
|
1582
|
+
readonly headers: Headers_2
|
|
760
1583
|
readonly ok: boolean
|
|
761
1584
|
readonly status: number
|
|
762
1585
|
readonly statusText: string
|
|
@@ -764,26 +1587,26 @@ declare class Response implements BodyMixin {
|
|
|
764
1587
|
readonly url: string
|
|
765
1588
|
readonly redirected: boolean
|
|
766
1589
|
|
|
767
|
-
readonly body:
|
|
1590
|
+
readonly body: ReadableStream_2 | null
|
|
768
1591
|
readonly bodyUsed: boolean
|
|
769
1592
|
|
|
770
1593
|
readonly arrayBuffer: () => Promise<ArrayBuffer>
|
|
771
1594
|
readonly blob: () => Promise<Blob_2>
|
|
772
|
-
readonly formData: () => Promise<
|
|
1595
|
+
readonly formData: () => Promise<FormData_2>
|
|
773
1596
|
readonly json: () => Promise<unknown>
|
|
774
1597
|
readonly text: () => Promise<string>
|
|
775
1598
|
|
|
776
|
-
readonly clone: () =>
|
|
1599
|
+
readonly clone: () => Response_2
|
|
777
1600
|
|
|
778
|
-
static error ():
|
|
779
|
-
static json(data: any, init?:
|
|
780
|
-
static redirect (url: string | URL_2, status: ResponseRedirectStatus):
|
|
1601
|
+
static error (): Response_2
|
|
1602
|
+
static json(data: any, init?: ResponseInit_2): Response_2
|
|
1603
|
+
static redirect (url: string | URL_2, status: ResponseRedirectStatus): Response_2
|
|
781
1604
|
}
|
|
782
1605
|
|
|
783
|
-
declare interface
|
|
1606
|
+
declare interface ResponseInit_2 {
|
|
784
1607
|
readonly status?: number
|
|
785
1608
|
readonly statusText?: string
|
|
786
|
-
readonly headers?:
|
|
1609
|
+
readonly headers?: HeadersInit_2
|
|
787
1610
|
}
|
|
788
1611
|
|
|
789
1612
|
declare type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308
|
|
@@ -821,11 +1644,22 @@ declare interface SpecIterator<T, TReturn = any, TNext = undefined> {
|
|
|
821
1644
|
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
|
|
822
1645
|
}
|
|
823
1646
|
|
|
1647
|
+
declare type TailConsumer = {
|
|
1648
|
+
/** The name of the service tail events will be forwarded to. */
|
|
1649
|
+
service: string;
|
|
1650
|
+
/** (Optional) The environt of the service. */
|
|
1651
|
+
environment?: string;
|
|
1652
|
+
};
|
|
1653
|
+
|
|
824
1654
|
/**
|
|
825
1655
|
* unstable_dev starts a wrangler dev server, and returns a promise that resolves with utility functions to interact with it.
|
|
826
1656
|
*/
|
|
827
1657
|
export declare function unstable_dev(script: string, options?: UnstableDevOptions, apiOptions?: unknown): Promise<UnstableDevWorker>;
|
|
828
1658
|
|
|
1659
|
+
export declare const unstable_pages: {
|
|
1660
|
+
deploy: typeof deploy;
|
|
1661
|
+
};
|
|
1662
|
+
|
|
829
1663
|
export declare interface UnstableDevOptions {
|
|
830
1664
|
config?: string;
|
|
831
1665
|
env?: string;
|
|
@@ -843,9 +1677,7 @@ export declare interface UnstableDevOptions {
|
|
|
843
1677
|
compatibilityFlags?: string[];
|
|
844
1678
|
persist?: boolean;
|
|
845
1679
|
persistTo?: string;
|
|
846
|
-
vars?:
|
|
847
|
-
[key: string]: unknown;
|
|
848
|
-
};
|
|
1680
|
+
vars?: Record<string, string | Json>;
|
|
849
1681
|
kv?: {
|
|
850
1682
|
binding: string;
|
|
851
1683
|
id: string;
|
|
@@ -862,18 +1694,19 @@ export declare interface UnstableDevOptions {
|
|
|
862
1694
|
bucket_name: string;
|
|
863
1695
|
preview_bucket_name?: string;
|
|
864
1696
|
}[];
|
|
1697
|
+
moduleRoot?: string;
|
|
1698
|
+
rules?: Rule[];
|
|
865
1699
|
logLevel?: "none" | "info" | "error" | "log" | "warn" | "debug";
|
|
866
|
-
logPrefix?: string;
|
|
867
1700
|
inspect?: boolean;
|
|
868
1701
|
local?: boolean;
|
|
869
1702
|
accountId?: string;
|
|
870
1703
|
experimental?: {
|
|
1704
|
+
processEntrypoint?: boolean;
|
|
1705
|
+
additionalModules?: CfModule[];
|
|
871
1706
|
d1Databases?: Environment["d1_databases"];
|
|
872
1707
|
disableExperimentalWarning?: boolean;
|
|
873
1708
|
disableDevRegistry?: boolean;
|
|
874
1709
|
enablePagesAssetsServiceBinding?: EnablePagesAssetsServiceBindingOptions;
|
|
875
|
-
experimentalLocal?: boolean;
|
|
876
|
-
experimentalLocalRemoteKv?: boolean;
|
|
877
1710
|
forceLocal?: boolean;
|
|
878
1711
|
liveReload?: boolean;
|
|
879
1712
|
showInteractiveDevSession?: boolean;
|
|
@@ -887,10 +1720,20 @@ export declare interface UnstableDevWorker {
|
|
|
887
1720
|
port: number;
|
|
888
1721
|
address: string;
|
|
889
1722
|
stop: () => Promise<void>;
|
|
890
|
-
fetch: (input?:
|
|
1723
|
+
fetch: (input?: RequestInfo_2, init?: RequestInit_2) => Promise<Response_2>;
|
|
891
1724
|
waitUntilExit: () => Promise<void>;
|
|
892
1725
|
}
|
|
893
1726
|
|
|
1727
|
+
/**
|
|
1728
|
+
* uploads an mTLS certificate and private key pair to the account mTLS certificate store
|
|
1729
|
+
*/
|
|
1730
|
+
export declare function uploadMTlsCertificate(accountId: string, body: MTlsCertificateBody): Promise<MTlsCertificateResponse>;
|
|
1731
|
+
|
|
1732
|
+
/**
|
|
1733
|
+
* reads an mTLS certificate and private key pair from disk and uploads it to the account mTLS certificate store
|
|
1734
|
+
*/
|
|
1735
|
+
export declare function uploadMTlsCertificateFromFs(accountId: string, details: MTlsCertificateUploadDetails): Promise<MTlsCertificateResponse>;
|
|
1736
|
+
|
|
894
1737
|
declare type ZoneIdRoute = {
|
|
895
1738
|
pattern: string;
|
|
896
1739
|
zone_id: string;
|