@myapihq/cli 1.0.18 → 1.0.20
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 +7 -9
- package/dist/commands/funnel.js +15 -2
- package/dist/commands/org.js +6 -0
- package/dist/index.js +4 -25
- package/package.json +1 -1
- package/src/commands/domain.ts +5 -9
- package/src/commands/funnel.ts +14 -2
- package/src/commands/org.ts +6 -0
- package/src/index.ts +4 -27
package/dist/commands/domain.js
CHANGED
|
@@ -30,15 +30,13 @@ export async function importDomain(domainArg, flags) {
|
|
|
30
30
|
const orgId = flags.org || config.default_org;
|
|
31
31
|
const domain = domainArg || config.default_domain;
|
|
32
32
|
if (!orgId || !domain)
|
|
33
|
-
error("Missing required arguments.\nUsage: myapi domain import <domain> --org <id> --namecheap-user <user> --namecheap-key <key
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
namecheap_api_key: flags['namecheap-key']
|
|
41
|
-
});
|
|
33
|
+
error("Missing required arguments.\nUsage: myapi domain import <domain> --org <id> [--namecheap-user <user> --namecheap-key <key>]\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
|
|
34
|
+
const payload = { domain };
|
|
35
|
+
if (flags['namecheap-user'])
|
|
36
|
+
payload.namecheap_api_user = flags['namecheap-user'];
|
|
37
|
+
if (flags['namecheap-key'])
|
|
38
|
+
payload.namecheap_api_key = flags['namecheap-key'];
|
|
39
|
+
await sdkDomain.importDomain(config.api_key, orgId, payload);
|
|
42
40
|
success(`Imported ${domain}`);
|
|
43
41
|
}
|
|
44
42
|
export async function list(flags) {
|
package/dist/commands/funnel.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { funnel as sdkFunnel } from '@myapihq/sdk';
|
|
1
|
+
import { funnel as sdkFunnel, hq } from '@myapihq/sdk';
|
|
2
2
|
import { requireConfig } from '../config.js';
|
|
3
3
|
import { success, error, printTable, info, printJson } from '../output.js';
|
|
4
4
|
export async function list(flags) {
|
|
@@ -18,6 +18,10 @@ export async function create(flags) {
|
|
|
18
18
|
}
|
|
19
19
|
const funnel = await sdkFunnel.createFunnel(config.api_key, orgId, domain);
|
|
20
20
|
success(`Funnel created! ID: ${funnel.id}`);
|
|
21
|
+
const org = await hq.getOrg(config.api_key, orgId);
|
|
22
|
+
if (org.preview_subdomain) {
|
|
23
|
+
info(`Preview: https://${org.preview_subdomain}.makeautonomous.com`);
|
|
24
|
+
}
|
|
21
25
|
}
|
|
22
26
|
export async function get(id, flags) {
|
|
23
27
|
const config = requireConfig();
|
|
@@ -50,8 +54,17 @@ export async function push(id, slug, flags) {
|
|
|
50
54
|
});
|
|
51
55
|
if (!html)
|
|
52
56
|
error("No HTML provided via stdin");
|
|
53
|
-
await sdkFunnel.pushFunnelPage(config.api_key, orgId, id, { slug, html });
|
|
57
|
+
const result = await sdkFunnel.pushFunnelPage(config.api_key, orgId, id, { slug, html });
|
|
54
58
|
success(`Pushed page to ${slug}`);
|
|
59
|
+
if (result?.url) {
|
|
60
|
+
info(`Preview: ${result.url}`);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
const org = await hq.getOrg(config.api_key, orgId);
|
|
64
|
+
if (org.preview_subdomain) {
|
|
65
|
+
info(`Preview: https://${org.preview_subdomain}.makeautonomous.com/${slug}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
55
68
|
}
|
|
56
69
|
export async function verify(id, flags) {
|
|
57
70
|
const config = requireConfig();
|
package/dist/commands/org.js
CHANGED
|
@@ -23,6 +23,9 @@ export async function create(flags) {
|
|
|
23
23
|
payload.logo_url = flags['logo-url'];
|
|
24
24
|
const org = await hq.createOrg(config.api_key, payload);
|
|
25
25
|
success(`Org created! ID: ${org.id}, Name: ${org.name}`);
|
|
26
|
+
if (org.preview_subdomain) {
|
|
27
|
+
info(`Preview domain: https://${org.preview_subdomain}.makeautonomous.com`);
|
|
28
|
+
}
|
|
26
29
|
}
|
|
27
30
|
export async function list(flags) {
|
|
28
31
|
if (flags.help) {
|
|
@@ -45,6 +48,9 @@ export async function get(id, flags) {
|
|
|
45
48
|
const config = requireConfig();
|
|
46
49
|
const org = await hq.getOrg(config.api_key, id);
|
|
47
50
|
printJson(org);
|
|
51
|
+
if (org.preview_subdomain) {
|
|
52
|
+
info(`Preview domain: https://${org.preview_subdomain}.makeautonomous.com`);
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
55
|
export async function del(id, flags) {
|
|
50
56
|
if (flags.help) {
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// AUTO-GENERATED by scripts/generate-indexes.js — do not edit manually
|
|
3
3
|
import { parseArgs } from './utils.js';
|
|
4
|
-
import { error, info
|
|
5
|
-
import { loadConfig, saveConfig } from './config.js';
|
|
4
|
+
import { error, info } from './output.js';
|
|
6
5
|
import { MyApiError } from '@myapihq/sdk';
|
|
7
6
|
import updateNotifier from 'update-notifier';
|
|
8
|
-
import omelette from 'omelette';
|
|
9
7
|
import * as fs from 'fs';
|
|
10
8
|
const pkgPath = new URL('../package.json', import.meta.url);
|
|
11
9
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
@@ -22,24 +20,10 @@ import * as urlCmd from './commands/url.js';
|
|
|
22
20
|
import * as webhookCmd from './commands/webhook.js';
|
|
23
21
|
import * as workflowCmd from './commands/workflow.js';
|
|
24
22
|
async function main() {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
reply(['keys', 'billing', 'org', 'setup', 'config', 'domain', 'funnel', 'image', 'storage', 'url', 'webhook', 'workflow', 'autocomplete']);
|
|
28
|
-
});
|
|
29
|
-
completion.init();
|
|
30
|
-
const config = loadConfig();
|
|
31
|
-
if (config && !config.autocomplete_setup) {
|
|
32
|
-
try {
|
|
33
|
-
completion.setupShellInitFile();
|
|
34
|
-
config.autocomplete_setup = true;
|
|
35
|
-
saveConfig(config);
|
|
36
|
-
info('✨ Autocomplete has been auto-configured! Restart your terminal (or run: source ~/.bashrc) to use it.');
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
// Ignore if we can't write to shell profiles
|
|
40
|
-
}
|
|
23
|
+
try {
|
|
24
|
+
updateNotifier({ pkg }).notify();
|
|
41
25
|
}
|
|
42
|
-
|
|
26
|
+
catch (e) { }
|
|
43
27
|
const { args, flags } = parseArgs(process.argv.slice(2));
|
|
44
28
|
if (args.length === 0) {
|
|
45
29
|
printHelp();
|
|
@@ -48,10 +32,6 @@ async function main() {
|
|
|
48
32
|
const [command, subcommand, ...restArgs] = args;
|
|
49
33
|
try {
|
|
50
34
|
switch (command) {
|
|
51
|
-
case 'autocomplete':
|
|
52
|
-
completion.setupShellInitFile();
|
|
53
|
-
success('Autocomplete successfully configured! Please restart your terminal or run: source ~/.bashrc (or ~/.zshrc)');
|
|
54
|
-
break;
|
|
55
35
|
case 'setup':
|
|
56
36
|
if (flags.help) {
|
|
57
37
|
info('Usage: myapi setup\n\nSetup CLI credentials and view integration instructions');
|
|
@@ -152,7 +132,6 @@ function printHelp() {
|
|
|
152
132
|
Usage: myapi <command> [subcommand] [args]
|
|
153
133
|
|
|
154
134
|
Commands:
|
|
155
|
-
autocomplete Autocomplete setup for bash/zsh
|
|
156
135
|
keys Manage API keys
|
|
157
136
|
billing Check balance and manage billing
|
|
158
137
|
org Manage organizations
|
package/package.json
CHANGED
package/src/commands/domain.ts
CHANGED
|
@@ -29,15 +29,11 @@ export async function importDomain(domainArg: string, flags: Record<string, stri
|
|
|
29
29
|
const config = requireConfig();
|
|
30
30
|
const orgId = (flags.org as string) || config.default_org;
|
|
31
31
|
const domain = domainArg || (config.default_domain as string);
|
|
32
|
-
if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain import <domain> --org <id> --namecheap-user <user> --namecheap-key <key
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
await sdkDomain.importDomain(config.api_key, orgId,
|
|
37
|
-
domain,
|
|
38
|
-
namecheap_api_user: flags['namecheap-user'] as string,
|
|
39
|
-
namecheap_api_key: flags['namecheap-key'] as string
|
|
40
|
-
});
|
|
32
|
+
if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain import <domain> --org <id> [--namecheap-user <user> --namecheap-key <key>]\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
|
|
33
|
+
const payload: { domain: string; namecheap_api_user?: string; namecheap_api_key?: string } = { domain };
|
|
34
|
+
if (flags['namecheap-user']) payload.namecheap_api_user = flags['namecheap-user'] as string;
|
|
35
|
+
if (flags['namecheap-key']) payload.namecheap_api_key = flags['namecheap-key'] as string;
|
|
36
|
+
await sdkDomain.importDomain(config.api_key, orgId, payload);
|
|
41
37
|
success(`Imported ${domain}`);
|
|
42
38
|
}
|
|
43
39
|
|
package/src/commands/funnel.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { funnel as sdkFunnel } from '@myapihq/sdk';
|
|
1
|
+
import { funnel as sdkFunnel, hq } from '@myapihq/sdk';
|
|
2
2
|
import { requireConfig } from '../config.js';
|
|
3
3
|
import { success, error, printTable, info, printJson } from '../output.js';
|
|
4
4
|
import * as fs from 'fs';
|
|
@@ -22,6 +22,10 @@ export async function create(flags: Record<string, string | boolean>) {
|
|
|
22
22
|
|
|
23
23
|
const funnel = await sdkFunnel.createFunnel(config.api_key, orgId, domain);
|
|
24
24
|
success(`Funnel created! ID: ${funnel.id}`);
|
|
25
|
+
const org = await hq.getOrg(config.api_key, orgId);
|
|
26
|
+
if (org.preview_subdomain) {
|
|
27
|
+
info(`Preview: https://${org.preview_subdomain}.makeautonomous.com`);
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
export async function get(id: string, flags: Record<string, string | boolean>) {
|
|
@@ -58,8 +62,16 @@ export async function push(id: string, slug: string, flags: Record<string, strin
|
|
|
58
62
|
|
|
59
63
|
if (!html) error("No HTML provided via stdin");
|
|
60
64
|
|
|
61
|
-
await sdkFunnel.pushFunnelPage(config.api_key, orgId, id, { slug, html });
|
|
65
|
+
const result = await sdkFunnel.pushFunnelPage(config.api_key, orgId, id, { slug, html });
|
|
62
66
|
success(`Pushed page to ${slug}`);
|
|
67
|
+
if (result?.url) {
|
|
68
|
+
info(`Preview: ${result.url}`);
|
|
69
|
+
} else {
|
|
70
|
+
const org = await hq.getOrg(config.api_key, orgId);
|
|
71
|
+
if (org.preview_subdomain) {
|
|
72
|
+
info(`Preview: https://${org.preview_subdomain}.makeautonomous.com/${slug}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
63
75
|
}
|
|
64
76
|
|
|
65
77
|
export async function verify(id: string, flags: Record<string, string | boolean>) {
|
package/src/commands/org.ts
CHANGED
|
@@ -21,6 +21,9 @@ export async function create(flags: Record<string, string | boolean>) {
|
|
|
21
21
|
|
|
22
22
|
const org = await hq.createOrg(config.api_key, payload);
|
|
23
23
|
success(`Org created! ID: ${org.id}, Name: ${org.name}`);
|
|
24
|
+
if (org.preview_subdomain) {
|
|
25
|
+
info(`Preview domain: https://${org.preview_subdomain}.makeautonomous.com`);
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
export async function list(flags: Record<string, string | boolean>) {
|
|
@@ -45,6 +48,9 @@ export async function get(id: string, flags: Record<string, string | boolean>) {
|
|
|
45
48
|
const config = requireConfig();
|
|
46
49
|
const org = await hq.getOrg(config.api_key, id);
|
|
47
50
|
printJson(org);
|
|
51
|
+
if (org.preview_subdomain) {
|
|
52
|
+
info(`Preview domain: https://${org.preview_subdomain}.makeautonomous.com`);
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
export async function del(id: string, flags: Record<string, string | boolean>) {
|
package/src/index.ts
CHANGED
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
// AUTO-GENERATED by scripts/generate-indexes.js — do not edit manually
|
|
3
3
|
import { parseArgs } from './utils.js';
|
|
4
4
|
import { error, info, success } from './output.js';
|
|
5
|
-
import { loadConfig
|
|
5
|
+
import { loadConfig } from './config.js';
|
|
6
6
|
import { MyApiError } from '@myapihq/sdk';
|
|
7
7
|
import updateNotifier from 'update-notifier';
|
|
8
|
-
import omelette from 'omelette';
|
|
9
8
|
import * as fs from 'fs';
|
|
10
|
-
import * as path from 'path';
|
|
11
9
|
|
|
12
10
|
const pkgPath = new URL('../package.json', import.meta.url);
|
|
13
11
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
@@ -25,35 +23,15 @@ import * as webhookCmd from './commands/webhook.js';
|
|
|
25
23
|
import * as workflowCmd from './commands/workflow.js';
|
|
26
24
|
|
|
27
25
|
async function main() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
completion.init();
|
|
33
|
-
|
|
34
|
-
const config = loadConfig();
|
|
35
|
-
if (config && !config.autocomplete_setup) {
|
|
36
|
-
try {
|
|
37
|
-
completion.setupShellInitFile();
|
|
38
|
-
config.autocomplete_setup = true;
|
|
39
|
-
saveConfig(config);
|
|
40
|
-
info('✨ Autocomplete has been auto-configured! Restart your terminal (or run: source ~/.bashrc) to use it.');
|
|
41
|
-
} catch (e) {
|
|
42
|
-
// Ignore if we can't write to shell profiles
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
updateNotifier({ pkg }).notify();
|
|
26
|
+
try {
|
|
27
|
+
updateNotifier({ pkg }).notify();
|
|
28
|
+
} catch(e) {}
|
|
47
29
|
|
|
48
30
|
const { args, flags } = parseArgs(process.argv.slice(2));
|
|
49
31
|
if (args.length === 0) { printHelp(); process.exit(0); }
|
|
50
32
|
const [command, subcommand, ...restArgs] = args;
|
|
51
33
|
try {
|
|
52
34
|
switch (command) {
|
|
53
|
-
case 'autocomplete':
|
|
54
|
-
completion.setupShellInitFile();
|
|
55
|
-
success('Autocomplete successfully configured! Please restart your terminal or run: source ~/.bashrc (or ~/.zshrc)');
|
|
56
|
-
break;
|
|
57
35
|
case 'setup':
|
|
58
36
|
if (flags.help) {
|
|
59
37
|
info('Usage: myapi setup\n\nSetup CLI credentials and view integration instructions');
|
|
@@ -137,7 +115,6 @@ function printHelp() {
|
|
|
137
115
|
Usage: myapi <command> [subcommand] [args]
|
|
138
116
|
|
|
139
117
|
Commands:
|
|
140
|
-
autocomplete Autocomplete setup for bash/zsh
|
|
141
118
|
keys Manage API keys
|
|
142
119
|
billing Check balance and manage billing
|
|
143
120
|
org Manage organizations
|