@fulldivevr/workcord-cli 1.0.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 (82) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +312 -0
  3. package/dist/auth.js +9 -0
  4. package/dist/cli.js +46 -0
  5. package/dist/client.js +125 -0
  6. package/dist/commands/_group.js +5 -0
  7. package/dist/commands/auth.js +125 -0
  8. package/dist/commands/challenges.js +51 -0
  9. package/dist/commands/custom-agents.js +120 -0
  10. package/dist/commands/dm.js +35 -0
  11. package/dist/commands/messages.js +360 -0
  12. package/dist/commands/room-agents.js +47 -0
  13. package/dist/commands/rooms.js +687 -0
  14. package/dist/commands/users.js +126 -0
  15. package/dist/commands/whoami.js +15 -0
  16. package/dist/generated/_helpers.js +8 -0
  17. package/dist/generated/commands/activity.js +46 -0
  18. package/dist/generated/commands/ai.js +40 -0
  19. package/dist/generated/commands/ambassador.js +34 -0
  20. package/dist/generated/commands/apple-iap.js +61 -0
  21. package/dist/generated/commands/attribution.js +130 -0
  22. package/dist/generated/commands/auth.js +205 -0
  23. package/dist/generated/commands/challenges.js +251 -0
  24. package/dist/generated/commands/clips.js +71 -0
  25. package/dist/generated/commands/contact-match.js +92 -0
  26. package/dist/generated/commands/content-crawler.js +27 -0
  27. package/dist/generated/commands/custom-agents.js +346 -0
  28. package/dist/generated/commands/desktop-releases.js +236 -0
  29. package/dist/generated/commands/discover.js +236 -0
  30. package/dist/generated/commands/dm.js +155 -0
  31. package/dist/generated/commands/drafts.js +41 -0
  32. package/dist/generated/commands/embed.js +34 -0
  33. package/dist/generated/commands/explore.js +19 -0
  34. package/dist/generated/commands/feed.js +67 -0
  35. package/dist/generated/commands/feedback.js +44 -0
  36. package/dist/generated/commands/gamification.js +33 -0
  37. package/dist/generated/commands/google-play-iap.js +73 -0
  38. package/dist/generated/commands/health.js +32 -0
  39. package/dist/generated/commands/internal.js +162 -0
  40. package/dist/generated/commands/interview.js +76 -0
  41. package/dist/generated/commands/invite-redirect.js +20 -0
  42. package/dist/generated/commands/jesuscord-admin.js +36 -0
  43. package/dist/generated/commands/join.js +27 -0
  44. package/dist/generated/commands/kits.js +108 -0
  45. package/dist/generated/commands/meetings.js +81 -0
  46. package/dist/generated/commands/message-folders.js +68 -0
  47. package/dist/generated/commands/messages.js +418 -0
  48. package/dist/generated/commands/one-emulator.js +32 -0
  49. package/dist/generated/commands/pdf-export.js +19 -0
  50. package/dist/generated/commands/pin-folders.js +72 -0
  51. package/dist/generated/commands/pinned-messages.js +81 -0
  52. package/dist/generated/commands/polls.js +152 -0
  53. package/dist/generated/commands/premium-feeds.js +32 -0
  54. package/dist/generated/commands/processors.js +22 -0
  55. package/dist/generated/commands/questions.js +54 -0
  56. package/dist/generated/commands/referrals.js +19 -0
  57. package/dist/generated/commands/reports.js +21 -0
  58. package/dist/generated/commands/room-a2-a.js +81 -0
  59. package/dist/generated/commands/room-agents.js +273 -0
  60. package/dist/generated/commands/room-invites.js +155 -0
  61. package/dist/generated/commands/room-owned-agent.js +36 -0
  62. package/dist/generated/commands/room-page.js +20 -0
  63. package/dist/generated/commands/rooms.js +1117 -0
  64. package/dist/generated/commands/saved-messages.js +84 -0
  65. package/dist/generated/commands/saved-stories.js +125 -0
  66. package/dist/generated/commands/search.js +44 -0
  67. package/dist/generated/commands/shadow-home-agent.js +36 -0
  68. package/dist/generated/commands/shadow.js +64 -0
  69. package/dist/generated/commands/share-cards.js +85 -0
  70. package/dist/generated/commands/share.js +20 -0
  71. package/dist/generated/commands/sponsors.js +20 -0
  72. package/dist/generated/commands/stories.js +324 -0
  73. package/dist/generated/commands/story-by-id.js +20 -0
  74. package/dist/generated/commands/submissions.js +112 -0
  75. package/dist/generated/commands/subscriptions.js +103 -0
  76. package/dist/generated/commands/tips.js +76 -0
  77. package/dist/generated/commands/users.js +373 -0
  78. package/dist/generated/commands/voice-token.js +21 -0
  79. package/dist/generated/commands/well-known.js +32 -0
  80. package/dist/generated/commands/wrapped.js +20 -0
  81. package/dist/generated/index.js +131 -0
  82. package/package.json +60 -0
@@ -0,0 +1,126 @@
1
+ import { call } from "../client.js";
2
+ import { getOrCreateGroup } from "./_group.js";
3
+ const DEFAULT_LIMIT = 20;
4
+ const MAX_LIMIT = 100;
5
+ const MAX_PUBLIC_PLAN = "teams";
6
+ const PLAN_TIERS = new Set(["free", "creator", "pro", "teams"]);
7
+ const PLAN_PLATFORMS = new Set(["stripe", "apple", "google", "internal"]);
8
+ const ACCOUNT_TYPES = new Set(["all", "authenticated", "anonymous"]);
9
+ function parseLimit(v) {
10
+ const limit = Number(v);
11
+ if (!Number.isInteger(limit) || limit < 1 || limit > MAX_LIMIT) {
12
+ throw new Error(`--limit must be an integer from 1 to ${MAX_LIMIT}`);
13
+ }
14
+ return limit;
15
+ }
16
+ function parsePlanTier(v) {
17
+ if (!PLAN_TIERS.has(v)) {
18
+ throw new Error(`--tier must be one of: ${Array.from(PLAN_TIERS).join(", ")}`);
19
+ }
20
+ return v;
21
+ }
22
+ function parsePlanPlatform(v) {
23
+ if (!PLAN_PLATFORMS.has(v)) {
24
+ throw new Error(`--platform must be one of: ${Array.from(PLAN_PLATFORMS).join(", ")}`);
25
+ }
26
+ return v;
27
+ }
28
+ function parseAccountType(v) {
29
+ if (!ACCOUNT_TYPES.has(v)) {
30
+ throw new Error(`--account-type must be one of: ${Array.from(ACCOUNT_TYPES).join(", ")}`);
31
+ }
32
+ return v;
33
+ }
34
+ function internalApiKey() {
35
+ const key = process.env.WORKCORD_INTERNAL_API_KEY;
36
+ if (!key) {
37
+ throw new Error("WORKCORD_INTERNAL_API_KEY must be set");
38
+ }
39
+ return key;
40
+ }
41
+ async function setPlanOverride(opts) {
42
+ return call({
43
+ method: "POST",
44
+ path: `/api/v1/internal/users/${encodeURIComponent(opts.user)}/tier`,
45
+ asUserId: opts.as,
46
+ headers: { "x-internal-key": internalApiKey() },
47
+ body: { tier: opts.tier, platform: opts.platform },
48
+ });
49
+ }
50
+ export function registerUsers(program) {
51
+ const group = getOrCreateGroup(program, "users", "Users operations");
52
+ group
53
+ .command("list")
54
+ .description("List/search one page of public users. Output: { users, count, nextCursor }.")
55
+ .option("--q <query>", "search query; empty string lists users", "")
56
+ .option("--limit <n>", `page size, 1-${MAX_LIMIT}`, String(DEFAULT_LIMIT))
57
+ .option("--cursor <cursor>", "pagination cursor from the previous page's nextCursor")
58
+ .option("--account-type <type>", "internal filter: all, authenticated, anonymous")
59
+ .option("--authenticated", "shortcut for --account-type authenticated")
60
+ .action(async (opts) => {
61
+ const { as } = program.opts();
62
+ if (!as)
63
+ throw new Error("--as <userId> is required");
64
+ const limit = parseLimit(opts.limit);
65
+ if (opts.authenticated && opts.accountType) {
66
+ throw new Error("Use either --authenticated or --account-type, not both");
67
+ }
68
+ const accountType = opts.authenticated ? "authenticated" : opts.accountType;
69
+ if (accountType !== undefined) {
70
+ const data = (await call({
71
+ method: "GET",
72
+ path: "/api/v1/internal/users",
73
+ query: { q: opts.q, limit, cursor: opts.cursor, accountType: parseAccountType(accountType) },
74
+ asUserId: as,
75
+ headers: { "x-internal-key": internalApiKey() },
76
+ }));
77
+ const users = data.users ?? [];
78
+ process.stdout.write(JSON.stringify({ ...data, users, count: users.length, nextCursor: data.cursor ?? null }) + "\n");
79
+ return;
80
+ }
81
+ const data = (await call({
82
+ method: "GET",
83
+ path: "/api/v1/search",
84
+ query: { type: "users", q: opts.q, limit, cursor: opts.cursor },
85
+ asUserId: as,
86
+ }));
87
+ const users = data.users ?? [];
88
+ process.stdout.write(JSON.stringify({ ...data, users, count: users.length, nextCursor: data.cursor ?? null }) + "\n");
89
+ });
90
+ group
91
+ .command("set-plan")
92
+ .description("Set a user's plan override through the internal API. Requires WORKCORD_INTERNAL_API_KEY.")
93
+ .requiredOption("--user <userId>", "target user id")
94
+ .requiredOption("--tier <tier>", `plan tier: ${Array.from(PLAN_TIERS).join(", ")}`)
95
+ .option("--platform <platform>", `subscription platform: ${Array.from(PLAN_PLATFORMS).join(", ")}`)
96
+ .action(async (opts) => {
97
+ const { as } = program.opts();
98
+ if (!as)
99
+ throw new Error("--as <userId> is required");
100
+ const data = await setPlanOverride({
101
+ as,
102
+ user: opts.user,
103
+ tier: parsePlanTier(opts.tier),
104
+ platform: opts.platform === undefined ? undefined : parsePlanPlatform(opts.platform),
105
+ });
106
+ process.stdout.write(JSON.stringify(data) + "\n");
107
+ });
108
+ group
109
+ .command("set-max-plan")
110
+ .description(`Set a user to the max public plan (${MAX_PUBLIC_PLAN}) through the internal API.`)
111
+ .requiredOption("--user <userId>", "target user id")
112
+ .option("--platform <platform>", `subscription platform: ${Array.from(PLAN_PLATFORMS).join(", ")}`)
113
+ .action(async (opts) => {
114
+ const { as } = program.opts();
115
+ if (!as)
116
+ throw new Error("--as <userId> is required");
117
+ const data = await setPlanOverride({
118
+ as,
119
+ user: opts.user,
120
+ tier: MAX_PUBLIC_PLAN,
121
+ platform: opts.platform === undefined ? undefined : parsePlanPlatform(opts.platform),
122
+ });
123
+ process.stdout.write(JSON.stringify(data) + "\n");
124
+ });
125
+ }
126
+ //# sourceMappingURL=users.js.map
@@ -0,0 +1,15 @@
1
+ import { mintToken } from "../auth.js";
2
+ export function registerWhoami(program) {
3
+ program
4
+ .command("whoami")
5
+ .description("print the acting userId and a freshly minted JWT")
6
+ .action(() => {
7
+ const { as } = program.opts();
8
+ if (!as) {
9
+ throw new Error("--as <userId> is required");
10
+ }
11
+ const token = mintToken(as);
12
+ process.stdout.write(JSON.stringify({ userId: as, token }) + "\n");
13
+ });
14
+ }
15
+ //# sourceMappingURL=whoami.js.map
@@ -0,0 +1,8 @@
1
+ export function getOrCreateGroup(program, name, description) {
2
+ const existing = program.commands.find((c) => c.name() === name);
3
+ return existing ?? program.command(name).description(description);
4
+ }
5
+ export function hasSubcommand(group, name) {
6
+ return group.commands.some((c) => c.name() === name);
7
+ }
8
+ //# sourceMappingURL=_helpers.js.map
@@ -0,0 +1,46 @@
1
+ import { call } from "../../client.js";
2
+ import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
+ export function register(program) {
4
+ const group = getOrCreateGroup(program, "activity", "Activity operations");
5
+ if (!hasSubcommand(group, "daily")) {
6
+ group
7
+ .command("daily")
8
+ .description("GET /api/v1/users/me/activity/daily")
9
+ .option("--period <value>", "string")
10
+ .action(async (opts) => {
11
+ const { as } = program.opts();
12
+ if (!as)
13
+ throw new Error("--as <userId> is required");
14
+ const path = `/api/v1/users/me/activity/daily`;
15
+ const query = {};
16
+ {
17
+ const v = opts.period;
18
+ if (v !== undefined)
19
+ query["period"] = v;
20
+ }
21
+ const data = await call({ method: "GET", path, asUserId: as, query });
22
+ process.stdout.write(JSON.stringify(data) + "\n");
23
+ });
24
+ }
25
+ if (!hasSubcommand(group, "by-room")) {
26
+ group
27
+ .command("by-room")
28
+ .description("GET /api/v1/users/me/activity/by-room")
29
+ .option("--period <value>", "string")
30
+ .action(async (opts) => {
31
+ const { as } = program.opts();
32
+ if (!as)
33
+ throw new Error("--as <userId> is required");
34
+ const path = `/api/v1/users/me/activity/by-room`;
35
+ const query = {};
36
+ {
37
+ const v = opts.period;
38
+ if (v !== undefined)
39
+ query["period"] = v;
40
+ }
41
+ const data = await call({ method: "GET", path, asUserId: as, query });
42
+ process.stdout.write(JSON.stringify(data) + "\n");
43
+ });
44
+ }
45
+ }
46
+ //# sourceMappingURL=activity.js.map
@@ -0,0 +1,40 @@
1
+ import { call } from "../../client.js";
2
+ import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
+ export function register(program) {
4
+ const group = getOrCreateGroup(program, "ai", "AI operations");
5
+ if (!hasSubcommand(group, "ask")) {
6
+ group
7
+ .command("ask")
8
+ .description("POST /api/v1/rooms/{roomId}/ai/ask")
9
+ .requiredOption("--room-id <value>", "roomId (path param)")
10
+ .requiredOption("--query <value>", "string, ≤500 chars")
11
+ .action(async (opts) => {
12
+ const { as } = program.opts();
13
+ if (!as)
14
+ throw new Error("--as <userId> is required");
15
+ const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/ai/ask`;
16
+ const body = {};
17
+ {
18
+ const v = opts.query;
19
+ if (v !== undefined)
20
+ body["query"] = v;
21
+ }
22
+ const data = await call({ method: "POST", path, asUserId: as, body });
23
+ process.stdout.write(JSON.stringify(data) + "\n");
24
+ });
25
+ }
26
+ if (!hasSubcommand(group, "marketplace")) {
27
+ group
28
+ .command("marketplace")
29
+ .description("GET /api/v1/ai/agents/marketplace")
30
+ .action(async (opts) => {
31
+ const { as } = program.opts();
32
+ if (!as)
33
+ throw new Error("--as <userId> is required");
34
+ const path = `/api/v1/ai/agents/marketplace`;
35
+ const data = await call({ method: "GET", path, asUserId: as });
36
+ process.stdout.write(JSON.stringify(data) + "\n");
37
+ });
38
+ }
39
+ }
40
+ //# sourceMappingURL=ai.js.map
@@ -0,0 +1,34 @@
1
+ import { call } from "../../client.js";
2
+ import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
+ export function register(program) {
4
+ const group = getOrCreateGroup(program, "ambassador", "Ambassador operations");
5
+ if (!hasSubcommand(group, "get")) {
6
+ group
7
+ .command("get")
8
+ .description("GET /api/v1/users/me/ambassador")
9
+ .action(async (opts) => {
10
+ const { as } = program.opts();
11
+ if (!as)
12
+ throw new Error("--as <userId> is required");
13
+ const path = `/api/v1/users/me/ambassador`;
14
+ const data = await call({ method: "GET", path, asUserId: as });
15
+ process.stdout.write(JSON.stringify(data) + "\n");
16
+ });
17
+ }
18
+ if (!hasSubcommand(group, "apply")) {
19
+ group
20
+ .command("apply")
21
+ .description("POST /api/v1/users/me/ambassador")
22
+ .option("--body <json>", "request body as JSON (no schema available)")
23
+ .action(async (opts) => {
24
+ const { as } = program.opts();
25
+ if (!as)
26
+ throw new Error("--as <userId> is required");
27
+ const path = `/api/v1/users/me/ambassador`;
28
+ const body = opts.body ? JSON.parse(opts.body) : undefined;
29
+ const data = await call({ method: "POST", path, asUserId: as, body });
30
+ process.stdout.write(JSON.stringify(data) + "\n");
31
+ });
32
+ }
33
+ }
34
+ //# sourceMappingURL=ambassador.js.map
@@ -0,0 +1,61 @@
1
+ import { call } from "../../client.js";
2
+ import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
+ export function register(program) {
4
+ const group = getOrCreateGroup(program, "apple-iap", "AppleIap operations");
5
+ if (!hasSubcommand(group, "verify")) {
6
+ group
7
+ .command("verify")
8
+ .description("POST /api/v1/subscriptions/apple/verify")
9
+ .requiredOption("--signed-transaction-jws <value>", "string")
10
+ .action(async (opts) => {
11
+ const { as } = program.opts();
12
+ if (!as)
13
+ throw new Error("--as <userId> is required");
14
+ const path = `/api/v1/subscriptions/apple/verify`;
15
+ const body = {};
16
+ {
17
+ const v = opts.signedTransactionJws;
18
+ if (v !== undefined)
19
+ body["signedTransactionJws"] = v;
20
+ }
21
+ const data = await call({ method: "POST", path, asUserId: as, body });
22
+ process.stdout.write(JSON.stringify(data) + "\n");
23
+ });
24
+ }
25
+ if (!hasSubcommand(group, "restore")) {
26
+ group
27
+ .command("restore")
28
+ .description("POST /api/v1/subscriptions/apple/restore")
29
+ .requiredOption("--signed-transaction-jws <value>", "string")
30
+ .action(async (opts) => {
31
+ const { as } = program.opts();
32
+ if (!as)
33
+ throw new Error("--as <userId> is required");
34
+ const path = `/api/v1/subscriptions/apple/restore`;
35
+ const body = {};
36
+ {
37
+ const v = opts.signedTransactionJws;
38
+ if (v !== undefined)
39
+ body["signedTransactionJws"] = v;
40
+ }
41
+ const data = await call({ method: "POST", path, asUserId: as, body });
42
+ process.stdout.write(JSON.stringify(data) + "\n");
43
+ });
44
+ }
45
+ if (!hasSubcommand(group, "webhook")) {
46
+ group
47
+ .command("webhook")
48
+ .description("POST /api/v1/webhooks/apple")
49
+ .option("--body <json>", "request body as JSON (no schema available)")
50
+ .action(async (opts) => {
51
+ const { as } = program.opts();
52
+ if (!as)
53
+ throw new Error("--as <userId> is required");
54
+ const path = `/api/v1/webhooks/apple`;
55
+ const body = opts.body ? JSON.parse(opts.body) : undefined;
56
+ const data = await call({ method: "POST", path, asUserId: as, body });
57
+ process.stdout.write(JSON.stringify(data) + "\n");
58
+ });
59
+ }
60
+ }
61
+ //# sourceMappingURL=apple-iap.js.map
@@ -0,0 +1,130 @@
1
+ import { call } from "../../client.js";
2
+ import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
+ export function register(program) {
4
+ const group = getOrCreateGroup(program, "attribution", "Attribution operations");
5
+ if (!hasSubcommand(group, "rooms-install")) {
6
+ group
7
+ .command("rooms-install")
8
+ .description("POST /api/v1/attribution/rooms-install")
9
+ .requiredOption("--invite-code <value>", "string")
10
+ .requiredOption("--device-id <value>", "string")
11
+ .requiredOption("--platform <value>", "string")
12
+ .action(async (opts) => {
13
+ const { as } = program.opts();
14
+ if (!as)
15
+ throw new Error("--as <userId> is required");
16
+ const path = `/api/v1/attribution/rooms-install`;
17
+ const body = {};
18
+ {
19
+ const v = opts.inviteCode;
20
+ if (v !== undefined)
21
+ body["inviteCode"] = v;
22
+ }
23
+ {
24
+ const v = opts.deviceId;
25
+ if (v !== undefined)
26
+ body["deviceId"] = v;
27
+ }
28
+ {
29
+ const v = opts.platform;
30
+ if (v !== undefined)
31
+ body["platform"] = v;
32
+ }
33
+ const data = await call({ method: "POST", path, asUserId: as, body });
34
+ process.stdout.write(JSON.stringify(data) + "\n");
35
+ });
36
+ }
37
+ if (!hasSubcommand(group, "generic-install")) {
38
+ group
39
+ .command("generic-install")
40
+ .description("POST /api/v1/attribution/install")
41
+ .requiredOption("--ref <value>", "string")
42
+ .requiredOption("--challenge-id <value>", "string")
43
+ .requiredOption("--platform <value>", "string")
44
+ .requiredOption("--device-id <value>", "string")
45
+ .requiredOption("--hmac <value>", "string")
46
+ .action(async (opts) => {
47
+ const { as } = program.opts();
48
+ if (!as)
49
+ throw new Error("--as <userId> is required");
50
+ const path = `/api/v1/attribution/install`;
51
+ const body = {};
52
+ {
53
+ const v = opts.ref;
54
+ if (v !== undefined)
55
+ body["ref"] = v;
56
+ }
57
+ {
58
+ const v = opts.challengeId;
59
+ if (v !== undefined)
60
+ body["challengeId"] = v;
61
+ }
62
+ {
63
+ const v = opts.platform;
64
+ if (v !== undefined)
65
+ body["platform"] = v;
66
+ }
67
+ {
68
+ const v = opts.deviceId;
69
+ if (v !== undefined)
70
+ body["deviceId"] = v;
71
+ }
72
+ {
73
+ const v = opts.hmac;
74
+ if (v !== undefined)
75
+ body["hmac"] = v;
76
+ }
77
+ const data = await call({ method: "POST", path, asUserId: as, body });
78
+ process.stdout.write(JSON.stringify(data) + "\n");
79
+ });
80
+ }
81
+ if (!hasSubcommand(group, "pending-attribution")) {
82
+ group
83
+ .command("pending-attribution")
84
+ .description("GET /api/v1/attribution/pending")
85
+ .action(async (opts) => {
86
+ const { as } = program.opts();
87
+ if (!as)
88
+ throw new Error("--as <userId> is required");
89
+ const path = `/api/v1/attribution/pending`;
90
+ const data = await call({ method: "GET", path, asUserId: as });
91
+ process.stdout.write(JSON.stringify(data) + "\n");
92
+ });
93
+ }
94
+ if (!hasSubcommand(group, "ios-pending")) {
95
+ group
96
+ .command("ios-pending")
97
+ .description("GET /api/v1/attribution/ios-pending")
98
+ .requiredOption("--bundle_id <value>", "string")
99
+ .action(async (opts) => {
100
+ const { as } = program.opts();
101
+ if (!as)
102
+ throw new Error("--as <userId> is required");
103
+ const path = `/api/v1/attribution/ios-pending`;
104
+ const query = {};
105
+ {
106
+ const v = opts.bundle_id;
107
+ if (v !== undefined)
108
+ query["bundle_id"] = v;
109
+ }
110
+ const data = await call({ method: "GET", path, asUserId: as, query });
111
+ process.stdout.write(JSON.stringify(data) + "\n");
112
+ });
113
+ }
114
+ if (!hasSubcommand(group, "branch-webhook")) {
115
+ group
116
+ .command("branch-webhook")
117
+ .description("POST /api/v1/attribution/branch-webhook")
118
+ .option("--body <json>", "request body as JSON (no schema available)")
119
+ .action(async (opts) => {
120
+ const { as } = program.opts();
121
+ if (!as)
122
+ throw new Error("--as <userId> is required");
123
+ const path = `/api/v1/attribution/branch-webhook`;
124
+ const body = opts.body ? JSON.parse(opts.body) : undefined;
125
+ const data = await call({ method: "POST", path, asUserId: as, body });
126
+ process.stdout.write(JSON.stringify(data) + "\n");
127
+ });
128
+ }
129
+ }
130
+ //# sourceMappingURL=attribution.js.map
@@ -0,0 +1,205 @@
1
+ // Auto-generated. Do not edit by hand. Regenerate via `npm run generate`.
2
+ import { Option } from "commander";
3
+ import { call } from "../../client.js";
4
+ import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
5
+ export function register(program) {
6
+ const group = getOrCreateGroup(program, "auth", "Auth operations");
7
+ if (!hasSubcommand(group, "send-otp")) {
8
+ group
9
+ .command("send-otp")
10
+ .description("POST /api/v1/auth/send-otp")
11
+ .requiredOption("--phone <value>", "string")
12
+ .action(async (opts) => {
13
+ const { as } = program.opts();
14
+ if (!as)
15
+ throw new Error("--as <userId> is required");
16
+ const path = `/api/v1/auth/send-otp`;
17
+ const body = {};
18
+ {
19
+ const v = opts.phone;
20
+ if (v !== undefined)
21
+ body["phone"] = v;
22
+ }
23
+ const data = await call({ method: "POST", path, asUserId: as, body });
24
+ process.stdout.write(JSON.stringify(data) + "\n");
25
+ });
26
+ }
27
+ if (!hasSubcommand(group, "verify-otp")) {
28
+ group
29
+ .command("verify-otp")
30
+ .description("POST /api/v1/auth/verify-otp")
31
+ .requiredOption("--phone <value>", "string")
32
+ .requiredOption("--code <value>", "string, ≤6 chars, ≥6 chars")
33
+ .action(async (opts) => {
34
+ const { as } = program.opts();
35
+ if (!as)
36
+ throw new Error("--as <userId> is required");
37
+ const path = `/api/v1/auth/verify-otp`;
38
+ const body = {};
39
+ {
40
+ const v = opts.phone;
41
+ if (v !== undefined)
42
+ body["phone"] = v;
43
+ }
44
+ {
45
+ const v = opts.code;
46
+ if (v !== undefined)
47
+ body["code"] = v;
48
+ }
49
+ const data = await call({ method: "POST", path, asUserId: as, body });
50
+ process.stdout.write(JSON.stringify(data) + "\n");
51
+ });
52
+ }
53
+ if (!hasSubcommand(group, "refresh")) {
54
+ group
55
+ .command("refresh")
56
+ .description("POST /api/v1/auth/refresh")
57
+ .requiredOption("--refresh-token <value>", "string")
58
+ .action(async (opts) => {
59
+ const { as } = program.opts();
60
+ if (!as)
61
+ throw new Error("--as <userId> is required");
62
+ const path = `/api/v1/auth/refresh`;
63
+ const body = {};
64
+ {
65
+ const v = opts.refreshToken;
66
+ if (v !== undefined)
67
+ body["refreshToken"] = v;
68
+ }
69
+ const data = await call({ method: "POST", path, asUserId: as, body });
70
+ process.stdout.write(JSON.stringify(data) + "\n");
71
+ });
72
+ }
73
+ if (!hasSubcommand(group, "phone-login")) {
74
+ group
75
+ .command("phone-login")
76
+ .description("POST /api/v1/auth/phone/login")
77
+ .requiredOption("--id-token <value>", "string")
78
+ .action(async (opts) => {
79
+ const { as } = program.opts();
80
+ if (!as)
81
+ throw new Error("--as <userId> is required");
82
+ const path = `/api/v1/auth/phone/login`;
83
+ const body = {};
84
+ {
85
+ const v = opts.idToken;
86
+ if (v !== undefined)
87
+ body["idToken"] = v;
88
+ }
89
+ const data = await call({ method: "POST", path, asUserId: as, body });
90
+ process.stdout.write(JSON.stringify(data) + "\n");
91
+ });
92
+ }
93
+ if (!hasSubcommand(group, "convert-guest")) {
94
+ group
95
+ .command("convert-guest")
96
+ .description("POST /api/v1/auth/convert-guest")
97
+ .requiredOption("--phone <value>", "string")
98
+ .requiredOption("--code <value>", "string, ≤6 chars, ≥6 chars")
99
+ .action(async (opts) => {
100
+ const { as } = program.opts();
101
+ if (!as)
102
+ throw new Error("--as <userId> is required");
103
+ const path = `/api/v1/auth/convert-guest`;
104
+ const body = {};
105
+ {
106
+ const v = opts.phone;
107
+ if (v !== undefined)
108
+ body["phone"] = v;
109
+ }
110
+ {
111
+ const v = opts.code;
112
+ if (v !== undefined)
113
+ body["code"] = v;
114
+ }
115
+ const data = await call({ method: "POST", path, asUserId: as, body });
116
+ process.stdout.write(JSON.stringify(data) + "\n");
117
+ });
118
+ }
119
+ if (!hasSubcommand(group, "guest-join")) {
120
+ group
121
+ .command("guest-join")
122
+ .description("POST /api/v1/auth/guest")
123
+ .option("--body <json>", "request body as JSON (no schema available)")
124
+ .action(async (opts) => {
125
+ const { as } = program.opts();
126
+ if (!as)
127
+ throw new Error("--as <userId> is required");
128
+ const path = `/api/v1/auth/guest`;
129
+ const body = opts.body ? JSON.parse(opts.body) : undefined;
130
+ const data = await call({ method: "POST", path, asUserId: as, body });
131
+ process.stdout.write(JSON.stringify(data) + "\n");
132
+ });
133
+ }
134
+ if (!hasSubcommand(group, "social-login")) {
135
+ group
136
+ .command("social-login")
137
+ .description("POST /api/v1/auth/social")
138
+ .addOption(new Option("--provider <value>", "string, enum").choices(["apple", "google", "facebook", "twitter"]).makeOptionMandatory())
139
+ .requiredOption("--token <value>", "string")
140
+ .option("--nonce <value>", "string")
141
+ .option("--first-name <value>", "string")
142
+ .option("--last-name <value>", "string")
143
+ .option("--authorization-code <value>", "string")
144
+ .action(async (opts) => {
145
+ const { as } = program.opts();
146
+ if (!as)
147
+ throw new Error("--as <userId> is required");
148
+ const path = `/api/v1/auth/social`;
149
+ const body = {};
150
+ {
151
+ const v = opts.provider;
152
+ if (v !== undefined)
153
+ body["provider"] = v;
154
+ }
155
+ {
156
+ const v = opts.token;
157
+ if (v !== undefined)
158
+ body["token"] = v;
159
+ }
160
+ {
161
+ const v = opts.nonce;
162
+ if (v !== undefined)
163
+ body["nonce"] = v;
164
+ }
165
+ {
166
+ const v = opts.firstName;
167
+ if (v !== undefined)
168
+ body["firstName"] = v;
169
+ }
170
+ {
171
+ const v = opts.lastName;
172
+ if (v !== undefined)
173
+ body["lastName"] = v;
174
+ }
175
+ {
176
+ const v = opts.authorizationCode;
177
+ if (v !== undefined)
178
+ body["authorizationCode"] = v;
179
+ }
180
+ const data = await call({ method: "POST", path, asUserId: as, body });
181
+ process.stdout.write(JSON.stringify(data) + "\n");
182
+ });
183
+ }
184
+ if (!hasSubcommand(group, "dev-otp")) {
185
+ group
186
+ .command("dev-otp")
187
+ .description("GET /api/v1/auth/dev-otp")
188
+ .requiredOption("--phone <value>", "string")
189
+ .action(async (opts) => {
190
+ const { as } = program.opts();
191
+ if (!as)
192
+ throw new Error("--as <userId> is required");
193
+ const path = `/api/v1/auth/dev-otp`;
194
+ const query = {};
195
+ {
196
+ const v = opts.phone;
197
+ if (v !== undefined)
198
+ query["phone"] = v;
199
+ }
200
+ const data = await call({ method: "GET", path, asUserId: as, query });
201
+ process.stdout.write(JSON.stringify(data) + "\n");
202
+ });
203
+ }
204
+ }
205
+ //# sourceMappingURL=auth.js.map