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