wrangler 3.26.0 → 3.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -3
- package/templates/startDevWorker/ProxyWorker.ts +73 -33
- package/wrangler-dist/ProxyWorker.js +49 -23
- package/wrangler-dist/ProxyWorker.js.map +1 -1
- package/wrangler-dist/cli.d.ts +18 -4
- package/wrangler-dist/cli.js +1187 -664
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.28.0",
|
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wrangler",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"selfsigned": "^2.0.1",
|
|
97
97
|
"source-map": "0.6.1",
|
|
98
98
|
"xxhash-wasm": "^1.0.1",
|
|
99
|
-
"miniflare": "3.20240129.
|
|
99
|
+
"miniflare": "3.20240129.1"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
102
|
"@cloudflare/ai": "^1.0.35",
|
|
@@ -187,12 +187,20 @@
|
|
|
187
187
|
"yargs": "^17.7.2",
|
|
188
188
|
"yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz",
|
|
189
189
|
"@cloudflare/cli": "1.1.1",
|
|
190
|
-
"@cloudflare/pages-shared": "^0.11.
|
|
190
|
+
"@cloudflare/pages-shared": "^0.11.11",
|
|
191
191
|
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
192
192
|
},
|
|
193
193
|
"optionalDependencies": {
|
|
194
194
|
"fsevents": "~2.3.2"
|
|
195
195
|
},
|
|
196
|
+
"peerDependencies": {
|
|
197
|
+
"@cloudflare/workers-types": "^4.20230914.0"
|
|
198
|
+
},
|
|
199
|
+
"peerDependenciesMeta": {
|
|
200
|
+
"@cloudflare/workers-types": {
|
|
201
|
+
"optional": true
|
|
202
|
+
}
|
|
203
|
+
},
|
|
196
204
|
"engines": {
|
|
197
205
|
"node": ">=16.17.0"
|
|
198
206
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import assert from "node:assert";
|
|
2
1
|
import {
|
|
3
2
|
createDeferred,
|
|
4
3
|
DeferredPromise,
|
|
4
|
+
urlFromParts,
|
|
5
5
|
} from "../../src/api/startDevWorker/utils";
|
|
6
6
|
import type {
|
|
7
7
|
ProxyData,
|
|
@@ -37,6 +37,7 @@ export class ProxyWorker implements DurableObject {
|
|
|
37
37
|
|
|
38
38
|
proxyData?: ProxyData;
|
|
39
39
|
requestQueue = new Map<Request, DeferredPromise<Response>>();
|
|
40
|
+
requestRetryQueue = new Map<Request, DeferredPromise<Response>>();
|
|
40
41
|
|
|
41
42
|
fetch(request: Request) {
|
|
42
43
|
if (isRequestForLiveReloadWebsocket(request)) {
|
|
@@ -94,11 +95,22 @@ export class ProxyWorker implements DurableObject {
|
|
|
94
95
|
return new Response(null, { status: 204 });
|
|
95
96
|
}
|
|
96
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Process requests that are being retried first, then process newer requests.
|
|
100
|
+
* Requests that are being retried are, by definition, older than requests which haven't been processed yet.
|
|
101
|
+
* We don't need to be more accurate than this re ordering, since the requests are being fired off synchronously.
|
|
102
|
+
*/
|
|
103
|
+
*getOrderedQueue() {
|
|
104
|
+
yield* this.requestRetryQueue;
|
|
105
|
+
yield* this.requestQueue;
|
|
106
|
+
}
|
|
107
|
+
|
|
97
108
|
processQueue() {
|
|
98
|
-
const { proxyData } = this; //
|
|
109
|
+
const { proxyData } = this; // store proxyData at the moment this function was called
|
|
99
110
|
if (proxyData === undefined) return;
|
|
100
111
|
|
|
101
|
-
for (const [request, deferredResponse] of this.
|
|
112
|
+
for (const [request, deferredResponse] of this.getOrderedQueue()) {
|
|
113
|
+
this.requestRetryQueue.delete(request);
|
|
102
114
|
this.requestQueue.delete(request);
|
|
103
115
|
|
|
104
116
|
const userWorkerUrl = new URL(request.url);
|
|
@@ -115,6 +127,8 @@ export class ProxyWorker implements DurableObject {
|
|
|
115
127
|
|
|
116
128
|
// merge proxyData headers with the request headers
|
|
117
129
|
for (const [key, value] of Object.entries(proxyData.headers ?? {})) {
|
|
130
|
+
if (value === undefined) continue;
|
|
131
|
+
|
|
118
132
|
if (key.toLowerCase() === "cookie") {
|
|
119
133
|
const existing = request.headers.get("cookie") ?? "";
|
|
120
134
|
headers.set("cookie", `${existing};${value}`);
|
|
@@ -123,8 +137,7 @@ export class ProxyWorker implements DurableObject {
|
|
|
123
137
|
}
|
|
124
138
|
}
|
|
125
139
|
|
|
126
|
-
// explicitly NOT await-ing this promise, we are in a loop and want to process the whole queue quickly
|
|
127
|
-
// if we decide to await, we should include a timeout (~100ms) in case the user worker has long-running/parellel requests
|
|
140
|
+
// explicitly NOT await-ing this promise, we are in a loop and want to process the whole queue quickly + synchronously
|
|
128
141
|
void fetch(userWorkerUrl, new Request(request, { headers }))
|
|
129
142
|
.then((res) => {
|
|
130
143
|
if (isHtmlResponse(res)) {
|
|
@@ -137,17 +150,55 @@ export class ProxyWorker implements DurableObject {
|
|
|
137
150
|
// errors here are network errors or from response post-processing
|
|
138
151
|
// to catch only network errors, use the 2nd param of the fetch.then()
|
|
139
152
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
153
|
+
// we have crossed an async boundary, so proxyData may have changed
|
|
154
|
+
// if proxyData.userWorkerUrl has changed, it means there is a new downstream UserWorker
|
|
155
|
+
// and that this error is stale since it was for a request to the old UserWorker
|
|
156
|
+
// so here we construct a newUserWorkerUrl so we can compare it to the (old) userWorkerUrl
|
|
157
|
+
const newUserWorkerUrl =
|
|
158
|
+
this.proxyData && urlFromParts(this.proxyData.userWorkerUrl);
|
|
159
|
+
|
|
160
|
+
// only report errors if the downstream proxy has NOT changed
|
|
161
|
+
if (userWorkerUrl.href === newUserWorkerUrl?.href) {
|
|
162
|
+
void sendMessageToProxyController(this.env, {
|
|
163
|
+
type: "error",
|
|
164
|
+
error: {
|
|
165
|
+
name: error.name,
|
|
166
|
+
message: error.message,
|
|
167
|
+
stack: error.stack,
|
|
168
|
+
cause: error.cause,
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
deferredResponse.reject(error);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// if the request can be retried (subset of idempotent requests which have no body), requeue it
|
|
176
|
+
else if (request.method === "GET" || request.method === "HEAD") {
|
|
177
|
+
this.requestRetryQueue.set(request, deferredResponse);
|
|
178
|
+
// we would only end up here if the downstream UserWorker is chang*ing*
|
|
179
|
+
// i.e. we are in a `pause`d state and expecting a `play` message soon
|
|
180
|
+
// this request will be processed (retried) when the `play` message arrives
|
|
181
|
+
// for that reason, we do not need to call `this.processQueue` here
|
|
182
|
+
// (but, also, it can't hurt to call it since it bails when
|
|
183
|
+
// in a `pause`d state i.e. `this.proxyData` is undefined)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// if the request cannot be retried, respond with 503 Service Unavailable
|
|
187
|
+
// important to note, this is not an (unexpected) error -- it is an acceptable flow of local development
|
|
188
|
+
// it would be incorrect to retry non-idempotent requests
|
|
189
|
+
// and would require cloning all body streams to avoid stream reuse (which is inefficient but not out of the question in the future)
|
|
190
|
+
// this is a good enough UX for now since it solves the most common GET use-case
|
|
191
|
+
else {
|
|
192
|
+
deferredResponse.resolve(
|
|
193
|
+
new Response(
|
|
194
|
+
"Your worker restarted mid-request. Please try sending the request again. Only GET or HEAD requests are retried automatically.",
|
|
195
|
+
{
|
|
196
|
+
status: 503,
|
|
197
|
+
headers: { "Retry-After": "0" },
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
);
|
|
201
|
+
}
|
|
151
202
|
});
|
|
152
203
|
}
|
|
153
204
|
}
|
|
@@ -166,25 +217,14 @@ function isRequestForLiveReloadWebsocket(req: Request): boolean {
|
|
|
166
217
|
return isWebSocketUpgrade && websocketProtocol === LIVE_RELOAD_PROTOCOL;
|
|
167
218
|
}
|
|
168
219
|
|
|
169
|
-
|
|
220
|
+
function sendMessageToProxyController(
|
|
170
221
|
env: Env,
|
|
171
|
-
message: ProxyWorkerOutgoingRequestBody
|
|
172
|
-
retries = 3
|
|
222
|
+
message: ProxyWorkerOutgoingRequestBody
|
|
173
223
|
) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
});
|
|
179
|
-
} catch (cause) {
|
|
180
|
-
if (retries > 0) {
|
|
181
|
-
return sendMessageToProxyController(env, message, retries - 1);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// no point sending an error message if we can't send this message
|
|
185
|
-
|
|
186
|
-
throw cause;
|
|
187
|
-
}
|
|
224
|
+
return env.PROXY_CONTROLLER.fetch("http://dummy", {
|
|
225
|
+
method: "POST",
|
|
226
|
+
body: JSON.stringify(message),
|
|
227
|
+
});
|
|
188
228
|
}
|
|
189
229
|
|
|
190
230
|
function insertLiveReloadScript(
|
|
@@ -15,6 +15,11 @@ function createDeferred(previousDeferred) {
|
|
|
15
15
|
reject
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
+
function urlFromParts(parts, base = "http://localhost") {
|
|
19
|
+
const url = new URL(base);
|
|
20
|
+
Object.assign(url, parts);
|
|
21
|
+
return url;
|
|
22
|
+
}
|
|
18
23
|
|
|
19
24
|
// templates/startDevWorker/ProxyWorker.ts
|
|
20
25
|
var LIVE_RELOAD_PROTOCOL = "WRANGLER_PROXYWORKER_LIVE_RELOAD_PROTOCOL";
|
|
@@ -32,6 +37,7 @@ var ProxyWorker = class {
|
|
|
32
37
|
}
|
|
33
38
|
proxyData;
|
|
34
39
|
requestQueue = /* @__PURE__ */ new Map();
|
|
40
|
+
requestRetryQueue = /* @__PURE__ */ new Map();
|
|
35
41
|
fetch(request) {
|
|
36
42
|
if (isRequestForLiveReloadWebsocket(request)) {
|
|
37
43
|
return this.handleLiveReloadWebSocket(request);
|
|
@@ -68,11 +74,21 @@ var ProxyWorker = class {
|
|
|
68
74
|
}
|
|
69
75
|
return new Response(null, { status: 204 });
|
|
70
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Process requests that are being retried first, then process newer requests.
|
|
79
|
+
* Requests that are being retried are, by definition, older than requests which haven't been processed yet.
|
|
80
|
+
* We don't need to be more accurate than this re ordering, since the requests are being fired off synchronously.
|
|
81
|
+
*/
|
|
82
|
+
*getOrderedQueue() {
|
|
83
|
+
yield* this.requestRetryQueue;
|
|
84
|
+
yield* this.requestQueue;
|
|
85
|
+
}
|
|
71
86
|
processQueue() {
|
|
72
87
|
const { proxyData } = this;
|
|
73
88
|
if (proxyData === void 0)
|
|
74
89
|
return;
|
|
75
|
-
for (const [request, deferredResponse] of this.
|
|
90
|
+
for (const [request, deferredResponse] of this.getOrderedQueue()) {
|
|
91
|
+
this.requestRetryQueue.delete(request);
|
|
76
92
|
this.requestQueue.delete(request);
|
|
77
93
|
const userWorkerUrl = new URL(request.url);
|
|
78
94
|
const headers = new Headers(request.headers);
|
|
@@ -82,6 +98,8 @@ var ProxyWorker = class {
|
|
|
82
98
|
headers.set("MF-Original-URL", innerUrl.href);
|
|
83
99
|
headers.set("MF-Disable-Pretty-Error", "true");
|
|
84
100
|
for (const [key, value] of Object.entries(proxyData.headers ?? {})) {
|
|
101
|
+
if (value === void 0)
|
|
102
|
+
continue;
|
|
85
103
|
if (key.toLowerCase() === "cookie") {
|
|
86
104
|
const existing = request.headers.get("cookie") ?? "";
|
|
87
105
|
headers.set("cookie", `${existing};${value}`);
|
|
@@ -95,16 +113,31 @@ var ProxyWorker = class {
|
|
|
95
113
|
}
|
|
96
114
|
deferredResponse.resolve(res);
|
|
97
115
|
}).catch((error) => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
116
|
+
const newUserWorkerUrl = this.proxyData && urlFromParts(this.proxyData.userWorkerUrl);
|
|
117
|
+
if (userWorkerUrl.href === newUserWorkerUrl?.href) {
|
|
118
|
+
void sendMessageToProxyController(this.env, {
|
|
119
|
+
type: "error",
|
|
120
|
+
error: {
|
|
121
|
+
name: error.name,
|
|
122
|
+
message: error.message,
|
|
123
|
+
stack: error.stack,
|
|
124
|
+
cause: error.cause
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
deferredResponse.reject(error);
|
|
128
|
+
} else if (request.method === "GET" || request.method === "HEAD") {
|
|
129
|
+
this.requestRetryQueue.set(request, deferredResponse);
|
|
130
|
+
} else {
|
|
131
|
+
deferredResponse.resolve(
|
|
132
|
+
new Response(
|
|
133
|
+
"Your worker restarted mid-request. Please try sending the request again. Only GET or HEAD requests are retried automatically.",
|
|
134
|
+
{
|
|
135
|
+
status: 503,
|
|
136
|
+
headers: { "Retry-After": "0" }
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
);
|
|
140
|
+
}
|
|
108
141
|
});
|
|
109
142
|
}
|
|
110
143
|
}
|
|
@@ -120,18 +153,11 @@ function isRequestForLiveReloadWebsocket(req) {
|
|
|
120
153
|
const isWebSocketUpgrade = req.headers.get("Upgrade") === "websocket";
|
|
121
154
|
return isWebSocketUpgrade && websocketProtocol === LIVE_RELOAD_PROTOCOL;
|
|
122
155
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
});
|
|
129
|
-
} catch (cause) {
|
|
130
|
-
if (retries > 0) {
|
|
131
|
-
return sendMessageToProxyController(env, message, retries - 1);
|
|
132
|
-
}
|
|
133
|
-
throw cause;
|
|
134
|
-
}
|
|
156
|
+
function sendMessageToProxyController(env, message) {
|
|
157
|
+
return env.PROXY_CONTROLLER.fetch("http://dummy", {
|
|
158
|
+
method: "POST",
|
|
159
|
+
body: JSON.stringify(message)
|
|
160
|
+
});
|
|
135
161
|
}
|
|
136
162
|
function insertLiveReloadScript(request, response, env, proxyData) {
|
|
137
163
|
const htmlRewriter = new HTMLRewriter();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/api/startDevWorker/utils.ts", "../templates/startDevWorker/ProxyWorker.ts"],
|
|
4
|
-
"mappings": ";AAAA,OAAO,YAAY;AASZ,SAAS,eACf,kBACqB;AACrB,MAAI,SAAS;AACb,QAAM,aAAa,IAAI,QAAW,CAAC,UAAU,YAAY;AACxD,cAAU;AACV,aAAS;AAAA,EACV,CAAC;AACD,SAAO,OAAO;AACd,SAAO,MAAM;AAIb,oBAAkB,QAAQ,UAAU;AAEpC,SAAO;AAAA,IACN,SAAS;AAAA,IACT;AAAA,IACA;AAAA,EACD;AACD;;;
|
|
4
|
+
"mappings": ";AAAA,OAAO,YAAY;AASZ,SAAS,eACf,kBACqB;AACrB,MAAI,SAAS;AACb,QAAM,aAAa,IAAI,QAAW,CAAC,UAAU,YAAY;AACxD,cAAU;AACV,aAAS;AAAA,EACV,CAAC;AACD,SAAO,OAAO;AACd,SAAO,MAAM;AAIb,oBAAkB,QAAQ,UAAU;AAEpC,SAAO;AAAA,IACN,SAAS;AAAA,IACT;AAAA,IACA;AAAA,EACD;AACD;AAIO,SAAS,aACf,OACA,OAAO,oBACD;AACN,QAAM,MAAM,IAAI,IAAI,IAAI;AAExB,SAAO,OAAO,KAAK,KAAK;AAExB,SAAO;AACR;;;AClBA,IAAM,uBAAuB;AAC7B,IAAO,sBAAQ;AAAA,EACd,MAAM,KAAK,KAAK;AACf,UAAM,YAAY,IAAI,eAAe,WAAW,EAAE;AAClD,UAAM,iBAAiB,IAAI,eAAe,IAAI,SAAS;AAEvD,WAAO,eAAe,MAAM,GAAG;AAAA,EAChC;AACD;AAEO,IAAM,cAAN,MAA2C;AA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K,6BAA6B,KAAK;AAAA,UACtC,MAAM;AAAA,UACN;AAAA,QACD,CAAC;AAAA,MACF;AAIA,UAAI,UAAU,YAAY;AACzB,cAAM,eAAe,IAAI,IAAI,QAAQ,GAAG;AACxC,qBAAa,WACZ,aAAa,aAAa,UAAU,QAAQ;AAE7C,YAAI;AAAA,UACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+DAW0D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAQ1D,EAAE,MAAM,KAAK;AAAA,QACd;AAAA,MACD;AAAA,IACD;AAAA,EACD,CAAC;AAED,SAAO,aAAa,UAAU,QAAQ;AACvC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { DispatchFetch } from 'miniflare';
|
|
|
6
6
|
import { Duplex } from 'stream';
|
|
7
7
|
import { EventEmitter } from 'events';
|
|
8
8
|
import { EventEmitter as EventEmitter_2 } from 'node:events';
|
|
9
|
+
import type { IncomingRequestCfProperties as IncomingRequestCfProperties_2 } from '@cloudflare/workers-types/experimental';
|
|
9
10
|
import { IpcNetConnectOpts } from 'net';
|
|
10
11
|
import type { Json } from 'miniflare';
|
|
11
12
|
import type { MessagePort as MessagePort_2 } from 'worker_threads';
|
|
@@ -136,11 +137,19 @@ declare type Binding = {
|
|
|
136
137
|
/**
|
|
137
138
|
* Result of the `getBindingsProxy` utility
|
|
138
139
|
*/
|
|
139
|
-
export declare type BindingsProxy<Bindings = Record<string, unknown
|
|
140
|
+
export declare type BindingsProxy<Bindings = Record<string, unknown>, CfProperties extends Record<string, unknown> = IncomingRequestCfProperties_2> = {
|
|
140
141
|
/**
|
|
141
142
|
* Object containing the various proxies
|
|
142
143
|
*/
|
|
143
144
|
bindings: Bindings;
|
|
145
|
+
/**
|
|
146
|
+
* Mock of the context object that Workers received in their request handler, all the object's methods are no-op
|
|
147
|
+
*/
|
|
148
|
+
cf: CfProperties;
|
|
149
|
+
/**
|
|
150
|
+
* Mock of the context object that Workers received in their request handler, all the object's methods are no-op
|
|
151
|
+
*/
|
|
152
|
+
ctx: ExecutionContext_2;
|
|
144
153
|
/**
|
|
145
154
|
* Caches object emulating the Workers Cache runtime API
|
|
146
155
|
*/
|
|
@@ -431,7 +440,7 @@ declare interface CfModule {
|
|
|
431
440
|
/**
|
|
432
441
|
* A module type.
|
|
433
442
|
*/
|
|
434
|
-
declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer";
|
|
443
|
+
declare type CfModuleType = "esm" | "commonjs" | "compiled-wasm" | "text" | "buffer" | "python" | "python-requirement";
|
|
435
444
|
|
|
436
445
|
/**
|
|
437
446
|
* The type of Worker
|
|
@@ -700,7 +709,7 @@ declare interface ConfigFields<Dev extends RawDevConfig> {
|
|
|
700
709
|
/**
|
|
701
710
|
* The possible types for a `Rule`.
|
|
702
711
|
*/
|
|
703
|
-
declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data";
|
|
712
|
+
declare type ConfigModuleRuleType = "ESModule" | "CommonJS" | "CompiledWasm" | "Text" | "Data" | "PythonModule" | "PythonRequirement";
|
|
704
713
|
|
|
705
714
|
declare type ConfigUpdateEvent = {
|
|
706
715
|
type: "configUpdate";
|
|
@@ -2083,6 +2092,11 @@ declare type EventTarget_2 = typeof globalThis extends { EventTarget: infer T }
|
|
|
2083
2092
|
): void
|
|
2084
2093
|
}
|
|
2085
2094
|
|
|
2095
|
+
declare class ExecutionContext_2 {
|
|
2096
|
+
waitUntil(promise: Promise<any>): void;
|
|
2097
|
+
passThroughOnException(): void;
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2086
2100
|
declare function fetch_2 (
|
|
2087
2101
|
input: RequestInfo_2,
|
|
2088
2102
|
init?: RequestInit_2
|
|
@@ -2269,7 +2283,7 @@ declare type FormDataEntryValue = string | File_2
|
|
|
2269
2283
|
* @param options The various options that can tweak this function's behavior
|
|
2270
2284
|
* @returns An Object containing the generated proxies alongside other related utilities
|
|
2271
2285
|
*/
|
|
2272
|
-
export declare function getBindingsProxy<Bindings = Record<string, unknown
|
|
2286
|
+
export declare function getBindingsProxy<Bindings = Record<string, unknown>, CfProperties extends Record<string, unknown> = IncomingRequestCfProperties_2>(options?: GetBindingsProxyOptions): Promise<BindingsProxy<Bindings, CfProperties>>;
|
|
2273
2287
|
|
|
2274
2288
|
/**
|
|
2275
2289
|
* Options for the `getBindingsProxy` utility
|