@velaro/cli 1.4.182 → 1.4.184
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/bin/velaro.js +4 -0
- package/lib/commands/api-usage.js +17 -0
- package/lib/commands/make.js +57 -0
- package/package.json +1 -1
package/bin/velaro.js
CHANGED
|
@@ -16,6 +16,7 @@ import { productMatchCommand } from '../lib/commands/product-match.js';
|
|
|
16
16
|
import { partFinderCommand } from '../lib/commands/part-finder.js';
|
|
17
17
|
import { knowledgeCommand } from '../lib/commands/knowledge.js';
|
|
18
18
|
import { productCommand } from '../lib/commands/product.js';
|
|
19
|
+
import { apiUsageCommand } from '../lib/commands/api-usage.js';
|
|
19
20
|
import { mcpKeyCommand } from '../lib/commands/mcp-key.js';
|
|
20
21
|
import { deployStateCommand } from '../lib/commands/deploy-state.js';
|
|
21
22
|
import { checkCommand } from '../lib/commands/check.js';
|
|
@@ -67,6 +68,7 @@ import { sapCommand } from '../lib/commands/sap.js';
|
|
|
67
68
|
import { salesforceCommand } from '../lib/commands/salesforce.js';
|
|
68
69
|
import { actionsCommand } from '../lib/commands/actions.js';
|
|
69
70
|
import { mondayCommand } from '../lib/commands/monday.js';
|
|
71
|
+
import { makeCommand } from '../lib/commands/make.js';
|
|
70
72
|
import { notionCommand } from '../lib/commands/notion.js';
|
|
71
73
|
import { callrailCommand } from '../lib/commands/callrail.js';
|
|
72
74
|
import { emailCampaignCommand } from '../lib/commands/email-campaign.js';
|
|
@@ -178,6 +180,7 @@ await (registerStaffCommands ? registerStaffCommands(baseYargs) : baseYargs)
|
|
|
178
180
|
.command(knowledgeCommand)
|
|
179
181
|
.command(productCommand)
|
|
180
182
|
.command(mcpKeyCommand)
|
|
183
|
+
.command(apiUsageCommand)
|
|
181
184
|
.command(deployStateCommand)
|
|
182
185
|
.command(checkCommand)
|
|
183
186
|
.command(siteCommand)
|
|
@@ -230,6 +233,7 @@ await (registerStaffCommands ? registerStaffCommands(baseYargs) : baseYargs)
|
|
|
230
233
|
.command(salesforceCommand)
|
|
231
234
|
.command(actionsCommand)
|
|
232
235
|
.command(mondayCommand)
|
|
236
|
+
.command(makeCommand)
|
|
233
237
|
.command(notionCommand)
|
|
234
238
|
.command(callrailCommand)
|
|
235
239
|
.command(emailCampaignCommand)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { get } from '../api.js';
|
|
2
|
+
import { runCommand } from '../run.js';
|
|
3
|
+
|
|
4
|
+
// velaro api-usage: API calls, API keys and webhook endpoints against the plan limits.
|
|
5
|
+
// Mirrors the get_api_usage MCP tool and Moshky tool. Route: GET /ApiKeys (usage array).
|
|
6
|
+
export const apiUsageCommand = {
|
|
7
|
+
command: 'api-usage',
|
|
8
|
+
describe: 'Show API usage against plan limits (calls today/month, keys, webhook endpoints)',
|
|
9
|
+
builder: y => y,
|
|
10
|
+
handler: runCommand(async () => {
|
|
11
|
+
const d = await get('/ApiKeys');
|
|
12
|
+
for (const m of d.usage || []) {
|
|
13
|
+
const cap = m.limit > 0 ? `${m.limit.toLocaleString()} (${m.percent}%)` : 'no cap';
|
|
14
|
+
console.log(`${m.label}: ${m.used.toLocaleString()} of ${cap}`);
|
|
15
|
+
}
|
|
16
|
+
}),
|
|
17
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* velaro make - Make (Integromat) Payload Fields
|
|
3
|
+
*
|
|
4
|
+
* velaro make fields Show the declared Payload Fields
|
|
5
|
+
* velaro make fields-set --fields a,b,c Replace the declared Payload Fields (empty clears them)
|
|
6
|
+
*
|
|
7
|
+
* Declared fields are the required keys of the AI tool; the AI is told the exact keys and
|
|
8
|
+
* a call with other keys is returned to it with the valid keys so it can retry.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { request } from '../api.js';
|
|
12
|
+
|
|
13
|
+
const GRN = '\x1b[32m';
|
|
14
|
+
const RED = '\x1b[31m';
|
|
15
|
+
const BOLD = '\x1b[1m';
|
|
16
|
+
const RST = '\x1b[0m';
|
|
17
|
+
const PATH = '/Make/attribute-allowlist?kind=data';
|
|
18
|
+
|
|
19
|
+
async function fieldsHandler() {
|
|
20
|
+
const res = await request('GET', PATH);
|
|
21
|
+
const keys = Array.isArray(res?.allowedKeys) ? res.allowedKeys : [];
|
|
22
|
+
console.log(`\n${BOLD}Make Payload Fields (${keys.length})${RST}\n`);
|
|
23
|
+
console.log(keys.length ? keys.map(k => ` ${k}`).join('\n') : ' none declared: the AI chooses its own keys');
|
|
24
|
+
console.log('');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function fieldsSetHandler(argv) {
|
|
28
|
+
const raw = typeof argv.fields === 'string' ? argv.fields : '';
|
|
29
|
+
const keys = raw.split(',').map(k => k.trim()).filter(Boolean);
|
|
30
|
+
const bad = keys.find(k => !/^[A-Za-z0-9_-]{1,100}$/.test(k));
|
|
31
|
+
if (bad) {
|
|
32
|
+
console.error(`${RED}Invalid field name "${bad}": letters, numbers, underscore and hyphen only (max 100).${RST}`);
|
|
33
|
+
process.exitCode = 1;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
await request('PUT', PATH, { allowedKeys: keys });
|
|
37
|
+
console.log(`${GRN}Saved ${keys.length} Payload Field(s).${RST}`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const makeCommand = {
|
|
41
|
+
command: 'make <subcommand>',
|
|
42
|
+
describe: 'Make integration Payload Fields',
|
|
43
|
+
builder: y => y
|
|
44
|
+
.command({
|
|
45
|
+
command: 'fields',
|
|
46
|
+
describe: 'Show the declared Payload Fields',
|
|
47
|
+
handler: fieldsHandler,
|
|
48
|
+
})
|
|
49
|
+
.command({
|
|
50
|
+
command: 'fields-set',
|
|
51
|
+
describe: 'Replace the declared Payload Fields',
|
|
52
|
+
builder: yy => yy.option('fields', { describe: 'Comma-separated field names (empty clears)', type: 'string', default: '' }),
|
|
53
|
+
handler: fieldsSetHandler,
|
|
54
|
+
})
|
|
55
|
+
.demandCommand(1, 'Specify a subcommand. Try: velaro make --help'),
|
|
56
|
+
handler: () => {},
|
|
57
|
+
};
|
package/package.json
CHANGED