@myapihq/cli 1.0.18 → 1.0.19
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/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/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/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>) {
|