wrangler 0.0.0-ece06ea → 0.0.0-ecfbb0c

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.
Files changed (190) hide show
  1. package/Cloudflare_CA.pem +18 -0
  2. package/README.md +33 -14
  3. package/bin/wrangler.js +123 -25
  4. package/kv-asset-handler.js +1 -0
  5. package/miniflare-dist/index.mjs +4893 -0
  6. package/package.json +157 -116
  7. package/src/__tests__/config-cache.test.ts +36 -0
  8. package/src/__tests__/configuration.test.ts +3829 -0
  9. package/src/__tests__/dev.test.tsx +1159 -0
  10. package/src/__tests__/guess-worker-format.test.ts +85 -0
  11. package/src/__tests__/{clipboardy-mock.js → helpers/clipboardy-mock.js} +0 -0
  12. package/src/__tests__/helpers/cmd-shim.d.ts +11 -0
  13. package/src/__tests__/helpers/faye-websocket.d.ts +6 -0
  14. package/src/__tests__/helpers/mock-account-id.ts +48 -0
  15. package/src/__tests__/helpers/mock-bin.ts +36 -0
  16. package/src/__tests__/helpers/mock-cfetch.ts +211 -0
  17. package/src/__tests__/helpers/mock-console.ts +97 -0
  18. package/src/__tests__/helpers/mock-dialogs.ts +153 -0
  19. package/src/__tests__/helpers/mock-http-server.ts +46 -0
  20. package/src/__tests__/helpers/mock-istty.ts +74 -0
  21. package/src/__tests__/helpers/mock-kv.ts +33 -0
  22. package/src/__tests__/helpers/mock-oauth-flow.ts +250 -0
  23. package/src/__tests__/helpers/mock-process.ts +39 -0
  24. package/src/__tests__/helpers/mock-stdin.ts +108 -0
  25. package/src/__tests__/helpers/mock-web-socket.ts +29 -0
  26. package/src/__tests__/helpers/run-in-tmp.ts +39 -0
  27. package/src/__tests__/helpers/run-wrangler.ts +16 -0
  28. package/src/__tests__/helpers/write-worker-source.ts +31 -0
  29. package/src/__tests__/helpers/write-wrangler-toml.ts +17 -0
  30. package/src/__tests__/https-options.test.ts +130 -0
  31. package/src/__tests__/index.test.ts +255 -148
  32. package/src/__tests__/init.test.ts +1992 -0
  33. package/src/__tests__/jest.setup.ts +107 -0
  34. package/src/__tests__/kv.test.ts +1619 -0
  35. package/src/__tests__/logger.test.ts +141 -0
  36. package/src/__tests__/package-manager.test.ts +353 -0
  37. package/src/__tests__/pages.test.ts +1254 -0
  38. package/src/__tests__/parse.test.ts +330 -0
  39. package/src/__tests__/publish.test.ts +6513 -0
  40. package/src/__tests__/pubsub.test.ts +276 -0
  41. package/src/__tests__/r2.test.ts +233 -0
  42. package/src/__tests__/route.test.ts +45 -0
  43. package/src/__tests__/secret.test.ts +486 -0
  44. package/src/__tests__/tail.test.ts +690 -0
  45. package/src/__tests__/user.test.ts +143 -0
  46. package/src/__tests__/whoami.test.tsx +220 -0
  47. package/src/abort.d.ts +3 -0
  48. package/src/api/dev.ts +39 -0
  49. package/src/api/index.ts +1 -0
  50. package/src/bundle-reporter.tsx +29 -0
  51. package/src/bundle.ts +212 -0
  52. package/src/cfetch/index.ts +121 -0
  53. package/src/cfetch/internal.ts +149 -0
  54. package/src/cli.ts +25 -8
  55. package/src/config/README.md +107 -0
  56. package/src/config/config.ts +243 -0
  57. package/src/config/diagnostics.ts +80 -0
  58. package/src/config/environment.ts +430 -0
  59. package/src/config/index.ts +225 -0
  60. package/src/config/validation-helpers.ts +584 -0
  61. package/src/config/validation.ts +1693 -0
  62. package/src/config-cache.ts +44 -0
  63. package/src/create-worker-preview.ts +199 -0
  64. package/src/create-worker-upload-form.ts +254 -0
  65. package/src/dev/dev-vars.ts +36 -0
  66. package/src/dev/dev.tsx +417 -0
  67. package/src/dev/local.tsx +350 -0
  68. package/src/dev/remote.tsx +294 -0
  69. package/src/dev/use-esbuild.ts +150 -0
  70. package/src/dev.tsx +517 -727
  71. package/src/dialogs.tsx +116 -66
  72. package/src/durable.ts +102 -0
  73. package/src/entry.ts +328 -0
  74. package/src/environment-variables.ts +35 -0
  75. package/src/errors.ts +11 -0
  76. package/src/generate.ts +33 -0
  77. package/src/git-client.ts +42 -0
  78. package/src/https-options.ts +123 -0
  79. package/src/index.tsx +1845 -1828
  80. package/src/init.ts +549 -0
  81. package/src/inspect.ts +662 -0
  82. package/src/intl-polyfill.d.ts +139 -0
  83. package/src/kv.ts +408 -0
  84. package/src/logger.ts +73 -0
  85. package/src/miniflare-cli/README.md +30 -0
  86. package/src/miniflare-cli/enum-keys.ts +17 -0
  87. package/src/miniflare-cli/index.ts +52 -0
  88. package/src/miniflare-cli/request-context.ts +40 -0
  89. package/src/module-collection.ts +258 -0
  90. package/src/open-in-browser.ts +17 -0
  91. package/src/package-manager.ts +174 -0
  92. package/src/pages/build.tsx +202 -0
  93. package/src/pages/constants.ts +7 -0
  94. package/src/pages/deployments.tsx +101 -0
  95. package/src/pages/dev.tsx +964 -0
  96. package/src/pages/functions/buildPlugin.ts +105 -0
  97. package/src/pages/functions/buildWorker.ts +151 -0
  98. package/src/pages/functions/filepath-routing.test.ts +234 -0
  99. package/src/pages/functions/filepath-routing.ts +189 -0
  100. package/src/pages/functions/identifiers.ts +78 -0
  101. package/src/pages/functions/routes.ts +151 -0
  102. package/src/pages/index.tsx +84 -0
  103. package/src/pages/projects.tsx +157 -0
  104. package/src/pages/publish.tsx +335 -0
  105. package/src/pages/types.ts +40 -0
  106. package/src/pages/upload.tsx +384 -0
  107. package/src/pages/utils.ts +12 -0
  108. package/src/parse.ts +286 -0
  109. package/src/paths.ts +26 -0
  110. package/src/preview.ts +31 -0
  111. package/src/proxy.ts +476 -0
  112. package/src/publish.ts +755 -343
  113. package/src/pubsub/index.ts +286 -0
  114. package/src/pubsub/pubsub-commands.tsx +594 -0
  115. package/src/r2.ts +50 -0
  116. package/src/selfsigned.d.ts +29 -0
  117. package/src/sites.tsx +357 -100
  118. package/src/tail/filters.ts +279 -0
  119. package/src/tail/index.ts +299 -0
  120. package/src/tail/printing.ts +67 -0
  121. package/src/update-check.ts +19 -0
  122. package/src/user/choose-account.tsx +60 -0
  123. package/src/user/env-vars.ts +46 -0
  124. package/src/user/generate-auth-url.ts +33 -0
  125. package/src/user/generate-random-state.ts +16 -0
  126. package/src/user/index.ts +3 -0
  127. package/src/user/user.tsx +1130 -0
  128. package/src/whoami.tsx +90 -0
  129. package/src/worker.ts +185 -0
  130. package/src/zones.ts +76 -0
  131. package/templates/checked-fetch.js +17 -0
  132. package/templates/gitignore +171 -0
  133. package/templates/new-worker-scheduled.js +17 -0
  134. package/templates/new-worker-scheduled.ts +32 -0
  135. package/templates/new-worker.js +15 -0
  136. package/templates/new-worker.ts +30 -0
  137. package/templates/no-op-worker.js +10 -0
  138. package/templates/pages-template-plugin.ts +155 -0
  139. package/templates/pages-template-worker.ts +161 -0
  140. package/templates/static-asset-facade.js +43 -0
  141. package/templates/tsconfig.json +105 -0
  142. package/wrangler-dist/cli.js +104118 -113381
  143. package/src/__tests__/fixtures/init/.gitkeep +0 -0
  144. package/src/__tests__/mock-cfetch.js +0 -46
  145. package/src/api/form_data.ts +0 -158
  146. package/src/api/inspect.ts +0 -441
  147. package/src/api/preview.ts +0 -123
  148. package/src/api/worker.ts +0 -161
  149. package/src/cfetch.ts +0 -72
  150. package/src/config.ts +0 -124
  151. package/src/kv.tsx +0 -211
  152. package/src/pages.tsx +0 -344
  153. package/src/tail.tsx +0 -71
  154. package/src/user.tsx +0 -1029
  155. package/src/util/fetch.ts +0 -74
  156. package/static-asset-facade.js +0 -47
  157. package/vendor/@cloudflare/kv-asset-handler/CHANGELOG.md +0 -332
  158. package/vendor/@cloudflare/kv-asset-handler/LICENSE_APACHE +0 -176
  159. package/vendor/@cloudflare/kv-asset-handler/LICENSE_MIT +0 -25
  160. package/vendor/@cloudflare/kv-asset-handler/README.md +0 -245
  161. package/vendor/@cloudflare/kv-asset-handler/dist/index.d.ts +0 -32
  162. package/vendor/@cloudflare/kv-asset-handler/dist/index.js +0 -354
  163. package/vendor/@cloudflare/kv-asset-handler/dist/mocks.d.ts +0 -13
  164. package/vendor/@cloudflare/kv-asset-handler/dist/mocks.js +0 -148
  165. package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.d.ts +0 -1
  166. package/vendor/@cloudflare/kv-asset-handler/dist/test/getAssetFromKV.js +0 -436
  167. package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.d.ts +0 -1
  168. package/vendor/@cloudflare/kv-asset-handler/dist/test/mapRequestToAsset.js +0 -40
  169. package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.d.ts +0 -1
  170. package/vendor/@cloudflare/kv-asset-handler/dist/test/serveSinglePageApp.js +0 -42
  171. package/vendor/@cloudflare/kv-asset-handler/dist/types.d.ts +0 -26
  172. package/vendor/@cloudflare/kv-asset-handler/dist/types.js +0 -31
  173. package/vendor/@cloudflare/kv-asset-handler/package.json +0 -52
  174. package/vendor/@cloudflare/kv-asset-handler/src/index.ts +0 -296
  175. package/vendor/@cloudflare/kv-asset-handler/src/mocks.ts +0 -136
  176. package/vendor/@cloudflare/kv-asset-handler/src/test/getAssetFromKV.ts +0 -464
  177. package/vendor/@cloudflare/kv-asset-handler/src/test/mapRequestToAsset.ts +0 -33
  178. package/vendor/@cloudflare/kv-asset-handler/src/test/serveSinglePageApp.ts +0 -42
  179. package/vendor/@cloudflare/kv-asset-handler/src/types.ts +0 -39
  180. package/vendor/wrangler-mime/CHANGELOG.md +0 -289
  181. package/vendor/wrangler-mime/LICENSE +0 -21
  182. package/vendor/wrangler-mime/Mime.js +0 -97
  183. package/vendor/wrangler-mime/README.md +0 -187
  184. package/vendor/wrangler-mime/cli.js +0 -46
  185. package/vendor/wrangler-mime/index.js +0 -4
  186. package/vendor/wrangler-mime/lite.js +0 -4
  187. package/vendor/wrangler-mime/package.json +0 -52
  188. package/vendor/wrangler-mime/types/other.js +0 -1
  189. package/vendor/wrangler-mime/types/standard.js +0 -1
  190. package/wrangler-dist/cli.js.map +0 -7
package/src/pages.tsx DELETED
@@ -1,344 +0,0 @@
1
- import type { BuilderCallback } from "yargs";
2
- import { join } from "path";
3
- import { tmpdir } from "os";
4
- import { existsSync } from "fs";
5
- import type { ChildProcess } from "child_process";
6
- import { execSync, spawn } from "child_process";
7
- import express from "express";
8
- import type { MiniflareOptions } from "miniflare";
9
- import type { RequestInfo, RequestInit } from "@miniflare/core";
10
- import httpProxyMiddleware from "http-proxy-middleware";
11
-
12
- type Exit = (message?: string) => undefined;
13
-
14
- const isWindows = () => process.platform === "win32";
15
-
16
- const SECONDS_TO_WAIT_FOR_PROXY = 5;
17
-
18
- const sleep = async (ms: number) =>
19
- await new Promise((resolve) => setTimeout(resolve, ms));
20
-
21
- const getPids = (pid: number) => {
22
- const pids: number[] = [pid];
23
- let command: string, regExp: RegExp;
24
-
25
- if (isWindows()) {
26
- command = `wmic process where (ParentProcessId=${pid}) get ProcessId`;
27
- regExp = new RegExp(/(\d+)/);
28
- } else {
29
- command = `pgrep -P ${pid}`;
30
- regExp = new RegExp(/(\d+)/);
31
- }
32
-
33
- try {
34
- const newPids = (
35
- execSync(command)
36
- .toString()
37
- .split("\n")
38
- .map((line) => line.match(regExp))
39
- .filter((line) => line !== null) as RegExpExecArray[]
40
- ).map((match) => parseInt(match[1]));
41
-
42
- pids.push(...newPids.map(getPids).flat());
43
- } catch {}
44
-
45
- return pids;
46
- };
47
-
48
- const getPort = (pid: number) => {
49
- let command: string, regExp: RegExp;
50
-
51
- if (isWindows()) {
52
- command = "\\windows\\system32\\netstat.exe -nao";
53
- regExp = new RegExp(`TCP\\s+.*:(\\d+)\\s+.*:\\d+\\s+LISTENING\\s+${pid}`);
54
- } else {
55
- command = "lsof -nPi";
56
- regExp = new RegExp(`${pid}\\s+.*TCP\\s+.*:(\\d+)\\s+\\(LISTEN\\)`);
57
- }
58
-
59
- try {
60
- const matches = execSync(command)
61
- .toString()
62
- .split("\n")
63
- .map((line) => line.match(regExp))
64
- .filter((line) => line !== null) as RegExpExecArray[];
65
-
66
- const match = matches[0];
67
- if (match) return parseInt(match[1]);
68
- } catch (thrown) {
69
- console.error(
70
- `Error scanning for ports of process with PID ${pid}: ${thrown}`
71
- );
72
- }
73
- };
74
-
75
- const spawnProxyProcess = async ({
76
- directory,
77
- port,
78
- remaining,
79
- }: {
80
- directory?: string;
81
- port?: number;
82
- remaining: (string | number)[];
83
- }) => {
84
- let proxy: ChildProcess;
85
-
86
- const exit: Exit = (message) => {
87
- if (message) console.error(message);
88
- if (proxy) proxy.kill();
89
- return undefined;
90
- };
91
-
92
- if (directory !== undefined) {
93
- console.log(`Serving ${directory}...`);
94
- const args = ["serve", directory];
95
- if (port) args.push("-p", port.toString());
96
- proxy = spawn("npx", args, { shell: isWindows() });
97
- } else {
98
- const command = remaining;
99
- if (command.length === 0)
100
- return exit(
101
- "Must specify a directory of static assets to serve or a command to run."
102
- );
103
-
104
- console.log(`Running ${command.join(" ")}...`);
105
- proxy = spawn(
106
- command[0].toString(),
107
- command.slice(1).map((value) => value.toString()),
108
- { shell: isWindows() }
109
- );
110
- }
111
-
112
- proxy.stdout.on("data", (data) => {
113
- console.log(`[proxy]: ${data}`);
114
- });
115
-
116
- proxy.stderr.on("data", (data) => {
117
- console.error(`[proxy]: ${data}`);
118
- });
119
-
120
- proxy.on("close", (code) => {
121
- console.error(`Proxy exited with status ${code}.`);
122
- });
123
-
124
- // Wait for proxy process to start...
125
- while (!proxy.pid) {}
126
-
127
- if (port === undefined) {
128
- console.log(
129
- `Sleeping ${SECONDS_TO_WAIT_FOR_PROXY} seconds to allow proxy process to start before attempting to automatically determine port...`
130
- );
131
- console.log("To skip, specify the proxy port with --proxy.");
132
- await sleep(SECONDS_TO_WAIT_FOR_PROXY * 1000);
133
-
134
- port = getPids(proxy.pid)
135
- .map(getPort)
136
- .filter((port) => port !== undefined)[0];
137
-
138
- if (port === undefined) {
139
- return exit(
140
- "Could not automatically determin proxy port. Please specify the proxy port with --proxy."
141
- );
142
- } else {
143
- console.log(`Automatically determined the proxy port to be ${port}.`);
144
- }
145
- }
146
-
147
- return { proxy, port, exit };
148
- };
149
-
150
- export const pages: BuilderCallback<unknown, unknown> = (yargs) => {
151
- return yargs.command(
152
- "dev [directory] [-- command]",
153
- "🧑‍💻 Develop your full-stack Pages application locally",
154
- (yargs) => {
155
- return yargs
156
- .positional("directory", {
157
- type: "string",
158
- demandOption: undefined,
159
- description: "The directory of static assets to serve",
160
- })
161
- .positional("command", {
162
- type: "string",
163
- demandOption: undefined,
164
- description: "The proxy command to run",
165
- })
166
- .options({
167
- local: {
168
- type: "boolean",
169
- default: true,
170
- description: "Run on my machine",
171
- },
172
- port: {
173
- type: "number",
174
- default: 8788,
175
- description: "The port to listen on (serve from)",
176
- },
177
- proxy: {
178
- type: "number",
179
- description:
180
- "The port to proxy (where the static assets are served)",
181
- },
182
- "script-path": {
183
- type: "string",
184
- default: "_worker.js",
185
- description:
186
- "The location of the single Worker script if not using functions",
187
- },
188
- binding: {
189
- type: "array",
190
- description: "Bind variable/secret (KEY=VALUE)",
191
- alias: "b",
192
- },
193
- kv: {
194
- type: "array",
195
- description: "KV namespace to bind",
196
- alias: "k",
197
- },
198
- do: {
199
- type: "array",
200
- description: "Durable Object to bind (NAME=CLASS)",
201
- alias: "o",
202
- },
203
- // TODO: Miniflare user options
204
- });
205
- },
206
- async ({
207
- local,
208
- directory,
209
- port,
210
- proxy: requestedProxyPort,
211
- "script-path": singleWorkerScriptPath,
212
- binding: bindings = [],
213
- kv: kvs = [],
214
- do: durableObjects = [],
215
- "--": remaining = [],
216
- }) => {
217
- if (!local) {
218
- console.error("Only local mode is supported at the moment.");
219
- return;
220
- }
221
-
222
- const functionsDirectory = "./functions";
223
- const usingFunctions = existsSync(functionsDirectory);
224
-
225
- const proxy = await spawnProxyProcess({
226
- directory,
227
- port: requestedProxyPort,
228
- remaining: remaining as (string | number)[],
229
- });
230
- if (proxy === undefined) return undefined;
231
-
232
- const { port: proxyPort, exit } = proxy;
233
-
234
- let miniflareArgs: MiniflareOptions = {};
235
-
236
- if (usingFunctions) {
237
- const scriptPath = join(tmpdir(), "./functionsWorker.js");
238
- miniflareArgs = {
239
- scriptPath,
240
- buildWatchPaths: [functionsDirectory],
241
- buildCommand: `npx @cloudflare/pages-functions-compiler build ${functionsDirectory} --outfile ${scriptPath}`,
242
- };
243
- } else {
244
- const scriptPath =
245
- directory !== undefined
246
- ? join(directory, singleWorkerScriptPath)
247
- : singleWorkerScriptPath;
248
-
249
- if (!existsSync(scriptPath)) {
250
- return exit(
251
- `No Worker script found at ${scriptPath}. Please either create a functions directory or create a single Worker at ${scriptPath}.`
252
- );
253
- }
254
-
255
- miniflareArgs = {
256
- scriptPath,
257
- };
258
- }
259
-
260
- const { Miniflare } = await import("miniflare");
261
- const { Request, Response, fetch } = await import("@miniflare/core");
262
- const miniflare = new Miniflare({
263
- watch: true,
264
- modules: true,
265
-
266
- kvNamespaces: kvs.map((kv) => kv.toString()),
267
-
268
- durableObjects: Object.fromEntries(
269
- durableObjects.map((durableObject) =>
270
- durableObject.toString().split("=")
271
- )
272
- ),
273
-
274
- bindings: {
275
- // User bindings
276
- ...Object.fromEntries(
277
- bindings.map((binding) => binding.toString().split("="))
278
- ),
279
-
280
- // env.ASSETS.fetch
281
- ASSETS: {
282
- fetch: async (
283
- input: RequestInfo,
284
- init?: RequestInit | undefined
285
- ) => {
286
- try {
287
- let request = new Request(input, init);
288
- const url = new URL(request.url);
289
- url.host = `127.0.0.1:${proxyPort}`;
290
- request = new Request(url.toString(), request);
291
- return await fetch(request);
292
- } catch (thrown) {
293
- console.error(`Could not proxy request: ${thrown}`);
294
-
295
- // TODO: Pretty error page
296
- return new Response(
297
- `[wrangler] Could not proxy request: ${thrown}`,
298
- { status: 502 }
299
- );
300
- }
301
- },
302
- },
303
- },
304
-
305
- kvPersist: true,
306
- durableObjectsPersist: true,
307
- cachePersist: true,
308
-
309
- ...miniflareArgs,
310
- });
311
- const miniflareServer = await miniflare.createServer();
312
-
313
- miniflareServer.listen(0, () => {
314
- const address = miniflareServer.address();
315
- if (typeof address === "string")
316
- return exit(
317
- "Could not determine Miniflare's port. Please report this issue to the Wrangler team."
318
- );
319
-
320
- const miniflarePort = address.port;
321
-
322
- const app = express();
323
-
324
- app.use(
325
- "/",
326
- httpProxyMiddleware.createProxyMiddleware({
327
- target: `http://127.0.0.1:${miniflarePort}`,
328
- })
329
- );
330
-
331
- app.use(
332
- "/",
333
- httpProxyMiddleware.createProxyMiddleware({
334
- target: `http://127.0.0.1:${proxyPort}`,
335
- })
336
- );
337
-
338
- app.listen(port, () => {
339
- console.log(`Serving at http://127.0.0.1:${port}/`);
340
- });
341
- });
342
- }
343
- );
344
- };
package/src/tail.tsx DELETED
@@ -1,71 +0,0 @@
1
- import WebSocket from "ws";
2
- import cfetch from "./cfetch";
3
- import { version as packageVersion } from "../package.json";
4
-
5
- export type TailApiResponse = {
6
- id: string;
7
- url: string;
8
- expires_at: Date;
9
- };
10
-
11
- function makeCreateTailUrl(accountId: string, workerName: string): string {
12
- return `/accounts/${accountId}/workers/scripts/${workerName}/tails`;
13
- }
14
-
15
- function makeDeleteTailUrl(
16
- accountId: string,
17
- workerName: string,
18
- tailId: string
19
- ): string {
20
- return `/accounts/${accountId}/workers/scripts/${workerName}/tails/${tailId}`;
21
- }
22
-
23
- /// Creates a tail, but doesn't connect to it.
24
- async function createTailButDontConnect(
25
- accountId: string,
26
- workerName: string
27
- ): Promise<TailApiResponse> {
28
- const createTailUrl = makeCreateTailUrl(accountId, workerName);
29
- /// https://api.cloudflare.com/#worker-tail-logs-start-tail
30
- return await cfetch<TailApiResponse>(createTailUrl, { method: "POST" });
31
- }
32
-
33
- export async function createTail(
34
- accountId: string,
35
- workerName: string,
36
- _filters: Filters
37
- ): Promise<{
38
- tail: WebSocket;
39
- expiration: Date;
40
- deleteTail: () => Promise<void>;
41
- }> {
42
- const {
43
- id: tailId,
44
- url: websocketUrl,
45
- expires_at: expiration,
46
- } = await createTailButDontConnect(accountId, workerName);
47
- const deleteUrl = makeDeleteTailUrl(accountId, workerName, tailId);
48
-
49
- // deletes the tail
50
- async function deleteTail() {
51
- await cfetch(deleteUrl, { method: "DELETE" });
52
- }
53
-
54
- const tail = new WebSocket(websocketUrl, "trace-v1", {
55
- headers: {
56
- "Sec-WebSocket-Protocol": "trace-v1", // needs to be `trace-v1` to be accepted
57
- "User-Agent": `wrangler-js/${packageVersion}`,
58
- },
59
- });
60
-
61
- // TODO: send filters as well
62
- return { tail, expiration, deleteTail };
63
- }
64
-
65
- export type Filters = {
66
- status?: "ok" | "error" | "canceled";
67
- header?: string;
68
- method?: string;
69
- "sampling-rate"?: number;
70
- search?: string;
71
- };