@myapihq/cli 1.0.82 → 1.1.0-wip.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/dist/commands/auth.d.ts +8 -3
- package/dist/commands/auth.js +11 -29
- package/dist/commands/billing.d.ts +8 -4
- package/dist/commands/billing.js +43 -22
- package/dist/commands/config.d.ts +8 -5
- package/dist/commands/config.js +63 -28
- package/dist/commands/domain.d.ts +12 -9
- package/dist/commands/domain.js +117 -86
- package/dist/commands/email.d.ts +4 -12
- package/dist/commands/email.js +490 -128
- package/dist/commands/funnel.d.ts +10 -7
- package/dist/commands/funnel.js +78 -55
- package/dist/commands/image.js +25 -15
- package/dist/commands/keys.d.ts +8 -3
- package/dist/commands/keys.js +67 -28
- package/dist/commands/org.d.ts +9 -5
- package/dist/commands/org.js +121 -53
- package/dist/commands/pixel.js +23 -11
- package/dist/commands/setup.d.ts +3 -2
- package/dist/commands/setup.js +44 -77
- package/dist/commands/storage.js +25 -15
- package/dist/commands/update.d.ts +2 -1
- package/dist/commands/url.js +19 -7
- package/dist/commands/webhook.d.ts +8 -5
- package/dist/commands/webhook.js +52 -36
- package/dist/commands/workflow.d.ts +13 -7
- package/dist/commands/workflow.js +158 -56
- package/dist/flags.d.ts +8 -0
- package/dist/flags.js +88 -0
- package/dist/flags.test.d.ts +1 -0
- package/dist/flags.test.js +73 -0
- package/dist/helpers.d.ts +6 -0
- package/dist/helpers.js +29 -0
- package/dist/index.js +97 -107
- package/dist/output.d.ts +10 -1
- package/dist/output.js +4 -6
- package/dist/skills/my-email-api/README.md +45 -0
- package/dist/skills/my-email-api/SKILL.md +106 -0
- package/dist/skills/my-email-api/claude/.claude-plugin/plugin.json +6 -0
- package/dist/skills/my-email-api/make/.gitkeep +0 -0
- package/dist/skills/my-email-api/n8n/.gitkeep +0 -0
- package/dist/skills/my-email-api/openapi/.gitkeep +0 -0
- package/dist/skills/my-webhook-api/README.md +40 -0
- package/dist/skills/my-webhook-api/SKILL.md +65 -0
- package/dist/skills/my-webhook-api/claude/.claude-plugin/plugin.json +6 -0
- package/dist/skills/my-webhook-api/make/.gitkeep +0 -0
- package/dist/skills/my-webhook-api/n8n/.gitkeep +0 -0
- package/dist/skills/my-webhook-api/openapi/.gitkeep +0 -0
- package/dist/skills/my-workflow-api/README.md +37 -0
- package/dist/skills/my-workflow-api/SKILL.md +98 -0
- package/dist/skills/my-workflow-api/claude/.claude-plugin/plugin.json +6 -0
- package/dist/skills/my-workflow-api/make/.gitkeep +0 -0
- package/dist/skills/my-workflow-api/n8n/.gitkeep +0 -0
- package/dist/skills/my-workflow-api/openapi/.gitkeep +0 -0
- package/dist/utils.d.ts +0 -4
- package/dist/utils.js +0 -33
- package/dist/utils.test.d.ts +1 -0
- package/dist/utils.test.js +48 -0
- package/package.json +9 -4
- package/dist/commands/account.d.ts +0 -4
- package/dist/commands/account.js +0 -80
package/dist/commands/domain.js
CHANGED
|
@@ -2,16 +2,20 @@ import { domain as sdkDomain } from '@myapihq/sdk';
|
|
|
2
2
|
import { requireConfig } from '../config.js';
|
|
3
3
|
import { success, error, info, printTable, printJson } from '../output.js';
|
|
4
4
|
import { formatDate } from '../utils.js';
|
|
5
|
+
import { requireOrg, requireDomain } from '../helpers.js';
|
|
6
|
+
export const SCHEMA = {
|
|
7
|
+
org: 'string',
|
|
8
|
+
domain: 'string',
|
|
9
|
+
filter: 'string',
|
|
10
|
+
years: 'number',
|
|
11
|
+
security: 'string',
|
|
12
|
+
'browser-check': 'string',
|
|
13
|
+
'purge-cache': 'boolean',
|
|
14
|
+
};
|
|
5
15
|
export async function check(domainArg, flags) {
|
|
6
16
|
const config = requireConfig();
|
|
7
|
-
const orgId = flags
|
|
8
|
-
const domain = domainArg
|
|
9
|
-
if (!orgId || !domain) {
|
|
10
|
-
const hint = config.default_org
|
|
11
|
-
? `(current default org: ${config.default_org})`
|
|
12
|
-
: '(Set defaults: myapi config set-org <id> / myapi config set-domain <domain>)';
|
|
13
|
-
error(`Missing required arguments.\nUsage: myapi domain check <domain>${config.default_org ? '' : ' --org <id>'}\n${hint}`);
|
|
14
|
-
}
|
|
17
|
+
const orgId = requireOrg(flags, config, 'myapi domain check <domain> [--org <id>]');
|
|
18
|
+
const domain = requireDomain(domainArg, flags, config, 'myapi domain check <domain> [--org <id>]');
|
|
15
19
|
const res = await sdkDomain.checkDomain(config.api_key, orgId, domain);
|
|
16
20
|
if (flags.json) {
|
|
17
21
|
const out = { domain, available: res.available };
|
|
@@ -34,58 +38,50 @@ export async function check(domainArg, flags) {
|
|
|
34
38
|
}
|
|
35
39
|
export async function register(domainArg, flags) {
|
|
36
40
|
const config = requireConfig();
|
|
37
|
-
const orgId = flags
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
info(`
|
|
45
|
-
info(`
|
|
46
|
-
info(`Your funnel will be live on https://${domain} once propagation completes.`);
|
|
41
|
+
const orgId = requireOrg(flags, config, 'myapi domain register <domain> [--years <n>] [--org <id>]');
|
|
42
|
+
if (!domainArg)
|
|
43
|
+
error('Missing required arguments.\nUsage: myapi domain register <domain> [--years <n>] [--org <id>]');
|
|
44
|
+
const years = flags.years || 1;
|
|
45
|
+
await sdkDomain.registerDomain(config.api_key, orgId, domainArg, years);
|
|
46
|
+
success(`Registered ${domainArg}!`);
|
|
47
|
+
info(`Assign it to your org now:\n myapi domain assign ${domainArg} --org ${orgId}`);
|
|
48
|
+
info(`DNS propagation can take a few minutes — track it with: myapi domain status ${domainArg}`);
|
|
49
|
+
info(`Your funnel will be live on https://${domainArg} once propagation completes.`);
|
|
47
50
|
}
|
|
48
51
|
export async function list(flags) {
|
|
49
52
|
const config = requireConfig();
|
|
50
|
-
const orgId = flags
|
|
51
|
-
if (!orgId)
|
|
52
|
-
error("Missing required arguments.\nUsage: myapi domain list --org <id> [--filter=all|unassigned|org]\n(Set default: myapi auth config set-org <id>)");
|
|
53
|
+
const orgId = requireOrg(flags, config, 'myapi domain list [--filter=all|unassigned|org] [--org <id>]');
|
|
53
54
|
const filter = flags.filter;
|
|
54
55
|
const domains = await sdkDomain.listDomains(config.api_key, orgId, filter);
|
|
55
56
|
if (flags.json) {
|
|
56
57
|
printJson(domains);
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
printTable(domains);
|
|
60
|
+
printTable(domains, {
|
|
61
|
+
flags,
|
|
62
|
+
empty: 'No domains found in this organization. Register one with: myapi domain register <name>',
|
|
63
|
+
});
|
|
64
64
|
}
|
|
65
65
|
export async function assign(domainArg, flags) {
|
|
66
66
|
const config = requireConfig();
|
|
67
|
-
const orgId = flags
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
success(`Assigned ${domain} to org ${orgId}`);
|
|
67
|
+
const orgId = requireOrg(flags, config, 'myapi domain assign <domain> [--org <id>]');
|
|
68
|
+
if (!domainArg)
|
|
69
|
+
error('Missing required arguments.\nUsage: myapi domain assign <domain> [--org <id>]');
|
|
70
|
+
await sdkDomain.assignDomain(config.api_key, orgId, domainArg);
|
|
71
|
+
success(`Assigned ${domainArg} to org ${orgId}`);
|
|
73
72
|
}
|
|
74
73
|
export async function unassign(domainArg, flags) {
|
|
75
74
|
const config = requireConfig();
|
|
76
|
-
const orgId = flags
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
success(`Unassigned ${domain} from org ${orgId}`);
|
|
75
|
+
const orgId = requireOrg(flags, config, 'myapi domain unassign <domain> [--org <id>]');
|
|
76
|
+
if (!domainArg)
|
|
77
|
+
error('Missing required arguments.\nUsage: myapi domain unassign <domain> [--org <id>]');
|
|
78
|
+
await sdkDomain.unassignDomain(config.api_key, orgId, domainArg);
|
|
79
|
+
success(`Unassigned ${domainArg} from org ${orgId}`);
|
|
82
80
|
}
|
|
83
81
|
export async function status(domainArg, flags) {
|
|
84
82
|
const config = requireConfig();
|
|
85
|
-
const orgId = flags
|
|
86
|
-
const domain = domainArg
|
|
87
|
-
if (!orgId || !domain)
|
|
88
|
-
error("Missing required arguments.\nUsage: myapi domain status <domain> --org <id>\n(Set defaults: myapi auth config set-org <id> / myapi auth config set-domain <domain>)");
|
|
83
|
+
const orgId = requireOrg(flags, config, 'myapi domain status <domain> [--org <id>]');
|
|
84
|
+
const domain = requireDomain(domainArg, flags, config, 'myapi domain status <domain> [--org <id>]');
|
|
89
85
|
const res = await sdkDomain.getDomainStatus(config.api_key, orgId, domain);
|
|
90
86
|
if (flags.json) {
|
|
91
87
|
printJson(res);
|
|
@@ -96,23 +92,19 @@ export async function status(domainArg, flags) {
|
|
|
96
92
|
if (res.expires_at)
|
|
97
93
|
info(`Expires: ${formatDate(res.expires_at)}`);
|
|
98
94
|
if (res.status === 'active')
|
|
99
|
-
info(
|
|
95
|
+
info('Note: if recently activated, the SSL certificate may still be provisioning — allow a few minutes before the site is reachable over HTTPS.');
|
|
100
96
|
}
|
|
101
97
|
export async function settings(domainArg, flags) {
|
|
102
98
|
const config = requireConfig();
|
|
103
|
-
const orgId = flags
|
|
104
|
-
const domain = domainArg
|
|
105
|
-
if (!orgId || !domain)
|
|
106
|
-
error("Missing required arguments.\nUsage: myapi domain settings <domain> --org <id>\n(Set defaults: myapi auth config set-org <id> / myapi auth config set-domain <domain>)");
|
|
99
|
+
const orgId = requireOrg(flags, config, 'myapi domain settings <domain> [--org <id>]');
|
|
100
|
+
const domain = requireDomain(domainArg, flags, config, 'myapi domain settings <domain> [--org <id>]');
|
|
107
101
|
const res = await sdkDomain.getDomainSettings(config.api_key, orgId, domain);
|
|
108
102
|
printJson(res);
|
|
109
103
|
}
|
|
110
104
|
export async function updateSettings(domainArg, flags) {
|
|
111
105
|
const config = requireConfig();
|
|
112
|
-
const orgId = flags
|
|
113
|
-
const domain = domainArg
|
|
114
|
-
if (!orgId || !domain)
|
|
115
|
-
error("Missing required arguments.\nUsage: myapi domain update-settings <domain> --org <id> [--security=...] [--browser-check=...] [--purge-cache]\n(Set defaults: myapi auth config set-org <id> / myapi auth config set-domain <domain>)");
|
|
106
|
+
const orgId = requireOrg(flags, config, 'myapi domain update-settings <domain> [--org <id>]');
|
|
107
|
+
const domain = requireDomain(domainArg, flags, config, 'myapi domain update-settings <domain> [--org <id>]');
|
|
116
108
|
const payload = {};
|
|
117
109
|
if (flags.security)
|
|
118
110
|
payload.security_level = flags.security;
|
|
@@ -120,49 +112,88 @@ export async function updateSettings(domainArg, flags) {
|
|
|
120
112
|
payload.browser_check = flags['browser-check'];
|
|
121
113
|
if (flags['purge-cache'])
|
|
122
114
|
payload.purge_cache = true;
|
|
115
|
+
if (Object.keys(payload).length === 0) {
|
|
116
|
+
error('Nothing to update. Pass at least one of --security=<level>, --browser-check=<on|off>, --purge-cache.');
|
|
117
|
+
}
|
|
123
118
|
const res = await sdkDomain.updateDomainSettings(config.api_key, orgId, domain, payload);
|
|
124
119
|
success(`Updated settings for ${domain}!\n${JSON.stringify(res, null, 2)}`);
|
|
125
120
|
}
|
|
121
|
+
// ── Dispatcher ───────────────────────────────────────────────────────────────
|
|
122
|
+
const SUBCOMMAND_USAGE = {
|
|
123
|
+
'list': `myapi domain list [--filter=all|unassigned|org] [--org <id>] [--json]
|
|
124
|
+
|
|
125
|
+
--filter=all All domains owned by the account.
|
|
126
|
+
--filter=unassigned Domains not yet assigned to any org.
|
|
127
|
+
--filter=org (Default) Domains assigned to the specified org.
|
|
128
|
+
|
|
129
|
+
Note: --filter=all and --filter=unassigned are account-wide; --org is only used
|
|
130
|
+
to authenticate the request.`,
|
|
131
|
+
'check': 'myapi domain check <domain> [--org <id>] [--json]',
|
|
132
|
+
'register': `myapi domain register <domain> [--years <num>] [--org <id>]
|
|
133
|
+
|
|
134
|
+
--years <num> Number of years to register for (default: 1)
|
|
135
|
+
|
|
136
|
+
Prerequisites:
|
|
137
|
+
- Sufficient balance (myapi billing balance)
|
|
138
|
+
- Domain available (myapi domain check <domain>)
|
|
139
|
+
|
|
140
|
+
After registering: myapi domain assign <domain>
|
|
141
|
+
DNS propagation takes a few minutes — track it with: myapi domain status <domain>`,
|
|
142
|
+
'assign': `myapi domain assign <domain> [--org <id>]
|
|
143
|
+
|
|
144
|
+
Assigns a registered domain to an org. Once assigned, your funnel is served at
|
|
145
|
+
https://<domain> after DNS propagation completes.
|
|
146
|
+
|
|
147
|
+
To transfer to a different org: unassign first, then assign to the new org.`,
|
|
148
|
+
'unassign': 'myapi domain unassign <domain> [--org <id>]',
|
|
149
|
+
'status': 'myapi domain status <domain> [--org <id>] [--json]',
|
|
150
|
+
'settings': `myapi domain settings <domain> [--org <id>]
|
|
151
|
+
|
|
152
|
+
Gets current edge/CDN settings (security level, browser check, cache).
|
|
153
|
+
Use "myapi domain update-settings" to change them.`,
|
|
154
|
+
'update-settings': `myapi domain update-settings <domain> [--security=<level>] [--browser-check=on|off] [--purge-cache] [--org <id>]
|
|
155
|
+
|
|
156
|
+
--security=<level> essentially_off | low | medium | high | under_attack (default: medium)
|
|
157
|
+
--browser-check=<on|off> Browser integrity challenge for suspicious traffic (default: on)
|
|
158
|
+
--purge-cache Immediately clear the CDN cache for this domain
|
|
159
|
+
|
|
160
|
+
Example:
|
|
161
|
+
myapi domain update-settings example.com --security=high --purge-cache`,
|
|
162
|
+
};
|
|
126
163
|
export async function run(subcommand, args, flags) {
|
|
127
164
|
if (!subcommand || (flags.help && !subcommand)) {
|
|
128
|
-
info(
|
|
165
|
+
info(`Usage: myapi domain <subcommand>
|
|
166
|
+
|
|
167
|
+
Subcommands:
|
|
168
|
+
list List domains
|
|
169
|
+
check Check domain availability
|
|
170
|
+
register Register a domain
|
|
171
|
+
assign Assign domain to an org
|
|
172
|
+
unassign Unassign domain from its current org
|
|
173
|
+
status Get domain status
|
|
174
|
+
settings Get edge/CDN settings
|
|
175
|
+
update-settings Update edge/CDN settings
|
|
176
|
+
|
|
177
|
+
Tip: Set defaults with "myapi config set-org <id>" / "set-domain <domain>" to skip flags on every command.`);
|
|
129
178
|
return;
|
|
130
179
|
}
|
|
131
180
|
if (flags.help) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
info('Usage: myapi domain register <domain> --org <id> [--years <num>]\n\nRegisters a new domain name under your account.\n\nFlags:\n --years <num> Number of years to register for (default: 1)\n\nPrerequisites:\n - You must have sufficient balance (myapi billing balance)\n - The domain must be available (myapi domain check <domain>)\n\nAfter registering, assign the domain to your org:\n myapi domain assign <domain> --org <id>\n\nDNS propagation takes a few minutes. Track it with:\n myapi domain status <domain>');
|
|
138
|
-
else if (subcommand === 'assign')
|
|
139
|
-
info('Usage: myapi domain assign <domain> --org <id>\n\nAssigns a registered domain to an organization. The domain must already be\nregistered under your account. Once assigned, your funnel will be served at\nhttps://<domain> after DNS propagation completes.\n\nTo transfer a domain to a different org: unassign it first, then assign to the new org.');
|
|
140
|
-
else if (subcommand === 'unassign')
|
|
141
|
-
info('Usage: myapi domain unassign <domain> --org <id>\n\nUnassigns a domain from its current organization. The domain remains registered\nunder your account and can be reassigned to a different org at any time.');
|
|
142
|
-
else if (subcommand === 'status')
|
|
143
|
-
info('Usage: myapi domain status <domain> --org <id> [--json]\n\nGets the registration status of a domain.\n\nFlags:\n --json Output raw JSON');
|
|
144
|
-
else if (subcommand === 'settings')
|
|
145
|
-
info('Usage: myapi domain settings <domain> --org <id>\n\nGets the current edge/CDN settings for a domain (security level, browser check, cache).\nUse "myapi domain update-settings" to change them.');
|
|
146
|
-
else if (subcommand === 'update-settings')
|
|
147
|
-
info('Usage: myapi domain update-settings <domain> --org <id> [flags]\n\nUpdates edge/CDN settings for a domain.\n\nFlags:\n --security=<level> CDN security level. Controls bot/threat filtering.\n Values: essentially_off | low | medium | high | under_attack\n Default (if unset): medium\n --browser-check=<on|off> Enable or disable browser integrity challenge for suspicious traffic.\n Default: on\n --purge-cache Immediately clears the CDN cache for this domain.\n Use after deploying changes that are not yet visible.\n\nExample:\n myapi domain update-settings example.com --org <id> --security=high --purge-cache');
|
|
181
|
+
const usage = SUBCOMMAND_USAGE[subcommand];
|
|
182
|
+
if (usage)
|
|
183
|
+
info(`Usage: ${usage}`);
|
|
184
|
+
else
|
|
185
|
+
info(`Unknown subcommand: ${subcommand}. Run "myapi domain --help" for the list.`);
|
|
148
186
|
return;
|
|
149
187
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
await status(args[0], flags);
|
|
162
|
-
else if (subcommand === 'settings')
|
|
163
|
-
await settings(args[0], flags);
|
|
164
|
-
else if (subcommand === 'update-settings')
|
|
165
|
-
await updateSettings(args[0], flags);
|
|
166
|
-
else
|
|
167
|
-
error(`Unknown subcommand: ${subcommand}. Run "myapi domain --help" for a list of valid subcommands.`);
|
|
188
|
+
switch (subcommand) {
|
|
189
|
+
case 'list': return list(flags);
|
|
190
|
+
case 'check': return check(args[0], flags);
|
|
191
|
+
case 'register': return register(args[0], flags);
|
|
192
|
+
case 'assign': return assign(args[0], flags);
|
|
193
|
+
case 'unassign': return unassign(args[0], flags);
|
|
194
|
+
case 'status': return status(args[0], flags);
|
|
195
|
+
case 'settings': return settings(args[0], flags);
|
|
196
|
+
case 'update-settings': return updateSettings(args[0], flags);
|
|
197
|
+
default: error(`Unknown subcommand: ${subcommand}. Run "myapi domain --help" for a list of valid subcommands.`);
|
|
198
|
+
}
|
|
168
199
|
}
|
package/dist/commands/email.d.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function inbox(address: string, flags: Record<string, string | boolean>): Promise<void>;
|
|
6
|
-
export declare function outbox(address: string, flags: Record<string, string | boolean>): Promise<void>;
|
|
7
|
-
export declare function listTemplates(flags: Record<string, string | boolean>): Promise<void>;
|
|
8
|
-
export declare function deleteTemplate(id: string, flags: Record<string, string | boolean>): Promise<void>;
|
|
9
|
-
export declare function generateTemplate(flags: Record<string, string | boolean>): Promise<void>;
|
|
10
|
-
export declare function listCampaigns(flags: Record<string, string | boolean>): Promise<void>;
|
|
11
|
-
export declare function campaignStats(id: string, flags: Record<string, string | boolean>): Promise<void>;
|
|
12
|
-
export declare function run(subcommand: string | undefined, args: string[], flags: Record<string, string | boolean>): Promise<void>;
|
|
1
|
+
import type { FlagSchema } from '../flags.js';
|
|
2
|
+
import { type Flags } from '../helpers.js';
|
|
3
|
+
export declare const SCHEMA: FlagSchema;
|
|
4
|
+
export declare function run(subcommand: string | undefined, args: string[], flags: Flags): Promise<void>;
|