@myapihq/cli 1.0.59 → 1.0.60
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 +3 -1
- package/dist/commands/funnel.js +11 -4
- package/dist/index.js +1 -2
- package/package.json +1 -1
- package/src/commands/domain.ts +3 -1
- package/src/commands/funnel.ts +10 -4
- package/src/index.ts +1 -2
package/dist/commands/domain.js
CHANGED
|
@@ -31,7 +31,9 @@ export async function register(domainArg, flags) {
|
|
|
31
31
|
const years = parseInt(flags.years) || 1;
|
|
32
32
|
const res = await sdkDomain.registerDomain(config.api_key, orgId, domain, years);
|
|
33
33
|
success(`Registered ${domain}!`);
|
|
34
|
-
info(`
|
|
34
|
+
info(`Assign it to your org now:\n myapi domain assign ${domain} --org ${orgId}`);
|
|
35
|
+
info(`DNS propagation can take a few minutes — track it with: myapi domain status ${domain}`);
|
|
36
|
+
info(`Your funnel will be live on https://${domain} once propagation completes.`);
|
|
35
37
|
}
|
|
36
38
|
export async function importDomain(domainArg, flags) {
|
|
37
39
|
const config = requireConfig();
|
package/dist/commands/funnel.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { funnel as sdkFunnel, hq } from '@myapihq/sdk';
|
|
2
|
-
import { requireConfig } from '../config.js';
|
|
2
|
+
import { requireConfig, saveConfig } from '../config.js';
|
|
3
3
|
import { success, error, printTable, info, printJson } from '../output.js';
|
|
4
4
|
import { formatDate } from '../utils.js';
|
|
5
5
|
export async function list(flags) {
|
|
@@ -47,14 +47,21 @@ export async function del(id, flags) {
|
|
|
47
47
|
export async function push(id, slug, flags) {
|
|
48
48
|
const config = requireConfig();
|
|
49
49
|
const orgId = flags.org || config.default_org;
|
|
50
|
-
|
|
50
|
+
if (!orgId)
|
|
51
|
+
error("Missing org. Set a default with: myapi auth config set-org <id>");
|
|
51
52
|
if (slug && flags.slug && slug !== flags.slug) {
|
|
52
53
|
info(`› Note: positional slug "${slug}" takes precedence over --slug "${flags.slug}".`);
|
|
53
54
|
}
|
|
54
55
|
const rawSlug = slug || flags.slug || '/';
|
|
55
56
|
const finalSlug = rawSlug.startsWith('/') ? rawSlug : `/${rawSlug}`;
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
let funnelId = id || config.default_funnel;
|
|
58
|
+
if (!funnelId) {
|
|
59
|
+
const existing = await sdkFunnel.listFunnels(config.api_key, orgId);
|
|
60
|
+
if (existing.length === 0)
|
|
61
|
+
error("No funnel found for this org. Try: myapi auth config set-org <id>");
|
|
62
|
+
funnelId = existing[0].id;
|
|
63
|
+
config.default_funnel = funnelId;
|
|
64
|
+
saveConfig(config);
|
|
58
65
|
}
|
|
59
66
|
const html = await new Promise((resolve, reject) => {
|
|
60
67
|
let data = '';
|
package/dist/index.js
CHANGED
|
@@ -199,8 +199,7 @@ function printHelp() {
|
|
|
199
199
|
const config = loadConfig();
|
|
200
200
|
const quickStart = config?.api_key
|
|
201
201
|
? `Quick start:
|
|
202
|
-
myapi funnel
|
|
203
|
-
echo '<h1>Hello!</h1>' | myapi funnel push <funnel_id> /`
|
|
202
|
+
echo '<h1>Hello!</h1>' | myapi funnel push /`
|
|
204
203
|
: `Quick start:
|
|
205
204
|
myapi auth setup --help`;
|
|
206
205
|
info(`myapi - MyAPI command-line interface
|
package/package.json
CHANGED
package/src/commands/domain.ts
CHANGED
|
@@ -30,7 +30,9 @@ export async function register(domainArg: string, flags: Record<string, string |
|
|
|
30
30
|
const years = parseInt(flags.years as string) || 1;
|
|
31
31
|
const res = await sdkDomain.registerDomain(config.api_key, orgId, domain, years);
|
|
32
32
|
success(`Registered ${domain}!`);
|
|
33
|
-
info(`
|
|
33
|
+
info(`Assign it to your org now:\n myapi domain assign ${domain} --org ${orgId}`);
|
|
34
|
+
info(`DNS propagation can take a few minutes — track it with: myapi domain status ${domain}`);
|
|
35
|
+
info(`Your funnel will be live on https://${domain} once propagation completes.`);
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
export async function importDomain(domainArg: string, flags: Record<string, string | boolean>) {
|
package/src/commands/funnel.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { funnel as sdkFunnel, hq } from '@myapihq/sdk';
|
|
2
|
-
import { requireConfig } from '../config.js';
|
|
2
|
+
import { requireConfig, saveConfig } from '../config.js';
|
|
3
3
|
import { success, error, printTable, info, printJson } from '../output.js';
|
|
4
4
|
import { formatDate } from '../utils.js';
|
|
5
5
|
import * as fs from 'fs';
|
|
@@ -47,15 +47,21 @@ export async function del(id: string, flags: Record<string, string | boolean>) {
|
|
|
47
47
|
export async function push(id: string, slug: string, flags: Record<string, string | boolean>) {
|
|
48
48
|
const config = requireConfig();
|
|
49
49
|
const orgId = (flags.org as string) || config.default_org;
|
|
50
|
-
|
|
50
|
+
if (!orgId) error("Missing org. Set a default with: myapi auth config set-org <id>");
|
|
51
|
+
|
|
51
52
|
if (slug && flags.slug && slug !== flags.slug) {
|
|
52
53
|
info(`› Note: positional slug "${slug}" takes precedence over --slug "${flags.slug}".`);
|
|
53
54
|
}
|
|
54
55
|
const rawSlug = slug || (flags.slug as string) || '/';
|
|
55
56
|
const finalSlug = rawSlug.startsWith('/') ? rawSlug : `/${rawSlug}`;
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
let funnelId = id || config.default_funnel;
|
|
59
|
+
if (!funnelId) {
|
|
60
|
+
const existing = await sdkFunnel.listFunnels(config.api_key, orgId);
|
|
61
|
+
if (existing.length === 0) error("No funnel found for this org. Try: myapi auth config set-org <id>");
|
|
62
|
+
funnelId = existing[0].id;
|
|
63
|
+
config.default_funnel = funnelId;
|
|
64
|
+
saveConfig(config);
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
const html = await new Promise<string>((resolve, reject) => {
|
package/src/index.ts
CHANGED
|
@@ -170,8 +170,7 @@ function printHelp() {
|
|
|
170
170
|
const config = loadConfig();
|
|
171
171
|
const quickStart = config?.api_key
|
|
172
172
|
? `Quick start:
|
|
173
|
-
myapi funnel
|
|
174
|
-
echo '<h1>Hello!</h1>' | myapi funnel push <funnel_id> /`
|
|
173
|
+
echo '<h1>Hello!</h1>' | myapi funnel push /`
|
|
175
174
|
: `Quick start:
|
|
176
175
|
myapi auth setup --help`;
|
|
177
176
|
info(`myapi - MyAPI command-line interface
|