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.
- package/bin/wrangler.js +6 -3
- package/miniflare-dist/index.mjs +1 -0
- package/package.json +1 -1
- package/src/__tests__/config-cache-without-cache-dir.test.ts +38 -0
- package/src/__tests__/config-cache.test.ts +6 -0
- package/src/__tests__/configuration.test.ts +117 -0
- package/src/__tests__/dev.test.tsx +1 -1
- package/src/__tests__/publish.test.ts +59 -3
- package/src/__tests__/pubsub.test.ts +91 -0
- package/src/api/dev.ts +16 -3
- package/src/cli.ts +1 -1
- package/src/config/environment.ts +23 -0
- package/src/config/index.ts +13 -0
- package/src/config/validation.ts +52 -0
- package/src/config-cache.ts +70 -31
- package/src/create-worker-upload-form.ts +9 -0
- package/src/dev/dev.tsx +2 -2
- package/src/dev/local.tsx +24 -22
- package/src/dev/remote.tsx +20 -5
- package/src/dev/use-esbuild.ts +6 -6
- package/src/dev.tsx +23 -11
- package/src/index.tsx +7 -7
- package/src/is-interactive.ts +12 -0
- package/src/miniflare-cli/index.ts +1 -0
- package/src/publish.ts +4 -3
- package/src/pubsub/pubsub-commands.tsx +386 -403
- package/src/user/choose-account.tsx +2 -2
- package/src/user/user.tsx +53 -22
- package/src/worker.ts +6 -0
- package/wrangler-dist/cli.js +15146 -15048
|
@@ -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
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
|
|
183
|
-
|
|
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
|
-
|
|
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
|
-
|
|
227
|
-
broker.description = args.description;
|
|
228
|
-
}
|
|
219
|
+
const broker: pubsub.PubSubBrokerUpdate = {};
|
|
229
220
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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
|
-
|
|
241
|
-
|
|
242
|
-
|
|
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
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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
|
-
|
|
276
|
-
|
|
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
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
.
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
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
|
-
|
|
462
|
-
|
|
463
|
-
|
|
401
|
+
logger.log(
|
|
402
|
+
`🔑 Issuing credential(s) for ${args.name}.${args.namespace}...`
|
|
403
|
+
);
|
|
464
404
|
|
|
465
|
-
|
|
405
|
+
logger.log(
|
|
406
|
+
await pubsub.issuePubSubBrokerTokens(
|
|
466
407
|
accountId,
|
|
467
408
|
args.namespace,
|
|
468
409
|
args.name,
|
|
469
|
-
args.
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
.
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
)
|
|
510
|
-
|
|
511
|
-
|
|
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
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
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
|
}
|