wrangler 0.0.0-e7cf0caa → 0.0.0-e87ad068

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 (85) hide show
  1. package/miniflare-dist/index.mjs +167 -93
  2. package/package.json +6 -6
  3. package/src/__tests__/configuration.test.ts +218 -0
  4. package/src/__tests__/constellation.test.ts +371 -0
  5. package/src/__tests__/d1/migrate.test.ts +100 -0
  6. package/src/__tests__/index.test.ts +4 -2
  7. package/src/__tests__/init.test.ts +109 -3
  8. package/src/__tests__/mtls-certificates.test.ts +2 -1
  9. package/src/__tests__/pages/functions-build.test.ts +77 -0
  10. package/src/__tests__/pages-deployment-tail.test.ts +2 -0
  11. package/src/__tests__/publish.test.ts +646 -187
  12. package/src/__tests__/tail.test.ts +49 -7
  13. package/src/__tests__/tsconfig.tsbuildinfo +1 -1
  14. package/src/__tests__/unstableDev.test.ts +61 -0
  15. package/src/__tests__/user.test.ts +1 -1
  16. package/src/api/dev.ts +12 -0
  17. package/src/api/pages/create-worker-bundle-contents.ts +4 -0
  18. package/src/api/pages/publish.tsx +28 -12
  19. package/src/bundle.ts +58 -14
  20. package/src/cfetch/internal.ts +19 -14
  21. package/src/config/environment.ts +41 -0
  22. package/src/config/index.ts +21 -0
  23. package/src/config/validation.ts +182 -0
  24. package/src/constellation/createProject.tsx +51 -0
  25. package/src/constellation/deleteProject.ts +51 -0
  26. package/src/constellation/deleteProjectModel.ts +76 -0
  27. package/src/constellation/index.ts +75 -0
  28. package/src/constellation/listCatalog.tsx +35 -0
  29. package/src/constellation/listModel.tsx +49 -0
  30. package/src/constellation/listProject.tsx +28 -0
  31. package/src/constellation/listRuntime.tsx +28 -0
  32. package/src/constellation/options.ts +17 -0
  33. package/src/constellation/types.ts +17 -0
  34. package/src/constellation/uploadModel.tsx +84 -0
  35. package/src/constellation/utils.ts +90 -0
  36. package/src/create-worker-upload-form.ts +25 -0
  37. package/src/d1/backups.tsx +4 -4
  38. package/src/d1/constants.ts +3 -0
  39. package/src/d1/create.tsx +77 -43
  40. package/src/d1/delete.ts +1 -1
  41. package/src/d1/execute.tsx +27 -13
  42. package/src/d1/list.tsx +13 -11
  43. package/src/d1/migrations/apply.tsx +29 -6
  44. package/src/d1/migrations/helpers.ts +8 -9
  45. package/src/d1/types.ts +7 -0
  46. package/src/dev/dev.tsx +9 -2
  47. package/src/dev/local.tsx +52 -20
  48. package/src/dev/remote.tsx +4 -0
  49. package/src/dev/start-server.ts +64 -40
  50. package/src/dev/use-esbuild.ts +70 -43
  51. package/src/dev-registry.ts +11 -0
  52. package/src/dev.tsx +23 -6
  53. package/src/docs/helpers.ts +50 -0
  54. package/src/docs/index.ts +25 -68
  55. package/src/entry.ts +8 -1
  56. package/src/environment-variables/factory.ts +2 -1
  57. package/src/generate/index.ts +5 -0
  58. package/src/index.ts +12 -1
  59. package/src/init.ts +52 -10
  60. package/src/inspect.ts +107 -6
  61. package/src/kv/helpers.ts +7 -4
  62. package/src/logger.ts +5 -1
  63. package/src/miniflare-cli/index.ts +2 -2
  64. package/src/miniflare-cli/tsconfig.tsbuildinfo +1 -1
  65. package/src/module-collection.ts +1 -1
  66. package/src/pages/build.ts +30 -17
  67. package/src/pages/dev.ts +51 -8
  68. package/src/pages/functions/buildPlugin.ts +1 -0
  69. package/src/pages/functions/buildWorker.ts +92 -2
  70. package/src/pages/functions/tsconfig.tsbuildinfo +1 -1
  71. package/src/publish/publish.ts +9 -1
  72. package/src/secret/index.ts +4 -0
  73. package/src/sites.ts +164 -52
  74. package/src/tail/createTail.ts +9 -0
  75. package/src/tail/printing.ts +12 -0
  76. package/src/traverse-module-graph.ts +2 -1
  77. package/src/type-generation.ts +6 -0
  78. package/src/user/user.ts +1 -0
  79. package/src/utils/render.ts +1 -1
  80. package/src/worker.ts +26 -0
  81. package/templates/__tests__/tsconfig.tsbuildinfo +1 -1
  82. package/templates/pages-dev-util.ts +4 -1
  83. package/templates/tsconfig.tsbuildinfo +1 -1
  84. package/wrangler-dist/cli.d.ts +78 -2
  85. package/wrangler-dist/cli.js +65057 -63883
@@ -14,6 +14,7 @@ import type {
14
14
  ScheduledEvent,
15
15
  AlarmEvent,
16
16
  EmailEvent,
17
+ TailInfo,
17
18
  } from "../tail/createTail";
18
19
  import type { RequestInit } from "undici";
19
20
  import type WebSocket from "ws";
@@ -56,10 +57,10 @@ describe("tail", () => {
56
57
  await runWrangler("tail durable-object--websocket--response");
57
58
  expect(std.out).toMatchInlineSnapshot(`""`);
58
59
  expect(std.warn).toMatchInlineSnapshot(`
59
- "▲ [WARNING] Beginning log collection requires restarting the Durable Objects associated with durable-object--websocket--response. Any WebSocket connections or other non-persisted state will be lost as part of this restart.
60
+ "▲ [WARNING] Beginning log collection requires restarting the Durable Objects associated with durable-object--websocket--response. Any WebSocket connections or other non-persisted state will be lost as part of this restart.
60
61
 
61
- "
62
- `);
62
+ "
63
+ `);
63
64
  expect(std.err).toMatchInlineSnapshot(`""`);
64
65
  });
65
66
  it("creates and then delete tails", async () => {
@@ -503,10 +504,36 @@ describe("tail", () => {
503
504
  )
504
505
  .replace(mockTailExpiration.toISOString(), "[mock expiration date]")
505
506
  ).toMatchInlineSnapshot(`
506
- "Successfully created tail, expires at [mock expiration date]
507
- Connected to test-worker, waiting for logs...
508
- Email from:${mockEmailEventFrom} to:${mockEmailEventTo} size:${mockEmailEventSize} @ [mock event timestamp] - Ok"
509
- `);
507
+ "Successfully created tail, expires at [mock expiration date]
508
+ Connected to test-worker, waiting for logs...
509
+ Email from:from@example.com to:to@example.com size:45416 @ [mock event timestamp] - Ok"
510
+ `);
511
+ });
512
+
513
+ it("logs tail overload message", async () => {
514
+ const api = mockWebsocketAPIs();
515
+ await runWrangler("tail test-worker --format pretty");
516
+
517
+ let event = generateTailInfo(true);
518
+ let message = generateMockEventMessage({ event });
519
+ let serializedMessage = serialize(message);
520
+ api.ws.send(serializedMessage);
521
+
522
+ event = generateTailInfo(false);
523
+ message = generateMockEventMessage({ event });
524
+ serializedMessage = serialize(message);
525
+ api.ws.send(serializedMessage);
526
+ expect(
527
+ std.out.replace(
528
+ mockTailExpiration.toISOString(),
529
+ "[mock expiration date]"
530
+ )
531
+ ).toMatchInlineSnapshot(`
532
+ "Successfully created tail, expires at [mock expiration date]
533
+ Connected to test-worker, waiting for logs...
534
+ Tail is currently in sampling mode due to the high volume of messages. To prevent messages from being dropped consider adding filters.
535
+ Tail has exited sampling mode and is no longer dropping messages."
536
+ `);
510
537
  });
511
538
 
512
539
  it("should not crash when the tail message has a void event", async () => {
@@ -675,6 +702,7 @@ function isRequest(
675
702
  | RequestEvent
676
703
  | AlarmEvent
677
704
  | EmailEvent
705
+ | TailInfo
678
706
  | undefined
679
707
  | null
680
708
  ): event is RequestEvent {
@@ -956,3 +984,17 @@ function generateMockEmailEvent(opts?: Partial<EmailEvent>): EmailEvent {
956
984
  rawSize: opts?.rawSize || mockEmailEventSize,
957
985
  };
958
986
  }
987
+
988
+ function generateTailInfo(overload: boolean): TailInfo {
989
+ return overload
990
+ ? {
991
+ message:
992
+ "Tail is currently in sampling mode due to the high volume of messages. To prevent messages from being dropped consider adding filters.",
993
+ type: "overload",
994
+ }
995
+ : {
996
+ message:
997
+ "Tail has exited sampling mode and is no longer dropping messages.",
998
+ type: "overload-stop",
999
+ };
1000
+ }