epilot 0.1.0 → 0.1.2

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 (108) hide show
  1. package/README.md +7 -345
  2. package/bin/epilot.js +5 -0
  3. package/package.json +7 -33
  4. package/definitions/access-token.json +0 -663
  5. package/definitions/address-suggestions.json +0 -582
  6. package/definitions/address.json +0 -578
  7. package/definitions/ai-agents.json +0 -1711
  8. package/definitions/app.json +0 -4443
  9. package/definitions/audit-logs.json +0 -305
  10. package/definitions/automation.json +0 -4815
  11. package/definitions/billing.json +0 -837
  12. package/definitions/blueprint-manifest.json +0 -3376
  13. package/definitions/consent.json +0 -344
  14. package/definitions/customer-portal.json +0 -15000
  15. package/definitions/dashboard.json +0 -484
  16. package/definitions/data-management.json +0 -962
  17. package/definitions/deduplication.json +0 -183
  18. package/definitions/design.json +0 -1423
  19. package/definitions/document.json +0 -758
  20. package/definitions/email-settings.json +0 -2627
  21. package/definitions/email-template.json +0 -1419
  22. package/definitions/entity-mapping.json +0 -1642
  23. package/definitions/entity.json +0 -10074
  24. package/definitions/environments.json +0 -363
  25. package/definitions/erp-integration.json +0 -5845
  26. package/definitions/event-catalog.json +0 -1051
  27. package/definitions/file.json +0 -2842
  28. package/definitions/iban.json +0 -132
  29. package/definitions/journey.json +0 -2341
  30. package/definitions/kanban.json +0 -929
  31. package/definitions/message.json +0 -2660
  32. package/definitions/metering.json +0 -2321
  33. package/definitions/notes.json +0 -1531
  34. package/definitions/notification.json +0 -1425
  35. package/definitions/organization.json +0 -629
  36. package/definitions/partner-directory.json +0 -1718
  37. package/definitions/permissions.json +0 -1480
  38. package/definitions/pricing-tier.json +0 -105
  39. package/definitions/pricing.json +0 -9884
  40. package/definitions/purpose.json +0 -524
  41. package/definitions/sandbox.json +0 -453
  42. package/definitions/submission.json +0 -313
  43. package/definitions/targeting.json +0 -1474
  44. package/definitions/template-variables.json +0 -1408
  45. package/definitions/user.json +0 -2408
  46. package/definitions/validation-rules.json +0 -1491
  47. package/definitions/webhooks.json +0 -1525
  48. package/definitions/workflow-definition.json +0 -3417
  49. package/definitions/workflow.json +0 -4106
  50. package/dist/access-token-OG5AR7UB.js +0 -51
  51. package/dist/address-QUSMK5GV.js +0 -51
  52. package/dist/address-suggestions-E5SQNUS5.js +0 -51
  53. package/dist/ai-agents-PM42SJY3.js +0 -51
  54. package/dist/app-YTM3XAJL.js +0 -51
  55. package/dist/audit-logs-NXP7GFKX.js +0 -51
  56. package/dist/auth-CCBTXH5U.js +0 -113
  57. package/dist/auth-login-2ZIXM47J.js +0 -137
  58. package/dist/auth-token-OS4BEEVZ.js +0 -43
  59. package/dist/automation-TDJASTEV.js +0 -51
  60. package/dist/billing-M4MRBLEK.js +0 -51
  61. package/dist/bin/epilot.js +0 -104
  62. package/dist/blueprint-manifest-NQL7NRMV.js +0 -51
  63. package/dist/chunk-57PPARIW.js +0 -715
  64. package/dist/chunk-5WUPDZ5D.js +0 -76
  65. package/dist/chunk-IST42ZNL.js +0 -78
  66. package/dist/chunk-RC3GCXCI.js +0 -76
  67. package/dist/chunk-TKZLQD2B.js +0 -72
  68. package/dist/chunk-UJ6TU34M.js +0 -56
  69. package/dist/completion-GRQM2FJQ.js +0 -168
  70. package/dist/consent-KQ7MJAS6.js +0 -51
  71. package/dist/customer-portal-VUVSKWAQ.js +0 -51
  72. package/dist/dashboard-GVR4XNGR.js +0 -51
  73. package/dist/data-management-2RD3DLOS.js +0 -51
  74. package/dist/deduplication-PY77EINR.js +0 -51
  75. package/dist/design-M4FP2K5R.js +0 -51
  76. package/dist/document-P4QA7LEZ.js +0 -51
  77. package/dist/email-settings-7HGGRCCM.js +0 -51
  78. package/dist/email-template-3HXQI4CH.js +0 -51
  79. package/dist/entity-XUESZBPJ.js +0 -51
  80. package/dist/entity-mapping-JBKWWBH2.js +0 -51
  81. package/dist/environments-KKOS7ONY.js +0 -51
  82. package/dist/erp-integration-YTOWHCAW.js +0 -51
  83. package/dist/event-catalog-UKLZUGC4.js +0 -51
  84. package/dist/file-IFZNZ547.js +0 -51
  85. package/dist/iban-X2IW2NWU.js +0 -51
  86. package/dist/interactive-46ICLQKL.js +0 -16
  87. package/dist/journey-JU6X2KMX.js +0 -51
  88. package/dist/kanban-VHUU44PM.js +0 -51
  89. package/dist/message-AOUWJ4YX.js +0 -51
  90. package/dist/metering-RDS3XBD5.js +0 -51
  91. package/dist/notes-WE2UC75B.js +0 -51
  92. package/dist/notification-FKFNBHYZ.js +0 -51
  93. package/dist/organization-LMNFF6BX.js +0 -51
  94. package/dist/partner-directory-IIZVQDXJ.js +0 -51
  95. package/dist/permissions-AYCMVM7Y.js +0 -51
  96. package/dist/pricing-PS26FWBS.js +0 -51
  97. package/dist/pricing-tier-FBXWQ6T3.js +0 -51
  98. package/dist/profile-5Q5YARG7.js +0 -135
  99. package/dist/purpose-HE4E4SVU.js +0 -51
  100. package/dist/sandbox-Z7BU4UAD.js +0 -51
  101. package/dist/submission-MWVDF2ZB.js +0 -51
  102. package/dist/targeting-7NM5GDJ6.js +0 -51
  103. package/dist/template-variables-AJAR7PAV.js +0 -51
  104. package/dist/user-A26XQXG3.js +0 -51
  105. package/dist/validation-rules-VZTISEG2.js +0 -51
  106. package/dist/webhooks-RXH67WZ3.js +0 -51
  107. package/dist/workflow-G4FUUGZQ.js +0 -51
  108. package/dist/workflow-definition-LJYLMMGD.js +0 -51
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- callApi
4
- } from "./chunk-57PPARIW.js";
5
- import "./chunk-5WUPDZ5D.js";
6
- import "./chunk-IST42ZNL.js";
7
- import "./chunk-RC3GCXCI.js";
8
- import "./chunk-TKZLQD2B.js";
9
-
10
- // src/commands/apis/access-token.ts
11
- import { defineCommand } from "citty";
12
- var access_token_default = defineCommand({
13
- meta: { name: "access-token", description: "Access Token API" },
14
- args: {
15
- operation: { type: "positional", description: "operationId to call", required: false },
16
- param: { type: "string", alias: "p", description: "Parameter key=value" },
17
- data: { type: "string", alias: "d", description: "Request body JSON" },
18
- header: { type: "string", alias: "H", description: "Custom header" },
19
- include: { type: "boolean", alias: "i", description: "Include response headers" },
20
- definition: { type: "string", description: "Override OpenAPI spec file/URL" },
21
- server: { type: "string", alias: "s", description: "Override server base URL" },
22
- profile: { type: "string", description: "Use a named profile" },
23
- token: { type: "string", alias: "t", description: "Bearer token" },
24
- json: { type: "boolean", description: "Output raw JSON" },
25
- verbose: { type: "boolean", alias: "v", description: "Verbose output" },
26
- interactive: { type: "boolean", description: "Interactive mode" },
27
- jsonata: { type: "string", description: "JSONata expression to transform response" },
28
- _ophelp: { type: "boolean", description: "Show operation help", required: false }
29
- },
30
- run: ({ args, rawArgs }) => {
31
- const positionalArgs = [];
32
- if (args.operation && rawArgs) {
33
- const opIdx = rawArgs.indexOf(args.operation);
34
- if (opIdx >= 0) {
35
- for (let i = opIdx + 1; i < rawArgs.length; i++) {
36
- const arg = rawArgs[i];
37
- if (arg.startsWith("-")) break;
38
- positionalArgs.push(arg);
39
- }
40
- }
41
- }
42
- return callApi("access-token", {
43
- ...args,
44
- help: !!args._ophelp,
45
- _args: positionalArgs
46
- });
47
- }
48
- });
49
- export {
50
- access_token_default as default
51
- };
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- callApi
4
- } from "./chunk-57PPARIW.js";
5
- import "./chunk-5WUPDZ5D.js";
6
- import "./chunk-IST42ZNL.js";
7
- import "./chunk-RC3GCXCI.js";
8
- import "./chunk-TKZLQD2B.js";
9
-
10
- // src/commands/apis/address.ts
11
- import { defineCommand } from "citty";
12
- var address_default = defineCommand({
13
- meta: { name: "address", description: "Address API" },
14
- args: {
15
- operation: { type: "positional", description: "operationId to call", required: false },
16
- param: { type: "string", alias: "p", description: "Parameter key=value" },
17
- data: { type: "string", alias: "d", description: "Request body JSON" },
18
- header: { type: "string", alias: "H", description: "Custom header" },
19
- include: { type: "boolean", alias: "i", description: "Include response headers" },
20
- definition: { type: "string", description: "Override OpenAPI spec file/URL" },
21
- server: { type: "string", alias: "s", description: "Override server base URL" },
22
- profile: { type: "string", description: "Use a named profile" },
23
- token: { type: "string", alias: "t", description: "Bearer token" },
24
- json: { type: "boolean", description: "Output raw JSON" },
25
- verbose: { type: "boolean", alias: "v", description: "Verbose output" },
26
- interactive: { type: "boolean", description: "Interactive mode" },
27
- jsonata: { type: "string", description: "JSONata expression to transform response" },
28
- _ophelp: { type: "boolean", description: "Show operation help", required: false }
29
- },
30
- run: ({ args, rawArgs }) => {
31
- const positionalArgs = [];
32
- if (args.operation && rawArgs) {
33
- const opIdx = rawArgs.indexOf(args.operation);
34
- if (opIdx >= 0) {
35
- for (let i = opIdx + 1; i < rawArgs.length; i++) {
36
- const arg = rawArgs[i];
37
- if (arg.startsWith("-")) break;
38
- positionalArgs.push(arg);
39
- }
40
- }
41
- }
42
- return callApi("address", {
43
- ...args,
44
- help: !!args._ophelp,
45
- _args: positionalArgs
46
- });
47
- }
48
- });
49
- export {
50
- address_default as default
51
- };
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- callApi
4
- } from "./chunk-57PPARIW.js";
5
- import "./chunk-5WUPDZ5D.js";
6
- import "./chunk-IST42ZNL.js";
7
- import "./chunk-RC3GCXCI.js";
8
- import "./chunk-TKZLQD2B.js";
9
-
10
- // src/commands/apis/address-suggestions.ts
11
- import { defineCommand } from "citty";
12
- var address_suggestions_default = defineCommand({
13
- meta: { name: "address-suggestions", description: "Address Suggestions API" },
14
- args: {
15
- operation: { type: "positional", description: "operationId to call", required: false },
16
- param: { type: "string", alias: "p", description: "Parameter key=value" },
17
- data: { type: "string", alias: "d", description: "Request body JSON" },
18
- header: { type: "string", alias: "H", description: "Custom header" },
19
- include: { type: "boolean", alias: "i", description: "Include response headers" },
20
- definition: { type: "string", description: "Override OpenAPI spec file/URL" },
21
- server: { type: "string", alias: "s", description: "Override server base URL" },
22
- profile: { type: "string", description: "Use a named profile" },
23
- token: { type: "string", alias: "t", description: "Bearer token" },
24
- json: { type: "boolean", description: "Output raw JSON" },
25
- verbose: { type: "boolean", alias: "v", description: "Verbose output" },
26
- interactive: { type: "boolean", description: "Interactive mode" },
27
- jsonata: { type: "string", description: "JSONata expression to transform response" },
28
- _ophelp: { type: "boolean", description: "Show operation help", required: false }
29
- },
30
- run: ({ args, rawArgs }) => {
31
- const positionalArgs = [];
32
- if (args.operation && rawArgs) {
33
- const opIdx = rawArgs.indexOf(args.operation);
34
- if (opIdx >= 0) {
35
- for (let i = opIdx + 1; i < rawArgs.length; i++) {
36
- const arg = rawArgs[i];
37
- if (arg.startsWith("-")) break;
38
- positionalArgs.push(arg);
39
- }
40
- }
41
- }
42
- return callApi("address-suggestions", {
43
- ...args,
44
- help: !!args._ophelp,
45
- _args: positionalArgs
46
- });
47
- }
48
- });
49
- export {
50
- address_suggestions_default as default
51
- };
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- callApi
4
- } from "./chunk-57PPARIW.js";
5
- import "./chunk-5WUPDZ5D.js";
6
- import "./chunk-IST42ZNL.js";
7
- import "./chunk-RC3GCXCI.js";
8
- import "./chunk-TKZLQD2B.js";
9
-
10
- // src/commands/apis/ai-agents.ts
11
- import { defineCommand } from "citty";
12
- var ai_agents_default = defineCommand({
13
- meta: { name: "ai-agents", description: "AI Agents API - OpenAPI 3.0" },
14
- args: {
15
- operation: { type: "positional", description: "operationId to call", required: false },
16
- param: { type: "string", alias: "p", description: "Parameter key=value" },
17
- data: { type: "string", alias: "d", description: "Request body JSON" },
18
- header: { type: "string", alias: "H", description: "Custom header" },
19
- include: { type: "boolean", alias: "i", description: "Include response headers" },
20
- definition: { type: "string", description: "Override OpenAPI spec file/URL" },
21
- server: { type: "string", alias: "s", description: "Override server base URL" },
22
- profile: { type: "string", description: "Use a named profile" },
23
- token: { type: "string", alias: "t", description: "Bearer token" },
24
- json: { type: "boolean", description: "Output raw JSON" },
25
- verbose: { type: "boolean", alias: "v", description: "Verbose output" },
26
- interactive: { type: "boolean", description: "Interactive mode" },
27
- jsonata: { type: "string", description: "JSONata expression to transform response" },
28
- _ophelp: { type: "boolean", description: "Show operation help", required: false }
29
- },
30
- run: ({ args, rawArgs }) => {
31
- const positionalArgs = [];
32
- if (args.operation && rawArgs) {
33
- const opIdx = rawArgs.indexOf(args.operation);
34
- if (opIdx >= 0) {
35
- for (let i = opIdx + 1; i < rawArgs.length; i++) {
36
- const arg = rawArgs[i];
37
- if (arg.startsWith("-")) break;
38
- positionalArgs.push(arg);
39
- }
40
- }
41
- }
42
- return callApi("ai-agents", {
43
- ...args,
44
- help: !!args._ophelp,
45
- _args: positionalArgs
46
- });
47
- }
48
- });
49
- export {
50
- ai_agents_default as default
51
- };
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- callApi
4
- } from "./chunk-57PPARIW.js";
5
- import "./chunk-5WUPDZ5D.js";
6
- import "./chunk-IST42ZNL.js";
7
- import "./chunk-RC3GCXCI.js";
8
- import "./chunk-TKZLQD2B.js";
9
-
10
- // src/commands/apis/app.ts
11
- import { defineCommand } from "citty";
12
- var app_default = defineCommand({
13
- meta: { name: "app", description: "App API" },
14
- args: {
15
- operation: { type: "positional", description: "operationId to call", required: false },
16
- param: { type: "string", alias: "p", description: "Parameter key=value" },
17
- data: { type: "string", alias: "d", description: "Request body JSON" },
18
- header: { type: "string", alias: "H", description: "Custom header" },
19
- include: { type: "boolean", alias: "i", description: "Include response headers" },
20
- definition: { type: "string", description: "Override OpenAPI spec file/URL" },
21
- server: { type: "string", alias: "s", description: "Override server base URL" },
22
- profile: { type: "string", description: "Use a named profile" },
23
- token: { type: "string", alias: "t", description: "Bearer token" },
24
- json: { type: "boolean", description: "Output raw JSON" },
25
- verbose: { type: "boolean", alias: "v", description: "Verbose output" },
26
- interactive: { type: "boolean", description: "Interactive mode" },
27
- jsonata: { type: "string", description: "JSONata expression to transform response" },
28
- _ophelp: { type: "boolean", description: "Show operation help", required: false }
29
- },
30
- run: ({ args, rawArgs }) => {
31
- const positionalArgs = [];
32
- if (args.operation && rawArgs) {
33
- const opIdx = rawArgs.indexOf(args.operation);
34
- if (opIdx >= 0) {
35
- for (let i = opIdx + 1; i < rawArgs.length; i++) {
36
- const arg = rawArgs[i];
37
- if (arg.startsWith("-")) break;
38
- positionalArgs.push(arg);
39
- }
40
- }
41
- }
42
- return callApi("app", {
43
- ...args,
44
- help: !!args._ophelp,
45
- _args: positionalArgs
46
- });
47
- }
48
- });
49
- export {
50
- app_default as default
51
- };
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- callApi
4
- } from "./chunk-57PPARIW.js";
5
- import "./chunk-5WUPDZ5D.js";
6
- import "./chunk-IST42ZNL.js";
7
- import "./chunk-RC3GCXCI.js";
8
- import "./chunk-TKZLQD2B.js";
9
-
10
- // src/commands/apis/audit-logs.ts
11
- import { defineCommand } from "citty";
12
- var audit_logs_default = defineCommand({
13
- meta: { name: "audit-logs", description: "Audit Log" },
14
- args: {
15
- operation: { type: "positional", description: "operationId to call", required: false },
16
- param: { type: "string", alias: "p", description: "Parameter key=value" },
17
- data: { type: "string", alias: "d", description: "Request body JSON" },
18
- header: { type: "string", alias: "H", description: "Custom header" },
19
- include: { type: "boolean", alias: "i", description: "Include response headers" },
20
- definition: { type: "string", description: "Override OpenAPI spec file/URL" },
21
- server: { type: "string", alias: "s", description: "Override server base URL" },
22
- profile: { type: "string", description: "Use a named profile" },
23
- token: { type: "string", alias: "t", description: "Bearer token" },
24
- json: { type: "boolean", description: "Output raw JSON" },
25
- verbose: { type: "boolean", alias: "v", description: "Verbose output" },
26
- interactive: { type: "boolean", description: "Interactive mode" },
27
- jsonata: { type: "string", description: "JSONata expression to transform response" },
28
- _ophelp: { type: "boolean", description: "Show operation help", required: false }
29
- },
30
- run: ({ args, rawArgs }) => {
31
- const positionalArgs = [];
32
- if (args.operation && rawArgs) {
33
- const opIdx = rawArgs.indexOf(args.operation);
34
- if (opIdx >= 0) {
35
- for (let i = opIdx + 1; i < rawArgs.length; i++) {
36
- const arg = rawArgs[i];
37
- if (arg.startsWith("-")) break;
38
- positionalArgs.push(arg);
39
- }
40
- }
41
- }
42
- return callApi("audit-logs", {
43
- ...args,
44
- help: !!args._ophelp,
45
- _args: positionalArgs
46
- });
47
- }
48
- });
49
- export {
50
- audit_logs_default as default
51
- };
@@ -1,113 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- loadCredentials,
4
- removeCredentials
5
- } from "./chunk-5WUPDZ5D.js";
6
- import "./chunk-IST42ZNL.js";
7
- import {
8
- BOLD,
9
- DIM,
10
- GREEN,
11
- RED,
12
- RESET,
13
- YELLOW
14
- } from "./chunk-TKZLQD2B.js";
15
-
16
- // src/commands/auth.ts
17
- import { defineCommand } from "citty";
18
- var auth_default = defineCommand({
19
- meta: {
20
- name: "auth",
21
- description: "Manage authentication"
22
- },
23
- subCommands: {
24
- login: () => import("./auth-login-2ZIXM47J.js").then((m) => m.default),
25
- token: () => import("./auth-token-OS4BEEVZ.js").then((m) => m.default),
26
- logout: defineCommand({
27
- meta: { name: "logout", description: "Remove stored credentials" },
28
- run: () => {
29
- const removed = removeCredentials();
30
- if (removed) {
31
- process.stdout.write(`${GREEN}Logged out successfully.${RESET}
32
- `);
33
- } else {
34
- process.stdout.write(`No stored credentials found.
35
- `);
36
- }
37
- }
38
- }),
39
- status: defineCommand({
40
- meta: { name: "status", description: "Show authentication status" },
41
- run: () => {
42
- const creds = loadCredentials();
43
- if (!creds) {
44
- process.stdout.write(`${YELLOW}Not authenticated.${RESET}
45
- `);
46
- process.stdout.write(`Run ${BOLD}epilot auth login${RESET} to authenticate.
47
- `);
48
- return;
49
- }
50
- const claims = parseJwtPayload(creds.token);
51
- const isApiToken = claims?.token_type === "api";
52
- const isCognitoToken = typeof claims?.iss === "string" && claims.iss.includes("cognito-idp");
53
- const tokenType = isApiToken ? "API Token" : isCognitoToken ? "User Token" : "Token";
54
- process.stdout.write(`${GREEN}${BOLD}Authenticated${RESET} ${DIM}(${tokenType})${RESET}
55
- `);
56
- const name = claims?.token_name || claims?.email || claims?.["cognito:username"] || creds.name;
57
- const orgId = claims?.org_id || claims?.["custom:ivy_org_id"] || creds.org_id;
58
- const userId = claims?.user_id || claims?.["custom:ivy_user_id"] || creds.user_id;
59
- const tokenId = claims?.token_id;
60
- const adminEmail = claims?.admin_email;
61
- const tokenUse = claims?.token_use;
62
- const roles = claims?.assume_roles;
63
- if (name) process.stdout.write(` Name: ${name}
64
- `);
65
- if (adminEmail && adminEmail !== name) process.stdout.write(` Email: ${adminEmail}
66
- `);
67
- if (orgId) process.stdout.write(` Org: ${orgId}
68
- `);
69
- if (userId) process.stdout.write(` User: ${userId}
70
- `);
71
- if (tokenId && tokenId !== userId) process.stdout.write(` Token ID: ${tokenId}
72
- `);
73
- if (tokenUse) process.stdout.write(` Use: ${tokenUse}
74
- `);
75
- if (roles?.length) process.stdout.write(` Roles: ${roles.join(", ")}
76
- `);
77
- if (creds.expires_at) {
78
- const expiry = new Date(creds.expires_at);
79
- const now = /* @__PURE__ */ new Date();
80
- const days = Math.floor((expiry.getTime() - now.getTime()) / (1e3 * 60 * 60 * 24));
81
- process.stdout.write(` Expires: ${creds.expires_at} ${DIM}(${days} days)${RESET}
82
- `);
83
- } else if (claims?.exp) {
84
- const expiry = new Date(claims.exp * 1e3);
85
- const now = /* @__PURE__ */ new Date();
86
- const diffMs = expiry.getTime() - now.getTime();
87
- const label = diffMs < 0 ? `${RED}expired${RESET}` : diffMs < 864e5 ? `${Math.floor(diffMs / 36e5)}h ${Math.floor(diffMs % 36e5 / 6e4)}m` : `${Math.floor(diffMs / 864e5)} days`;
88
- process.stdout.write(` Expires: ${expiry.toISOString()} ${DIM}(${label})${RESET}
89
- `);
90
- } else if (claims?.iat && !claims?.exp) {
91
- const issued = new Date(claims.iat * 1e3);
92
- process.stdout.write(` Issued: ${issued.toISOString()} ${DIM}(no expiry)${RESET}
93
- `);
94
- }
95
- process.stdout.write(` Token: ${creds.token.substring(0, 20)}...${RESET}
96
- `);
97
- }
98
- })
99
- }
100
- });
101
- var parseJwtPayload = (token) => {
102
- try {
103
- const parts = token.split(".");
104
- if (parts.length !== 3) return null;
105
- const payload = Buffer.from(parts[1], "base64url").toString("utf-8");
106
- return JSON.parse(payload);
107
- } catch {
108
- return null;
109
- }
110
- };
111
- export {
112
- auth_default as default
113
- };
@@ -1,137 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- saveCredentials
4
- } from "./chunk-5WUPDZ5D.js";
5
- import "./chunk-IST42ZNL.js";
6
- import {
7
- BOLD,
8
- DIM,
9
- GREEN,
10
- RED,
11
- RESET
12
- } from "./chunk-TKZLQD2B.js";
13
-
14
- // src/commands/auth-login.ts
15
- import { defineCommand } from "citty";
16
- import { createServer } from "http";
17
- var auth_login_default = defineCommand({
18
- meta: { name: "login", description: "Authenticate with epilot" },
19
- args: {
20
- token: { type: "string", description: "Manually provide a token instead of browser login" },
21
- profile: { type: "string", description: "Save credentials to this profile" }
22
- },
23
- run: async ({ args }) => {
24
- const profileName = args.profile || process.env.EPILOT_PROFILE;
25
- if (args.token) {
26
- saveCredentials({ token: args.token }, profileName);
27
- const suffix = profileName ? ` to profile "${profileName}"` : "";
28
- process.stdout.write(`${GREEN}Token saved${suffix}.${RESET}
29
- `);
30
- return;
31
- }
32
- if (profileName) {
33
- process.stdout.write(`${BOLD}Opening browser for epilot login (profile: ${profileName})...${RESET}
34
- `);
35
- } else {
36
- process.stdout.write(`${BOLD}Opening browser for epilot login...${RESET}
37
- `);
38
- }
39
- const token = await browserLogin(profileName);
40
- if (token) {
41
- process.stdout.write(`${GREEN}${BOLD}Login successful!${RESET}
42
- `);
43
- } else {
44
- process.stderr.write(`${RED}Login failed or was cancelled.${RESET}
45
- `);
46
- process.exit(1);
47
- }
48
- }
49
- });
50
- var browserLogin = async (profileName) => {
51
- let settled = false;
52
- let timeoutId;
53
- return new Promise(async (resolve) => {
54
- const done = (token) => {
55
- if (settled) return;
56
- settled = true;
57
- clearTimeout(timeoutId);
58
- server.close();
59
- resolve(token);
60
- };
61
- const server = createServer((req, res) => {
62
- const url = new URL(req.url, `http://localhost`);
63
- if (url.pathname === "/callback") {
64
- const token = url.searchParams.get("token");
65
- const orgId = url.searchParams.get("org_id");
66
- const userId = url.searchParams.get("user_id");
67
- const name = url.searchParams.get("name");
68
- if (token) {
69
- saveCredentials({
70
- token,
71
- org_id: orgId ?? void 0,
72
- user_id: userId ?? void 0,
73
- name: name ?? void 0
74
- }, profileName);
75
- res.writeHead(200, { "Content-Type": "text/html" });
76
- res.end("<html><body><h1>Login successful!</h1><p>You can close this tab.</p></body></html>");
77
- done(token);
78
- } else {
79
- res.writeHead(400, { "Content-Type": "text/html" });
80
- res.end("<html><body><h1>Login failed</h1><p>No token received.</p></body></html>");
81
- done(null);
82
- }
83
- } else {
84
- res.writeHead(404);
85
- res.end();
86
- }
87
- });
88
- server.unref();
89
- server.listen(0, async () => {
90
- const address = server.address();
91
- if (!address || typeof address === "string") {
92
- done(null);
93
- return;
94
- }
95
- const port = address.port;
96
- const callbackUrl = `http://localhost:${port}/callback`;
97
- const loginUrl = `https://portal.epilot.cloud/login?cli_callback=${encodeURIComponent(callbackUrl)}`;
98
- process.stdout.write(`
99
- ${DIM}Login URL: ${loginUrl}${RESET}
100
-
101
- `);
102
- try {
103
- const open = (await import("open")).default;
104
- await open(loginUrl);
105
- process.stdout.write(`Browser opened. Waiting for authentication...
106
- `);
107
- } catch {
108
- process.stdout.write(
109
- `Could not open browser. Please visit this URL manually:
110
-
111
- ${loginUrl}
112
-
113
- `
114
- );
115
- }
116
- if (process.stdin.isTTY) {
117
- process.stdout.write(`
118
- ${DIM}Or paste a token manually:${RESET}
119
- `);
120
- try {
121
- const { password } = await import("@inquirer/prompts");
122
- const token = await password({ message: "Token:" });
123
- if (token?.trim()) {
124
- saveCredentials({ token: token.trim() }, profileName);
125
- done(token.trim());
126
- }
127
- } catch {
128
- }
129
- }
130
- timeoutId = setTimeout(() => done(null), 5 * 60 * 1e3);
131
- timeoutId.unref();
132
- });
133
- });
134
- };
135
- export {
136
- auth_login_default as default
137
- };
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- saveCredentials
4
- } from "./chunk-5WUPDZ5D.js";
5
- import "./chunk-IST42ZNL.js";
6
- import {
7
- BOLD,
8
- GREEN,
9
- RED,
10
- RESET
11
- } from "./chunk-TKZLQD2B.js";
12
-
13
- // src/commands/auth-token.ts
14
- import { defineCommand } from "citty";
15
- var auth_token_default = defineCommand({
16
- meta: { name: "token", description: "Store an API token directly" },
17
- args: {
18
- token: { type: "positional", description: "API token to store", required: false },
19
- profile: { type: "string", description: "Save credentials to this profile" }
20
- },
21
- run: async ({ args }) => {
22
- const profileName = args.profile || process.env.EPILOT_PROFILE;
23
- let token = args.token;
24
- if (!token) {
25
- const { password } = await import("@inquirer/prompts");
26
- token = await password({
27
- message: "Paste your API token:"
28
- });
29
- }
30
- if (!token) {
31
- process.stderr.write(`${RED}No token provided.${RESET}
32
- `);
33
- process.exit(1);
34
- }
35
- saveCredentials({ token }, profileName);
36
- const suffix = profileName ? ` to profile "${profileName}"` : "";
37
- process.stdout.write(`${GREEN}${BOLD}Token saved${suffix}.${RESET}
38
- `);
39
- }
40
- });
41
- export {
42
- auth_token_default as default
43
- };
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- callApi
4
- } from "./chunk-57PPARIW.js";
5
- import "./chunk-5WUPDZ5D.js";
6
- import "./chunk-IST42ZNL.js";
7
- import "./chunk-RC3GCXCI.js";
8
- import "./chunk-TKZLQD2B.js";
9
-
10
- // src/commands/apis/automation.ts
11
- import { defineCommand } from "citty";
12
- var automation_default = defineCommand({
13
- meta: { name: "automation", description: "Automation API" },
14
- args: {
15
- operation: { type: "positional", description: "operationId to call", required: false },
16
- param: { type: "string", alias: "p", description: "Parameter key=value" },
17
- data: { type: "string", alias: "d", description: "Request body JSON" },
18
- header: { type: "string", alias: "H", description: "Custom header" },
19
- include: { type: "boolean", alias: "i", description: "Include response headers" },
20
- definition: { type: "string", description: "Override OpenAPI spec file/URL" },
21
- server: { type: "string", alias: "s", description: "Override server base URL" },
22
- profile: { type: "string", description: "Use a named profile" },
23
- token: { type: "string", alias: "t", description: "Bearer token" },
24
- json: { type: "boolean", description: "Output raw JSON" },
25
- verbose: { type: "boolean", alias: "v", description: "Verbose output" },
26
- interactive: { type: "boolean", description: "Interactive mode" },
27
- jsonata: { type: "string", description: "JSONata expression to transform response" },
28
- _ophelp: { type: "boolean", description: "Show operation help", required: false }
29
- },
30
- run: ({ args, rawArgs }) => {
31
- const positionalArgs = [];
32
- if (args.operation && rawArgs) {
33
- const opIdx = rawArgs.indexOf(args.operation);
34
- if (opIdx >= 0) {
35
- for (let i = opIdx + 1; i < rawArgs.length; i++) {
36
- const arg = rawArgs[i];
37
- if (arg.startsWith("-")) break;
38
- positionalArgs.push(arg);
39
- }
40
- }
41
- }
42
- return callApi("automation", {
43
- ...args,
44
- help: !!args._ophelp,
45
- _args: positionalArgs
46
- });
47
- }
48
- });
49
- export {
50
- automation_default as default
51
- };