@fulldivevr/workcord-cli 1.0.0 → 1.1.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 (77) hide show
  1. package/README.md +67 -25
  2. package/dist/auth.js +38 -4
  3. package/dist/client.js +5 -5
  4. package/dist/commands/auth.js +7 -2
  5. package/dist/commands/challenges.js +2 -7
  6. package/dist/commands/custom-agents.js +3 -8
  7. package/dist/commands/dm.js +2 -3
  8. package/dist/commands/messages.js +8 -21
  9. package/dist/commands/room-agents.js +2 -7
  10. package/dist/commands/rooms.js +24 -31
  11. package/dist/commands/users.js +4 -9
  12. package/dist/commands/whoami.js +24 -7
  13. package/dist/generated/commands/activity.js +3 -6
  14. package/dist/generated/commands/ai.js +3 -6
  15. package/dist/generated/commands/ambassador.js +3 -6
  16. package/dist/generated/commands/apple-iap.js +4 -9
  17. package/dist/generated/commands/attribution.js +6 -15
  18. package/dist/generated/commands/auth.js +9 -24
  19. package/dist/generated/commands/challenges.js +13 -36
  20. package/dist/generated/commands/clips.js +3 -6
  21. package/dist/generated/commands/contact-match.js +7 -18
  22. package/dist/generated/commands/content-crawler.js +2 -3
  23. package/dist/generated/commands/custom-agents.js +22 -63
  24. package/dist/generated/commands/desktop-releases.js +5 -12
  25. package/dist/generated/commands/discover.js +9 -24
  26. package/dist/generated/commands/dm.js +10 -27
  27. package/dist/generated/commands/drafts.js +3 -6
  28. package/dist/generated/commands/embed.js +3 -6
  29. package/dist/generated/commands/explore.js +2 -3
  30. package/dist/generated/commands/feed.js +4 -9
  31. package/dist/generated/commands/feedback.js +2 -3
  32. package/dist/generated/commands/gamification.js +3 -6
  33. package/dist/generated/commands/google-play-iap.js +4 -9
  34. package/dist/generated/commands/health.js +3 -6
  35. package/dist/generated/commands/internal.js +9 -24
  36. package/dist/generated/commands/interview.js +4 -9
  37. package/dist/generated/commands/invite-redirect.js +2 -3
  38. package/dist/generated/commands/jesuscord-admin.js +3 -6
  39. package/dist/generated/commands/join.js +2 -3
  40. package/dist/generated/commands/kits.js +7 -18
  41. package/dist/generated/commands/meetings.js +6 -15
  42. package/dist/generated/commands/message-folders.js +5 -12
  43. package/dist/generated/commands/messages.js +17 -48
  44. package/dist/generated/commands/one-emulator.js +2 -3
  45. package/dist/generated/commands/pdf-export.js +2 -3
  46. package/dist/generated/commands/pin-folders.js +5 -12
  47. package/dist/generated/commands/pinned-messages.js +4 -9
  48. package/dist/generated/commands/polls.js +6 -15
  49. package/dist/generated/commands/premium-feeds.js +2 -3
  50. package/dist/generated/commands/processors.js +2 -3
  51. package/dist/generated/commands/questions.js +3 -6
  52. package/dist/generated/commands/referrals.js +2 -3
  53. package/dist/generated/commands/reports.js +2 -3
  54. package/dist/generated/commands/room-a2-a.js +6 -15
  55. package/dist/generated/commands/room-agents.js +13 -36
  56. package/dist/generated/commands/room-invites.js +9 -24
  57. package/dist/generated/commands/room-owned-agent.js +3 -6
  58. package/dist/generated/commands/room-page.js +2 -3
  59. package/dist/generated/commands/rooms.js +45 -132
  60. package/dist/generated/commands/saved-messages.js +4 -9
  61. package/dist/generated/commands/saved-stories.js +7 -18
  62. package/dist/generated/commands/search.js +2 -3
  63. package/dist/generated/commands/shadow-home-agent.js +3 -6
  64. package/dist/generated/commands/shadow.js +5 -12
  65. package/dist/generated/commands/share-cards.js +4 -9
  66. package/dist/generated/commands/share.js +2 -3
  67. package/dist/generated/commands/sponsors.js +2 -3
  68. package/dist/generated/commands/stories.js +12 -33
  69. package/dist/generated/commands/story-by-id.js +2 -3
  70. package/dist/generated/commands/submissions.js +4 -9
  71. package/dist/generated/commands/subscriptions.js +8 -21
  72. package/dist/generated/commands/tips.js +3 -6
  73. package/dist/generated/commands/users.js +16 -45
  74. package/dist/generated/commands/voice-token.js +2 -3
  75. package/dist/generated/commands/well-known.js +3 -6
  76. package/dist/generated/commands/wrapped.js +2 -3
  77. package/package.json +3 -2
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "dm", "Dm operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("POST /api/v1/dm/start")
9
10
  .option("--body <json>", "request body as JSON (no schema available)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/api/v1/dm/start`;
15
14
  const body = opts.body ? JSON.parse(opts.body) : undefined;
16
15
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -23,9 +22,7 @@ export function register(program) {
23
22
  .description("POST /api/v1/dm/start-agent")
24
23
  .option("--body <json>", "request body as JSON (no schema available)")
25
24
  .action(async (opts) => {
26
- const { as } = program.opts();
27
- if (!as)
28
- throw new Error("--as <userId> is required");
25
+ const as = actingUserId(program);
29
26
  const path = `/api/v1/dm/start-agent`;
30
27
  const body = opts.body ? JSON.parse(opts.body) : undefined;
31
28
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -40,9 +37,7 @@ export function register(program) {
40
37
  .option("--limit <value>", "string")
41
38
  .option("--include-shadow <value>", "string")
42
39
  .action(async (opts) => {
43
- const { as } = program.opts();
44
- if (!as)
45
- throw new Error("--as <userId> is required");
40
+ const as = actingUserId(program);
46
41
  const path = `/api/v1/dm`;
47
42
  const query = {};
48
43
  {
@@ -71,9 +66,7 @@ export function register(program) {
71
66
  .requiredOption("--user-id <value>", "userId (path param)")
72
67
  .option("--body <json>", "request body as JSON (no schema available)")
73
68
  .action(async (opts) => {
74
- const { as } = program.opts();
75
- if (!as)
76
- throw new Error("--as <userId> is required");
69
+ const as = actingUserId(program);
77
70
  const path = `/api/v1/dm/block/${encodeURIComponent(opts.userId)}`;
78
71
  const body = opts.body ? JSON.parse(opts.body) : undefined;
79
72
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -86,9 +79,7 @@ export function register(program) {
86
79
  .description("DELETE /api/v1/dm/block/{userId}")
87
80
  .requiredOption("--user-id <value>", "userId (path param)")
88
81
  .action(async (opts) => {
89
- const { as } = program.opts();
90
- if (!as)
91
- throw new Error("--as <userId> is required");
82
+ const as = actingUserId(program);
92
83
  const path = `/api/v1/dm/block/${encodeURIComponent(opts.userId)}`;
93
84
  const data = await call({ method: "DELETE", path, asUserId: as });
94
85
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -99,9 +90,7 @@ export function register(program) {
99
90
  .command("list-blocked-users")
100
91
  .description("GET /api/v1/dm/blocked")
101
92
  .action(async (opts) => {
102
- const { as } = program.opts();
103
- if (!as)
104
- throw new Error("--as <userId> is required");
93
+ const as = actingUserId(program);
105
94
  const path = `/api/v1/dm/blocked`;
106
95
  const data = await call({ method: "GET", path, asUserId: as });
107
96
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -113,9 +102,7 @@ export function register(program) {
113
102
  .description("GET /api/v1/dm/check-block/{userId}")
114
103
  .requiredOption("--user-id <value>", "userId (path param)")
115
104
  .action(async (opts) => {
116
- const { as } = program.opts();
117
- if (!as)
118
- throw new Error("--as <userId> is required");
105
+ const as = actingUserId(program);
119
106
  const path = `/api/v1/dm/check-block/${encodeURIComponent(opts.userId)}`;
120
107
  const data = await call({ method: "GET", path, asUserId: as });
121
108
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -128,9 +115,7 @@ export function register(program) {
128
115
  .requiredOption("--room-id <value>", "roomId (path param)")
129
116
  .option("--body <json>", "request body as JSON (no schema available)")
130
117
  .action(async (opts) => {
131
- const { as } = program.opts();
132
- if (!as)
133
- throw new Error("--as <userId> is required");
118
+ const as = actingUserId(program);
134
119
  const path = `/api/v1/dm/rooms/${encodeURIComponent(opts.roomId)}/clear`;
135
120
  const body = opts.body ? JSON.parse(opts.body) : undefined;
136
121
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -143,9 +128,7 @@ export function register(program) {
143
128
  .description("DELETE /api/v1/dm/rooms/{roomId}")
144
129
  .requiredOption("--room-id <value>", "roomId (path param)")
145
130
  .action(async (opts) => {
146
- const { as } = program.opts();
147
- if (!as)
148
- throw new Error("--as <userId> is required");
131
+ const as = actingUserId(program);
149
132
  const path = `/api/v1/dm/rooms/${encodeURIComponent(opts.roomId)}`;
150
133
  const data = await call({ method: "DELETE", path, asUserId: as });
151
134
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "drafts", "Drafts operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("GET /api/v1/drafts")
9
10
  .option("--room-id <value>", "string")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/api/v1/drafts`;
15
14
  const query = {};
16
15
  {
@@ -28,9 +27,7 @@ export function register(program) {
28
27
  .description("PATCH /api/v1/drafts")
29
28
  .option("--body <json>", "request body as JSON (no schema available)")
30
29
  .action(async (opts) => {
31
- const { as } = program.opts();
32
- if (!as)
33
- throw new Error("--as <userId> is required");
30
+ const as = actingUserId(program);
34
31
  const path = `/api/v1/drafts`;
35
32
  const body = opts.body ? JSON.parse(opts.body) : undefined;
36
33
  const data = await call({ method: "PATCH", path, asUserId: as, body });
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "embed", "Embed operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("GET /embed/{storyId}")
9
10
  .requiredOption("--story-id <value>", "storyId (path param)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/embed/${encodeURIComponent(opts.storyId)}`;
15
14
  const data = await call({ method: "GET", path, asUserId: as });
16
15
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -22,9 +21,7 @@ export function register(program) {
22
21
  .description("GET /embed/{storyId}/snippet")
23
22
  .requiredOption("--story-id <value>", "storyId (path param)")
24
23
  .action(async (opts) => {
25
- const { as } = program.opts();
26
- if (!as)
27
- throw new Error("--as <userId> is required");
24
+ const as = actingUserId(program);
28
25
  const path = `/embed/${encodeURIComponent(opts.storyId)}/snippet`;
29
26
  const data = await call({ method: "GET", path, asUserId: as });
30
27
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "explore", "Explore operations");
@@ -7,9 +8,7 @@ export function register(program) {
7
8
  .command("explore-page")
8
9
  .description("GET /explore")
9
10
  .action(async (opts) => {
10
- const { as } = program.opts();
11
- if (!as)
12
- throw new Error("--as <userId> is required");
11
+ const as = actingUserId(program);
13
12
  const path = `/explore`;
14
13
  const data = await call({ method: "GET", path, asUserId: as });
15
14
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "feed", "Feed operations");
@@ -9,9 +10,7 @@ export function register(program) {
9
10
  .option("--cursor <value>", "string")
10
11
  .option("--limit <value>", "string")
11
12
  .action(async (opts) => {
12
- const { as } = program.opts();
13
- if (!as)
14
- throw new Error("--as <userId> is required");
13
+ const as = actingUserId(program);
15
14
  const path = `/api/v1/users/me/feed`;
16
15
  const query = {};
17
16
  {
@@ -34,9 +33,7 @@ export function register(program) {
34
33
  .description("GET /api/v1/users/me/feed/suggestions")
35
34
  .option("--limit <value>", "string")
36
35
  .action(async (opts) => {
37
- const { as } = program.opts();
38
- if (!as)
39
- throw new Error("--as <userId> is required");
36
+ const as = actingUserId(program);
40
37
  const path = `/api/v1/users/me/feed/suggestions`;
41
38
  const query = {};
42
39
  {
@@ -54,9 +51,7 @@ export function register(program) {
54
51
  .description("POST /api/v1/users/me/feed/dismiss")
55
52
  .option("--body <json>", "request body as JSON (no schema available)")
56
53
  .action(async (opts) => {
57
- const { as } = program.opts();
58
- if (!as)
59
- throw new Error("--as <userId> is required");
54
+ const as = actingUserId(program);
60
55
  const path = `/api/v1/users/me/feed/dismiss`;
61
56
  const body = opts.body ? JSON.parse(opts.body) : undefined;
62
57
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "feedback", "Feedback operations");
@@ -11,9 +12,7 @@ export function register(program) {
11
12
  .option("--screenshot <value>", "string")
12
13
  .option("--rating <n>", "number")
13
14
  .action(async (opts) => {
14
- const { as } = program.opts();
15
- if (!as)
16
- throw new Error("--as <userId> is required");
15
+ const as = actingUserId(program);
17
16
  const path = `/api/v1/feedback`;
18
17
  const body = {};
19
18
  {
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "gamification", "Gamification operations");
@@ -7,9 +8,7 @@ export function register(program) {
7
8
  .command("my-impact")
8
9
  .description("GET /api/v1/users/me/impact")
9
10
  .action(async (opts) => {
10
- const { as } = program.opts();
11
- if (!as)
12
- throw new Error("--as <userId> is required");
11
+ const as = actingUserId(program);
13
12
  const path = `/api/v1/users/me/impact`;
14
13
  const data = await call({ method: "GET", path, asUserId: as });
15
14
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -21,9 +20,7 @@ export function register(program) {
21
20
  .description("GET /api/v1/users/{userId}/impact")
22
21
  .requiredOption("--user-id <value>", "userId (path param)")
23
22
  .action(async (opts) => {
24
- const { as } = program.opts();
25
- if (!as)
26
- throw new Error("--as <userId> is required");
23
+ const as = actingUserId(program);
27
24
  const path = `/api/v1/users/${encodeURIComponent(opts.userId)}/impact`;
28
25
  const data = await call({ method: "GET", path, asUserId: as });
29
26
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "google-play-iap", "GooglePlayIap operations");
@@ -9,9 +10,7 @@ export function register(program) {
9
10
  .requiredOption("--purchase-token <value>", "string")
10
11
  .requiredOption("--product-id <value>", "string")
11
12
  .action(async (opts) => {
12
- const { as } = program.opts();
13
- if (!as)
14
- throw new Error("--as <userId> is required");
13
+ const as = actingUserId(program);
15
14
  const path = `/api/v1/subscriptions/google/verify`;
16
15
  const body = {};
17
16
  {
@@ -35,9 +34,7 @@ export function register(program) {
35
34
  .requiredOption("--purchase-token <value>", "string")
36
35
  .requiredOption("--product-id <value>", "string")
37
36
  .action(async (opts) => {
38
- const { as } = program.opts();
39
- if (!as)
40
- throw new Error("--as <userId> is required");
37
+ const as = actingUserId(program);
41
38
  const path = `/api/v1/subscriptions/google/restore`;
42
39
  const body = {};
43
40
  {
@@ -60,9 +57,7 @@ export function register(program) {
60
57
  .description("POST /api/v1/webhooks/google-play")
61
58
  .option("--body <json>", "request body as JSON (no schema available)")
62
59
  .action(async (opts) => {
63
- const { as } = program.opts();
64
- if (!as)
65
- throw new Error("--as <userId> is required");
60
+ const as = actingUserId(program);
66
61
  const path = `/api/v1/webhooks/google-play`;
67
62
  const body = opts.body ? JSON.parse(opts.body) : undefined;
68
63
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "health", "Health operations");
@@ -7,9 +8,7 @@ export function register(program) {
7
8
  .command("health")
8
9
  .description("GET /api/health")
9
10
  .action(async (opts) => {
10
- const { as } = program.opts();
11
- if (!as)
12
- throw new Error("--as <userId> is required");
11
+ const as = actingUserId(program);
13
12
  const path = `/api/health`;
14
13
  const data = await call({ method: "GET", path, asUserId: as });
15
14
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -20,9 +19,7 @@ export function register(program) {
20
19
  .command("hello")
21
20
  .description("GET /api/hello")
22
21
  .action(async (opts) => {
23
- const { as } = program.opts();
24
- if (!as)
25
- throw new Error("--as <userId> is required");
22
+ const as = actingUserId(program);
26
23
  const path = `/api/hello`;
27
24
  const data = await call({ method: "GET", path, asUserId: as });
28
25
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "internal", "Internal operations");
@@ -9,9 +10,7 @@ export function register(program) {
9
10
  .requiredOption("--room-id <value>", "roomId (path param)")
10
11
  .option("--body <json>", "request body as JSON (no schema available)")
11
12
  .action(async (opts) => {
12
- const { as } = program.opts();
13
- if (!as)
14
- throw new Error("--as <userId> is required");
13
+ const as = actingUserId(program);
15
14
  const path = `/api/v1/internal/rooms/${encodeURIComponent(opts.roomId)}/emit-message`;
16
15
  const body = opts.body ? JSON.parse(opts.body) : undefined;
17
16
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -24,9 +23,7 @@ export function register(program) {
24
23
  .description("POST /api/v1/internal/voice/dispatch")
25
24
  .option("--body <json>", "request body as JSON (no schema available)")
26
25
  .action(async (opts) => {
27
- const { as } = program.opts();
28
- if (!as)
29
- throw new Error("--as <userId> is required");
26
+ const as = actingUserId(program);
30
27
  const path = `/api/v1/internal/voice/dispatch`;
31
28
  const body = opts.body ? JSON.parse(opts.body) : undefined;
32
29
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -42,9 +39,7 @@ export function register(program) {
42
39
  .option("--limit <json>", " (JSON)")
43
40
  .option("--q <json>", " (JSON)")
44
41
  .action(async (opts) => {
45
- const { as } = program.opts();
46
- if (!as)
47
- throw new Error("--as <userId> is required");
42
+ const as = actingUserId(program);
48
43
  const path = `/api/v1/internal/users`;
49
44
  const query = {};
50
45
  {
@@ -78,9 +73,7 @@ export function register(program) {
78
73
  .requiredOption("--user-id <value>", "userId (path param)")
79
74
  .option("--body <json>", "request body as JSON (no schema available)")
80
75
  .action(async (opts) => {
81
- const { as } = program.opts();
82
- if (!as)
83
- throw new Error("--as <userId> is required");
76
+ const as = actingUserId(program);
84
77
  const path = `/api/v1/internal/users/${encodeURIComponent(opts.userId)}/tier`;
85
78
  const body = opts.body ? JSON.parse(opts.body) : undefined;
86
79
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -94,9 +87,7 @@ export function register(program) {
94
87
  .option("--limit <json>", " (JSON)")
95
88
  .option("--q <json>", " (JSON)")
96
89
  .action(async (opts) => {
97
- const { as } = program.opts();
98
- if (!as)
99
- throw new Error("--as <userId> is required");
90
+ const as = actingUserId(program);
100
91
  const path = `/api/v1/internal/email-auth/allowlist`;
101
92
  const query = {};
102
93
  {
@@ -119,9 +110,7 @@ export function register(program) {
119
110
  .description("POST /api/v1/internal/email-auth/allowlist")
120
111
  .option("--body <json>", "request body as JSON (no schema available)")
121
112
  .action(async (opts) => {
122
- const { as } = program.opts();
123
- if (!as)
124
- throw new Error("--as <userId> is required");
113
+ const as = actingUserId(program);
125
114
  const path = `/api/v1/internal/email-auth/allowlist`;
126
115
  const body = opts.body ? JSON.parse(opts.body) : undefined;
127
116
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -135,9 +124,7 @@ export function register(program) {
135
124
  .requiredOption("--email <value>", "email (path param)")
136
125
  .option("--body <json>", "request body as JSON (no schema available)")
137
126
  .action(async (opts) => {
138
- const { as } = program.opts();
139
- if (!as)
140
- throw new Error("--as <userId> is required");
127
+ const as = actingUserId(program);
141
128
  const path = `/api/v1/internal/email-auth/allowlist/${encodeURIComponent(opts.email)}`;
142
129
  const body = opts.body ? JSON.parse(opts.body) : undefined;
143
130
  const data = await call({ method: "PATCH", path, asUserId: as, body });
@@ -150,9 +137,7 @@ export function register(program) {
150
137
  .description("DELETE /api/v1/internal/email-auth/allowlist/{email}")
151
138
  .requiredOption("--email <value>", "email (path param)")
152
139
  .action(async (opts) => {
153
- const { as } = program.opts();
154
- if (!as)
155
- throw new Error("--as <userId> is required");
140
+ const as = actingUserId(program);
156
141
  const path = `/api/v1/internal/email-auth/allowlist/${encodeURIComponent(opts.email)}`;
157
142
  const data = await call({ method: "DELETE", path, asUserId: as });
158
143
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,6 +1,7 @@
1
1
  // Auto-generated. Do not edit by hand. Regenerate via `npm run generate`.
2
2
  import { Option } from "commander";
3
3
  import { call } from "../../client.js";
4
+ import { actingUserId } from "../../auth.js";
4
5
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
5
6
  export function register(program) {
6
7
  const group = getOrCreateGroup(program, "interview", "Interview operations");
@@ -11,9 +12,7 @@ export function register(program) {
11
12
  .addOption(new Option("--mode <value>", "string, enum").choices(["room", "agent"]).makeOptionMandatory())
12
13
  .option("--seed <value>", "string, ≤10000 chars")
13
14
  .action(async (opts) => {
14
- const { as } = program.opts();
15
- if (!as)
16
- throw new Error("--as <userId> is required");
15
+ const as = actingUserId(program);
17
16
  const path = `/api/v1/assistant/interview/start`;
18
17
  const body = {};
19
18
  {
@@ -37,9 +36,7 @@ export function register(program) {
37
36
  .requiredOption("--session-id <value>", "sessionId (path param)")
38
37
  .requiredOption("--message <value>", "string, ≤10000 chars")
39
38
  .action(async (opts) => {
40
- const { as } = program.opts();
41
- if (!as)
42
- throw new Error("--as <userId> is required");
39
+ const as = actingUserId(program);
43
40
  const path = `/api/v1/assistant/interview/${encodeURIComponent(opts.sessionId)}/reply`;
44
41
  const body = {};
45
42
  {
@@ -58,9 +55,7 @@ export function register(program) {
58
55
  .requiredOption("--session-id <value>", "sessionId (path param)")
59
56
  .requiredOption("--proposal <json>", " (JSON)")
60
57
  .action(async (opts) => {
61
- const { as } = program.opts();
62
- if (!as)
63
- throw new Error("--as <userId> is required");
58
+ const as = actingUserId(program);
64
59
  const path = `/api/v1/assistant/interview/${encodeURIComponent(opts.sessionId)}/confirm`;
65
60
  const body = {};
66
61
  {
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "invite-redirect", "InviteRedirect operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("GET /c/{inviteCode}")
9
10
  .requiredOption("--invite-code <value>", "inviteCode (path param)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/c/${encodeURIComponent(opts.inviteCode)}`;
15
14
  const data = await call({ method: "GET", path, asUserId: as });
16
15
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "jesuscord-admin", "JesuscordAdmin operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("POST /api/v1/admin/jesuscord/setup")
9
10
  .option("--body <json>", "request body as JSON (no schema available)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/api/v1/admin/jesuscord/setup`;
15
14
  const body = opts.body ? JSON.parse(opts.body) : undefined;
16
15
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -23,9 +22,7 @@ export function register(program) {
23
22
  .description("POST /api/v1/admin/jesuscord/cleanup")
24
23
  .option("--body <json>", "request body as JSON (no schema available)")
25
24
  .action(async (opts) => {
26
- const { as } = program.opts();
27
- if (!as)
28
- throw new Error("--as <userId> is required");
25
+ const as = actingUserId(program);
29
26
  const path = `/api/v1/admin/jesuscord/cleanup`;
30
27
  const body = opts.body ? JSON.parse(opts.body) : undefined;
31
28
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "join", "Join operations");
@@ -9,9 +10,7 @@ export function register(program) {
9
10
  .requiredOption("--code <value>", "code (path param)")
10
11
  .option("--ref <json>", " (JSON)")
11
12
  .action(async (opts) => {
12
- const { as } = program.opts();
13
- if (!as)
14
- throw new Error("--as <userId> is required");
13
+ const as = actingUserId(program);
15
14
  const path = `/join/${encodeURIComponent(opts.code)}`;
16
15
  const query = {};
17
16
  {
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "kits", "Kits operations");
@@ -9,9 +10,7 @@ export function register(program) {
9
10
  .option("--cursor <value>", "string")
10
11
  .option("--limit <value>", "string")
11
12
  .action(async (opts) => {
12
- const { as } = program.opts();
13
- if (!as)
14
- throw new Error("--as <userId> is required");
13
+ const as = actingUserId(program);
15
14
  const path = `/api/v1/users/me/kits`;
16
15
  const query = {};
17
16
  {
@@ -35,9 +34,7 @@ export function register(program) {
35
34
  .requiredOption("--kit-id <value>", "kitId (path param)")
36
35
  .option("--body <json>", "request body as JSON (no schema available)")
37
36
  .action(async (opts) => {
38
- const { as } = program.opts();
39
- if (!as)
40
- throw new Error("--as <userId> is required");
37
+ const as = actingUserId(program);
41
38
  const path = `/api/v1/kits/${encodeURIComponent(opts.kitId)}/approve`;
42
39
  const body = opts.body ? JSON.parse(opts.body) : undefined;
43
40
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -51,9 +48,7 @@ export function register(program) {
51
48
  .requiredOption("--kit-id <value>", "kitId (path param)")
52
49
  .requiredOption("--element-id <value>", "elementId (path param)")
53
50
  .action(async (opts) => {
54
- const { as } = program.opts();
55
- if (!as)
56
- throw new Error("--as <userId> is required");
51
+ const as = actingUserId(program);
57
52
  const path = `/api/v1/kits/${encodeURIComponent(opts.kitId)}/elements/${encodeURIComponent(opts.elementId)}`;
58
53
  const data = await call({ method: "DELETE", path, asUserId: as });
59
54
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -65,9 +60,7 @@ export function register(program) {
65
60
  .description("GET /api/v1/kits/{kitId}/public")
66
61
  .requiredOption("--kit-id <value>", "kitId (path param)")
67
62
  .action(async (opts) => {
68
- const { as } = program.opts();
69
- if (!as)
70
- throw new Error("--as <userId> is required");
63
+ const as = actingUserId(program);
71
64
  const path = `/api/v1/kits/${encodeURIComponent(opts.kitId)}/public`;
72
65
  const data = await call({ method: "GET", path, asUserId: as });
73
66
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -80,9 +73,7 @@ export function register(program) {
80
73
  .requiredOption("--kit-id <value>", "kitId (path param)")
81
74
  .requiredOption("--element-id <value>", "elementId (path param)")
82
75
  .action(async (opts) => {
83
- const { as } = program.opts();
84
- if (!as)
85
- throw new Error("--as <userId> is required");
76
+ const as = actingUserId(program);
86
77
  const path = `/api/v1/kits/${encodeURIComponent(opts.kitId)}/elements/${encodeURIComponent(opts.elementId)}/public`;
87
78
  const data = await call({ method: "GET", path, asUserId: as });
88
79
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -95,9 +86,7 @@ export function register(program) {
95
86
  .requiredOption("--pastor-id <value>", "pastorId (path param)")
96
87
  .option("--body <json>", "request body as JSON (no schema available)")
97
88
  .action(async (opts) => {
98
- const { as } = program.opts();
99
- if (!as)
100
- throw new Error("--as <userId> is required");
89
+ const as = actingUserId(program);
101
90
  const path = `/api/v1/jesuscord/pastors/${encodeURIComponent(opts.pastorId)}/share-proof-dm`;
102
91
  const body = opts.body ? JSON.parse(opts.body) : undefined;
103
92
  const data = await call({ method: "POST", path, asUserId: as, body });