@claypi/cli 0.1.4 → 0.1.5
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/index.js +104 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -82972,6 +82972,13 @@ function readJsonFlag(flagName, source) {
|
|
|
82972
82972
|
throw new InvalidArgumentError(`${flagName}: not valid JSON (${err.message})`);
|
|
82973
82973
|
}
|
|
82974
82974
|
}
|
|
82975
|
+
function readJsonObjectFlag(flagName, source) {
|
|
82976
|
+
const parsed = readJsonFlag(flagName, source);
|
|
82977
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
82978
|
+
throw new InvalidArgumentError(`${flagName}: must be a JSON object`);
|
|
82979
|
+
}
|
|
82980
|
+
return parsed;
|
|
82981
|
+
}
|
|
82975
82982
|
|
|
82976
82983
|
// src/commands/tables/list.ts
|
|
82977
82984
|
function buildListCommand() {
|
|
@@ -92203,6 +92210,7 @@ var BlockSettings = external_exports.discriminatedUnion("blockType", [
|
|
|
92203
92210
|
AdSyncBlockSettings
|
|
92204
92211
|
]);
|
|
92205
92212
|
var AutoRunMode = external_exports.enum(["all", "keep_existing"]);
|
|
92213
|
+
var TableColorLabels = external_exports.record(external_exports.nativeEnum(DataTypeColor), external_exports.string());
|
|
92206
92214
|
var TableSettingsBase = external_exports.object({
|
|
92207
92215
|
AUTO_RUN_ON: external_exports.boolean().optional(),
|
|
92208
92216
|
AUTO_RUN_MODE: AutoRunMode.optional(),
|
|
@@ -92237,7 +92245,8 @@ var TableSettingsBase = external_exports.object({
|
|
|
92237
92245
|
PASS_THROUGH_TABLE_SUCCESS_CRITERIA: GridViewFilterConfigGroup.optional(),
|
|
92238
92246
|
PASS_THROUGH_TABLE_DELETE_EXCESS_RECORDS_LIMIT: external_exports.number().optional(),
|
|
92239
92247
|
/** When true, table data is synced for ClayQL queries (cross-table, NL queries). */
|
|
92240
|
-
CLAYQL_SYNC_ENABLED: external_exports.boolean().optional()
|
|
92248
|
+
CLAYQL_SYNC_ENABLED: external_exports.boolean().optional(),
|
|
92249
|
+
COLOR_LABELS: TableColorLabels.optional()
|
|
92241
92250
|
});
|
|
92242
92251
|
var TableSettings = TableSettingsBase.refine(
|
|
92243
92252
|
(data) => {
|
|
@@ -92288,7 +92297,7 @@ var TableSettingsKeys = Object.freeze(
|
|
|
92288
92297
|
);
|
|
92289
92298
|
|
|
92290
92299
|
// ../../libs/shared/src/tools/tool-id.ts
|
|
92291
|
-
var ToolType = external_exports.enum(["function", "enrichment"]);
|
|
92300
|
+
var ToolType = external_exports.enum(["function", "enrichment", "workflow"]);
|
|
92292
92301
|
|
|
92293
92302
|
// ../../libs/shared/src/tools/tool-input-schemas.ts
|
|
92294
92303
|
var ToolSurface = external_exports.enum(["api", "mcp", "claygent"]);
|
|
@@ -93998,6 +94007,89 @@ var terracottaClayActionsContract = {
|
|
|
93998
94007
|
}
|
|
93999
94008
|
};
|
|
94000
94009
|
|
|
94010
|
+
// src/commands/workflows/actions/dynamic-fields.ts
|
|
94011
|
+
function prefixRevealedFieldNames(responses, parameterPath) {
|
|
94012
|
+
const prefix = parameterPath.split(".").pop() ?? parameterPath;
|
|
94013
|
+
return responses.map((response) => ({
|
|
94014
|
+
...response,
|
|
94015
|
+
dynamicData: (response.dynamicData ?? []).map((field) => {
|
|
94016
|
+
if (typeof field === "object" && field !== null && "name" in field) {
|
|
94017
|
+
const named = field;
|
|
94018
|
+
if (typeof named.name === "string") {
|
|
94019
|
+
return { ...field, name: `${prefix}|${named.name}` };
|
|
94020
|
+
}
|
|
94021
|
+
}
|
|
94022
|
+
return field;
|
|
94023
|
+
})
|
|
94024
|
+
}));
|
|
94025
|
+
}
|
|
94026
|
+
function buildDynamicFieldsCommand() {
|
|
94027
|
+
const cmd = new Command("dynamic-fields");
|
|
94028
|
+
cmd.description("Resolve an action parameter whose options or fields depend on other inputs.").argument("<packageId>", "Action package id, from `workflows actions list`").argument("<actionKey>", "Action key, from `workflows actions list`").argument("<parameterPath>", "Parameter name; dot-notation for grouped params (e.g. objectSchema.stage)").addOption(
|
|
94029
|
+
new Option(
|
|
94030
|
+
"--type <type>",
|
|
94031
|
+
"select = resolve a dependent dropdown\u2019s values; input = resolve a revealed field set."
|
|
94032
|
+
).choices(["select", "input"]).default("select")
|
|
94033
|
+
).option("--account <id>", "Connected account id (authAccountId) for actions that need auth.").option(
|
|
94034
|
+
"--inputs <json|file|->",
|
|
94035
|
+
"Already-chosen input values as a JSON object keyed by parameter name: inline JSON, a file path, or - for stdin."
|
|
94036
|
+
).addHelpText(
|
|
94037
|
+
"after",
|
|
94038
|
+
`
|
|
94039
|
+
Output (success, exit 0):
|
|
94040
|
+
[ { "parameterPath": <string>,
|
|
94041
|
+
"dynamicData": [ ... ], // shape depends on --type, see below
|
|
94042
|
+
"errors": [ { "errorMessage": <string>, "errorDetails": <string>?,
|
|
94043
|
+
"errorStatus": <string>, "isBlocking": <boolean> } ]?,
|
|
94044
|
+
"logUrl": <string>? } ]
|
|
94045
|
+
|
|
94046
|
+
--type select dynamicData: [ { "value": <string>, "displayName": <string> } ]
|
|
94047
|
+
\u2014 "value" is what you pass back in a later --inputs call.
|
|
94048
|
+
--type input dynamicData: revealed input-parameter schema objects forwarded from the
|
|
94049
|
+
server; each "name" is prefixed to pipe notation (<parameterPath>|<field>)
|
|
94050
|
+
so it can be bound directly \u2014 the bare name drops the value at run time.
|
|
94051
|
+
|
|
94052
|
+
"errors[].isBlocking" is load-bearing: when true, abort cascading input resolution.
|
|
94053
|
+
|
|
94054
|
+
Configuring cascading inputs is iterative: resolve and fill one input, then re-run
|
|
94055
|
+
with it in --inputs to resolve the next dependent parameter.
|
|
94056
|
+
|
|
94057
|
+
Common errors:
|
|
94058
|
+
validation_error (exit 2) Required arguments missing, or --inputs is unreadable, not valid JSON, or not a JSON object.
|
|
94059
|
+
auth_forbidden (exit 3) API key lacks permission for this command (insufficient scope).
|
|
94060
|
+
|
|
94061
|
+
Examples:
|
|
94062
|
+
$ clay workflows actions dynamic-fields <packageId> create-object objectType --account acc_123 | jq '.[0].dynamicData'
|
|
94063
|
+
$ clay workflows actions dynamic-fields <packageId> create-object property --account acc_123 --inputs '{"objectType":"companies"}' | jq -r '.[0].dynamicData[].value'
|
|
94064
|
+
`
|
|
94065
|
+
).action(
|
|
94066
|
+
async (packageId, actionKey, parameterPath, opts) => {
|
|
94067
|
+
const inputs = opts.inputs === void 0 ? {} : readJsonObjectFlag("--inputs", opts.inputs);
|
|
94068
|
+
const workspaceId = await currentWorkspaceId();
|
|
94069
|
+
const client = await v3Client(terracottaClayActionsContract);
|
|
94070
|
+
const result = await unwrap(
|
|
94071
|
+
client.getClayActionDynamicFields({
|
|
94072
|
+
params: { workspaceId },
|
|
94073
|
+
body: {
|
|
94074
|
+
dynamicRequests: [
|
|
94075
|
+
{
|
|
94076
|
+
actionPackageId: packageId,
|
|
94077
|
+
actionKey,
|
|
94078
|
+
parameterPath,
|
|
94079
|
+
type: opts.type,
|
|
94080
|
+
authAccountId: opts.account,
|
|
94081
|
+
inputs
|
|
94082
|
+
}
|
|
94083
|
+
]
|
|
94084
|
+
}
|
|
94085
|
+
})
|
|
94086
|
+
);
|
|
94087
|
+
writeJson(opts.type === "input" ? prefixRevealedFieldNames(result, parameterPath) : result);
|
|
94088
|
+
}
|
|
94089
|
+
);
|
|
94090
|
+
return cmd;
|
|
94091
|
+
}
|
|
94092
|
+
|
|
94001
94093
|
// src/commands/workflows/actions/projection.ts
|
|
94002
94094
|
var ACTION_FIELDS = [
|
|
94003
94095
|
"type",
|
|
@@ -94149,8 +94241,9 @@ function buildActionsCommand() {
|
|
|
94149
94241
|
"after",
|
|
94150
94242
|
`
|
|
94151
94243
|
Subcommands:
|
|
94152
|
-
list
|
|
94153
|
-
schema
|
|
94244
|
+
list Dump the full action catalog (greppable JSON).
|
|
94245
|
+
schema Fetch one action\u2019s input schema by packageId + actionKey.
|
|
94246
|
+
dynamic-fields Resolve a parameter whose options/fields depend on other inputs.
|
|
94154
94247
|
|
|
94155
94248
|
These are workflow building blocks (actions you add to a node\u2019s "tools"). For
|
|
94156
94249
|
workspace *function tools*, a different concept, see \`clay tools\`.
|
|
@@ -94158,10 +94251,12 @@ workspace *function tools*, a different concept, see \`clay tools\`.
|
|
|
94158
94251
|
Examples:
|
|
94159
94252
|
$ clay workflows actions list > catalog.json
|
|
94160
94253
|
$ clay workflows actions schema <packageId> <actionKey> | jq '.inputParameters'
|
|
94254
|
+
$ clay workflows actions dynamic-fields <packageId> <actionKey> <param> --inputs '{"objectType":"companies"}'
|
|
94161
94255
|
`
|
|
94162
94256
|
);
|
|
94163
94257
|
cmd.addCommand(applyClaySettings(buildListCommand5()));
|
|
94164
94258
|
cmd.addCommand(applyClaySettings(buildSchemaCommand()));
|
|
94259
|
+
cmd.addCommand(applyClaySettings(buildDynamicFieldsCommand()));
|
|
94165
94260
|
return cmd;
|
|
94166
94261
|
}
|
|
94167
94262
|
|
|
@@ -95014,7 +95109,10 @@ var ActionToolParameters = external_exports.record(
|
|
|
95014
95109
|
type: external_exports.string(),
|
|
95015
95110
|
description: external_exports.string(),
|
|
95016
95111
|
required: external_exports.boolean(),
|
|
95017
|
-
|
|
95112
|
+
// Optional: it's a human label that static action params carry, but fields resolved
|
|
95113
|
+
// dynamically and merged into the snapshot (parent|child) have none; consumers fall
|
|
95114
|
+
// back to the param name. Required here rejected those runs with contract_mismatch.
|
|
95115
|
+
displayName: external_exports.string().optional()
|
|
95018
95116
|
})
|
|
95019
95117
|
);
|
|
95020
95118
|
var ActionToolData = external_exports.object({
|
|
@@ -96682,11 +96780,7 @@ Examples:
|
|
|
96682
96780
|
|
|
96683
96781
|
// src/commands/workflows/runs/input.ts
|
|
96684
96782
|
function readRunInputs(source) {
|
|
96685
|
-
|
|
96686
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
96687
|
-
throw new InvalidArgumentError("--input: must be a JSON object of workflow inputs");
|
|
96688
|
-
}
|
|
96689
|
-
return parsed;
|
|
96783
|
+
return readJsonObjectFlag("--input", source);
|
|
96690
96784
|
}
|
|
96691
96785
|
|
|
96692
96786
|
// src/commands/workflows/runs/start.ts
|