@apilift/cli 1.5.7 → 1.5.8

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/apilift.js CHANGED
@@ -32585,6 +32585,7 @@ function scalar(value, schema, name) {
32585
32585
  const numeric = Number(value);
32586
32586
  if (value.trim() && Number.isFinite(numeric) && (!types.includes("integer") || Number.isInteger(numeric))) return numeric;
32587
32587
  }
32588
+ if (types.includes("array") || types.includes("object")) throw new Error(`${name} expects ${types.join(" or ")}; supply it using --input JSON`);
32588
32589
  throw new Error(`${name} expects ${types.join(" or ") || "a scalar"}; ${JSON.stringify(value)} is incompatible`);
32589
32590
  }
32590
32591
  function savedContextCompatible(value, schema) {
@@ -32980,7 +32981,7 @@ async function handleRun(invocation, api, state, session, fetcher, root, stdin =
32980
32981
  const sources = await sourceGuidance(api, appName, [documentation.inputs], saved, invocation.sessionLabel);
32981
32982
  return fail2(`invalid-input \u2014 ${error62 instanceof Error ? error62.message : "Inputs are invalid"}. No app request was sent.
32982
32983
  ${[...fields.required, ...fields.optional].join("\n")}
32983
- ${sources}Run: ${prefix(`run ${appName} ${actionName}${fields.requiredNames.map((name) => ` --${name.replaceAll("_", "-")} <chosen-value>`).join("")}`)}
32984
+ ${sources}Run: ${prefix(`run ${appName} ${actionName}${fields.runArgs}`)}
32984
32985
  `);
32985
32986
  }
32986
32987
  if (invocation.flags.includes("check")) {
@@ -33409,25 +33410,32 @@ Preview a specific action's resolved inputs without sending a request:
33409
33410
  `);
33410
33411
  }
33411
33412
  function propertyLines(schema, context, app2, sessionLabel) {
33412
- if (typeof schema !== "object" || !schema || typeof schema.properties !== "object" || !schema.properties) return { required: [], optional: [], requiredNames: [] };
33413
+ if (typeof schema !== "object" || !schema || typeof schema.properties !== "object" || !schema.properties) return { required: [], optional: [], runArgs: "" };
33413
33414
  const required2 = new Set(Array.isArray(schema.required) ? schema.required : []);
33414
- const sections = { required: [], optional: [], requiredNames: [] };
33415
+ const sections = { required: [], optional: [] }, requiredNames = [];
33416
+ let requiresJson = false;
33415
33417
  for (const [name, raw] of Object.entries(schema.properties)) {
33416
33418
  const property = typeof raw === "object" && raw !== null ? raw : {};
33419
+ const types = typeof property.type === "string" ? [property.type] : Array.isArray(property.type) ? property.type : [];
33420
+ const json3 = !types.length || types.includes("object") || types.includes("array");
33417
33421
  const type = Array.isArray(property.enum) ? property.enum.map((value) => String(value)).join("|") : typeof property.type === "string" ? property.type : Array.isArray(property.type) ? property.type.join("|") : "JSON";
33418
33422
  const description2 = typeof property.description === "string" ? property.description : "No description was published.";
33419
33423
  const source = typeof property["x-source"] === "object" && property["x-source"] ? property["x-source"] : null;
33420
33424
  const flag = `--${name.replaceAll("_", "-")}`;
33421
33425
  const constraints = [typeof property.minimum === "number" ? `Minimum: ${property.minimum}.` : "", typeof property.maximum === "number" ? `Maximum: ${property.maximum}.` : "", Object.hasOwn(property, "default") ? `Default: ${JSON.stringify(property.default)}.` : ""].filter(Boolean).join(" ");
33422
33426
  const compatible3 = Object.hasOwn(context, name) && savedContextCompatible(context[name], property);
33423
- const saved = !Object.hasOwn(context, name) ? "" : compatible3 ? ` Saved: ${quote(context[name])}; omit to reuse, pass ${flag} to override once.` : ` Saved ${quote(context[name])} is incompatible; pass ${flag} explicitly or ${command2(sessionLabel, `context set ${name} <compatible-value>`)}.`;
33427
+ const override = json3 ? `${name} in --input JSON` : flag;
33428
+ const saved = !Object.hasOwn(context, name) ? "" : compatible3 ? ` Saved: ${quote(context[name])}; omit to reuse, pass ${override} to override once.` : json3 ? ` Saved ${quote(context[name])} is incompatible; supply ${override}.` : ` Saved ${quote(context[name])} is incompatible; pass ${flag} explicitly or ${command2(sessionLabel, `context set ${name} <compatible-value>`)}.`;
33424
33429
  const obtain = source?.action ? ` Source: ${source.action}, result ${source.path ?? "<result-path>"}; choose the intended record.` : "";
33425
- const line = ` ${flag} <${type}>
33430
+ const line = ` ${json3 ? name : flag} <${type}>${json3 ? " (use --input JSON)" : ""}
33426
33431
  ${description2}${constraints ? ` ${constraints}` : ""}${saved}${obtain}`;
33427
33432
  sections[required2.has(name) ? "required" : "optional"].push(line);
33428
- if (required2.has(name) && !compatible3) sections.requiredNames.push(name);
33433
+ if (required2.has(name) && !compatible3) {
33434
+ requiredNames.push(name);
33435
+ requiresJson ||= json3;
33436
+ }
33429
33437
  }
33430
- return sections;
33438
+ return { ...sections, runArgs: requiresJson ? " --input @./input.json" : requiredNames.map((name) => ` --${name.replaceAll("_", "-")} <chosen-value>`).join("") };
33431
33439
  }
33432
33440
  function schemaProperties(schema) {
33433
33441
  return schema && typeof schema === "object" && schema.properties && typeof schema.properties === "object" ? schema.properties : {};
@@ -33478,7 +33486,7 @@ async function sourceGuidance(api, app2, schemas, context, label2, already = [])
33478
33486
  const inputs = propertyLines(doc.inputs, context, app2, label2);
33479
33487
  return `Source ${name} (${doc.effect}): ${doc.description}
33480
33488
  ${[...inputs.required, ...inputs.optional].join("\n")}
33481
- ${command2(label2, `run ${app2} ${name}${inputs.requiredNames.map((n) => ` --${n.replaceAll("_", "-")} <chosen-value>`).join("")}`)}
33489
+ ${command2(label2, `run ${app2} ${name}${inputs.runArgs}`)}
33482
33490
  Returns:
33483
33491
  ${outputLines(doc.output)}${Object.values(schemaProperties(doc.inputs)).some((field) => field && typeof field === "object" && field["x-source"]) ? `Further source inputs: ${command2(label2, `actions show ${app2} ${name}`)}
33484
33492
  ` : ""}`;
@@ -33737,7 +33745,7 @@ Unavailable: ${doc.unavailable?.reason ?? "No executable definition"}. ${doc.una
33737
33745
  Investigate: ${prefix(`apps update ${appName}`)}
33738
33746
  `;
33739
33747
  const inputs = propertyLines(doc.inputs, context, appName, invocation.sessionLabel);
33740
- const flags = inputs.requiredNames.map((name) => ` --${name.replaceAll("_", "-")} <chosen-value>`).join("");
33748
+ const flags = inputs.runArgs;
33741
33749
  return `${doc.name} \u2014 ${doc.title}
33742
33750
  ${doc.description}
33743
33751
  Effect: ${doc.effect ?? "unknown"}. ${doc.transport ? `Connection: ${doc.transport.mode}${doc.transport.credentials.length ? `; saved fields: ${doc.transport.credentials.map((f) => f.name).join(", ")}` : "; no saved credential required"}. ` : ""}${doc.proof ? `Discovery tested ${doc.proof}; this run checks the response without automatic readback. Use a published read when the task needs state confirmation.` : ""}
@@ -39194,6 +39202,7 @@ Use apilift help commands for syntax.
39194
39202
  const envelope = apiErrorEnvelopeSchema.safeParse(error62.response);
39195
39203
  if (envelope.success) {
39196
39204
  const apiError2 = envelope.data.error;
39205
+ if (apiError2.code === "action-not-found") apiError2.hint = apiError2.hint.replaceAll("apilift actions search ", `${commandPrefix(parsed.invocation?.sessionLabel)} actions search `);
39197
39206
  output2 = result2("", cliExitForError(apiError2), `${apiError2.code} \u2014 ${apiError2.message}
39198
39207
  ${apiError2.hint ? `${apiError2.hint}
39199
39208
  ` : ""}${apiError2.code === "session-limit" ? `${typeof apiError2.details.activeExpiresAt === "string" ? `Active session lease expires ${apiError2.details.activeExpiresAt}.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apilift",
3
- "version": "1.5.7",
3
+ "version": "1.5.8",
4
4
  "description": "Use logged-in apps and discover missing actions with Apilift.",
5
5
  "author": {
6
6
  "name": "Apilift"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apilift",
3
- "version": "1.5.7",
3
+ "version": "1.5.8",
4
4
  "description": "Use logged-in apps and discover missing actions with Apilift.",
5
5
  "author": {
6
6
  "name": "Apilift"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apilift/cli",
3
- "version": "1.5.7",
3
+ "version": "1.5.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -36,7 +36,7 @@
36
36
  "engines": {
37
37
  "node": ">=24.16.0 <27"
38
38
  },
39
- "gitHead": "ef64dc7015807fd042d91b7f6b0c9f880f05103f",
39
+ "gitHead": "371aa6fdc44dfb35b65960678ad8567917746591",
40
40
  "repository": {
41
41
  "type": "git",
42
42
  "url": "git+https://github.com/egor-sergeev/apilift.git",