@myapihq/cli 1.0.19 → 1.0.21
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/funnel.js +4 -5
- package/dist/index.js +14 -28
- package/package.json +1 -1
- package/src/commands/funnel.ts +6 -7
- package/src/index.ts +14 -30
package/dist/commands/funnel.js
CHANGED
|
@@ -12,11 +12,10 @@ export async function list(flags) {
|
|
|
12
12
|
export async function create(flags) {
|
|
13
13
|
const config = requireConfig();
|
|
14
14
|
const orgId = flags.org || config.default_org;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
error("Missing required arguments.\nUsage: myapi funnel create --org <id> --domain <domain>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
|
|
15
|
+
if (!orgId) {
|
|
16
|
+
error("Missing required arguments.\nUsage: myapi funnel create --org <id>\n(Or set defaults via: myapi config set-org <id>)");
|
|
18
17
|
}
|
|
19
|
-
const funnel = await sdkFunnel.createFunnel(config.api_key, orgId
|
|
18
|
+
const funnel = await sdkFunnel.createFunnel(config.api_key, orgId);
|
|
20
19
|
success(`Funnel created! ID: ${funnel.id}`);
|
|
21
20
|
const org = await hq.getOrg(config.api_key, orgId);
|
|
22
21
|
if (org.preview_subdomain) {
|
|
@@ -86,7 +85,7 @@ export async function run(subcommand, args, flags) {
|
|
|
86
85
|
if (subcommand === 'list')
|
|
87
86
|
info('Usage: myapi funnel list --org <id>');
|
|
88
87
|
else if (subcommand === 'create')
|
|
89
|
-
info('Usage: myapi funnel create --org <id>
|
|
88
|
+
info('Usage: myapi funnel create --org <id>');
|
|
90
89
|
else if (subcommand === 'get')
|
|
91
90
|
info('Usage: myapi funnel get <id> --org <id>');
|
|
92
91
|
else if (subcommand === 'delete')
|
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');
|
|
@@ -143,7 +123,7 @@ async function main() {
|
|
|
143
123
|
else if (err.status === 401)
|
|
144
124
|
error('Invalid API key. Run: myapi setup');
|
|
145
125
|
}
|
|
146
|
-
error(err.message || String(err));
|
|
126
|
+
error(err.message || (typeof err === 'object' ? JSON.stringify(err) : String(err)));
|
|
147
127
|
}
|
|
148
128
|
}
|
|
149
129
|
function printHelp() {
|
|
@@ -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
|
|
@@ -166,6 +145,13 @@ Commands:
|
|
|
166
145
|
webhook Manage inbound webhooks
|
|
167
146
|
workflow Manage workflow automations
|
|
168
147
|
|
|
169
|
-
Run "myapi <command> --help" for subcommand help
|
|
148
|
+
Run "myapi <command> --help" for subcommand help.
|
|
149
|
+
|
|
150
|
+
Quick start:
|
|
151
|
+
myapi org create --name "Acme Inc"
|
|
152
|
+
myapi domain register acme.com --org <org_id>
|
|
153
|
+
myapi domain assign acme.com --org <org_id> --target <org_id>
|
|
154
|
+
myapi funnel create --org <org_id>
|
|
155
|
+
echo '<h1>Hello!</h1>' | myapi funnel push <funnel_id> / --org <org_id>`);
|
|
170
156
|
}
|
|
171
|
-
main().catch(err => { error(err.message || String(err)); });
|
|
157
|
+
main().catch(err => { error(err.message || (typeof err === 'object' ? JSON.stringify(err) : String(err))); });
|
package/package.json
CHANGED
package/src/commands/funnel.ts
CHANGED
|
@@ -14,13 +14,12 @@ export async function list(flags: Record<string, string | boolean>) {
|
|
|
14
14
|
export async function create(flags: Record<string, string | boolean>) {
|
|
15
15
|
const config = requireConfig();
|
|
16
16
|
const orgId = (flags.org as string) || config.default_org;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
error("Missing required arguments.\nUsage: myapi funnel create --org <id> --domain <domain>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
|
|
17
|
+
|
|
18
|
+
if (!orgId) {
|
|
19
|
+
error("Missing required arguments.\nUsage: myapi funnel create --org <id>\n(Or set defaults via: myapi config set-org <id>)");
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
const funnel = await sdkFunnel.createFunnel(config.api_key, orgId
|
|
21
|
+
|
|
22
|
+
const funnel = await sdkFunnel.createFunnel(config.api_key, orgId);
|
|
24
23
|
success(`Funnel created! ID: ${funnel.id}`);
|
|
25
24
|
const org = await hq.getOrg(config.api_key, orgId);
|
|
26
25
|
if (org.preview_subdomain) {
|
|
@@ -92,7 +91,7 @@ export async function run(subcommand: string | undefined, args: string[], flags:
|
|
|
92
91
|
|
|
93
92
|
if (flags.help) {
|
|
94
93
|
if (subcommand === 'list') info('Usage: myapi funnel list --org <id>');
|
|
95
|
-
else if (subcommand === 'create') info('Usage: myapi funnel create --org <id>
|
|
94
|
+
else if (subcommand === 'create') info('Usage: myapi funnel create --org <id>');
|
|
96
95
|
else if (subcommand === 'get') info('Usage: myapi funnel get <id> --org <id>');
|
|
97
96
|
else if (subcommand === 'delete') info('Usage: myapi funnel delete <id> --org <id>');
|
|
98
97
|
else if (subcommand === 'push') info('Usage: myapi funnel push <funnel_id> <slug> --org <id> < index.html\n\nPushes HTML content from stdin to the specified funnel.');
|
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');
|
|
@@ -127,7 +105,7 @@ async function main() {
|
|
|
127
105
|
if (err.status === 402) error('Insufficient balance. Run: myapi billing topup <amount>');
|
|
128
106
|
else if (err.status === 401) error('Invalid API key. Run: myapi setup');
|
|
129
107
|
}
|
|
130
|
-
error(err.message || String(err));
|
|
108
|
+
error(err.message || (typeof err === 'object' ? JSON.stringify(err) : String(err)));
|
|
131
109
|
}
|
|
132
110
|
}
|
|
133
111
|
|
|
@@ -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
|
|
@@ -151,7 +128,14 @@ Commands:
|
|
|
151
128
|
webhook Manage inbound webhooks
|
|
152
129
|
workflow Manage workflow automations
|
|
153
130
|
|
|
154
|
-
Run "myapi <command> --help" for subcommand help
|
|
131
|
+
Run "myapi <command> --help" for subcommand help.
|
|
132
|
+
|
|
133
|
+
Quick start:
|
|
134
|
+
myapi org create --name "Acme Inc"
|
|
135
|
+
myapi domain register acme.com --org <org_id>
|
|
136
|
+
myapi domain assign acme.com --org <org_id> --target <org_id>
|
|
137
|
+
myapi funnel create --org <org_id>
|
|
138
|
+
echo '<h1>Hello!</h1>' | myapi funnel push <funnel_id> / --org <org_id>`);
|
|
155
139
|
}
|
|
156
140
|
|
|
157
|
-
main().catch(err => { error(err.message || String(err)); });
|
|
141
|
+
main().catch(err => { error(err.message || (typeof err === 'object' ? JSON.stringify(err) : String(err))); });
|