wrangler 2.0.18 → 2.0.22
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/bin/wrangler.js +36 -5
- package/package.json +2 -2
- package/src/__tests__/configuration.test.ts +11 -7
- package/src/__tests__/dev.test.tsx +44 -0
- package/src/__tests__/helpers/run-in-tmp.ts +2 -2
- package/src/__tests__/metrics.test.ts +445 -0
- package/src/__tests__/test-old-node-version.js +31 -0
- package/src/config/config.ts +8 -0
- package/src/config/validation.ts +9 -0
- package/src/config-cache.ts +2 -1
- package/src/dev/dev.tsx +28 -18
- package/src/dev/local.tsx +7 -4
- package/src/dev/remote.tsx +5 -1
- package/src/dev.tsx +7 -1
- package/src/index.tsx +73 -0
- package/src/metrics/index.ts +4 -0
- package/src/metrics/is-ci.ts +14 -0
- package/src/metrics/metrics-config.ts +239 -0
- package/src/metrics/metrics-dispatcher.ts +95 -0
- package/src/metrics/send-event.ts +92 -0
- package/src/pages/build.tsx +2 -0
- package/src/pages/deployments.tsx +6 -1
- package/src/pages/dev.tsx +4 -0
- package/src/pages/projects.tsx +7 -1
- package/src/pages/publish.tsx +3 -0
- package/src/pages/upload.tsx +2 -2
- package/src/pubsub/pubsub-commands.tsx +46 -0
- package/src/user/user.tsx +2 -1
- package/src/whoami.tsx +2 -1
- package/src/worker-namespace.ts +16 -0
- package/wrangler-dist/cli.js +1619 -1002
|
@@ -3,6 +3,7 @@ import { readConfig } from "../config";
|
|
|
3
3
|
import { confirm } from "../dialogs";
|
|
4
4
|
import { CommandLineArgsError } from "../index";
|
|
5
5
|
import { logger } from "../logger";
|
|
6
|
+
import * as metrics from "../metrics";
|
|
6
7
|
import { parseHumanDuration } from "../parse";
|
|
7
8
|
import { requireAuth } from "../user";
|
|
8
9
|
import * as pubsub from ".";
|
|
@@ -50,6 +51,9 @@ export function pubSubCommands(
|
|
|
50
51
|
logger.log(`Creating Pub/SubNamespace ${args.name}...`);
|
|
51
52
|
await pubsub.createPubSubNamespace(accountId, namespace);
|
|
52
53
|
logger.log(`Success! Created Pub/Sub Namespace ${args.name}`);
|
|
54
|
+
await metrics.sendMetricsEvent("create pubsub namespace", {
|
|
55
|
+
sendMetrics: config.send_metrics,
|
|
56
|
+
});
|
|
53
57
|
}
|
|
54
58
|
)
|
|
55
59
|
.command(
|
|
@@ -63,6 +67,9 @@ export function pubSubCommands(
|
|
|
63
67
|
const accountId = await requireAuth(config);
|
|
64
68
|
|
|
65
69
|
logger.log(await pubsub.listPubSubNamespaces(accountId));
|
|
70
|
+
await metrics.sendMetricsEvent("list pubsub namespaces", {
|
|
71
|
+
sendMetrics: config.send_metrics,
|
|
72
|
+
});
|
|
66
73
|
}
|
|
67
74
|
)
|
|
68
75
|
.command(
|
|
@@ -89,6 +96,9 @@ export function pubSubCommands(
|
|
|
89
96
|
logger.log(`Deleting namespace ${args.name}...`);
|
|
90
97
|
await pubsub.deletePubSubNamespace(accountId, args.name);
|
|
91
98
|
logger.log(`Deleted namespace ${args.name}.`);
|
|
99
|
+
await metrics.sendMetricsEvent("delete pubsub namespace", {
|
|
100
|
+
sendMetrics: config.send_metrics,
|
|
101
|
+
});
|
|
92
102
|
}
|
|
93
103
|
}
|
|
94
104
|
)
|
|
@@ -111,6 +121,9 @@ export function pubSubCommands(
|
|
|
111
121
|
logger.log(
|
|
112
122
|
await pubsub.describePubSubNamespace(accountId, args.name)
|
|
113
123
|
);
|
|
124
|
+
await metrics.sendMetricsEvent("view pubsub namespace", {
|
|
125
|
+
sendMetrics: config.send_metrics,
|
|
126
|
+
});
|
|
114
127
|
}
|
|
115
128
|
)
|
|
116
129
|
.epilogue(pubsub.pubSubBetaWarning);
|
|
@@ -178,6 +191,9 @@ export function pubSubCommands(
|
|
|
178
191
|
logger.log(
|
|
179
192
|
await pubsub.createPubSubBroker(accountId, args.namespace, broker)
|
|
180
193
|
);
|
|
194
|
+
await metrics.sendMetricsEvent("create pubsub broker", {
|
|
195
|
+
sendMetrics: config.send_metrics,
|
|
196
|
+
});
|
|
181
197
|
}
|
|
182
198
|
);
|
|
183
199
|
|
|
@@ -247,6 +263,9 @@ export function pubSubCommands(
|
|
|
247
263
|
)
|
|
248
264
|
);
|
|
249
265
|
logger.log(`Successfully updated Pub/Sub Broker ${args.name}`);
|
|
266
|
+
await metrics.sendMetricsEvent("update pubsub broker", {
|
|
267
|
+
sendMetrics: config.send_metrics,
|
|
268
|
+
});
|
|
250
269
|
}
|
|
251
270
|
);
|
|
252
271
|
|
|
@@ -268,6 +287,9 @@ export function pubSubCommands(
|
|
|
268
287
|
const accountId = await requireAuth(config);
|
|
269
288
|
|
|
270
289
|
logger.log(await pubsub.listPubSubBrokers(accountId, args.namespace));
|
|
290
|
+
await metrics.sendMetricsEvent("list pubsub brokers", {
|
|
291
|
+
sendMetrics: config.send_metrics,
|
|
292
|
+
});
|
|
271
293
|
}
|
|
272
294
|
);
|
|
273
295
|
|
|
@@ -306,6 +328,9 @@ export function pubSubCommands(
|
|
|
306
328
|
args.name
|
|
307
329
|
);
|
|
308
330
|
logger.log(`Deleted Pub/Sub Broker ${args.name}.`);
|
|
331
|
+
await metrics.sendMetricsEvent("delete pubsub broker", {
|
|
332
|
+
sendMetrics: config.send_metrics,
|
|
333
|
+
});
|
|
309
334
|
}
|
|
310
335
|
}
|
|
311
336
|
)
|
|
@@ -338,6 +363,9 @@ export function pubSubCommands(
|
|
|
338
363
|
args.name
|
|
339
364
|
)
|
|
340
365
|
);
|
|
366
|
+
await metrics.sendMetricsEvent("view pubsub broker", {
|
|
367
|
+
sendMetrics: config.send_metrics,
|
|
368
|
+
});
|
|
341
369
|
}
|
|
342
370
|
);
|
|
343
371
|
|
|
@@ -413,6 +441,9 @@ export function pubSubCommands(
|
|
|
413
441
|
parsedExpiration
|
|
414
442
|
)
|
|
415
443
|
);
|
|
444
|
+
await metrics.sendMetricsEvent("issue pubsub broker credentials", {
|
|
445
|
+
sendMetrics: config.send_metrics,
|
|
446
|
+
});
|
|
416
447
|
}
|
|
417
448
|
);
|
|
418
449
|
|
|
@@ -458,6 +489,9 @@ export function pubSubCommands(
|
|
|
458
489
|
);
|
|
459
490
|
|
|
460
491
|
logger.log(`Revoked ${args.jti.length} credential(s).`);
|
|
492
|
+
await metrics.sendMetricsEvent("revoke pubsub broker credentials", {
|
|
493
|
+
sendMetrics: config.send_metrics,
|
|
494
|
+
});
|
|
461
495
|
}
|
|
462
496
|
);
|
|
463
497
|
|
|
@@ -502,6 +536,9 @@ export function pubSubCommands(
|
|
|
502
536
|
);
|
|
503
537
|
|
|
504
538
|
logger.log(`Unrevoked ${numTokens} credential(s)`);
|
|
539
|
+
await metrics.sendMetricsEvent("unrevoke pubsub broker credentials", {
|
|
540
|
+
sendMetrics: config.send_metrics,
|
|
541
|
+
});
|
|
505
542
|
}
|
|
506
543
|
);
|
|
507
544
|
|
|
@@ -535,6 +572,12 @@ export function pubSubCommands(
|
|
|
535
572
|
args.name
|
|
536
573
|
)
|
|
537
574
|
);
|
|
575
|
+
await metrics.sendMetricsEvent(
|
|
576
|
+
"list pubsub broker revoked credentials",
|
|
577
|
+
{
|
|
578
|
+
sendMetrics: config.send_metrics,
|
|
579
|
+
}
|
|
580
|
+
);
|
|
538
581
|
}
|
|
539
582
|
);
|
|
540
583
|
|
|
@@ -567,6 +610,9 @@ export function pubSubCommands(
|
|
|
567
610
|
args.name
|
|
568
611
|
)
|
|
569
612
|
);
|
|
613
|
+
await metrics.sendMetricsEvent("list pubsub broker public-keys", {
|
|
614
|
+
sendMetrics: config.send_metrics,
|
|
615
|
+
});
|
|
570
616
|
}
|
|
571
617
|
);
|
|
572
618
|
|
package/src/user/user.tsx
CHANGED
|
@@ -1058,7 +1058,8 @@ export function listScopes(message = "💁 Available scopes:"): void {
|
|
|
1058
1058
|
Scope: scope,
|
|
1059
1059
|
Description: Scopes[scope],
|
|
1060
1060
|
}));
|
|
1061
|
-
render(<Table data={data} />);
|
|
1061
|
+
const { unmount } = render(<Table data={data} />);
|
|
1062
|
+
unmount();
|
|
1062
1063
|
// TODO: maybe a good idea to show usage here
|
|
1063
1064
|
}
|
|
1064
1065
|
|
package/src/whoami.tsx
CHANGED
|
@@ -8,7 +8,8 @@ import { getAPIToken, getAuthFromEnv } from "./user";
|
|
|
8
8
|
export async function whoami() {
|
|
9
9
|
logger.log("Getting User settings...");
|
|
10
10
|
const user = await getUserInfo();
|
|
11
|
-
render(<WhoAmI user={user}></WhoAmI>);
|
|
11
|
+
const { unmount } = render(<WhoAmI user={user}></WhoAmI>);
|
|
12
|
+
unmount();
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export function WhoAmI({ user }: { user: UserInfo | undefined }) {
|
package/src/worker-namespace.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { fetchResult } from "./cfetch";
|
|
2
2
|
import { readConfig } from "./config";
|
|
3
3
|
import { logger } from "./logger";
|
|
4
|
+
import * as metrics from "./metrics";
|
|
4
5
|
import { requireAuth } from "./user";
|
|
5
6
|
import { printWranglerBanner } from ".";
|
|
6
7
|
import type { ConfigPath } from ".";
|
|
@@ -113,6 +114,9 @@ export function workerNamespaceCommands(
|
|
|
113
114
|
const config = readConfig(args.config as ConfigPath, args);
|
|
114
115
|
const accountId = await requireAuth(config);
|
|
115
116
|
await listWorkerNamespaces(accountId);
|
|
117
|
+
await metrics.sendMetricsEvent("list worker namespaces", {
|
|
118
|
+
sendMetrics: config.send_metrics,
|
|
119
|
+
});
|
|
116
120
|
})
|
|
117
121
|
.command(
|
|
118
122
|
"get <name>",
|
|
@@ -128,6 +132,9 @@ export function workerNamespaceCommands(
|
|
|
128
132
|
const config = readConfig(args.config as ConfigPath, args);
|
|
129
133
|
const accountId = await requireAuth(config);
|
|
130
134
|
await getWorkerNamespaceInfo(accountId, args.name);
|
|
135
|
+
await metrics.sendMetricsEvent("view worker namespace", {
|
|
136
|
+
sendMetrics: config.send_metrics,
|
|
137
|
+
});
|
|
131
138
|
}
|
|
132
139
|
)
|
|
133
140
|
.command(
|
|
@@ -145,6 +152,9 @@ export function workerNamespaceCommands(
|
|
|
145
152
|
const config = readConfig(args.config as ConfigPath, args);
|
|
146
153
|
const accountId = await requireAuth(config);
|
|
147
154
|
await createWorkerNamespace(accountId, args.name);
|
|
155
|
+
await metrics.sendMetricsEvent("create worker namespace", {
|
|
156
|
+
sendMetrics: config.send_metrics,
|
|
157
|
+
});
|
|
148
158
|
}
|
|
149
159
|
)
|
|
150
160
|
.command(
|
|
@@ -162,6 +172,9 @@ export function workerNamespaceCommands(
|
|
|
162
172
|
const config = readConfig(args.config as ConfigPath, args);
|
|
163
173
|
const accountId = await requireAuth(config);
|
|
164
174
|
await deleteWorkerNamespace(accountId, args.name);
|
|
175
|
+
await metrics.sendMetricsEvent("delete worker namespace", {
|
|
176
|
+
sendMetrics: config.send_metrics,
|
|
177
|
+
});
|
|
165
178
|
}
|
|
166
179
|
)
|
|
167
180
|
.command(
|
|
@@ -185,6 +198,9 @@ export function workerNamespaceCommands(
|
|
|
185
198
|
const config = readConfig(args.config as ConfigPath, args);
|
|
186
199
|
const accountId = await requireAuth(config);
|
|
187
200
|
await renameWorkerNamespace(accountId, args.oldName, args.newName);
|
|
201
|
+
await metrics.sendMetricsEvent("rename worker namespace", {
|
|
202
|
+
sendMetrics: config.send_metrics,
|
|
203
|
+
});
|
|
188
204
|
}
|
|
189
205
|
);
|
|
190
206
|
}
|