wrangler 2.4.4 → 2.6.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.
Files changed (46) hide show
  1. package/bin/wrangler.js +20 -8
  2. package/miniflare-dist/index.mjs +90 -41
  3. package/package.json +3 -3
  4. package/src/__tests__/configuration.test.ts +211 -0
  5. package/src/__tests__/delete.test.ts +81 -48
  6. package/src/__tests__/dev.test.tsx +25 -8
  7. package/src/__tests__/helpers/mock-oauth-flow.ts +5 -1
  8. package/src/__tests__/helpers/msw/handlers/oauth.ts +13 -18
  9. package/src/__tests__/init.test.ts +18 -3
  10. package/src/__tests__/logout.test.ts +47 -0
  11. package/src/__tests__/metrics.test.ts +88 -43
  12. package/src/__tests__/pages-deployment-tail.test.ts +165 -101
  13. package/src/__tests__/publish.test.ts +94 -7
  14. package/src/__tests__/pubsub.test.ts +208 -88
  15. package/src/__tests__/queues.test.ts +155 -67
  16. package/src/__tests__/tail.test.ts +207 -108
  17. package/src/__tests__/type-generation.test.ts +7 -0
  18. package/src/__tests__/user.test.ts +43 -69
  19. package/src/config/environment.ts +16 -0
  20. package/src/config/index.ts +31 -8
  21. package/src/config/validation.ts +49 -0
  22. package/src/create-worker-upload-form.ts +9 -0
  23. package/src/d1/backups.tsx +7 -2
  24. package/src/d1/delete.tsx +4 -4
  25. package/src/d1/index.ts +2 -0
  26. package/src/d1/migrations/apply.tsx +6 -5
  27. package/src/d1/migrations/helpers.ts +4 -2
  28. package/src/d1/migrations/list.tsx +2 -2
  29. package/src/d1/migrations/options.ts +18 -0
  30. package/src/dev/dev.tsx +46 -22
  31. package/src/dev/local.tsx +63 -29
  32. package/src/dev/start-server.ts +18 -21
  33. package/src/dev.tsx +33 -13
  34. package/src/git-client.ts +15 -4
  35. package/src/index.tsx +1 -0
  36. package/src/init.ts +8 -0
  37. package/src/miniflare-cli/assets.ts +55 -28
  38. package/src/miniflare-cli/index.ts +2 -1
  39. package/src/pages/dev.tsx +7 -0
  40. package/src/proxy.ts +5 -0
  41. package/src/publish/publish.ts +1 -0
  42. package/src/secret/index.ts +1 -0
  43. package/src/type-generation.ts +10 -2
  44. package/src/worker.ts +6 -0
  45. package/wrangler-dist/cli.d.ts +15 -0
  46. package/wrangler-dist/cli.js +2045 -636
@@ -540,6 +540,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
540
540
  r2_buckets: config.r2_buckets,
541
541
  d1_databases: identifyD1BindingsAsBeta(config.d1_databases),
542
542
  services: config.services,
543
+ analytics_engine_datasets: config.analytics_engine_datasets,
543
544
  dispatch_namespaces: config.dispatch_namespaces,
544
545
  logfwdr: config.logfwdr,
545
546
  unsafe: config.unsafe?.bindings,
@@ -108,6 +108,7 @@ export const secret = (secretYargs: Argv<CommonYargsOptions>) => {
108
108
  r2_buckets: [],
109
109
  d1_databases: [],
110
110
  services: [],
111
+ analytics_engine_datasets: [],
111
112
  wasm_modules: {},
112
113
  text_blobs: {},
113
114
  data_blobs: {},
@@ -59,6 +59,14 @@ export async function generateTypes(
59
59
  }
60
60
  }
61
61
 
62
+ if (configToDTS.analytics_engine_datasets) {
63
+ for (const analyticsEngine of configToDTS.analytics_engine_datasets) {
64
+ envTypeStructure.push(
65
+ `${analyticsEngine.binding}: AnalyticsEngineDataset;`
66
+ );
67
+ }
68
+ }
69
+
62
70
  if (configToDTS.dispatch_namespaces) {
63
71
  for (const namespace of configToDTS.dispatch_namespaces) {
64
72
  envTypeStructure.push(`${namespace.binding}: any;`);
@@ -156,11 +164,11 @@ function writeDTSFile({
156
164
  if (formatType === "modules") {
157
165
  combinedTypeStrings += `interface Env {\n${envTypeStructure
158
166
  .map((value) => `\t${value}`)
159
- .join("\n")} \n}\n${modulesTypeStructure.join("\n")}`;
167
+ .join("\n")}\n}\n${modulesTypeStructure.join("\n")}`;
160
168
  } else {
161
169
  combinedTypeStrings += `export {};\ndeclare global {\n${envTypeStructure
162
170
  .map((value) => `\tconst ${value}`)
163
- .join("\n")} \n}\n${modulesTypeStructure.join("\n")}`;
171
+ .join("\n")}\n}\n${modulesTypeStructure.join("\n")}`;
164
172
  }
165
173
 
166
174
  if (envTypeStructure.length || modulesTypeStructure.length) {
package/src/worker.ts CHANGED
@@ -144,6 +144,11 @@ interface CfService {
144
144
  environment?: string;
145
145
  }
146
146
 
147
+ interface CfAnalyticsEngineDataset {
148
+ binding: string;
149
+ dataset?: string;
150
+ }
151
+
147
152
  interface CfDispatchNamespace {
148
153
  binding: string;
149
154
  namespace: string;
@@ -207,6 +212,7 @@ export interface CfWorkerInit {
207
212
  r2_buckets: CfR2Bucket[] | undefined;
208
213
  d1_databases: CfD1Database[] | undefined;
209
214
  services: CfService[] | undefined;
215
+ analytics_engine_datasets: CfAnalyticsEngineDataset[] | undefined;
210
216
  dispatch_namespaces: CfDispatchNamespace[] | undefined;
211
217
  logfwdr: CfLogfwdr | undefined;
212
218
  unsafe: CfUnsafeBinding[] | undefined;
@@ -527,6 +527,21 @@ declare interface EnvironmentNonInheritable {
527
527
  /** The environment of the service (e.g. production, staging, etc). */
528
528
  environment?: string;
529
529
  }[] | undefined;
530
+ /**
531
+ * Specifies analytics engine datasets that are bound to this Worker environment.
532
+ *
533
+ * NOTE: This field is not automatically inherited from the top level environment,
534
+ * and so must be specified in every named environment.
535
+ *
536
+ * @default `[]`
537
+ * @nonInheritable
538
+ */
539
+ analytics_engine_datasets: {
540
+ /** The binding name used to refer to the dataset in the worker. */
541
+ binding: string;
542
+ /** The name of this dataset to write to. */
543
+ dataset?: string;
544
+ }[];
530
545
  /**
531
546
  * "Unsafe" tables for features that aren't directly supported by wrangler.
532
547
  *