@sendmux/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 (70) hide show
  1. package/README.md +26 -0
  2. package/bin/run.js +5 -0
  3. package/dist/base-command.d.ts +25 -0
  4. package/dist/base-command.d.ts.map +1 -0
  5. package/dist/base-command.js +93 -0
  6. package/dist/commands/mailbox/folders/list.d.ts +24 -0
  7. package/dist/commands/mailbox/folders/list.d.ts.map +1 -0
  8. package/dist/commands/mailbox/folders/list.js +6 -0
  9. package/dist/commands/mailbox/me/get.d.ts +21 -0
  10. package/dist/commands/mailbox/me/get.d.ts.map +1 -0
  11. package/dist/commands/mailbox/me/get.js +6 -0
  12. package/dist/commands/mailbox/messages/get.d.ts +24 -0
  13. package/dist/commands/mailbox/messages/get.d.ts.map +1 -0
  14. package/dist/commands/mailbox/messages/get.js +6 -0
  15. package/dist/commands/mailbox/messages/list.d.ts +87 -0
  16. package/dist/commands/mailbox/messages/list.d.ts.map +1 -0
  17. package/dist/commands/mailbox/messages/list.js +6 -0
  18. package/dist/commands/management/domains/get.d.ts +24 -0
  19. package/dist/commands/management/domains/get.d.ts.map +1 -0
  20. package/dist/commands/management/domains/get.js +6 -0
  21. package/dist/commands/management/domains/list.d.ts +24 -0
  22. package/dist/commands/management/domains/list.d.ts.map +1 -0
  23. package/dist/commands/management/domains/list.js +6 -0
  24. package/dist/commands/management/mailboxes/list.d.ts +27 -0
  25. package/dist/commands/management/mailboxes/list.d.ts.map +1 -0
  26. package/dist/commands/management/mailboxes/list.js +6 -0
  27. package/dist/commands/management/providers/list.d.ts +30 -0
  28. package/dist/commands/management/providers/list.d.ts.map +1 -0
  29. package/dist/commands/management/providers/list.js +6 -0
  30. package/dist/commands/profiles/list.d.ts +9 -0
  31. package/dist/commands/profiles/list.d.ts.map +1 -0
  32. package/dist/commands/profiles/list.js +28 -0
  33. package/dist/commands/profiles/set.d.ts +14 -0
  34. package/dist/commands/profiles/set.d.ts.map +1 -0
  35. package/dist/commands/profiles/set.js +57 -0
  36. package/dist/commands/profiles/show.d.ts +9 -0
  37. package/dist/commands/profiles/show.d.ts.map +1 -0
  38. package/dist/commands/profiles/show.js +36 -0
  39. package/dist/commands/sending/send/batch.d.ts +21 -0
  40. package/dist/commands/sending/send/batch.d.ts.map +1 -0
  41. package/dist/commands/sending/send/batch.js +6 -0
  42. package/dist/commands/sending/send.d.ts +21 -0
  43. package/dist/commands/sending/send.d.ts.map +1 -0
  44. package/dist/commands/sending/send.js +6 -0
  45. package/dist/generated/operations.d.ts +2340 -0
  46. package/dist/generated/operations.d.ts.map +1 -0
  47. package/dist/generated/operations.js +2511 -0
  48. package/dist/index.d.ts +2 -0
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.js +1 -0
  51. package/dist/key-kind.d.ts +4 -0
  52. package/dist/key-kind.d.ts.map +1 -0
  53. package/dist/key-kind.js +15 -0
  54. package/dist/operation-command.d.ts +18 -0
  55. package/dist/operation-command.d.ts.map +1 -0
  56. package/dist/operation-command.js +11 -0
  57. package/dist/operation-flags.d.ts +33 -0
  58. package/dist/operation-flags.d.ts.map +1 -0
  59. package/dist/operation-flags.js +103 -0
  60. package/dist/operation-runner.d.ts +5 -0
  61. package/dist/operation-runner.d.ts.map +1 -0
  62. package/dist/operation-runner.js +45 -0
  63. package/dist/operation-types.d.ts +19 -0
  64. package/dist/operation-types.d.ts.map +1 -0
  65. package/dist/operation-types.js +1 -0
  66. package/dist/profiles.d.ts +12 -0
  67. package/dist/profiles.d.ts.map +1 -0
  68. package/dist/profiles.js +35 -0
  69. package/oclif.manifest.json +1546 -0
  70. package/package.json +60 -0
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # @sendmux/cli
2
+
3
+ Agent-drivable command line interface for Sendmux.
4
+
5
+ Install:
6
+
7
+ ```sh
8
+ npm install -g @sendmux/cli
9
+ ```
10
+
11
+ Configure a profile:
12
+
13
+ ```sh
14
+ sendmux profiles:set default --api-key smx_root_... --default
15
+ sendmux profiles:set mailbox --api-key smx_mbx_...
16
+ ```
17
+
18
+ Use `--json` on API commands to emit the raw Sendmux response envelope:
19
+
20
+ ```sh
21
+ sendmux mailbox:messages:list --profile mailbox --query limit=25 --json
22
+ sendmux management:domains:list --profile default --json
23
+ sendmux sending:send --profile default --body '{"from":"sender@example.com","to":["user@example.com"],"subject":"Hello","text":"Hello"}' --json
24
+ ```
25
+
26
+ Commands reject mismatched key types before making a network request.
package/bin/run.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execute } from "@oclif/core";
4
+
5
+ await execute({ dir: import.meta.url });
@@ -0,0 +1,25 @@
1
+ import { Command } from "@oclif/core";
2
+ import { type ApiKeyKind } from "./key-kind.js";
3
+ export interface AuthFlags {
4
+ "api-key"?: string;
5
+ "base-url"?: string;
6
+ profile?: string;
7
+ }
8
+ export interface ResolvedAuth {
9
+ apiKey: string;
10
+ apiKeyKind: ApiKeyKind;
11
+ baseUrl?: string;
12
+ source: string;
13
+ }
14
+ export declare const authFlags: {
15
+ "api-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ "base-url": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ };
19
+ export declare abstract class SendmuxCommand extends Command {
20
+ static enableJsonFlag: boolean;
21
+ resolveAuth(flags: AuthFlags, expectedKind: ApiKeyKind): Promise<ResolvedAuth>;
22
+ renderResult(value: unknown): unknown;
23
+ private assertKeyKind;
24
+ }
25
+ //# sourceMappingURL=base-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-command.d.ts","sourceRoot":"","sources":["../src/base-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAE7C,OAAO,EAEL,KAAK,UAAU,EAChB,MAAM,eAAe,CAAC;AAGvB,MAAM,WAAW,SAAS;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,SAAS;;;;CAcrB,CAAC;AAEF,8BAAsB,cAAe,SAAQ,OAAO;IAClD,MAAM,CAAC,cAAc,UAAQ;IAEvB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;IAmDpF,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IASrC,OAAO,CAAC,aAAa;CA4BtB"}
@@ -0,0 +1,93 @@
1
+ import { Command, Flags } from "@oclif/core";
2
+ import { inferApiKeyKind, } from "./key-kind.js";
3
+ import { readCliConfig } from "./profiles.js";
4
+ export const authFlags = {
5
+ "api-key": Flags.string({
6
+ description: "Sendmux API key. Defaults to SENDMUX_API_KEY.",
7
+ helpGroup: "GLOBAL",
8
+ }),
9
+ "base-url": Flags.string({
10
+ description: "Override the API base URL. Defaults to the SDK surface default or SENDMUX_BASE_URL.",
11
+ helpGroup: "GLOBAL",
12
+ }),
13
+ profile: Flags.string({
14
+ char: "p",
15
+ description: "Profile name from the local Sendmux CLI config. Defaults to SENDMUX_PROFILE or the configured default profile.",
16
+ helpGroup: "GLOBAL",
17
+ }),
18
+ };
19
+ export class SendmuxCommand extends Command {
20
+ static enableJsonFlag = true;
21
+ async resolveAuth(flags, expectedKind) {
22
+ const envApiKey = process.env.SENDMUX_API_KEY;
23
+ const envBaseUrl = process.env.SENDMUX_BASE_URL;
24
+ if (flags["api-key"] || envApiKey) {
25
+ const apiKey = flags["api-key"] ?? envApiKey;
26
+ if (!apiKey) {
27
+ throw new Error("Missing Sendmux API key");
28
+ }
29
+ const baseUrl = flags["base-url"] ?? envBaseUrl;
30
+ const input = {
31
+ apiKey,
32
+ expectedKind,
33
+ source: flags["api-key"] ? "--api-key" : "SENDMUX_API_KEY",
34
+ };
35
+ if (baseUrl) {
36
+ input.baseUrl = baseUrl;
37
+ }
38
+ return this.assertKeyKind(input);
39
+ }
40
+ const config = await readCliConfig(this.config.configDir);
41
+ const profileName = flags.profile ?? process.env.SENDMUX_PROFILE ?? config.defaultProfile;
42
+ if (!profileName) {
43
+ this.error("No Sendmux profile configured. Run `sendmux profiles:set <name> --api-key <key> --default` or pass --api-key.", {
44
+ exit: 2,
45
+ });
46
+ }
47
+ const profile = config.profiles[profileName];
48
+ if (!profile) {
49
+ this.error(`Sendmux profile "${profileName}" was not found. Run \`sendmux profiles:list\` to see configured profiles.`, {
50
+ exit: 2,
51
+ });
52
+ }
53
+ const baseUrl = flags["base-url"] ?? envBaseUrl ?? profile.baseUrl;
54
+ const input = {
55
+ apiKey: profile.apiKey,
56
+ expectedKind,
57
+ source: `profile "${profileName}"`,
58
+ };
59
+ if (baseUrl) {
60
+ input.baseUrl = baseUrl;
61
+ }
62
+ return this.assertKeyKind(input);
63
+ }
64
+ renderResult(value) {
65
+ if (this.jsonEnabled()) {
66
+ return value;
67
+ }
68
+ this.log(JSON.stringify(value, null, 2));
69
+ return value;
70
+ }
71
+ assertKeyKind({ apiKey, baseUrl, expectedKind, source, }) {
72
+ let apiKeyKind;
73
+ try {
74
+ apiKeyKind = inferApiKeyKind(apiKey);
75
+ }
76
+ catch (error) {
77
+ this.error(error instanceof Error ? error.message : "Invalid Sendmux API key", { exit: 2 });
78
+ }
79
+ if (apiKeyKind !== expectedKind) {
80
+ const expectedLabel = expectedKind === "root" ? "root" : "mailbox";
81
+ const actualLabel = apiKeyKind === "root" ? "root" : "mailbox";
82
+ this.error(`Command requires a ${expectedLabel} API key, but ${source} contains a ${actualLabel} API key.`, {
83
+ exit: 2,
84
+ });
85
+ }
86
+ return {
87
+ apiKey,
88
+ apiKeyKind,
89
+ source,
90
+ ...(baseUrl ? { baseUrl } : {}),
91
+ };
92
+ }
93
+ }
@@ -0,0 +1,24 @@
1
+ import { OperationCommand } from "../../../operation-command.js";
2
+ export default class MailboxFoldersList extends OperationCommand {
3
+ static description: "List mailbox folders";
4
+ static operation: {
5
+ readonly command: "mailbox:folders:list";
6
+ readonly description: "List mailbox folders";
7
+ readonly headerParams: readonly [];
8
+ readonly method: "get";
9
+ readonly operationId: "mailboxListFolders";
10
+ readonly path: "/mailbox/folders";
11
+ readonly pathParams: readonly [];
12
+ readonly queryParams: readonly [{
13
+ readonly name: "cursor";
14
+ readonly required: false;
15
+ }, {
16
+ readonly name: "limit";
17
+ readonly required: false;
18
+ }];
19
+ readonly requestBodyRequired: false;
20
+ readonly requiredKeyKind: "mailbox";
21
+ readonly surface: "mailbox";
22
+ };
23
+ }
24
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/mailbox/folders/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,gBAAgB;IAC9D,MAAM,CAAC,WAAW,yBAAoD;IACtE,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;MAAwC;CACzD"}
@@ -0,0 +1,6 @@
1
+ import { curatedOperations } from "../../../generated/operations.js";
2
+ import { OperationCommand } from "../../../operation-command.js";
3
+ export default class MailboxFoldersList extends OperationCommand {
4
+ static description = curatedOperations.mailboxListFolders.description;
5
+ static operation = curatedOperations.mailboxListFolders;
6
+ }
@@ -0,0 +1,21 @@
1
+ import { OperationCommand } from "../../../operation-command.js";
2
+ export default class MailboxMeGet extends OperationCommand {
3
+ static description: "Self-introspect the calling mailbox";
4
+ static operation: {
5
+ readonly command: "mailbox:me:get";
6
+ readonly description: "Self-introspect the calling mailbox";
7
+ readonly headerParams: readonly [{
8
+ readonly name: "If-None-Match";
9
+ readonly required: false;
10
+ }];
11
+ readonly method: "get";
12
+ readonly operationId: "mailboxGetMe";
13
+ readonly path: "/mailbox/me";
14
+ readonly pathParams: readonly [];
15
+ readonly queryParams: readonly [];
16
+ readonly requestBodyRequired: false;
17
+ readonly requiredKeyKind: "mailbox";
18
+ readonly surface: "mailbox";
19
+ };
20
+ }
21
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/commands/mailbox/me/get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,gBAAgB;IACxD,MAAM,CAAC,WAAW,wCAA8C;IAChE,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;MAAkC;CACnD"}
@@ -0,0 +1,6 @@
1
+ import { curatedOperations } from "../../../generated/operations.js";
2
+ import { OperationCommand } from "../../../operation-command.js";
3
+ export default class MailboxMeGet extends OperationCommand {
4
+ static description = curatedOperations.mailboxGetMe.description;
5
+ static operation = curatedOperations.mailboxGetMe;
6
+ }
@@ -0,0 +1,24 @@
1
+ import { OperationCommand } from "../../../operation-command.js";
2
+ export default class MailboxMessagesGet extends OperationCommand {
3
+ static description: "Get a mailbox message";
4
+ static operation: {
5
+ readonly command: "mailbox:messages:get";
6
+ readonly description: "Get a mailbox message";
7
+ readonly headerParams: readonly [{
8
+ readonly name: "If-None-Match";
9
+ readonly required: false;
10
+ }];
11
+ readonly method: "get";
12
+ readonly operationId: "mailboxGetMessage";
13
+ readonly path: "/mailbox/messages/{message_id}";
14
+ readonly pathParams: readonly [{
15
+ readonly name: "message_id";
16
+ readonly required: true;
17
+ }];
18
+ readonly queryParams: readonly [];
19
+ readonly requestBodyRequired: false;
20
+ readonly requiredKeyKind: "mailbox";
21
+ readonly surface: "mailbox";
22
+ };
23
+ }
24
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/commands/mailbox/messages/get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,gBAAgB;IAC9D,MAAM,CAAC,WAAW,0BAAmD;IACrE,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;MAAuC;CACxD"}
@@ -0,0 +1,6 @@
1
+ import { curatedOperations } from "../../../generated/operations.js";
2
+ import { OperationCommand } from "../../../operation-command.js";
3
+ export default class MailboxMessagesGet extends OperationCommand {
4
+ static description = curatedOperations.mailboxGetMessage.description;
5
+ static operation = curatedOperations.mailboxGetMessage;
6
+ }
@@ -0,0 +1,87 @@
1
+ import { OperationCommand } from "../../../operation-command.js";
2
+ export default class MailboxMessagesList extends OperationCommand {
3
+ static description: "List mailbox messages";
4
+ static operation: {
5
+ readonly command: "mailbox:messages:list";
6
+ readonly description: "List mailbox messages";
7
+ readonly headerParams: readonly [];
8
+ readonly method: "get";
9
+ readonly operationId: "mailboxListMessages";
10
+ readonly path: "/mailbox/messages";
11
+ readonly pathParams: readonly [];
12
+ readonly queryParams: readonly [{
13
+ readonly name: "cursor";
14
+ readonly required: false;
15
+ }, {
16
+ readonly name: "limit";
17
+ readonly required: false;
18
+ }, {
19
+ readonly name: "folder_id";
20
+ readonly required: false;
21
+ }, {
22
+ readonly name: "thread_id";
23
+ readonly required: false;
24
+ }, {
25
+ readonly name: "q";
26
+ readonly required: false;
27
+ }, {
28
+ readonly name: "from";
29
+ readonly required: false;
30
+ }, {
31
+ readonly name: "to";
32
+ readonly required: false;
33
+ }, {
34
+ readonly name: "cc";
35
+ readonly required: false;
36
+ }, {
37
+ readonly name: "bcc";
38
+ readonly required: false;
39
+ }, {
40
+ readonly name: "subject";
41
+ readonly required: false;
42
+ }, {
43
+ readonly name: "body";
44
+ readonly required: false;
45
+ }, {
46
+ readonly name: "header_name";
47
+ readonly required: false;
48
+ }, {
49
+ readonly name: "header_value";
50
+ readonly required: false;
51
+ }, {
52
+ readonly name: "min_size_bytes";
53
+ readonly required: false;
54
+ }, {
55
+ readonly name: "max_size_bytes";
56
+ readonly required: false;
57
+ }, {
58
+ readonly name: "keyword";
59
+ readonly required: false;
60
+ }, {
61
+ readonly name: "not_keyword";
62
+ readonly required: false;
63
+ }, {
64
+ readonly name: "after";
65
+ readonly required: false;
66
+ }, {
67
+ readonly name: "before";
68
+ readonly required: false;
69
+ }, {
70
+ readonly name: "has_attachment";
71
+ readonly required: false;
72
+ }, {
73
+ readonly name: "is_unread";
74
+ readonly required: false;
75
+ }, {
76
+ readonly name: "sort_by";
77
+ readonly required: false;
78
+ }, {
79
+ readonly name: "sort_direction";
80
+ readonly required: false;
81
+ }];
82
+ readonly requestBodyRequired: false;
83
+ readonly requiredKeyKind: "mailbox";
84
+ readonly surface: "mailbox";
85
+ };
86
+ }
87
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/mailbox/messages/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,gBAAgB;IAC/D,MAAM,CAAC,WAAW,0BAAqD;IACvE,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAyC;CAC1D"}
@@ -0,0 +1,6 @@
1
+ import { curatedOperations } from "../../../generated/operations.js";
2
+ import { OperationCommand } from "../../../operation-command.js";
3
+ export default class MailboxMessagesList extends OperationCommand {
4
+ static description = curatedOperations.mailboxListMessages.description;
5
+ static operation = curatedOperations.mailboxListMessages;
6
+ }
@@ -0,0 +1,24 @@
1
+ import { OperationCommand } from "../../../operation-command.js";
2
+ export default class ManagementDomainsGet extends OperationCommand {
3
+ static description: "Get a mailbox domain";
4
+ static operation: {
5
+ readonly command: "management:domains:get";
6
+ readonly description: "Get a mailbox domain";
7
+ readonly headerParams: readonly [{
8
+ readonly name: "If-None-Match";
9
+ readonly required: false;
10
+ }];
11
+ readonly method: "get";
12
+ readonly operationId: "managementGetDomain";
13
+ readonly path: "/domains/{public_id}";
14
+ readonly pathParams: readonly [{
15
+ readonly name: "public_id";
16
+ readonly required: true;
17
+ }];
18
+ readonly queryParams: readonly [];
19
+ readonly requestBodyRequired: false;
20
+ readonly requiredKeyKind: "root";
21
+ readonly surface: "management";
22
+ };
23
+ }
24
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/commands/management/domains/get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,gBAAgB;IAChE,MAAM,CAAC,WAAW,yBAAqD;IACvE,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;MAAyC;CAC1D"}
@@ -0,0 +1,6 @@
1
+ import { curatedOperations } from "../../../generated/operations.js";
2
+ import { OperationCommand } from "../../../operation-command.js";
3
+ export default class ManagementDomainsGet extends OperationCommand {
4
+ static description = curatedOperations.managementGetDomain.description;
5
+ static operation = curatedOperations.managementGetDomain;
6
+ }
@@ -0,0 +1,24 @@
1
+ import { OperationCommand } from "../../../operation-command.js";
2
+ export default class ManagementDomainsList extends OperationCommand {
3
+ static description: "List mailbox domains";
4
+ static operation: {
5
+ readonly command: "management:domains:list";
6
+ readonly description: "List mailbox domains";
7
+ readonly headerParams: readonly [];
8
+ readonly method: "get";
9
+ readonly operationId: "managementListDomains";
10
+ readonly path: "/domains";
11
+ readonly pathParams: readonly [];
12
+ readonly queryParams: readonly [{
13
+ readonly name: "cursor";
14
+ readonly required: false;
15
+ }, {
16
+ readonly name: "limit";
17
+ readonly required: false;
18
+ }];
19
+ readonly requestBodyRequired: false;
20
+ readonly requiredKeyKind: "root";
21
+ readonly surface: "management";
22
+ };
23
+ }
24
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/management/domains/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,gBAAgB;IACjE,MAAM,CAAC,WAAW,yBAAuD;IACzE,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;MAA2C;CAC5D"}
@@ -0,0 +1,6 @@
1
+ import { curatedOperations } from "../../../generated/operations.js";
2
+ import { OperationCommand } from "../../../operation-command.js";
3
+ export default class ManagementDomainsList extends OperationCommand {
4
+ static description = curatedOperations.managementListDomains.description;
5
+ static operation = curatedOperations.managementListDomains;
6
+ }
@@ -0,0 +1,27 @@
1
+ import { OperationCommand } from "../../../operation-command.js";
2
+ export default class ManagementMailboxesList extends OperationCommand {
3
+ static description: "List mailboxes";
4
+ static operation: {
5
+ readonly command: "management:mailboxes:list";
6
+ readonly description: "List mailboxes";
7
+ readonly headerParams: readonly [];
8
+ readonly method: "get";
9
+ readonly operationId: "managementListMailboxes";
10
+ readonly path: "/mailboxes";
11
+ readonly pathParams: readonly [];
12
+ readonly queryParams: readonly [{
13
+ readonly name: "cursor";
14
+ readonly required: false;
15
+ }, {
16
+ readonly name: "limit";
17
+ readonly required: false;
18
+ }, {
19
+ readonly name: "include_deleted";
20
+ readonly required: false;
21
+ }];
22
+ readonly requestBodyRequired: false;
23
+ readonly requiredKeyKind: "root";
24
+ readonly surface: "management";
25
+ };
26
+ }
27
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/management/mailboxes/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,gBAAgB;IACnE,MAAM,CAAC,WAAW,mBAAyD;IAC3E,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;MAA6C;CAC9D"}
@@ -0,0 +1,6 @@
1
+ import { curatedOperations } from "../../../generated/operations.js";
2
+ import { OperationCommand } from "../../../operation-command.js";
3
+ export default class ManagementMailboxesList extends OperationCommand {
4
+ static description = curatedOperations.managementListMailboxes.description;
5
+ static operation = curatedOperations.managementListMailboxes;
6
+ }
@@ -0,0 +1,30 @@
1
+ import { OperationCommand } from "../../../operation-command.js";
2
+ export default class ManagementProvidersList extends OperationCommand {
3
+ static description: "List sending accounts";
4
+ static operation: {
5
+ readonly command: "management:providers:list";
6
+ readonly description: "List sending accounts";
7
+ readonly headerParams: readonly [];
8
+ readonly method: "get";
9
+ readonly operationId: "managementListProviders";
10
+ readonly path: "/providers";
11
+ readonly pathParams: readonly [];
12
+ readonly queryParams: readonly [{
13
+ readonly name: "cursor";
14
+ readonly required: false;
15
+ }, {
16
+ readonly name: "status";
17
+ readonly required: false;
18
+ }, {
19
+ readonly name: "type";
20
+ readonly required: false;
21
+ }, {
22
+ readonly name: "limit";
23
+ readonly required: false;
24
+ }];
25
+ readonly requestBodyRequired: false;
26
+ readonly requiredKeyKind: "root";
27
+ readonly surface: "management";
28
+ };
29
+ }
30
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/management/providers/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,gBAAgB;IACnE,MAAM,CAAC,WAAW,0BAAyD;IAC3E,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;MAA6C;CAC9D"}
@@ -0,0 +1,6 @@
1
+ import { curatedOperations } from "../../../generated/operations.js";
2
+ import { OperationCommand } from "../../../operation-command.js";
3
+ export default class ManagementProvidersList extends OperationCommand {
4
+ static description = curatedOperations.managementListProviders.description;
5
+ static operation = curatedOperations.managementListProviders;
6
+ }
@@ -0,0 +1,9 @@
1
+ import { SendmuxCommand } from "../../base-command.js";
2
+ export default class ProfilesList extends SendmuxCommand {
3
+ static description: string;
4
+ static flags: {
5
+ verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
6
+ };
7
+ run(): Promise<unknown>;
8
+ }
9
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/profiles/list.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAOvD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,cAAc;IACtD,MAAM,CAAC,WAAW,SAAsC;IACxD,MAAM,CAAC,KAAK;;MAIV;IAEI,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;CAiB9B"}
@@ -0,0 +1,28 @@
1
+ import { Flags } from "@oclif/core";
2
+ import { SendmuxCommand } from "../../base-command.js";
3
+ import { inferApiKeyKind, maskApiKey, } from "../../key-kind.js";
4
+ import { readCliConfig } from "../../profiles.js";
5
+ export default class ProfilesList extends SendmuxCommand {
6
+ static description = "List local Sendmux CLI profiles.";
7
+ static flags = {
8
+ verbose: Flags.boolean({
9
+ description: "Include masked API key prefixes.",
10
+ }),
11
+ };
12
+ async run() {
13
+ const { flags } = await this.parse(ProfilesList);
14
+ const config = await readCliConfig(this.config.configDir);
15
+ const profiles = Object.entries(config.profiles).map(([name, profile]) => ({
16
+ default: name === config.defaultProfile,
17
+ key_kind: inferApiKeyKind(profile.apiKey),
18
+ name,
19
+ ...(profile.baseUrl ? { base_url: profile.baseUrl } : {}),
20
+ ...(flags.verbose ? { api_key: maskApiKey(profile.apiKey) } : {}),
21
+ }));
22
+ return this.renderResult({
23
+ ok: true,
24
+ data: { profiles },
25
+ meta: {},
26
+ });
27
+ }
28
+ }
@@ -0,0 +1,14 @@
1
+ import { SendmuxCommand } from "../../base-command.js";
2
+ export default class ProfilesSet extends SendmuxCommand {
3
+ static args: {
4
+ name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static flags: {
8
+ "api-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ "base-url": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ default: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ };
12
+ run(): Promise<unknown>;
13
+ }
14
+ //# sourceMappingURL=set.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../src/commands/profiles/set.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAOvD,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,cAAc;IACrD,MAAM,CAAC,IAAI;;MAKT;IACF,MAAM,CAAC,WAAW,SAAmD;IACrE,MAAM,CAAC,KAAK;;;;MAWV;IAEI,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;CAsC9B"}
@@ -0,0 +1,57 @@
1
+ import { Args, Flags } from "@oclif/core";
2
+ import { SendmuxCommand } from "../../base-command.js";
3
+ import { inferApiKeyKind } from "../../key-kind.js";
4
+ import { readCliConfig, writeCliConfig, } from "../../profiles.js";
5
+ export default class ProfilesSet extends SendmuxCommand {
6
+ static args = {
7
+ name: Args.string({
8
+ description: "Profile name.",
9
+ required: true,
10
+ }),
11
+ };
12
+ static description = "Create or update a local Sendmux CLI profile.";
13
+ static flags = {
14
+ "api-key": Flags.string({
15
+ description: "Sendmux API key. Defaults to SENDMUX_API_KEY.",
16
+ required: false,
17
+ }),
18
+ "base-url": Flags.string({
19
+ description: "Optional API base URL override for this profile.",
20
+ }),
21
+ default: Flags.boolean({
22
+ description: "Make this the default profile.",
23
+ }),
24
+ };
25
+ async run() {
26
+ const { args, flags } = await this.parse(ProfilesSet);
27
+ const apiKey = flags["api-key"] ?? process.env.SENDMUX_API_KEY;
28
+ if (!apiKey) {
29
+ this.error("Pass --api-key or set SENDMUX_API_KEY.", { exit: 2 });
30
+ }
31
+ const keyKind = inferApiKeyKind(apiKey);
32
+ const config = await readCliConfig(this.config.configDir);
33
+ config.profiles[args.name] = {
34
+ apiKey,
35
+ ...(flags["base-url"] ? { baseUrl: flags["base-url"] } : {}),
36
+ };
37
+ if (flags.default || !config.defaultProfile) {
38
+ config.defaultProfile = args.name;
39
+ }
40
+ await writeCliConfig(this.config.configDir, config);
41
+ const result = {
42
+ ok: true,
43
+ data: {
44
+ default: config.defaultProfile === args.name,
45
+ key_kind: keyKind,
46
+ name: args.name,
47
+ ...(flags["base-url"] ? { base_url: flags["base-url"] } : {}),
48
+ },
49
+ meta: {},
50
+ };
51
+ if (!this.jsonEnabled()) {
52
+ this.log(`Saved Sendmux ${keyKind} profile "${args.name}".`);
53
+ return result;
54
+ }
55
+ return result;
56
+ }
57
+ }