@freeticket/cli 0.1.1 → 0.4.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.
Files changed (2) hide show
  1. package/dist/index.js +1073 -61
  2. package/package.json +13 -4
package/dist/index.js CHANGED
@@ -6,9 +6,15 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@freeticket/cli",
9
- version: "0.1.1",
9
+ version: "0.4.0",
10
10
  description: "Official FreeTicket CLI \u2014 consumes the B2B REST API for events, sales, tickets, memberships, venues, staff, and reports.",
11
- keywords: ["freeticket", "cli", "ticketing", "events", "api"],
11
+ keywords: [
12
+ "freeticket",
13
+ "cli",
14
+ "ticketing",
15
+ "events",
16
+ "api"
17
+ ],
12
18
  homepage: "https://github.com/AppFreeticket/freeticket-cli#readme",
13
19
  bugs: "https://github.com/AppFreeticket/freeticket-cli/issues",
14
20
  repository: {
@@ -22,7 +28,9 @@ var package_default = {
22
28
  bin: {
23
29
  ft: "dist/index.js"
24
30
  },
25
- files: ["dist"],
31
+ files: [
32
+ "dist"
33
+ ],
26
34
  engines: {
27
35
  node: ">=20"
28
36
  },
@@ -32,8 +40,9 @@ var package_default = {
32
40
  scripts: {
33
41
  build: "tsup",
34
42
  dev: "tsup --watch",
35
- generate: "openapi-ts",
43
+ generate: "openapi-ts && openapi-ts -f openapi-ts.admin.config.ts",
36
44
  "sync-openapi": "tsx scripts/sync-openapi.ts",
45
+ "sync-openapi:admin": "FT_OPENAPI_URL=${FT_ADMIN_OPENAPI_URL:-https://admin.appfreeticket.com/api/admin/openapi.json} FT_OPENAPI_OUT=admin-openapi.json tsx scripts/sync-openapi.ts",
37
46
  lint: "biome check .",
38
47
  format: "biome check --write .",
39
48
  test: "vitest run",
@@ -61,7 +70,7 @@ var package_default = {
61
70
  // src/client/client.gen.ts
62
71
  import { createClient, createConfig } from "@hey-api/client-fetch";
63
72
  var client = createClient(createConfig({
64
- baseUrl: "http://localhost:3000/api/v1"
73
+ baseUrl: "https://admin.appfreeticket.com/api/v1"
65
74
  }));
66
75
 
67
76
  // src/client/sdk.gen.ts
@@ -89,6 +98,34 @@ var getEvents = (options) => {
89
98
  ...options
90
99
  });
91
100
  };
101
+ var postEvents = (options) => {
102
+ return (options.client ?? client).post({
103
+ security: [
104
+ {
105
+ name: "Authorization",
106
+ type: "apiKey"
107
+ }
108
+ ],
109
+ url: "/events",
110
+ ...options,
111
+ headers: {
112
+ "Content-Type": "application/json",
113
+ ...options?.headers
114
+ }
115
+ });
116
+ };
117
+ var deleteEventsId = (options) => {
118
+ return (options.client ?? client).delete({
119
+ security: [
120
+ {
121
+ name: "Authorization",
122
+ type: "apiKey"
123
+ }
124
+ ],
125
+ url: "/events/{id}",
126
+ ...options
127
+ });
128
+ };
92
129
  var getEventsId = (options) => {
93
130
  return (options.client ?? client).get({
94
131
  security: [
@@ -97,11 +134,419 @@ var getEventsId = (options) => {
97
134
  type: "apiKey"
98
135
  }
99
136
  ],
100
- url: "/events/{id}",
137
+ url: "/events/{id}",
138
+ ...options
139
+ });
140
+ };
141
+ var patchEventsId = (options) => {
142
+ return (options.client ?? client).patch({
143
+ security: [
144
+ {
145
+ name: "Authorization",
146
+ type: "apiKey"
147
+ }
148
+ ],
149
+ url: "/events/{id}",
150
+ ...options,
151
+ headers: {
152
+ "Content-Type": "application/json",
153
+ ...options?.headers
154
+ }
155
+ });
156
+ };
157
+ var postEventsIdPublish = (options) => {
158
+ return (options.client ?? client).post({
159
+ security: [
160
+ {
161
+ name: "Authorization",
162
+ type: "apiKey"
163
+ }
164
+ ],
165
+ url: "/events/{id}/publish",
166
+ ...options
167
+ });
168
+ };
169
+ var getEventsIdDates = (options) => {
170
+ return (options.client ?? client).get({
171
+ security: [
172
+ {
173
+ name: "Authorization",
174
+ type: "apiKey"
175
+ }
176
+ ],
177
+ url: "/events/{id}/dates",
178
+ ...options
179
+ });
180
+ };
181
+ var postEventsIdDates = (options) => {
182
+ return (options.client ?? client).post({
183
+ security: [
184
+ {
185
+ name: "Authorization",
186
+ type: "apiKey"
187
+ }
188
+ ],
189
+ url: "/events/{id}/dates",
190
+ ...options
191
+ });
192
+ };
193
+ var deleteEventsIdDatesDateId = (options) => {
194
+ return (options.client ?? client).delete({
195
+ security: [
196
+ {
197
+ name: "Authorization",
198
+ type: "apiKey"
199
+ }
200
+ ],
201
+ url: "/events/{id}/dates/{dateId}",
202
+ ...options
203
+ });
204
+ };
205
+ var patchEventsIdDatesDateId = (options) => {
206
+ return (options.client ?? client).patch({
207
+ security: [
208
+ {
209
+ name: "Authorization",
210
+ type: "apiKey"
211
+ }
212
+ ],
213
+ url: "/events/{id}/dates/{dateId}",
214
+ ...options
215
+ });
216
+ };
217
+ var getTicketTypes = (options) => {
218
+ return (options?.client ?? client).get({
219
+ security: [
220
+ {
221
+ name: "Authorization",
222
+ type: "apiKey"
223
+ }
224
+ ],
225
+ url: "/ticket-types",
226
+ ...options
227
+ });
228
+ };
229
+ var postTicketTypes = (options) => {
230
+ return (options.client ?? client).post({
231
+ security: [
232
+ {
233
+ name: "Authorization",
234
+ type: "apiKey"
235
+ }
236
+ ],
237
+ url: "/ticket-types",
238
+ ...options,
239
+ headers: {
240
+ "Content-Type": "application/json",
241
+ ...options?.headers
242
+ }
243
+ });
244
+ };
245
+ var deleteTicketTypesId = (options) => {
246
+ return (options.client ?? client).delete({
247
+ security: [
248
+ {
249
+ name: "Authorization",
250
+ type: "apiKey"
251
+ }
252
+ ],
253
+ url: "/ticket-types/{id}",
254
+ ...options
255
+ });
256
+ };
257
+ var getTicketTypesId = (options) => {
258
+ return (options.client ?? client).get({
259
+ security: [
260
+ {
261
+ name: "Authorization",
262
+ type: "apiKey"
263
+ }
264
+ ],
265
+ url: "/ticket-types/{id}",
266
+ ...options
267
+ });
268
+ };
269
+ var patchTicketTypesId = (options) => {
270
+ return (options.client ?? client).patch({
271
+ security: [
272
+ {
273
+ name: "Authorization",
274
+ type: "apiKey"
275
+ }
276
+ ],
277
+ url: "/ticket-types/{id}",
278
+ ...options
279
+ });
280
+ };
281
+ var getSales = (options) => {
282
+ return (options?.client ?? client).get({
283
+ security: [
284
+ {
285
+ name: "Authorization",
286
+ type: "apiKey"
287
+ }
288
+ ],
289
+ url: "/sales",
290
+ ...options
291
+ });
292
+ };
293
+ var getSalesId = (options) => {
294
+ return (options.client ?? client).get({
295
+ security: [
296
+ {
297
+ name: "Authorization",
298
+ type: "apiKey"
299
+ }
300
+ ],
301
+ url: "/sales/{id}",
302
+ ...options
303
+ });
304
+ };
305
+ var postSalesIdCancel = (options) => {
306
+ return (options.client ?? client).post({
307
+ security: [
308
+ {
309
+ name: "Authorization",
310
+ type: "apiKey"
311
+ }
312
+ ],
313
+ url: "/sales/{id}/cancel",
314
+ ...options
315
+ });
316
+ };
317
+ var postSalesIdRefund = (options) => {
318
+ return (options.client ?? client).post({
319
+ security: [
320
+ {
321
+ name: "Authorization",
322
+ type: "apiKey"
323
+ }
324
+ ],
325
+ url: "/sales/{id}/refund",
326
+ ...options
327
+ });
328
+ };
329
+ var getMembershipPlans = (options) => {
330
+ return (options?.client ?? client).get({
331
+ security: [
332
+ {
333
+ name: "Authorization",
334
+ type: "apiKey"
335
+ }
336
+ ],
337
+ url: "/membership-plans",
338
+ ...options
339
+ });
340
+ };
341
+ var postMembershipPlans = (options) => {
342
+ return (options.client ?? client).post({
343
+ security: [
344
+ {
345
+ name: "Authorization",
346
+ type: "apiKey"
347
+ }
348
+ ],
349
+ url: "/membership-plans",
350
+ ...options,
351
+ headers: {
352
+ "Content-Type": "application/json",
353
+ ...options?.headers
354
+ }
355
+ });
356
+ };
357
+ var deleteMembershipPlansId = (options) => {
358
+ return (options.client ?? client).delete({
359
+ security: [
360
+ {
361
+ name: "Authorization",
362
+ type: "apiKey"
363
+ }
364
+ ],
365
+ url: "/membership-plans/{id}",
366
+ ...options
367
+ });
368
+ };
369
+ var getMembershipPlansId = (options) => {
370
+ return (options.client ?? client).get({
371
+ security: [
372
+ {
373
+ name: "Authorization",
374
+ type: "apiKey"
375
+ }
376
+ ],
377
+ url: "/membership-plans/{id}",
378
+ ...options
379
+ });
380
+ };
381
+ var patchMembershipPlansId = (options) => {
382
+ return (options.client ?? client).patch({
383
+ security: [
384
+ {
385
+ name: "Authorization",
386
+ type: "apiKey"
387
+ }
388
+ ],
389
+ url: "/membership-plans/{id}",
390
+ ...options
391
+ });
392
+ };
393
+ var getVenues = (options) => {
394
+ return (options?.client ?? client).get({
395
+ security: [
396
+ {
397
+ name: "Authorization",
398
+ type: "apiKey"
399
+ }
400
+ ],
401
+ url: "/venues",
402
+ ...options
403
+ });
404
+ };
405
+ var postVenues = (options) => {
406
+ return (options.client ?? client).post({
407
+ security: [
408
+ {
409
+ name: "Authorization",
410
+ type: "apiKey"
411
+ }
412
+ ],
413
+ url: "/venues",
414
+ ...options,
415
+ headers: {
416
+ "Content-Type": "application/json",
417
+ ...options?.headers
418
+ }
419
+ });
420
+ };
421
+ var deleteVenuesId = (options) => {
422
+ return (options.client ?? client).delete({
423
+ security: [
424
+ {
425
+ name: "Authorization",
426
+ type: "apiKey"
427
+ }
428
+ ],
429
+ url: "/venues/{id}",
430
+ ...options
431
+ });
432
+ };
433
+ var getVenuesId = (options) => {
434
+ return (options.client ?? client).get({
435
+ security: [
436
+ {
437
+ name: "Authorization",
438
+ type: "apiKey"
439
+ }
440
+ ],
441
+ url: "/venues/{id}",
442
+ ...options
443
+ });
444
+ };
445
+ var patchVenuesId = (options) => {
446
+ return (options.client ?? client).patch({
447
+ security: [
448
+ {
449
+ name: "Authorization",
450
+ type: "apiKey"
451
+ }
452
+ ],
453
+ url: "/venues/{id}",
454
+ ...options
455
+ });
456
+ };
457
+ var getStaff = (options) => {
458
+ return (options?.client ?? client).get({
459
+ security: [
460
+ {
461
+ name: "Authorization",
462
+ type: "apiKey"
463
+ }
464
+ ],
465
+ url: "/staff",
466
+ ...options
467
+ });
468
+ };
469
+ var postStaff = (options) => {
470
+ return (options.client ?? client).post({
471
+ security: [
472
+ {
473
+ name: "Authorization",
474
+ type: "apiKey"
475
+ }
476
+ ],
477
+ url: "/staff",
478
+ ...options,
479
+ headers: {
480
+ "Content-Type": "application/json",
481
+ ...options?.headers
482
+ }
483
+ });
484
+ };
485
+ var patchStaffIdRole = (options) => {
486
+ return (options.client ?? client).patch({
487
+ security: [
488
+ {
489
+ name: "Authorization",
490
+ type: "apiKey"
491
+ }
492
+ ],
493
+ url: "/staff/{id}/role",
494
+ ...options,
495
+ headers: {
496
+ "Content-Type": "application/json",
497
+ ...options?.headers
498
+ }
499
+ });
500
+ };
501
+ var getReportsSummary = (options) => {
502
+ return (options?.client ?? client).get({
503
+ security: [
504
+ {
505
+ name: "Authorization",
506
+ type: "apiKey"
507
+ }
508
+ ],
509
+ url: "/reports/summary",
510
+ ...options
511
+ });
512
+ };
513
+ var getReportsReconciliation = (options) => {
514
+ return (options.client ?? client).get({
515
+ security: [
516
+ {
517
+ name: "Authorization",
518
+ type: "apiKey"
519
+ }
520
+ ],
521
+ url: "/reports/reconciliation",
522
+ ...options
523
+ });
524
+ };
525
+ var getReportsExportsReconciliation = (options) => {
526
+ return (options.client ?? client).get({
527
+ security: [
528
+ {
529
+ name: "Authorization",
530
+ type: "apiKey"
531
+ }
532
+ ],
533
+ url: "/reports/exports/reconciliation",
534
+ ...options
535
+ });
536
+ };
537
+ var getReportsExportsBuyers = (options) => {
538
+ return (options?.client ?? client).get({
539
+ security: [
540
+ {
541
+ name: "Authorization",
542
+ type: "apiKey"
543
+ }
544
+ ],
545
+ url: "/reports/exports/buyers",
101
546
  ...options
102
547
  });
103
548
  };
104
- var getTicketTypes = (options) => {
549
+ var getReportsExportsSubscribers = (options) => {
105
550
  return (options?.client ?? client).get({
106
551
  security: [
107
552
  {
@@ -109,145 +554,293 @@ var getTicketTypes = (options) => {
109
554
  type: "apiKey"
110
555
  }
111
556
  ],
112
- url: "/ticket-types",
557
+ url: "/reports/exports/subscribers",
113
558
  ...options
114
559
  });
115
560
  };
116
- var getTicketTypesId = (options) => {
117
- return (options.client ?? client).get({
561
+
562
+ // src/admin-client/client.gen.ts
563
+ import { createClient as createClient2, createConfig as createConfig2 } from "@hey-api/client-fetch";
564
+ var client2 = createClient2(createConfig2({
565
+ baseUrl: "https://admin.appfreeticket.com/api/admin"
566
+ }));
567
+
568
+ // src/admin-client/sdk.gen.ts
569
+ var getMe2 = (options) => {
570
+ return (options?.client ?? client2).get({
118
571
  security: [
119
572
  {
120
- name: "Authorization",
573
+ in: "cookie",
574
+ name: "better-auth.session_token",
121
575
  type: "apiKey"
122
576
  }
123
577
  ],
124
- url: "/ticket-types/{id}",
578
+ url: "/me",
125
579
  ...options
126
580
  });
127
581
  };
128
- var getSales = (options) => {
129
- return (options?.client ?? client).get({
582
+ var getWorkspaces = (options) => {
583
+ return (options?.client ?? client2).get({
130
584
  security: [
131
585
  {
132
- name: "Authorization",
586
+ in: "cookie",
587
+ name: "better-auth.session_token",
133
588
  type: "apiKey"
134
589
  }
135
590
  ],
136
- url: "/sales",
591
+ url: "/workspaces",
137
592
  ...options
138
593
  });
139
594
  };
140
- var getSalesId = (options) => {
141
- return (options.client ?? client).get({
595
+ var postWorkspaces = (options) => {
596
+ return (options.client ?? client2).post({
142
597
  security: [
143
598
  {
144
- name: "Authorization",
599
+ in: "cookie",
600
+ name: "better-auth.session_token",
145
601
  type: "apiKey"
146
602
  }
147
603
  ],
148
- url: "/sales/{id}",
604
+ url: "/workspaces",
605
+ ...options,
606
+ headers: {
607
+ "Content-Type": "application/json",
608
+ ...options?.headers
609
+ }
610
+ });
611
+ };
612
+ var getWorkspacesId = (options) => {
613
+ return (options.client ?? client2).get({
614
+ security: [
615
+ {
616
+ in: "cookie",
617
+ name: "better-auth.session_token",
618
+ type: "apiKey"
619
+ }
620
+ ],
621
+ url: "/workspaces/{id}",
149
622
  ...options
150
623
  });
151
624
  };
152
- var getMembershipPlans = (options) => {
153
- return (options?.client ?? client).get({
625
+ var patchWorkspacesId = (options) => {
626
+ return (options.client ?? client2).patch({
154
627
  security: [
155
628
  {
156
- name: "Authorization",
629
+ in: "cookie",
630
+ name: "better-auth.session_token",
157
631
  type: "apiKey"
158
632
  }
159
633
  ],
160
- url: "/membership-plans",
634
+ url: "/workspaces/{id}",
635
+ ...options,
636
+ headers: {
637
+ "Content-Type": "application/json",
638
+ ...options?.headers
639
+ }
640
+ });
641
+ };
642
+ var postWorkspacesIdSuspend = (options) => {
643
+ return (options.client ?? client2).post({
644
+ security: [
645
+ {
646
+ in: "cookie",
647
+ name: "better-auth.session_token",
648
+ type: "apiKey"
649
+ }
650
+ ],
651
+ url: "/workspaces/{id}/suspend",
161
652
  ...options
162
653
  });
163
654
  };
164
- var getMembershipPlansId = (options) => {
165
- return (options.client ?? client).get({
655
+ var postWorkspacesIdRestore = (options) => {
656
+ return (options.client ?? client2).post({
166
657
  security: [
167
658
  {
168
- name: "Authorization",
659
+ in: "cookie",
660
+ name: "better-auth.session_token",
169
661
  type: "apiKey"
170
662
  }
171
663
  ],
172
- url: "/membership-plans/{id}",
664
+ url: "/workspaces/{id}/restore",
173
665
  ...options
174
666
  });
175
667
  };
176
- var getVenues = (options) => {
177
- return (options?.client ?? client).get({
668
+ var getUsers = (options) => {
669
+ return (options?.client ?? client2).get({
178
670
  security: [
179
671
  {
180
- name: "Authorization",
672
+ in: "cookie",
673
+ name: "better-auth.session_token",
181
674
  type: "apiKey"
182
675
  }
183
676
  ],
184
- url: "/venues",
677
+ url: "/users",
185
678
  ...options
186
679
  });
187
680
  };
188
- var getVenuesId = (options) => {
189
- return (options.client ?? client).get({
681
+ var getUsersId = (options) => {
682
+ return (options.client ?? client2).get({
190
683
  security: [
191
684
  {
192
- name: "Authorization",
685
+ in: "cookie",
686
+ name: "better-auth.session_token",
193
687
  type: "apiKey"
194
688
  }
195
689
  ],
196
- url: "/venues/{id}",
690
+ url: "/users/{id}",
197
691
  ...options
198
692
  });
199
693
  };
200
- var getStaff = (options) => {
201
- return (options?.client ?? client).get({
694
+ var patchUsersId = (options) => {
695
+ return (options.client ?? client2).patch({
202
696
  security: [
203
697
  {
204
- name: "Authorization",
698
+ in: "cookie",
699
+ name: "better-auth.session_token",
205
700
  type: "apiKey"
206
701
  }
207
702
  ],
208
- url: "/staff",
703
+ url: "/users/{id}",
704
+ ...options,
705
+ headers: {
706
+ "Content-Type": "application/json",
707
+ ...options?.headers
708
+ }
709
+ });
710
+ };
711
+ var postImpersonate = (options) => {
712
+ return (options.client ?? client2).post({
713
+ security: [
714
+ {
715
+ in: "cookie",
716
+ name: "better-auth.session_token",
717
+ type: "apiKey"
718
+ }
719
+ ],
720
+ url: "/impersonate",
721
+ ...options,
722
+ headers: {
723
+ "Content-Type": "application/json",
724
+ ...options?.headers
725
+ }
726
+ });
727
+ };
728
+ var postImpersonateStop = (options) => {
729
+ return (options?.client ?? client2).post({
730
+ security: [
731
+ {
732
+ in: "cookie",
733
+ name: "better-auth.session_token",
734
+ type: "apiKey"
735
+ }
736
+ ],
737
+ url: "/impersonate/stop",
209
738
  ...options
210
739
  });
211
740
  };
212
- var getReportsSummary = (options) => {
213
- return (options?.client ?? client).get({
741
+ var getPlatformPlans = (options) => {
742
+ return (options?.client ?? client2).get({
214
743
  security: [
215
744
  {
216
- name: "Authorization",
745
+ in: "cookie",
746
+ name: "better-auth.session_token",
217
747
  type: "apiKey"
218
748
  }
219
749
  ],
220
- url: "/reports/summary",
750
+ url: "/platform-plans",
221
751
  ...options
222
752
  });
223
753
  };
224
- var getReportsExportsBuyers = (options) => {
225
- return (options?.client ?? client).get({
754
+ var postPlatformPlans = (options) => {
755
+ return (options.client ?? client2).post({
226
756
  security: [
227
757
  {
228
- name: "Authorization",
758
+ in: "cookie",
759
+ name: "better-auth.session_token",
229
760
  type: "apiKey"
230
761
  }
231
762
  ],
232
- url: "/reports/exports/buyers",
763
+ url: "/platform-plans",
764
+ ...options,
765
+ headers: {
766
+ "Content-Type": "application/json",
767
+ ...options?.headers
768
+ }
769
+ });
770
+ };
771
+ var getPlatformPlansId = (options) => {
772
+ return (options.client ?? client2).get({
773
+ security: [
774
+ {
775
+ in: "cookie",
776
+ name: "better-auth.session_token",
777
+ type: "apiKey"
778
+ }
779
+ ],
780
+ url: "/platform-plans/{id}",
233
781
  ...options
234
782
  });
235
783
  };
236
- var getReportsExportsSubscribers = (options) => {
237
- return (options?.client ?? client).get({
784
+ var patchPlatformPlansId = (options) => {
785
+ return (options.client ?? client2).patch({
238
786
  security: [
239
787
  {
240
- name: "Authorization",
788
+ in: "cookie",
789
+ name: "better-auth.session_token",
241
790
  type: "apiKey"
242
791
  }
243
792
  ],
244
- url: "/reports/exports/subscribers",
793
+ url: "/platform-plans/{id}",
794
+ ...options,
795
+ headers: {
796
+ "Content-Type": "application/json",
797
+ ...options?.headers
798
+ }
799
+ });
800
+ };
801
+ var getFeatureFlags = (options) => {
802
+ return (options?.client ?? client2).get({
803
+ security: [
804
+ {
805
+ in: "cookie",
806
+ name: "better-auth.session_token",
807
+ type: "apiKey"
808
+ }
809
+ ],
810
+ url: "/feature-flags",
811
+ ...options
812
+ });
813
+ };
814
+ var putFeatureFlagsKey = (options) => {
815
+ return (options.client ?? client2).put({
816
+ security: [
817
+ {
818
+ in: "cookie",
819
+ name: "better-auth.session_token",
820
+ type: "apiKey"
821
+ }
822
+ ],
823
+ url: "/feature-flags/{key}",
824
+ ...options,
825
+ headers: {
826
+ "Content-Type": "application/json",
827
+ ...options?.headers
828
+ }
829
+ });
830
+ };
831
+ var getAuditLog = (options) => {
832
+ return (options?.client ?? client2).get({
833
+ security: [
834
+ {
835
+ in: "cookie",
836
+ name: "better-auth.session_token",
837
+ type: "apiKey"
838
+ }
839
+ ],
840
+ url: "/audit-log",
245
841
  ...options
246
842
  });
247
843
  };
248
-
249
- // src/commands/auth.ts
250
- import chalk2 from "chalk";
251
844
 
252
845
  // src/lib/config.ts
253
846
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -269,7 +862,8 @@ function loadConfig() {
269
862
  return {
270
863
  apiUrl: process.env.FT_API_URL ?? file.apiUrl ?? DEFAULT_API_URL,
271
864
  apiKey: process.env.FT_API_KEY ?? file.apiKey,
272
- workspaceId: process.env.FT_WORKSPACE_ID ?? file.workspaceId
865
+ workspaceId: process.env.FT_WORKSPACE_ID ?? file.workspaceId,
866
+ adminSession: process.env.FT_ADMIN_SESSION ?? file.adminSession
273
867
  };
274
868
  }
275
869
  function saveConfig(patch) {
@@ -296,6 +890,21 @@ function configureClient(workspaceOverride) {
296
890
  }
297
891
  });
298
892
  }
893
+ function configureAdminClient() {
894
+ const cfg = loadConfig();
895
+ if (!cfg.adminSession) {
896
+ fail(
897
+ "No superadmin session. Export FT_ADMIN_SESSION with a SUPER_ADMIN better-auth session token.",
898
+ "Log in to the admin panel in your browser and copy the `better-auth.session_token` cookie."
899
+ );
900
+ }
901
+ client2.setConfig({
902
+ baseUrl: `${cfg.apiUrl.replace(/\/$/, "")}/api/admin`,
903
+ headers: {
904
+ Cookie: `better-auth.session_token=${cfg.adminSession}`
905
+ }
906
+ });
907
+ }
299
908
  function unwrap(res) {
300
909
  if (res.data !== void 0) return res.data;
301
910
  const status = res.response?.status;
@@ -331,6 +940,44 @@ ${hint}`);
331
940
  process.exit(1);
332
941
  }
333
942
 
943
+ // src/lib/input.ts
944
+ import { readFileSync as readFileSync2 } from "fs";
945
+ import * as readline from "readline";
946
+ function parseData(input) {
947
+ if (!input) {
948
+ fail(
949
+ "Missing --data. Pass inline JSON or @path/to/file.json.",
950
+ `Example: --data '{"name":"My event"}' or --data @event.json`
951
+ );
952
+ }
953
+ let raw = input;
954
+ if (raw.startsWith("@")) {
955
+ try {
956
+ raw = readFileSync2(raw.slice(1), "utf8");
957
+ } catch {
958
+ fail(`Cannot read file: ${raw.slice(1)}`);
959
+ }
960
+ }
961
+ try {
962
+ return JSON.parse(raw);
963
+ } catch {
964
+ return fail("Invalid JSON in --data.");
965
+ }
966
+ }
967
+ function confirm(question) {
968
+ if (!process.stdin.isTTY) return Promise.resolve(false);
969
+ const rl = readline.createInterface({
970
+ input: process.stdin,
971
+ output: process.stderr
972
+ });
973
+ return new Promise((resolve) => {
974
+ rl.question(`${question} [y/N] `, (answer) => {
975
+ rl.close();
976
+ resolve(/^y(es)?$/i.test(answer.trim()));
977
+ });
978
+ });
979
+ }
980
+
334
981
  // src/lib/output.ts
335
982
  import chalk from "chalk";
336
983
  import Table from "cli-table3";
@@ -356,6 +1003,20 @@ function print(data, opts = {}) {
356
1003
  process.stdout.write(`${JSON.stringify(data, null, 2)}
357
1004
  `);
358
1005
  }
1006
+ function toCsv(rows, columns) {
1007
+ if (!Array.isArray(rows) || rows.length === 0) return "";
1008
+ const cols = columns ?? Object.keys(rows[0]);
1009
+ const esc = (v) => {
1010
+ if (v === null || v === void 0) return "";
1011
+ const s = typeof v === "object" ? JSON.stringify(v) : String(v);
1012
+ return /[",\n\r]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s;
1013
+ };
1014
+ const head = cols.map(esc).join(",");
1015
+ const body = rows.map(
1016
+ (r) => cols.map((c2) => esc(r[c2])).join(",")
1017
+ );
1018
+ return [head, ...body].join("\n");
1019
+ }
359
1020
  function printNextCursor(page) {
360
1021
  if (page?.nextCursor) {
361
1022
  console.error(chalk.dim(`
@@ -371,7 +1032,194 @@ function fmt(v) {
371
1032
  return String(v);
372
1033
  }
373
1034
 
1035
+ // src/commands/admin.ts
1036
+ function registerAdmin(program2) {
1037
+ const admin = program2.command("admin").description("Superadmin (cross-tenant) \u2014 requires FT_ADMIN_SESSION");
1038
+ admin.command("me").description("Current superadmin identity (GET /api/admin/me)").option("--json", "raw JSON output").action(async (opts) => {
1039
+ configureAdminClient();
1040
+ const body = unwrap(await getMe2({}));
1041
+ print(body.data, { json: opts.json });
1042
+ });
1043
+ admin.command("impersonate").description(`Start impersonation (--data '{"targetUserId":"..."}')`).requiredOption("--data <json>", "JSON body (inline or @file.json)").option("--json", "raw JSON output").action(async (opts) => {
1044
+ configureAdminClient();
1045
+ const body = unwrap(
1046
+ await postImpersonate({ body: parseData(opts.data) })
1047
+ );
1048
+ print(body?.data ?? body, { json: opts.json });
1049
+ });
1050
+ admin.command("impersonate-stop").description("Stop the current impersonation").option("--json", "raw JSON output").action(async (opts) => {
1051
+ configureAdminClient();
1052
+ const body = unwrap(await postImpersonateStop({}));
1053
+ print(body?.data ?? { ok: true }, { json: opts.json });
1054
+ });
1055
+ const resources = [
1056
+ {
1057
+ name: "workspaces",
1058
+ describe: "Tenants / workspaces",
1059
+ list: getWorkspaces,
1060
+ get: getWorkspacesId,
1061
+ create: postWorkspaces,
1062
+ update: patchWorkspacesId,
1063
+ actions: [
1064
+ {
1065
+ name: "suspend",
1066
+ describe: "Suspend a workspace",
1067
+ fn: postWorkspacesIdSuspend,
1068
+ confirm: true
1069
+ },
1070
+ {
1071
+ name: "restore",
1072
+ describe: "Restore a suspended workspace",
1073
+ fn: postWorkspacesIdRestore
1074
+ }
1075
+ ],
1076
+ columns: ["id", "name", "type", "country", "suspended", "createdAt"],
1077
+ listFlags: [
1078
+ { flag: "--status <s>", describe: "filter by status", query: "status" },
1079
+ { flag: "--q <text>", describe: "search by name/slug", query: "q" }
1080
+ ]
1081
+ },
1082
+ {
1083
+ name: "users",
1084
+ describe: "Global users (cross-tenant)",
1085
+ list: getUsers,
1086
+ get: getUsersId,
1087
+ update: patchUsersId,
1088
+ columns: ["id", "name", "email", "role", "banned", "createdAt"],
1089
+ listFlags: [
1090
+ { flag: "--q <text>", describe: "search by name/email", query: "q" },
1091
+ { flag: "--role <r>", describe: "filter by role", query: "role" },
1092
+ {
1093
+ flag: "--workspace <id>",
1094
+ describe: "filter by workspace",
1095
+ query: "workspaceId"
1096
+ }
1097
+ ]
1098
+ },
1099
+ {
1100
+ name: "plans",
1101
+ describe: "Platform plans",
1102
+ list: getPlatformPlans,
1103
+ get: getPlatformPlansId,
1104
+ create: postPlatformPlans,
1105
+ update: patchPlatformPlansId,
1106
+ columns: ["id", "name", "price", "currency", "interval"]
1107
+ },
1108
+ {
1109
+ name: "feature-flags",
1110
+ describe: "Feature flags",
1111
+ list: getFeatureFlags,
1112
+ actions: [
1113
+ {
1114
+ name: "set",
1115
+ describe: `Set a flag (--data '{"scope":"...","enabled":true}')`,
1116
+ fn: putFeatureFlagsKey,
1117
+ body: true,
1118
+ param: "key"
1119
+ }
1120
+ ],
1121
+ columns: ["key", "enabled", "description"],
1122
+ noPaging: true
1123
+ },
1124
+ {
1125
+ name: "audit-log",
1126
+ describe: "Superadmin audit log",
1127
+ list: getAuditLog,
1128
+ columns: ["id", "actorId", "action", "targetType", "createdAt"],
1129
+ listFlags: [
1130
+ { flag: "--actor <id>", describe: "filter by actor", query: "actorId" },
1131
+ { flag: "--action <a>", describe: "filter by action", query: "action" },
1132
+ { flag: "--from <date>", describe: "from (ISO 8601)", query: "from" },
1133
+ { flag: "--to <date>", describe: "to (ISO 8601)", query: "to" }
1134
+ ]
1135
+ }
1136
+ ];
1137
+ for (const spec of resources) registerAdminResource(admin, spec);
1138
+ }
1139
+ function registerAdminResource(parent, spec) {
1140
+ const root = parent.command(spec.name).description(spec.describe);
1141
+ const singular = spec.name.replace(/s$/, "");
1142
+ if (spec.list) {
1143
+ const list = spec.list;
1144
+ const cmd = root.command("list").description(`List ${spec.name}`);
1145
+ if (!spec.noPaging) {
1146
+ cmd.option("--limit <n>", "results per page (1-100)", "20").option("--cursor <id>", "pagination cursor");
1147
+ }
1148
+ for (const f of spec.listFlags ?? []) cmd.option(f.flag, f.describe);
1149
+ cmd.option("--csv", "CSV output");
1150
+ cmd.option("--json", "raw JSON output");
1151
+ cmd.action(async (opts) => {
1152
+ configureAdminClient();
1153
+ const query = {};
1154
+ if (!spec.noPaging) {
1155
+ query.limit = Number(opts.limit);
1156
+ query.cursor = opts.cursor;
1157
+ }
1158
+ for (const f of spec.listFlags ?? []) {
1159
+ const v = opts[camel(f.query)];
1160
+ if (v !== void 0) query[f.query] = v;
1161
+ }
1162
+ const body = unwrap(await list({ query }));
1163
+ if (opts.csv) {
1164
+ process.stdout.write(`${toCsv(body.data, spec.columns)}
1165
+ `);
1166
+ return;
1167
+ }
1168
+ print(body.data, { json: opts.json, columns: spec.columns });
1169
+ if (!opts.json && !spec.noPaging) printNextCursor(body.page);
1170
+ });
1171
+ }
1172
+ if (spec.get) {
1173
+ const get = spec.get;
1174
+ root.command("get <id>").description(`Get one ${singular} by id`).option("--json", "raw JSON output").action(async (id, opts) => {
1175
+ configureAdminClient();
1176
+ const body = unwrap(await get({ path: { id } }));
1177
+ print(body.data, { json: opts.json });
1178
+ });
1179
+ }
1180
+ if (spec.create) {
1181
+ const create = spec.create;
1182
+ root.command("create").description(`Create a ${singular}`).requiredOption("--data <json>", "JSON body (inline or @file.json)").option("--json", "raw JSON output").action(async (opts) => {
1183
+ configureAdminClient();
1184
+ const body = unwrap(await create({ body: parseData(opts.data) }));
1185
+ print(body?.data ?? body, { json: opts.json });
1186
+ });
1187
+ }
1188
+ if (spec.update) {
1189
+ const update = spec.update;
1190
+ root.command("update <id>").description(`Update a ${singular} by id`).requiredOption("--data <json>", "JSON body (inline or @file.json)").option("--json", "raw JSON output").action(async (id, opts) => {
1191
+ configureAdminClient();
1192
+ const body = unwrap(
1193
+ await update({ path: { id }, body: parseData(opts.data) })
1194
+ );
1195
+ print(body?.data ?? body, { json: opts.json });
1196
+ });
1197
+ }
1198
+ for (const action of spec.actions ?? []) {
1199
+ const param = action.param ?? "id";
1200
+ const cmd = root.command(`${action.name} <${param}>`).description(action.describe).option("--yes", "skip confirmation").option("--json", "raw JSON output");
1201
+ if (action.body) {
1202
+ cmd.option("--data <json>", "JSON body (inline or @file.json)");
1203
+ }
1204
+ cmd.action(async (value, opts) => {
1205
+ if (action.confirm && !opts.yes && !await confirm(`${action.name} ${singular} ${value}?`)) {
1206
+ console.error("Aborted.");
1207
+ return;
1208
+ }
1209
+ configureAdminClient();
1210
+ const payload = { path: { [param]: value } };
1211
+ if (action.body && opts.data) payload.body = parseData(opts.data);
1212
+ const body = unwrap(await action.fn(payload));
1213
+ print(body?.data ?? body ?? { ok: true }, { json: opts.json });
1214
+ });
1215
+ }
1216
+ }
1217
+ function camel(s) {
1218
+ return s.replace(/-([a-z])/g, (_, c2) => c2.toUpperCase());
1219
+ }
1220
+
374
1221
  // src/commands/auth.ts
1222
+ import chalk2 from "chalk";
375
1223
  function registerAuth(program2) {
376
1224
  program2.command("login").description("Store the API key and workspace in ~/.freeticket/config.json").requiredOption(
377
1225
  "--key <ft_live_\u2026>",
@@ -416,6 +1264,48 @@ function registerAuth(program2) {
416
1264
  });
417
1265
  }
418
1266
 
1267
+ // src/commands/event-dates.ts
1268
+ function registerEventDates(program2, spec) {
1269
+ const root = program2.command("event-dates").description("Event dates (sessions of an event)");
1270
+ root.command("list <eventId>").description("List dates of an event").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (eventId, opts) => {
1271
+ configureClient(opts.workspace);
1272
+ const body = unwrap(await spec.list({ path: { id: eventId } }));
1273
+ print(body.data ?? body, {
1274
+ json: opts.json,
1275
+ columns: ["id", "startsAt", "endsAt", "status"]
1276
+ });
1277
+ });
1278
+ root.command("create <eventId>").description("Add a date to an event").requiredOption("--data <json>", "JSON body (inline or @file.json)").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (eventId, opts) => {
1279
+ configureClient(opts.workspace);
1280
+ const body = unwrap(
1281
+ await spec.create({
1282
+ path: { id: eventId },
1283
+ body: parseData(opts.data)
1284
+ })
1285
+ );
1286
+ print(body.data ?? body, { json: opts.json });
1287
+ });
1288
+ root.command("update <eventId> <dateId>").description("Update an event date").requiredOption("--data <json>", "JSON body (inline or @file.json)").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (eventId, dateId, opts) => {
1289
+ configureClient(opts.workspace);
1290
+ const body = unwrap(
1291
+ await spec.update({
1292
+ path: { id: eventId, dateId },
1293
+ body: parseData(opts.data)
1294
+ })
1295
+ );
1296
+ print(body.data ?? body, { json: opts.json });
1297
+ });
1298
+ 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) => {
1299
+ if (!opts.yes && !await confirm(`Delete date ${dateId}?`)) {
1300
+ console.error("Aborted.");
1301
+ return;
1302
+ }
1303
+ configureClient(opts.workspace);
1304
+ const body = unwrap(await spec.del({ path: { id: eventId, dateId } }));
1305
+ print(body?.data ?? { deleted: dateId }, { json: opts.json });
1306
+ });
1307
+ }
1308
+
419
1309
  // src/commands/reports.ts
420
1310
  function registerReports(program2) {
421
1311
  const root = program2.command("reports").description("KPIs and exports");
@@ -426,7 +1316,40 @@ function registerReports(program2) {
426
1316
  );
427
1317
  print(body.data, { json: opts.json });
428
1318
  });
429
- const exp = root.command("export").description("Export buyers or subscribers (CSV)");
1319
+ root.command("reconciliation").description("CFO reconciliation: Mercado Pago vs sale vs Siigo invoice").requiredOption("--from <date>", "date_from (ISO 8601)").requiredOption("--to <date>", "date_to (ISO 8601)").option(
1320
+ "--match <status>",
1321
+ "OK | MISSING_INVOICE | MISSING_CUFE | AMOUNT_MISMATCH | MISSING_PAYMENT"
1322
+ ).option("--provider <p>", "filter by payment provider").option("--page <n>", "page number").option("--page-size <n>", "rows per page").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (opts) => {
1323
+ configureClient(opts.workspace);
1324
+ const body = unwrap(
1325
+ await getReportsReconciliation({
1326
+ query: {
1327
+ date_from: opts.from,
1328
+ date_to: opts.to,
1329
+ match_status: opts.match,
1330
+ provider: opts.provider,
1331
+ page: opts.page,
1332
+ page_size: opts.pageSize
1333
+ }
1334
+ })
1335
+ );
1336
+ print(body.data, { json: opts.json });
1337
+ });
1338
+ const exp = root.command("export").description("Export buyers, subscribers or reconciliation (CSV)");
1339
+ 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) => {
1340
+ configureClient(opts.workspace);
1341
+ const body = unwrap(
1342
+ await getReportsExportsReconciliation({
1343
+ query: {
1344
+ date_from: opts.from,
1345
+ date_to: opts.to,
1346
+ match_status: opts.match,
1347
+ provider: opts.provider
1348
+ }
1349
+ })
1350
+ );
1351
+ print(body.data ?? body, { json: opts.json });
1352
+ });
430
1353
  for (const [name, fn, label] of [
431
1354
  ["buyers", getReportsExportsBuyers, "buyers"],
432
1355
  ["subscribers", getReportsExportsSubscribers, "subscribers"]
@@ -442,9 +1365,10 @@ function registerReports(program2) {
442
1365
  // src/commands/resource.ts
443
1366
  function registerResource(program2, spec) {
444
1367
  const root = program2.command(spec.name).description(spec.describe);
1368
+ const singular = spec.name.replace(/s$/, "");
445
1369
  if (spec.list) {
446
1370
  const list = spec.list;
447
- const cmd = root.command("list").description(`List ${spec.name} from the active workspace`).option("--limit <n>", "results per page (1-100)", "20").option("--cursor <id>", "pagination cursor").option("--workspace <id>", "workspace override").option("--json", "raw JSON output");
1371
+ const cmd = root.command("list").description(`List ${spec.name} from the active workspace`).option("--limit <n>", "results per page (1-100)", "20").option("--cursor <id>", "pagination cursor").option("--workspace <id>", "workspace override").option("--csv", "CSV output (for spreadsheets/accounting)").option("--json", "raw JSON output");
448
1372
  for (const f of spec.listFlags ?? []) cmd.option(f.flag, f.describe);
449
1373
  cmd.action(async (opts) => {
450
1374
  configureClient(opts.workspace);
@@ -453,24 +1377,72 @@ function registerResource(program2, spec) {
453
1377
  cursor: opts.cursor
454
1378
  };
455
1379
  for (const f of spec.listFlags ?? []) {
456
- const v = opts[camel(f.query)];
1380
+ const v = opts[camel2(f.query)];
457
1381
  if (v !== void 0) query[f.query] = v;
458
1382
  }
459
1383
  const body = unwrap(await list({ query }));
1384
+ if (opts.csv) {
1385
+ process.stdout.write(`${toCsv(body.data, spec.columns)}
1386
+ `);
1387
+ return;
1388
+ }
460
1389
  print(body.data, { json: opts.json, columns: spec.columns });
461
1390
  if (!opts.json) printNextCursor(body.page);
462
1391
  });
463
1392
  }
464
1393
  if (spec.get) {
465
1394
  const get = spec.get;
466
- root.command("get <id>").description(`Get one ${spec.name.replace(/s$/, "")} by id`).option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (id, opts) => {
1395
+ root.command("get <id>").description(`Get one ${singular} by id`).option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (id, opts) => {
467
1396
  configureClient(opts.workspace);
468
1397
  const body = unwrap(await get({ path: { id } }));
469
1398
  print(body.data, { json: opts.json });
470
1399
  });
471
1400
  }
1401
+ if (spec.create) {
1402
+ const create = spec.create;
1403
+ root.command("create").description(`Create a ${singular}`).requiredOption("--data <json>", "JSON body (inline or @file.json)").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (opts) => {
1404
+ configureClient(opts.workspace);
1405
+ const body = unwrap(await create({ body: parseData(opts.data) }));
1406
+ print(body.data ?? body, { json: opts.json });
1407
+ });
1408
+ }
1409
+ if (spec.update) {
1410
+ const update = spec.update;
1411
+ root.command("update <id>").description(`Update a ${singular} by id`).requiredOption("--data <json>", "JSON body (inline or @file.json)").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (id, opts) => {
1412
+ configureClient(opts.workspace);
1413
+ const body = unwrap(
1414
+ await update({ path: { id }, body: parseData(opts.data) })
1415
+ );
1416
+ print(body.data ?? body, { json: opts.json });
1417
+ });
1418
+ }
1419
+ if (spec.del) {
1420
+ const del = spec.del;
1421
+ 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) => {
1422
+ if (!opts.yes && !await confirm(`Delete ${singular} ${id}?`)) {
1423
+ console.error("Aborted.");
1424
+ return;
1425
+ }
1426
+ configureClient(opts.workspace);
1427
+ const body = unwrap(await del({ path: { id } }));
1428
+ print(body?.data ?? { deleted: id }, { json: opts.json });
1429
+ });
1430
+ }
1431
+ for (const action of spec.actions ?? []) {
1432
+ const cmd = root.command(`${action.name} <id>`).description(action.describe).option("--workspace <id>", "workspace override").option("--json", "raw JSON output");
1433
+ if (action.body) {
1434
+ cmd.option("--data <json>", "JSON body (inline or @file.json)");
1435
+ }
1436
+ cmd.action(async (id, opts) => {
1437
+ configureClient(opts.workspace);
1438
+ const payload = { path: { id } };
1439
+ if (action.body && opts.data) payload.body = parseData(opts.data);
1440
+ const body = unwrap(await action.fn(payload));
1441
+ print(body?.data ?? body ?? { ok: true, id }, { json: opts.json });
1442
+ });
1443
+ }
472
1444
  }
473
- function camel(s) {
1445
+ function camel2(s) {
474
1446
  return s.replace(/-([a-z])/g, (_, c2) => c2.toUpperCase());
475
1447
  }
476
1448
 
@@ -501,13 +1473,34 @@ registerResource(program, {
501
1473
  describe: "Events",
502
1474
  list: getEvents,
503
1475
  get: getEventsId,
1476
+ create: postEvents,
1477
+ update: patchEventsId,
1478
+ del: deleteEventsId,
1479
+ actions: [
1480
+ { name: "publish", describe: "Publish an event", fn: postEventsIdPublish }
1481
+ ],
504
1482
  columns: ["id", "name", "status", "startsAt"]
505
1483
  });
1484
+ registerEventDates(program, {
1485
+ list: getEventsIdDates,
1486
+ create: postEventsIdDates,
1487
+ update: patchEventsIdDatesDateId,
1488
+ del: deleteEventsIdDatesDateId
1489
+ });
506
1490
  registerResource(program, {
507
1491
  name: "sales",
508
1492
  describe: "Sales",
509
1493
  list: getSales,
510
1494
  get: getSalesId,
1495
+ actions: [
1496
+ { name: "cancel", describe: "Cancel a sale", fn: postSalesIdCancel },
1497
+ {
1498
+ name: "refund",
1499
+ describe: "Refund a sale (--data for partial amount)",
1500
+ fn: postSalesIdRefund,
1501
+ body: true
1502
+ }
1503
+ ],
511
1504
  columns: ["id", "reference", "status", "total", "currency", "createdAt"],
512
1505
  listFlags: [
513
1506
  { flag: "--status <s>", describe: "filter by status", query: "status" }
@@ -518,6 +1511,9 @@ registerResource(program, {
518
1511
  describe: "Ticket types",
519
1512
  list: getTicketTypes,
520
1513
  get: getTicketTypesId,
1514
+ create: postTicketTypes,
1515
+ update: patchTicketTypesId,
1516
+ del: deleteTicketTypesId,
521
1517
  columns: ["id", "name", "price", "currency", "stock"],
522
1518
  listFlags: [
523
1519
  {
@@ -532,6 +1528,9 @@ registerResource(program, {
532
1528
  describe: "Membership plans",
533
1529
  list: getMembershipPlans,
534
1530
  get: getMembershipPlansId,
1531
+ create: postMembershipPlans,
1532
+ update: patchMembershipPlansId,
1533
+ del: deleteMembershipPlansId,
535
1534
  columns: ["id", "name", "price", "currency", "interval"]
536
1535
  });
537
1536
  registerResource(program, {
@@ -539,15 +1538,28 @@ registerResource(program, {
539
1538
  describe: "Venues",
540
1539
  list: getVenues,
541
1540
  get: getVenuesId,
1541
+ create: postVenues,
1542
+ update: patchVenuesId,
1543
+ del: deleteVenuesId,
542
1544
  columns: ["id", "name", "city"]
543
1545
  });
544
1546
  registerResource(program, {
545
1547
  name: "staff",
546
1548
  describe: "Workspace staff",
547
1549
  list: getStaff,
1550
+ create: postStaff,
1551
+ actions: [
1552
+ {
1553
+ name: "set-role",
1554
+ describe: `Change a staff member's role (--data '{"role":"..."}')`,
1555
+ fn: patchStaffIdRole,
1556
+ body: true
1557
+ }
1558
+ ],
548
1559
  columns: ["id", "name", "email", "role"]
549
1560
  });
550
1561
  registerReports(program);
1562
+ registerAdmin(program);
551
1563
  if (process.argv.length <= 2) {
552
1564
  console.log(banner());
553
1565
  program.outputHelp();