zinkee 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +395 -215
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -8,9 +8,9 @@ Implemented command groups:
8
8
 
9
9
  - `profiles`
10
10
  - `config`
11
- - `files`
12
11
  - `schemas`
13
12
  - `records`
13
+ - `files`
14
14
  - `comments`
15
15
  - `navigation`
16
16
  - `teamspace`
@@ -37,7 +37,7 @@ npm test
37
37
 
38
38
  ## Configuration
39
39
 
40
- The CLI is compatible with the existing config file:
40
+ The CLI uses a TOML config file:
41
41
 
42
42
  ```text
43
43
  ~/.config/zinkee/config.toml
@@ -55,303 +55,488 @@ base_url = "https://api.zinkee.com"
55
55
 
56
56
  ## Global Options
57
57
 
58
- - `--profile <name>`
59
- - `--base-url <url>`
60
- - `--api-key <token>`
61
- - `--read-only`
62
- - `--example <command path>`
63
- - `--json`
58
+ | Option | Description |
59
+ |---|---|
60
+ | `--profile <name>` | Select a profile from config |
61
+ | `--base-url <url>` | Override the configured base URL |
62
+ | `--api-key <token>` | Override the configured API key |
63
+ | `--read-only` | Run in read-only mode |
64
+ | `--example` | Show examples for a command |
65
+ | `--json` | Emit JSON output |
64
66
 
65
67
  ## JSON Contract
66
68
 
67
69
  Successful commands emit:
68
70
 
69
71
  ```json
70
- {
71
- "data": {},
72
- "meta": {}
73
- }
72
+ { "data": {}, "meta": {} }
74
73
  ```
75
74
 
76
75
  Failing commands emit:
77
76
 
78
77
  ```json
79
- {
80
- "error": {},
81
- "meta": {}
82
- }
78
+ { "error": {}, "meta": {} }
83
79
  ```
84
80
 
85
- ## Quick Examples
81
+ ---
82
+
83
+ ## Schemas
84
+
85
+ ### Create a schema
86
+
87
+ ```bash
88
+ zinkee schemas create --name "Projects" --slug projects --auditable --commentable
89
+ ```
90
+
91
+ ### List and get schemas
86
92
 
87
93
  ```bash
88
- zinkee profiles list
89
- zinkee --json config validate
90
94
  zinkee --json schemas list
91
- zinkee --json schemas get tareas
92
- zinkee --json records list contacts --limit 50 --offset 0
93
- zinkee --json records query contacts --where "status eq active"
94
- zinkee --json files storage
95
- zinkee --json automations list
96
- zinkee --example records query
97
- zinkee --json --example automations create
98
- zinkee --json --example automations trigger set
99
- zinkee --json --example automations actions add
100
- zinkee --json --example automations webhook set
101
- zinkee --json --example automations connections create
95
+ zinkee --json schemas get projects
102
96
  ```
103
97
 
104
- ## Automations
98
+ ### Create fields
105
99
 
106
- The `automations` group manages the full public automation surface:
100
+ Simple field types use `--type`, `--slug`, `--label`:
101
+
102
+ ```bash
103
+ zinkee schemas fields create projects --type text --slug name --label "Name"
104
+ zinkee schemas fields create projects --type number --slug budget --label "Budget"
105
+ zinkee schemas fields create projects --type date --slug start-date --label "Start Date"
106
+ zinkee schemas fields create projects --type file --slug attachment --label "Attachment"
107
+ zinkee schemas fields create projects --type autoincremental --slug code --label "Code"
108
+ zinkee schemas fields create projects --type member --slug owner --label "Owner"
109
+ ```
107
110
 
108
- - automation folders
109
- - automation metadata
110
- - triggers
111
- - actions
112
- - flow wiring
113
- - webhook endpoint configuration
114
- - plugins
115
- - stored connections for HTTP actions
111
+ Valid types: `text`, `number`, `date`, `file`, `autoincremental`, `member`, `option`, `reference`, `formula`.
116
112
 
117
- If you are scripting, prefer `--json`. If you are discovering the CLI, prefer `--example <command path>`.
113
+ Complex types require `--raw`:
118
114
 
119
- ### Before You Start
115
+ ```bash
116
+ # Option field
117
+ zinkee schemas fields create projects --raw '{
118
+ "type":"option","slug":"status","label":"Status",
119
+ "options":[
120
+ {"id":1,"name":"Open","color":"default"},
121
+ {"id":2,"name":"In Progress","color":"primary"},
122
+ {"id":3,"name":"Done","color":"success"}
123
+ ]
124
+ }'
125
+
126
+ # Reference field (targetSchema and targetDisplayField must be UUIDs)
127
+ zinkee schemas fields create tasks --raw '{
128
+ "type":"reference","slug":"project","label":"Project",
129
+ "targetSchema":"<schema-uuid>",
130
+ "targetDisplayField":"<field-uuid>",
131
+ "deleteBehavior":"SET_NULL"
132
+ }'
133
+
134
+ # Formula field (use formulaText, not expression)
135
+ zinkee schemas fields create projects --raw '{
136
+ "type":"formula","slug":"code","label":"Code",
137
+ "formulaText":"concat(\"PRJ-\", <_id-field-uuid>)"
138
+ }'
139
+ ```
120
140
 
121
- - `automations create` requires `--name` and a valid trigger.
122
- - For `record_created` and `record_changed`, `--trigger-schema` accepts a real schema UUID or schema slug from your workspace.
123
- - For `record_changed`, every `--trigger-field` must be a real field UUID or field slug from that schema.
124
- - `--condition` uses the format `<field:comparator:value>`.
125
- - `--condition-json` accepts a full JSON condition object when you need structured `rawValue/source` entries.
126
- - For record-based automation values, the CLI sends `{ rawValue, source }` objects to the API v2 contract.
127
- - The `scheduled` trigger uses a six-field cron expression, for example `0 15 10 * * 1`.
141
+ ### Update field config
128
142
 
129
- Useful discovery commands:
143
+ Config properties must be wrapped inside a `config` key:
130
144
 
131
145
  ```bash
132
- zinkee --json schemas list
133
- zinkee --json schemas get <schema-uuid-or-slug>
134
- zinkee --json schemas fields list <schema-uuid-or-slug>
135
- zinkee --json automations plugins list
136
- zinkee --json automations connections list
146
+ # Number formatting
147
+ zinkee schemas fields update projects budget --raw '{
148
+ "config":{
149
+ "defaultValue":"0",
150
+ "formatOptions":{
151
+ "format":"number","decimals":2,"thousandsSeparator":true,
152
+ "symbolEnabled":true,"symbolValue":" €","symbolPosition":"right"
153
+ }
154
+ }
155
+ }'
156
+
157
+ # Date formatting
158
+ zinkee schemas fields update projects start-date --raw '{
159
+ "config":{"formatOptions":{"format":"date","dateFormat":"L","showTime":false}}
160
+ }'
161
+
162
+ # Text type (valid values: NORMAL, LONG)
163
+ zinkee schemas fields update projects description --raw '{"config":{"textType":"LONG"}}'
137
164
  ```
138
165
 
139
- ### Trigger Types
166
+ ### Formula syntax
167
+
168
+ Formulas reference fields by UUID **without brackets**:
140
169
 
141
- Valid trigger types are:
170
+ ```
171
+ concat("PRJ-", f1e1d000-0000-0000-0000-000000000005)
172
+ if(8e73e31d-c47d-4123-a14c-331991c39c0e > 10, "High", "Low")
173
+ date_format(44b72f55-3fc3-40f4-88bb-343bb4a6270c, "AAAA-MM")
174
+ ```
142
175
 
143
- - `scheduled`
144
- - `record_created`
145
- - `record_changed`
146
- - `webhook`
176
+ - Field references: UUID without brackets (no `[uuid]`)
177
+ - Date masks are in Spanish: `AAAA`, `MM`, `DD`, `MMMM`, `DDDD`, etc.
178
+ - Date masks must be quoted: `"AAAA-MM"`
179
+ - Functions: `concat`, `if`, `date_format`, `datetime_diff`, arithmetic (`+`,`-`,`*`,`/`)
180
+ - Invalid formulas are created with status `DRAFT` and evaluate to `null`
147
181
 
148
- Minimal scheduled automation:
182
+ ---
183
+
184
+ ## Records
185
+
186
+ ### CRUD operations
149
187
 
150
188
  ```bash
151
- zinkee --json automations create \
152
- --name "Nightly invoice sync" \
153
- --trigger-type scheduled \
154
- --cron "0 15 10 * * 1"
189
+ # Create
190
+ zinkee records create projects \
191
+ --set name="Website Redesign" \
192
+ --set budget=25000 \
193
+ --set start-date="2026-01-15T00:00:00.000Z" \
194
+ --set status=1
195
+
196
+ # List and query
197
+ zinkee --json records list projects --limit 50
198
+ zinkee --json records query projects --limit 10 --sort "_id:desc"
199
+
200
+ # Get
201
+ zinkee --json records get projects <record-uuid>
202
+
203
+ # Update
204
+ zinkee records update projects <record-uuid> --set status=2
205
+
206
+ # Delete
207
+ zinkee records delete projects <record-uuid>
155
208
  ```
156
209
 
157
- Record-created automation using a schema slug:
210
+ Option values are written as numbers (`--set status=1`) but returned as strings (`"1"`). Number values are stored and returned as strings.
211
+
212
+ ---
213
+
214
+ ## Files
158
215
 
159
216
  ```bash
160
- zinkee --json automations create \
161
- --name "Lead welcome" \
162
- --trigger-type record_created \
163
- --trigger-schema leads
217
+ # Upload
218
+ zinkee --json files upload /path/to/document.pdf
219
+
220
+ # Download
221
+ zinkee files download <file-uuid> --output /path/to/download.pdf
222
+
223
+ # Attach to a record's FileField
224
+ zinkee records update projects <record-uuid> \
225
+ --set-json 'attachment=[{"id":"<file-uuid>","name":"doc.pdf","contentType":"application/pdf"}]'
226
+
227
+ # Detach
228
+ zinkee records update projects <record-uuid> --set-json 'attachment=[]'
229
+
230
+ # Delete (storage only — does NOT clean record references)
231
+ zinkee files delete <file-uuid>
232
+
233
+ # Storage info
234
+ zinkee --json files storage
164
235
  ```
165
236
 
166
- Record-changed automation using schema and field slugs:
237
+ > **Important**: deleting a file does not remove references from records. Manually clear the FileField before or after deleting.
238
+
239
+ ---
240
+
241
+ ## Comments
242
+
243
+ Requires schemas with `commentable: true`.
167
244
 
168
245
  ```bash
169
- zinkee --json automations create \
170
- --name "Order status sync" \
171
- --trigger-type record_changed \
172
- --trigger-schema orders \
173
- --trigger-field status
246
+ zinkee comments create <schema-slug> <record-uuid> --text "This is a comment"
247
+ zinkee comments list <schema-slug> <record-uuid>
174
248
  ```
175
249
 
176
- Replace the trigger on an existing automation:
250
+ ---
251
+
252
+ ## Navigation
253
+
254
+ Organize schemas into database folders.
177
255
 
178
256
  ```bash
179
- zinkee --json automations trigger set automation-1 \
180
- --trigger-type record_changed \
181
- --trigger-schema orders \
182
- --trigger-field status
257
+ # List folders with contents
258
+ zinkee --json navigation folders list
259
+
260
+ # Create folder
261
+ zinkee navigation folders create --name "CRM" --order 1
262
+
263
+ # Move a schema into a folder
264
+ zinkee navigation resources move <schema-uuid> --type SCHEMA --to "CRM"
265
+
266
+ # Delete folder (resources move back to root silently)
267
+ zinkee navigation folders delete "CRM"
183
268
  ```
184
269
 
185
- Add trigger conditions:
270
+ Root folder cannot be deleted.
271
+
272
+ ---
273
+
274
+ ## Teamspace
275
+
276
+ Publish resources (schemas, displays) to the teamspace visible to non-admin users.
186
277
 
187
278
  ```bash
188
- zinkee --json automations trigger set automation-1 \
189
- --trigger-type record_changed \
190
- --trigger-schema orders \
191
- --trigger-field status \
192
- --condition status:eq:approved
279
+ # Create teamspace folder
280
+ zinkee teamspace folders create --name "Dashboards" --order 1
281
+
282
+ # Publish a schema (accepts UUID or slug)
283
+ zinkee teamspace resources publish projects --to "Dashboards"
284
+
285
+ # Publish a display
286
+ zinkee teamspace resources publish <display-uuid> --to "Dashboards"
287
+
288
+ # Unpublish
289
+ zinkee teamspace resources unpublish <resource-uuid>
290
+
291
+ # List folders with resources
292
+ zinkee --json teamspace folders list --include-resources
293
+
294
+ # Re-publishing moves the resource to the new folder
295
+ zinkee teamspace resources publish projects --to "Other Folder"
193
296
  ```
194
297
 
195
- For `record_created` and `record_changed`, trigger conditions are always sent as literal values under the new `{ rawValue, source }` shape. Trigger conditions do not support `source`.
298
+ ---
299
+
300
+ ## Displays
196
301
 
197
- ### Actions
302
+ Displays are dashboards composed of widgets that visualize data from schemas.
198
303
 
199
- Valid action types are:
304
+ ### Creation flow
200
305
 
201
- - `create_record`
202
- - `update_record`
203
- - `search_records`
204
- - `send_message`
205
- - `http_request`
206
- - `execute_plugin`
306
+ 1. Create the display
307
+ 2. Create context variables
308
+ 3. Create widgets with `variableMap` bindings
309
+ 4. Set freeform layout positions
207
310
 
208
- Notes:
311
+ ### Templates
209
312
 
210
- - `schema` references inside `automations` are standardized to accept either a UUID or a slug.
211
- - `field` references inside `automations` are standardized to accept either a UUID or a slug.
212
- - `pluginId` for `execute_plugin` must be an active plugin id from `zinkee --json automations plugins list`.
313
+ - `freeform` — grid with `x/y/w/h` positioning (recommended)
314
+ - `single_view` — single widget view
315
+ - `widget_row` — stacked rows
316
+ - `widget_row_tabs` — rows with tabs
317
+ - `side_tabs_widgets` — tabs with sidebar
213
318
 
214
- Create-record action:
319
+ ### Create a freeform display
215
320
 
216
321
  ```bash
217
- zinkee --json automations actions add automation-1 \
218
- --type create_record \
219
- --name "Create follow-up" \
220
- --target-schema followups \
221
- --map status=pending \
222
- --map-json owner='{"rawValue":null,"source":{"type":"TRIGGER","id":"payload_value"}}'
322
+ zinkee --json displays create --name "Project Dashboard" --template freeform
223
323
  ```
224
324
 
225
- The CLI wraps `--map field=value` literals as:
325
+ ### Add a context variable
226
326
 
227
- ```json
228
- {
229
- "rawValue": "value",
230
- "source": null
231
- }
327
+ ```bash
328
+ zinkee --json displays variables create <display-uuid> \
329
+ --type reference \
330
+ --name "Project" \
331
+ --source-schema projects \
332
+ --source-field project-name
232
333
  ```
233
334
 
234
- For source-based values, pass the full object through `--map-json`. Valid `source.type` values are `TRIGGER` and `PREVIOUS_ACTION`.
335
+ Variables accept slugs for `--source-schema` and `--source-field`.
235
336
 
236
- Search-records action with a trigger-based condition:
337
+ ### Add widgets
237
338
 
238
- ```bash
239
- zinkee --json automations actions add automation-1 \
240
- --type search_records \
241
- --name "Find duplicates" \
242
- --target-schema followups \
243
- --condition-json '{"field":"email","comparator":"eq","values":[{"rawValue":null,"source":{"type":"TRIGGER","id":"payload_value"}}]}'
244
- ```
339
+ Every widget MUST include a `variableMap` that maps each display variable to a field in the widget's schema:
245
340
 
246
- Update-record action using the trigger record:
341
+ - **Same schema as variable**: bind to the same display field (e.g., `project-name`)
342
+ - **Different schema**: bind to the ReferenceField pointing to the variable's schema (e.g., `task-project`)
343
+ - **No filtering**: set to `null`
247
344
 
248
345
  ```bash
249
- zinkee --json automations actions add automation-1 \
250
- --type update_record \
251
- --name "Update trigger record" \
252
- --target-schema followups \
253
- --map status=ready \
254
- --use-trigger-record
346
+ # Table widget (--field accepts slugs)
347
+ zinkee --json displays widgets create <display-uuid> \
348
+ --type TABLE_OR_SUBTABLE \
349
+ --name "Tasks" \
350
+ --origin-resource <tasks-schema-uuid> \
351
+ --field task-code \
352
+ --field task-title \
353
+ --field task-status \
354
+ --raw '{"bindings":{"variableMap":{"<variable-uuid>":"<task-project-field-uuid>"}}}'
355
+
356
+ # KPI widget
357
+ zinkee --json displays widgets create <display-uuid> \
358
+ --type KPI \
359
+ --name "Total Hours" \
360
+ --origin-resource <hours-schema-uuid> \
361
+ --raw '{
362
+ "bindings":{"variableMap":{"<variable-uuid>":"<hours-project-field-uuid>"}},
363
+ "kpi":{"typeCalc":"SUM","fieldCalc":"hours-field-slug"}
364
+ }'
365
+
366
+ # Chart widget (valid types: lines, bars, stackedBars, combined)
367
+ zinkee --json displays widgets create <display-uuid> \
368
+ --type CHART \
369
+ --name "Hours by Employee" \
370
+ --origin-resource <hours-schema-uuid> \
371
+ --chart-type bars \
372
+ --x-axis-field employee-field-slug \
373
+ --raw '{
374
+ "bindings":{"variableMap":{"<variable-uuid>":"<hours-project-field-uuid>"}},
375
+ "chart":{"yAxisSeries":[{"typeCalc":"SUM","fieldCalc":"hours-field-slug","axisType":"PRIMARY"}]}
376
+ }'
377
+
378
+ # KANBAN, TIMELINE, DETAIL also supported
255
379
  ```
256
380
 
257
- When `--use-trigger-record` is enabled, the CLI does not send `conditions`.
381
+ Widget types: `TABLE_OR_SUBTABLE`, `DETAIL`, `KPI`, `CHART`, `TIMELINE`, `KANBAN`, `HIERARCHY`.
258
382
 
259
- HTTP request action:
383
+ ### Set freeform layout
384
+
385
+ After creating widgets, position them on a 12-column grid:
260
386
 
261
387
  ```bash
262
- zinkee --json automations actions add automation-1 \
263
- --type http_request \
264
- --name "Notify ERP" \
265
- --method POST \
266
- --url https://example.com/integrations/order-status \
267
- --header X-Demo=cli \
268
- --body '{"event":"order.status.changed"}' \
269
- --content-type application/json \
270
- --timeout-ms 5000
388
+ zinkee displays layout update <display-uuid> --template freeform --freeform-layouts '{
389
+ "lg": [
390
+ {"i":"<kpi-widget-uuid>","x":0,"y":0,"w":3,"h":4},
391
+ {"i":"<kpi-widget-uuid>","x":3,"y":0,"w":3,"h":4},
392
+ {"i":"<table-widget-uuid>","x":0,"y":4,"w":12,"h":10}
393
+ ]
394
+ }'
271
395
  ```
272
396
 
273
- HTTP request action with stored auth:
397
+ ### KPI with filters
398
+
399
+ The `--filter` flag doesn't work on KPI widgets. Pass filters in `--raw`:
274
400
 
275
401
  ```bash
276
- zinkee --json automations actions add automation-1 \
277
- --type http_request \
278
- --name "Notify ERP" \
279
- --method POST \
280
- --url https://example.com/integrations/order-status \
281
- --content-type application/json \
282
- --auth-mode STORED \
283
- --connection 550e8400-e29b-41d4-a716-446655440001
402
+ --raw '{"query":{"filters":[{"fieldId":"<field-uuid>","operator":"EQUALS","value":"2"}]}}'
284
403
  ```
285
404
 
286
- Execute-plugin action:
405
+ ### Slug support
406
+
407
+ Slugs are resolved to UUIDs in: `--field`, `--source-schema`, `--source-field`, `--x-axis-field`, `kpi.fieldCalc`, `chart.xAxisFieldId`, `chart.yAxisSeries[].fieldCalc`, `bindings.variableMap` values.
408
+
409
+ Display UUIDs are required for `displays widgets create/update` and `displays variables create`.
410
+
411
+ ---
412
+
413
+ ## Automations
414
+
415
+ Automations execute actions in response to triggers (record events, schedules, webhooks).
416
+
417
+ ### Creation flow
418
+
419
+ 1. Create automation with trigger
420
+ 2. Add actions
421
+ 3. Wire the flow (connect trigger → actions → actions)
422
+ 4. Activate
423
+
424
+ ### Trigger types
287
425
 
288
426
  ```bash
289
- zinkee --json automations actions add automation-1 \
290
- --type execute_plugin \
291
- --name "Run plugin" \
292
- --plugin clone-budget \
293
- --arg mode=safe \
294
- --arg-json payload='{"dryRun":true}'
427
+ # Scheduled (six-field cron — includes seconds)
428
+ zinkee --json automations create \
429
+ --name "Weekly report" \
430
+ --trigger-type scheduled \
431
+ --cron "0 15 10 * * 1"
432
+
433
+ # Record created (requires at least one --condition)
434
+ zinkee --json automations create \
435
+ --name "High priority task" \
436
+ --trigger-type record_created \
437
+ --trigger-schema tasks \
438
+ --condition priority:eq:3
439
+
440
+ # Record changed (requires --trigger-field)
441
+ zinkee --json automations create \
442
+ --name "Status change" \
443
+ --trigger-type record_changed \
444
+ --trigger-schema tasks \
445
+ --trigger-field status
446
+
447
+ # Webhook
448
+ zinkee --json automations create \
449
+ --name "External webhook" \
450
+ --trigger-type webhook
295
451
  ```
296
452
 
297
- Update an existing action:
453
+ Valid trigger types: `scheduled`, `record_created`, `record_changed`, `webhook`.
454
+
455
+ ### Action types
298
456
 
299
457
  ```bash
300
- zinkee --json automations actions update automation-1 action-1 \
458
+ # Create record with literal and trigger-sourced values
459
+ zinkee --json automations actions add <automation-uuid> \
460
+ --type create_record \
461
+ --name "Create time entry" \
462
+ --target-schema time-entries \
463
+ --map description="Auto-created" \
464
+ --map hours=0 \
465
+ --map-json project='{"rawValue":null,"source":{"type":"TRIGGER","id":"<project-field-uuid>"}}'
466
+
467
+ # Update the trigger record
468
+ zinkee --json automations actions add <automation-uuid> \
301
469
  --type update_record \
302
- --name "Update trigger record" \
303
- --target-schema followups \
304
- --map status=ready \
305
- --use-trigger-record
306
- ```
470
+ --name "Mark as processed" \
471
+ --target-schema tasks \
472
+ --use-trigger-record \
473
+ --map processed=true
307
474
 
308
- ### Flow Wiring
475
+ # Search records
476
+ zinkee --json automations actions add <automation-uuid> \
477
+ --type search_records \
478
+ --name "Find related" \
479
+ --target-schema time-entries \
480
+ --condition-json '{"field":"project","comparator":"eq","values":[{"rawValue":null,"source":{"type":"TRIGGER","id":"<project-field-uuid>"}}]}'
309
481
 
310
- Use `flow set` after you have action ids:
482
+ # HTTP request
483
+ zinkee --json automations actions add <automation-uuid> \
484
+ --type http_request \
485
+ --name "Notify webhook" \
486
+ --method POST \
487
+ --url https://example.com/hook \
488
+ --content-type application/json \
489
+ --body '{"event":"task.created"}'
311
490
 
312
- ```bash
313
- zinkee --json automations flow set automation-1 \
314
- --entry action-1 \
315
- --transition action-1:action-2 \
316
- --transition action-2:action-3
491
+ # Execute plugin
492
+ zinkee --json automations actions add <automation-uuid> \
493
+ --type execute_plugin \
494
+ --name "Clone budget" \
495
+ --plugin clone-budget \
496
+ --arg mode=safe
317
497
  ```
318
498
 
319
- The resulting payload uses:
499
+ Valid action types: `create_record`, `update_record`, `search_records`, `send_message`, `http_request`, `execute_plugin`.
320
500
 
321
- - `entryActionIds`
322
- - `transitions[].fromActionId`
323
- - `transitions[].toActionId`
501
+ ### Field mapping format
324
502
 
325
- ### Webhook Automations
503
+ - `--map field=value` → `{"rawValue":"value","source":null}` (literal)
504
+ - `--map-json field='{"rawValue":null,"source":{"type":"TRIGGER","id":"<field-uuid>"}}'` (from trigger)
505
+ - `source.type` values: `TRIGGER`, `PREVIOUS_ACTION`
506
+ - `source.id` must be a field UUID — slugs are not resolved here
326
507
 
327
- The webhook endpoint configuration is a separate resource from the trigger itself.
508
+ ### Flow wiring
328
509
 
329
- Configure webhook ingestion for an automation:
510
+ Actions are NOT auto-wired. Connect them explicitly:
330
511
 
331
512
  ```bash
332
- zinkee --json automations webhook set automation-1 \
333
- --active \
334
- --idempotency-key-path "$.id" \
335
- --event-type-path "$.type" \
336
- --allowed-event-type frontend.demo.created \
337
- --field-mapping '{"variable":"external_id","jsonPath":"$.data.id"}'
513
+ zinkee --json automations flow set <automation-uuid> \
514
+ --entry <action-1-uuid> \
515
+ --transition <action-1-uuid>:<action-2-uuid> \
516
+ --transition <action-2-uuid>:<action-3-uuid>
338
517
  ```
339
518
 
340
- Read the generated endpoint details:
519
+ ### Activate / deactivate
341
520
 
342
521
  ```bash
343
- zinkee --json automations webhook get automation-1
522
+ zinkee automations activate <automation-uuid>
523
+ zinkee automations deactivate <automation-uuid>
344
524
  ```
345
525
 
346
- If you want the automation trigger itself to be webhook-based:
526
+ ### Webhook configuration
347
527
 
348
528
  ```bash
349
- zinkee --json automations trigger set automation-1 --trigger-type webhook
350
- ```
529
+ zinkee --json automations webhook set <automation-uuid> \
530
+ --active \
531
+ --idempotency-key-path "$.id" \
532
+ --event-type-path "$.type" \
533
+ --allowed-event-type order.created \
534
+ --field-mapping '{"variable":"external_id","jsonPath":"$.data.id"}'
351
535
 
352
- ### Stored Connections
536
+ zinkee --json automations webhook get <automation-uuid>
537
+ ```
353
538
 
354
- Create a stored connection for `http_request` actions:
539
+ ### Stored connections
355
540
 
356
541
  ```bash
357
542
  zinkee --json automations connections create \
@@ -361,35 +546,30 @@ zinkee --json automations connections create \
361
546
  --config '{"headerName":"Authorization"}' \
362
547
  --secret apiKey=super-secret \
363
548
  --active
549
+
550
+ zinkee --json automations connections list
364
551
  ```
365
552
 
366
- Patch a stored connection:
553
+ ### Troubleshooting
367
554
 
368
- ```bash
369
- zinkee --json automations connections update connection-1 \
370
- --raw '{"set":{"name":"ERP API Key Updated","config":{"headerName":"Authorization"}}}'
371
- ```
555
+ - `Automation payload is invalid` → trigger is missing or malformed
556
+ - Use `scheduled` (not `schedule`) as trigger type
557
+ - Cron must be six fields (includes seconds): `"0 15 10 * * 1"`
558
+ - `record_created` requires at least one `--condition`
559
+ - `record_changed` requires at least one `--trigger-field`
560
+ - Actions must be wired with `flow set` before they execute
561
+ - Use `--json --example automations <subcommand>` for canonical examples
372
562
 
373
- ### Patching Automations
563
+ ---
374
564
 
375
- `automations update` uses the backend patch contract with `set` and `unset`.
565
+ ## Discovery
376
566
 
377
567
  ```bash
378
- zinkee --json automations update automation-1 \
379
- --raw '{"set":{"description":"Updated by CLI docs"},"unset":["folderId"]}'
568
+ zinkee --json schemas list
569
+ zinkee --json schemas fields list <schema>
570
+ zinkee --json displays list
571
+ zinkee --json automations list
572
+ zinkee --json automations plugins list
573
+ zinkee --json automations connections list
574
+ zinkee --example <command path>
380
575
  ```
381
-
382
- Supported metadata patch paths:
383
-
384
- - `name`
385
- - `description`
386
- - `folderId`
387
-
388
- ### Troubleshooting
389
-
390
- - `Automation payload is invalid` during create usually means the trigger is missing or malformed.
391
- - `scheduled` is the correct trigger type, not `schedule`.
392
- - Use a six-field cron expression for `scheduled`.
393
- - `record_changed` requires at least one `--trigger-field`.
394
- - Record-based triggers only work with real schema and field UUIDs or slugs from your workspace.
395
- - `zinkee --json --example automations <subcommand>` returns canonical command recipes without executing the command.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zinkee",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "CLI for Zinkee API v2",
5
5
  "type": "module",
6
6
  "bin": {