zinkee 0.1.21 → 0.1.23
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/.claude/settings.local.json +3 -1
- package/dist/index.js +100 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/automations.test.ts +130 -0
- package/src/commands/automations.ts +50 -2
- package/src/commands/displays.ts +5 -2
- package/src/utils/examples.test.ts +46 -0
- package/src/utils/examples.ts +70 -3
|
@@ -41,7 +41,9 @@
|
|
|
41
41
|
"Bash(_ZINKEE_COMPLETE=zsh_complete COMP_WORDS=\"zinkee config show --foo --bar baz quux ?\" COMP_CWORD=10 node dist/index.js)",
|
|
42
42
|
"Bash(git -C /home/guillermo/dev/cli status)",
|
|
43
43
|
"Bash(git -C /home/guillermo/dev/cli branch --show-current)",
|
|
44
|
-
"Bash(git -C /home/guillermo/dev/cli diff --stat)"
|
|
44
|
+
"Bash(git -C /home/guillermo/dev/cli diff --stat)",
|
|
45
|
+
"Bash(git fetch *)",
|
|
46
|
+
"Bash(pnpm exec *)"
|
|
45
47
|
]
|
|
46
48
|
}
|
|
47
49
|
}
|
package/dist/index.js
CHANGED
|
@@ -3306,12 +3306,12 @@ var specificExamples = {
|
|
|
3306
3306
|
}`
|
|
3307
3307
|
},
|
|
3308
3308
|
{
|
|
3309
|
-
description: "Change a DATE variable to use
|
|
3310
|
-
command: "zinkee --json displays variables update 0f6f062f-1478-4df2-96a1-c495d037d260 bbbbbbbb-2222-4222-a222-222222222222 --date-mode dynamic --date-dynamic-option
|
|
3309
|
+
description: "Change a DATE variable to use last12Months.",
|
|
3310
|
+
command: "zinkee --json displays variables update 0f6f062f-1478-4df2-96a1-c495d037d260 bbbbbbbb-2222-4222-a222-222222222222 --date-mode dynamic --date-dynamic-option last12Months",
|
|
3311
3311
|
raw: `{
|
|
3312
3312
|
"date": {
|
|
3313
3313
|
"mode": "dynamic",
|
|
3314
|
-
"dynamicOption": "
|
|
3314
|
+
"dynamicOption": "last12Months"
|
|
3315
3315
|
}
|
|
3316
3316
|
}`
|
|
3317
3317
|
}
|
|
@@ -5450,6 +5450,43 @@ var specificExamples = {
|
|
|
5450
5450
|
"steps": ["one", "two"]
|
|
5451
5451
|
}
|
|
5452
5452
|
}
|
|
5453
|
+
}`
|
|
5454
|
+
},
|
|
5455
|
+
{
|
|
5456
|
+
description: "Add a send-message action. --to maps to fieldMapping.recipients and --message maps to fieldMapping.body. Values are wrapped in {rawValue, source} like every other automation field mapping; use --map / --map-json for extra keys.",
|
|
5457
|
+
command: `zinkee --json automations actions add automation-1 --type send_message --name "Notify customer" --to customer@example.com --subject "Your order status has changed" --message "Hello, your order is now processed."`,
|
|
5458
|
+
raw: `{
|
|
5459
|
+
"type": "send_message",
|
|
5460
|
+
"name": "Notify customer",
|
|
5461
|
+
"config": {
|
|
5462
|
+
"fieldMapping": {
|
|
5463
|
+
"recipients": {
|
|
5464
|
+
"rawValue": "customer@example.com",
|
|
5465
|
+
"source": null
|
|
5466
|
+
},
|
|
5467
|
+
"subject": {
|
|
5468
|
+
"rawValue": "Your order status has changed",
|
|
5469
|
+
"source": null
|
|
5470
|
+
},
|
|
5471
|
+
"body": {
|
|
5472
|
+
"rawValue": "Hello, your order is now processed.",
|
|
5473
|
+
"source": null
|
|
5474
|
+
}
|
|
5475
|
+
}
|
|
5476
|
+
}
|
|
5477
|
+
}`
|
|
5478
|
+
},
|
|
5479
|
+
{
|
|
5480
|
+
description: "Add a generate-document action. The renderer reads the template, writes the file, and stores its id in the target FileField of the target schema.",
|
|
5481
|
+
command: 'zinkee --json automations actions add automation-1 --type generate_document --name "Generate invoice PDF" --document-template 6c08673e-f8a6-44d2-8c91-d09eca911f8f --target-schema 68d2c7be-4392-42de-b5ae-625ad79cfc3c --target-file-field c8edbde8-a361-4e9f-a39a-2e88971f21a7',
|
|
5482
|
+
raw: `{
|
|
5483
|
+
"type": "generate_document",
|
|
5484
|
+
"name": "Generate invoice PDF",
|
|
5485
|
+
"config": {
|
|
5486
|
+
"documentTemplateId": "6c08673e-f8a6-44d2-8c91-d09eca911f8f",
|
|
5487
|
+
"targetSchemaId": "68d2c7be-4392-42de-b5ae-625ad79cfc3c",
|
|
5488
|
+
"targetFileFieldId": "c8edbde8-a361-4e9f-a39a-2e88971f21a7"
|
|
5489
|
+
}
|
|
5453
5490
|
}`
|
|
5454
5491
|
}
|
|
5455
5492
|
]),
|
|
@@ -5500,6 +5537,30 @@ var specificExamples = {
|
|
|
5500
5537
|
"authMode": "STORED",
|
|
5501
5538
|
"connectionId": "connection-1"
|
|
5502
5539
|
}
|
|
5540
|
+
}`
|
|
5541
|
+
},
|
|
5542
|
+
{
|
|
5543
|
+
description: "Replace a send-message action. --to maps to fieldMapping.recipients and --message maps to fieldMapping.body; values are wrapped in {rawValue, source}.",
|
|
5544
|
+
command: `zinkee --json automations actions update automation-1 action-1 --type send_message --name "Notify customer" --to customer@example.com --subject "Your order status has changed" --message "Hello, your order is now processed."`,
|
|
5545
|
+
raw: `{
|
|
5546
|
+
"type": "send_message",
|
|
5547
|
+
"name": "Notify customer",
|
|
5548
|
+
"config": {
|
|
5549
|
+
"fieldMapping": {
|
|
5550
|
+
"recipients": {
|
|
5551
|
+
"rawValue": "customer@example.com",
|
|
5552
|
+
"source": null
|
|
5553
|
+
},
|
|
5554
|
+
"subject": {
|
|
5555
|
+
"rawValue": "Your order status has changed",
|
|
5556
|
+
"source": null
|
|
5557
|
+
},
|
|
5558
|
+
"body": {
|
|
5559
|
+
"rawValue": "Hello, your order is now processed.",
|
|
5560
|
+
"source": null
|
|
5561
|
+
}
|
|
5562
|
+
}
|
|
5563
|
+
}
|
|
5503
5564
|
}`
|
|
5504
5565
|
}
|
|
5505
5566
|
]),
|
|
@@ -7007,6 +7068,15 @@ function buildActionInput(options, mode) {
|
|
|
7007
7068
|
if (options.targetSchema !== void 0) {
|
|
7008
7069
|
config.targetSchemaId = options.targetSchema;
|
|
7009
7070
|
}
|
|
7071
|
+
if (options.to !== void 0) {
|
|
7072
|
+
mappings.recipients = options.to;
|
|
7073
|
+
}
|
|
7074
|
+
if (options.subject !== void 0) {
|
|
7075
|
+
mappings.subject = options.subject;
|
|
7076
|
+
}
|
|
7077
|
+
if (options.message !== void 0) {
|
|
7078
|
+
mappings.body = options.message;
|
|
7079
|
+
}
|
|
7010
7080
|
if (!isEmptyObject(mappings)) {
|
|
7011
7081
|
config.fieldMapping = mappings;
|
|
7012
7082
|
}
|
|
@@ -7050,6 +7120,12 @@ function buildActionInput(options, mode) {
|
|
|
7050
7120
|
if (!isEmptyObject(args)) {
|
|
7051
7121
|
config.pluginArgs = args;
|
|
7052
7122
|
}
|
|
7123
|
+
if (options.documentTemplate !== void 0) {
|
|
7124
|
+
config.documentTemplateId = options.documentTemplate;
|
|
7125
|
+
}
|
|
7126
|
+
if (options.targetFileField !== void 0) {
|
|
7127
|
+
config.targetFileFieldId = options.targetFileField;
|
|
7128
|
+
}
|
|
7053
7129
|
if (!isEmptyObject(config)) {
|
|
7054
7130
|
if (isJsonObject2(config.fieldMapping)) {
|
|
7055
7131
|
config.fieldMapping = normalizeAutomationFieldMapping(
|
|
@@ -7236,12 +7312,28 @@ function addTriggerPayloadOptions(command) {
|
|
|
7236
7312
|
[]
|
|
7237
7313
|
).option("--webhook-endpoint-id <uuid>", "webhook endpoint id").option("--raw <json>", "raw trigger JSON payload").option("--raw-file <path>", "path to raw trigger JSON payload");
|
|
7238
7314
|
}
|
|
7315
|
+
var ACTION_TYPES_HELP = `
|
|
7316
|
+
Action types and their flags:
|
|
7317
|
+
create_record --target-schema, --map, --map-json
|
|
7318
|
+
update_record --target-schema, --use-trigger-record, --map,
|
|
7319
|
+
--condition, --condition-json
|
|
7320
|
+
search_records --target-schema, --condition, --condition-json
|
|
7321
|
+
send_message --to, --subject, --message
|
|
7322
|
+
(--map / --map-json also accepted for extra keys)
|
|
7323
|
+
http_request --method, --url, --header, --body, --content-type,
|
|
7324
|
+
--timeout-ms, --var, --auth-mode, --connection
|
|
7325
|
+
execute_plugin --plugin, --arg, --arg-json
|
|
7326
|
+
generate_document --document-template, --target-schema, --target-file-field
|
|
7327
|
+
`;
|
|
7239
7328
|
function addActionPayloadOptions(command) {
|
|
7240
|
-
return command.option(
|
|
7329
|
+
return command.option(
|
|
7330
|
+
"--type <type>",
|
|
7331
|
+
"action type (create_record|update_record|search_records|send_message|http_request|execute_plugin|generate_document)"
|
|
7332
|
+
).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("--condition <field:comparator:value>", "action condition", collectValues, []).option("--condition-json <json>", "action condition as JSON", collectValues, []).option("--use-trigger-record", "use the triggering record").option("--method <method>", "HTTP method").option("--url <url>", "HTTP target URL").option("--header <key=value>", "HTTP header", collectValues, []).option("--body <json>", "HTTP request body as JSON").option("--body-file <path>", "path to HTTP request body JSON").option("--content-type <type>", "HTTP content type").option(
|
|
7241
7333
|
"--timeout-ms <n>",
|
|
7242
7334
|
"HTTP timeout in milliseconds",
|
|
7243
7335
|
parseNonNegativeInteger
|
|
7244
|
-
).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("--raw <json>", "raw action JSON payload").option("--raw-file <path>", "path to raw action JSON payload");
|
|
7336
|
+
).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);
|
|
7245
7337
|
}
|
|
7246
7338
|
function registerAutomationsCommands(program, options = {}) {
|
|
7247
7339
|
const filePath = options.configPath ?? defaultConfigPath;
|
|
@@ -8066,6 +8158,7 @@ function parseExpression(input) {
|
|
|
8066
8158
|
}
|
|
8067
8159
|
|
|
8068
8160
|
// src/commands/displays.ts
|
|
8161
|
+
var DATE_DYNAMIC_OPTIONS = "today, thisWeek, thisMonth, thisQuarter, thisSemester, thisYear, next7Days, next30Days, next6Months, next12Months, last12Months";
|
|
8069
8162
|
function getCommandIo4(stdout) {
|
|
8070
8163
|
return stdout ?? process.stdout;
|
|
8071
8164
|
}
|
|
@@ -8502,7 +8595,7 @@ function registerDisplaysCommands(program, options = {}) {
|
|
|
8502
8595
|
}
|
|
8503
8596
|
printTable([match], void 0, stdout);
|
|
8504
8597
|
});
|
|
8505
|
-
variables.command("create").description("Create variable").argument("<display>", "display uuid or slug", parseUuidOrSlugSelector3).option("--type <type>").option("--name <name>").option("--allow-multiple").option("--static").option("--default <value>").option("--default-value <value>", "repeatable default value", (v, p = []) => [...p, v], []).option("--source-schema <id>").option("--source-field <id>").option("--filter <expr>", "repeatable filter", collectFilters, []).option("--date-mode <mode>").option("--date-dynamic-option <option>").option("--date-specific <iso>").option("--date-range-start <iso>").option("--date-range-end <iso>").option("--raw <json>").option("--raw-file <path>").action(async function action(display, commandOptions) {
|
|
8598
|
+
variables.command("create").description("Create variable").argument("<display>", "display uuid or slug", parseUuidOrSlugSelector3).option("--type <type>").option("--name <name>").option("--allow-multiple").option("--static").option("--default <value>").option("--default-value <value>", "repeatable default value", (v, p = []) => [...p, v], []).option("--source-schema <id>").option("--source-field <id>").option("--filter <expr>", "repeatable filter", collectFilters, []).option("--date-mode <mode>").option("--date-dynamic-option <option>", `dynamic date period (${DATE_DYNAMIC_OPTIONS})`).option("--date-specific <iso>").option("--date-range-start <iso>").option("--date-range-end <iso>").option("--raw <json>").option("--raw-file <path>").action(async function action(display, commandOptions) {
|
|
8506
8599
|
const { api, json, readOnly } = createDisplaysApi(this, filePath);
|
|
8507
8600
|
ensureWritable3("displays variables create", readOnly, "write");
|
|
8508
8601
|
const data = await api.createVariable(display, buildVariableBody(commandOptions));
|
|
@@ -8512,7 +8605,7 @@ function registerDisplaysCommands(program, options = {}) {
|
|
|
8512
8605
|
}
|
|
8513
8606
|
writeLine4(stdout, `Created variable on display "${display.value}".`);
|
|
8514
8607
|
});
|
|
8515
|
-
variables.command("update").description("Update variable").argument("<display>", "display uuid or slug", parseUuidOrSlugSelector3).argument("<variable>", "variable id").option("--type <type>").option("--name <name>").option("--allow-multiple").option("--static").option("--default <value>").option("--default-value <value>", "repeatable default value", (v, p = []) => [...p, v], []).option("--source-schema <id>").option("--source-field <id>").option("--filter <expr>", "repeatable filter", collectFilters, []).option("--date-mode <mode>").option("--date-dynamic-option <option>").option("--date-specific <iso>").option("--date-range-start <iso>").option("--date-range-end <iso>").option("--raw <json>").option("--raw-file <path>").action(async function action(display, variableId, commandOptions) {
|
|
8608
|
+
variables.command("update").description("Update variable").argument("<display>", "display uuid or slug", parseUuidOrSlugSelector3).argument("<variable>", "variable id").option("--type <type>").option("--name <name>").option("--allow-multiple").option("--static").option("--default <value>").option("--default-value <value>", "repeatable default value", (v, p = []) => [...p, v], []).option("--source-schema <id>").option("--source-field <id>").option("--filter <expr>", "repeatable filter", collectFilters, []).option("--date-mode <mode>").option("--date-dynamic-option <option>", `dynamic date period (${DATE_DYNAMIC_OPTIONS})`).option("--date-specific <iso>").option("--date-range-start <iso>").option("--date-range-end <iso>").option("--raw <json>").option("--raw-file <path>").action(async function action(display, variableId, commandOptions) {
|
|
8516
8609
|
const { api, json, readOnly } = createDisplaysApi(this, filePath);
|
|
8517
8610
|
ensureWritable3("displays variables update", readOnly, "write");
|
|
8518
8611
|
const data = await api.updateVariable(display, variableId, buildVariableBody(commandOptions));
|