@myapihq/cli 2.21.0 → 2.21.1
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.
|
@@ -2,6 +2,11 @@ import { audience as sdkAudience } from '@myapihq/sdk';
|
|
|
2
2
|
import { requireConfig } from '../config.js';
|
|
3
3
|
import { success, error, printTable, info, printJson } from '../output.js';
|
|
4
4
|
import { requireOrg, requireArg } from '../helpers.js';
|
|
5
|
+
import { retryFunds } from '../utils.js';
|
|
6
|
+
// Billable: the backend reserves funds before serving these, so an empty
|
|
7
|
+
// wallet with an auto-recharge in flight answers 402 in_flight with a
|
|
8
|
+
// retry hint. retryFunds waits it out instead of killing an unattended
|
|
9
|
+
// run. Only create/update/members/refresh gate — list, get and delete are free and stay unwrapped.
|
|
5
10
|
export const EXPOSES = [
|
|
6
11
|
'POST /audience/orgs/{org_id}/audiences',
|
|
7
12
|
'GET /audience/orgs/{org_id}/audiences',
|
|
@@ -59,9 +64,9 @@ async function create(nameArg, flags) {
|
|
|
59
64
|
}
|
|
60
65
|
const filter = parseFilter(flags.filter);
|
|
61
66
|
const description = typeof flags.description === 'string' ? flags.description : undefined;
|
|
62
|
-
const res = await sdkAudience.createAudience(config.api_key, orgId, {
|
|
67
|
+
const res = await retryFunds(() => sdkAudience.createAudience(config.api_key, orgId, {
|
|
63
68
|
name, source: source, filter, description,
|
|
64
|
-
});
|
|
69
|
+
}));
|
|
65
70
|
if (flags.json) {
|
|
66
71
|
printJson(res);
|
|
67
72
|
return;
|
|
@@ -102,7 +107,7 @@ async function update(id, flags) {
|
|
|
102
107
|
if (Object.keys(patch).length === 0) {
|
|
103
108
|
error('Pass at least one of --name / --description / --filter to update.');
|
|
104
109
|
}
|
|
105
|
-
const res = await sdkAudience.updateAudience(config.api_key, orgId, id, patch);
|
|
110
|
+
const res = await retryFunds(() => sdkAudience.updateAudience(config.api_key, orgId, id, patch));
|
|
106
111
|
if (flags.json) {
|
|
107
112
|
printJson(res);
|
|
108
113
|
return;
|
|
@@ -125,7 +130,7 @@ async function members(id, flags) {
|
|
|
125
130
|
opts.limit = flags.limit;
|
|
126
131
|
if (typeof flags.offset === 'number')
|
|
127
132
|
opts.offset = flags.offset;
|
|
128
|
-
const res = await sdkAudience.getAudienceMembers(config.api_key, orgId, id, opts);
|
|
133
|
+
const res = await retryFunds(() => sdkAudience.getAudienceMembers(config.api_key, orgId, id, opts));
|
|
129
134
|
if (flags.json) {
|
|
130
135
|
printJson(res);
|
|
131
136
|
return;
|
|
@@ -161,7 +166,7 @@ async function refresh(id, flags) {
|
|
|
161
166
|
const config = requireConfig();
|
|
162
167
|
const orgId = requireOrg(flags, config, 'myapi audience refresh <id> [--org <id>]');
|
|
163
168
|
requireArg(id, 'id', 'myapi audience refresh <id> [--org <id>]');
|
|
164
|
-
const res = await sdkAudience.refreshAudience(config.api_key, orgId, id);
|
|
169
|
+
const res = await retryFunds(() => sdkAudience.refreshAudience(config.api_key, orgId, id));
|
|
165
170
|
if (flags.json) {
|
|
166
171
|
printJson(res);
|
|
167
172
|
return;
|
package/dist/commands/company.js
CHANGED
|
@@ -2,6 +2,11 @@ import { company as sdkCompany } from '@myapihq/sdk';
|
|
|
2
2
|
import { requireConfig } from '../config.js';
|
|
3
3
|
import { error, printTable, info, printJson } from '../output.js';
|
|
4
4
|
import { requireOrg, requireArg } from '../helpers.js';
|
|
5
|
+
import { retryFunds } from '../utils.js';
|
|
6
|
+
// Billable: the backend reserves funds before serving these, so an empty
|
|
7
|
+
// wallet with an auto-recharge in flight answers 402 in_flight with a
|
|
8
|
+
// retry hint. retryFunds waits it out instead of killing an unattended
|
|
9
|
+
// run. Both handlers gate; there is no free company call.
|
|
5
10
|
export const EXPOSES = [
|
|
6
11
|
'POST /company/orgs/{org_id}/search',
|
|
7
12
|
'GET /company/orgs/{org_id}/{company_id}',
|
|
@@ -72,7 +77,7 @@ async function search(flags) {
|
|
|
72
77
|
const config = requireConfig();
|
|
73
78
|
const orgId = requireOrg(flags, config, 'myapi company search [filters...] [--org <id>]');
|
|
74
79
|
const options = buildSearch(flags);
|
|
75
|
-
const res = await sdkCompany.searchCompanies(config.api_key, orgId, options);
|
|
80
|
+
const res = await retryFunds(() => sdkCompany.searchCompanies(config.api_key, orgId, options));
|
|
76
81
|
if (flags.json) {
|
|
77
82
|
printJson(res);
|
|
78
83
|
return;
|
|
@@ -94,7 +99,7 @@ async function get(companyId, flags) {
|
|
|
94
99
|
const orgId = requireOrg(flags, config, 'myapi company get <company_id> [--include-people N] [--org <id>]');
|
|
95
100
|
requireArg(companyId, 'company_id', 'myapi company get <company_id> [--include-people N] [--org <id>]');
|
|
96
101
|
const includePeople = typeof flags['include-people'] === 'number' ? flags['include-people'] : undefined;
|
|
97
|
-
const res = await sdkCompany.getCompany(config.api_key, orgId, companyId, includePeople);
|
|
102
|
+
const res = await retryFunds(() => sdkCompany.getCompany(config.api_key, orgId, companyId, includePeople));
|
|
98
103
|
printJson(res);
|
|
99
104
|
}
|
|
100
105
|
export const SUBCOMMAND_USAGE = {
|
package/dist/commands/people.js
CHANGED
|
@@ -2,6 +2,11 @@ import { people as sdkPeople } from '@myapihq/sdk';
|
|
|
2
2
|
import { requireConfig } from '../config.js';
|
|
3
3
|
import { error, printTable, info, printJson } from '../output.js';
|
|
4
4
|
import { requireOrg, requireArg } from '../helpers.js';
|
|
5
|
+
import { retryFunds } from '../utils.js';
|
|
6
|
+
// Billable: the backend reserves funds before serving these, so an empty
|
|
7
|
+
// wallet with an auto-recharge in flight answers 402 in_flight with a
|
|
8
|
+
// retry hint. retryFunds waits it out instead of killing an unattended
|
|
9
|
+
// run. Both handlers gate; there is no free people call.
|
|
5
10
|
export const EXPOSES = [
|
|
6
11
|
'POST /people/orgs/{org_id}/search',
|
|
7
12
|
'GET /people/orgs/{org_id}/{person_id}',
|
|
@@ -61,7 +66,7 @@ async function search(flags) {
|
|
|
61
66
|
const config = requireConfig();
|
|
62
67
|
const orgId = requireOrg(flags, config, 'myapi people search [filters...] [--org <id>]');
|
|
63
68
|
const filter = buildFilter(flags);
|
|
64
|
-
const res = await sdkPeople.searchPeople(config.api_key, orgId, filter);
|
|
69
|
+
const res = await retryFunds(() => sdkPeople.searchPeople(config.api_key, orgId, filter));
|
|
65
70
|
if (flags.json) {
|
|
66
71
|
printJson(res);
|
|
67
72
|
return;
|
|
@@ -80,7 +85,7 @@ async function get(personId, flags) {
|
|
|
80
85
|
const config = requireConfig();
|
|
81
86
|
const orgId = requireOrg(flags, config, 'myapi people get <person_id> [--org <id>]');
|
|
82
87
|
requireArg(personId, 'person_id', 'myapi people get <person_id> [--org <id>]');
|
|
83
|
-
const res = await sdkPeople.getPerson(config.api_key, orgId, personId);
|
|
88
|
+
const res = await retryFunds(() => sdkPeople.getPerson(config.api_key, orgId, personId));
|
|
84
89
|
printJson(res);
|
|
85
90
|
}
|
|
86
91
|
export const SUBCOMMAND_USAGE = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myapihq/cli",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "2.21.
|
|
4
|
+
"version": "2.21.1",
|
|
5
5
|
"description": "MyAPI command-line interface",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"lint:skills:strict": "node scripts/copy-skills.js && node scripts/lint-skills.js --strict"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@myapihq/sdk": "^2.21.
|
|
49
|
+
"@myapihq/sdk": "^2.21.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^25.6.0",
|