@myapihq/cli 2.31.6 → 2.31.7
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/dist/commands/domain.js +4 -0
- package/dist/commands/email/mailbox.js +9 -1
- package/dist/commands/email/message.js +4 -0
- package/dist/commands/email/template.js +12 -0
- package/dist/commands/fn.js +4 -0
- package/dist/commands/funnel.js +4 -0
- package/dist/commands/git.js +8 -0
- package/dist/commands/payments.js +8 -0
- package/dist/commands/storage.js +4 -0
- package/dist/commands/workflow.js +8 -0
- package/package.json +3 -2
package/dist/commands/domain.js
CHANGED
|
@@ -421,6 +421,10 @@ export async function updateSettings(domainArg, flags) {
|
|
|
421
421
|
error('Nothing to update. Pass at least one of --security=<level>, --browser-check=<on|off>, --purge-cache.');
|
|
422
422
|
}
|
|
423
423
|
const res = await sdkDomain.updateDomainSettings(config.api_key, orgId, domain, payload);
|
|
424
|
+
if (flags.json) {
|
|
425
|
+
printJson(res);
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
424
428
|
success(`Updated settings for ${domain}!\n${JSON.stringify(res, null, 2)}`);
|
|
425
429
|
}
|
|
426
430
|
// ── DNS records sub-surface (`myapi domain records ...`) ────────────────────
|
|
@@ -72,6 +72,10 @@ async function activateSending(flags) {
|
|
|
72
72
|
if (!address)
|
|
73
73
|
error('Missing required arguments.\nUsage: myapi email mailbox activate-sending --address <email>');
|
|
74
74
|
const res = await sdkEmail.activateSending(config.api_key, address);
|
|
75
|
+
if (flags.json) {
|
|
76
|
+
printJson(res);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
75
79
|
// A repaired account was broken a moment ago: it held a mailbox that reported
|
|
76
80
|
// sending_enabled while the ACCOUNT had no credential behind it, so every send
|
|
77
81
|
// failed with nothing in the mailbox or domain to explain why. Reporting that
|
|
@@ -85,12 +89,16 @@ async function activateSending(flags) {
|
|
|
85
89
|
}
|
|
86
90
|
success(`Sending activated: ${address} (${res.emails_quota_remaining} emails/day quota)`);
|
|
87
91
|
}
|
|
88
|
-
async function setForwarding(address, forwardTo,
|
|
92
|
+
async function setForwarding(address, forwardTo, flags) {
|
|
89
93
|
const config = requireConfig();
|
|
90
94
|
if (!address || !forwardTo) {
|
|
91
95
|
error('Missing required arguments.\nUsage: myapi email mailbox set-forwarding <user@domain> <forward-to@domain>');
|
|
92
96
|
}
|
|
93
97
|
const res = await sdkEmail.setForwarding(config.api_key, address, forwardTo);
|
|
98
|
+
if (flags.json) {
|
|
99
|
+
printJson(res);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
94
102
|
success(`Forwarding set: ${res.address} → ${res.forward_to}`);
|
|
95
103
|
info('A copy of every incoming message is redirected; the original is kept in the mailbox.');
|
|
96
104
|
}
|
|
@@ -75,6 +75,10 @@ async function send(flags) {
|
|
|
75
75
|
template_id: flags['template-id'],
|
|
76
76
|
template_vars: templateVars,
|
|
77
77
|
}));
|
|
78
|
+
if (flags.json) {
|
|
79
|
+
printJson(res);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
78
82
|
success(`Email sent! Message ID: ${res.message_id}`);
|
|
79
83
|
}
|
|
80
84
|
async function status(messageId, _flags) {
|
|
@@ -34,6 +34,10 @@ async function generate(nameArg, flags) {
|
|
|
34
34
|
failedMessage: 'Template generation failed',
|
|
35
35
|
timeoutMessage: 'Template generation timed out',
|
|
36
36
|
});
|
|
37
|
+
if (flags.json) {
|
|
38
|
+
printJson(status);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
37
41
|
success(`Template generated! ID: ${status.template_id}\nPreview: ${status.result?.preview_url}`);
|
|
38
42
|
}
|
|
39
43
|
async function list(flags) {
|
|
@@ -100,6 +104,10 @@ async function edit(id, flags) {
|
|
|
100
104
|
if (!id || !flags.prompt)
|
|
101
105
|
error('Missing required arguments.\nUsage: myapi email template edit <id> --prompt <str> [--org <id>]');
|
|
102
106
|
const res = await sdkEmail.editTemplate(config.api_key, orgId, id, flags.prompt);
|
|
107
|
+
if (flags.json) {
|
|
108
|
+
printJson(res);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
103
111
|
success(`Template ${res.template_id} edited\nPreview: ${res.preview_url}`);
|
|
104
112
|
}
|
|
105
113
|
async function sendTest(id, flags) {
|
|
@@ -108,6 +116,10 @@ async function sendTest(id, flags) {
|
|
|
108
116
|
if (!id || !flags.to)
|
|
109
117
|
error('Missing required arguments.\nUsage: myapi email template send-test <template_id> --to <email> [--org <id>]');
|
|
110
118
|
const res = await sdkEmail.sendTestEmail(config.api_key, orgId, id, flags.to);
|
|
119
|
+
if (flags.json) {
|
|
120
|
+
printJson(res);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
111
123
|
success(`Test sent! Message ID: ${res.message_id}`);
|
|
112
124
|
}
|
|
113
125
|
async function del(id, flags) {
|
package/dist/commands/fn.js
CHANGED
|
@@ -297,6 +297,10 @@ export async function setEnv(id, name, value, flags) {
|
|
|
297
297
|
if (Object.keys(env).length === 0)
|
|
298
298
|
error('No secrets given. Usage: myapi fn env <id> --set KEY=VALUE');
|
|
299
299
|
const result = await sdkFn.setFunctionEnvBulk(config.api_key, orgId, id, env);
|
|
300
|
+
if (flags.json) {
|
|
301
|
+
printJson(result);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
300
304
|
success(`Set ${result.set} secret${result.set === 1 ? '' : 's'} on function ${id}`);
|
|
301
305
|
info('Values are encrypted at rest and never stored or echoed by MyAPI.');
|
|
302
306
|
return;
|
package/dist/commands/funnel.js
CHANGED
|
@@ -137,6 +137,10 @@ export async function create(flags) {
|
|
|
137
137
|
if (name)
|
|
138
138
|
validateFunnelName(name);
|
|
139
139
|
const result = await sdkFunnel.createFunnel(config.api_key, orgId, name ? { name } : undefined);
|
|
140
|
+
if (flags.json) {
|
|
141
|
+
printJson(result);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
140
144
|
success(`Funnel created! ID: ${result.funnel.id}`);
|
|
141
145
|
if (result.funnel.name)
|
|
142
146
|
info(`Name: ${result.funnel.name}`);
|
package/dist/commands/git.js
CHANGED
|
@@ -104,6 +104,10 @@ export async function create(name, flags) {
|
|
|
104
104
|
const repoName = name || flags.name;
|
|
105
105
|
requireArg(repoName, 'name', 'myapi git create <name> [--default-branch <b>]');
|
|
106
106
|
const res = await sdkGit.createRepo(config.api_key, orgId, repoName, flags['default-branch']);
|
|
107
|
+
if (flags.json) {
|
|
108
|
+
printJson(res);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
107
111
|
success(`Repository created: ${res.name}`);
|
|
108
112
|
info(`Default branch: ${res.default_branch}`);
|
|
109
113
|
}
|
|
@@ -334,6 +338,10 @@ export async function merge(repo, flags) {
|
|
|
334
338
|
if (!target || !source)
|
|
335
339
|
error('Both --target <branch> and --source <branch> are required.\nUsage: myapi git merge <repo> --target <b> --source <b>\n(Merge is fast-forward only.)');
|
|
336
340
|
const res = await sdkGit.merge(config.api_key, orgId, repo, target, source);
|
|
341
|
+
if (flags.json) {
|
|
342
|
+
printJson(res);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
337
345
|
success(`Merged ${source} into ${target} → ${shortSha(res.sha)}`);
|
|
338
346
|
}
|
|
339
347
|
export async function repack(repo, flags) {
|
|
@@ -60,6 +60,10 @@ export async function connect(flags) {
|
|
|
60
60
|
if (!key.startsWith('sk_'))
|
|
61
61
|
error('--stripe-key must be a Stripe secret key (starts with "sk_").');
|
|
62
62
|
const res = await sdkPayments.connect(config.api_key, orgId, key);
|
|
63
|
+
if (flags.json) {
|
|
64
|
+
printJson(res);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
63
67
|
success('Stripe connected.');
|
|
64
68
|
info(`Tier: ${res.tier}`);
|
|
65
69
|
info(`Stripe account: ${res.stripe_account_id}`);
|
|
@@ -174,6 +178,10 @@ export async function refund(id, flags) {
|
|
|
174
178
|
if (!id)
|
|
175
179
|
error('Missing charge id.\nUsage: myapi payments refund <charge_id>');
|
|
176
180
|
const res = await sdkPayments.refundCharge(config.api_key, orgId, id);
|
|
181
|
+
if (flags.json) {
|
|
182
|
+
printJson(res);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
177
185
|
success(`Charge ${res.id} refunded (status: ${res.status}).`);
|
|
178
186
|
}
|
|
179
187
|
// ── Dispatcher ───────────────────────────────────────────────────────────────
|
package/dist/commands/storage.js
CHANGED
|
@@ -85,6 +85,10 @@ async function ingest(url, flags) {
|
|
|
85
85
|
const orgId = requireOrg(flags, config, 'myapi storage ingest <url> [--name <name>] [--org <id>]');
|
|
86
86
|
requireArg(url, 'url', 'myapi storage ingest <url> [--name <name>] [--org <id>]');
|
|
87
87
|
const res = await sdkStorage.ingestAsset(config.api_key, orgId, url, flags.name);
|
|
88
|
+
if (flags.json) {
|
|
89
|
+
printJson(res);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
88
92
|
success(`Asset ingested! ID: ${res.asset_id}\nHosted URL: ${res.url}`);
|
|
89
93
|
}
|
|
90
94
|
async function upload(filePath, flags) {
|
|
@@ -216,6 +216,10 @@ export async function create(nameArg, flags) {
|
|
|
216
216
|
trigger_config: { endpoint_id: endpointId },
|
|
217
217
|
steps,
|
|
218
218
|
});
|
|
219
|
+
if (flags.json) {
|
|
220
|
+
printJson(wf);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
219
223
|
const shouldEnable = flags['no-enable'] !== true;
|
|
220
224
|
if (shouldEnable) {
|
|
221
225
|
await sdkWorkflow.enableWorkflow(config.api_key, orgId, wf.id);
|
|
@@ -253,6 +257,10 @@ export async function update(id, flags) {
|
|
|
253
257
|
error('Nothing to update. Provide at least one of --name, --endpoint-id, --steps.');
|
|
254
258
|
}
|
|
255
259
|
const wf = await sdkWorkflow.updateWorkflow(config.api_key, orgId, id, payload);
|
|
260
|
+
if (flags.json) {
|
|
261
|
+
printJson(wf);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
256
264
|
success(`Workflow ${wf.id} updated`);
|
|
257
265
|
}
|
|
258
266
|
export async function enable(id, flags) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myapihq/cli",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "2.31.
|
|
4
|
+
"version": "2.31.7",
|
|
5
5
|
"description": "MyAPI command-line interface",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"lint:query-params": "node scripts/lint-query-params.js",
|
|
38
38
|
"lint:flag-lexicon": "node scripts/lint-flag-lexicon.js",
|
|
39
39
|
"lint:verb-symmetry": "node scripts/lint-verb-symmetry.js",
|
|
40
|
+
"lint:json-parity": "node scripts/lint-json-parity.js",
|
|
40
41
|
"lint:request-fields": "node scripts/lint-request-fields.js",
|
|
41
42
|
"audit:doctor": "npm run build && node scripts/audit-doctor.js",
|
|
42
43
|
"lint:docs": "node scripts/lint-docs.js",
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
"lint:skills:strict": "node scripts/copy-skills.js && node scripts/lint-skills.js --strict"
|
|
50
51
|
},
|
|
51
52
|
"dependencies": {
|
|
52
|
-
"@myapihq/sdk": "^2.31.
|
|
53
|
+
"@myapihq/sdk": "^2.31.7"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
56
|
"@types/node": "^25.6.0",
|