@sendmux/cli 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -3
- package/dist/commands/mailbox/create-attachment-upload.d.ts +26 -0
- package/dist/commands/mailbox/create-attachment-upload.d.ts.map +1 -0
- package/dist/commands/mailbox/create-attachment-upload.js +7 -0
- package/dist/commands/mailbox/get-message-attachment.d.ts +6 -0
- package/dist/commands/mailbox/get-message-attachment.d.ts.map +1 -1
- package/dist/commands/mailbox/stream-events.d.ts +18 -0
- package/dist/commands/mailbox/stream-events.d.ts.map +1 -1
- package/dist/commands/mailbox/stream-events.js +8 -0
- package/dist/generated/operations.d.ts +27 -0
- package/dist/generated/operations.d.ts.map +1 -1
- package/dist/generated/operations.js +30 -0
- package/dist/operation-command.d.ts +4 -0
- package/dist/operation-command.d.ts.map +1 -1
- package/dist/operation-flags.d.ts +9 -0
- package/dist/operation-flags.d.ts.map +1 -1
- package/dist/operation-flags.js +29 -4
- package/dist/operation-runner.d.ts.map +1 -1
- package/dist/operation-runner.js +282 -0
- package/oclif.manifest.json +3200 -435
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -50,12 +50,58 @@ sendmux sending:send --profile sending --body '{"from":{"email":"sender@example.
|
|
|
50
50
|
|
|
51
51
|
Commands reject mismatched key types before making a network request.
|
|
52
52
|
|
|
53
|
+
## Attachments And Events
|
|
54
|
+
|
|
55
|
+
Send a mailbox message with a local file in one command:
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
sendmux mailbox:send-message \
|
|
59
|
+
--profile mailbox \
|
|
60
|
+
--idempotency-key "$IDEMPOTENCY_KEY" \
|
|
61
|
+
--attach ./report.md \
|
|
62
|
+
--body '{"to":[{"email":"recipient@example.com","name":null}],"subject":"Report","text_body":"Attached."}' \
|
|
63
|
+
--json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`--attach` can be repeated. The CLI reads and uploads each local file before sending, so the file bytes do not pass through model context. Mailbox uploads use the mailbox attachment cap, currently `7,500,000` bytes per attachment; Sending API sends use the generated Sending API request-body limits.
|
|
67
|
+
|
|
68
|
+
Upload a file first, then use the returned `blob_id` in `mailbox:send-message`:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
sendmux mailbox:upload-attachment \
|
|
72
|
+
--profile mailbox \
|
|
73
|
+
--file ./report.md \
|
|
74
|
+
--json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Use presigned upload when a shell should upload without an API key:
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
sendmux mailbox:upload-attachment \
|
|
81
|
+
--profile mailbox \
|
|
82
|
+
--file ./report.md \
|
|
83
|
+
--via-presigned \
|
|
84
|
+
--json
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Attachment metadata returned from message, search, and event operations includes `download_url`. Fetch it promptly with any HTTP client; no `Authorization` header is needed. If it expires, re-run the message or attachment metadata command to get a fresh URL.
|
|
88
|
+
|
|
89
|
+
Follow live mailbox events as newline-delimited JSON:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
sendmux mailbox:stream-events \
|
|
93
|
+
--profile mailbox \
|
|
94
|
+
--query event_types=message.received \
|
|
95
|
+
--query close_after=300 \
|
|
96
|
+
--follow
|
|
97
|
+
```
|
|
98
|
+
|
|
53
99
|
## Commands
|
|
54
100
|
|
|
55
|
-
The CLI includes `
|
|
101
|
+
The CLI includes `97` generated API operation commands:
|
|
56
102
|
|
|
57
|
-
- `
|
|
58
|
-
- `
|
|
103
|
+
- `41` Mailbox commands, including `mailbox:messages:list`, `mailbox:messages:get`, `mailbox:send-message`, and `mailbox:list-granted-mailboxes`.
|
|
104
|
+
- `53` Management commands, including `management:domains:list`, `management:create-mailbox`, `management:get-spend-summary`, and `management:create-webhook`.
|
|
59
105
|
- `3` Sending commands: `sending:get-open-api-spec`, `sending:send`, and `sending:send:batch`.
|
|
60
106
|
- Profile commands: `profiles:list`, `profiles:set`, and `profiles:show`.
|
|
61
107
|
|
|
@@ -75,6 +121,10 @@ Operation commands support:
|
|
|
75
121
|
- `--profile` / `-p`
|
|
76
122
|
- `--body`
|
|
77
123
|
- `--body-file`
|
|
124
|
+
- `--attach`
|
|
125
|
+
- `--file`
|
|
126
|
+
- `--via-presigned`
|
|
127
|
+
- `--content-type`
|
|
78
128
|
- `--header`
|
|
79
129
|
- `--idempotency-key`
|
|
80
130
|
- `--if-match`
|
|
@@ -85,6 +135,10 @@ Operation commands support:
|
|
|
85
135
|
|
|
86
136
|
`--path`, `--query`, and `--header` use `name=value` syntax and can be repeated when the operation accepts multiple values.
|
|
87
137
|
|
|
138
|
+
Attachment flags are command-specific: `--attach` works on supported send commands, while `--file` and `--via-presigned` work on mailbox attachment upload commands. Mailbox upload commands share the `7,500,000` byte per-attachment cap.
|
|
139
|
+
|
|
140
|
+
`mailbox:stream-events` also supports `--follow` to keep printing events until the stream closes or the process is interrupted.
|
|
141
|
+
|
|
88
142
|
## Support
|
|
89
143
|
|
|
90
144
|
Open an issue in [Sendmux/sendmux-sdk](https://github.com/Sendmux/sendmux-sdk/issues) with the CLI version, command, flags, and request ID from any API error.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { OperationCommand } from "../../operation-command.js";
|
|
2
|
+
export default class MailboxCreateAttachmentUploadCommand extends OperationCommand {
|
|
3
|
+
static description: "Create a presigned mailbox attachment upload";
|
|
4
|
+
static operation: {
|
|
5
|
+
readonly bodyKind: "json";
|
|
6
|
+
readonly command: "mailbox:create-attachment-upload";
|
|
7
|
+
readonly description: "Create a presigned mailbox attachment upload";
|
|
8
|
+
readonly headerParams: readonly [];
|
|
9
|
+
readonly method: "post";
|
|
10
|
+
readonly operationId: "mailboxCreateAttachmentUpload";
|
|
11
|
+
readonly path: "/mailbox/attachment-uploads";
|
|
12
|
+
readonly pathParams: readonly [];
|
|
13
|
+
readonly queryParams: readonly [{
|
|
14
|
+
readonly name: "mailbox_id";
|
|
15
|
+
readonly required: false;
|
|
16
|
+
readonly schema: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
};
|
|
19
|
+
}];
|
|
20
|
+
readonly responseKind: "json";
|
|
21
|
+
readonly requestBodyRequired: false;
|
|
22
|
+
readonly requiredKeyKind: "mailbox";
|
|
23
|
+
readonly surface: "mailbox";
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=create-attachment-upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-attachment-upload.d.ts","sourceRoot":"","sources":["../../../src/commands/mailbox/create-attachment-upload.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,CAAC,OAAO,OAAO,oCAAqC,SAAQ,gBAAgB;IAChF,MAAM,CAAC,WAAW,iDAAwD;IAC1E,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;MAA4C;CAC7D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// This file is generated by scripts/generate-cli.mjs
|
|
2
|
+
import { operations } from "../../generated/operations.js";
|
|
3
|
+
import { OperationCommand } from "../../operation-command.js";
|
|
4
|
+
export default class MailboxCreateAttachmentUploadCommand extends OperationCommand {
|
|
5
|
+
static description = operations.mailboxCreateAttachmentUpload.description;
|
|
6
|
+
static operation = operations.mailboxCreateAttachmentUpload;
|
|
7
|
+
}
|
|
@@ -34,6 +34,12 @@ export default class MailboxGetMessageAttachmentCommand extends OperationCommand
|
|
|
34
34
|
readonly schema: {
|
|
35
35
|
readonly type: "string";
|
|
36
36
|
};
|
|
37
|
+
}, {
|
|
38
|
+
readonly name: "download_token";
|
|
39
|
+
readonly required: false;
|
|
40
|
+
readonly schema: {
|
|
41
|
+
readonly type: "string";
|
|
42
|
+
};
|
|
37
43
|
}];
|
|
38
44
|
readonly responseKind: "json";
|
|
39
45
|
readonly requestBodyRequired: false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-message-attachment.d.ts","sourceRoot":"","sources":["../../../src/commands/mailbox/get-message-attachment.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,CAAC,OAAO,OAAO,kCAAmC,SAAQ,gBAAgB;IAC9E,MAAM,CAAC,WAAW,kCAAsD;IACxE,MAAM,CAAC,SAAS
|
|
1
|
+
{"version":3,"file":"get-message-attachment.d.ts","sourceRoot":"","sources":["../../../src/commands/mailbox/get-message-attachment.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,CAAC,OAAO,OAAO,kCAAmC,SAAQ,gBAAgB;IAC9E,MAAM,CAAC,WAAW,kCAAsD;IACxE,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAA0C;CAC3D"}
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { OperationCommand } from "../../operation-command.js";
|
|
2
2
|
export default class MailboxStreamEventsCommand extends OperationCommand {
|
|
3
3
|
static description: "Stream mailbox events";
|
|
4
|
+
static flags: {
|
|
5
|
+
follow: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
6
|
+
attach: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
body: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
"body-file": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
"content-type": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
header: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
"idempotency-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
"if-match": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
"if-none-match": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
path: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
query: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
"via-presigned": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
"api-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
"base-url": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
};
|
|
4
22
|
static operation: {
|
|
5
23
|
readonly bodyKind: "none";
|
|
6
24
|
readonly command: "mailbox:stream-events";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-events.d.ts","sourceRoot":"","sources":["../../../src/commands/mailbox/stream-events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream-events.d.ts","sourceRoot":"","sources":["../../../src/commands/mailbox/stream-events.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,MAAM,CAAC,OAAO,OAAO,0BAA2B,SAAQ,gBAAgB;IACtE,MAAM,CAAC,WAAW,0BAA8C;IAChE,MAAM,CAAC,KAAK;;;;;;;;;;;;;;;;;MAKV;IACF,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAkC;CACnD"}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
// This file is generated by scripts/generate-cli.mjs
|
|
2
|
+
import { Flags } from "@oclif/core";
|
|
2
3
|
import { operations } from "../../generated/operations.js";
|
|
3
4
|
import { OperationCommand } from "../../operation-command.js";
|
|
5
|
+
import { operationFlags } from "../../operation-flags.js";
|
|
4
6
|
export default class MailboxStreamEventsCommand extends OperationCommand {
|
|
5
7
|
static description = operations.mailboxStreamEvents.description;
|
|
8
|
+
static flags = {
|
|
9
|
+
...operationFlags,
|
|
10
|
+
follow: Flags.boolean({
|
|
11
|
+
description: "Keep streaming mailbox events until the stream closes or the process is interrupted. Emits one JSON object per line.",
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
6
14
|
static operation = operations.mailboxStreamEvents;
|
|
7
15
|
}
|
|
@@ -199,6 +199,27 @@ export declare const operations: {
|
|
|
199
199
|
readonly requiredKeyKind: "mailbox";
|
|
200
200
|
readonly surface: "mailbox";
|
|
201
201
|
};
|
|
202
|
+
readonly mailboxCreateAttachmentUpload: {
|
|
203
|
+
readonly bodyKind: "json";
|
|
204
|
+
readonly command: "mailbox:create-attachment-upload";
|
|
205
|
+
readonly description: "Create a presigned mailbox attachment upload";
|
|
206
|
+
readonly headerParams: readonly [];
|
|
207
|
+
readonly method: "post";
|
|
208
|
+
readonly operationId: "mailboxCreateAttachmentUpload";
|
|
209
|
+
readonly path: "/mailbox/attachment-uploads";
|
|
210
|
+
readonly pathParams: readonly [];
|
|
211
|
+
readonly queryParams: readonly [{
|
|
212
|
+
readonly name: "mailbox_id";
|
|
213
|
+
readonly required: false;
|
|
214
|
+
readonly schema: {
|
|
215
|
+
readonly type: "string";
|
|
216
|
+
};
|
|
217
|
+
}];
|
|
218
|
+
readonly responseKind: "json";
|
|
219
|
+
readonly requestBodyRequired: false;
|
|
220
|
+
readonly requiredKeyKind: "mailbox";
|
|
221
|
+
readonly surface: "mailbox";
|
|
222
|
+
};
|
|
202
223
|
readonly mailboxCreateFolder: {
|
|
203
224
|
readonly bodyKind: "json";
|
|
204
225
|
readonly command: "mailbox:create-folder";
|
|
@@ -551,6 +572,12 @@ export declare const operations: {
|
|
|
551
572
|
readonly schema: {
|
|
552
573
|
readonly type: "string";
|
|
553
574
|
};
|
|
575
|
+
}, {
|
|
576
|
+
readonly name: "download_token";
|
|
577
|
+
readonly required: false;
|
|
578
|
+
readonly schema: {
|
|
579
|
+
readonly type: "string";
|
|
580
|
+
};
|
|
554
581
|
}];
|
|
555
582
|
readonly responseKind: "json";
|
|
556
583
|
readonly requestBodyRequired: false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/generated/operations.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/generated/operations.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAspIiC,CAAC;AAEzD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWpB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,UAAU,CAAC"}
|
|
@@ -227,6 +227,29 @@ export const operations = {
|
|
|
227
227
|
"requiredKeyKind": "mailbox",
|
|
228
228
|
"surface": "mailbox"
|
|
229
229
|
},
|
|
230
|
+
mailboxCreateAttachmentUpload: {
|
|
231
|
+
"bodyKind": "json",
|
|
232
|
+
"command": "mailbox:create-attachment-upload",
|
|
233
|
+
"description": "Create a presigned mailbox attachment upload",
|
|
234
|
+
"headerParams": [],
|
|
235
|
+
"method": "post",
|
|
236
|
+
"operationId": "mailboxCreateAttachmentUpload",
|
|
237
|
+
"path": "/mailbox/attachment-uploads",
|
|
238
|
+
"pathParams": [],
|
|
239
|
+
"queryParams": [
|
|
240
|
+
{
|
|
241
|
+
"name": "mailbox_id",
|
|
242
|
+
"required": false,
|
|
243
|
+
"schema": {
|
|
244
|
+
"type": "string"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
"responseKind": "json",
|
|
249
|
+
"requestBodyRequired": false,
|
|
250
|
+
"requiredKeyKind": "mailbox",
|
|
251
|
+
"surface": "mailbox"
|
|
252
|
+
},
|
|
230
253
|
mailboxCreateFolder: {
|
|
231
254
|
"bodyKind": "json",
|
|
232
255
|
"command": "mailbox:create-folder",
|
|
@@ -633,6 +656,13 @@ export const operations = {
|
|
|
633
656
|
"schema": {
|
|
634
657
|
"type": "string"
|
|
635
658
|
}
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
"name": "download_token",
|
|
662
|
+
"required": false,
|
|
663
|
+
"schema": {
|
|
664
|
+
"type": "string"
|
|
665
|
+
}
|
|
636
666
|
}
|
|
637
667
|
],
|
|
638
668
|
"responseKind": "json",
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { SendmuxCommand } from "./base-command.js";
|
|
2
2
|
export declare abstract class OperationCommand extends SendmuxCommand {
|
|
3
3
|
static flags: {
|
|
4
|
+
attach: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
4
5
|
body: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
5
6
|
"body-file": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
"content-type": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
9
|
header: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
10
|
"idempotency-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
11
|
"if-match": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
12
|
"if-none-match": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
13
|
path: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
14
|
query: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
"via-presigned": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
16
|
"api-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
17
|
"base-url": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
18
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-command.d.ts","sourceRoot":"","sources":["../src/operation-command.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMnD,8BAAsB,gBAAiB,SAAQ,cAAc;IAC3D,MAAM,CAAC,KAAK
|
|
1
|
+
{"version":3,"file":"operation-command.d.ts","sourceRoot":"","sources":["../src/operation-command.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMnD,8BAAsB,gBAAiB,SAAQ,cAAc;IAC3D,MAAM,CAAC,KAAK;;;;;;;;;;;;;;;;MAAkB;IAExB,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;CAK9B"}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { type AuthFlags, type SendmuxCommand } from "./base-command.js";
|
|
2
2
|
import type { OperationDefinition } from "./operation-types.js";
|
|
3
3
|
export interface OperationFlags extends AuthFlags {
|
|
4
|
+
attach?: string[];
|
|
4
5
|
body?: string;
|
|
5
6
|
"body-file"?: string;
|
|
7
|
+
"content-type"?: string;
|
|
8
|
+
file?: string;
|
|
9
|
+
follow?: boolean;
|
|
6
10
|
header?: string[];
|
|
7
11
|
"idempotency-key"?: string;
|
|
8
12
|
"if-match"?: string;
|
|
9
13
|
"if-none-match"?: string;
|
|
10
14
|
path?: string[];
|
|
11
15
|
query?: string[];
|
|
16
|
+
"via-presigned"?: boolean;
|
|
12
17
|
}
|
|
13
18
|
export interface ParsedOperationOptions {
|
|
14
19
|
body?: unknown;
|
|
@@ -17,14 +22,18 @@ export interface ParsedOperationOptions {
|
|
|
17
22
|
query?: Record<string, unknown>;
|
|
18
23
|
}
|
|
19
24
|
export declare const operationFlags: {
|
|
25
|
+
attach: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
26
|
body: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
27
|
"body-file": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
28
|
+
"content-type": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
29
|
+
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
30
|
header: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
31
|
"idempotency-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
32
|
"if-match": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
33
|
"if-none-match": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
34
|
path: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
35
|
query: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
36
|
+
"via-presigned": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
28
37
|
"api-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
29
38
|
"base-url": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
30
39
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-flags.d.ts","sourceRoot":"","sources":["../src/operation-flags.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,mBAAmB,EAGpB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"operation-flags.d.ts","sourceRoot":"","sources":["../src/operation-flags.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,mBAAmB,EAGpB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;CA0C1B,CAAC;AAEF,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,mBAAmB,EAC9B,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,sBAAsB,CAAC,CAwBjC"}
|
package/dist/operation-flags.js
CHANGED
|
@@ -3,12 +3,22 @@ import { readFile } from "node:fs/promises";
|
|
|
3
3
|
import { authFlags, } from "./base-command.js";
|
|
4
4
|
export const operationFlags = {
|
|
5
5
|
...authFlags,
|
|
6
|
+
attach: Flags.string({
|
|
7
|
+
description: "Local file path to attach to mailbox:send-message or sending:send. Repeat for multiple files.",
|
|
8
|
+
multiple: true,
|
|
9
|
+
}),
|
|
6
10
|
body: Flags.string({
|
|
7
11
|
description: "JSON request body, or UTF-8 bytes for binary operations.",
|
|
8
12
|
}),
|
|
9
13
|
"body-file": Flags.string({
|
|
10
14
|
description: "Path to a JSON request body file, or a binary file for binary operations.",
|
|
11
15
|
}),
|
|
16
|
+
"content-type": Flags.string({
|
|
17
|
+
description: "Override the inferred Content-Type for --file or --attach.",
|
|
18
|
+
}),
|
|
19
|
+
file: Flags.string({
|
|
20
|
+
description: "Local file path for attachment upload convenience commands.",
|
|
21
|
+
}),
|
|
12
22
|
header: Flags.string({
|
|
13
23
|
description: "Header as name=value. Repeat for multiple headers.",
|
|
14
24
|
multiple: true,
|
|
@@ -30,10 +40,13 @@ export const operationFlags = {
|
|
|
30
40
|
description: "Query parameter as name=value. Repeat for multiple query parameters.",
|
|
31
41
|
multiple: true,
|
|
32
42
|
}),
|
|
43
|
+
"via-presigned": Flags.boolean({
|
|
44
|
+
description: "For mailbox:upload-attachment --file, mint a short-lived upload URL and PUT the file without sending an API key.",
|
|
45
|
+
}),
|
|
33
46
|
};
|
|
34
47
|
export async function parseOperationOptions(command, operation, flags) {
|
|
35
48
|
const path = parseParameterPairs(command, operation.pathParams, flags.path ?? [], "--path");
|
|
36
|
-
const query = parseParameterPairs(command, operation.queryParams, flags.query ?? [], "--query");
|
|
49
|
+
const query = parseParameterPairs(command, operation.queryParams, flags.query ?? [], "--query", fileSuppliedQueryParams(operation, flags));
|
|
37
50
|
const headers = parseParameterPairs(command, operation.headerParams, flags.header ?? [], "--header");
|
|
38
51
|
if (flags["idempotency-key"]) {
|
|
39
52
|
addHeaderFlag(command, operation, headers, "Idempotency-Key", flags["idempotency-key"]);
|
|
@@ -52,7 +65,7 @@ export async function parseOperationOptions(command, operation, flags) {
|
|
|
52
65
|
query,
|
|
53
66
|
});
|
|
54
67
|
}
|
|
55
|
-
function parseParameterPairs(command, parameters, values, flagName) {
|
|
68
|
+
function parseParameterPairs(command, parameters, values, flagName, suppliedByConvenienceFlag = new Set()) {
|
|
56
69
|
const parameterMap = new Map(parameters.map((parameter) => [keyForParameter(flagName, parameter.name), parameter]));
|
|
57
70
|
const pairs = {};
|
|
58
71
|
for (const value of values) {
|
|
@@ -83,7 +96,7 @@ function parseParameterPairs(command, parameters, values, flagName) {
|
|
|
83
96
|
pairs[parameter.name] = parsedValue;
|
|
84
97
|
}
|
|
85
98
|
for (const parameter of parameters) {
|
|
86
|
-
if (parameter.required && pairs[parameter.name] === undefined) {
|
|
99
|
+
if (parameter.required && pairs[parameter.name] === undefined && !suppliedByConvenienceFlag.has(parameter.name)) {
|
|
87
100
|
command.error(`Missing ${labelForFlag(flagName)} parameter "${parameter.name}". Pass ${flagName} ${parameter.name}=<value>.`, {
|
|
88
101
|
exit: 2,
|
|
89
102
|
});
|
|
@@ -101,6 +114,9 @@ function parseParameterPairs(command, parameters, values, flagName) {
|
|
|
101
114
|
return pairs;
|
|
102
115
|
}
|
|
103
116
|
async function parseBody(command, operation, flags) {
|
|
117
|
+
if (flags.file && (flags.body || flags["body-file"])) {
|
|
118
|
+
command.error("Pass only one of --file, --body, or --body-file.", { exit: 2 });
|
|
119
|
+
}
|
|
104
120
|
if (flags.body && flags["body-file"]) {
|
|
105
121
|
command.error("Pass only one of --body or --body-file.", { exit: 2 });
|
|
106
122
|
}
|
|
@@ -112,7 +128,7 @@ async function parseBody(command, operation, flags) {
|
|
|
112
128
|
}
|
|
113
129
|
const hasBodyInput = flags.body !== undefined || flags["body-file"] !== undefined;
|
|
114
130
|
if (!hasBodyInput) {
|
|
115
|
-
if (operation.requestBodyRequired) {
|
|
131
|
+
if (operation.requestBodyRequired && !fileSuppliesBody(operation, flags)) {
|
|
116
132
|
const label = operation.bodyKind === "binary" ? "request body file" : "JSON body";
|
|
117
133
|
command.error(`This command requires a ${label}. Pass --body${operation.bodyKind === "binary" ? "-file" : " or --body-file"}.`, {
|
|
118
134
|
exit: 2,
|
|
@@ -137,6 +153,15 @@ async function parseBody(command, operation, flags) {
|
|
|
137
153
|
command.error("Request body must be valid JSON.", { exit: 2 });
|
|
138
154
|
}
|
|
139
155
|
}
|
|
156
|
+
function fileSuppliesBody(operation, flags) {
|
|
157
|
+
return Boolean(flags.file) && operation.operationId === "mailboxUploadAttachment";
|
|
158
|
+
}
|
|
159
|
+
function fileSuppliedQueryParams(operation, flags) {
|
|
160
|
+
if (flags.file && operation.operationId === "mailboxUploadAttachment") {
|
|
161
|
+
return new Set(["filename"]);
|
|
162
|
+
}
|
|
163
|
+
return new Set();
|
|
164
|
+
}
|
|
140
165
|
function addHeaderFlag(command, operation, headers, name, value) {
|
|
141
166
|
const parameter = operation.headerParams.find((item) => item.name.toLowerCase() === name.toLowerCase());
|
|
142
167
|
if (!parameter) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-runner.d.ts","sourceRoot":"","sources":["../src/operation-runner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"operation-runner.d.ts","sourceRoot":"","sources":["../src/operation-runner.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAqBhE,wBAAsB,eAAe,CACnC,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,mBAAmB,EAC9B,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,OAAO,CAAC,CAkElB"}
|