shipmail-cli 0.5.4 → 0.6.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 +1 -12
- package/dist/cli.js +1 -113
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Most commands require an API key. Create one in the Shipmail dashboard and expor
|
|
|
14
14
|
export SHIPMAIL_API_KEY="sm_live_..."
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
You can also pass `--api-key` to any command. Use `SHIPMAIL_BASE_URL` or `--base-url` when targeting a non-production API.
|
|
17
|
+
You can also pass `--api-key` to any command. Use `SHIPMAIL_BASE_URL` or `--base-url` when targeting a non-production API.
|
|
18
18
|
|
|
19
19
|
## Common Commands
|
|
20
20
|
|
|
@@ -125,14 +125,6 @@ shipmail webhooks create \
|
|
|
125
125
|
--events message.received,message.bounced
|
|
126
126
|
shipmail webhooks deliveries whk_123 --status failed
|
|
127
127
|
shipmail webhooks replay-delivery whk_123 dlv_123 --idempotency-key replay-123
|
|
128
|
-
|
|
129
|
-
# Partner beta lifecycle and delegated infrastructure
|
|
130
|
-
shipmail partner organizations create --name "Operator" --external-reference operator_123 --owner-email owner@example.com --mailbox-limit 3 --data-classification internal_test
|
|
131
|
-
shipmail partner usage
|
|
132
|
-
shipmail partner credential-grants list
|
|
133
|
-
shipmail partner credential-grants consume grant_123 --name "Embedded webmail"
|
|
134
|
-
shipmail domains list --organization-id 00000000-0000-4000-8000-000000000123
|
|
135
|
-
shipmail mailboxes create --organization-id 00000000-0000-4000-8000-000000000123 --domain-id dom_123 --address support --generate-password
|
|
136
128
|
```
|
|
137
129
|
|
|
138
130
|
Paragraph, quote, callout, list-item, and column bodies in `--blocks` accept bare text or
|
|
@@ -174,9 +166,6 @@ Use repeatable `--header "Name: value"` flags for request headers. Use `--output
|
|
|
174
166
|
- `newsletter-domains list`
|
|
175
167
|
- `newsletters create|update|preview|preflight|test-send|schedule|cancel|resume`
|
|
176
168
|
- `newsletter-assets list|upload|register-url`
|
|
177
|
-
- `partner organizations list|create|get|update|invite|suspend|resume|offboard`
|
|
178
|
-
- `partner credential-grants list|consume`
|
|
179
|
-
- `partner usage`
|
|
180
169
|
|
|
181
170
|
Configure a publisher-owned Atom self URL and the number of recent issues:
|
|
182
171
|
|
package/dist/cli.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "shipmail";
|
|
16
16
|
|
|
17
17
|
// src/version.ts
|
|
18
|
-
var VERSION = "0.
|
|
18
|
+
var VERSION = "0.6.0";
|
|
19
19
|
|
|
20
20
|
// src/cli.ts
|
|
21
21
|
var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
|
|
@@ -166,9 +166,6 @@ function baseUrl(parsed, env) {
|
|
|
166
166
|
if (!raw) return DEFAULT_BASE_URL;
|
|
167
167
|
return validateBaseUrl(raw, env["SHIPMAIL_ALLOW_INSECURE_BASE_URL"] === "1");
|
|
168
168
|
}
|
|
169
|
-
function organizationId(parsed, env) {
|
|
170
|
-
return getString(parsed.options, "organization-id") ?? env["SHIPMAIL_ORGANIZATION_ID"];
|
|
171
|
-
}
|
|
172
169
|
function requireApiKey(parsed, env) {
|
|
173
170
|
const key = apiKey(parsed, env);
|
|
174
171
|
if (!key) {
|
|
@@ -181,7 +178,6 @@ function createClient(parsed, options) {
|
|
|
181
178
|
const config = {
|
|
182
179
|
apiKey: requireApiKey(parsed, env),
|
|
183
180
|
baseUrl: baseUrl(parsed, env),
|
|
184
|
-
organizationId: organizationId(parsed, env),
|
|
185
181
|
...options.fetch ? { fetch: options.fetch } : {}
|
|
186
182
|
};
|
|
187
183
|
return new ShipmailClient(config);
|
|
@@ -358,10 +354,6 @@ async function rawApiRequest(parsed, runOptions, method, path, body, authRequire
|
|
|
358
354
|
const key = apiKey(parsed, env);
|
|
359
355
|
if (key) headers["Authorization"] = `Bearer ${key}`;
|
|
360
356
|
}
|
|
361
|
-
const targetOrganizationId = organizationId(parsed, env);
|
|
362
|
-
if (targetOrganizationId) {
|
|
363
|
-
headers["X-Shipmail-Organization-Id"] = targetOrganizationId;
|
|
364
|
-
}
|
|
365
357
|
let requestBody;
|
|
366
358
|
if (body !== void 0) {
|
|
367
359
|
headers["Content-Type"] = "application/json";
|
|
@@ -520,17 +512,6 @@ Usage:
|
|
|
520
512
|
shipmail booking-pages get <id>
|
|
521
513
|
shipmail booking-pages update <id> [--name "..."] [--conferencing-provider zoom|google_meet|none] [--active false]
|
|
522
514
|
shipmail booking-pages delete <id>
|
|
523
|
-
shipmail partner organizations list
|
|
524
|
-
shipmail partner organizations create --name "Operator" --external-reference op_123 --owner-email owner@example.com [--mailbox-limit 3] [--data-classification internal_test|customer]
|
|
525
|
-
shipmail partner organizations get <id>
|
|
526
|
-
shipmail partner organizations update <id> [--name "Operator"] [--mailbox-limit 5]
|
|
527
|
-
shipmail partner organizations invite <id> [--owner-email owner@example.com]
|
|
528
|
-
shipmail partner organizations suspend <id>
|
|
529
|
-
shipmail partner organizations resume <id>
|
|
530
|
-
shipmail partner organizations offboard <id>
|
|
531
|
-
shipmail partner credential-grants list
|
|
532
|
-
shipmail partner credential-grants consume <grant-id> [--name "Marketstead webmail"] [--expires-at 2026-10-01T00:00:00Z] [--allowed-cidr 203.0.113.0/24]
|
|
533
|
-
shipmail partner usage
|
|
534
515
|
|
|
535
516
|
Booking page conferencing:
|
|
536
517
|
--conferencing-provider <zoom|google_meet> Create a meeting for every booking.
|
|
@@ -552,7 +533,6 @@ Newsletter feeds:
|
|
|
552
533
|
Global options:
|
|
553
534
|
--api-key <key> API key. Defaults to SHIPMAIL_API_KEY.
|
|
554
535
|
--base-url <url> API base URL. Defaults to SHIPMAIL_BASE_URL or ${DEFAULT_BASE_URL}.
|
|
555
|
-
--organization-id Delegated child organization for supported infrastructure commands.
|
|
556
536
|
--header "K: V" Extra header for the generic api command. Repeatable.
|
|
557
537
|
|
|
558
538
|
Environment:
|
|
@@ -560,7 +540,6 @@ Environment:
|
|
|
560
540
|
SHIPMAIL_BASE_URL Optional API base URL. Must be https on shipmail.to.
|
|
561
541
|
SHIPMAIL_ALLOW_INSECURE_BASE_URL=1
|
|
562
542
|
Permit a non-https or non-shipmail.to base URL (development only).
|
|
563
|
-
SHIPMAIL_ORGANIZATION_ID Optional delegated child organization ID.
|
|
564
543
|
`;
|
|
565
544
|
}
|
|
566
545
|
function requirePositional(positional, index, label) {
|
|
@@ -2200,96 +2179,6 @@ async function runAutomations(client, parsed, out) {
|
|
|
2200
2179
|
}
|
|
2201
2180
|
throw new CliUsageError("Unknown automations command.");
|
|
2202
2181
|
}
|
|
2203
|
-
async function runPartner(client, parsed, out) {
|
|
2204
|
-
const group = parsed.positional[1];
|
|
2205
|
-
if (group === "usage") {
|
|
2206
|
-
writeJson(out, await client.partner.usage());
|
|
2207
|
-
return;
|
|
2208
|
-
}
|
|
2209
|
-
if (group === "credential-grants") {
|
|
2210
|
-
const command2 = requirePositional(parsed.positional, 2, "credential grant command");
|
|
2211
|
-
if (command2 === "list") {
|
|
2212
|
-
writeJson(out, await client.partner.listMailboxCredentialGrants());
|
|
2213
|
-
return;
|
|
2214
|
-
}
|
|
2215
|
-
if (command2 !== "consume")
|
|
2216
|
-
throw new CliUsageError("Unknown partner credential-grants command.");
|
|
2217
|
-
const grantId = requirePositional(parsed.positional, 3, "credential grant id");
|
|
2218
|
-
const name = getString(parsed.options, "name");
|
|
2219
|
-
const expiresAt = getString(parsed.options, "expires-at");
|
|
2220
|
-
const allowedCidrs = getStringList(parsed.options, "allowed-cidr");
|
|
2221
|
-
writeJson(
|
|
2222
|
-
out,
|
|
2223
|
-
await client.partner.consumeMailboxCredentialGrant(grantId, {
|
|
2224
|
-
...name ? { name } : {},
|
|
2225
|
-
...expiresAt ? { expires_at: expiresAt } : {},
|
|
2226
|
-
...allowedCidrs.length > 0 ? { allowed_cidrs: allowedCidrs } : {}
|
|
2227
|
-
})
|
|
2228
|
-
);
|
|
2229
|
-
return;
|
|
2230
|
-
}
|
|
2231
|
-
if (group !== "organizations") throw new CliUsageError("Unknown partner command.");
|
|
2232
|
-
const command = parsed.positional[2];
|
|
2233
|
-
if (command === "list") {
|
|
2234
|
-
writeJson(out, await client.partner.listOrganizations());
|
|
2235
|
-
return;
|
|
2236
|
-
}
|
|
2237
|
-
if (command === "create") {
|
|
2238
|
-
const classification = getString(parsed.options, "data-classification") ?? "customer";
|
|
2239
|
-
if (classification !== "internal_test" && classification !== "customer") {
|
|
2240
|
-
throw new CliUsageError("--data-classification must be internal_test or customer.");
|
|
2241
|
-
}
|
|
2242
|
-
const params = {
|
|
2243
|
-
name: getRequiredString(parsed.options, "name"),
|
|
2244
|
-
external_reference: getRequiredString(parsed.options, "external-reference"),
|
|
2245
|
-
owner_email: getRequiredString(parsed.options, "owner-email"),
|
|
2246
|
-
mailbox_limit: getNumber(parsed.options, "mailbox-limit") ?? 3,
|
|
2247
|
-
data_classification: classification
|
|
2248
|
-
};
|
|
2249
|
-
writeJson(out, await client.partner.createOrganization(params));
|
|
2250
|
-
return;
|
|
2251
|
-
}
|
|
2252
|
-
const id = requirePositional(parsed.positional, 3, "partner organization id");
|
|
2253
|
-
if (command === "get") {
|
|
2254
|
-
writeJson(out, await client.partner.getOrganization(id));
|
|
2255
|
-
return;
|
|
2256
|
-
}
|
|
2257
|
-
if (command === "update") {
|
|
2258
|
-
const name = getString(parsed.options, "name");
|
|
2259
|
-
const mailboxLimit = getNumber(parsed.options, "mailbox-limit");
|
|
2260
|
-
if (name === void 0 && mailboxLimit === void 0) {
|
|
2261
|
-
throw new CliUsageError("Provide --name or --mailbox-limit.");
|
|
2262
|
-
}
|
|
2263
|
-
const params = {
|
|
2264
|
-
...name !== void 0 ? { name } : {},
|
|
2265
|
-
...mailboxLimit !== void 0 ? { mailbox_limit: mailboxLimit } : {}
|
|
2266
|
-
};
|
|
2267
|
-
writeJson(out, await client.partner.updateOrganization(id, params));
|
|
2268
|
-
return;
|
|
2269
|
-
}
|
|
2270
|
-
if (command === "invite") {
|
|
2271
|
-
writeJson(
|
|
2272
|
-
out,
|
|
2273
|
-
await client.partner.resendOwnershipInvitation(id, {
|
|
2274
|
-
owner_email: getString(parsed.options, "owner-email")
|
|
2275
|
-
})
|
|
2276
|
-
);
|
|
2277
|
-
return;
|
|
2278
|
-
}
|
|
2279
|
-
if (command === "suspend") {
|
|
2280
|
-
writeJson(out, await client.partner.suspendOrganization(id));
|
|
2281
|
-
return;
|
|
2282
|
-
}
|
|
2283
|
-
if (command === "resume") {
|
|
2284
|
-
writeJson(out, await client.partner.resumeOrganization(id));
|
|
2285
|
-
return;
|
|
2286
|
-
}
|
|
2287
|
-
if (command === "offboard") {
|
|
2288
|
-
writeJson(out, await client.partner.offboardOrganization(id));
|
|
2289
|
-
return;
|
|
2290
|
-
}
|
|
2291
|
-
throw new CliUsageError("Unknown partner organizations command.");
|
|
2292
|
-
}
|
|
2293
2182
|
function writeError(err, errOut) {
|
|
2294
2183
|
if (err instanceof CliUsageError) {
|
|
2295
2184
|
errOut.write(`Error: ${err.message}
|
|
@@ -2375,7 +2264,6 @@ async function runCli(argv, options = {}) {
|
|
|
2375
2264
|
else if (command === "audiences") await runAudiences(client, parsed, out);
|
|
2376
2265
|
else if (command === "calendar") await runCalendar(client, parsed, out);
|
|
2377
2266
|
else if (command === "booking-pages") await runBookingPages(client, parsed, out);
|
|
2378
|
-
else if (command === "partner") await runPartner(client, parsed, out);
|
|
2379
2267
|
else throw new CliUsageError(`Unknown command: ${command}.`);
|
|
2380
2268
|
return 0;
|
|
2381
2269
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shipmail-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Official CLI for the Shipmail API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"shipmail": "0.
|
|
44
|
+
"shipmail": "0.6.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"tsup": "^8.4.0",
|