zinkee 0.1.48 → 0.1.50
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/README.md +41 -2
- package/dist/{chunk-Z7L7HPYZ.js → chunk-IEW5RTJV.js} +5 -1
- package/dist/chunk-IEW5RTJV.js.map +1 -0
- package/dist/{examples-6KL2QXFC.js → examples-CFZMP2GJ.js} +15 -2
- package/dist/{examples-6KL2QXFC.js.map → examples-CFZMP2GJ.js.map} +1 -1
- package/dist/index.js +25 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-Z7L7HPYZ.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
normalizeSchemaFieldType,
|
|
18
18
|
normalizeSchemaFieldUpdatePayload,
|
|
19
19
|
printTable
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-IEW5RTJV.js";
|
|
21
21
|
|
|
22
22
|
// src/cli-runner.ts
|
|
23
23
|
import { realpathSync } from "fs";
|
|
@@ -250,7 +250,7 @@ ${list}`
|
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
252
|
async function showExamples(commandName, json, stdout, filters = {}) {
|
|
253
|
-
const { getCommandExamples } = await import("./examples-
|
|
253
|
+
const { getCommandExamples } = await import("./examples-CFZMP2GJ.js");
|
|
254
254
|
const examples = getCommandExamples(commandName, filters);
|
|
255
255
|
if (examples.length === 0) {
|
|
256
256
|
throw new CliError("invalid_cli_usage", `No examples registered for "${commandName}".`);
|
|
@@ -1234,7 +1234,7 @@ function mergeMappings(stringAssignments, jsonAssignments) {
|
|
|
1234
1234
|
}
|
|
1235
1235
|
var AUTOMATION_SOURCE_TYPES = /* @__PURE__ */ new Set(["TRIGGER", "PREVIOUS_ACTION"]);
|
|
1236
1236
|
function isAutomationValueSource(value) {
|
|
1237
|
-
return isJsonObject(value) && typeof value.type === "string" && AUTOMATION_SOURCE_TYPES.has(value.type) && typeof value.id === "string" && value.id.trim().length > 0;
|
|
1237
|
+
return isJsonObject(value) && typeof value.type === "string" && AUTOMATION_SOURCE_TYPES.has(value.type) && typeof value.id === "string" && value.id.trim().length > 0 && (value.actionId === void 0 || value.type === "PREVIOUS_ACTION" && typeof value.actionId === "string" && value.actionId.trim().length > 0);
|
|
1238
1238
|
}
|
|
1239
1239
|
function looksLikeAutomationResolvedValue(value) {
|
|
1240
1240
|
if (!isJsonObject(value)) {
|
|
@@ -1246,7 +1246,7 @@ function looksLikeAutomationResolvedValue(value) {
|
|
|
1246
1246
|
if (!Object.hasOwn(value, "source")) {
|
|
1247
1247
|
return false;
|
|
1248
1248
|
}
|
|
1249
|
-
return value.source === null ||
|
|
1249
|
+
return value.source === null || isJsonObject(value.source) && ("type" in value.source || "id" in value.source || "actionId" in value.source);
|
|
1250
1250
|
}
|
|
1251
1251
|
function normalizeAutomationResolvedValue(value, label, options) {
|
|
1252
1252
|
if (!looksLikeAutomationResolvedValue(value)) {
|
|
@@ -1282,7 +1282,8 @@ function normalizeAutomationResolvedValue(value, label, options) {
|
|
|
1282
1282
|
rawValue: null,
|
|
1283
1283
|
source: {
|
|
1284
1284
|
type: sourceValue.type,
|
|
1285
|
-
id: sourceValue.id
|
|
1285
|
+
id: sourceValue.id,
|
|
1286
|
+
...sourceValue.actionId === void 0 ? {} : { actionId: sourceValue.actionId }
|
|
1286
1287
|
}
|
|
1287
1288
|
};
|
|
1288
1289
|
}
|
|
@@ -1606,7 +1607,23 @@ function buildActionInput(options, mode) {
|
|
|
1606
1607
|
if (options.targetFileField !== void 0) {
|
|
1607
1608
|
config.targetFileFieldId = options.targetFileField;
|
|
1608
1609
|
}
|
|
1610
|
+
if (options.operation !== void 0) {
|
|
1611
|
+
config.operation = options.operation;
|
|
1612
|
+
}
|
|
1613
|
+
if (options.schema !== void 0) {
|
|
1614
|
+
config.schemaId = options.schema;
|
|
1615
|
+
}
|
|
1616
|
+
const invoicingInputs = mergeMappings(options.input, options.inputJson);
|
|
1617
|
+
if (!isEmptyObject(invoicingInputs)) {
|
|
1618
|
+
config.inputs = { ...isJsonObject(config.inputs) ? config.inputs : {}, ...invoicingInputs };
|
|
1619
|
+
}
|
|
1620
|
+
if (input.type === "invoicing" && config.inputs === void 0) {
|
|
1621
|
+
config.inputs = {};
|
|
1622
|
+
}
|
|
1609
1623
|
if (!isEmptyObject(config)) {
|
|
1624
|
+
if (isJsonObject(config.inputs)) {
|
|
1625
|
+
config.inputs = normalizeAutomationFieldMapping(config.inputs, "invoicing input");
|
|
1626
|
+
}
|
|
1610
1627
|
if (isJsonObject(config.fieldMapping)) {
|
|
1611
1628
|
config.fieldMapping = normalizeAutomationFieldMapping(
|
|
1612
1629
|
config.fieldMapping,
|
|
@@ -1804,11 +1821,12 @@ Action types and their flags:
|
|
|
1804
1821
|
--timeout-ms, --var, --auth-mode, --connection
|
|
1805
1822
|
execute_plugin --plugin, --arg, --arg-json
|
|
1806
1823
|
generate_document --document-template, --target-schema, --target-file-field
|
|
1824
|
+
invoicing --operation, --schema, --input, --input-json
|
|
1807
1825
|
`;
|
|
1808
1826
|
function addActionPayloadOptions(command) {
|
|
1809
1827
|
return command.option(
|
|
1810
1828
|
"--type <type>",
|
|
1811
|
-
"action type (create_record|update_record|search_records|send_message|http_request|execute_plugin|generate_document)"
|
|
1829
|
+
"action type (create_record|update_record|search_records|send_message|http_request|execute_plugin|generate_document|invoicing)"
|
|
1812
1830
|
).option("--name <name>", "action name").option("--target-schema <uuid>", "target schema id").option("--map <field=value>", "field mapping", collectValues, []).option("--map-json <field=json>", "JSON field mapping", collectValues, []).option(
|
|
1813
1831
|
"--condition <field:comparator:value>",
|
|
1814
1832
|
"action condition (use field:comparator for comparators without value: ie, ine)",
|
|
@@ -1818,7 +1836,7 @@ function addActionPayloadOptions(command) {
|
|
|
1818
1836
|
"--timeout-ms <n>",
|
|
1819
1837
|
"HTTP timeout in milliseconds",
|
|
1820
1838
|
parseNonNegativeInteger
|
|
1821
|
-
).option("--var <key=value>", "HTTP variable", collectValues, []).option("--auth-mode <mode>", "HTTP auth mode").option("--connection <uuid>", "connection id for HTTP auth").option("--plugin <id>", "plugin id for execute_plugin").option("--arg <key=value>", "plugin argument", collectValues, []).option("--arg-json <key=json>", "plugin argument as JSON", collectValues, []).option("--to <recipient>", "send_message recipient (maps to fieldMapping.recipients)").option("--subject <text>", "send_message subject").option("--message <text>", "send_message body text (maps to fieldMapping.body)").option("--document-template <uuid>", "generate_document template id").option("--target-file-field <uuid>", "generate_document target FileField id").option("--raw <json>", "raw action JSON payload").option("--raw-file <path>", "path to raw action JSON payload").addHelpText("after", ACTION_TYPES_HELP);
|
|
1839
|
+
).option("--var <key=value>", "HTTP variable", collectValues, []).option("--auth-mode <mode>", "HTTP auth mode").option("--connection <uuid>", "connection id for HTTP auth").option("--plugin <id>", "plugin id for execute_plugin").option("--arg <key=value>", "plugin argument", collectValues, []).option("--arg-json <key=json>", "plugin argument as JSON", collectValues, []).option("--to <recipient>", "send_message recipient (maps to fieldMapping.recipients)").option("--subject <text>", "send_message subject").option("--message <text>", "send_message body text (maps to fieldMapping.body)").option("--document-template <uuid>", "generate_document template id").option("--target-file-field <uuid>", "generate_document target FileField id").option("--operation <operation>", "invoicing operation (prepare|issue|refund|cancel|create_correction)").option("--schema <uuid>", "invoicing source draft or invoice schema id").option("--input <key=value>", "invoicing literal input (repeatable)", collectValues, []).option("--input-json <key=json>", "invoicing literal or source input (repeatable)", collectValues, []).option("--raw <json>", "raw action JSON payload").option("--raw-file <path>", "path to raw action JSON payload").addHelpText("after", ACTION_TYPES_HELP);
|
|
1822
1840
|
}
|
|
1823
1841
|
function registerAutomationsCommands(program, options = {}) {
|
|
1824
1842
|
const filePath = options.configPath ?? defaultConfigPath;
|