alwaysai
Version:
The alwaysAI command-line interface (CLI)
39 lines • 1.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.rpc = void 0;
const alwayscli_1 = require("@alwaysai/alwayscli");
const cloud_api_1 = require("@alwaysai/cloud-api");
const environment_1 = require("../environment");
const infrastructure_1 = require("../infrastructure");
const rpcMethodCliLeaves = Object.entries(cloud_api_1.rpcMethodSpecs).map(([methodName, { description }]) => {
return (0, alwayscli_1.CliLeaf)({
name: methodName,
description,
positionalInput: (0, alwayscli_1.CliJsonInput)({
placeholder: '<args>',
description: 'Method arguments array as a JSON string'
}),
async action(args) {
const method = (0, infrastructure_1.CliRpcClient)()[methodName];
const result = await method(...(args || []));
return result;
}
});
});
const rpcRawCliLeaf = (0, alwayscli_1.CliLeaf)({
name: 'raw',
positionalInput: (0, alwayscli_1.CliJsonInput)({
required: true
}),
description: 'Send a custom data payload to the RPC endpoint',
async action(data) {
return await (0, infrastructure_1.CliRpcClient)().raw(data);
}
});
exports.rpc = (0, alwayscli_1.CliBranch)({
name: 'rpc',
hidden: !environment_1.ALWAYSAI_SHOW_HIDDEN,
description: 'Call the alwaysAI Cloud API RPC interface',
subcommands: [...rpcMethodCliLeaves, rpcRawCliLeaf]
});
//# sourceMappingURL=rpc.js.map