@sendmux/cli 1.1.0 → 1.3.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 +7 -1
- 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/commands/sending/complete-attachment-upload.d.ts +40 -0
- package/dist/commands/sending/complete-attachment-upload.d.ts.map +1 -0
- package/dist/commands/sending/complete-attachment-upload.js +7 -0
- package/dist/commands/sending/create-attachment-upload.d.ts +27 -0
- package/dist/commands/sending/create-attachment-upload.d.ts.map +1 -0
- package/dist/commands/sending/create-attachment-upload.js +7 -0
- package/dist/commands/sending/get-attachment.d.ts +27 -0
- package/dist/commands/sending/get-attachment.d.ts.map +1 -0
- package/dist/commands/sending/get-attachment.js +7 -0
- package/dist/commands/sending/get-open-api-spec.d.ts +1 -1
- package/dist/commands/sending/upload-attachment.d.ts +49 -0
- package/dist/commands/sending/upload-attachment.d.ts.map +1 -0
- package/dist/commands/sending/upload-attachment.js +7 -0
- package/dist/generated/operations.d.ts +152 -2
- package/dist/generated/operations.d.ts.map +1 -1
- package/dist/generated/operations.js +170 -2
- package/dist/key-kind.d.ts +1 -1
- package/dist/key-kind.d.ts.map +1 -1
- package/dist/key-kind.js +6 -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 +331 -14
- package/oclif.manifest.json +3785 -334
- package/package.json +2 -2
|
@@ -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,9 +656,16 @@ 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
|
-
"responseKind": "
|
|
668
|
+
"responseKind": "binary",
|
|
639
669
|
"requestBodyRequired": false,
|
|
640
670
|
"requiredKeyKind": "mailbox",
|
|
641
671
|
"surface": "mailbox"
|
|
@@ -4144,6 +4174,94 @@ export const operations = {
|
|
|
4144
4174
|
"requiredKeyKind": "root",
|
|
4145
4175
|
"surface": "management"
|
|
4146
4176
|
},
|
|
4177
|
+
sendingCompleteAttachmentUpload: {
|
|
4178
|
+
"bodyKind": "binary",
|
|
4179
|
+
"command": "sending:complete-attachment-upload",
|
|
4180
|
+
"description": "Upload bytes to an attachment upload URL",
|
|
4181
|
+
"headerParams": [
|
|
4182
|
+
{
|
|
4183
|
+
"name": "X-Sendmux-Upload-Token",
|
|
4184
|
+
"required": true,
|
|
4185
|
+
"schema": {
|
|
4186
|
+
"type": "string"
|
|
4187
|
+
}
|
|
4188
|
+
},
|
|
4189
|
+
{
|
|
4190
|
+
"name": "Content-Length",
|
|
4191
|
+
"required": true,
|
|
4192
|
+
"schema": {
|
|
4193
|
+
"type": "integer",
|
|
4194
|
+
"minimum": 1
|
|
4195
|
+
}
|
|
4196
|
+
}
|
|
4197
|
+
],
|
|
4198
|
+
"method": "put",
|
|
4199
|
+
"operationId": "sendingCompleteAttachmentUpload",
|
|
4200
|
+
"path": "/emails/attachment-uploads/{upload_id}",
|
|
4201
|
+
"pathParams": [
|
|
4202
|
+
{
|
|
4203
|
+
"name": "upload_id",
|
|
4204
|
+
"required": true,
|
|
4205
|
+
"schema": {
|
|
4206
|
+
"type": "string",
|
|
4207
|
+
"pattern": "^upl_[a-z0-9]{24}$"
|
|
4208
|
+
}
|
|
4209
|
+
}
|
|
4210
|
+
],
|
|
4211
|
+
"queryParams": [],
|
|
4212
|
+
"responseKind": "json",
|
|
4213
|
+
"requestBodyRequired": true,
|
|
4214
|
+
"requiredKeyKind": "none",
|
|
4215
|
+
"surface": "sending"
|
|
4216
|
+
},
|
|
4217
|
+
sendingCreateAttachmentUpload: {
|
|
4218
|
+
"bodyKind": "json",
|
|
4219
|
+
"command": "sending:create-attachment-upload",
|
|
4220
|
+
"description": "Create an attachment upload URL",
|
|
4221
|
+
"headerParams": [
|
|
4222
|
+
{
|
|
4223
|
+
"name": "Idempotency-Key",
|
|
4224
|
+
"required": false,
|
|
4225
|
+
"schema": {
|
|
4226
|
+
"type": "string",
|
|
4227
|
+
"maxLength": 255
|
|
4228
|
+
}
|
|
4229
|
+
}
|
|
4230
|
+
],
|
|
4231
|
+
"method": "post",
|
|
4232
|
+
"operationId": "sendingCreateAttachmentUpload",
|
|
4233
|
+
"path": "/emails/attachment-uploads",
|
|
4234
|
+
"pathParams": [],
|
|
4235
|
+
"queryParams": [],
|
|
4236
|
+
"responseKind": "json",
|
|
4237
|
+
"requestBodyRequired": true,
|
|
4238
|
+
"requiredKeyKind": "sending",
|
|
4239
|
+
"surface": "sending"
|
|
4240
|
+
},
|
|
4241
|
+
sendingGetAttachment: {
|
|
4242
|
+
"bodyKind": "none",
|
|
4243
|
+
"command": "sending:get-attachment",
|
|
4244
|
+
"description": "Get attachment metadata",
|
|
4245
|
+
"headerParams": [],
|
|
4246
|
+
"method": "get",
|
|
4247
|
+
"operationId": "sendingGetAttachment",
|
|
4248
|
+
"path": "/emails/attachments/{attachment_id}",
|
|
4249
|
+
"pathParams": [
|
|
4250
|
+
{
|
|
4251
|
+
"name": "attachment_id",
|
|
4252
|
+
"required": true,
|
|
4253
|
+
"schema": {
|
|
4254
|
+
"type": "string",
|
|
4255
|
+
"pattern": "^att_[a-z0-9]{24}$"
|
|
4256
|
+
}
|
|
4257
|
+
}
|
|
4258
|
+
],
|
|
4259
|
+
"queryParams": [],
|
|
4260
|
+
"responseKind": "json",
|
|
4261
|
+
"requestBodyRequired": false,
|
|
4262
|
+
"requiredKeyKind": "sending",
|
|
4263
|
+
"surface": "sending"
|
|
4264
|
+
},
|
|
4147
4265
|
sendingGetOpenApiSpec: {
|
|
4148
4266
|
"bodyKind": "none",
|
|
4149
4267
|
"command": "sending:get-open-api-spec",
|
|
@@ -4164,7 +4282,7 @@ export const operations = {
|
|
|
4164
4282
|
"queryParams": [],
|
|
4165
4283
|
"responseKind": "json",
|
|
4166
4284
|
"requestBodyRequired": false,
|
|
4167
|
-
"requiredKeyKind": "
|
|
4285
|
+
"requiredKeyKind": "none",
|
|
4168
4286
|
"surface": "sending"
|
|
4169
4287
|
},
|
|
4170
4288
|
sendingSendEmail: {
|
|
@@ -4215,6 +4333,56 @@ export const operations = {
|
|
|
4215
4333
|
"requiredKeyKind": "sending",
|
|
4216
4334
|
"surface": "sending"
|
|
4217
4335
|
},
|
|
4336
|
+
sendingUploadAttachment: {
|
|
4337
|
+
"bodyKind": "binary",
|
|
4338
|
+
"command": "sending:upload-attachment",
|
|
4339
|
+
"description": "Upload an attachment",
|
|
4340
|
+
"headerParams": [
|
|
4341
|
+
{
|
|
4342
|
+
"name": "Idempotency-Key",
|
|
4343
|
+
"required": false,
|
|
4344
|
+
"schema": {
|
|
4345
|
+
"type": "string",
|
|
4346
|
+
"maxLength": 255
|
|
4347
|
+
}
|
|
4348
|
+
},
|
|
4349
|
+
{
|
|
4350
|
+
"name": "Content-Length",
|
|
4351
|
+
"required": true,
|
|
4352
|
+
"schema": {
|
|
4353
|
+
"type": "integer",
|
|
4354
|
+
"minimum": 1
|
|
4355
|
+
}
|
|
4356
|
+
}
|
|
4357
|
+
],
|
|
4358
|
+
"method": "post",
|
|
4359
|
+
"operationId": "sendingUploadAttachment",
|
|
4360
|
+
"path": "/emails/attachments",
|
|
4361
|
+
"pathParams": [],
|
|
4362
|
+
"queryParams": [
|
|
4363
|
+
{
|
|
4364
|
+
"name": "filename",
|
|
4365
|
+
"required": true,
|
|
4366
|
+
"schema": {
|
|
4367
|
+
"type": "string",
|
|
4368
|
+
"minLength": 1,
|
|
4369
|
+
"maxLength": 255
|
|
4370
|
+
}
|
|
4371
|
+
},
|
|
4372
|
+
{
|
|
4373
|
+
"name": "content_type",
|
|
4374
|
+
"required": false,
|
|
4375
|
+
"schema": {
|
|
4376
|
+
"type": "string",
|
|
4377
|
+
"maxLength": 255
|
|
4378
|
+
}
|
|
4379
|
+
}
|
|
4380
|
+
],
|
|
4381
|
+
"responseKind": "json",
|
|
4382
|
+
"requestBodyRequired": true,
|
|
4383
|
+
"requiredKeyKind": "sending",
|
|
4384
|
+
"surface": "sending"
|
|
4385
|
+
},
|
|
4218
4386
|
};
|
|
4219
4387
|
export const curatedOperations = {
|
|
4220
4388
|
mailboxGetMe: operations.mailboxGetMe,
|
package/dist/key-kind.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type ApiKeyKind = "mailbox" | "root";
|
|
2
|
-
export type RequiredApiKeyKind = ApiKeyKind | "sending";
|
|
2
|
+
export type RequiredApiKeyKind = ApiKeyKind | "none" | "sending";
|
|
3
3
|
export declare function inferApiKeyKind(apiKey: string): ApiKeyKind;
|
|
4
4
|
export declare function isApiKeyCompatibleWithKind(apiKey: string, expectedKind: RequiredApiKeyKind): boolean;
|
|
5
5
|
export declare function apiKeyKindLabel(kind: RequiredApiKeyKind): string;
|
package/dist/key-kind.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key-kind.d.ts","sourceRoot":"","sources":["../src/key-kind.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAC5C,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"key-kind.d.ts","sourceRoot":"","sources":["../src/key-kind.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAC5C,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;AAEjE,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAc1D;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,kBAAkB,GAAG,OAAO,CAUpG;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAKhE;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMjD"}
|
package/dist/key-kind.js
CHANGED
|
@@ -11,12 +11,18 @@ export function inferApiKeyKind(apiKey) {
|
|
|
11
11
|
throw new Error("Sendmux API keys must start with smx_root_, smx_mbx_, or smx_agent_");
|
|
12
12
|
}
|
|
13
13
|
export function isApiKeyCompatibleWithKind(apiKey, expectedKind) {
|
|
14
|
+
if (expectedKind === "none") {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
14
17
|
if (expectedKind === "sending") {
|
|
15
18
|
return apiKey.startsWith("smx_mbx_") || apiKey.startsWith("smx_agent_");
|
|
16
19
|
}
|
|
17
20
|
return inferApiKeyKind(apiKey) === expectedKind;
|
|
18
21
|
}
|
|
19
22
|
export function apiKeyKindLabel(kind) {
|
|
23
|
+
if (kind === "none") {
|
|
24
|
+
return "no";
|
|
25
|
+
}
|
|
20
26
|
return kind === "sending" ? "sending" : kind;
|
|
21
27
|
}
|
|
22
28
|
export function maskApiKey(apiKey) {
|
|
@@ -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 upload and 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;AAsBhE,wBAAsB,eAAe,CACnC,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,mBAAmB,EAC9B,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,OAAO,CAAC,CAwElB"}
|