@freeticket/cli 0.5.0 → 0.6.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 +12 -2
  2. package/dist/index.js +401 -8
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -85,15 +85,25 @@ ft sales list --status CONFIRMED --json
85
85
  | `ft event-dates list` · `create` · `update` · `delete` | Event dates | ADMIN |
86
86
  | `ft ticket-types list` · `get <id>` | Ticket types (`--event-date-id`) | VIEWER |
87
87
  | `ft ticket-types create` · `update <id>` · `delete <id>` | Manage ticket types (`--data <json>`) | ADMIN |
88
- | `ft sales list` · `get <id>` | Sales (`--status`) | STAFF |
88
+ | `ft sales list` · `get <id>` | Sales (filters: `--status` `--channel` `--event` `--event-date` `--reference` `--buyer` `--from` `--to`) | STAFF |
89
+ | `ft sales create` | Create a sale/order — comps & programmatic sales (`--data <json>`) | ADMIN |
89
90
  | `ft sales cancel <id>` · `refund <id>` | Cancel / refund a sale (`--data` for partial refund) | ADMIN |
91
+ | `ft sales tickets <id>` | List the individual tickets/attendees of a sale | STAFF |
92
+ | `ft tickets access <code>` | Read a ticket's access status (no admit) | STAFF |
93
+ | `ft tickets checkin <code>` | Admit a ticket at the door (idempotent) | STAFF |
94
+ | `ft tickets resend <code>` | Resend the ticket's confirmation email (QR) | ADMIN |
90
95
  | `ft plans list` · `get <id>` | Membership plans | VIEWER |
91
96
  | `ft plans create` · `update <id>` · `delete <id>` | Manage membership plans (`--data <json>`) | ADMIN |
97
+ | `ft plans subscribers <id>` | List a plan's subscribers/members | VIEWER |
98
+ | `ft subscriptions cancel <id>` | Cancel a subscription | ADMIN |
99
+ | `ft discounts list` · `create` · `update <id>` · `delete <id>` | Discount codes / coupons (`--event` `--active`; `--data <json>`) | ADMIN |
100
+ | `ft webhooks list` · `create` · `delete <id>` | Webhook endpoints, HMAC-signed delivery (`--data <json>`) | ADMIN |
92
101
  | `ft venues list` · `get <id>` | Venues | VIEWER |
93
102
  | `ft venues create` · `update <id>` · `delete <id>` | Manage venues (`--data <json>`) | ADMIN |
94
103
  | `ft staff list` · `create` · `set-role <id>` | Workspace staff (`--data <json>`) | ADMIN |
95
104
  | `ft reports summary` | KPIs (`--period 7d\|30d\|90d\|1y`) | VIEWER |
96
- | `ft reports export buyers\|subscribers` | Export buyers / subscribers | ADMIN |
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 |
97
107
 
98
108
  > **Write operations** (`create`/`update`/`delete` and actions like `publish`,
99
109
  > `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.5.0",
9
+ version: "0.6.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",
@@ -70,7 +70,7 @@ var package_default = {
70
70
  // src/client/client.gen.ts
71
71
  import { createClient, createConfig } from "@hey-api/client-fetch";
72
72
  var client = createClient(createConfig({
73
- baseUrl: "https://admin.appfreeticket.com/api/v1"
73
+ baseUrl: "http://localhost:3000/api/v1"
74
74
  }));
75
75
 
76
76
  // src/client/sdk.gen.ts
@@ -306,6 +306,22 @@ var getSales = (options) => {
306
306
  ...options
307
307
  });
308
308
  };
309
+ var postSales = (options) => {
310
+ return (options.client ?? client).post({
311
+ security: [
312
+ {
313
+ name: "Authorization",
314
+ type: "apiKey"
315
+ }
316
+ ],
317
+ url: "/sales",
318
+ ...options,
319
+ headers: {
320
+ "Content-Type": "application/json",
321
+ ...options?.headers
322
+ }
323
+ });
324
+ };
309
325
  var getSalesId = (options) => {
310
326
  return (options.client ?? client).get({
311
327
  security: [
@@ -526,6 +542,18 @@ var getReportsSummary = (options) => {
526
542
  ...options
527
543
  });
528
544
  };
545
+ var getReportsInventory = (options) => {
546
+ return (options?.client ?? client).get({
547
+ security: [
548
+ {
549
+ name: "Authorization",
550
+ type: "apiKey"
551
+ }
552
+ ],
553
+ url: "/reports/inventory",
554
+ ...options
555
+ });
556
+ };
529
557
  var getReportsReconciliation = (options) => {
530
558
  return (options.client ?? client).get({
531
559
  security: [
@@ -550,6 +578,18 @@ var getReportsExportsReconciliation = (options) => {
550
578
  ...options
551
579
  });
552
580
  };
581
+ var getReportsExportsAttendees = (options) => {
582
+ return (options?.client ?? client).get({
583
+ security: [
584
+ {
585
+ name: "Authorization",
586
+ type: "apiKey"
587
+ }
588
+ ],
589
+ url: "/reports/exports/attendees",
590
+ ...options
591
+ });
592
+ };
553
593
  var getReportsExportsBuyers = (options) => {
554
594
  return (options?.client ?? client).get({
555
595
  security: [
@@ -574,6 +614,198 @@ var getReportsExportsSubscribers = (options) => {
574
614
  ...options
575
615
  });
576
616
  };
617
+ var getReportsByEvent = (options) => {
618
+ return (options?.client ?? client).get({
619
+ security: [
620
+ {
621
+ name: "Authorization",
622
+ type: "apiKey"
623
+ }
624
+ ],
625
+ url: "/reports/by-event",
626
+ ...options
627
+ });
628
+ };
629
+ var getReportsTimeseries = (options) => {
630
+ return (options.client ?? client).get({
631
+ security: [
632
+ {
633
+ name: "Authorization",
634
+ type: "apiKey"
635
+ }
636
+ ],
637
+ url: "/reports/timeseries",
638
+ ...options
639
+ });
640
+ };
641
+ var getDiscounts = (options) => {
642
+ return (options?.client ?? client).get({
643
+ security: [
644
+ {
645
+ name: "Authorization",
646
+ type: "apiKey"
647
+ }
648
+ ],
649
+ url: "/discounts",
650
+ ...options
651
+ });
652
+ };
653
+ var postDiscounts = (options) => {
654
+ return (options.client ?? client).post({
655
+ security: [
656
+ {
657
+ name: "Authorization",
658
+ type: "apiKey"
659
+ }
660
+ ],
661
+ url: "/discounts",
662
+ ...options,
663
+ headers: {
664
+ "Content-Type": "application/json",
665
+ ...options?.headers
666
+ }
667
+ });
668
+ };
669
+ var deleteDiscountsId = (options) => {
670
+ return (options.client ?? client).delete({
671
+ security: [
672
+ {
673
+ name: "Authorization",
674
+ type: "apiKey"
675
+ }
676
+ ],
677
+ url: "/discounts/{id}",
678
+ ...options
679
+ });
680
+ };
681
+ var patchDiscountsId = (options) => {
682
+ return (options.client ?? client).patch({
683
+ security: [
684
+ {
685
+ name: "Authorization",
686
+ type: "apiKey"
687
+ }
688
+ ],
689
+ url: "/discounts/{id}",
690
+ ...options,
691
+ headers: {
692
+ "Content-Type": "application/json",
693
+ ...options?.headers
694
+ }
695
+ });
696
+ };
697
+ var getWebhooks = (options) => {
698
+ return (options?.client ?? client).get({
699
+ security: [
700
+ {
701
+ name: "Authorization",
702
+ type: "apiKey"
703
+ }
704
+ ],
705
+ url: "/webhooks",
706
+ ...options
707
+ });
708
+ };
709
+ var postWebhooks = (options) => {
710
+ return (options.client ?? client).post({
711
+ security: [
712
+ {
713
+ name: "Authorization",
714
+ type: "apiKey"
715
+ }
716
+ ],
717
+ url: "/webhooks",
718
+ ...options,
719
+ headers: {
720
+ "Content-Type": "application/json",
721
+ ...options?.headers
722
+ }
723
+ });
724
+ };
725
+ var deleteWebhooksId = (options) => {
726
+ return (options.client ?? client).delete({
727
+ security: [
728
+ {
729
+ name: "Authorization",
730
+ type: "apiKey"
731
+ }
732
+ ],
733
+ url: "/webhooks/{id}",
734
+ ...options
735
+ });
736
+ };
737
+ var getMembershipPlansIdSubscribers = (options) => {
738
+ return (options.client ?? client).get({
739
+ security: [
740
+ {
741
+ name: "Authorization",
742
+ type: "apiKey"
743
+ }
744
+ ],
745
+ url: "/membership-plans/{id}/subscribers",
746
+ ...options
747
+ });
748
+ };
749
+ var postSubscriptionsIdCancel = (options) => {
750
+ return (options.client ?? client).post({
751
+ security: [
752
+ {
753
+ name: "Authorization",
754
+ type: "apiKey"
755
+ }
756
+ ],
757
+ url: "/subscriptions/{id}/cancel",
758
+ ...options
759
+ });
760
+ };
761
+ var getSalesIdTickets = (options) => {
762
+ return (options.client ?? client).get({
763
+ security: [
764
+ {
765
+ name: "Authorization",
766
+ type: "apiKey"
767
+ }
768
+ ],
769
+ url: "/sales/{id}/tickets",
770
+ ...options
771
+ });
772
+ };
773
+ var postTicketsTicketCodeCheckin = (options) => {
774
+ return (options.client ?? client).post({
775
+ security: [
776
+ {
777
+ name: "Authorization",
778
+ type: "apiKey"
779
+ }
780
+ ],
781
+ url: "/tickets/{ticketCode}/checkin",
782
+ ...options
783
+ });
784
+ };
785
+ var getTicketsTicketCodeAccess = (options) => {
786
+ return (options.client ?? client).get({
787
+ security: [
788
+ {
789
+ name: "Authorization",
790
+ type: "apiKey"
791
+ }
792
+ ],
793
+ url: "/tickets/{ticketCode}/access",
794
+ ...options
795
+ });
796
+ };
797
+ var postTicketsTicketCodeResend = (options) => {
798
+ return (options.client ?? client).post({
799
+ security: [
800
+ {
801
+ name: "Authorization",
802
+ type: "apiKey"
803
+ }
804
+ ],
805
+ url: "/tickets/{ticketCode}/resend",
806
+ ...options
807
+ });
808
+ };
577
809
 
578
810
  // src/admin-client/client.gen.ts
579
811
  import { createClient as createClient2, createConfig as createConfig2 } from "@hey-api/client-fetch";
@@ -1425,7 +1657,48 @@ function registerReports(program2) {
1425
1657
  );
1426
1658
  print(body.data, { json: opts.json });
1427
1659
  });
1428
- const exp = root.command("export").description("Export buyers, subscribers or reconciliation (CSV)");
1660
+ 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) => {
1661
+ configureClient(opts.workspace);
1662
+ const body = unwrap(
1663
+ await getReportsByEvent({
1664
+ query: { from: opts.from, to: opts.to, status: opts.status }
1665
+ })
1666
+ );
1667
+ print(body.data, { json: opts.json });
1668
+ });
1669
+ root.command("timeseries").description("Revenue / tickets sold bucketed over time").requiredOption("--interval <i>", "day | week | month").option("--from <date>", "created from (ISO 8601)").option("--to <date>", "created to (ISO 8601)").option("--event <id>", "filter by event").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (opts) => {
1670
+ configureClient(opts.workspace);
1671
+ const body = unwrap(
1672
+ await getReportsTimeseries({
1673
+ query: {
1674
+ interval: opts.interval,
1675
+ from: opts.from,
1676
+ to: opts.to,
1677
+ event: opts.event
1678
+ }
1679
+ })
1680
+ );
1681
+ print(body.data, { json: opts.json });
1682
+ });
1683
+ root.command("inventory").description("Capacity / sold / reserved / available per event\xB7date\xB7type").option("--event-id <id>", "filter by event").option("--event-date-id <id>", "filter by event date").option("--from <date>", "date from (ISO 8601)").option("--to <date>", "date to (ISO 8601)").option("--include-drafts", "include draft events").option("--group-by <g>", "ticketType | date | event").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (opts) => {
1684
+ configureClient(opts.workspace);
1685
+ const body = unwrap(
1686
+ await getReportsInventory({
1687
+ query: {
1688
+ eventId: opts.eventId,
1689
+ eventDateId: opts.eventDateId,
1690
+ from: opts.from,
1691
+ to: opts.to,
1692
+ includeDrafts: opts.includeDrafts,
1693
+ groupBy: opts.groupBy
1694
+ }
1695
+ })
1696
+ );
1697
+ print(body.data, { json: opts.json });
1698
+ });
1699
+ const exp = root.command("export").description(
1700
+ "Export buyers, attendees, subscribers or reconciliation (CSV)"
1701
+ );
1429
1702
  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) => {
1430
1703
  configureClient(opts.workspace);
1431
1704
  const body = unwrap(
@@ -1441,15 +1714,30 @@ function registerReports(program2) {
1441
1714
  print(body.data ?? body, { json: opts.json });
1442
1715
  });
1443
1716
  for (const [name, fn, label] of [
1444
- ["buyers", getReportsExportsBuyers, "buyers"],
1445
- ["subscribers", getReportsExportsSubscribers, "subscribers"]
1717
+ ["buyers", getReportsExportsBuyers, "buyers (one row per sale)"],
1718
+ ["attendees", getReportsExportsAttendees, "attendees (one row per ticket)"]
1446
1719
  ]) {
1447
- exp.command(name).description(`Export ${label}`).option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (opts) => {
1720
+ 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) => {
1448
1721
  configureClient(opts.workspace);
1449
- const body = unwrap(await fn({}));
1722
+ const body = unwrap(
1723
+ await fn({
1724
+ query: {
1725
+ event: opts.event,
1726
+ eventDate: opts.eventDate,
1727
+ from: opts.from,
1728
+ to: opts.to,
1729
+ status: opts.status
1730
+ }
1731
+ })
1732
+ );
1450
1733
  print(body.data ?? body, { json: opts.json });
1451
1734
  });
1452
1735
  }
1736
+ exp.command("subscribers").description("Export subscribers").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (opts) => {
1737
+ configureClient(opts.workspace);
1738
+ const body = unwrap(await getReportsExportsSubscribers({}));
1739
+ print(body.data ?? body, { json: opts.json });
1740
+ });
1453
1741
  }
1454
1742
 
1455
1743
  // src/commands/resource.ts
@@ -1566,6 +1854,34 @@ function camel2(s) {
1566
1854
  return s.replace(/-([a-z])/g, (_, c2) => c2.toUpperCase());
1567
1855
  }
1568
1856
 
1857
+ // src/commands/tickets.ts
1858
+ function registerTickets(program2) {
1859
+ const root = program2.command("tickets").description("Individual tickets: door check-in, access status, QR resend");
1860
+ root.command("access <code>").description("Read a ticket's access status without admitting it").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (code, opts) => {
1861
+ configureClient(opts.workspace);
1862
+ const body = unwrap(
1863
+ await getTicketsTicketCodeAccess({ path: { ticketCode: code } })
1864
+ );
1865
+ print(body.data ?? body, { json: opts.json });
1866
+ });
1867
+ root.command("checkin <code>").description(
1868
+ "Admit a ticket at the door (idempotent, prevents double entry)"
1869
+ ).option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (code, opts) => {
1870
+ configureClient(opts.workspace);
1871
+ const body = unwrap(
1872
+ await postTicketsTicketCodeCheckin({ path: { ticketCode: code } })
1873
+ );
1874
+ print(body.data ?? body, { json: opts.json });
1875
+ });
1876
+ root.command("resend <code>").description("Resend the ticket's confirmation email (QR)").option("--workspace <id>", "workspace override").option("--json", "raw JSON output").action(async (code, opts) => {
1877
+ configureClient(opts.workspace);
1878
+ const body = unwrap(
1879
+ await postTicketsTicketCodeResend({ path: { ticketCode: code } })
1880
+ );
1881
+ print(body.data ?? body, { json: opts.json });
1882
+ });
1883
+ }
1884
+
1569
1885
  // src/commands/workspace.ts
1570
1886
  import chalk3 from "chalk";
1571
1887
  function registerWorkspace(program2) {
@@ -1668,6 +1984,7 @@ registerResource(program, {
1668
1984
  describe: "Sales",
1669
1985
  list: getSales,
1670
1986
  get: getSalesId,
1987
+ create: postSales,
1671
1988
  actions: [
1672
1989
  { name: "cancel", describe: "Cancel a sale", fn: postSalesIdCancel },
1673
1990
  {
@@ -1675,11 +1992,43 @@ registerResource(program, {
1675
1992
  describe: "Refund a sale (--data for partial amount)",
1676
1993
  fn: postSalesIdRefund,
1677
1994
  body: true
1995
+ },
1996
+ {
1997
+ name: "tickets",
1998
+ describe: "List the individual tickets/attendees of a sale",
1999
+ fn: getSalesIdTickets
1678
2000
  }
1679
2001
  ],
1680
2002
  columns: ["id", "reference", "status", "total", "currency", "createdAt"],
1681
2003
  listFlags: [
1682
- { flag: "--status <s>", describe: "filter by status", query: "status" }
2004
+ { flag: "--status <s>", describe: "filter by status", query: "status" },
2005
+ {
2006
+ flag: "--channel <c>",
2007
+ describe: "filter by sales channel",
2008
+ query: "channel"
2009
+ },
2010
+ { flag: "--event <id>", describe: "filter by event", query: "event" },
2011
+ {
2012
+ flag: "--event-date <id>",
2013
+ describe: "filter by event date",
2014
+ query: "eventDate"
2015
+ },
2016
+ {
2017
+ flag: "--reference <ref>",
2018
+ describe: "filter by reference",
2019
+ query: "reference"
2020
+ },
2021
+ {
2022
+ flag: "--buyer <q>",
2023
+ describe: "filter by buyer name/email",
2024
+ query: "buyer"
2025
+ },
2026
+ {
2027
+ flag: "--from <date>",
2028
+ describe: "created from (ISO 8601)",
2029
+ query: "from"
2030
+ },
2031
+ { flag: "--to <date>", describe: "created to (ISO 8601)", query: "to" }
1683
2032
  ]
1684
2033
  });
1685
2034
  registerResource(program, {
@@ -1707,8 +2056,51 @@ registerResource(program, {
1707
2056
  create: postMembershipPlans,
1708
2057
  update: patchMembershipPlansId,
1709
2058
  del: deleteMembershipPlansId,
2059
+ actions: [
2060
+ {
2061
+ name: "subscribers",
2062
+ describe: "List the subscribers/members of a plan",
2063
+ fn: getMembershipPlansIdSubscribers
2064
+ }
2065
+ ],
1710
2066
  columns: ["id", "name", "price", "currency", "billingCycle"]
1711
2067
  });
2068
+ registerResource(program, {
2069
+ name: "discounts",
2070
+ describe: "Discount codes / coupons",
2071
+ list: getDiscounts,
2072
+ create: postDiscounts,
2073
+ update: patchDiscountsId,
2074
+ del: deleteDiscountsId,
2075
+ columns: ["id", "code", "type", "value", "active", "uses", "maxUses"],
2076
+ listFlags: [
2077
+ { flag: "--event <id>", describe: "filter by event", query: "event" },
2078
+ {
2079
+ flag: "--active <bool>",
2080
+ describe: "filter by active (true/false)",
2081
+ query: "active"
2082
+ }
2083
+ ]
2084
+ });
2085
+ registerResource(program, {
2086
+ name: "webhooks",
2087
+ describe: "Webhook endpoints (HMAC-signed event delivery)",
2088
+ list: getWebhooks,
2089
+ create: postWebhooks,
2090
+ del: deleteWebhooksId,
2091
+ columns: ["id", "url", "events", "active", "createdAt"]
2092
+ });
2093
+ registerResource(program, {
2094
+ name: "subscriptions",
2095
+ describe: "Plan subscriptions",
2096
+ actions: [
2097
+ {
2098
+ name: "cancel",
2099
+ describe: "Cancel a subscription",
2100
+ fn: postSubscriptionsIdCancel
2101
+ }
2102
+ ]
2103
+ });
1712
2104
  registerResource(program, {
1713
2105
  name: "venues",
1714
2106
  describe: "Venues",
@@ -1734,6 +2126,7 @@ registerResource(program, {
1734
2126
  ],
1735
2127
  columns: ["id", "name", "email", "role"]
1736
2128
  });
2129
+ registerTickets(program);
1737
2130
  registerReports(program);
1738
2131
  registerAdmin(program);
1739
2132
  if (process.argv.length <= 2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freeticket/cli",
3
- "version": "0.5.0",
3
+ "version": "0.6.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",