@blocklive/cli 0.0.0-stage → 0.7.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.
@@ -0,0 +1,1016 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolve = exports.catalog = exports.ENVIRONMENT = exports.EXIT_ERRORS = exports.EXIT_MEANINGS = exports.GLOBAL_OPTIONS = exports.COMMANDS = exports.ACTION_WORDS = void 0;
4
+ const errors_1 = require("./errors");
5
+ const http_1 = require("./http");
6
+ const EVENT = { name: 'event', meaning: "The event's ID or slug." };
7
+ const TEAM = {
8
+ name: 'team',
9
+ meaning: "The team's ID or slug (or an organization's, with --org): `team.slug` in `events list --json`, or a scope's `id` in `whoami --json`.",
10
+ };
11
+ const TICKET = {
12
+ name: 'ticket',
13
+ meaning: "The ticket type's ID, as `tickets list` shows it.",
14
+ };
15
+ const ORDER = {
16
+ name: 'order',
17
+ meaning: 'The order ID, as `invoices list` and `guests list --json` show it.',
18
+ };
19
+ const LIMIT = {
20
+ name: '--limit',
21
+ value: '<n>',
22
+ meaning: 'How many rows on a page, 1 to 100.',
23
+ };
24
+ const ALL = {
25
+ name: '--all',
26
+ meaning: 'Every page, not just the first.',
27
+ };
28
+ const ORG = { name: '--org', meaning: "The name is an organization's." };
29
+ const YES = { name: '--yes', meaning: 'Do it without asking first.' };
30
+ const DRY_RUN = {
31
+ name: '--dry-run',
32
+ meaning: 'Only show the plan; change nothing.',
33
+ };
34
+ const IDEMPOTENCY_KEY = {
35
+ name: '--idempotency-key',
36
+ value: '<uuid>',
37
+ meaning: 'The UUID to send the change with. Sent again with the same key, it is answered as before, never made twice. Default: a new one each run.',
38
+ };
39
+ // What `tickets add` and `tickets edit` set.
40
+ const TICKET_OPTIONS = {
41
+ title: {
42
+ name: '--title',
43
+ value: '<title>',
44
+ meaning: 'Its name, up to 100 characters.',
45
+ },
46
+ description: {
47
+ name: '--description',
48
+ value: '<text>',
49
+ meaning: 'What it includes, up to 2,000 characters; "" for none.',
50
+ },
51
+ supply: {
52
+ name: '--supply',
53
+ value: '<n>',
54
+ meaning: 'How many there are, 1 to 1,000,000, never fewer than are sold. Default 100.',
55
+ },
56
+ perPerson: {
57
+ name: '--per-person',
58
+ value: '<n>',
59
+ meaning: 'How many one person may get. Default 4, or the quantity when that is less.',
60
+ },
61
+ saleStarts: {
62
+ name: '--sale-starts',
63
+ value: '<time>',
64
+ meaning: 'When its sale starts, as ISO 8601 with its offset: 2026-12-01T19:00:00+01:00, or …Z for UTC. Default now.',
65
+ },
66
+ saleEnds: {
67
+ name: '--sale-ends',
68
+ value: '<time>',
69
+ meaning: 'When its sale ends, the same way. Default when the event ends.',
70
+ },
71
+ hidden: { name: '--hidden', meaning: 'Hide it from the event page.' },
72
+ shown: { name: '--shown', meaning: 'Show it on the event page again.' },
73
+ paused: { name: '--paused', meaning: 'Take it off sale for now.' },
74
+ onSale: { name: '--on-sale', meaning: 'Put it on sale again.' },
75
+ showSales: {
76
+ name: '--show-sales',
77
+ meaning: 'Show how many are sold on the event page (hidden by default).',
78
+ },
79
+ hideSales: {
80
+ name: '--hide-sales',
81
+ meaning: "Don't show how many are sold.",
82
+ },
83
+ transferable: {
84
+ name: '--transferable',
85
+ meaning: 'Let guests transfer it to someone else.',
86
+ },
87
+ notTransferable: {
88
+ name: '--not-transferable',
89
+ meaning: "Don't let guests transfer it.",
90
+ },
91
+ order: {
92
+ name: '--order',
93
+ value: '<n>',
94
+ meaning: "Its place in the event's list, 1 first; the others move along.",
95
+ },
96
+ art: {
97
+ name: '--art',
98
+ value: '<file>',
99
+ meaning: "The ticket type's art, from a file. A still PNG, JPEG or WebP (by its content), at most 4 MB, 200 to 8,000 pixels a side and 40 megapixels, with no metadata in it (Exif, XMP, text): Blocklive refuses any other and says why. On its own, without other options to change. Not with an unattended sign-in.",
100
+ attendedOnly: true,
101
+ },
102
+ price: {
103
+ name: '--price',
104
+ value: '<amount>',
105
+ meaning: "Its price in the event's currency, like 25 or 12.50: 0 is free, at most 1,000,000,000, with at most 2 decimals. Fees the ticket type adds on top are added to it. It is a draft: the price goes live when the event is published.",
106
+ },
107
+ currency: {
108
+ name: '--currency',
109
+ value: '<code>',
110
+ meaning: "The currency --price is in, like USD. Optional, and only a check: it must be the event's own, which is changed in the event editor.",
111
+ },
112
+ };
113
+ const T = TICKET_OPTIONS;
114
+ // What `events create` and `events edit` set.
115
+ const EVENT_OPTIONS = {
116
+ team: {
117
+ name: '--team',
118
+ value: '<team>',
119
+ meaning: "The team's ID or slug: `team.slug` in `events list --json`, or a team scope's `id` in `whoami --json`.",
120
+ },
121
+ title: {
122
+ name: '--title',
123
+ value: '<title>',
124
+ meaning: 'Its title, up to 120 characters. Default Untitled Event.',
125
+ },
126
+ starts: {
127
+ name: '--starts',
128
+ value: '<time>',
129
+ meaning: 'When it starts, as ISO 8601 with its offset, to the minute: 2026-12-01T19:00+01:00, or …Z for UTC. Default: the next whole hour where it is.',
130
+ },
131
+ ends: {
132
+ name: '--ends',
133
+ value: '<time>',
134
+ meaning: 'When it ends, the same way, after it starts. Default an hour after it starts.',
135
+ },
136
+ timeZone: {
137
+ name: '--time-zone',
138
+ value: '<zone>',
139
+ meaning: "Its time zone, an IANA name like Europe/London. Default this computer's.",
140
+ },
141
+ };
142
+ const DRAFT_OPTIONS = {
143
+ title: {
144
+ name: '--title',
145
+ value: '<title>',
146
+ meaning: 'Its title, up to 120 characters; not blank.',
147
+ },
148
+ subtitle: {
149
+ name: '--subtitle',
150
+ value: '<text>',
151
+ meaning: 'One line under the title, up to 140 characters; "" for none.',
152
+ },
153
+ description: {
154
+ name: '--description',
155
+ value: '<text>',
156
+ meaning: 'What it is, up to 50,000 characters; "" for none.',
157
+ },
158
+ descriptionFile: {
159
+ name: '--description-file',
160
+ value: '<file>',
161
+ meaning: 'The description from a UTF-8 text file (up to 200 KB), as it is: nothing in it is followed.',
162
+ },
163
+ starts: {
164
+ ...EVENT_OPTIONS.starts,
165
+ meaning: 'When it starts, as ISO 8601 with its offset, to the minute. A start past the end takes the end with it, keeping the length.',
166
+ },
167
+ ends: {
168
+ ...EVENT_OPTIONS.ends,
169
+ meaning: 'When it ends, the same way, after it starts.',
170
+ },
171
+ timeZone: {
172
+ ...EVENT_OPTIONS.timeZone,
173
+ meaning: 'Its time zone, an IANA name. Alone it keeps the clock times (19:00 stays 19:00), as the event editor does.',
174
+ },
175
+ location: {
176
+ name: '--location',
177
+ value: '<text|link>',
178
+ meaning: 'Where it is: an address, or a link for an online event (shown only to people who registered). For a place on the map, use --place.',
179
+ },
180
+ hideLocation: {
181
+ name: '--hide-location',
182
+ meaning: 'Show the location only to people who registered.',
183
+ },
184
+ showLocation: {
185
+ name: '--show-location',
186
+ meaning: 'Show the location to everyone (not for a link).',
187
+ },
188
+ cover: {
189
+ name: '--cover',
190
+ value: '<file>',
191
+ meaning: "The event's cover image, from a file. A still PNG, JPEG or WebP (by its content), at most 4 MB, 200 to 8,000 pixels a side and 40 megapixels, with no metadata in it (Exif, XMP, text): Blocklive refuses any other and says why. On its own, without other options to change. Not with an unattended sign-in.",
192
+ attendedOnly: true,
193
+ },
194
+ place: {
195
+ name: '--place',
196
+ value: '<place ID>',
197
+ meaning: "The event's place on the map, by its Google place ID as `places search` shows it. Blocklive asks Google Maps for the place and stores its name, address, parts and maps link; the address becomes the place's name and the event one in person. On its own, without other options to change. Each use counts as place lookups (20 a person a day). Not with an unattended sign-in.",
198
+ attendedOnly: true,
199
+ },
200
+ };
201
+ const D = DRAFT_OPTIONS;
202
+ const NO_BROWSER = {
203
+ name: '--no-browser',
204
+ meaning: 'Only print the link to confirm it; open no browser. (With --json it is only printed anyway.)',
205
+ };
206
+ const NO_WAIT = {
207
+ name: '--no-wait',
208
+ meaning: 'Ask, print where to confirm it and until when, and stop: `request show` says how it went.',
209
+ };
210
+ const EDIT_DRAFTS = { action: 'events.write', name: 'Edit drafts' };
211
+ const PUBLISH = { action: 'events.publish', name: 'Publish' };
212
+ /** What each action a sign-in may be approved for lets it do, in the words
213
+ * of the approve page (cli-approve-model.ts, CLI_ACTIONS). */
214
+ exports.ACTION_WORDS = {
215
+ 'checkin.write': 'Check guests in and out',
216
+ 'guests.write': 'Add guests with free tickets',
217
+ 'events.write': 'Edit drafts: create events, change event details and ticket types, import and undo bulk promo codes (nothing goes live until it is published, on blocklive.io or with a sign-in allowed to publish)',
218
+ 'events.publish': 'Publish: make an event and its changes public',
219
+ };
220
+ const MANAGERS = "The event's managers and admins.";
221
+ // Said in `who` of the commands an unattended sign-in can't run.
222
+ const ATTENDED = 'Not with an unattended sign-in: it needs one the person approves themselves.';
223
+ const TEAM_MANAGERS = "The team's managers and admins (not door staff, nor an organization's admin without a role at the team).";
224
+ exports.COMMANDS = [
225
+ {
226
+ name: 'login',
227
+ usage: 'blocklive login [--no-browser] [--unattended [--no-wait]] [--insecure-storage] [--api <url>]',
228
+ summary: 'Sign in through your browser (two-step verification needed), or with a code to enter on another device; --unattended for a sign-in that keeps working without you.',
229
+ kind: 'session',
230
+ args: [],
231
+ options: [
232
+ {
233
+ name: '--no-browser',
234
+ meaning: 'Sign in with a code to enter on any device. Pressing Enter at a terminal still opens the /cli page here: the page, never the code.',
235
+ },
236
+ {
237
+ name: '--unattended',
238
+ meaning: 'A sign-in that keeps working without you, for an AI agent or a script on this computer. Make its setup code on blocklive.io (Developer, CLI sign-ins, Add unattended sign-in); the CLI reads it from standard input only (hidden at a terminal, else the first line piped in), never from an argument or a variable, and sends it only to Blocklive itself: a live code to https://blocklive.io, a test code to a development server on this computer (localhost, 127.0.0.1 or [::1]). Then the person types the check code it prints on the Developer page and presses Activate. It works only from this network (or country), for 1, 7 or 30 days, and stops after 7 days unused. Refused over a profile that is signed in or waiting for Activate.',
239
+ },
240
+ {
241
+ name: '--no-wait',
242
+ meaning: "With --unattended: keep the sign-in and stop without waiting for Activate (--json prints the check code to type on the Developer page, checkCode). It isn't active until the person presses Activate; the next command says so (activation_pending) until then.",
243
+ },
244
+ {
245
+ name: '--insecure-storage',
246
+ meaning: 'Keep the sign-in in a file only you can read instead of a keychain: where there is none, or none that can keep it (a server with no keyring running). Only login takes it: later commands find the file.',
247
+ },
248
+ ],
249
+ who: 'Anyone with a Blocklive account, a role at a team, event or organization, and two-step verification; an unattended one only where a Blocklive admin switched unattended sign-ins on.',
250
+ local: true,
251
+ },
252
+ {
253
+ name: 'logout',
254
+ usage: 'blocklive logout',
255
+ summary: 'Sign out here and end the sign-in on Blocklive; an unattended one not yet activated is cancelled.',
256
+ kind: 'session',
257
+ args: [],
258
+ options: [],
259
+ who: 'Anyone signed in.',
260
+ },
261
+ {
262
+ name: 'whoami',
263
+ usage: 'blocklive whoami',
264
+ summary: 'Who you are signed in as, what this sign-in may do, and when it ends.',
265
+ kind: 'session',
266
+ args: [],
267
+ options: [],
268
+ who: 'Anyone signed in.',
269
+ },
270
+ {
271
+ name: 'events list',
272
+ usage: 'blocklive events list [--limit <n>] [--all]',
273
+ summary: 'The events you can see through this sign-in, newest first.',
274
+ kind: 'read',
275
+ args: [],
276
+ options: [LIMIT, ALL],
277
+ who: 'Anyone signed in.',
278
+ short: true,
279
+ },
280
+ {
281
+ name: 'event show',
282
+ usage: 'blocklive event show <event>',
283
+ summary: 'One event, by ID or slug: tickets sold, check-ins, ticket types.',
284
+ kind: 'read',
285
+ args: [EVENT],
286
+ options: [],
287
+ who: 'Anyone who can see the event.',
288
+ short: true,
289
+ },
290
+ {
291
+ name: 'events create',
292
+ usage: 'blocklive events create --team <team> [--title <title>] [--starts <time>] [--ends <time>] [--time-zone <zone>] [--yes] [--dry-run] [--idempotency-key <uuid>]',
293
+ summary: "Create an event at a team, after showing the plan; it isn't published, and nobody sees it until it is published (on blocklive.io, or with `event publish`). 10 a team a day.",
294
+ kind: 'change',
295
+ args: [],
296
+ options: [
297
+ EVENT_OPTIONS.team,
298
+ EVENT_OPTIONS.title,
299
+ EVENT_OPTIONS.starts,
300
+ EVENT_OPTIONS.ends,
301
+ EVENT_OPTIONS.timeZone,
302
+ YES,
303
+ DRY_RUN,
304
+ IDEMPOTENCY_KEY,
305
+ ],
306
+ needs: EDIT_DRAFTS,
307
+ who: TEAM_MANAGERS,
308
+ dryRun: true,
309
+ idempotencyKey: true,
310
+ },
311
+ {
312
+ name: 'events edit',
313
+ usage: 'blocklive events edit <event> [--title <title>] [--subtitle <text>] [--description <text> | --description-file <file>] [--starts <time>] [--ends <time>] [--time-zone <zone>] [--location <text|link>] [--hide-location | --show-location] [--cover <file>] [--place <place ID>] [--yes] [--dry-run] [--idempotency-key <uuid>]',
314
+ summary: "Change its draft's details, when and where (at least one thing), after showing the plan; live only when it is published (on blocklive.io, or with `event publish`). --cover <file> sets its cover image instead, on its own; --place <place ID> its place on the map, on its own.",
315
+ kind: 'change',
316
+ args: [EVENT],
317
+ options: [
318
+ D.title,
319
+ D.subtitle,
320
+ D.description,
321
+ D.descriptionFile,
322
+ D.starts,
323
+ D.ends,
324
+ D.timeZone,
325
+ D.location,
326
+ D.hideLocation,
327
+ D.showLocation,
328
+ D.cover,
329
+ D.place,
330
+ YES,
331
+ DRY_RUN,
332
+ IDEMPOTENCY_KEY,
333
+ ],
334
+ needs: EDIT_DRAFTS,
335
+ who: MANAGERS,
336
+ dryRun: true,
337
+ idempotencyKey: true,
338
+ },
339
+ {
340
+ name: 'event draft',
341
+ usage: 'blocklive event draft <event> [--full]',
342
+ summary: 'Its draft beside what is live, whether it has changes not published, and where to edit and publish it. A description shows its first 300 characters, its length and SHA-256; --full shows it whole.',
343
+ kind: 'read',
344
+ args: [EVENT],
345
+ options: [
346
+ {
347
+ name: '--full',
348
+ meaning: 'Show each description whole (description.full in --json), not only its first 300 characters.',
349
+ },
350
+ ],
351
+ who: MANAGERS,
352
+ },
353
+ {
354
+ name: 'event publish',
355
+ usage: 'blocklive event publish <event> [--yes] [--dry-run] [--idempotency-key <uuid>] [--no-wait] [--finish <publish>]',
356
+ summary: "Publish it: the event, its tickets and its prices go live for everyone. Shows what goes live and asks first, then waits for it to go through (up to 3 minutes). An event published from its organiser's own wallet is published on blocklive.io.",
357
+ kind: 'change',
358
+ args: [EVENT],
359
+ options: [
360
+ YES,
361
+ DRY_RUN,
362
+ IDEMPOTENCY_KEY,
363
+ {
364
+ name: '--no-wait',
365
+ meaning: "Start it and stop without waiting for it to go through (exit 7): it isn't live until it is finished with --finish.",
366
+ },
367
+ {
368
+ name: '--finish',
369
+ value: '<publish>',
370
+ meaning: 'Finish a publish already started, by the ID the command printed: waits for it to go through, then puts it live. Safe to run again.',
371
+ },
372
+ ],
373
+ needs: PUBLISH,
374
+ who: `${MANAGERS} The sign-in must allow "Publish", switched on when it was approved. ${ATTENDED}`,
375
+ dryRun: true,
376
+ idempotencyKey: true,
377
+ attendedOnly: true,
378
+ },
379
+ {
380
+ name: 'guests list',
381
+ usage: 'blocklive guests list <event> [--limit <n>] [--all]',
382
+ summary: "The event's guests, one row per ticket.",
383
+ kind: 'read',
384
+ args: [EVENT],
385
+ options: [LIMIT, ALL],
386
+ who: "The event's or its team's managers and admins.",
387
+ short: true,
388
+ personalDetails: true,
389
+ },
390
+ {
391
+ name: 'places search',
392
+ usage: 'blocklive places search <text>',
393
+ summary: 'Up to five places on Google Maps for some text, each with its name, address, Google place ID and maps link. The ID is what `events edit --place` takes. Blocklive counts each lookup: 20 a person a day.',
394
+ kind: 'read',
395
+ args: [
396
+ {
397
+ name: 'text',
398
+ meaning: "What to search for, in 3 to 120 characters: a venue's name with its city works best.",
399
+ },
400
+ ],
401
+ options: [],
402
+ needs: EDIT_DRAFTS,
403
+ who: `Anyone whose sign-in allows "Edit drafts". ${ATTENDED}`,
404
+ short: true,
405
+ attendedOnly: true,
406
+ },
407
+ {
408
+ name: 'promos list',
409
+ usage: 'blocklive promos list <event> [--limit <n>] [--all]',
410
+ summary: "The event's promo codes, bulk codes and bulk imports.",
411
+ kind: 'read',
412
+ args: [EVENT],
413
+ options: [LIMIT, ALL],
414
+ who: "The event's managers and admins, and the owner of its team's organization.",
415
+ short: true,
416
+ },
417
+ {
418
+ name: 'promos import',
419
+ usage: 'blocklive promos import <event> --file <codes.csv> [--percent <n>] [--uses <n> | --unlimited] [--per-guest <n>] [--tickets <names>] [--yes] [--dry-run] [--no-browser] [--no-wait]',
420
+ summary: 'Import bulk codes as drafts (card checkout only), after showing the plan; confirmed on blocklive.io with two-step.',
421
+ kind: 'change',
422
+ args: [EVENT],
423
+ options: [
424
+ {
425
+ name: '--file',
426
+ value: '<codes.csv>',
427
+ meaning: 'One code a line, or a CSV with a header row (code, discount, uses, per guest, tickets).',
428
+ },
429
+ {
430
+ name: '--percent',
431
+ value: '<n>',
432
+ meaning: 'The discount where a line has none. Default 100.',
433
+ },
434
+ {
435
+ name: '--uses',
436
+ value: '<n>',
437
+ meaning: 'How many times each code works. Default 1.',
438
+ },
439
+ {
440
+ name: '--unlimited',
441
+ meaning: 'Codes that work any number of times.',
442
+ },
443
+ {
444
+ name: '--per-guest',
445
+ value: '<n>',
446
+ meaning: 'How many times one person can use a code. Default 1.',
447
+ },
448
+ {
449
+ name: '--tickets',
450
+ value: '<names>',
451
+ meaning: 'Ticket type names, split by ;, or all (the default).',
452
+ },
453
+ YES,
454
+ DRY_RUN,
455
+ NO_BROWSER,
456
+ NO_WAIT,
457
+ ],
458
+ needs: EDIT_DRAFTS,
459
+ who: MANAGERS,
460
+ confirmedOnBlocklive: true,
461
+ dryRun: true,
462
+ },
463
+ {
464
+ name: 'promos undo',
465
+ usage: 'blocklive promos undo <event> [<import>] [--yes] [--dry-run]',
466
+ summary: 'Your bulk imports at the event, or undo one of them after showing its plan.',
467
+ kind: 'change',
468
+ args: [
469
+ EVENT,
470
+ {
471
+ name: 'import',
472
+ meaning: 'The import ID, as `promos undo <event>` lists it.',
473
+ optional: true,
474
+ },
475
+ ],
476
+ options: [YES, DRY_RUN],
477
+ needs: EDIT_DRAFTS,
478
+ who: `${MANAGERS} Only your own imports. ${ATTENDED}`,
479
+ dryRun: true,
480
+ attendedOnly: true,
481
+ },
482
+ {
483
+ name: 'tickets list',
484
+ usage: 'blocklive tickets list <event>',
485
+ summary: 'Its ticket types as the event editor has them: price, sold, sale window, on sale or paused, shown or hidden, and whether each is live.',
486
+ kind: 'read',
487
+ args: [EVENT],
488
+ options: [],
489
+ who: MANAGERS,
490
+ short: true,
491
+ },
492
+ {
493
+ name: 'tickets add',
494
+ usage: 'blocklive tickets add <event> --title <title> [--price <amount>] [--currency <code>] [--description <text>] [--supply <n>] [--per-person <n>] [--sale-starts <time>] [--sale-ends <time>] [--hidden] [--paused] [--show-sales] [--not-transferable] [--yes] [--dry-run] [--idempotency-key <uuid>]',
495
+ summary: "Add a ticket type as a draft, free unless --price is given, after showing the plan; it goes live, with its price, when the event is published (on blocklive.io, or with `event publish`). The price is in the event's currency. An event has at most 50 ticket types.",
496
+ kind: 'change',
497
+ args: [EVENT],
498
+ options: [
499
+ T.title,
500
+ T.price,
501
+ T.currency,
502
+ T.description,
503
+ T.supply,
504
+ T.perPerson,
505
+ T.saleStarts,
506
+ T.saleEnds,
507
+ T.hidden,
508
+ T.paused,
509
+ T.showSales,
510
+ T.notTransferable,
511
+ YES,
512
+ DRY_RUN,
513
+ IDEMPOTENCY_KEY,
514
+ ],
515
+ needs: EDIT_DRAFTS,
516
+ who: MANAGERS,
517
+ dryRun: true,
518
+ idempotencyKey: true,
519
+ },
520
+ {
521
+ name: 'tickets edit',
522
+ usage: 'blocklive tickets edit <event> <ticket> [--title <title>] [--price <amount>] [--currency <code>] [--description <text>] [--supply <n>] [--per-person <n>] [--sale-starts <time>] [--sale-ends <time>] [--hidden | --shown] [--paused | --on-sale] [--show-sales | --hide-sales] [--transferable | --not-transferable] [--order <n>] [--art <file>] [--yes] [--dry-run] [--idempotency-key <uuid>]',
523
+ summary: "Change a ticket type's draft (at least one thing), after showing the plan; it goes live when the event is published (on blocklive.io, or with `event publish`). --price changes its price in the event's currency (0 makes it free); until the event is published, buyers pay the price that is live. --art <file> sets its art instead, on its own.",
524
+ kind: 'change',
525
+ args: [EVENT, TICKET],
526
+ options: [
527
+ T.title,
528
+ T.price,
529
+ T.currency,
530
+ T.description,
531
+ T.supply,
532
+ T.perPerson,
533
+ T.saleStarts,
534
+ T.saleEnds,
535
+ T.hidden,
536
+ T.shown,
537
+ T.paused,
538
+ T.onSale,
539
+ T.showSales,
540
+ T.hideSales,
541
+ T.transferable,
542
+ T.notTransferable,
543
+ T.order,
544
+ T.art,
545
+ YES,
546
+ DRY_RUN,
547
+ IDEMPOTENCY_KEY,
548
+ ],
549
+ needs: EDIT_DRAFTS,
550
+ who: MANAGERS,
551
+ dryRun: true,
552
+ idempotencyKey: true,
553
+ },
554
+ {
555
+ name: 'tickets remove',
556
+ usage: 'blocklive tickets remove <event> <ticket> [--yes] [--dry-run] [--idempotency-key <uuid>]',
557
+ summary: "Remove a ticket type in its draft, after showing the plan, with the promo codes and token gates that unlock it; it goes live when the event is published (on blocklive.io, or with `event publish`), and until then the live ticket type stays on sale. Refused once any are sold or in an open order; a sponsor package's or a free-ticket type for guests is removed on its own page. Putting one back is in the event editor.",
558
+ kind: 'change',
559
+ args: [EVENT, TICKET],
560
+ options: [YES, DRY_RUN, IDEMPOTENCY_KEY],
561
+ needs: EDIT_DRAFTS,
562
+ who: `${MANAGERS} ${ATTENDED}`,
563
+ dryRun: true,
564
+ idempotencyKey: true,
565
+ attendedOnly: true,
566
+ },
567
+ {
568
+ name: 'invoices list',
569
+ usage: 'blocklive invoices list <event> [--limit <n>] [--all]',
570
+ summary: "Its orders' invoice status, why one waits, and the seller of record (25 a page).",
571
+ kind: 'read',
572
+ args: [EVENT],
573
+ options: [
574
+ { ...LIMIT, meaning: 'How many rows on a page, 1 to 25.' },
575
+ ALL,
576
+ ],
577
+ who: MANAGERS,
578
+ short: true,
579
+ personalDetails: true,
580
+ },
581
+ {
582
+ name: 'invoice show',
583
+ usage: 'blocklive invoice show <order>',
584
+ summary: "One order's invoice, billing details and documents.",
585
+ kind: 'read',
586
+ args: [ORDER],
587
+ options: [],
588
+ who: MANAGERS,
589
+ short: true,
590
+ personalDetails: true,
591
+ },
592
+ {
593
+ name: 'invoice issue',
594
+ usage: 'blocklive invoice issue <order> [--no-browser] [--no-wait]',
595
+ summary: "Issue an order's invoice, confirmed and issued on blocklive.io; it isn't emailed.",
596
+ kind: 'ask',
597
+ args: [ORDER],
598
+ options: [NO_BROWSER, NO_WAIT],
599
+ who: MANAGERS,
600
+ confirmedOnBlocklive: true,
601
+ personalDetails: true,
602
+ },
603
+ {
604
+ name: 'payment-account show',
605
+ usage: 'blocklive payment-account show <event>',
606
+ summary: 'Which account takes its payments, and whether a switch would be refused now (also a team).',
607
+ kind: 'read',
608
+ args: [{ name: 'event', meaning: "The event's or team's ID or slug." }],
609
+ options: [],
610
+ who: `Managers and admins of the event or team, and the owner of the team's organization. ${ATTENDED}`,
611
+ short: true,
612
+ attendedOnly: true,
613
+ },
614
+ {
615
+ name: 'payment-account choices',
616
+ usage: 'blocklive payment-account choices <event>',
617
+ summary: "The payout accounts an unpublished event could take from the CLI: its team's own account, and Blocklive's. Each by the ID `payment-account choose --to` takes, shown as its type, last four characters and whose it is.",
618
+ kind: 'read',
619
+ args: [EVENT],
620
+ options: [],
621
+ who: `The event's managers and admins. ${ATTENDED}`,
622
+ attendedOnly: true,
623
+ },
624
+ {
625
+ name: 'payment-account choose',
626
+ usage: 'blocklive payment-account choose <event> --to <team|id> [--no-browser] [--no-wait]',
627
+ summary: "Choose where this event's card payments are paid out (its payout account), for an event that isn't published yet. It only asks: nothing changes until you confirm it on blocklive.io with a new two-step code. The CLI takes no code.",
628
+ kind: 'ask',
629
+ args: [EVENT],
630
+ options: [
631
+ {
632
+ name: '--to',
633
+ value: '<team|id>',
634
+ meaning: "team for the team's own account, or an account's ID as `payment-account choices` shows it.",
635
+ },
636
+ NO_BROWSER,
637
+ NO_WAIT,
638
+ ],
639
+ needs: EDIT_DRAFTS,
640
+ who: `A team admin, an owner or admin of the team's organization, or a Blocklive admin, each with two-step verification. ${ATTENDED}`,
641
+ confirmedOnBlocklive: true,
642
+ attendedOnly: true,
643
+ },
644
+ {
645
+ name: 'payment-account switch',
646
+ usage: 'blocklive payment-account switch <event> --to <account|team> --reason <why> [--no-browser] [--no-wait]',
647
+ summary: 'Move its card payments to another account (also a team); refused while it has card orders on its account.',
648
+ kind: 'ask',
649
+ args: [{ name: 'event', meaning: "The event's or team's ID or slug." }],
650
+ options: [
651
+ {
652
+ name: '--to',
653
+ value: '<account|team>',
654
+ meaning: "The account's ID, or team for the event's team default.",
655
+ },
656
+ { name: '--reason', value: '<why>', meaning: 'Why it moves.' },
657
+ NO_BROWSER,
658
+ NO_WAIT,
659
+ ],
660
+ who: `Blocklive's admins. ${ATTENDED}`,
661
+ confirmedOnBlocklive: true,
662
+ attendedOnly: true,
663
+ },
664
+ {
665
+ name: 'developers list',
666
+ usage: 'blocklive developers list <team> [--org]',
667
+ summary: 'Who manages API keys there, open invitations, and whether developer access is on.',
668
+ kind: 'read',
669
+ args: [TEAM],
670
+ options: [ORG],
671
+ who: `The team's admins, and the organization's owner. ${ATTENDED}`,
672
+ short: true,
673
+ attendedOnly: true,
674
+ },
675
+ {
676
+ name: 'developers add',
677
+ usage: 'blocklive developers add <team> --email <address> [--org] [--no-browser] [--no-wait]',
678
+ summary: 'Add someone on the team as a developer, or invite anyone else, confirmed on blocklive.io.',
679
+ kind: 'ask',
680
+ args: [TEAM],
681
+ options: [
682
+ {
683
+ name: '--email',
684
+ value: '<address>',
685
+ meaning: 'Who to add or invite.',
686
+ },
687
+ ORG,
688
+ NO_BROWSER,
689
+ NO_WAIT,
690
+ ],
691
+ who: `The team's admins, and the organization's owner. ${ATTENDED}`,
692
+ confirmedOnBlocklive: true,
693
+ attendedOnly: true,
694
+ },
695
+ {
696
+ name: 'domains list',
697
+ usage: 'blocklive domains list <team>',
698
+ summary: "Its events' custom domains, their state and the DNS records to set.",
699
+ kind: 'read',
700
+ args: [{ name: 'team', meaning: "The team's ID or slug." }],
701
+ options: [],
702
+ who: "The team's managers and admins.",
703
+ short: true,
704
+ },
705
+ {
706
+ name: 'domains claim',
707
+ usage: 'blocklive domains claim <event> <hostname> [--no-browser] [--no-wait]',
708
+ summary: 'Start connecting a custom domain to the event, confirmed on blocklive.io.',
709
+ kind: 'ask',
710
+ args: [
711
+ EVENT,
712
+ {
713
+ name: 'hostname',
714
+ meaning: 'A name like tickets.example.com: no https://, path or port.',
715
+ },
716
+ ],
717
+ options: [NO_BROWSER, NO_WAIT],
718
+ who: MANAGERS,
719
+ confirmedOnBlocklive: true,
720
+ },
721
+ {
722
+ name: 'request show',
723
+ usage: 'blocklive request show <request> [--wait]',
724
+ summary: 'Where one of this sign-in’s requests to confirm on blocklive.io stands.',
725
+ kind: 'read',
726
+ args: [
727
+ {
728
+ name: 'request',
729
+ meaning: 'The request ID that --no-wait printed.',
730
+ },
731
+ ],
732
+ options: [
733
+ {
734
+ name: '--wait',
735
+ meaning: 'Wait until it is confirmed, declined or expired, with the exit code the command would have had.',
736
+ },
737
+ ],
738
+ who: 'The sign-in that asked.',
739
+ short: true,
740
+ },
741
+ {
742
+ name: 'commands',
743
+ usage: 'blocklive commands [--json]',
744
+ summary: 'Every command, its options, exit codes and environment variables.',
745
+ kind: 'read',
746
+ args: [],
747
+ options: [],
748
+ who: 'Anyone; needs no sign-in.',
749
+ local: true,
750
+ },
751
+ {
752
+ name: 'help',
753
+ usage: 'blocklive help [--json]',
754
+ summary: 'The list of commands and options; with --json, the same catalog as `commands --json`.',
755
+ kind: 'read',
756
+ args: [],
757
+ options: [],
758
+ who: 'Anyone; needs no sign-in.',
759
+ local: true,
760
+ },
761
+ ];
762
+ /** Options every command takes. */
763
+ exports.GLOBAL_OPTIONS = [
764
+ {
765
+ name: '--profile',
766
+ value: '<name>',
767
+ meaning: 'Use another saved sign-in. Default: BLOCKLIVE_PROFILE, else default.',
768
+ },
769
+ {
770
+ name: '--api',
771
+ value: '<url>',
772
+ meaning: 'Which Blocklive: login signs in there; any other command stops unless it is the one the profile signed in to. Default: BLOCKLIVE_API_URL, else https://blocklive.io. Also --base-url.',
773
+ },
774
+ { name: '--base-url', value: '<url>', meaning: 'The same as --api.' },
775
+ {
776
+ name: '--json',
777
+ meaning: 'Print one line of JSON on standard output; never ask anything, and open a browser only when Enter is pressed at a terminal (login).',
778
+ },
779
+ { name: '--help', meaning: 'Show help. Also -h.' },
780
+ { name: '--version', meaning: 'Show the version.' },
781
+ ];
782
+ exports.EXIT_MEANINGS = {
783
+ ok: 'Done.',
784
+ error: 'Something went wrong; the message says what. Trying again may work.',
785
+ usage: 'The command or an option is wrong.',
786
+ refused: 'Not signed in, not allowed, refused, declined, or not confirmed in time.',
787
+ notFound: 'Not found.',
788
+ rateLimited: 'Over a limit: the per-minute one after waiting, or one that will not clear in a minute (the message says which).',
789
+ conflict: 'The idempotency key was already used: for a different change, or from another sign-in.',
790
+ partial: "Some rows of a file were refused, or a publish hasn't gone through yet (the message says how to finish it).",
791
+ };
792
+ /** The `error.code` values each exit code comes with, and what to do. A
793
+ * usage error the CLI finds itself (exit 2) has no code. */
794
+ exports.EXIT_ERRORS = {
795
+ ok: [],
796
+ error: [
797
+ {
798
+ code: 'unavailable',
799
+ meaning: "Blocklive couldn't answer just now: it failed on its side, or what came back wasn't its answer.",
800
+ whatToDo: 'Try again in a minute. For a change, run it again with --idempotency-key and the key its error gives (idempotencyKey): it is made once.',
801
+ },
802
+ {
803
+ code: 'unreachable',
804
+ meaning: "Blocklive couldn't be reached, or didn't answer in time.",
805
+ whatToDo: 'Check the connection and try again. For a change, run it again with --idempotency-key and the key its error gives (idempotencyKey): it is made once.',
806
+ },
807
+ {
808
+ code: 'upgrade_required',
809
+ meaning: 'This CLI is too old.',
810
+ whatToDo: 'Install it again (the message says how).',
811
+ },
812
+ {
813
+ code: 'command_unavailable',
814
+ meaning: "This Blocklive doesn't have the command yet: the CLI is newer than it. Nothing is missing but the command.",
815
+ whatToDo: "Try again after Blocklive's next update, or do it on blocklive.io.",
816
+ },
817
+ {
818
+ code: 'config_unreadable',
819
+ meaning: "The CLI's settings file can't be read.",
820
+ whatToDo: 'Ask the person to run `blocklive login` to write it again.',
821
+ },
822
+ {
823
+ code: 'store_failed',
824
+ meaning: "A renewed sign-in couldn't be saved in the keychain (or its file), so the CLI ended it on Blocklive rather than leave it live with nobody holding it.",
825
+ whatToDo: 'Fix the keychain or the file, then ask the person to sign in again.',
826
+ },
827
+ ],
828
+ usage: [
829
+ {
830
+ code: 'invalid_request',
831
+ meaning: 'Blocklive found an option or argument wrong.',
832
+ whatToDo: 'Fix the command; the message says what.',
833
+ },
834
+ ],
835
+ refused: [
836
+ {
837
+ code: 'not_signed_in',
838
+ meaning: 'No sign-in on this profile, or it has ended.',
839
+ whatToDo: 'Ask the person to sign in: `blocklive login`.',
840
+ },
841
+ {
842
+ code: 'forbidden',
843
+ meaning: "The role or the sign-in doesn't allow it, or a hold stops it; the message says why.",
844
+ whatToDo: "Report it: trying again won't help.",
845
+ },
846
+ {
847
+ code: 'refused',
848
+ meaning: 'Blocklive refused the change, in its own words. Nothing changed.',
849
+ whatToDo: 'Fix what the message says, or report it.',
850
+ },
851
+ {
852
+ code: 'declined',
853
+ meaning: 'A request was declined on blocklive.io. Nothing changed.',
854
+ whatToDo: 'Report it, and ask the person before asking again.',
855
+ },
856
+ {
857
+ code: 'expired',
858
+ meaning: "A request wasn't confirmed in time. Nothing changed.",
859
+ whatToDo: 'Ask the person before trying again.',
860
+ },
861
+ {
862
+ code: 'not_issued',
863
+ meaning: "Confirmed, but the invoice wasn't issued; the message says why.",
864
+ whatToDo: 'Report it, and run it again once the order is ready.',
865
+ },
866
+ {
867
+ code: 'access_denied',
868
+ meaning: 'The login was refused on the approval page, or an unattended setup was cancelled.',
869
+ whatToDo: 'Ask the person to run `blocklive login` again (for an unattended one, with a new setup code).',
870
+ },
871
+ {
872
+ code: 'expired_token',
873
+ meaning: "The login code expired before it was approved, or an unattended setup wasn't activated in its 10 minutes.",
874
+ whatToDo: 'Ask the person to run `blocklive login` again (for an unattended one, with a new setup code).',
875
+ },
876
+ {
877
+ code: 'wrong_code',
878
+ meaning: 'The setup code is wrong, was already used, or has expired. If the Developer page shows a computer waiting to be activated, it is not this one.',
879
+ whatToDo: 'Ask the person to press Cancel on any computer waiting on the Developer page, make a new setup code and run `blocklive login --unattended` again.',
880
+ },
881
+ {
882
+ code: 'activation_pending',
883
+ meaning: "The unattended sign-in set up here isn't activated yet.",
884
+ whatToDo: 'Ask the person to go to the Developer page, type the check code `login --unattended` printed and press Activate, then run the command again.',
885
+ },
886
+ {
887
+ code: 'held_elsewhere',
888
+ meaning: "The unattended sign-in was used from a network or country it isn't held to. It still works from where it was set up; nothing was counted.",
889
+ whatToDo: "Run it from the computer's usual network (or country). Don't retry from here.",
890
+ },
891
+ {
892
+ code: 'switched_off',
893
+ meaning: 'A Blocklive admin switched off unattended sign-ins where this one acted, so it ended for good.',
894
+ whatToDo: 'Stop, and tell the person: once it is switched on again they make a new one.',
895
+ },
896
+ {
897
+ code: 'sign_in_ended',
898
+ meaning: "The unattended sign-in ended for good: its time ran out, it went unused too long, it was signed out or ended on blocklive.io, it was used from two places at once, the person's account, password, two-step verification or roles changed, or no place it acted at is left. `reason` says which.",
899
+ whatToDo: 'Stop, and ask the person to make a new one (`blocklive login --unattended`).',
900
+ },
901
+ {
902
+ code: 'needs_attended_sign_in',
903
+ meaning: "The command needs a sign-in the person approves themselves: an unattended one can't run it (`attendedOnly` in the catalog), nor anything Blocklive hasn't cleared for unattended sign-ins.",
904
+ whatToDo: "Don't retry: ask the person to run it, signed in with `blocklive login`.",
905
+ },
906
+ {
907
+ code: 'personal_details_off',
908
+ meaning: 'This unattended sign-in may not read guests’ or buyers’ details (`personalDetails` in the catalog).',
909
+ whatToDo: "Don't retry: ask the person to run it, signed in with `blocklive login`, or for an unattended sign-in that may read them (made on the Developer page).",
910
+ },
911
+ ],
912
+ notFound: [
913
+ {
914
+ code: 'not_found',
915
+ meaning: "No such event, team, order, ticket type or request, or the sign-in can't see it. These aren't told apart.",
916
+ whatToDo: "Check the ID or slug and the sign-in's scope.",
917
+ },
918
+ ],
919
+ rateLimited: [
920
+ {
921
+ code: 'rate_limited',
922
+ meaning: "Over a limit. Requests a minute: waited out first, up to five times. Or, said at once in Blocklive's words, one that won't clear in a minute (reason budget): the CLI's changes an hour, events made a day (a team's, a sign-in's, a person's, or all of Blocklive's), dry runs an hour.",
923
+ whatToDo: "With reason budget, don't retry soon: do it on blocklive.io, or later (the message says when). Otherwise wait a minute.",
924
+ },
925
+ ],
926
+ conflict: [
927
+ {
928
+ code: 'idempotency_conflict',
929
+ meaning: 'The idempotency key was used in the last 24 hours for a different change, or from another sign-in. Nothing changed.',
930
+ whatToDo: 'Use a new key for a new change, and send a key again only from the sign-in that first sent it.',
931
+ },
932
+ ],
933
+ partial: [],
934
+ };
935
+ /** The environment variables the CLI reads. */
936
+ exports.ENVIRONMENT = [
937
+ {
938
+ name: 'BLOCKLIVE_API_URL',
939
+ meaning: 'Which Blocklive to sign in to, as --api.',
940
+ },
941
+ {
942
+ name: 'BLOCKLIVE_PROFILE',
943
+ meaning: 'Which saved sign-in to use, as --profile (which wins).',
944
+ },
945
+ {
946
+ name: 'BLOCKLIVE_NO_BROWSER',
947
+ meaning: 'Set to 1 to never open a browser, whatever is pressed: login uses a code and only prints where to go, and confirm links are only printed.',
948
+ },
949
+ {
950
+ name: 'XDG_CONFIG_HOME',
951
+ meaning: 'Where the CLI keeps its settings: $XDG_CONFIG_HOME/blocklive, else ~/.config/blocklive.',
952
+ },
953
+ { name: 'NO_COLOR', meaning: 'Set to turn colour off.' },
954
+ { name: 'FORCE_COLOR', meaning: 'Set (not 0) to turn colour on.' },
955
+ { name: 'TERM', meaning: 'dumb turns colour off.' },
956
+ {
957
+ name: 'SSH_CONNECTION',
958
+ meaning: 'Over SSH, login uses a code. Also SSH_TTY.',
959
+ },
960
+ {
961
+ name: 'DISPLAY',
962
+ meaning: 'On Linux without a display, login uses a code. Also WAYLAND_DISPLAY.',
963
+ },
964
+ ];
965
+ /** What `blocklive commands --json` prints. */
966
+ function catalog() {
967
+ return {
968
+ cli: 'blocklive',
969
+ version: http_1.VERSION,
970
+ globalOptions: exports.GLOBAL_OPTIONS,
971
+ exitCodes: Object.keys(errors_1.EXIT).map((name) => ({
972
+ code: errors_1.EXIT[name],
973
+ name,
974
+ meaning: exports.EXIT_MEANINGS[name],
975
+ errors: exports.EXIT_ERRORS[name],
976
+ })),
977
+ environment: exports.ENVIRONMENT,
978
+ commands: exports.COMMANDS.map((c) => ({
979
+ name: c.name,
980
+ usage: c.usage,
981
+ summary: c.summary,
982
+ kind: c.kind,
983
+ args: c.args.map((a) => ({
984
+ name: a.name,
985
+ meaning: a.meaning,
986
+ optional: !!a.optional,
987
+ })),
988
+ options: c.options.map((o) => ({
989
+ name: o.name,
990
+ value: o.value ?? null,
991
+ meaning: o.meaning,
992
+ attendedOnly: !!o.attendedOnly,
993
+ })),
994
+ signedIn: !c.local,
995
+ needs: c.needs ?? null,
996
+ who: c.who,
997
+ confirmedOnBlocklive: !!c.confirmedOnBlocklive,
998
+ dryRun: !!c.dryRun,
999
+ idempotencyKey: !!c.idempotencyKey,
1000
+ attendedOnly: !!c.attendedOnly,
1001
+ personalDetails: !!c.personalDetails,
1002
+ })),
1003
+ };
1004
+ }
1005
+ exports.catalog = catalog;
1006
+ /** The command a command line names, and the words after its first. */
1007
+ function resolve(words) {
1008
+ const [first, second] = words;
1009
+ const all = exports.COMMANDS;
1010
+ const exact = all.find((c) => c.name === `${first} ${second}`);
1011
+ if (exact)
1012
+ return { command: exact, rest: words.slice(1) };
1013
+ const alone = all.find((c) => c.name === first || (c.short && c.name.split(' ')[0] === first));
1014
+ return alone && { command: alone, rest: words.slice(1) };
1015
+ }
1016
+ exports.resolve = resolve;