@myapihq/cli 1.0.20 → 1.0.22

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.
@@ -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
- const domain = flags.domain || config.default_domain;
16
- if (!orgId || !domain) {
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, domain);
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> --domain <domain>');
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
@@ -123,7 +123,7 @@ async function main() {
123
123
  else if (err.status === 401)
124
124
  error('Invalid API key. Run: myapi setup');
125
125
  }
126
- error(err.message || String(err));
126
+ error(err.message || (typeof err === 'object' ? JSON.stringify(err) : String(err)));
127
127
  }
128
128
  }
129
129
  function printHelp() {
@@ -145,6 +145,13 @@ Commands:
145
145
  webhook Manage inbound webhooks
146
146
  workflow Manage workflow automations
147
147
 
148
- 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>`);
149
156
  }
150
- 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myapihq/cli",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "MyAPI command-line interface",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -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
- const domain = (flags.domain as string) || config.default_domain;
18
-
19
- if (!orgId || !domain) {
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, domain);
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> --domain <domain>');
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
@@ -105,7 +105,7 @@ async function main() {
105
105
  if (err.status === 402) error('Insufficient balance. Run: myapi billing topup <amount>');
106
106
  else if (err.status === 401) error('Invalid API key. Run: myapi setup');
107
107
  }
108
- error(err.message || String(err));
108
+ error(err.message || (typeof err === 'object' ? JSON.stringify(err) : String(err)));
109
109
  }
110
110
  }
111
111
 
@@ -128,7 +128,14 @@ Commands:
128
128
  webhook Manage inbound webhooks
129
129
  workflow Manage workflow automations
130
130
 
131
- 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>`);
132
139
  }
133
140
 
134
- main().catch(err => { error(err.message || String(err)); });
141
+ main().catch(err => { error(err.message || (typeof err === 'object' ? JSON.stringify(err) : String(err))); });