wrangler 0.0.0-ea7ee45 → 0.0.0-eab9542

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.
@@ -18,7 +18,7 @@ export function pubSubCommands(
18
18
  "namespace",
19
19
  "Manage your Pub/Sub Namespaces",
20
20
  (pubsubNamespaceYargs) => {
21
- pubsubNamespaceYargs
21
+ return pubsubNamespaceYargs
22
22
  .command(
23
23
  "create <name>",
24
24
  "Create a new Pub/Sub Namespace",
@@ -33,7 +33,8 @@ export function pubSubCommands(
33
33
  .option("description", {
34
34
  describe: "Textual description of Namespace",
35
35
  type: "string",
36
- });
36
+ })
37
+ .epilogue(pubsub.pubSubBetaWarning);
37
38
  },
38
39
  async (args) => {
39
40
  const config = readConfig(args.config as ConfigPath, args);
@@ -51,13 +52,12 @@ export function pubSubCommands(
51
52
  logger.log(`Success! Created Pub/Sub Namespace ${args.name}`);
52
53
  }
53
54
  )
54
- .epilogue(pubsub.pubSubBetaWarning);
55
-
56
- pubsubNamespaceYargs
57
55
  .command(
58
56
  "list",
59
57
  "List your existing Pub/Sub Namespaces",
60
- {},
58
+ (yargs) => {
59
+ return yargs.epilogue(pubsub.pubSubBetaWarning);
60
+ },
61
61
  async (args) => {
62
62
  const config = readConfig(args.config as ConfigPath, args);
63
63
  const accountId = await requireAuth(config);
@@ -65,18 +65,17 @@ export function pubSubCommands(
65
65
  logger.log(await pubsub.listPubSubNamespaces(accountId));
66
66
  }
67
67
  )
68
- .epilogue(pubsub.pubSubBetaWarning);
69
-
70
- pubsubNamespaceYargs
71
68
  .command(
72
69
  "delete <name>",
73
70
  "Delete a Pub/Sub Namespace",
74
71
  (yargs) => {
75
- return yargs.positional("name", {
76
- describe: "The name of the namespace to delete",
77
- type: "string",
78
- demandOption: true,
79
- });
72
+ return yargs
73
+ .positional("name", {
74
+ describe: "The name of the namespace to delete",
75
+ type: "string",
76
+ demandOption: true,
77
+ })
78
+ .epilogue(pubsub.pubSubBetaWarning);
80
79
  },
81
80
  async (args) => {
82
81
  const config = readConfig(args.config as ConfigPath, args);
@@ -93,18 +92,17 @@ export function pubSubCommands(
93
92
  }
94
93
  }
95
94
  )
96
- .epilogue(pubsub.pubSubBetaWarning);
97
-
98
- pubsubNamespaceYargs
99
95
  .command(
100
96
  "describe <name>",
101
97
  "Describe a Pub/Sub Namespace",
102
98
  (yargs) => {
103
- return yargs.positional("name", {
104
- describe: "The name of the namespace to describe.",
105
- type: "string",
106
- demandOption: true,
107
- });
99
+ return yargs
100
+ .positional("name", {
101
+ describe: "The name of the namespace to describe.",
102
+ type: "string",
103
+ demandOption: true,
104
+ })
105
+ .epilogue(pubsub.pubSubBetaWarning);
108
106
  },
109
107
  async (args) => {
110
108
  const config = readConfig(args.config as ConfigPath, args);
@@ -116,168 +114,162 @@ export function pubSubCommands(
116
114
  }
117
115
  )
118
116
  .epilogue(pubsub.pubSubBetaWarning);
119
-
120
- return pubsubNamespaceYargs;
121
117
  }
122
118
  )
123
119
  .command("broker", "Interact with your Pub/Sub Brokers", (brokersYargs) => {
124
- brokersYargs
125
- .command(
126
- "create <name>",
127
- "Create a new Pub/Sub Broker",
128
- (yargs) =>
129
- yargs
130
- .positional("name", {
131
- describe:
132
- "The name of the Pub/Sub Broker. This name will form part of the public endpoint, in the form <broker>.<namespace>.cloudflarepubsub.com",
133
- type: "string",
134
- demandOption: true,
135
- })
136
- .option("namespace", {
137
- describe:
138
- "An existing Namespace to associate the Broker with. This name will form part of the public endpoint, in the form <broker>.<namespace>.cloudflarepubsub.com",
139
- type: "string",
140
- alias: "ns",
141
- demandOption: true,
142
- })
143
- .option("description", {
144
- describe: "Longer description for the broker",
145
- type: "string",
146
- })
147
- .option("expiration", {
148
- describe:
149
- "Time to allow token validity (can use seconds, hours, months, weeks, years)",
150
- type: "string",
151
- })
152
- .option("on-publish-url", {
153
- describe:
154
- "A (HTTPS) Cloudflare Worker (or webhook) URL that messages will be sent to on-publish.",
155
- type: "string",
156
- }),
157
- async (args) => {
158
- const config = readConfig(args.config as ConfigPath, args);
159
- const accountId = await requireAuth(config);
160
-
161
- const broker: pubsub.PubSubBroker = {
162
- name: args.name,
163
- };
164
- if (args.description) {
165
- broker.description = args.description;
166
- }
167
- if (args.expiration) {
168
- const expiration = parseHumanDuration(args.expiration);
169
- if (isNaN(expiration)) {
170
- throw new CommandLineArgsError(
171
- `${args.expiration} is not a time duration. (Example of valid values are: 1y, 6 days)`
172
- );
173
- }
174
- broker.expiration = expiration;
175
- }
176
- if (args["on-publish-url"]) {
177
- broker.on_publish = {
178
- url: args["on-publish-url"],
179
- };
120
+ brokersYargs.command(
121
+ "create <name>",
122
+ "Create a new Pub/Sub Broker",
123
+ (yargs) =>
124
+ yargs
125
+ .positional("name", {
126
+ describe:
127
+ "The name of the Pub/Sub Broker. This name will form part of the public endpoint, in the form <broker>.<namespace>.cloudflarepubsub.com",
128
+ type: "string",
129
+ demandOption: true,
130
+ })
131
+ .option("namespace", {
132
+ describe:
133
+ "An existing Namespace to associate the Broker with. This name will form part of the public endpoint, in the form <broker>.<namespace>.cloudflarepubsub.com",
134
+ type: "string",
135
+ alias: "ns",
136
+ demandOption: true,
137
+ })
138
+ .option("description", {
139
+ describe: "Longer description for the broker",
140
+ type: "string",
141
+ })
142
+ .option("expiration", {
143
+ describe:
144
+ "Time to allow token validity (can use seconds, hours, months, weeks, years)",
145
+ type: "string",
146
+ })
147
+ .option("on-publish-url", {
148
+ describe:
149
+ "A (HTTPS) Cloudflare Worker (or webhook) URL that messages will be sent to on-publish.",
150
+ type: "string",
151
+ })
152
+ .epilogue(pubsub.pubSubBetaWarning),
153
+ async (args) => {
154
+ const config = readConfig(args.config as ConfigPath, args);
155
+ const accountId = await requireAuth(config);
156
+
157
+ const broker: pubsub.PubSubBroker = {
158
+ name: args.name,
159
+ };
160
+ if (args.description) {
161
+ broker.description = args.description;
162
+ }
163
+ if (args.expiration) {
164
+ const expiration = parseHumanDuration(args.expiration);
165
+ if (isNaN(expiration)) {
166
+ throw new CommandLineArgsError(
167
+ `${args.expiration} is not a time duration. (Example of valid values are: 1y, 6 days)`
168
+ );
180
169
  }
181
-
182
- logger.log(
183
- await pubsub.createPubSubBroker(accountId, args.namespace, broker)
184
- );
170
+ broker.expiration = expiration;
171
+ }
172
+ if (args["on-publish-url"]) {
173
+ broker.on_publish = {
174
+ url: args["on-publish-url"],
175
+ };
185
176
  }
186
- )
187
- .epilogue(pubsub.pubSubBetaWarning);
188
-
189
- brokersYargs
190
- .command(
191
- "update <name>",
192
- "Update an existing Pub/Sub Broker's configuration.",
193
- (yargs) =>
194
- yargs
195
- .positional("name", {
196
- describe: "The name of an existing Pub/Sub Broker",
197
- type: "string",
198
- demandOption: true,
199
- })
200
- .option("namespace", {
201
- describe: "The Namespace the Broker is associated with",
202
- type: "string",
203
- alias: "ns",
204
- demandOption: true,
205
- })
206
- .option("description", {
207
- describe: "A optional description of the Broker.",
208
- type: "string",
209
- })
210
- .option("expiration", {
211
- describe:
212
- "The expiration date for all client credentials issued by the Broker (can use seconds, hours, months, weeks, years)",
213
- type: "string",
214
- })
215
- .option("on-publish-url", {
216
- describe:
217
- "A (HTTPS) Cloudflare Worker (or webhook) URL that messages will be sent to on-publish.",
218
- type: "string",
219
- }),
220
- async (args) => {
221
- const config = readConfig(args.config as ConfigPath, args);
222
- const accountId = await requireAuth(config);
223
177
 
224
- const broker: pubsub.PubSubBrokerUpdate = {};
178
+ logger.log(
179
+ await pubsub.createPubSubBroker(accountId, args.namespace, broker)
180
+ );
181
+ }
182
+ );
183
+
184
+ brokersYargs.command(
185
+ "update <name>",
186
+ "Update an existing Pub/Sub Broker's configuration.",
187
+ (yargs) =>
188
+ yargs
189
+ .positional("name", {
190
+ describe: "The name of an existing Pub/Sub Broker",
191
+ type: "string",
192
+ demandOption: true,
193
+ })
194
+ .option("namespace", {
195
+ describe: "The Namespace the Broker is associated with",
196
+ type: "string",
197
+ alias: "ns",
198
+ demandOption: true,
199
+ })
200
+ .option("description", {
201
+ describe: "A optional description of the Broker.",
202
+ type: "string",
203
+ })
204
+ .option("expiration", {
205
+ describe:
206
+ "The expiration date for all client credentials issued by the Broker (can use seconds, hours, months, weeks, years)",
207
+ type: "string",
208
+ })
209
+ .option("on-publish-url", {
210
+ describe:
211
+ "A (HTTPS) Cloudflare Worker (or webhook) URL that messages will be sent to on-publish.",
212
+ type: "string",
213
+ })
214
+ .epilogue(pubsub.pubSubBetaWarning),
215
+ async (args) => {
216
+ const config = readConfig(args.config as ConfigPath, args);
217
+ const accountId = await requireAuth(config);
225
218
 
226
- if (args.description) {
227
- broker.description = args.description;
228
- }
219
+ const broker: pubsub.PubSubBrokerUpdate = {};
229
220
 
230
- if (args.expiration) {
231
- const expiration = parseHumanDuration(args.expiration);
232
- if (isNaN(expiration)) {
233
- throw new CommandLineArgsError(
234
- `${args.expiration} is not a time duration. Examples of valid values include: '1y', '24h', or '6 days'.`
235
- );
236
- }
237
- broker.expiration = expiration;
238
- }
221
+ if (args.description) {
222
+ broker.description = args.description;
223
+ }
239
224
 
240
- if (args["on-publish-url"]) {
241
- broker.on_publish = {
242
- url: args["on-publish-url"],
243
- };
225
+ if (args.expiration) {
226
+ const expiration = parseHumanDuration(args.expiration);
227
+ if (isNaN(expiration)) {
228
+ throw new CommandLineArgsError(
229
+ `${args.expiration} is not a time duration. Examples of valid values include: '1y', '24h', or '6 days'.`
230
+ );
244
231
  }
232
+ broker.expiration = expiration;
233
+ }
245
234
 
246
- logger.log(
247
- await pubsub.updatePubSubBroker(
248
- accountId,
249
- args.namespace,
250
- args.name,
251
- broker
252
- )
253
- );
254
- logger.log(`Successfully updated Pub/Sub Broker ${args.name}`);
235
+ if (args["on-publish-url"]) {
236
+ broker.on_publish = {
237
+ url: args["on-publish-url"],
238
+ };
255
239
  }
256
- )
257
- .epilogue(pubsub.pubSubBetaWarning);
258
240
 
259
- brokersYargs
260
- .command(
261
- "list",
262
- "List the Pub/Sub Brokers within a Namespace",
263
- (yargs) => {
264
- return yargs.option("namespace", {
241
+ logger.log(
242
+ await pubsub.updatePubSubBroker(
243
+ accountId,
244
+ args.namespace,
245
+ args.name,
246
+ broker
247
+ )
248
+ );
249
+ logger.log(`Successfully updated Pub/Sub Broker ${args.name}`);
250
+ }
251
+ );
252
+
253
+ brokersYargs.command(
254
+ "list",
255
+ "List the Pub/Sub Brokers within a Namespace",
256
+ (yargs) => {
257
+ return yargs
258
+ .option("namespace", {
265
259
  describe: "The Namespace the Brokers are associated with.",
266
260
  type: "string",
267
261
  alias: "ns",
268
262
  demandOption: true,
269
- });
270
- },
271
- async (args) => {
272
- const config = readConfig(args.config as ConfigPath, args);
273
- const accountId = await requireAuth(config);
263
+ })
264
+ .epilogue(pubsub.pubSubBetaWarning);
265
+ },
266
+ async (args) => {
267
+ const config = readConfig(args.config as ConfigPath, args);
268
+ const accountId = await requireAuth(config);
274
269
 
275
- logger.log(
276
- await pubsub.listPubSubBrokers(accountId, args.namespace)
277
- );
278
- }
279
- )
280
- .epilogue(pubsub.pubSubBetaWarning);
270
+ logger.log(await pubsub.listPubSubBrokers(accountId, args.namespace));
271
+ }
272
+ );
281
273
 
282
274
  brokersYargs
283
275
  .command(
@@ -295,7 +287,8 @@ export function pubSubCommands(
295
287
  type: "string",
296
288
  alias: "ns",
297
289
  demandOption: true,
298
- });
290
+ })
291
+ .epilogue(pubsub.pubSubBetaWarning);
299
292
  },
300
293
  async (args) => {
301
294
  const config = readConfig(args.config as ConfigPath, args);
@@ -316,9 +309,6 @@ export function pubSubCommands(
316
309
  }
317
310
  }
318
311
  )
319
- .epilogue(pubsub.pubSubBetaWarning);
320
-
321
- brokersYargs
322
312
  .command(
323
313
  "describe <name>",
324
314
  "Describe an existing Pub/Sub Broker.",
@@ -334,7 +324,8 @@ export function pubSubCommands(
334
324
  type: "string",
335
325
  alias: "ns",
336
326
  demandOption: true,
337
- });
327
+ })
328
+ .epilogue(pubsub.pubSubBetaWarning);
338
329
  },
339
330
  async (args) => {
340
331
  const config = readConfig(args.config as ConfigPath, args);
@@ -348,247 +339,239 @@ export function pubSubCommands(
348
339
  )
349
340
  );
350
341
  }
351
- )
352
- .epilogue(pubsub.pubSubBetaWarning);
353
-
354
- brokersYargs
355
- .command(
356
- "issue <name>",
357
- "Issue new client credentials for a specific Pub/Sub Broker.",
358
- (yargs) => {
359
- return yargs
360
- .positional("name", {
361
- describe: "The name of the Broker to issue credentials for.",
362
- type: "string",
363
- demandOption: true,
364
- })
365
- .option("namespace", {
366
- describe: "The Namespace the Broker is associated with.",
367
- type: "string",
368
- alias: "ns",
369
- demandOption: true,
370
- })
371
- .option("number", {
372
- describe: "The number of credentials to generate.",
373
- type: "number",
374
- alias: "n",
375
- default: 1,
376
- })
377
- .option("type", {
378
- describe: "The type of credential to generate.",
379
- type: "string",
380
- default: "TOKEN",
381
- })
382
- .option("expiration", {
383
- describe:
384
- "The expiration to set on the issued credentials. This overrides any Broker-level expiration that is set.",
385
- type: "string",
386
- alias: "exp",
387
- })
388
- .option("client-id", {
389
- describe:
390
- "A list of existing clientIds to generate tokens for. By default, clientIds are randomly generated.",
391
- type: "string",
392
- alias: "jti",
393
- array: true,
394
- });
395
- },
396
- async (args) => {
397
- const config = readConfig(args.config as ConfigPath, args);
398
- const accountId = await requireAuth(config);
399
-
400
- let parsedExpiration: number | undefined;
401
- if (args.expiration) {
402
- const expiration = parseHumanDuration(args.expiration);
403
- if (isNaN(expiration)) {
404
- throw new CommandLineArgsError(
405
- `${args.expiration} is not a time duration. Example of valid values are: 1y, 6 days.`
406
- );
407
- }
408
- parsedExpiration = expiration;
342
+ );
343
+
344
+ brokersYargs.command(
345
+ "issue <name>",
346
+ "Issue new client credentials for a specific Pub/Sub Broker.",
347
+ (yargs) => {
348
+ return yargs
349
+ .positional("name", {
350
+ describe: "The name of the Broker to issue credentials for.",
351
+ type: "string",
352
+ demandOption: true,
353
+ })
354
+ .option("namespace", {
355
+ describe: "The Namespace the Broker is associated with.",
356
+ type: "string",
357
+ alias: "ns",
358
+ demandOption: true,
359
+ })
360
+ .option("number", {
361
+ describe: "The number of credentials to generate.",
362
+ type: "number",
363
+ alias: "n",
364
+ default: 1,
365
+ })
366
+ .option("type", {
367
+ describe: "The type of credential to generate.",
368
+ type: "string",
369
+ default: "TOKEN",
370
+ })
371
+ .option("expiration", {
372
+ describe:
373
+ "The expiration to set on the issued credentials. This overrides any Broker-level expiration that is set.",
374
+ type: "string",
375
+ alias: "exp",
376
+ })
377
+ .option("client-id", {
378
+ describe:
379
+ "A list of existing clientIds to generate tokens for. By default, clientIds are randomly generated.",
380
+ type: "string",
381
+ alias: "jti",
382
+ array: true,
383
+ })
384
+ .epilogue(pubsub.pubSubBetaWarning);
385
+ },
386
+ async (args) => {
387
+ const config = readConfig(args.config as ConfigPath, args);
388
+ const accountId = await requireAuth(config);
389
+
390
+ let parsedExpiration: number | undefined;
391
+ if (args.expiration) {
392
+ const expiration = parseHumanDuration(args.expiration);
393
+ if (isNaN(expiration)) {
394
+ throw new CommandLineArgsError(
395
+ `${args.expiration} is not a time duration. Example of valid values are: 1y, 6 days.`
396
+ );
409
397
  }
410
-
411
- logger.log(
412
- `🔑 Issuing credential(s) for ${args.name}.${args.namespace}...`
413
- );
414
-
415
- logger.log(
416
- await pubsub.issuePubSubBrokerTokens(
417
- accountId,
418
- args.namespace,
419
- args.name,
420
- args.number,
421
- args.type,
422
- args["client-id"],
423
- parsedExpiration
424
- )
425
- );
398
+ parsedExpiration = expiration;
426
399
  }
427
- )
428
- .epilogue(pubsub.pubSubBetaWarning);
429
-
430
- brokersYargs
431
- .command(
432
- "revoke <name>",
433
- "Revoke a set of active client credentials associated with the given Broker",
434
- (yargs) => {
435
- return yargs
436
- .positional("name", {
437
- describe:
438
- "The name of the Broker to revoke credentials against.",
439
- type: "string",
440
- demandOption: true,
441
- })
442
- .option("namespace", {
443
- describe: "The Namespace the Broker is associated with.",
444
- type: "string",
445
- alias: "ns",
446
- demandOption: true,
447
- })
448
- .option("jti", {
449
- describe: "Tokens to revoke",
450
- type: "string",
451
- demandOption: true,
452
- array: true,
453
- });
454
- },
455
- async (args) => {
456
- const config = readConfig(args.config as ConfigPath, args);
457
- const accountId = await requireAuth(config);
458
-
459
- const numTokens = args.jti.length;
460
400
 
461
- logger.log(
462
- `🔴 Revoking access to ${args.name} for ${numTokens} credential(s)...`
463
- );
401
+ logger.log(
402
+ `🔑 Issuing credential(s) for ${args.name}.${args.namespace}...`
403
+ );
464
404
 
465
- await pubsub.revokePubSubBrokerTokens(
405
+ logger.log(
406
+ await pubsub.issuePubSubBrokerTokens(
466
407
  accountId,
467
408
  args.namespace,
468
409
  args.name,
469
- args.jti
470
- );
471
-
472
- logger.log(`Revoked ${args.jti.length} credential(s).`);
473
- }
474
- )
475
- .epilogue(pubsub.pubSubBetaWarning);
476
-
477
- brokersYargs
478
- .command(
479
- "unrevoke <name>",
480
- "Restore access to a set of previously revoked client credentials.",
481
- (yargs) => {
482
- return yargs
483
- .positional("name", {
484
- describe:
485
- "The name of the Broker to revoke credentials against.",
486
- type: "string",
487
- demandOption: true,
488
- })
489
- .option("namespace", {
490
- describe: "The Namespace the Broker is associated with.",
491
- type: "string",
492
- alias: "ns",
493
- demandOption: true,
494
- })
495
- .option("jti", {
496
- describe: "Tokens to revoke",
497
- type: "string",
498
- demandOption: true,
499
- array: true,
500
- });
501
- },
502
- async (args) => {
503
- const config = readConfig(args.config as ConfigPath, args);
504
- const accountId = await requireAuth(config);
505
-
506
- const numTokens = args.jti.length;
507
- logger.log(
508
- `🟢 Restoring access to ${args.broker} for ${numTokens} credential(s)...`
509
- );
510
-
511
- await pubsub.unrevokePubSubBrokerTokens(
410
+ args.number,
411
+ args.type,
412
+ args["client-id"],
413
+ parsedExpiration
414
+ )
415
+ );
416
+ }
417
+ );
418
+
419
+ brokersYargs.command(
420
+ "revoke <name>",
421
+ "Revoke a set of active client credentials associated with the given Broker",
422
+ (yargs) => {
423
+ return yargs
424
+ .positional("name", {
425
+ describe: "The name of the Broker to revoke credentials against.",
426
+ type: "string",
427
+ demandOption: true,
428
+ })
429
+ .option("namespace", {
430
+ describe: "The Namespace the Broker is associated with.",
431
+ type: "string",
432
+ alias: "ns",
433
+ demandOption: true,
434
+ })
435
+ .option("jti", {
436
+ describe: "Tokens to revoke",
437
+ type: "string",
438
+ demandOption: true,
439
+ array: true,
440
+ })
441
+ .epilogue(pubsub.pubSubBetaWarning);
442
+ },
443
+ async (args) => {
444
+ const config = readConfig(args.config as ConfigPath, args);
445
+ const accountId = await requireAuth(config);
446
+
447
+ const numTokens = args.jti.length;
448
+
449
+ logger.log(
450
+ `🔴 Revoking access to ${args.name} for ${numTokens} credential(s)...`
451
+ );
452
+
453
+ await pubsub.revokePubSubBrokerTokens(
454
+ accountId,
455
+ args.namespace,
456
+ args.name,
457
+ args.jti
458
+ );
459
+
460
+ logger.log(`Revoked ${args.jti.length} credential(s).`);
461
+ }
462
+ );
463
+
464
+ brokersYargs.command(
465
+ "unrevoke <name>",
466
+ "Restore access to a set of previously revoked client credentials.",
467
+ (yargs) => {
468
+ return yargs
469
+ .positional("name", {
470
+ describe: "The name of the Broker to revoke credentials against.",
471
+ type: "string",
472
+ demandOption: true,
473
+ })
474
+ .option("namespace", {
475
+ describe: "The Namespace the Broker is associated with.",
476
+ type: "string",
477
+ alias: "ns",
478
+ demandOption: true,
479
+ })
480
+ .option("jti", {
481
+ describe: "Tokens to revoke",
482
+ type: "string",
483
+ demandOption: true,
484
+ array: true,
485
+ })
486
+ .epilogue(pubsub.pubSubBetaWarning);
487
+ },
488
+ async (args) => {
489
+ const config = readConfig(args.config as ConfigPath, args);
490
+ const accountId = await requireAuth(config);
491
+
492
+ const numTokens = args.jti.length;
493
+ logger.log(
494
+ `🟢 Restoring access to ${args.broker} for ${numTokens} credential(s)...`
495
+ );
496
+
497
+ await pubsub.unrevokePubSubBrokerTokens(
498
+ accountId,
499
+ args.namespace,
500
+ args.name,
501
+ args.jti
502
+ );
503
+
504
+ logger.log(`Unrevoked ${numTokens} credential(s)`);
505
+ }
506
+ );
507
+
508
+ brokersYargs.command(
509
+ "show-revocations <name>",
510
+ "Show all previously revoked client credentials.",
511
+ (yargs) => {
512
+ return yargs
513
+ .positional("name", {
514
+ describe: "The name of the Broker to revoke credentials against.",
515
+ type: "string",
516
+ demandOption: true,
517
+ })
518
+ .option("namespace", {
519
+ describe: "The Namespace the Broker is associated with.",
520
+ type: "string",
521
+ alias: "ns",
522
+ demandOption: true,
523
+ })
524
+ .epilogue(pubsub.pubSubBetaWarning);
525
+ },
526
+ async (args) => {
527
+ const config = readConfig(args.config as ConfigPath, args);
528
+ const accountId = await requireAuth(config);
529
+
530
+ logger.log(`Listing previously revoked tokens for ${args.name}...`);
531
+ logger.log(
532
+ await pubsub.listRevokedPubSubBrokerTokens(
512
533
  accountId,
513
534
  args.namespace,
514
- args.name,
515
- args.jti
516
- );
517
-
518
- logger.log(`Unrevoked ${numTokens} credential(s)`);
519
- }
520
- )
521
- .epilogue(pubsub.pubSubBetaWarning);
522
-
523
- brokersYargs
524
- .command(
525
- "show-revocations <name>",
526
- "Show all previously revoked client credentials.",
527
- (yargs) => {
528
- return yargs
529
- .positional("name", {
530
- describe:
531
- "The name of the Broker to revoke credentials against.",
532
- type: "string",
533
- demandOption: true,
534
- })
535
- .option("namespace", {
536
- describe: "The Namespace the Broker is associated with.",
537
- type: "string",
538
- alias: "ns",
539
- demandOption: true,
540
- });
541
- },
542
- async (args) => {
543
- const config = readConfig(args.config as ConfigPath, args);
544
- const accountId = await requireAuth(config);
545
-
546
- logger.log(`Listing previously revoked tokens for ${args.name}...`);
547
- logger.log(
548
- await pubsub.listRevokedPubSubBrokerTokens(
549
- accountId,
550
- args.namespace,
551
- args.name
552
- )
553
- );
554
- }
555
- )
556
- .epilogue(pubsub.pubSubBetaWarning);
557
-
558
- brokersYargs
559
- .command(
560
- "public-keys <name>",
561
- "Show the public keys used for verifying on-publish hooks and credentials for a Broker.",
562
- (yargs) => {
563
- return yargs
564
- .positional("name", {
565
- describe:
566
- "The name of the Broker to revoke credentials against.",
567
- type: "string",
568
- demandOption: true,
569
- })
570
- .option("namespace", {
571
- describe: "The Namespace the Broker is associated with.",
572
- type: "string",
573
- alias: "ns",
574
- demandOption: true,
575
- });
576
- },
577
- async (args) => {
578
- const config = readConfig(args.config as ConfigPath, args);
579
- const accountId = await requireAuth(config);
580
-
581
- logger.log(
582
- await pubsub.getPubSubBrokerPublicKeys(
583
- accountId,
584
- args.namespace,
585
- args.name
586
- )
587
- );
588
- }
589
- )
590
- .epilogue(pubsub.pubSubBetaWarning);
535
+ args.name
536
+ )
537
+ );
538
+ }
539
+ );
540
+
541
+ brokersYargs.command(
542
+ "public-keys <name>",
543
+ "Show the public keys used for verifying on-publish hooks and credentials for a Broker.",
544
+ (yargs) => {
545
+ return yargs
546
+ .positional("name", {
547
+ describe: "The name of the Broker to revoke credentials against.",
548
+ type: "string",
549
+ demandOption: true,
550
+ })
551
+ .option("namespace", {
552
+ describe: "The Namespace the Broker is associated with.",
553
+ type: "string",
554
+ alias: "ns",
555
+ demandOption: true,
556
+ })
557
+ .epilogue(pubsub.pubSubBetaWarning);
558
+ },
559
+ async (args) => {
560
+ const config = readConfig(args.config as ConfigPath, args);
561
+ const accountId = await requireAuth(config);
562
+
563
+ logger.log(
564
+ await pubsub.getPubSubBrokerPublicKeys(
565
+ accountId,
566
+ args.namespace,
567
+ args.name
568
+ )
569
+ );
570
+ }
571
+ );
591
572
 
573
+ brokersYargs.epilogue(pubsub.pubSubBetaWarning);
592
574
  return brokersYargs;
593
- });
575
+ })
576
+ .epilogue(pubsub.pubSubBetaWarning);
594
577
  }