@freeticket/cli 0.7.1 → 0.9.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.
- package/README.md +8 -4
- package/dist/index.js +721 -75
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@freeticket/cli",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.9.0",
|
|
10
10
|
description: "Official FreeTicket CLI \u2014 consumes the B2B REST API for events, sales, tickets, memberships, venues, staff, and reports.",
|
|
11
11
|
keywords: [
|
|
12
12
|
"freeticket",
|
|
@@ -72,10 +72,46 @@ var package_default = {
|
|
|
72
72
|
// src/client/client.gen.ts
|
|
73
73
|
import { createClient, createConfig } from "@hey-api/client-fetch";
|
|
74
74
|
var client = createClient(createConfig({
|
|
75
|
-
baseUrl: "
|
|
75
|
+
baseUrl: "https://admin.appfreeticket.com/api/v1"
|
|
76
76
|
}));
|
|
77
77
|
|
|
78
78
|
// src/client/sdk.gen.ts
|
|
79
|
+
var getEventsIdDates = (options) => {
|
|
80
|
+
return (options.client ?? client).get({
|
|
81
|
+
security: [
|
|
82
|
+
{
|
|
83
|
+
name: "Authorization",
|
|
84
|
+
type: "apiKey"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "x-api-key",
|
|
88
|
+
type: "apiKey"
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
url: "/events/{id}/dates",
|
|
92
|
+
...options
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
var postEventsIdDates = (options) => {
|
|
96
|
+
return (options.client ?? client).post({
|
|
97
|
+
security: [
|
|
98
|
+
{
|
|
99
|
+
name: "Authorization",
|
|
100
|
+
type: "apiKey"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "x-api-key",
|
|
104
|
+
type: "apiKey"
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
url: "/events/{id}/dates",
|
|
108
|
+
...options,
|
|
109
|
+
headers: {
|
|
110
|
+
"Content-Type": "application/json",
|
|
111
|
+
...options?.headers
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
};
|
|
79
115
|
var postAuthDeviceCode = (options) => {
|
|
80
116
|
return (options?.client ?? client).post({
|
|
81
117
|
url: "/auth/device/code",
|
|
@@ -98,6 +134,10 @@ var getMe = (options) => {
|
|
|
98
134
|
{
|
|
99
135
|
name: "Authorization",
|
|
100
136
|
type: "apiKey"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "x-api-key",
|
|
140
|
+
type: "apiKey"
|
|
101
141
|
}
|
|
102
142
|
],
|
|
103
143
|
url: "/me",
|
|
@@ -110,6 +150,10 @@ var getEvents = (options) => {
|
|
|
110
150
|
{
|
|
111
151
|
name: "Authorization",
|
|
112
152
|
type: "apiKey"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "x-api-key",
|
|
156
|
+
type: "apiKey"
|
|
113
157
|
}
|
|
114
158
|
],
|
|
115
159
|
url: "/events",
|
|
@@ -122,6 +166,10 @@ var postEvents = (options) => {
|
|
|
122
166
|
{
|
|
123
167
|
name: "Authorization",
|
|
124
168
|
type: "apiKey"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "x-api-key",
|
|
172
|
+
type: "apiKey"
|
|
125
173
|
}
|
|
126
174
|
],
|
|
127
175
|
url: "/events",
|
|
@@ -138,6 +186,10 @@ var deleteEventsId = (options) => {
|
|
|
138
186
|
{
|
|
139
187
|
name: "Authorization",
|
|
140
188
|
type: "apiKey"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "x-api-key",
|
|
192
|
+
type: "apiKey"
|
|
141
193
|
}
|
|
142
194
|
],
|
|
143
195
|
url: "/events/{id}",
|
|
@@ -150,6 +202,10 @@ var getEventsId = (options) => {
|
|
|
150
202
|
{
|
|
151
203
|
name: "Authorization",
|
|
152
204
|
type: "apiKey"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
name: "x-api-key",
|
|
208
|
+
type: "apiKey"
|
|
153
209
|
}
|
|
154
210
|
],
|
|
155
211
|
url: "/events/{id}",
|
|
@@ -162,6 +218,10 @@ var patchEventsId = (options) => {
|
|
|
162
218
|
{
|
|
163
219
|
name: "Authorization",
|
|
164
220
|
type: "apiKey"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: "x-api-key",
|
|
224
|
+
type: "apiKey"
|
|
165
225
|
}
|
|
166
226
|
],
|
|
167
227
|
url: "/events/{id}",
|
|
@@ -178,33 +238,13 @@ var postEventsIdPublish = (options) => {
|
|
|
178
238
|
{
|
|
179
239
|
name: "Authorization",
|
|
180
240
|
type: "apiKey"
|
|
181
|
-
}
|
|
182
|
-
],
|
|
183
|
-
url: "/events/{id}/publish",
|
|
184
|
-
...options
|
|
185
|
-
});
|
|
186
|
-
};
|
|
187
|
-
var getEventsIdDates = (options) => {
|
|
188
|
-
return (options.client ?? client).get({
|
|
189
|
-
security: [
|
|
190
|
-
{
|
|
191
|
-
name: "Authorization",
|
|
192
|
-
type: "apiKey"
|
|
193
|
-
}
|
|
194
|
-
],
|
|
195
|
-
url: "/events/{id}/dates",
|
|
196
|
-
...options
|
|
197
|
-
});
|
|
198
|
-
};
|
|
199
|
-
var postEventsIdDates = (options) => {
|
|
200
|
-
return (options.client ?? client).post({
|
|
201
|
-
security: [
|
|
241
|
+
},
|
|
202
242
|
{
|
|
203
|
-
name: "
|
|
243
|
+
name: "x-api-key",
|
|
204
244
|
type: "apiKey"
|
|
205
245
|
}
|
|
206
246
|
],
|
|
207
|
-
url: "/events/{id}/
|
|
247
|
+
url: "/events/{id}/publish",
|
|
208
248
|
...options
|
|
209
249
|
});
|
|
210
250
|
};
|
|
@@ -214,6 +254,10 @@ var deleteEventsIdDatesDateId = (options) => {
|
|
|
214
254
|
{
|
|
215
255
|
name: "Authorization",
|
|
216
256
|
type: "apiKey"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
name: "x-api-key",
|
|
260
|
+
type: "apiKey"
|
|
217
261
|
}
|
|
218
262
|
],
|
|
219
263
|
url: "/events/{id}/dates/{dateId}",
|
|
@@ -226,10 +270,18 @@ var patchEventsIdDatesDateId = (options) => {
|
|
|
226
270
|
{
|
|
227
271
|
name: "Authorization",
|
|
228
272
|
type: "apiKey"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
name: "x-api-key",
|
|
276
|
+
type: "apiKey"
|
|
229
277
|
}
|
|
230
278
|
],
|
|
231
279
|
url: "/events/{id}/dates/{dateId}",
|
|
232
|
-
...options
|
|
280
|
+
...options,
|
|
281
|
+
headers: {
|
|
282
|
+
"Content-Type": "application/json",
|
|
283
|
+
...options?.headers
|
|
284
|
+
}
|
|
233
285
|
});
|
|
234
286
|
};
|
|
235
287
|
var getTicketTypes = (options) => {
|
|
@@ -238,6 +290,10 @@ var getTicketTypes = (options) => {
|
|
|
238
290
|
{
|
|
239
291
|
name: "Authorization",
|
|
240
292
|
type: "apiKey"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: "x-api-key",
|
|
296
|
+
type: "apiKey"
|
|
241
297
|
}
|
|
242
298
|
],
|
|
243
299
|
url: "/ticket-types",
|
|
@@ -250,6 +306,10 @@ var postTicketTypes = (options) => {
|
|
|
250
306
|
{
|
|
251
307
|
name: "Authorization",
|
|
252
308
|
type: "apiKey"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: "x-api-key",
|
|
312
|
+
type: "apiKey"
|
|
253
313
|
}
|
|
254
314
|
],
|
|
255
315
|
url: "/ticket-types",
|
|
@@ -266,6 +326,10 @@ var deleteTicketTypesId = (options) => {
|
|
|
266
326
|
{
|
|
267
327
|
name: "Authorization",
|
|
268
328
|
type: "apiKey"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
name: "x-api-key",
|
|
332
|
+
type: "apiKey"
|
|
269
333
|
}
|
|
270
334
|
],
|
|
271
335
|
url: "/ticket-types/{id}",
|
|
@@ -278,6 +342,10 @@ var getTicketTypesId = (options) => {
|
|
|
278
342
|
{
|
|
279
343
|
name: "Authorization",
|
|
280
344
|
type: "apiKey"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: "x-api-key",
|
|
348
|
+
type: "apiKey"
|
|
281
349
|
}
|
|
282
350
|
],
|
|
283
351
|
url: "/ticket-types/{id}",
|
|
@@ -290,10 +358,18 @@ var patchTicketTypesId = (options) => {
|
|
|
290
358
|
{
|
|
291
359
|
name: "Authorization",
|
|
292
360
|
type: "apiKey"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
name: "x-api-key",
|
|
364
|
+
type: "apiKey"
|
|
293
365
|
}
|
|
294
366
|
],
|
|
295
367
|
url: "/ticket-types/{id}",
|
|
296
|
-
...options
|
|
368
|
+
...options,
|
|
369
|
+
headers: {
|
|
370
|
+
"Content-Type": "application/json",
|
|
371
|
+
...options?.headers
|
|
372
|
+
}
|
|
297
373
|
});
|
|
298
374
|
};
|
|
299
375
|
var getSales = (options) => {
|
|
@@ -302,6 +378,10 @@ var getSales = (options) => {
|
|
|
302
378
|
{
|
|
303
379
|
name: "Authorization",
|
|
304
380
|
type: "apiKey"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
name: "x-api-key",
|
|
384
|
+
type: "apiKey"
|
|
305
385
|
}
|
|
306
386
|
],
|
|
307
387
|
url: "/sales",
|
|
@@ -314,6 +394,10 @@ var postSales = (options) => {
|
|
|
314
394
|
{
|
|
315
395
|
name: "Authorization",
|
|
316
396
|
type: "apiKey"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
name: "x-api-key",
|
|
400
|
+
type: "apiKey"
|
|
317
401
|
}
|
|
318
402
|
],
|
|
319
403
|
url: "/sales",
|
|
@@ -330,6 +414,10 @@ var getSalesId = (options) => {
|
|
|
330
414
|
{
|
|
331
415
|
name: "Authorization",
|
|
332
416
|
type: "apiKey"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
name: "x-api-key",
|
|
420
|
+
type: "apiKey"
|
|
333
421
|
}
|
|
334
422
|
],
|
|
335
423
|
url: "/sales/{id}",
|
|
@@ -342,10 +430,18 @@ var postSalesIdCancel = (options) => {
|
|
|
342
430
|
{
|
|
343
431
|
name: "Authorization",
|
|
344
432
|
type: "apiKey"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
name: "x-api-key",
|
|
436
|
+
type: "apiKey"
|
|
345
437
|
}
|
|
346
438
|
],
|
|
347
439
|
url: "/sales/{id}/cancel",
|
|
348
|
-
...options
|
|
440
|
+
...options,
|
|
441
|
+
headers: {
|
|
442
|
+
"Content-Type": "application/json",
|
|
443
|
+
...options?.headers
|
|
444
|
+
}
|
|
349
445
|
});
|
|
350
446
|
};
|
|
351
447
|
var postSalesIdRefund = (options) => {
|
|
@@ -354,10 +450,18 @@ var postSalesIdRefund = (options) => {
|
|
|
354
450
|
{
|
|
355
451
|
name: "Authorization",
|
|
356
452
|
type: "apiKey"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
name: "x-api-key",
|
|
456
|
+
type: "apiKey"
|
|
357
457
|
}
|
|
358
458
|
],
|
|
359
459
|
url: "/sales/{id}/refund",
|
|
360
|
-
...options
|
|
460
|
+
...options,
|
|
461
|
+
headers: {
|
|
462
|
+
"Content-Type": "application/json",
|
|
463
|
+
...options?.headers
|
|
464
|
+
}
|
|
361
465
|
});
|
|
362
466
|
};
|
|
363
467
|
var getMembershipPlans = (options) => {
|
|
@@ -366,6 +470,10 @@ var getMembershipPlans = (options) => {
|
|
|
366
470
|
{
|
|
367
471
|
name: "Authorization",
|
|
368
472
|
type: "apiKey"
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
name: "x-api-key",
|
|
476
|
+
type: "apiKey"
|
|
369
477
|
}
|
|
370
478
|
],
|
|
371
479
|
url: "/membership-plans",
|
|
@@ -378,6 +486,10 @@ var postMembershipPlans = (options) => {
|
|
|
378
486
|
{
|
|
379
487
|
name: "Authorization",
|
|
380
488
|
type: "apiKey"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
name: "x-api-key",
|
|
492
|
+
type: "apiKey"
|
|
381
493
|
}
|
|
382
494
|
],
|
|
383
495
|
url: "/membership-plans",
|
|
@@ -394,6 +506,10 @@ var deleteMembershipPlansId = (options) => {
|
|
|
394
506
|
{
|
|
395
507
|
name: "Authorization",
|
|
396
508
|
type: "apiKey"
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
name: "x-api-key",
|
|
512
|
+
type: "apiKey"
|
|
397
513
|
}
|
|
398
514
|
],
|
|
399
515
|
url: "/membership-plans/{id}",
|
|
@@ -406,6 +522,10 @@ var getMembershipPlansId = (options) => {
|
|
|
406
522
|
{
|
|
407
523
|
name: "Authorization",
|
|
408
524
|
type: "apiKey"
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
name: "x-api-key",
|
|
528
|
+
type: "apiKey"
|
|
409
529
|
}
|
|
410
530
|
],
|
|
411
531
|
url: "/membership-plans/{id}",
|
|
@@ -418,10 +538,18 @@ var patchMembershipPlansId = (options) => {
|
|
|
418
538
|
{
|
|
419
539
|
name: "Authorization",
|
|
420
540
|
type: "apiKey"
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
name: "x-api-key",
|
|
544
|
+
type: "apiKey"
|
|
421
545
|
}
|
|
422
546
|
],
|
|
423
547
|
url: "/membership-plans/{id}",
|
|
424
|
-
...options
|
|
548
|
+
...options,
|
|
549
|
+
headers: {
|
|
550
|
+
"Content-Type": "application/json",
|
|
551
|
+
...options?.headers
|
|
552
|
+
}
|
|
425
553
|
});
|
|
426
554
|
};
|
|
427
555
|
var getVenues = (options) => {
|
|
@@ -430,6 +558,10 @@ var getVenues = (options) => {
|
|
|
430
558
|
{
|
|
431
559
|
name: "Authorization",
|
|
432
560
|
type: "apiKey"
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
name: "x-api-key",
|
|
564
|
+
type: "apiKey"
|
|
433
565
|
}
|
|
434
566
|
],
|
|
435
567
|
url: "/venues",
|
|
@@ -442,6 +574,10 @@ var postVenues = (options) => {
|
|
|
442
574
|
{
|
|
443
575
|
name: "Authorization",
|
|
444
576
|
type: "apiKey"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
name: "x-api-key",
|
|
580
|
+
type: "apiKey"
|
|
445
581
|
}
|
|
446
582
|
],
|
|
447
583
|
url: "/venues",
|
|
@@ -458,6 +594,10 @@ var deleteVenuesId = (options) => {
|
|
|
458
594
|
{
|
|
459
595
|
name: "Authorization",
|
|
460
596
|
type: "apiKey"
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
name: "x-api-key",
|
|
600
|
+
type: "apiKey"
|
|
461
601
|
}
|
|
462
602
|
],
|
|
463
603
|
url: "/venues/{id}",
|
|
@@ -470,6 +610,10 @@ var getVenuesId = (options) => {
|
|
|
470
610
|
{
|
|
471
611
|
name: "Authorization",
|
|
472
612
|
type: "apiKey"
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
name: "x-api-key",
|
|
616
|
+
type: "apiKey"
|
|
473
617
|
}
|
|
474
618
|
],
|
|
475
619
|
url: "/venues/{id}",
|
|
@@ -482,10 +626,18 @@ var patchVenuesId = (options) => {
|
|
|
482
626
|
{
|
|
483
627
|
name: "Authorization",
|
|
484
628
|
type: "apiKey"
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
name: "x-api-key",
|
|
632
|
+
type: "apiKey"
|
|
485
633
|
}
|
|
486
634
|
],
|
|
487
635
|
url: "/venues/{id}",
|
|
488
|
-
...options
|
|
636
|
+
...options,
|
|
637
|
+
headers: {
|
|
638
|
+
"Content-Type": "application/json",
|
|
639
|
+
...options?.headers
|
|
640
|
+
}
|
|
489
641
|
});
|
|
490
642
|
};
|
|
491
643
|
var getStaff = (options) => {
|
|
@@ -494,6 +646,10 @@ var getStaff = (options) => {
|
|
|
494
646
|
{
|
|
495
647
|
name: "Authorization",
|
|
496
648
|
type: "apiKey"
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
name: "x-api-key",
|
|
652
|
+
type: "apiKey"
|
|
497
653
|
}
|
|
498
654
|
],
|
|
499
655
|
url: "/staff",
|
|
@@ -506,6 +662,10 @@ var postStaff = (options) => {
|
|
|
506
662
|
{
|
|
507
663
|
name: "Authorization",
|
|
508
664
|
type: "apiKey"
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
name: "x-api-key",
|
|
668
|
+
type: "apiKey"
|
|
509
669
|
}
|
|
510
670
|
],
|
|
511
671
|
url: "/staff",
|
|
@@ -522,6 +682,10 @@ var patchStaffIdRole = (options) => {
|
|
|
522
682
|
{
|
|
523
683
|
name: "Authorization",
|
|
524
684
|
type: "apiKey"
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
name: "x-api-key",
|
|
688
|
+
type: "apiKey"
|
|
525
689
|
}
|
|
526
690
|
],
|
|
527
691
|
url: "/staff/{id}/role",
|
|
@@ -538,6 +702,10 @@ var getReportsSummary = (options) => {
|
|
|
538
702
|
{
|
|
539
703
|
name: "Authorization",
|
|
540
704
|
type: "apiKey"
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
name: "x-api-key",
|
|
708
|
+
type: "apiKey"
|
|
541
709
|
}
|
|
542
710
|
],
|
|
543
711
|
url: "/reports/summary",
|
|
@@ -550,6 +718,10 @@ var getReportsInventory = (options) => {
|
|
|
550
718
|
{
|
|
551
719
|
name: "Authorization",
|
|
552
720
|
type: "apiKey"
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
name: "x-api-key",
|
|
724
|
+
type: "apiKey"
|
|
553
725
|
}
|
|
554
726
|
],
|
|
555
727
|
url: "/reports/inventory",
|
|
@@ -562,6 +734,10 @@ var getReportsReconciliation = (options) => {
|
|
|
562
734
|
{
|
|
563
735
|
name: "Authorization",
|
|
564
736
|
type: "apiKey"
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
name: "x-api-key",
|
|
740
|
+
type: "apiKey"
|
|
565
741
|
}
|
|
566
742
|
],
|
|
567
743
|
url: "/reports/reconciliation",
|
|
@@ -574,6 +750,10 @@ var getReportsExportsReconciliation = (options) => {
|
|
|
574
750
|
{
|
|
575
751
|
name: "Authorization",
|
|
576
752
|
type: "apiKey"
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
name: "x-api-key",
|
|
756
|
+
type: "apiKey"
|
|
577
757
|
}
|
|
578
758
|
],
|
|
579
759
|
url: "/reports/exports/reconciliation",
|
|
@@ -586,6 +766,10 @@ var getReportsExportsAttendees = (options) => {
|
|
|
586
766
|
{
|
|
587
767
|
name: "Authorization",
|
|
588
768
|
type: "apiKey"
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
name: "x-api-key",
|
|
772
|
+
type: "apiKey"
|
|
589
773
|
}
|
|
590
774
|
],
|
|
591
775
|
url: "/reports/exports/attendees",
|
|
@@ -598,6 +782,10 @@ var getReportsExportsBuyers = (options) => {
|
|
|
598
782
|
{
|
|
599
783
|
name: "Authorization",
|
|
600
784
|
type: "apiKey"
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
name: "x-api-key",
|
|
788
|
+
type: "apiKey"
|
|
601
789
|
}
|
|
602
790
|
],
|
|
603
791
|
url: "/reports/exports/buyers",
|
|
@@ -610,6 +798,10 @@ var getReportsExportsSubscribers = (options) => {
|
|
|
610
798
|
{
|
|
611
799
|
name: "Authorization",
|
|
612
800
|
type: "apiKey"
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
name: "x-api-key",
|
|
804
|
+
type: "apiKey"
|
|
613
805
|
}
|
|
614
806
|
],
|
|
615
807
|
url: "/reports/exports/subscribers",
|
|
@@ -622,6 +814,10 @@ var getReportsByEvent = (options) => {
|
|
|
622
814
|
{
|
|
623
815
|
name: "Authorization",
|
|
624
816
|
type: "apiKey"
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
name: "x-api-key",
|
|
820
|
+
type: "apiKey"
|
|
625
821
|
}
|
|
626
822
|
],
|
|
627
823
|
url: "/reports/by-event",
|
|
@@ -634,18 +830,58 @@ var getReportsTimeseries = (options) => {
|
|
|
634
830
|
{
|
|
635
831
|
name: "Authorization",
|
|
636
832
|
type: "apiKey"
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
name: "x-api-key",
|
|
836
|
+
type: "apiKey"
|
|
637
837
|
}
|
|
638
838
|
],
|
|
639
839
|
url: "/reports/timeseries",
|
|
640
840
|
...options
|
|
641
841
|
});
|
|
642
842
|
};
|
|
843
|
+
var getReportsFinancials = (options) => {
|
|
844
|
+
return (options?.client ?? client).get({
|
|
845
|
+
security: [
|
|
846
|
+
{
|
|
847
|
+
name: "Authorization",
|
|
848
|
+
type: "apiKey"
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
name: "x-api-key",
|
|
852
|
+
type: "apiKey"
|
|
853
|
+
}
|
|
854
|
+
],
|
|
855
|
+
url: "/reports/financials",
|
|
856
|
+
...options
|
|
857
|
+
});
|
|
858
|
+
};
|
|
859
|
+
var getSettlements = (options) => {
|
|
860
|
+
return (options?.client ?? client).get({
|
|
861
|
+
security: [
|
|
862
|
+
{
|
|
863
|
+
name: "Authorization",
|
|
864
|
+
type: "apiKey"
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
name: "x-api-key",
|
|
868
|
+
type: "apiKey"
|
|
869
|
+
}
|
|
870
|
+
],
|
|
871
|
+
url: "/settlements",
|
|
872
|
+
...options
|
|
873
|
+
});
|
|
874
|
+
};
|
|
643
875
|
var getDiscounts = (options) => {
|
|
644
876
|
return (options?.client ?? client).get({
|
|
645
877
|
security: [
|
|
646
878
|
{
|
|
647
879
|
name: "Authorization",
|
|
648
880
|
type: "apiKey"
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
name: "x-api-key",
|
|
884
|
+
type: "apiKey"
|
|
649
885
|
}
|
|
650
886
|
],
|
|
651
887
|
url: "/discounts",
|
|
@@ -658,6 +894,10 @@ var postDiscounts = (options) => {
|
|
|
658
894
|
{
|
|
659
895
|
name: "Authorization",
|
|
660
896
|
type: "apiKey"
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
name: "x-api-key",
|
|
900
|
+
type: "apiKey"
|
|
661
901
|
}
|
|
662
902
|
],
|
|
663
903
|
url: "/discounts",
|
|
@@ -674,6 +914,10 @@ var deleteDiscountsId = (options) => {
|
|
|
674
914
|
{
|
|
675
915
|
name: "Authorization",
|
|
676
916
|
type: "apiKey"
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
name: "x-api-key",
|
|
920
|
+
type: "apiKey"
|
|
677
921
|
}
|
|
678
922
|
],
|
|
679
923
|
url: "/discounts/{id}",
|
|
@@ -686,6 +930,10 @@ var patchDiscountsId = (options) => {
|
|
|
686
930
|
{
|
|
687
931
|
name: "Authorization",
|
|
688
932
|
type: "apiKey"
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
name: "x-api-key",
|
|
936
|
+
type: "apiKey"
|
|
689
937
|
}
|
|
690
938
|
],
|
|
691
939
|
url: "/discounts/{id}",
|
|
@@ -702,6 +950,10 @@ var getWebhooks = (options) => {
|
|
|
702
950
|
{
|
|
703
951
|
name: "Authorization",
|
|
704
952
|
type: "apiKey"
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
name: "x-api-key",
|
|
956
|
+
type: "apiKey"
|
|
705
957
|
}
|
|
706
958
|
],
|
|
707
959
|
url: "/webhooks",
|
|
@@ -714,6 +966,10 @@ var postWebhooks = (options) => {
|
|
|
714
966
|
{
|
|
715
967
|
name: "Authorization",
|
|
716
968
|
type: "apiKey"
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
name: "x-api-key",
|
|
972
|
+
type: "apiKey"
|
|
717
973
|
}
|
|
718
974
|
],
|
|
719
975
|
url: "/webhooks",
|
|
@@ -730,6 +986,10 @@ var deleteWebhooksId = (options) => {
|
|
|
730
986
|
{
|
|
731
987
|
name: "Authorization",
|
|
732
988
|
type: "apiKey"
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
name: "x-api-key",
|
|
992
|
+
type: "apiKey"
|
|
733
993
|
}
|
|
734
994
|
],
|
|
735
995
|
url: "/webhooks/{id}",
|
|
@@ -742,6 +1002,10 @@ var getMembershipPlansIdSubscribers = (options) => {
|
|
|
742
1002
|
{
|
|
743
1003
|
name: "Authorization",
|
|
744
1004
|
type: "apiKey"
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
name: "x-api-key",
|
|
1008
|
+
type: "apiKey"
|
|
745
1009
|
}
|
|
746
1010
|
],
|
|
747
1011
|
url: "/membership-plans/{id}/subscribers",
|
|
@@ -754,6 +1018,10 @@ var postSubscriptionsIdCancel = (options) => {
|
|
|
754
1018
|
{
|
|
755
1019
|
name: "Authorization",
|
|
756
1020
|
type: "apiKey"
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
name: "x-api-key",
|
|
1024
|
+
type: "apiKey"
|
|
757
1025
|
}
|
|
758
1026
|
],
|
|
759
1027
|
url: "/subscriptions/{id}/cancel",
|
|
@@ -766,18 +1034,42 @@ var getSalesIdTickets = (options) => {
|
|
|
766
1034
|
{
|
|
767
1035
|
name: "Authorization",
|
|
768
1036
|
type: "apiKey"
|
|
1037
|
+
},
|
|
1038
|
+
{
|
|
1039
|
+
name: "x-api-key",
|
|
1040
|
+
type: "apiKey"
|
|
769
1041
|
}
|
|
770
1042
|
],
|
|
771
1043
|
url: "/sales/{id}/tickets",
|
|
772
1044
|
...options
|
|
773
1045
|
});
|
|
774
1046
|
};
|
|
1047
|
+
var postTicketsTicketCodeResend = (options) => {
|
|
1048
|
+
return (options.client ?? client).post({
|
|
1049
|
+
security: [
|
|
1050
|
+
{
|
|
1051
|
+
name: "Authorization",
|
|
1052
|
+
type: "apiKey"
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
name: "x-api-key",
|
|
1056
|
+
type: "apiKey"
|
|
1057
|
+
}
|
|
1058
|
+
],
|
|
1059
|
+
url: "/tickets/{ticketCode}/resend",
|
|
1060
|
+
...options
|
|
1061
|
+
});
|
|
1062
|
+
};
|
|
775
1063
|
var postTicketsTicketCodeCheckin = (options) => {
|
|
776
1064
|
return (options.client ?? client).post({
|
|
777
1065
|
security: [
|
|
778
1066
|
{
|
|
779
1067
|
name: "Authorization",
|
|
780
1068
|
type: "apiKey"
|
|
1069
|
+
},
|
|
1070
|
+
{
|
|
1071
|
+
name: "x-api-key",
|
|
1072
|
+
type: "apiKey"
|
|
781
1073
|
}
|
|
782
1074
|
],
|
|
783
1075
|
url: "/tickets/{ticketCode}/checkin",
|
|
@@ -790,21 +1082,65 @@ var getTicketsTicketCodeAccess = (options) => {
|
|
|
790
1082
|
{
|
|
791
1083
|
name: "Authorization",
|
|
792
1084
|
type: "apiKey"
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
name: "x-api-key",
|
|
1088
|
+
type: "apiKey"
|
|
793
1089
|
}
|
|
794
1090
|
],
|
|
795
1091
|
url: "/tickets/{ticketCode}/access",
|
|
796
1092
|
...options
|
|
797
1093
|
});
|
|
798
1094
|
};
|
|
799
|
-
var
|
|
1095
|
+
var getApiKeys = (options) => {
|
|
1096
|
+
return (options?.client ?? client).get({
|
|
1097
|
+
security: [
|
|
1098
|
+
{
|
|
1099
|
+
name: "Authorization",
|
|
1100
|
+
type: "apiKey"
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
name: "x-api-key",
|
|
1104
|
+
type: "apiKey"
|
|
1105
|
+
}
|
|
1106
|
+
],
|
|
1107
|
+
url: "/api-keys",
|
|
1108
|
+
...options
|
|
1109
|
+
});
|
|
1110
|
+
};
|
|
1111
|
+
var postApiKeys = (options) => {
|
|
800
1112
|
return (options.client ?? client).post({
|
|
801
1113
|
security: [
|
|
802
1114
|
{
|
|
803
1115
|
name: "Authorization",
|
|
804
1116
|
type: "apiKey"
|
|
1117
|
+
},
|
|
1118
|
+
{
|
|
1119
|
+
name: "x-api-key",
|
|
1120
|
+
type: "apiKey"
|
|
805
1121
|
}
|
|
806
1122
|
],
|
|
807
|
-
url: "/
|
|
1123
|
+
url: "/api-keys",
|
|
1124
|
+
...options,
|
|
1125
|
+
headers: {
|
|
1126
|
+
"Content-Type": "application/json",
|
|
1127
|
+
...options?.headers
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
};
|
|
1131
|
+
var deleteApiKeysId = (options) => {
|
|
1132
|
+
return (options.client ?? client).delete({
|
|
1133
|
+
security: [
|
|
1134
|
+
{
|
|
1135
|
+
name: "Authorization",
|
|
1136
|
+
type: "apiKey"
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
name: "x-api-key",
|
|
1140
|
+
type: "apiKey"
|
|
1141
|
+
}
|
|
1142
|
+
],
|
|
1143
|
+
url: "/api-keys/{id}",
|
|
808
1144
|
...options
|
|
809
1145
|
});
|
|
810
1146
|
};
|
|
@@ -892,6 +1228,23 @@ var patchWorkspacesId = (options) => {
|
|
|
892
1228
|
}
|
|
893
1229
|
});
|
|
894
1230
|
};
|
|
1231
|
+
var postWorkspacesIdPlan = (options) => {
|
|
1232
|
+
return (options.client ?? client2).post({
|
|
1233
|
+
security: [
|
|
1234
|
+
{
|
|
1235
|
+
in: "cookie",
|
|
1236
|
+
name: "better-auth.session_token",
|
|
1237
|
+
type: "apiKey"
|
|
1238
|
+
}
|
|
1239
|
+
],
|
|
1240
|
+
url: "/workspaces/{id}/plan",
|
|
1241
|
+
...options,
|
|
1242
|
+
headers: {
|
|
1243
|
+
"Content-Type": "application/json",
|
|
1244
|
+
...options?.headers
|
|
1245
|
+
}
|
|
1246
|
+
});
|
|
1247
|
+
};
|
|
895
1248
|
var postWorkspacesIdSuspend = (options) => {
|
|
896
1249
|
return (options.client ?? client2).post({
|
|
897
1250
|
security: [
|
|
@@ -1094,6 +1447,49 @@ var getAuditLog = (options) => {
|
|
|
1094
1447
|
...options
|
|
1095
1448
|
});
|
|
1096
1449
|
};
|
|
1450
|
+
var getTokens = (options) => {
|
|
1451
|
+
return (options?.client ?? client2).get({
|
|
1452
|
+
security: [
|
|
1453
|
+
{
|
|
1454
|
+
in: "cookie",
|
|
1455
|
+
name: "better-auth.session_token",
|
|
1456
|
+
type: "apiKey"
|
|
1457
|
+
}
|
|
1458
|
+
],
|
|
1459
|
+
url: "/tokens",
|
|
1460
|
+
...options
|
|
1461
|
+
});
|
|
1462
|
+
};
|
|
1463
|
+
var postTokens = (options) => {
|
|
1464
|
+
return (options.client ?? client2).post({
|
|
1465
|
+
security: [
|
|
1466
|
+
{
|
|
1467
|
+
in: "cookie",
|
|
1468
|
+
name: "better-auth.session_token",
|
|
1469
|
+
type: "apiKey"
|
|
1470
|
+
}
|
|
1471
|
+
],
|
|
1472
|
+
url: "/tokens",
|
|
1473
|
+
...options,
|
|
1474
|
+
headers: {
|
|
1475
|
+
"Content-Type": "application/json",
|
|
1476
|
+
...options?.headers
|
|
1477
|
+
}
|
|
1478
|
+
});
|
|
1479
|
+
};
|
|
1480
|
+
var deleteTokensId = (options) => {
|
|
1481
|
+
return (options.client ?? client2).delete({
|
|
1482
|
+
security: [
|
|
1483
|
+
{
|
|
1484
|
+
in: "cookie",
|
|
1485
|
+
name: "better-auth.session_token",
|
|
1486
|
+
type: "apiKey"
|
|
1487
|
+
}
|
|
1488
|
+
],
|
|
1489
|
+
url: "/tokens/{id}",
|
|
1490
|
+
...options
|
|
1491
|
+
});
|
|
1492
|
+
};
|
|
1097
1493
|
|
|
1098
1494
|
// src/lib/config.ts
|
|
1099
1495
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -1161,6 +1557,20 @@ function configureAdminClient() {
|
|
|
1161
1557
|
}
|
|
1162
1558
|
});
|
|
1163
1559
|
}
|
|
1560
|
+
async function signedDownload(path) {
|
|
1561
|
+
const cfg = client.getConfig();
|
|
1562
|
+
const res = await fetch(`${cfg.baseUrl}${path}`, {
|
|
1563
|
+
redirect: "manual",
|
|
1564
|
+
headers: cfg.headers
|
|
1565
|
+
});
|
|
1566
|
+
const url = res.headers.get("location");
|
|
1567
|
+
if (!url)
|
|
1568
|
+
fail(
|
|
1569
|
+
`The API did not return a signed URL (HTTP ${res.status}).`,
|
|
1570
|
+
res.status === 404 ? "The settlement has no document yet, or it belongs to another workspace." : void 0
|
|
1571
|
+
);
|
|
1572
|
+
return { url, expiresInMinutes: 5 };
|
|
1573
|
+
}
|
|
1164
1574
|
function unwrap(res) {
|
|
1165
1575
|
if (res.data !== void 0) return res.data;
|
|
1166
1576
|
const status = res.response?.status;
|
|
@@ -1220,6 +1630,16 @@ function parseData(input) {
|
|
|
1220
1630
|
return fail("Invalid JSON in --data.");
|
|
1221
1631
|
}
|
|
1222
1632
|
}
|
|
1633
|
+
async function confirmOrExit(question, yes) {
|
|
1634
|
+
if (yes) return;
|
|
1635
|
+
if (!process.stdin.isTTY) {
|
|
1636
|
+
fail(
|
|
1637
|
+
`Refusing: ${question} \u2014 no TTY to confirm.`,
|
|
1638
|
+
"Pass --yes in scripts / CI."
|
|
1639
|
+
);
|
|
1640
|
+
}
|
|
1641
|
+
if (!await confirm(question)) fail("Aborted.");
|
|
1642
|
+
}
|
|
1223
1643
|
function confirm(question) {
|
|
1224
1644
|
if (!process.stdin.isTTY) return Promise.resolve(false);
|
|
1225
1645
|
const rl = readline.createInterface({
|
|
@@ -1239,7 +1659,10 @@ import chalk from "chalk";
|
|
|
1239
1659
|
import Table from "cli-table3";
|
|
1240
1660
|
function print(data, opts = {}) {
|
|
1241
1661
|
if (opts.json) {
|
|
1242
|
-
|
|
1662
|
+
const out = opts.columnsExplicit && opts.columns && Array.isArray(data) ? data.map(
|
|
1663
|
+
(row) => pick(row, opts.columns)
|
|
1664
|
+
) : data;
|
|
1665
|
+
process.stdout.write(`${JSON.stringify(out, null, 2)}
|
|
1243
1666
|
`);
|
|
1244
1667
|
return;
|
|
1245
1668
|
}
|
|
@@ -1296,6 +1719,18 @@ function fmt(v) {
|
|
|
1296
1719
|
if (typeof v === "object") return JSON.stringify(v);
|
|
1297
1720
|
return String(v);
|
|
1298
1721
|
}
|
|
1722
|
+
function pick(row, columns) {
|
|
1723
|
+
const out = {};
|
|
1724
|
+
for (const c2 of columns) if (c2 in row) out[c2] = row[c2];
|
|
1725
|
+
return out;
|
|
1726
|
+
}
|
|
1727
|
+
function printEmptyScope(workspaceId) {
|
|
1728
|
+
console.error(
|
|
1729
|
+
chalk.dim(
|
|
1730
|
+
workspaceId ? `(0 results in workspace ${workspaceId})` : "(0 results in the session's active workspace - check it with `ft whoami`, or scope with --workspace <id>)"
|
|
1731
|
+
)
|
|
1732
|
+
);
|
|
1733
|
+
}
|
|
1299
1734
|
|
|
1300
1735
|
// src/commands/admin.ts
|
|
1301
1736
|
function registerAdmin(program2) {
|
|
@@ -1370,6 +1805,16 @@ function registerAdmin(program2) {
|
|
|
1370
1805
|
name: "restore",
|
|
1371
1806
|
describe: "Restore a suspended workspace",
|
|
1372
1807
|
fn: postWorkspacesIdRestore
|
|
1808
|
+
},
|
|
1809
|
+
{
|
|
1810
|
+
// Assisted sale: activates a tier without going through Stripe
|
|
1811
|
+
// self-service. If the tenant had a Stripe subscription it is
|
|
1812
|
+
// cancelled there first; a failure there aborts with 409.
|
|
1813
|
+
name: "plan",
|
|
1814
|
+
describe: `Assign a platform plan manually (--data '{"planSlug":"spark|star|icon|legend"}')`,
|
|
1815
|
+
fn: postWorkspacesIdPlan,
|
|
1816
|
+
body: true,
|
|
1817
|
+
confirm: true
|
|
1373
1818
|
}
|
|
1374
1819
|
],
|
|
1375
1820
|
columns: ["id", "name", "type", "country", "suspended", "createdAt"],
|
|
@@ -1420,6 +1865,25 @@ function registerAdmin(program2) {
|
|
|
1420
1865
|
columns: ["key", "enabled", "description"],
|
|
1421
1866
|
noPaging: true
|
|
1422
1867
|
},
|
|
1868
|
+
{
|
|
1869
|
+
// Platform service tokens (PAT): headless credential for `ft admin` in
|
|
1870
|
+
// CI, minted from an interactive SUPER_ADMIN session. The plaintext is
|
|
1871
|
+
// only ever returned by `create` — store it right away.
|
|
1872
|
+
name: "tokens",
|
|
1873
|
+
describe: "Platform service tokens (PAT)",
|
|
1874
|
+
list: getTokens,
|
|
1875
|
+
create: postTokens,
|
|
1876
|
+
actions: [
|
|
1877
|
+
{
|
|
1878
|
+
name: "revoke",
|
|
1879
|
+
describe: "Revoke a service token",
|
|
1880
|
+
fn: deleteTokensId,
|
|
1881
|
+
confirm: true
|
|
1882
|
+
}
|
|
1883
|
+
],
|
|
1884
|
+
columns: ["id", "name", "lastUsedAt", "expiresAt", "createdAt"],
|
|
1885
|
+
noPaging: true
|
|
1886
|
+
},
|
|
1423
1887
|
{
|
|
1424
1888
|
name: "audit-log",
|
|
1425
1889
|
describe: "Superadmin audit log",
|
|
@@ -1501,9 +1965,8 @@ function registerAdminResource(parent, spec) {
|
|
|
1501
1965
|
cmd.option("--data <json>", "JSON body (inline or @file.json)");
|
|
1502
1966
|
}
|
|
1503
1967
|
cmd.action(async (value, opts) => {
|
|
1504
|
-
if (action.confirm
|
|
1505
|
-
|
|
1506
|
-
return;
|
|
1968
|
+
if (action.confirm) {
|
|
1969
|
+
await confirmOrExit(`${action.name} ${singular} ${value}?`, opts.yes);
|
|
1507
1970
|
}
|
|
1508
1971
|
configureAdminClient();
|
|
1509
1972
|
const payload = { path: { [param]: value } };
|
|
@@ -1517,9 +1980,107 @@ function camel(s) {
|
|
|
1517
1980
|
return s.replace(/-([a-z])/g, (_, c2) => c2.toUpperCase());
|
|
1518
1981
|
}
|
|
1519
1982
|
|
|
1983
|
+
// src/commands/api-keys.ts
|
|
1984
|
+
import chalk3 from "chalk";
|
|
1985
|
+
var COLUMNS = [
|
|
1986
|
+
"name",
|
|
1987
|
+
"keyPrefix",
|
|
1988
|
+
"scope",
|
|
1989
|
+
"lastUsedAt",
|
|
1990
|
+
"expiresAt",
|
|
1991
|
+
"revokedAt"
|
|
1992
|
+
];
|
|
1993
|
+
function registerApiKeys(program2) {
|
|
1994
|
+
const root = program2.command("api-keys").description("Self-service API keys: create, list, revoke");
|
|
1995
|
+
root.command("create <name>").description("Mint a new API key (the secret is shown only once)").option("--scope <read|write>", "key scope", "read").option("--expires <iso>", "expiry as ISO 8601 (e.g. 2027-01-01)").option("--workspace <id>", "workspace override").option("--json", "raw JSON output (includes the plaintext secret)").action(async (name, opts) => {
|
|
1996
|
+
const scope = opts.scope;
|
|
1997
|
+
if (scope !== "read" && scope !== "write") {
|
|
1998
|
+
fail("Invalid --scope. Use `read` or `write`.");
|
|
1999
|
+
}
|
|
2000
|
+
configureClient(opts.workspace);
|
|
2001
|
+
const body = unwrap(
|
|
2002
|
+
await postApiKeys({
|
|
2003
|
+
body: {
|
|
2004
|
+
name,
|
|
2005
|
+
scope,
|
|
2006
|
+
...opts.expires ? { expiresAt: opts.expires } : {}
|
|
2007
|
+
}
|
|
2008
|
+
})
|
|
2009
|
+
);
|
|
2010
|
+
const key = body.data;
|
|
2011
|
+
if (opts.json) {
|
|
2012
|
+
print(key, { json: true });
|
|
2013
|
+
return;
|
|
2014
|
+
}
|
|
2015
|
+
console.log(
|
|
2016
|
+
`
|
|
2017
|
+
${chalk3.green("\u2713")} API key "${chalk3.bold(key.name)}" created (scope: ${key.scope}).
|
|
2018
|
+
`
|
|
2019
|
+
);
|
|
2020
|
+
console.log(
|
|
2021
|
+
chalk3.yellow(" Copy your secret now \u2014 it will NOT be shown again:\n")
|
|
2022
|
+
);
|
|
2023
|
+
console.log(` ${chalk3.bold.cyan(key.key)}
|
|
2024
|
+
`);
|
|
2025
|
+
print(
|
|
2026
|
+
{
|
|
2027
|
+
id: key.id,
|
|
2028
|
+
name: key.name,
|
|
2029
|
+
scope: key.scope,
|
|
2030
|
+
keyPrefix: key.keyPrefix,
|
|
2031
|
+
expiresAt: key.expiresAt,
|
|
2032
|
+
createdAt: key.createdAt
|
|
2033
|
+
},
|
|
2034
|
+
{}
|
|
2035
|
+
);
|
|
2036
|
+
});
|
|
2037
|
+
root.command("list").description("List your API keys (the secret is never returned)").option("--limit <n>", "results per page (1-100)", "20").option("--cursor <id>", "pagination cursor").option("--all", "auto-paginate: fetch every page (ignores --cursor)").option("--columns <list>", "comma-separated columns to display").option("--full", "show every field instead of the curated columns").option("--workspace <id>", "workspace override").option("--csv", "CSV output (for spreadsheets)").option("--json", "raw JSON output (data only)").action(async (opts) => {
|
|
2038
|
+
configureClient(opts.workspace);
|
|
2039
|
+
const columns = resolveColumns(opts, COLUMNS);
|
|
2040
|
+
const query = {
|
|
2041
|
+
limit: opts.limit,
|
|
2042
|
+
cursor: opts.cursor
|
|
2043
|
+
};
|
|
2044
|
+
if (opts.all) {
|
|
2045
|
+
const rows = [];
|
|
2046
|
+
let cursor;
|
|
2047
|
+
let page;
|
|
2048
|
+
do {
|
|
2049
|
+
const body2 = unwrap(
|
|
2050
|
+
await getApiKeys({ query: { ...query, cursor } })
|
|
2051
|
+
);
|
|
2052
|
+
rows.push(...body2.data ?? []);
|
|
2053
|
+
page = body2.page;
|
|
2054
|
+
cursor = page?.nextCursor ?? void 0;
|
|
2055
|
+
} while (page?.hasMore && cursor);
|
|
2056
|
+
if (opts.csv) {
|
|
2057
|
+
process.stdout.write(`${toCsv(rows, columns)}
|
|
2058
|
+
`);
|
|
2059
|
+
return;
|
|
2060
|
+
}
|
|
2061
|
+
print(rows, { json: opts.json, columns });
|
|
2062
|
+
return;
|
|
2063
|
+
}
|
|
2064
|
+
const body = unwrap(await getApiKeys({ query }));
|
|
2065
|
+
if (opts.csv) {
|
|
2066
|
+
process.stdout.write(`${toCsv(body.data, columns)}
|
|
2067
|
+
`);
|
|
2068
|
+
return;
|
|
2069
|
+
}
|
|
2070
|
+
print(body.data, { json: opts.json, columns });
|
|
2071
|
+
if (!opts.json) printNextCursor(body.page);
|
|
2072
|
+
});
|
|
2073
|
+
root.command("revoke <id>").description("Revoke one of your API keys").option("--yes", "skip confirmation").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (id, opts) => {
|
|
2074
|
+
await confirmOrExit(`Revoke API key ${id}?`, opts.yes);
|
|
2075
|
+
configureClient(opts.workspace);
|
|
2076
|
+
const body = unwrap(await deleteApiKeysId({ path: { id } }));
|
|
2077
|
+
print(body?.data ?? { revoked: id }, { json: opts.json });
|
|
2078
|
+
});
|
|
2079
|
+
}
|
|
2080
|
+
|
|
1520
2081
|
// src/commands/auth.ts
|
|
1521
2082
|
import { spawn } from "child_process";
|
|
1522
|
-
import
|
|
2083
|
+
import chalk4 from "chalk";
|
|
1523
2084
|
function registerAuth(program2) {
|
|
1524
2085
|
program2.command("login").description(
|
|
1525
2086
|
"Log in via the browser (device flow) and store the session in ~/.freeticket/config.json"
|
|
@@ -1529,7 +2090,7 @@ function registerAuth(program2) {
|
|
|
1529
2090
|
).option(
|
|
1530
2091
|
"--url <url>",
|
|
1531
2092
|
"API base URL (default: https://admin.appfreeticket.com)"
|
|
1532
|
-
).option("--workspace <id>", "default active workspace").action(async (opts) => {
|
|
2093
|
+
).option("--workspace <id>", "default active workspace").option("--json", "raw JSON output (confirmation goes to stderr)").action(async (opts) => {
|
|
1533
2094
|
if (opts.url) saveConfig({ apiUrl: opts.url });
|
|
1534
2095
|
const cred = opts.key ? { apiKey: opts.key, workspaceId: void 0 } : await deviceLogin();
|
|
1535
2096
|
const workspaceId = opts.workspace ?? cred.workspaceId;
|
|
@@ -1539,10 +2100,10 @@ function registerAuth(program2) {
|
|
|
1539
2100
|
});
|
|
1540
2101
|
configureClient(workspaceId);
|
|
1541
2102
|
const me = unwrap(await getMe({})).data;
|
|
1542
|
-
console.
|
|
1543
|
-
`${
|
|
2103
|
+
console.error(
|
|
2104
|
+
`${chalk4.green("\u2713")} Session saved in ${chalk4.dim(CONFIG_PATH)}`
|
|
1544
2105
|
);
|
|
1545
|
-
print(me, {});
|
|
2106
|
+
print(me, { json: opts.json });
|
|
1546
2107
|
});
|
|
1547
2108
|
program2.command("whoami").description("Show the authenticated user and workspaces (GET /me)").option("--json", "raw JSON output").action(async (opts) => {
|
|
1548
2109
|
configureClient();
|
|
@@ -1552,10 +2113,10 @@ function registerAuth(program2) {
|
|
|
1552
2113
|
program2.command("logout").description("Log out and remove the stored session").action(() => {
|
|
1553
2114
|
saveConfig({ apiKey: void 0 });
|
|
1554
2115
|
console.log(
|
|
1555
|
-
`${
|
|
2116
|
+
`${chalk4.green("\u2713")} Logged out \u2014 session removed from ${chalk4.dim(CONFIG_PATH)}`
|
|
1556
2117
|
);
|
|
1557
2118
|
});
|
|
1558
|
-
program2.command("config").description("Show active configuration (the credential is masked)").action(() => {
|
|
2119
|
+
program2.command("config").description("Show active configuration (the credential is masked)").option("--json", "raw JSON output").action((opts) => {
|
|
1559
2120
|
const cfg = loadConfig();
|
|
1560
2121
|
print(
|
|
1561
2122
|
{
|
|
@@ -1564,7 +2125,7 @@ function registerAuth(program2) {
|
|
|
1564
2125
|
session: cfg.apiKey ? `${cfg.apiKey.slice(0, 12)}\u2026` : null,
|
|
1565
2126
|
workspaceId: cfg.workspaceId ?? null
|
|
1566
2127
|
},
|
|
1567
|
-
{}
|
|
2128
|
+
{ json: opts.json }
|
|
1568
2129
|
);
|
|
1569
2130
|
});
|
|
1570
2131
|
}
|
|
@@ -1582,11 +2143,11 @@ async function deviceLogin() {
|
|
|
1582
2143
|
const start = unwrap(await postAuthDeviceCode({}));
|
|
1583
2144
|
console.log(
|
|
1584
2145
|
`
|
|
1585
|
-
Open ${
|
|
2146
|
+
Open ${chalk4.cyan(start.verification_uri)} and enter the code:
|
|
1586
2147
|
|
|
1587
|
-
${
|
|
2148
|
+
${chalk4.bold(start.user_code)}
|
|
1588
2149
|
|
|
1589
|
-
${
|
|
2150
|
+
${chalk4.dim("Opening your browser\u2026 (Ctrl+C to cancel)")}
|
|
1590
2151
|
`
|
|
1591
2152
|
);
|
|
1592
2153
|
openBrowser(start.verification_uri_complete);
|
|
@@ -1606,7 +2167,7 @@ ${chalk3.dim("Opening your browser\u2026 (Ctrl+C to cancel)")}
|
|
|
1606
2167
|
if (workspaces.length > 1 && active) {
|
|
1607
2168
|
console.log(
|
|
1608
2169
|
`
|
|
1609
|
-
${
|
|
2170
|
+
${chalk4.dim("Workspaces:")} ${workspaces.map((w) => w.slug).join(", ")} ${chalk4.dim(`(using ${active.slug}; switch with --workspace)`)}`
|
|
1610
2171
|
);
|
|
1611
2172
|
}
|
|
1612
2173
|
return { apiKey: access_token, workspaceId: active?.id };
|
|
@@ -1663,10 +2224,7 @@ function registerEventDates(program2, spec) {
|
|
|
1663
2224
|
print(body.data ?? body, { json: opts.json });
|
|
1664
2225
|
});
|
|
1665
2226
|
root.command("delete <eventId> <dateId>").description("Delete an event date").option("--yes", "skip confirmation").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (eventId, dateId, opts) => {
|
|
1666
|
-
|
|
1667
|
-
console.error("Aborted.");
|
|
1668
|
-
return;
|
|
1669
|
-
}
|
|
2227
|
+
await confirmOrExit(`Delete date ${dateId}?`, opts.yes);
|
|
1670
2228
|
configureClient(opts.workspace);
|
|
1671
2229
|
const body = unwrap(await spec.del({ path: { id: eventId, dateId } }));
|
|
1672
2230
|
print(body?.data ?? { deleted: dateId }, { json: opts.json });
|
|
@@ -1702,6 +2260,20 @@ function registerReports(program2) {
|
|
|
1702
2260
|
);
|
|
1703
2261
|
print(body.data, { json: opts.json });
|
|
1704
2262
|
});
|
|
2263
|
+
root.command("financials").description(
|
|
2264
|
+
"Per-function P&L: gross, platform fee, facial, payment fee, 4x1000, net to settle"
|
|
2265
|
+
).option("--event <id>", "filter by event").option("--past", "only functions that already happened (settleable)").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").option("--csv", "CSV output (for spreadsheets/accounting)").action(async (opts) => {
|
|
2266
|
+
configureClient(opts.workspace);
|
|
2267
|
+
const body = unwrap(
|
|
2268
|
+
await getReportsFinancials({
|
|
2269
|
+
query: {
|
|
2270
|
+
event: opts.event,
|
|
2271
|
+
past: opts.past === void 0 ? void 0 : opts.past ? "true" : "false"
|
|
2272
|
+
}
|
|
2273
|
+
})
|
|
2274
|
+
);
|
|
2275
|
+
printExport(body.data, opts);
|
|
2276
|
+
});
|
|
1705
2277
|
root.command("by-event").description("Revenue / tickets sold / availability grouped by event").option("--from <date>", "created from (ISO 8601)").option("--to <date>", "created to (ISO 8601)").option("--status <s>", "filter by sale status").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (opts) => {
|
|
1706
2278
|
configureClient(opts.workspace);
|
|
1707
2279
|
const body = unwrap(
|
|
@@ -1744,7 +2316,7 @@ function registerReports(program2) {
|
|
|
1744
2316
|
const exp = root.command("export").description(
|
|
1745
2317
|
"Export buyers, attendees, subscribers or reconciliation (CSV)"
|
|
1746
2318
|
);
|
|
1747
|
-
exp.command("reconciliation").description("Export reconciliation (CSV) for accounting").requiredOption("--from <date>", "date_from (ISO 8601)").requiredOption("--to <date>", "date_to (ISO 8601)").option("--match <status>", "filter by match_status").option("--provider <p>", "filter by payment provider").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (opts) => {
|
|
2319
|
+
exp.command("reconciliation").description("Export reconciliation (CSV) for accounting").requiredOption("--from <date>", "date_from (ISO 8601)").requiredOption("--to <date>", "date_to (ISO 8601)").option("--match <status>", "filter by match_status").option("--provider <p>", "filter by payment provider").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").option("--csv", "CSV output (for spreadsheets/accounting)").action(async (opts) => {
|
|
1748
2320
|
configureClient(opts.workspace);
|
|
1749
2321
|
const body = unwrap(
|
|
1750
2322
|
await getReportsExportsReconciliation({
|
|
@@ -1756,13 +2328,13 @@ function registerReports(program2) {
|
|
|
1756
2328
|
}
|
|
1757
2329
|
})
|
|
1758
2330
|
);
|
|
1759
|
-
|
|
2331
|
+
printExport(body.data ?? body, opts);
|
|
1760
2332
|
});
|
|
1761
2333
|
for (const [name, fn, label] of [
|
|
1762
2334
|
["buyers", getReportsExportsBuyers, "buyers (one row per sale)"],
|
|
1763
2335
|
["attendees", getReportsExportsAttendees, "attendees (one row per ticket)"]
|
|
1764
2336
|
]) {
|
|
1765
|
-
exp.command(name).description(`Export ${label}`).option("--event <id>", "filter by event").option("--event-date <id>", "filter by event date").option("--from <date>", "created from (ISO 8601)").option("--to <date>", "created to (ISO 8601)").option("--status <s>", "filter by sale status").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (opts) => {
|
|
2337
|
+
exp.command(name).description(`Export ${label}`).option("--event <id>", "filter by event").option("--event-date <id>", "filter by event date").option("--from <date>", "created from (ISO 8601)").option("--to <date>", "created to (ISO 8601)").option("--status <s>", "filter by sale status").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").option("--csv", "CSV output (for spreadsheets/accounting)").action(async (opts) => {
|
|
1766
2338
|
configureClient(opts.workspace);
|
|
1767
2339
|
const body = unwrap(
|
|
1768
2340
|
await fn({
|
|
@@ -1775,17 +2347,33 @@ function registerReports(program2) {
|
|
|
1775
2347
|
}
|
|
1776
2348
|
})
|
|
1777
2349
|
);
|
|
1778
|
-
|
|
2350
|
+
printExport(body.data ?? body, opts);
|
|
1779
2351
|
});
|
|
1780
2352
|
}
|
|
1781
|
-
exp.command("subscribers").description("Export subscribers").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (opts) => {
|
|
2353
|
+
exp.command("subscribers").description("Export subscribers").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").option("--csv", "CSV output (for spreadsheets/accounting)").action(async (opts) => {
|
|
1782
2354
|
configureClient(opts.workspace);
|
|
1783
2355
|
const body = unwrap(await getReportsExportsSubscribers({}));
|
|
1784
|
-
|
|
2356
|
+
printExport(body.data ?? body, opts);
|
|
1785
2357
|
});
|
|
1786
2358
|
}
|
|
2359
|
+
function printExport(rows, opts) {
|
|
2360
|
+
if (typeof rows === "string") {
|
|
2361
|
+
process.stdout.write(rows.endsWith("\n") ? rows : `${rows}
|
|
2362
|
+
`);
|
|
2363
|
+
return;
|
|
2364
|
+
}
|
|
2365
|
+
if (opts.csv && Array.isArray(rows)) {
|
|
2366
|
+
process.stdout.write(`${toCsv(rows)}
|
|
2367
|
+
`);
|
|
2368
|
+
return;
|
|
2369
|
+
}
|
|
2370
|
+
print(rows, { json: opts.json });
|
|
2371
|
+
}
|
|
1787
2372
|
|
|
1788
2373
|
// src/commands/resource.ts
|
|
2374
|
+
function activeWorkspace(flag) {
|
|
2375
|
+
return flag ?? loadConfig().workspaceId;
|
|
2376
|
+
}
|
|
1789
2377
|
function registerResource(program2, spec) {
|
|
1790
2378
|
const root = program2.command(spec.name).description(spec.describe);
|
|
1791
2379
|
const singular = spec.name.replace(/s$/, "");
|
|
@@ -1826,7 +2414,12 @@ function registerResource(program2, spec) {
|
|
|
1826
2414
|
`);
|
|
1827
2415
|
return;
|
|
1828
2416
|
}
|
|
1829
|
-
print(rows, {
|
|
2417
|
+
print(rows, {
|
|
2418
|
+
json: opts.json,
|
|
2419
|
+
columns,
|
|
2420
|
+
columnsExplicit: Boolean(opts.columns)
|
|
2421
|
+
});
|
|
2422
|
+
if (rows.length === 0) printEmptyScope(activeWorkspace(opts.workspace));
|
|
1830
2423
|
return;
|
|
1831
2424
|
}
|
|
1832
2425
|
const body = unwrap(await list({ query }));
|
|
@@ -1839,7 +2432,13 @@ function registerResource(program2, spec) {
|
|
|
1839
2432
|
`);
|
|
1840
2433
|
return;
|
|
1841
2434
|
}
|
|
1842
|
-
print(body.data, {
|
|
2435
|
+
print(body.data, {
|
|
2436
|
+
json: opts.json,
|
|
2437
|
+
columns,
|
|
2438
|
+
columnsExplicit: Boolean(opts.columns)
|
|
2439
|
+
});
|
|
2440
|
+
if ((body.data ?? []).length === 0)
|
|
2441
|
+
printEmptyScope(activeWorkspace(opts.workspace));
|
|
1843
2442
|
if (!opts.json) printNextCursor(body.page);
|
|
1844
2443
|
});
|
|
1845
2444
|
}
|
|
@@ -1872,10 +2471,7 @@ function registerResource(program2, spec) {
|
|
|
1872
2471
|
if (spec.del) {
|
|
1873
2472
|
const del = spec.del;
|
|
1874
2473
|
root.command("delete <id>").description(`Delete a ${singular} by id`).option("--yes", "skip confirmation").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (id, opts) => {
|
|
1875
|
-
|
|
1876
|
-
console.error("Aborted.");
|
|
1877
|
-
return;
|
|
1878
|
-
}
|
|
2474
|
+
await confirmOrExit(`Delete ${singular} ${id}?`, opts.yes);
|
|
1879
2475
|
configureClient(opts.workspace);
|
|
1880
2476
|
const body = unwrap(await del({ path: { id } }));
|
|
1881
2477
|
print(body?.data ?? { deleted: id }, { json: opts.json });
|
|
@@ -1894,6 +2490,7 @@ function registerResource(program2, spec) {
|
|
|
1894
2490
|
print(body?.data ?? body ?? { ok: true, id }, { json: opts.json });
|
|
1895
2491
|
});
|
|
1896
2492
|
}
|
|
2493
|
+
spec.extend?.(root);
|
|
1897
2494
|
}
|
|
1898
2495
|
function camel2(s) {
|
|
1899
2496
|
return s.replace(/-([a-z])/g, (_, c2) => c2.toUpperCase());
|
|
@@ -1928,7 +2525,7 @@ function registerTickets(program2) {
|
|
|
1928
2525
|
}
|
|
1929
2526
|
|
|
1930
2527
|
// src/commands/workspace.ts
|
|
1931
|
-
import
|
|
2528
|
+
import chalk5 from "chalk";
|
|
1932
2529
|
function registerWorkspace(program2) {
|
|
1933
2530
|
const root = program2.command("workspace").description("List, switch, and show the active workspace");
|
|
1934
2531
|
root.command("list").alias("ls").description("List the workspaces you can access (marks the active one)").option("--json", "raw JSON output").action(async (opts) => {
|
|
@@ -1939,11 +2536,13 @@ function registerWorkspace(program2) {
|
|
|
1939
2536
|
active: w.id === activeId ? "*" : "",
|
|
1940
2537
|
id: w.id,
|
|
1941
2538
|
name: w.name,
|
|
1942
|
-
slug: w.slug
|
|
2539
|
+
slug: w.slug,
|
|
2540
|
+
role: w.role,
|
|
2541
|
+
access: w.sections === null ? "full" : w.sections.length === 0 ? "revoked" : w.sections.join("|")
|
|
1943
2542
|
}));
|
|
1944
2543
|
print(rows, {
|
|
1945
2544
|
json: opts.json,
|
|
1946
|
-
columns: ["active", "id", "name", "slug"]
|
|
2545
|
+
columns: ["active", "id", "name", "slug", "role", "access"]
|
|
1947
2546
|
});
|
|
1948
2547
|
});
|
|
1949
2548
|
root.command("use <idOrSlug>").description(
|
|
@@ -1962,7 +2561,7 @@ function registerWorkspace(program2) {
|
|
|
1962
2561
|
}
|
|
1963
2562
|
saveConfig({ workspaceId: match.id });
|
|
1964
2563
|
console.log(
|
|
1965
|
-
`${
|
|
2564
|
+
`${chalk5.green("\u2713")} Active workspace: ${chalk5.bold(match.name)} ${chalk5.dim(`(${match.slug})`)}`
|
|
1966
2565
|
);
|
|
1967
2566
|
});
|
|
1968
2567
|
root.command("show").description("Show the active workspace").option("--json", "raw JSON output").action(async (opts) => {
|
|
@@ -2003,7 +2602,7 @@ function banner() {
|
|
|
2003
2602
|
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
2004
2603
|
import { homedir as homedir2 } from "os";
|
|
2005
2604
|
import { dirname as dirname2, join as join2 } from "path";
|
|
2006
|
-
import
|
|
2605
|
+
import chalk6 from "chalk";
|
|
2007
2606
|
var CACHE_PATH = join2(homedir2(), ".freeticket", "update-check.json");
|
|
2008
2607
|
var REGISTRY = "https://registry.npmjs.org/@freeticket/cli/latest";
|
|
2009
2608
|
var ONE_DAY = 24 * 60 * 60 * 1e3;
|
|
@@ -2017,8 +2616,8 @@ async function notifyUpdate(current) {
|
|
|
2017
2616
|
if (latest && isNewer(latest, current)) {
|
|
2018
2617
|
process.stderr.write(
|
|
2019
2618
|
`
|
|
2020
|
-
${
|
|
2021
|
-
${
|
|
2619
|
+
${chalk6.yellow(`\u26A0 Update available: @freeticket/cli ${current} \u2192 ${latest}`)}
|
|
2620
|
+
${chalk6.dim(" npm i -g @freeticket/cli@latest \xB7 or use npx @freeticket/cli@latest")}
|
|
2022
2621
|
|
|
2023
2622
|
`
|
|
2024
2623
|
);
|
|
@@ -2080,7 +2679,41 @@ registerResource(program, {
|
|
|
2080
2679
|
{ name: "publish", describe: "Publish an event", fn: postEventsIdPublish }
|
|
2081
2680
|
],
|
|
2082
2681
|
// startsAt lives on EventDate, not Event — use createdAt for a temporal column.
|
|
2083
|
-
columns: ["id", "name", "status", "createdAt"]
|
|
2682
|
+
columns: ["id", "name", "status", "createdAt"],
|
|
2683
|
+
listFlags: [
|
|
2684
|
+
{ flag: "--q <text>", describe: "search by name", query: "q" },
|
|
2685
|
+
{
|
|
2686
|
+
flag: "--status <s>",
|
|
2687
|
+
describe: "DRAFT | PUBLISHED | SOLD_OUT | CANCELLED | COMPLETED",
|
|
2688
|
+
query: "status"
|
|
2689
|
+
},
|
|
2690
|
+
{
|
|
2691
|
+
flag: "--with-total",
|
|
2692
|
+
describe: "include page.total (opt-in: costs an extra count query)",
|
|
2693
|
+
query: "withTotal"
|
|
2694
|
+
}
|
|
2695
|
+
]
|
|
2696
|
+
});
|
|
2697
|
+
registerResource(program, {
|
|
2698
|
+
name: "settlements",
|
|
2699
|
+
describe: "Settlements paid to the organizer",
|
|
2700
|
+
list: getSettlements,
|
|
2701
|
+
columns: ["id", "reference", "status", "amount", "currency", "createdAt"],
|
|
2702
|
+
listFlags: [
|
|
2703
|
+
{ flag: "--event <id>", describe: "filter by event", query: "event" },
|
|
2704
|
+
{
|
|
2705
|
+
flag: "--status <s>",
|
|
2706
|
+
describe: "SENT | AWAITING_PAYMENT | PAID",
|
|
2707
|
+
query: "status"
|
|
2708
|
+
}
|
|
2709
|
+
],
|
|
2710
|
+
extend: (root) => {
|
|
2711
|
+
root.command("document <id>").description("Signed download URL for the settlement PDF (5 min TTL)").option("--proof <fileName>", "download a payment proof instead").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (id, opts) => {
|
|
2712
|
+
configureClient(opts.workspace);
|
|
2713
|
+
const path = opts.proof ? `/settlements/${id}/proofs/${encodeURIComponent(opts.proof)}` : `/settlements/${id}/document`;
|
|
2714
|
+
print(await signedDownload(path), { json: opts.json });
|
|
2715
|
+
});
|
|
2716
|
+
}
|
|
2084
2717
|
});
|
|
2085
2718
|
registerEventDates(program, {
|
|
2086
2719
|
list: getEventsIdDates,
|
|
@@ -2095,7 +2728,12 @@ registerResource(program, {
|
|
|
2095
2728
|
get: getSalesId,
|
|
2096
2729
|
create: postSales,
|
|
2097
2730
|
actions: [
|
|
2098
|
-
{
|
|
2731
|
+
{
|
|
2732
|
+
name: "cancel",
|
|
2733
|
+
describe: `Cancel a sale (--data '{"acknowledge_open_payment":true}' if the payment is still open)`,
|
|
2734
|
+
fn: postSalesIdCancel,
|
|
2735
|
+
body: true
|
|
2736
|
+
},
|
|
2099
2737
|
{
|
|
2100
2738
|
name: "refund",
|
|
2101
2739
|
describe: "Refund a sale (--data for partial amount)",
|
|
@@ -2233,10 +2871,18 @@ registerResource(program, {
|
|
|
2233
2871
|
body: true
|
|
2234
2872
|
}
|
|
2235
2873
|
],
|
|
2236
|
-
columns: ["id", "name", "email", "role"]
|
|
2874
|
+
columns: ["id", "name", "email", "role", "workspaceName"],
|
|
2875
|
+
listFlags: [
|
|
2876
|
+
{
|
|
2877
|
+
flag: "--workspace-ids <ids>",
|
|
2878
|
+
describe: "comma-separated workspace ids (max 25): staff of all of them in one call",
|
|
2879
|
+
query: "workspaceIds"
|
|
2880
|
+
}
|
|
2881
|
+
]
|
|
2237
2882
|
});
|
|
2238
2883
|
registerTickets(program);
|
|
2239
2884
|
registerReports(program);
|
|
2885
|
+
registerApiKeys(program);
|
|
2240
2886
|
registerAdmin(program);
|
|
2241
2887
|
if (process.argv.length <= 2) {
|
|
2242
2888
|
console.log(banner());
|