@freeticket/cli 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +147 -130
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// package.json
|
|
4
4
|
var package_default = {
|
|
5
5
|
name: "@freeticket/cli",
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.14.0",
|
|
7
7
|
description: "Official FreeTicket CLI \u2014 consumes the B2B REST API for events, sales, tickets, memberships, venues, staff, and reports.",
|
|
8
8
|
keywords: [
|
|
9
9
|
"freeticket",
|
|
@@ -164,15 +164,35 @@ var client = createClient(createConfig({
|
|
|
164
164
|
}));
|
|
165
165
|
|
|
166
166
|
// src/client/sdk.gen.ts
|
|
167
|
-
var
|
|
168
|
-
return (options
|
|
169
|
-
|
|
167
|
+
var getEventsIdDates = (options) => {
|
|
168
|
+
return (options.client ?? client).get({
|
|
169
|
+
security: [
|
|
170
|
+
{
|
|
171
|
+
name: "Authorization",
|
|
172
|
+
type: "apiKey"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "x-api-key",
|
|
176
|
+
type: "apiKey"
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
url: "/events/{id}/dates",
|
|
170
180
|
...options
|
|
171
181
|
});
|
|
172
182
|
};
|
|
173
|
-
var
|
|
183
|
+
var postEventsIdDates = (options) => {
|
|
174
184
|
return (options.client ?? client).post({
|
|
175
|
-
|
|
185
|
+
security: [
|
|
186
|
+
{
|
|
187
|
+
name: "Authorization",
|
|
188
|
+
type: "apiKey"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "x-api-key",
|
|
192
|
+
type: "apiKey"
|
|
193
|
+
}
|
|
194
|
+
],
|
|
195
|
+
url: "/events/{id}/dates",
|
|
176
196
|
...options,
|
|
177
197
|
headers: {
|
|
178
198
|
"Content-Type": "application/json",
|
|
@@ -180,17 +200,23 @@ var postAuthDeviceToken = (options) => {
|
|
|
180
200
|
}
|
|
181
201
|
});
|
|
182
202
|
};
|
|
183
|
-
var
|
|
184
|
-
return (options
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
203
|
+
var getEvents = (options) => {
|
|
204
|
+
return (options?.client ?? client).get({
|
|
205
|
+
security: [
|
|
206
|
+
{
|
|
207
|
+
name: "Authorization",
|
|
208
|
+
type: "apiKey"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: "x-api-key",
|
|
212
|
+
type: "apiKey"
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
url: "/events",
|
|
216
|
+
...options
|
|
191
217
|
});
|
|
192
218
|
};
|
|
193
|
-
var
|
|
219
|
+
var postEvents = (options) => {
|
|
194
220
|
return (options.client ?? client).post({
|
|
195
221
|
security: [
|
|
196
222
|
{
|
|
@@ -202,7 +228,7 @@ var postWorkspaces = (options) => {
|
|
|
202
228
|
type: "apiKey"
|
|
203
229
|
}
|
|
204
230
|
],
|
|
205
|
-
url: "/
|
|
231
|
+
url: "/events",
|
|
206
232
|
...options,
|
|
207
233
|
headers: {
|
|
208
234
|
"Content-Type": "application/json",
|
|
@@ -210,7 +236,7 @@ var postWorkspaces = (options) => {
|
|
|
210
236
|
}
|
|
211
237
|
});
|
|
212
238
|
};
|
|
213
|
-
var
|
|
239
|
+
var getContentVideos = (options) => {
|
|
214
240
|
return (options?.client ?? client).get({
|
|
215
241
|
security: [
|
|
216
242
|
{
|
|
@@ -222,11 +248,11 @@ var getMe = (options) => {
|
|
|
222
248
|
type: "apiKey"
|
|
223
249
|
}
|
|
224
250
|
],
|
|
225
|
-
url: "/
|
|
251
|
+
url: "/content/videos",
|
|
226
252
|
...options
|
|
227
253
|
});
|
|
228
254
|
};
|
|
229
|
-
var
|
|
255
|
+
var getContentLives = (options) => {
|
|
230
256
|
return (options?.client ?? client).get({
|
|
231
257
|
security: [
|
|
232
258
|
{
|
|
@@ -238,11 +264,37 @@ var getEvents = (options) => {
|
|
|
238
264
|
type: "apiKey"
|
|
239
265
|
}
|
|
240
266
|
],
|
|
241
|
-
url: "/
|
|
267
|
+
url: "/content/lives",
|
|
242
268
|
...options
|
|
243
269
|
});
|
|
244
270
|
};
|
|
245
|
-
var
|
|
271
|
+
var postAuthDeviceCode = (options) => {
|
|
272
|
+
return (options?.client ?? client).post({
|
|
273
|
+
url: "/auth/device/code",
|
|
274
|
+
...options
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
var postAuthDeviceToken = (options) => {
|
|
278
|
+
return (options.client ?? client).post({
|
|
279
|
+
url: "/auth/device/token",
|
|
280
|
+
...options,
|
|
281
|
+
headers: {
|
|
282
|
+
"Content-Type": "application/json",
|
|
283
|
+
...options?.headers
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
};
|
|
287
|
+
var postAuthSignup = (options) => {
|
|
288
|
+
return (options.client ?? client).post({
|
|
289
|
+
url: "/auth/signup",
|
|
290
|
+
...options,
|
|
291
|
+
headers: {
|
|
292
|
+
"Content-Type": "application/json",
|
|
293
|
+
...options?.headers
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
};
|
|
297
|
+
var postWorkspaces = (options) => {
|
|
246
298
|
return (options.client ?? client).post({
|
|
247
299
|
security: [
|
|
248
300
|
{
|
|
@@ -254,7 +306,7 @@ var postEvents = (options) => {
|
|
|
254
306
|
type: "apiKey"
|
|
255
307
|
}
|
|
256
308
|
],
|
|
257
|
-
url: "/
|
|
309
|
+
url: "/workspaces",
|
|
258
310
|
...options,
|
|
259
311
|
headers: {
|
|
260
312
|
"Content-Type": "application/json",
|
|
@@ -262,6 +314,22 @@ var postEvents = (options) => {
|
|
|
262
314
|
}
|
|
263
315
|
});
|
|
264
316
|
};
|
|
317
|
+
var getMe = (options) => {
|
|
318
|
+
return (options?.client ?? client).get({
|
|
319
|
+
security: [
|
|
320
|
+
{
|
|
321
|
+
name: "Authorization",
|
|
322
|
+
type: "apiKey"
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: "x-api-key",
|
|
326
|
+
type: "apiKey"
|
|
327
|
+
}
|
|
328
|
+
],
|
|
329
|
+
url: "/me",
|
|
330
|
+
...options
|
|
331
|
+
});
|
|
332
|
+
};
|
|
265
333
|
var deleteEventsId = (options) => {
|
|
266
334
|
return (options.client ?? client).delete({
|
|
267
335
|
security: [
|
|
@@ -346,42 +414,6 @@ var postEventsIdCancel = (options) => {
|
|
|
346
414
|
...options
|
|
347
415
|
});
|
|
348
416
|
};
|
|
349
|
-
var getEventsIdDates = (options) => {
|
|
350
|
-
return (options.client ?? client).get({
|
|
351
|
-
security: [
|
|
352
|
-
{
|
|
353
|
-
name: "Authorization",
|
|
354
|
-
type: "apiKey"
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
name: "x-api-key",
|
|
358
|
-
type: "apiKey"
|
|
359
|
-
}
|
|
360
|
-
],
|
|
361
|
-
url: "/events/{id}/dates",
|
|
362
|
-
...options
|
|
363
|
-
});
|
|
364
|
-
};
|
|
365
|
-
var postEventsIdDates = (options) => {
|
|
366
|
-
return (options.client ?? client).post({
|
|
367
|
-
security: [
|
|
368
|
-
{
|
|
369
|
-
name: "Authorization",
|
|
370
|
-
type: "apiKey"
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
name: "x-api-key",
|
|
374
|
-
type: "apiKey"
|
|
375
|
-
}
|
|
376
|
-
],
|
|
377
|
-
url: "/events/{id}/dates",
|
|
378
|
-
...options,
|
|
379
|
-
headers: {
|
|
380
|
-
"Content-Type": "application/json",
|
|
381
|
-
...options?.headers
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
};
|
|
385
417
|
var deleteEventsIdDatesDateId = (options) => {
|
|
386
418
|
return (options.client ?? client).delete({
|
|
387
419
|
security: [
|
|
@@ -578,26 +610,6 @@ var postSalesIdCancel = (options) => {
|
|
|
578
610
|
}
|
|
579
611
|
});
|
|
580
612
|
};
|
|
581
|
-
var postSalesIdRefund = (options) => {
|
|
582
|
-
return (options.client ?? client).post({
|
|
583
|
-
security: [
|
|
584
|
-
{
|
|
585
|
-
name: "Authorization",
|
|
586
|
-
type: "apiKey"
|
|
587
|
-
},
|
|
588
|
-
{
|
|
589
|
-
name: "x-api-key",
|
|
590
|
-
type: "apiKey"
|
|
591
|
-
}
|
|
592
|
-
],
|
|
593
|
-
url: "/sales/{id}/refund",
|
|
594
|
-
...options,
|
|
595
|
-
headers: {
|
|
596
|
-
"Content-Type": "application/json",
|
|
597
|
-
...options?.headers
|
|
598
|
-
}
|
|
599
|
-
});
|
|
600
|
-
};
|
|
601
613
|
var getMembershipPlans = (options) => {
|
|
602
614
|
return (options?.client ?? client).get({
|
|
603
615
|
security: [
|
|
@@ -1282,22 +1294,6 @@ var patchTicketsTicketCode = (options) => {
|
|
|
1282
1294
|
}
|
|
1283
1295
|
});
|
|
1284
1296
|
};
|
|
1285
|
-
var postTicketsTicketCodeResend = (options) => {
|
|
1286
|
-
return (options.client ?? client).post({
|
|
1287
|
-
security: [
|
|
1288
|
-
{
|
|
1289
|
-
name: "Authorization",
|
|
1290
|
-
type: "apiKey"
|
|
1291
|
-
},
|
|
1292
|
-
{
|
|
1293
|
-
name: "x-api-key",
|
|
1294
|
-
type: "apiKey"
|
|
1295
|
-
}
|
|
1296
|
-
],
|
|
1297
|
-
url: "/tickets/{ticketCode}/resend",
|
|
1298
|
-
...options
|
|
1299
|
-
});
|
|
1300
|
-
};
|
|
1301
1297
|
var postTicketsTicketCodeCheckin = (options) => {
|
|
1302
1298
|
return (options.client ?? client).post({
|
|
1303
1299
|
security: [
|
|
@@ -1386,22 +1382,6 @@ var deleteApiKeysId = (options) => {
|
|
|
1386
1382
|
...options
|
|
1387
1383
|
});
|
|
1388
1384
|
};
|
|
1389
|
-
var getContentVideos = (options) => {
|
|
1390
|
-
return (options?.client ?? client).get({
|
|
1391
|
-
security: [
|
|
1392
|
-
{
|
|
1393
|
-
name: "Authorization",
|
|
1394
|
-
type: "apiKey"
|
|
1395
|
-
},
|
|
1396
|
-
{
|
|
1397
|
-
name: "x-api-key",
|
|
1398
|
-
type: "apiKey"
|
|
1399
|
-
}
|
|
1400
|
-
],
|
|
1401
|
-
url: "/content/videos",
|
|
1402
|
-
...options
|
|
1403
|
-
});
|
|
1404
|
-
};
|
|
1405
1385
|
var getContentPosts = (options) => {
|
|
1406
1386
|
return (options?.client ?? client).get({
|
|
1407
1387
|
security: [
|
|
@@ -1438,22 +1418,6 @@ var postContentPosts = (options) => {
|
|
|
1438
1418
|
}
|
|
1439
1419
|
});
|
|
1440
1420
|
};
|
|
1441
|
-
var getContentLives = (options) => {
|
|
1442
|
-
return (options?.client ?? client).get({
|
|
1443
|
-
security: [
|
|
1444
|
-
{
|
|
1445
|
-
name: "Authorization",
|
|
1446
|
-
type: "apiKey"
|
|
1447
|
-
},
|
|
1448
|
-
{
|
|
1449
|
-
name: "x-api-key",
|
|
1450
|
-
type: "apiKey"
|
|
1451
|
-
}
|
|
1452
|
-
],
|
|
1453
|
-
url: "/content/lives",
|
|
1454
|
-
...options
|
|
1455
|
-
});
|
|
1456
|
-
};
|
|
1457
1421
|
var getContentLivesId = (options) => {
|
|
1458
1422
|
return (options.client ?? client).get({
|
|
1459
1423
|
security: [
|
|
@@ -1622,6 +1586,42 @@ var postMerchProductsImagesUploadUrl = (options) => {
|
|
|
1622
1586
|
}
|
|
1623
1587
|
});
|
|
1624
1588
|
};
|
|
1589
|
+
var postSalesIdRefund = (options) => {
|
|
1590
|
+
return (options.client ?? client).post({
|
|
1591
|
+
security: [
|
|
1592
|
+
{
|
|
1593
|
+
name: "Authorization",
|
|
1594
|
+
type: "apiKey"
|
|
1595
|
+
},
|
|
1596
|
+
{
|
|
1597
|
+
name: "x-api-key",
|
|
1598
|
+
type: "apiKey"
|
|
1599
|
+
}
|
|
1600
|
+
],
|
|
1601
|
+
url: "/sales/{id}/refund",
|
|
1602
|
+
...options,
|
|
1603
|
+
headers: {
|
|
1604
|
+
"Content-Type": "application/json",
|
|
1605
|
+
...options?.headers
|
|
1606
|
+
}
|
|
1607
|
+
});
|
|
1608
|
+
};
|
|
1609
|
+
var postTicketsTicketCodeResend = (options) => {
|
|
1610
|
+
return (options.client ?? client).post({
|
|
1611
|
+
security: [
|
|
1612
|
+
{
|
|
1613
|
+
name: "Authorization",
|
|
1614
|
+
type: "apiKey"
|
|
1615
|
+
},
|
|
1616
|
+
{
|
|
1617
|
+
name: "x-api-key",
|
|
1618
|
+
type: "apiKey"
|
|
1619
|
+
}
|
|
1620
|
+
],
|
|
1621
|
+
url: "/tickets/{ticketCode}/resend",
|
|
1622
|
+
...options
|
|
1623
|
+
});
|
|
1624
|
+
};
|
|
1625
1625
|
|
|
1626
1626
|
// src/commands/account.ts
|
|
1627
1627
|
import chalk4 from "chalk";
|
|
@@ -2064,9 +2064,12 @@ function registerAuth(program2) {
|
|
|
2064
2064
|
).option(
|
|
2065
2065
|
"--workspace <id>",
|
|
2066
2066
|
"pin this login to one workspace (default: every workspace the account reaches)"
|
|
2067
|
+
).option(
|
|
2068
|
+
"--read-only",
|
|
2069
|
+
"ask for a read-only key (GET only; any write answers 403) and refuse to save one that is not. Not a sandbox: the real gate is the person approving in the browser"
|
|
2067
2070
|
).option("--json", "raw JSON output (confirmation goes to stderr)").action(async (opts) => {
|
|
2068
2071
|
const apiUrl = opts.url ?? process.env.FT_API_URL ?? readConfig().apiUrl ?? DEFAULT_API_URL;
|
|
2069
|
-
const apiKey = opts.key ?? await deviceLogin(apiUrl);
|
|
2072
|
+
const apiKey = opts.key ?? await deviceLogin(apiUrl, opts.readOnly);
|
|
2070
2073
|
const workspaceId = opts.workspace;
|
|
2071
2074
|
configureClient(workspaceId, {
|
|
2072
2075
|
name: opts.account ?? LEGACY_ACCOUNT,
|
|
@@ -2075,6 +2078,8 @@ function registerAuth(program2) {
|
|
|
2075
2078
|
workspaceId
|
|
2076
2079
|
});
|
|
2077
2080
|
const me = unwrap(await getMe({})).data;
|
|
2081
|
+
const refusal = readOnlyRefusal(opts.readOnly, me.scope);
|
|
2082
|
+
if (refusal) fail(refusal);
|
|
2078
2083
|
const { name, replaces } = loginTarget(
|
|
2079
2084
|
readConfig(),
|
|
2080
2085
|
me.email,
|
|
@@ -2091,7 +2096,7 @@ function registerAuth(program2) {
|
|
|
2091
2096
|
replaces
|
|
2092
2097
|
);
|
|
2093
2098
|
console.error(
|
|
2094
|
-
`${chalk3.green("\u2713")} Account ${chalk3.bold(name)} saved in ${chalk3.dim(CONFIG_PATH)}`
|
|
2099
|
+
`${chalk3.green("\u2713")} Account ${chalk3.bold(name)} saved in ${chalk3.dim(CONFIG_PATH)}` + (me.scope === "read" ? chalk3.yellow(" (read-only)") : "")
|
|
2095
2100
|
);
|
|
2096
2101
|
const { activeAccount, accounts } = readConfig();
|
|
2097
2102
|
if (activeAccount && activeAccount !== name) {
|
|
@@ -2165,6 +2170,7 @@ function registerAuth(program2) {
|
|
|
2165
2170
|
account: m.account,
|
|
2166
2171
|
email: m.email,
|
|
2167
2172
|
name: m.name,
|
|
2173
|
+
scope: m.scope,
|
|
2168
2174
|
workspaces: m.workspaces.map((w) => w.slug).join(", ")
|
|
2169
2175
|
}))
|
|
2170
2176
|
);
|
|
@@ -2223,6 +2229,15 @@ function registerAuth(program2) {
|
|
|
2223
2229
|
);
|
|
2224
2230
|
});
|
|
2225
2231
|
}
|
|
2232
|
+
function withQuery(url, key, value) {
|
|
2233
|
+
const u = new URL(url);
|
|
2234
|
+
u.searchParams.set(key, value);
|
|
2235
|
+
return u.toString();
|
|
2236
|
+
}
|
|
2237
|
+
function readOnlyRefusal(readOnly, scope) {
|
|
2238
|
+
if (!readOnly || scope === "read") return null;
|
|
2239
|
+
return "That key can write (the read-only box was unticked, or --key is a write key). Nothing was saved.";
|
|
2240
|
+
}
|
|
2226
2241
|
function mask(secret) {
|
|
2227
2242
|
return `${secret.slice(0, 12)}\u2026`;
|
|
2228
2243
|
}
|
|
@@ -2234,7 +2249,7 @@ function openBrowser(url) {
|
|
|
2234
2249
|
} catch {
|
|
2235
2250
|
}
|
|
2236
2251
|
}
|
|
2237
|
-
async function deviceLogin(baseUrl) {
|
|
2252
|
+
async function deviceLogin(baseUrl, readOnly = false) {
|
|
2238
2253
|
const apiUrl = baseUrl.replace(/\/$/, "");
|
|
2239
2254
|
client.setConfig({ baseUrl: `${apiUrl}/api/v1` });
|
|
2240
2255
|
const start = unwrap(await postAuthDeviceCode({}));
|
|
@@ -2247,7 +2262,9 @@ Open ${chalk3.cyan(start.verification_uri)} and enter the code:
|
|
|
2247
2262
|
${chalk3.dim("Opening your browser\u2026 (Ctrl+C to cancel)")}
|
|
2248
2263
|
`
|
|
2249
2264
|
);
|
|
2250
|
-
openBrowser(
|
|
2265
|
+
openBrowser(
|
|
2266
|
+
readOnly ? withQuery(start.verification_uri_complete, "scope", "read") : start.verification_uri_complete
|
|
2267
|
+
);
|
|
2251
2268
|
const deadline = Date.now() + start.expires_in * 1e3;
|
|
2252
2269
|
let interval = start.interval;
|
|
2253
2270
|
while (Date.now() < deadline) {
|
package/package.json
CHANGED