@freeticket/cli 0.8.0 → 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.
Files changed (3) hide show
  1. package/README.md +8 -4
  2. package/dist/index.js +560 -76
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -79,7 +79,7 @@ ft sales list --status CONFIRMED --json
79
79
  | `ft whoami` | Active user and accessible workspaces | VIEWER |
80
80
  | `ft config` · `ft logout` | Show config (masked key) · remove key | — |
81
81
  | `ft workspace list` · `use <id\|slug>` · `show` | List, switch, and show the active workspace | VIEWER |
82
- | `ft events list` · `get <id>` | Workspace events | VIEWER |
82
+ | `ft events list` · `get <id>` | Workspace events (`--q` `--status` `--with-total`) | VIEWER |
83
83
  | `ft events create` · `update <id>` · `delete <id>` | Manage events (`--data <json>`) | ADMIN |
84
84
  | `ft events publish <id>` | Publish an event | ADMIN |
85
85
  | `ft event-dates list` · `create` · `update` · `delete` | Event dates | ADMIN |
@@ -87,7 +87,7 @@ ft sales list --status CONFIRMED --json
87
87
  | `ft ticket-types create` · `update <id>` · `delete <id>` | Manage ticket types (`--data <json>`) | ADMIN |
88
88
  | `ft sales list` · `get <id>` | Sales (filters: `--status` `--channel` `--event` `--event-date` `--reference` `--buyer` `--from` `--to`) | STAFF |
89
89
  | `ft sales create` | Create a sale/order — comps & programmatic sales (`--data <json>`) | ADMIN |
90
- | `ft sales cancel <id>` · `refund <id>` | Cancel / refund a sale (`--data` for partial refund) | ADMIN |
90
+ | `ft sales cancel <id>` · `refund <id>` | Cancel / refund a sale (`--data` for the partial amount and for the `acknowledge_open_payment` / `acknowledge_manual` flags) | ADMIN |
91
91
  | `ft sales tickets <id>` | List the individual tickets/attendees of a sale | STAFF |
92
92
  | `ft tickets access <code>` | Read a ticket's access status (no admit) | STAFF |
93
93
  | `ft tickets checkin <code>` | Admit a ticket at the door (idempotent) | STAFF |
@@ -100,10 +100,14 @@ ft sales list --status CONFIRMED --json
100
100
  | `ft webhooks list` · `create` · `delete <id>` | Webhook endpoints, HMAC-signed delivery (`--data <json>`) | ADMIN |
101
101
  | `ft venues list` · `get <id>` | Venues | VIEWER |
102
102
  | `ft venues create` · `update <id>` · `delete <id>` | Manage venues (`--data <json>`) | ADMIN |
103
- | `ft staff list` · `create` · `set-role <id>` | Workspace staff (`--data <json>`) | ADMIN |
103
+ | `ft staff list` · `create` · `set-role <id>` | Workspace staff (`--workspace-ids <ids>` lists up to 25 workspaces in one call; `--data <json>`) | ADMIN |
104
104
  | `ft reports summary` | KPIs (`--period 7d\|30d\|90d\|1y`) | VIEWER |
105
105
  | `ft reports by-event` · `timeseries` · `inventory` | Revenue/tickets by event, over time, and capacity/availability | VIEWER |
106
- | `ft reports export buyers\|attendees\|subscribers` | Export buyers / attendees / subscribers (CSV; filters `--event` `--event-date` `--from` `--to` `--status`) | ADMIN |
106
+ | `ft reports export buyers\|attendees\|subscribers\|reconciliation` | Exports as CSV (filters `--event` `--event-date` `--from` `--to` `--status`) | ADMIN |
107
+ | `ft reports reconciliation` · `financials` | CFO reconciliation (Mercado Pago vs sale vs Siigo invoice) · per-function P&L | ADMIN |
108
+ | `ft settlements list` · `document <id>` | Settlements paid to the organizer · signed download URL for the PDF, 5 min TTL (`--proof <fileName>` for a payment proof) | ADMIN |
109
+ | `ft api-keys create <name>` · `list` · `revoke <id>` | Self-service API keys (the secret is shown once, never stored) | ADMIN |
110
+ | `ft admin login` · `me` · `workspaces` · `users` · `plans` · `feature-flags` · `tokens` · `audit-log` | Superadmin, cross-tenant — needs a SUPER_ADMIN session, not an API key. Includes `admin workspaces plan <id>` (assisted plan assignment) and `webTemplate` / `customDomain` on `update` | SUPER_ADMIN |
107
111
 
108
112
  > **Write operations** (`create`/`update`/`delete` and actions like `publish`,
109
113
  > `cancel`, `refund`) send a JSON body via `--data <inline-json>` or
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.8.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: "http://localhost:3000/api/v1"
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,46 +238,26 @@ 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: [
241
+ },
190
242
  {
191
- name: "Authorization",
243
+ name: "x-api-key",
192
244
  type: "apiKey"
193
245
  }
194
246
  ],
195
- url: "/events/{id}/dates",
247
+ url: "/events/{id}/publish",
196
248
  ...options
197
249
  });
198
250
  };
199
- var postEventsIdDates = (options) => {
200
- return (options.client ?? client).post({
201
- security: [
202
- {
203
- name: "Authorization",
204
- type: "apiKey"
205
- }
206
- ],
207
- url: "/events/{id}/dates",
208
- ...options,
209
- headers: {
210
- "Content-Type": "application/json",
211
- ...options?.headers
212
- }
213
- });
214
- };
215
251
  var deleteEventsIdDatesDateId = (options) => {
216
252
  return (options.client ?? client).delete({
217
253
  security: [
218
254
  {
219
255
  name: "Authorization",
220
256
  type: "apiKey"
257
+ },
258
+ {
259
+ name: "x-api-key",
260
+ type: "apiKey"
221
261
  }
222
262
  ],
223
263
  url: "/events/{id}/dates/{dateId}",
@@ -230,6 +270,10 @@ var patchEventsIdDatesDateId = (options) => {
230
270
  {
231
271
  name: "Authorization",
232
272
  type: "apiKey"
273
+ },
274
+ {
275
+ name: "x-api-key",
276
+ type: "apiKey"
233
277
  }
234
278
  ],
235
279
  url: "/events/{id}/dates/{dateId}",
@@ -246,6 +290,10 @@ var getTicketTypes = (options) => {
246
290
  {
247
291
  name: "Authorization",
248
292
  type: "apiKey"
293
+ },
294
+ {
295
+ name: "x-api-key",
296
+ type: "apiKey"
249
297
  }
250
298
  ],
251
299
  url: "/ticket-types",
@@ -258,6 +306,10 @@ var postTicketTypes = (options) => {
258
306
  {
259
307
  name: "Authorization",
260
308
  type: "apiKey"
309
+ },
310
+ {
311
+ name: "x-api-key",
312
+ type: "apiKey"
261
313
  }
262
314
  ],
263
315
  url: "/ticket-types",
@@ -274,6 +326,10 @@ var deleteTicketTypesId = (options) => {
274
326
  {
275
327
  name: "Authorization",
276
328
  type: "apiKey"
329
+ },
330
+ {
331
+ name: "x-api-key",
332
+ type: "apiKey"
277
333
  }
278
334
  ],
279
335
  url: "/ticket-types/{id}",
@@ -286,6 +342,10 @@ var getTicketTypesId = (options) => {
286
342
  {
287
343
  name: "Authorization",
288
344
  type: "apiKey"
345
+ },
346
+ {
347
+ name: "x-api-key",
348
+ type: "apiKey"
289
349
  }
290
350
  ],
291
351
  url: "/ticket-types/{id}",
@@ -298,6 +358,10 @@ var patchTicketTypesId = (options) => {
298
358
  {
299
359
  name: "Authorization",
300
360
  type: "apiKey"
361
+ },
362
+ {
363
+ name: "x-api-key",
364
+ type: "apiKey"
301
365
  }
302
366
  ],
303
367
  url: "/ticket-types/{id}",
@@ -314,6 +378,10 @@ var getSales = (options) => {
314
378
  {
315
379
  name: "Authorization",
316
380
  type: "apiKey"
381
+ },
382
+ {
383
+ name: "x-api-key",
384
+ type: "apiKey"
317
385
  }
318
386
  ],
319
387
  url: "/sales",
@@ -326,6 +394,10 @@ var postSales = (options) => {
326
394
  {
327
395
  name: "Authorization",
328
396
  type: "apiKey"
397
+ },
398
+ {
399
+ name: "x-api-key",
400
+ type: "apiKey"
329
401
  }
330
402
  ],
331
403
  url: "/sales",
@@ -342,6 +414,10 @@ var getSalesId = (options) => {
342
414
  {
343
415
  name: "Authorization",
344
416
  type: "apiKey"
417
+ },
418
+ {
419
+ name: "x-api-key",
420
+ type: "apiKey"
345
421
  }
346
422
  ],
347
423
  url: "/sales/{id}",
@@ -354,10 +430,18 @@ var postSalesIdCancel = (options) => {
354
430
  {
355
431
  name: "Authorization",
356
432
  type: "apiKey"
433
+ },
434
+ {
435
+ name: "x-api-key",
436
+ type: "apiKey"
357
437
  }
358
438
  ],
359
439
  url: "/sales/{id}/cancel",
360
- ...options
440
+ ...options,
441
+ headers: {
442
+ "Content-Type": "application/json",
443
+ ...options?.headers
444
+ }
361
445
  });
362
446
  };
363
447
  var postSalesIdRefund = (options) => {
@@ -366,10 +450,18 @@ var postSalesIdRefund = (options) => {
366
450
  {
367
451
  name: "Authorization",
368
452
  type: "apiKey"
453
+ },
454
+ {
455
+ name: "x-api-key",
456
+ type: "apiKey"
369
457
  }
370
458
  ],
371
459
  url: "/sales/{id}/refund",
372
- ...options
460
+ ...options,
461
+ headers: {
462
+ "Content-Type": "application/json",
463
+ ...options?.headers
464
+ }
373
465
  });
374
466
  };
375
467
  var getMembershipPlans = (options) => {
@@ -378,6 +470,10 @@ var getMembershipPlans = (options) => {
378
470
  {
379
471
  name: "Authorization",
380
472
  type: "apiKey"
473
+ },
474
+ {
475
+ name: "x-api-key",
476
+ type: "apiKey"
381
477
  }
382
478
  ],
383
479
  url: "/membership-plans",
@@ -390,6 +486,10 @@ var postMembershipPlans = (options) => {
390
486
  {
391
487
  name: "Authorization",
392
488
  type: "apiKey"
489
+ },
490
+ {
491
+ name: "x-api-key",
492
+ type: "apiKey"
393
493
  }
394
494
  ],
395
495
  url: "/membership-plans",
@@ -406,6 +506,10 @@ var deleteMembershipPlansId = (options) => {
406
506
  {
407
507
  name: "Authorization",
408
508
  type: "apiKey"
509
+ },
510
+ {
511
+ name: "x-api-key",
512
+ type: "apiKey"
409
513
  }
410
514
  ],
411
515
  url: "/membership-plans/{id}",
@@ -418,6 +522,10 @@ var getMembershipPlansId = (options) => {
418
522
  {
419
523
  name: "Authorization",
420
524
  type: "apiKey"
525
+ },
526
+ {
527
+ name: "x-api-key",
528
+ type: "apiKey"
421
529
  }
422
530
  ],
423
531
  url: "/membership-plans/{id}",
@@ -430,6 +538,10 @@ var patchMembershipPlansId = (options) => {
430
538
  {
431
539
  name: "Authorization",
432
540
  type: "apiKey"
541
+ },
542
+ {
543
+ name: "x-api-key",
544
+ type: "apiKey"
433
545
  }
434
546
  ],
435
547
  url: "/membership-plans/{id}",
@@ -446,6 +558,10 @@ var getVenues = (options) => {
446
558
  {
447
559
  name: "Authorization",
448
560
  type: "apiKey"
561
+ },
562
+ {
563
+ name: "x-api-key",
564
+ type: "apiKey"
449
565
  }
450
566
  ],
451
567
  url: "/venues",
@@ -458,6 +574,10 @@ var postVenues = (options) => {
458
574
  {
459
575
  name: "Authorization",
460
576
  type: "apiKey"
577
+ },
578
+ {
579
+ name: "x-api-key",
580
+ type: "apiKey"
461
581
  }
462
582
  ],
463
583
  url: "/venues",
@@ -474,6 +594,10 @@ var deleteVenuesId = (options) => {
474
594
  {
475
595
  name: "Authorization",
476
596
  type: "apiKey"
597
+ },
598
+ {
599
+ name: "x-api-key",
600
+ type: "apiKey"
477
601
  }
478
602
  ],
479
603
  url: "/venues/{id}",
@@ -486,6 +610,10 @@ var getVenuesId = (options) => {
486
610
  {
487
611
  name: "Authorization",
488
612
  type: "apiKey"
613
+ },
614
+ {
615
+ name: "x-api-key",
616
+ type: "apiKey"
489
617
  }
490
618
  ],
491
619
  url: "/venues/{id}",
@@ -498,6 +626,10 @@ var patchVenuesId = (options) => {
498
626
  {
499
627
  name: "Authorization",
500
628
  type: "apiKey"
629
+ },
630
+ {
631
+ name: "x-api-key",
632
+ type: "apiKey"
501
633
  }
502
634
  ],
503
635
  url: "/venues/{id}",
@@ -514,6 +646,10 @@ var getStaff = (options) => {
514
646
  {
515
647
  name: "Authorization",
516
648
  type: "apiKey"
649
+ },
650
+ {
651
+ name: "x-api-key",
652
+ type: "apiKey"
517
653
  }
518
654
  ],
519
655
  url: "/staff",
@@ -526,6 +662,10 @@ var postStaff = (options) => {
526
662
  {
527
663
  name: "Authorization",
528
664
  type: "apiKey"
665
+ },
666
+ {
667
+ name: "x-api-key",
668
+ type: "apiKey"
529
669
  }
530
670
  ],
531
671
  url: "/staff",
@@ -542,6 +682,10 @@ var patchStaffIdRole = (options) => {
542
682
  {
543
683
  name: "Authorization",
544
684
  type: "apiKey"
685
+ },
686
+ {
687
+ name: "x-api-key",
688
+ type: "apiKey"
545
689
  }
546
690
  ],
547
691
  url: "/staff/{id}/role",
@@ -558,6 +702,10 @@ var getReportsSummary = (options) => {
558
702
  {
559
703
  name: "Authorization",
560
704
  type: "apiKey"
705
+ },
706
+ {
707
+ name: "x-api-key",
708
+ type: "apiKey"
561
709
  }
562
710
  ],
563
711
  url: "/reports/summary",
@@ -570,6 +718,10 @@ var getReportsInventory = (options) => {
570
718
  {
571
719
  name: "Authorization",
572
720
  type: "apiKey"
721
+ },
722
+ {
723
+ name: "x-api-key",
724
+ type: "apiKey"
573
725
  }
574
726
  ],
575
727
  url: "/reports/inventory",
@@ -582,6 +734,10 @@ var getReportsReconciliation = (options) => {
582
734
  {
583
735
  name: "Authorization",
584
736
  type: "apiKey"
737
+ },
738
+ {
739
+ name: "x-api-key",
740
+ type: "apiKey"
585
741
  }
586
742
  ],
587
743
  url: "/reports/reconciliation",
@@ -594,6 +750,10 @@ var getReportsExportsReconciliation = (options) => {
594
750
  {
595
751
  name: "Authorization",
596
752
  type: "apiKey"
753
+ },
754
+ {
755
+ name: "x-api-key",
756
+ type: "apiKey"
597
757
  }
598
758
  ],
599
759
  url: "/reports/exports/reconciliation",
@@ -606,6 +766,10 @@ var getReportsExportsAttendees = (options) => {
606
766
  {
607
767
  name: "Authorization",
608
768
  type: "apiKey"
769
+ },
770
+ {
771
+ name: "x-api-key",
772
+ type: "apiKey"
609
773
  }
610
774
  ],
611
775
  url: "/reports/exports/attendees",
@@ -618,6 +782,10 @@ var getReportsExportsBuyers = (options) => {
618
782
  {
619
783
  name: "Authorization",
620
784
  type: "apiKey"
785
+ },
786
+ {
787
+ name: "x-api-key",
788
+ type: "apiKey"
621
789
  }
622
790
  ],
623
791
  url: "/reports/exports/buyers",
@@ -630,6 +798,10 @@ var getReportsExportsSubscribers = (options) => {
630
798
  {
631
799
  name: "Authorization",
632
800
  type: "apiKey"
801
+ },
802
+ {
803
+ name: "x-api-key",
804
+ type: "apiKey"
633
805
  }
634
806
  ],
635
807
  url: "/reports/exports/subscribers",
@@ -642,6 +814,10 @@ var getReportsByEvent = (options) => {
642
814
  {
643
815
  name: "Authorization",
644
816
  type: "apiKey"
817
+ },
818
+ {
819
+ name: "x-api-key",
820
+ type: "apiKey"
645
821
  }
646
822
  ],
647
823
  url: "/reports/by-event",
@@ -654,18 +830,58 @@ var getReportsTimeseries = (options) => {
654
830
  {
655
831
  name: "Authorization",
656
832
  type: "apiKey"
833
+ },
834
+ {
835
+ name: "x-api-key",
836
+ type: "apiKey"
657
837
  }
658
838
  ],
659
839
  url: "/reports/timeseries",
660
840
  ...options
661
841
  });
662
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
+ };
663
875
  var getDiscounts = (options) => {
664
876
  return (options?.client ?? client).get({
665
877
  security: [
666
878
  {
667
879
  name: "Authorization",
668
880
  type: "apiKey"
881
+ },
882
+ {
883
+ name: "x-api-key",
884
+ type: "apiKey"
669
885
  }
670
886
  ],
671
887
  url: "/discounts",
@@ -678,6 +894,10 @@ var postDiscounts = (options) => {
678
894
  {
679
895
  name: "Authorization",
680
896
  type: "apiKey"
897
+ },
898
+ {
899
+ name: "x-api-key",
900
+ type: "apiKey"
681
901
  }
682
902
  ],
683
903
  url: "/discounts",
@@ -694,6 +914,10 @@ var deleteDiscountsId = (options) => {
694
914
  {
695
915
  name: "Authorization",
696
916
  type: "apiKey"
917
+ },
918
+ {
919
+ name: "x-api-key",
920
+ type: "apiKey"
697
921
  }
698
922
  ],
699
923
  url: "/discounts/{id}",
@@ -706,6 +930,10 @@ var patchDiscountsId = (options) => {
706
930
  {
707
931
  name: "Authorization",
708
932
  type: "apiKey"
933
+ },
934
+ {
935
+ name: "x-api-key",
936
+ type: "apiKey"
709
937
  }
710
938
  ],
711
939
  url: "/discounts/{id}",
@@ -722,6 +950,10 @@ var getWebhooks = (options) => {
722
950
  {
723
951
  name: "Authorization",
724
952
  type: "apiKey"
953
+ },
954
+ {
955
+ name: "x-api-key",
956
+ type: "apiKey"
725
957
  }
726
958
  ],
727
959
  url: "/webhooks",
@@ -734,6 +966,10 @@ var postWebhooks = (options) => {
734
966
  {
735
967
  name: "Authorization",
736
968
  type: "apiKey"
969
+ },
970
+ {
971
+ name: "x-api-key",
972
+ type: "apiKey"
737
973
  }
738
974
  ],
739
975
  url: "/webhooks",
@@ -750,6 +986,10 @@ var deleteWebhooksId = (options) => {
750
986
  {
751
987
  name: "Authorization",
752
988
  type: "apiKey"
989
+ },
990
+ {
991
+ name: "x-api-key",
992
+ type: "apiKey"
753
993
  }
754
994
  ],
755
995
  url: "/webhooks/{id}",
@@ -762,6 +1002,10 @@ var getMembershipPlansIdSubscribers = (options) => {
762
1002
  {
763
1003
  name: "Authorization",
764
1004
  type: "apiKey"
1005
+ },
1006
+ {
1007
+ name: "x-api-key",
1008
+ type: "apiKey"
765
1009
  }
766
1010
  ],
767
1011
  url: "/membership-plans/{id}/subscribers",
@@ -774,6 +1018,10 @@ var postSubscriptionsIdCancel = (options) => {
774
1018
  {
775
1019
  name: "Authorization",
776
1020
  type: "apiKey"
1021
+ },
1022
+ {
1023
+ name: "x-api-key",
1024
+ type: "apiKey"
777
1025
  }
778
1026
  ],
779
1027
  url: "/subscriptions/{id}/cancel",
@@ -786,18 +1034,42 @@ var getSalesIdTickets = (options) => {
786
1034
  {
787
1035
  name: "Authorization",
788
1036
  type: "apiKey"
1037
+ },
1038
+ {
1039
+ name: "x-api-key",
1040
+ type: "apiKey"
789
1041
  }
790
1042
  ],
791
1043
  url: "/sales/{id}/tickets",
792
1044
  ...options
793
1045
  });
794
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
+ };
795
1063
  var postTicketsTicketCodeCheckin = (options) => {
796
1064
  return (options.client ?? client).post({
797
1065
  security: [
798
1066
  {
799
1067
  name: "Authorization",
800
1068
  type: "apiKey"
1069
+ },
1070
+ {
1071
+ name: "x-api-key",
1072
+ type: "apiKey"
801
1073
  }
802
1074
  ],
803
1075
  url: "/tickets/{ticketCode}/checkin",
@@ -810,6 +1082,10 @@ var getTicketsTicketCodeAccess = (options) => {
810
1082
  {
811
1083
  name: "Authorization",
812
1084
  type: "apiKey"
1085
+ },
1086
+ {
1087
+ name: "x-api-key",
1088
+ type: "apiKey"
813
1089
  }
814
1090
  ],
815
1091
  url: "/tickets/{ticketCode}/access",
@@ -822,6 +1098,10 @@ var getApiKeys = (options) => {
822
1098
  {
823
1099
  name: "Authorization",
824
1100
  type: "apiKey"
1101
+ },
1102
+ {
1103
+ name: "x-api-key",
1104
+ type: "apiKey"
825
1105
  }
826
1106
  ],
827
1107
  url: "/api-keys",
@@ -834,6 +1114,10 @@ var postApiKeys = (options) => {
834
1114
  {
835
1115
  name: "Authorization",
836
1116
  type: "apiKey"
1117
+ },
1118
+ {
1119
+ name: "x-api-key",
1120
+ type: "apiKey"
837
1121
  }
838
1122
  ],
839
1123
  url: "/api-keys",
@@ -850,21 +1134,13 @@ var deleteApiKeysId = (options) => {
850
1134
  {
851
1135
  name: "Authorization",
852
1136
  type: "apiKey"
853
- }
854
- ],
855
- url: "/api-keys/{id}",
856
- ...options
857
- });
858
- };
859
- var postTicketsTicketCodeResend = (options) => {
860
- return (options.client ?? client).post({
861
- security: [
1137
+ },
862
1138
  {
863
- name: "Authorization",
1139
+ name: "x-api-key",
864
1140
  type: "apiKey"
865
1141
  }
866
1142
  ],
867
- url: "/tickets/{ticketCode}/resend",
1143
+ url: "/api-keys/{id}",
868
1144
  ...options
869
1145
  });
870
1146
  };
@@ -952,6 +1228,23 @@ var patchWorkspacesId = (options) => {
952
1228
  }
953
1229
  });
954
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
+ };
955
1248
  var postWorkspacesIdSuspend = (options) => {
956
1249
  return (options.client ?? client2).post({
957
1250
  security: [
@@ -1154,6 +1447,49 @@ var getAuditLog = (options) => {
1154
1447
  ...options
1155
1448
  });
1156
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
+ };
1157
1493
 
1158
1494
  // src/lib/config.ts
1159
1495
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -1221,6 +1557,20 @@ function configureAdminClient() {
1221
1557
  }
1222
1558
  });
1223
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
+ }
1224
1574
  function unwrap(res) {
1225
1575
  if (res.data !== void 0) return res.data;
1226
1576
  const status = res.response?.status;
@@ -1280,6 +1630,16 @@ function parseData(input) {
1280
1630
  return fail("Invalid JSON in --data.");
1281
1631
  }
1282
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
+ }
1283
1643
  function confirm(question) {
1284
1644
  if (!process.stdin.isTTY) return Promise.resolve(false);
1285
1645
  const rl = readline.createInterface({
@@ -1299,7 +1659,10 @@ import chalk from "chalk";
1299
1659
  import Table from "cli-table3";
1300
1660
  function print(data, opts = {}) {
1301
1661
  if (opts.json) {
1302
- process.stdout.write(`${JSON.stringify(data, null, 2)}
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)}
1303
1666
  `);
1304
1667
  return;
1305
1668
  }
@@ -1356,6 +1719,18 @@ function fmt(v) {
1356
1719
  if (typeof v === "object") return JSON.stringify(v);
1357
1720
  return String(v);
1358
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
+ }
1359
1734
 
1360
1735
  // src/commands/admin.ts
1361
1736
  function registerAdmin(program2) {
@@ -1430,6 +1805,16 @@ function registerAdmin(program2) {
1430
1805
  name: "restore",
1431
1806
  describe: "Restore a suspended workspace",
1432
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
1433
1818
  }
1434
1819
  ],
1435
1820
  columns: ["id", "name", "type", "country", "suspended", "createdAt"],
@@ -1480,6 +1865,25 @@ function registerAdmin(program2) {
1480
1865
  columns: ["key", "enabled", "description"],
1481
1866
  noPaging: true
1482
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
+ },
1483
1887
  {
1484
1888
  name: "audit-log",
1485
1889
  describe: "Superadmin audit log",
@@ -1561,9 +1965,8 @@ function registerAdminResource(parent, spec) {
1561
1965
  cmd.option("--data <json>", "JSON body (inline or @file.json)");
1562
1966
  }
1563
1967
  cmd.action(async (value, opts) => {
1564
- if (action.confirm && !opts.yes && !await confirm(`${action.name} ${singular} ${value}?`)) {
1565
- console.error("Aborted.");
1566
- return;
1968
+ if (action.confirm) {
1969
+ await confirmOrExit(`${action.name} ${singular} ${value}?`, opts.yes);
1567
1970
  }
1568
1971
  configureAdminClient();
1569
1972
  const payload = { path: { [param]: value } };
@@ -1668,10 +2071,7 @@ ${chalk3.green("\u2713")} API key "${chalk3.bold(key.name)}" created (scope: ${k
1668
2071
  if (!opts.json) printNextCursor(body.page);
1669
2072
  });
1670
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) => {
1671
- if (!opts.yes && !await confirm(`Revoke API key ${id}?`)) {
1672
- console.error("Aborted.");
1673
- return;
1674
- }
2074
+ await confirmOrExit(`Revoke API key ${id}?`, opts.yes);
1675
2075
  configureClient(opts.workspace);
1676
2076
  const body = unwrap(await deleteApiKeysId({ path: { id } }));
1677
2077
  print(body?.data ?? { revoked: id }, { json: opts.json });
@@ -1690,7 +2090,7 @@ function registerAuth(program2) {
1690
2090
  ).option(
1691
2091
  "--url <url>",
1692
2092
  "API base URL (default: https://admin.appfreeticket.com)"
1693
- ).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) => {
1694
2094
  if (opts.url) saveConfig({ apiUrl: opts.url });
1695
2095
  const cred = opts.key ? { apiKey: opts.key, workspaceId: void 0 } : await deviceLogin();
1696
2096
  const workspaceId = opts.workspace ?? cred.workspaceId;
@@ -1700,10 +2100,10 @@ function registerAuth(program2) {
1700
2100
  });
1701
2101
  configureClient(workspaceId);
1702
2102
  const me = unwrap(await getMe({})).data;
1703
- console.log(
2103
+ console.error(
1704
2104
  `${chalk4.green("\u2713")} Session saved in ${chalk4.dim(CONFIG_PATH)}`
1705
2105
  );
1706
- print(me, {});
2106
+ print(me, { json: opts.json });
1707
2107
  });
1708
2108
  program2.command("whoami").description("Show the authenticated user and workspaces (GET /me)").option("--json", "raw JSON output").action(async (opts) => {
1709
2109
  configureClient();
@@ -1716,7 +2116,7 @@ function registerAuth(program2) {
1716
2116
  `${chalk4.green("\u2713")} Logged out \u2014 session removed from ${chalk4.dim(CONFIG_PATH)}`
1717
2117
  );
1718
2118
  });
1719
- 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) => {
1720
2120
  const cfg = loadConfig();
1721
2121
  print(
1722
2122
  {
@@ -1725,7 +2125,7 @@ function registerAuth(program2) {
1725
2125
  session: cfg.apiKey ? `${cfg.apiKey.slice(0, 12)}\u2026` : null,
1726
2126
  workspaceId: cfg.workspaceId ?? null
1727
2127
  },
1728
- {}
2128
+ { json: opts.json }
1729
2129
  );
1730
2130
  });
1731
2131
  }
@@ -1824,10 +2224,7 @@ function registerEventDates(program2, spec) {
1824
2224
  print(body.data ?? body, { json: opts.json });
1825
2225
  });
1826
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) => {
1827
- if (!opts.yes && !await confirm(`Delete date ${dateId}?`)) {
1828
- console.error("Aborted.");
1829
- return;
1830
- }
2227
+ await confirmOrExit(`Delete date ${dateId}?`, opts.yes);
1831
2228
  configureClient(opts.workspace);
1832
2229
  const body = unwrap(await spec.del({ path: { id: eventId, dateId } }));
1833
2230
  print(body?.data ?? { deleted: dateId }, { json: opts.json });
@@ -1863,6 +2260,20 @@ function registerReports(program2) {
1863
2260
  );
1864
2261
  print(body.data, { json: opts.json });
1865
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
+ });
1866
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) => {
1867
2278
  configureClient(opts.workspace);
1868
2279
  const body = unwrap(
@@ -1905,7 +2316,7 @@ function registerReports(program2) {
1905
2316
  const exp = root.command("export").description(
1906
2317
  "Export buyers, attendees, subscribers or reconciliation (CSV)"
1907
2318
  );
1908
- 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) => {
1909
2320
  configureClient(opts.workspace);
1910
2321
  const body = unwrap(
1911
2322
  await getReportsExportsReconciliation({
@@ -1917,13 +2328,13 @@ function registerReports(program2) {
1917
2328
  }
1918
2329
  })
1919
2330
  );
1920
- print(body.data ?? body, { json: opts.json });
2331
+ printExport(body.data ?? body, opts);
1921
2332
  });
1922
2333
  for (const [name, fn, label] of [
1923
2334
  ["buyers", getReportsExportsBuyers, "buyers (one row per sale)"],
1924
2335
  ["attendees", getReportsExportsAttendees, "attendees (one row per ticket)"]
1925
2336
  ]) {
1926
- 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) => {
1927
2338
  configureClient(opts.workspace);
1928
2339
  const body = unwrap(
1929
2340
  await fn({
@@ -1936,17 +2347,33 @@ function registerReports(program2) {
1936
2347
  }
1937
2348
  })
1938
2349
  );
1939
- print(body.data ?? body, { json: opts.json });
2350
+ printExport(body.data ?? body, opts);
1940
2351
  });
1941
2352
  }
1942
- 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) => {
1943
2354
  configureClient(opts.workspace);
1944
2355
  const body = unwrap(await getReportsExportsSubscribers({}));
1945
- print(body.data ?? body, { json: opts.json });
2356
+ printExport(body.data ?? body, opts);
1946
2357
  });
1947
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
+ }
1948
2372
 
1949
2373
  // src/commands/resource.ts
2374
+ function activeWorkspace(flag) {
2375
+ return flag ?? loadConfig().workspaceId;
2376
+ }
1950
2377
  function registerResource(program2, spec) {
1951
2378
  const root = program2.command(spec.name).description(spec.describe);
1952
2379
  const singular = spec.name.replace(/s$/, "");
@@ -1987,7 +2414,12 @@ function registerResource(program2, spec) {
1987
2414
  `);
1988
2415
  return;
1989
2416
  }
1990
- print(rows, { json: opts.json, columns });
2417
+ print(rows, {
2418
+ json: opts.json,
2419
+ columns,
2420
+ columnsExplicit: Boolean(opts.columns)
2421
+ });
2422
+ if (rows.length === 0) printEmptyScope(activeWorkspace(opts.workspace));
1991
2423
  return;
1992
2424
  }
1993
2425
  const body = unwrap(await list({ query }));
@@ -2000,7 +2432,13 @@ function registerResource(program2, spec) {
2000
2432
  `);
2001
2433
  return;
2002
2434
  }
2003
- print(body.data, { json: opts.json, columns });
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));
2004
2442
  if (!opts.json) printNextCursor(body.page);
2005
2443
  });
2006
2444
  }
@@ -2033,10 +2471,7 @@ function registerResource(program2, spec) {
2033
2471
  if (spec.del) {
2034
2472
  const del = spec.del;
2035
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) => {
2036
- if (!opts.yes && !await confirm(`Delete ${singular} ${id}?`)) {
2037
- console.error("Aborted.");
2038
- return;
2039
- }
2474
+ await confirmOrExit(`Delete ${singular} ${id}?`, opts.yes);
2040
2475
  configureClient(opts.workspace);
2041
2476
  const body = unwrap(await del({ path: { id } }));
2042
2477
  print(body?.data ?? { deleted: id }, { json: opts.json });
@@ -2055,6 +2490,7 @@ function registerResource(program2, spec) {
2055
2490
  print(body?.data ?? body ?? { ok: true, id }, { json: opts.json });
2056
2491
  });
2057
2492
  }
2493
+ spec.extend?.(root);
2058
2494
  }
2059
2495
  function camel2(s) {
2060
2496
  return s.replace(/-([a-z])/g, (_, c2) => c2.toUpperCase());
@@ -2100,11 +2536,13 @@ function registerWorkspace(program2) {
2100
2536
  active: w.id === activeId ? "*" : "",
2101
2537
  id: w.id,
2102
2538
  name: w.name,
2103
- 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("|")
2104
2542
  }));
2105
2543
  print(rows, {
2106
2544
  json: opts.json,
2107
- columns: ["active", "id", "name", "slug"]
2545
+ columns: ["active", "id", "name", "slug", "role", "access"]
2108
2546
  });
2109
2547
  });
2110
2548
  root.command("use <idOrSlug>").description(
@@ -2241,7 +2679,41 @@ registerResource(program, {
2241
2679
  { name: "publish", describe: "Publish an event", fn: postEventsIdPublish }
2242
2680
  ],
2243
2681
  // startsAt lives on EventDate, not Event — use createdAt for a temporal column.
2244
- 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
+ }
2245
2717
  });
2246
2718
  registerEventDates(program, {
2247
2719
  list: getEventsIdDates,
@@ -2256,7 +2728,12 @@ registerResource(program, {
2256
2728
  get: getSalesId,
2257
2729
  create: postSales,
2258
2730
  actions: [
2259
- { name: "cancel", describe: "Cancel a sale", fn: postSalesIdCancel },
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
+ },
2260
2737
  {
2261
2738
  name: "refund",
2262
2739
  describe: "Refund a sale (--data for partial amount)",
@@ -2394,7 +2871,14 @@ registerResource(program, {
2394
2871
  body: true
2395
2872
  }
2396
2873
  ],
2397
- 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
+ ]
2398
2882
  });
2399
2883
  registerTickets(program);
2400
2884
  registerReports(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freeticket/cli",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Official FreeTicket CLI — consumes the B2B REST API for events, sales, tickets, memberships, venues, staff, and reports.",
5
5
  "keywords": [
6
6
  "freeticket",