zinkee 0.1.59 → 0.1.61
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 +91 -6
- package/dist/{chunk-RHSXS2M4.js → chunk-W3BI6KES.js} +51 -2
- package/dist/chunk-W3BI6KES.js.map +1 -0
- package/dist/{examples-EAGYSHFN.js → examples-VXDDPC3X.js} +74 -2
- package/dist/examples-VXDDPC3X.js.map +1 -0
- package/dist/index.js +105 -29
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-RHSXS2M4.js.map +0 -1
- package/dist/examples-EAGYSHFN.js.map +0 -1
package/README.md
CHANGED
|
@@ -78,11 +78,27 @@ base_url = "https://api-z2.zinkee.com"
|
|
|
78
78
|
| `--api-key <token>` | Override the configured API key |
|
|
79
79
|
| `--workspace <workspace>` | Workspace name or id for a session profile (also `ZINKEE_WORKSPACE`) |
|
|
80
80
|
| `--read-only` | Run in read-only mode |
|
|
81
|
+
| `--idempotency-key <key>` | Send this `Idempotency-Key` on the write request so a retry does not repeat it |
|
|
81
82
|
| `--example` | Show examples for a command |
|
|
82
83
|
| `--json` | Emit JSON output |
|
|
83
84
|
| `--install-completion [shell]` | Install shell completion (bash, zsh, fish, powershell) |
|
|
84
85
|
| `--show-completion [shell]` | Print the completion script to stdout |
|
|
85
86
|
|
|
87
|
+
### Idempotency keys
|
|
88
|
+
|
|
89
|
+
`--idempotency-key <key>` takes 1–128 characters among letters, digits, `.`,
|
|
90
|
+
`_`, `:` and `-`; anything else fails with `invalid_cli_usage` before any
|
|
91
|
+
request. The key is sent on POST, PATCH, PUT and DELETE requests to the Public
|
|
92
|
+
API (not on reads or `records query`), and the server keeps it for 24 h per
|
|
93
|
+
workspace. Running the same command again with the same key returns the first
|
|
94
|
+
response instead of writing twice; the same key with a different request fails
|
|
95
|
+
with 422 `idempotency_key_reused`. Use a new key for each distinct write. File
|
|
96
|
+
uploads (`files upload`, `document-templates assets add`) do not accept a key.
|
|
97
|
+
|
|
98
|
+
With a key, the CLI retries a network error, a timeout or a 409
|
|
99
|
+
`idempotency_request_in_progress` up to 3 attempts in total, waiting
|
|
100
|
+
`Retry-After` (at most 30 s) or 1 s and then 2 s. Without a key it never retries.
|
|
101
|
+
|
|
86
102
|
## Shell completion
|
|
87
103
|
|
|
88
104
|
```bash
|
|
@@ -370,6 +386,9 @@ zinkee records create projects \
|
|
|
370
386
|
# Create many records from a JSON array file (one object per record; mutually exclusive with the single-record flags)
|
|
371
387
|
zinkee --json records create projects --records-file ./projects.json
|
|
372
388
|
|
|
389
|
+
# Re-running this exact command within 24 h returns the first result instead of creating the record again
|
|
390
|
+
zinkee --json records create projects --set name="Website Redesign" --idempotency-key import-2026-10-22-row-17
|
|
391
|
+
|
|
373
392
|
# List and query
|
|
374
393
|
zinkee --json records list projects --limit 50
|
|
375
394
|
zinkee --json records query projects --limit 10 --sort "_id:desc"
|
|
@@ -377,6 +396,9 @@ zinkee --json records query projects --limit 10 --sort "_id:desc"
|
|
|
377
396
|
# Query with a free-text search term (matched across the schema's searchable fields)
|
|
378
397
|
zinkee --json records query projects --where "status in OPEN" --search "garcia" --limit 25
|
|
379
398
|
|
|
399
|
+
# Query with OR and nested groups (native where, see "Query filters" below)
|
|
400
|
+
zinkee --json records query deals --where-json '{"or":[{"field":"status","op":"eq","value":"OPEN"},{"field":"amount","op":"gt","value":10000}]}'
|
|
401
|
+
|
|
380
402
|
# Get
|
|
381
403
|
zinkee --json records get projects <record-uuid>
|
|
382
404
|
|
|
@@ -407,6 +429,35 @@ holds any child record refuses the clear (409 `data_dependency_conflict`), as it
|
|
|
407
429
|
refuses `records delete` of a record it points at; nothing is deleted. Blocked by
|
|
408
430
|
`--read-only`.
|
|
409
431
|
|
|
432
|
+
### Query filters
|
|
433
|
+
|
|
434
|
+
`--where "<field> <op> [value]"` is repeatable and combines its conditions with AND
|
|
435
|
+
(the colon form `field:op:value` works when the expression has no spaces). Operators:
|
|
436
|
+
`eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `contains`, `not_contains`, `in`
|
|
437
|
+
(comma-separated values), `between` (exactly two comma-separated values `from,to`,
|
|
438
|
+
both included), `is_empty`, `is_not_empty`.
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
zinkee --json records query contacts --where "contact-name not_contains test"
|
|
442
|
+
zinkee --json records query contacts --where "due-date between 2026-10-01,2026-10-31"
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
For OR, pass the API's native `where` with `--where-json`: a JSON array of conditions
|
|
446
|
+
(implicit AND) or a single object, either a condition `{"field","op","value"}` or a
|
|
447
|
+
group `{"and": [...]}` / `{"or": [...]}` whose items are conditions or groups. With
|
|
448
|
+
groups the API allows up to 3 nested levels and 50 conditions. The `id` field accepts
|
|
449
|
+
`eq`, `neq` and `in` with record UUIDs, inside or outside groups.
|
|
450
|
+
|
|
451
|
+
```bash
|
|
452
|
+
zinkee --json records query deals \
|
|
453
|
+
--where-json '{"or":[{"and":[{"field":"status","op":"eq","value":"OPEN"},{"field":"amount","op":"gt","value":10000}]},{"field":"close-date","op":"between","value":["2026-10-01","2026-10-31"]}]}'
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
`--where-json` cannot be combined with `--where`; either of them replaces the `where`
|
|
457
|
+
of `--raw`/`--raw-file`. A `--raw` payload in the native shape (`op`, groups,
|
|
458
|
+
`{"field","direction"}` sort entries, `page`) is sent as is. See
|
|
459
|
+
`zinkee --json --example records query` for more payloads.
|
|
460
|
+
|
|
410
461
|
---
|
|
411
462
|
|
|
412
463
|
## Files
|
|
@@ -919,7 +970,7 @@ zinkee --json automations connections list
|
|
|
919
970
|
|
|
920
971
|
## Document templates
|
|
921
972
|
|
|
922
|
-
Document templates group reusable files
|
|
973
|
+
Document templates group reusable asset files. The `generate_document` automation action renders a template to PDF against the triggering record: the template needs an `index.html` asset with Pebble expressions, and its other assets (stylesheets, images, …) are files that page references. Template names must be unique within the workspace; the `<template>` argument accepts a UUID or an exact name. The `<asset>` argument requires a UUID.
|
|
923
974
|
|
|
924
975
|
### Typical lifecycle
|
|
925
976
|
|
|
@@ -929,11 +980,11 @@ Document templates group reusable files (e.g. Word/Excel masters) that automatio
|
|
|
929
980
|
zinkee --json document-templates create --name "Quarterly report"
|
|
930
981
|
```
|
|
931
982
|
|
|
932
|
-
2. Upload one or more asset files
|
|
983
|
+
2. Upload one or more asset files. The asset name defaults to the local file name; `--name` overrides it and is the relative path `index.html` uses to reference the asset
|
|
933
984
|
|
|
934
985
|
```bash
|
|
935
|
-
zinkee --json document-templates assets add "Quarterly report" ./
|
|
936
|
-
zinkee --json document-templates assets add "Quarterly report" ./
|
|
986
|
+
zinkee --json document-templates assets add "Quarterly report" ./index.html
|
|
987
|
+
zinkee --json document-templates assets add "Quarterly report" ./styles.css --name css/styles.css
|
|
937
988
|
```
|
|
938
989
|
|
|
939
990
|
3. List and inspect
|
|
@@ -956,10 +1007,44 @@ zinkee --json document-templates delete <template-uuid>
|
|
|
956
1007
|
`download` streams raw bytes — use `--output` to write to disk (required when combined with `--json`):
|
|
957
1008
|
|
|
958
1009
|
```bash
|
|
959
|
-
zinkee --json document-templates assets download <template-uuid> <asset-uuid> --output ./
|
|
960
|
-
zinkee document-templates assets download <template-uuid> <asset-uuid> >
|
|
1010
|
+
zinkee --json document-templates assets download <template-uuid> <asset-uuid> --output ./index.html
|
|
1011
|
+
zinkee document-templates assets download <template-uuid> <asset-uuid> > index.html
|
|
1012
|
+
```
|
|
1013
|
+
|
|
1014
|
+
### Writing `index.html` for `generate_document`
|
|
1015
|
+
|
|
1016
|
+
The action renders `index.html` with Pebble, converts it to PDF and stores the PDF in the action's target file field. Expressions outside a loop start at a root:
|
|
1017
|
+
|
|
1018
|
+
- `record` (recommended): reserved alias for the record that triggers the automation, whatever the slug of its schema. It is the only option when that slug contains a hyphen or starts with a digit.
|
|
1019
|
+
- The source schema slug, still accepted when it is an identifier (letters, digits and `_`, not starting with a digit): `{{ budgets['budget-name'] }}`.
|
|
1020
|
+
|
|
1021
|
+
A template uses one root or the other: mixing `record[...]` and the slug fails with `unsupported_document_template_expression`.
|
|
1022
|
+
|
|
1023
|
+
```html
|
|
1024
|
+
<link rel="stylesheet" href="css/styles.css"/>
|
|
1025
|
+
<h1>Invoice {{ record['invoice-id'] }}</h1>
|
|
1026
|
+
{% for d in record['vf-drafts'] %}
|
|
1027
|
+
{% for l in d['vf-invoice-items'] %}
|
|
1028
|
+
<p>{{ l['description'] }}</p>
|
|
1029
|
+
{% endfor %}
|
|
1030
|
+
{% endfor %}
|
|
1031
|
+
{% for photo in record['photos'] %}<img src="{{ photo.src }}" alt="{{ photo.name }}"/>{% endfor %}
|
|
961
1032
|
```
|
|
962
1033
|
|
|
1034
|
+
- Paths use `.slug` or `['slug']`. Field and child schema slugs that are not identifiers, such as those with a hyphen, always need brackets and single quotes: `x['field-slug']`.
|
|
1035
|
+
- Filters after `|` are allowed. The only tags are `{% for x in … %}` / `{% endfor %}` and `{% if %}` / `{% elseif %}` / `{% else %}` / `{% endif %}`; function calls and any other tag fail with `unsupported_document_template_expression`.
|
|
1036
|
+
- `{% for %}` over a related schema slug yields its records in either direction: those referencing the current record, or the one its reference field points to (zero or one row). Two reference fields from the current schema to that schema are ambiguous and fail. Rows are ordered by the child's numeric `order` field, when it has one, then by creation time.
|
|
1037
|
+
- `{% for %}` over a file field (`photos` above) yields one row per PNG, JPEG, GIF or BMP image, with `src` (the path for `<img src>`), `name` and `type`; other file types are skipped.
|
|
1038
|
+
- Values arrive already formatted with the workspace timezone and language.
|
|
1039
|
+
- Avoid `{% for record in … %}`: the loop variable hides the root until its `endfor`.
|
|
1040
|
+
- A root with a hyphen fails with `unsupported_document_template_expression`, and the error suggests the expression rooted at `record` (`vf-invoices['invoice-id']` → `record['invoice-id']`).
|
|
1041
|
+
|
|
1042
|
+
Assets:
|
|
1043
|
+
|
|
1044
|
+
- An asset named exactly `index.html` is required (`document_generation_index_html_missing`). Names starting with `record-files/` are reserved for record images.
|
|
1045
|
+
- `<link href>` and `<img src>` must be relative paths of template assets (or a file field row's `src`); absolute or external URLs are rejected.
|
|
1046
|
+
- Inline CSS (`<style>` or `style="…"`) is rejected: move styles to `.css` assets linked from `index.html`. Stylesheets cannot use `@import`, and their `url(…)` must point to template assets.
|
|
1047
|
+
|
|
963
1048
|
### Notes
|
|
964
1049
|
|
|
965
1050
|
- `get` is a client-side helper: the backend has no get-one endpoint, so the CLI filters the list response. Use `list` if you want everything in one call.
|
|
@@ -64,6 +64,7 @@ var ApiClientError = class extends Error {
|
|
|
64
64
|
status;
|
|
65
65
|
responseBody;
|
|
66
66
|
responseText;
|
|
67
|
+
retryAfter;
|
|
67
68
|
cause;
|
|
68
69
|
constructor(code, message, details) {
|
|
69
70
|
super(message);
|
|
@@ -73,6 +74,7 @@ var ApiClientError = class extends Error {
|
|
|
73
74
|
this.status = details.status;
|
|
74
75
|
this.responseBody = details.responseBody;
|
|
75
76
|
this.responseText = details.responseText;
|
|
77
|
+
this.retryAfter = details.retryAfter;
|
|
76
78
|
this.cause = details.cause;
|
|
77
79
|
}
|
|
78
80
|
};
|
|
@@ -127,6 +129,35 @@ function summarizeNetworkCause(cause) {
|
|
|
127
129
|
}
|
|
128
130
|
return void 0;
|
|
129
131
|
}
|
|
132
|
+
var IDEMPOTENT_WRITE_METHODS = /* @__PURE__ */ new Set(["POST", "PATCH", "PUT", "DELETE"]);
|
|
133
|
+
var MAX_IDEMPOTENT_ATTEMPTS = 3;
|
|
134
|
+
var MAX_RETRY_AFTER_MS = 3e4;
|
|
135
|
+
function acceptsIdempotencyKey(method, url) {
|
|
136
|
+
return IDEMPOTENT_WRITE_METHODS.has(method.toUpperCase()) && !new URL(url).pathname.endsWith(":query");
|
|
137
|
+
}
|
|
138
|
+
function isReusableBody(body) {
|
|
139
|
+
return body === void 0 || body === null || typeof body === "string" || body instanceof Uint8Array;
|
|
140
|
+
}
|
|
141
|
+
function isRetryableWithIdempotencyKey(error) {
|
|
142
|
+
if (!(error instanceof ApiClientError)) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
if (error.code === "network_error" || error.code === "timeout") {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
const body = error.responseBody;
|
|
149
|
+
return error.status === 409 && typeof body === "object" && body !== null && body.reason === "idempotency_request_in_progress";
|
|
150
|
+
}
|
|
151
|
+
function idempotentRetryDelayMs(error, attempt) {
|
|
152
|
+
const retryAfter = error.retryAfter?.trim();
|
|
153
|
+
if (retryAfter && /^\d+$/.test(retryAfter)) {
|
|
154
|
+
return Math.min(Number(retryAfter) * 1e3, MAX_RETRY_AFTER_MS);
|
|
155
|
+
}
|
|
156
|
+
return 1e3 * 2 ** (attempt - 1);
|
|
157
|
+
}
|
|
158
|
+
function sleep(ms) {
|
|
159
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
160
|
+
}
|
|
130
161
|
var ApiClient = class {
|
|
131
162
|
constructor(options) {
|
|
132
163
|
this.options = options;
|
|
@@ -178,6 +209,23 @@ var ApiClient = class {
|
|
|
178
209
|
if (token && !headers.has("authorization")) {
|
|
179
210
|
headers.set("authorization", `Bearer ${token}`);
|
|
180
211
|
}
|
|
212
|
+
const { idempotencyKey } = this.options;
|
|
213
|
+
if (idempotencyKey && !headers.has("idempotency-key") && acceptsIdempotencyKey(method, url)) {
|
|
214
|
+
headers.set("idempotency-key", idempotencyKey);
|
|
215
|
+
}
|
|
216
|
+
const retryable = headers.has("idempotency-key") && isReusableBody(init.body);
|
|
217
|
+
for (let attempt = 1; ; attempt += 1) {
|
|
218
|
+
try {
|
|
219
|
+
return await this.send(url, method, headers, init, consume);
|
|
220
|
+
} catch (error) {
|
|
221
|
+
if (!retryable || attempt >= MAX_IDEMPOTENT_ATTEMPTS || init.signal?.aborted || !isRetryableWithIdempotencyKey(error)) {
|
|
222
|
+
throw error;
|
|
223
|
+
}
|
|
224
|
+
await sleep(idempotentRetryDelayMs(error, attempt));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
async send(url, method, headers, init, consume) {
|
|
181
229
|
const controller = new AbortController();
|
|
182
230
|
const timeoutMs = init.timeoutMs ?? this.options.timeoutMs;
|
|
183
231
|
let timedOut = false;
|
|
@@ -251,7 +299,8 @@ var ApiClient = class {
|
|
|
251
299
|
method,
|
|
252
300
|
status: response.status,
|
|
253
301
|
responseBody,
|
|
254
|
-
responseText: responseBody === text ? text : void 0
|
|
302
|
+
responseText: responseBody === text ? text : void 0,
|
|
303
|
+
retryAfter: response.headers.get("retry-after") ?? void 0
|
|
255
304
|
}
|
|
256
305
|
);
|
|
257
306
|
}
|
|
@@ -1312,4 +1361,4 @@ export {
|
|
|
1312
1361
|
buildSchemaFieldCreateHelpText,
|
|
1313
1362
|
buildSchemaFieldCreateValidationMessage
|
|
1314
1363
|
};
|
|
1315
|
-
//# sourceMappingURL=chunk-
|
|
1364
|
+
//# sourceMappingURL=chunk-W3BI6KES.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/output.ts","../src/client.ts","../src/utils/errors.ts","../src/utils/schema-fields.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\nimport type {\n JsonEnvelopeMeta,\n JsonErrorEnvelope,\n JsonSuccessEnvelope,\n} from \"../types.js\";\n\nconst require = createRequire(import.meta.url);\n\nexport interface OutputWriter {\n write(chunk: string): unknown;\n}\n\nfunction stringifyCellValue(value: unknown): string {\n if (value === null || value === undefined) {\n return \"\";\n }\n\n if (typeof value === \"string\") {\n return value;\n }\n\n if (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"bigint\") {\n return String(value);\n }\n\n return JSON.stringify(value);\n}\n\nexport function buildJsonSuccess<TData, TMeta extends JsonEnvelopeMeta = JsonEnvelopeMeta>(\n data: TData,\n meta: TMeta = {} as TMeta,\n): JsonSuccessEnvelope<TData, TMeta> {\n return { data, meta };\n}\n\nexport function buildJsonError<TErr, TMeta extends JsonEnvelopeMeta = JsonEnvelopeMeta>(\n error: TErr,\n meta: TMeta = {} as TMeta,\n): JsonErrorEnvelope<TErr, TMeta> {\n return { error, meta };\n}\n\nexport interface FolderLocation {\n id?: string;\n name?: string | null;\n isRoot?: boolean;\n}\n\n/** Column keys, in order, produced by {@link folderColumns}. Append them to a table's key list. */\nexport const FOLDER_TABLE_KEYS = [\"folderId\", \"folderName\", \"folderIsRoot\"] as const;\n\n/**\n * Flattens the API `folder` object (`{ id, name, isRoot }`) into the folderId/folderName/folderIsRoot table columns.\n * The root folder arrives with a null name, so folderName renders it as \"(root)\". A missing folder (e.g. a workspace\n * without a default group) leaves every column empty.\n */\nexport function folderColumns(folder: FolderLocation | null | undefined): {\n folderId: string;\n folderName: string;\n folderIsRoot: string;\n} {\n if (!folder) {\n return { folderId: \"\", folderName: \"\", folderIsRoot: \"\" };\n }\n\n return {\n folderId: folder.id ?? \"\",\n folderName: folder.name ?? (folder.isRoot === true ? \"(root)\" : \"\"),\n folderIsRoot: folder.isRoot === undefined ? \"\" : String(folder.isRoot),\n };\n}\n\nexport function printTable(\n rows: readonly Record<string, unknown>[],\n keys?: readonly string[],\n writer?: OutputWriter,\n): void {\n const output = writer ?? process.stdout;\n const firstRow = rows[0];\n\n if (!firstRow) {\n output.write(\"No results.\\n\");\n return;\n }\n\n const headings = [...(keys ?? Object.keys(firstRow))];\n const Table = require(\"cli-table3\") as typeof import(\"cli-table3\");\n const table = new Table({\n head: headings,\n wordWrap: true,\n });\n\n for (const row of rows) {\n table.push(headings.map((heading) => stringifyCellValue(row[heading])));\n }\n\n output.write(`${table.toString()}\\n`);\n}\n","import { createRequire } from \"node:module\";\nimport { Readable, Transform, type Writable } from \"node:stream\";\nimport { pipeline } from \"node:stream/promises\";\n\nconst require = createRequire(import.meta.url);\nconst { version } = require(\"../package.json\") as { version: string };\n\nexport interface ApiClientOptions {\n baseUrl: string;\n apiKey?: string;\n /** Resolves the bearer token on the first request instead of apiKey; called at most once. */\n getToken?: () => Promise<string>;\n timeoutMs?: number;\n fetch?: typeof fetch;\n /** Sent as Idempotency-Key on write requests, which are then retried on transient failures. */\n idempotencyKey?: string;\n}\n\nexport type ApiClientErrorCode =\n | \"network_error\"\n | \"http_error\"\n | \"timeout\"\n | \"invalid_json\";\n\nexport interface ApiClientErrorDetails {\n url: string;\n method: string;\n status?: number;\n responseBody?: unknown;\n responseText?: string;\n retryAfter?: string;\n cause?: unknown;\n}\n\nexport class ApiClientError extends Error {\n override name = \"ApiClientError\";\n\n readonly code: ApiClientErrorCode;\n\n readonly url: string;\n\n readonly method: string;\n\n readonly status?: number;\n\n readonly responseBody?: unknown;\n\n readonly responseText?: string;\n\n readonly retryAfter?: string;\n\n override readonly cause?: unknown;\n\n constructor(\n code: ApiClientErrorCode,\n message: string,\n details: ApiClientErrorDetails,\n ) {\n super(message);\n this.code = code;\n this.url = details.url;\n this.method = details.method;\n this.status = details.status;\n this.responseBody = details.responseBody;\n this.responseText = details.responseText;\n this.retryAfter = details.retryAfter;\n this.cause = details.cause;\n }\n}\n\nexport interface ApiRequestOptions extends RequestInit {\n timeoutMs?: number;\n}\n\nfunction isJsonContentType(contentType: string | null): boolean {\n return contentType ? /(^|\\/|\\+)json\\b/i.test(contentType) : false;\n}\n\nfunction looksLikeJson(text: string): boolean {\n const trimmed = text.trim();\n\n return (\n trimmed.startsWith(\"{\") ||\n trimmed.startsWith(\"[\") ||\n trimmed === \"null\" ||\n trimmed === \"true\" ||\n trimmed === \"false\" ||\n /^-?(0|[1-9]\\d*)(\\.\\d+)?([eE][+-]?\\d+)?$/.test(trimmed) ||\n trimmed.startsWith('\"')\n );\n}\n\nfunction parseJsonBody<T>(text: string, url: string, method: string): T {\n const trimmed = text.trim();\n\n if (trimmed.length === 0) {\n return undefined as T;\n }\n\n try {\n return JSON.parse(trimmed) as T;\n } catch (cause) {\n throw new ApiClientError(\"invalid_json\", `Failed to parse JSON response from ${method} ${url}.`, {\n url,\n method,\n responseText: text,\n cause,\n });\n }\n}\n\nfunction parseErrorBody(text: string, contentType: string | null): unknown {\n if (text.trim().length === 0) {\n return undefined;\n }\n\n if (!isJsonContentType(contentType) && !looksLikeJson(text)) {\n return text;\n }\n\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n}\n\nfunction summarizeNetworkCause(cause: unknown): string | undefined {\n const seen = new Set<unknown>();\n let current: unknown = cause;\n\n while (current && typeof current === \"object\" && !seen.has(current)) {\n seen.add(current);\n\n const candidate = current as { message?: unknown; code?: unknown; cause?: unknown };\n const message = typeof candidate.message === \"string\" ? candidate.message.trim() : \"\";\n const code = typeof candidate.code === \"string\" ? candidate.code : undefined;\n\n if (message && message !== \"fetch failed\") {\n return code && !message.includes(code) ? `${message} (${code})` : message;\n }\n\n current = candidate.cause;\n }\n\n return undefined;\n}\n\nconst IDEMPOTENT_WRITE_METHODS = new Set([\"POST\", \"PATCH\", \"PUT\", \"DELETE\"]);\nconst MAX_IDEMPOTENT_ATTEMPTS = 3;\nconst MAX_RETRY_AFTER_MS = 30_000;\n\n/** `:query` endpoints only read, so the server ignores the key there. */\nfunction acceptsIdempotencyKey(method: string, url: string): boolean {\n return IDEMPOTENT_WRITE_METHODS.has(method.toUpperCase()) && !new URL(url).pathname.endsWith(\":query\");\n}\n\n/** Streams and form data cannot be sent twice as they are. */\nfunction isReusableBody(body: RequestInit[\"body\"]): boolean {\n return body === undefined || body === null || typeof body === \"string\" || body instanceof Uint8Array;\n}\n\nfunction isRetryableWithIdempotencyKey(error: unknown): error is ApiClientError {\n if (!(error instanceof ApiClientError)) {\n return false;\n }\n\n if (error.code === \"network_error\" || error.code === \"timeout\") {\n return true;\n }\n\n const body = error.responseBody;\n return error.status === 409\n && typeof body === \"object\"\n && body !== null\n && (body as { reason?: unknown }).reason === \"idempotency_request_in_progress\";\n}\n\nfunction idempotentRetryDelayMs(error: ApiClientError, attempt: number): number {\n const retryAfter = error.retryAfter?.trim();\n\n if (retryAfter && /^\\d+$/.test(retryAfter)) {\n return Math.min(Number(retryAfter) * 1000, MAX_RETRY_AFTER_MS);\n }\n\n return 1000 * 2 ** (attempt - 1);\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nexport class ApiClient {\n private readonly fetchImpl: typeof fetch;\n\n private tokenPromise?: Promise<string>;\n\n constructor(private readonly options: ApiClientOptions) {\n this.fetchImpl = options.fetch ?? fetch;\n }\n\n getJson<T>(path: string, init: ApiRequestOptions = {}): Promise<T> {\n return this.requestJson<T>(path, { ...init, method: \"GET\" });\n }\n\n requestJson<T>(path: string, init: ApiRequestOptions = {}): Promise<T> {\n return this.request(\n path,\n init,\n async (response, url) => {\n const text = await response.text();\n return parseJsonBody<T>(text, url, init.method ?? \"GET\");\n },\n \"application/json\",\n );\n }\n\n download(\n path: string,\n destination: Writable,\n init: ApiRequestOptions = {},\n ): Promise<number> {\n return this.request(path, init, async (response, _url, signal) => {\n let bytes = 0;\n const counter = new Transform({\n transform(chunk: Buffer, _encoding, callback) {\n bytes += chunk.length;\n callback(null, chunk);\n },\n });\n const source = response.body\n ? Readable.fromWeb(response.body as Parameters<typeof Readable.fromWeb>[0])\n : Readable.from([]);\n\n await pipeline(source, counter, destination, { signal });\n return bytes;\n });\n }\n\n private buildUrl(path: string): string {\n const normalizedPath = path.startsWith(\"/\") ? path : `/${path}`;\n\n return new URL(normalizedPath, this.options.baseUrl).toString();\n }\n\n private async request<T>(\n path: string,\n init: ApiRequestOptions,\n consume: (response: Response, url: string, signal: AbortSignal) => Promise<T>,\n accept?: string,\n ): Promise<T> {\n const url = this.buildUrl(path);\n const method = init.method ?? \"GET\";\n const headers = new Headers(init.headers);\n headers.set(\"user-agent\", `zinkee-cli/${version}`);\n\n if (accept && !headers.has(\"accept\")) {\n headers.set(\"accept\", accept);\n }\n\n // Awaited outside the try below so its own errors are not reported as network errors.\n const token = this.options.getToken\n ? await (this.tokenPromise ??= this.options.getToken())\n : this.options.apiKey;\n\n if (token && !headers.has(\"authorization\")) {\n headers.set(\"authorization\", `Bearer ${token}`);\n }\n\n const { idempotencyKey } = this.options;\n\n if (idempotencyKey && !headers.has(\"idempotency-key\") && acceptsIdempotencyKey(method, url)) {\n headers.set(\"idempotency-key\", idempotencyKey);\n }\n\n // Only keyed requests are retried: the server replays or rejects a repeat instead of running it again.\n const retryable = headers.has(\"idempotency-key\") && isReusableBody(init.body);\n\n for (let attempt = 1; ; attempt += 1) {\n try {\n return await this.send(url, method, headers, init, consume);\n } catch (error) {\n if (\n !retryable ||\n attempt >= MAX_IDEMPOTENT_ATTEMPTS ||\n init.signal?.aborted ||\n !isRetryableWithIdempotencyKey(error)\n ) {\n throw error;\n }\n\n await sleep(idempotentRetryDelayMs(error, attempt));\n }\n }\n }\n\n private async send<T>(\n url: string,\n method: string,\n headers: Headers,\n init: ApiRequestOptions,\n consume: (response: Response, url: string, signal: AbortSignal) => Promise<T>,\n ): Promise<T> {\n const controller = new AbortController();\n const timeoutMs = init.timeoutMs ?? this.options.timeoutMs;\n let timedOut = false;\n let timeoutHandle: ReturnType<typeof setTimeout> | undefined;\n\n const abortListener = (): void => {\n controller.abort(init.signal?.reason);\n };\n\n if (init.signal) {\n if (init.signal.aborted) {\n controller.abort(init.signal.reason);\n } else {\n init.signal.addEventListener(\"abort\", abortListener, { once: true });\n }\n }\n\n if (timeoutMs !== undefined) {\n timeoutHandle = setTimeout(() => {\n if (!controller.signal.aborted) {\n timedOut = true;\n controller.abort();\n }\n }, timeoutMs);\n }\n\n try {\n controller.signal.throwIfAborted();\n const response = await this.fetchImpl(url, {\n ...init,\n headers,\n signal: controller.signal,\n });\n const responseUrl = response.url || url;\n\n if (!response.ok) {\n const text = await response.text();\n throw this.buildHttpError(response, text, init, responseUrl);\n }\n\n return await consume(response, responseUrl, controller.signal);\n } catch (cause) {\n if (cause instanceof ApiClientError) {\n throw cause;\n }\n\n if (timedOut) {\n throw new ApiClientError(\"timeout\", `Request timed out after ${timeoutMs}ms.`, {\n url,\n method,\n cause,\n });\n }\n\n const causeSummary = summarizeNetworkCause(cause);\n const message = causeSummary\n ? `Request failed for ${method} ${url}: ${causeSummary}.`\n : `Request failed for ${method} ${url}.`;\n\n throw new ApiClientError(\"network_error\", message, {\n url,\n method,\n cause,\n });\n } finally {\n if (timeoutHandle !== undefined) {\n clearTimeout(timeoutHandle);\n }\n\n if (init.signal) {\n init.signal.removeEventListener(\"abort\", abortListener);\n }\n }\n }\n\n private buildHttpError(\n response: Response,\n text: string,\n init: ApiRequestOptions,\n url: string,\n ): ApiClientError {\n const method = init.method ?? \"GET\";\n const responseBody = parseErrorBody(text, response.headers.get(\"content-type\"));\n\n return new ApiClientError(\n \"http_error\",\n `Request failed with status ${response.status} for ${method} ${url}.`,\n {\n url,\n method,\n status: response.status,\n responseBody,\n responseText: responseBody === text ? text : undefined,\n retryAfter: response.headers.get(\"retry-after\") ?? undefined,\n },\n );\n }\n}\n","import { ApiClientError } from \"../client.js\";\nimport type { JsonEnvelopeMeta, JsonErrorEnvelope } from \"../types.js\";\n\nimport { buildJsonError } from \"./output.js\";\n\nexport type CliErrorCode =\n | \"unknown_error\"\n | \"invalid_cli_usage\"\n | \"configuration_error\"\n | \"authentication_required\"\n | \"command_not_allowed_in_read_only_mode\"\n | \"network_error\"\n | \"http_error\"\n | \"timeout\"\n | \"invalid_json\";\n\nexport const cliExitCodeByErrorCode = {\n unknown_error: 1,\n invalid_cli_usage: 2,\n configuration_error: 2,\n authentication_required: 3,\n command_not_allowed_in_read_only_mode: 7,\n network_error: 1,\n http_error: 1,\n timeout: 1,\n invalid_json: 1,\n} as const satisfies Record<CliErrorCode, number>;\n\nexport interface CliErrorDetails {\n [key: string]: unknown;\n}\n\nexport interface CliErrorPayload {\n code: CliErrorCode;\n message: string;\n exitCode: number;\n details?: CliErrorDetails;\n}\n\nconst errorCodeByName: Record<string, CliErrorCode> = {\n ProfileResolutionError: \"configuration_error\",\n};\n\nexport class CliError extends Error {\n override name = \"CliError\";\n\n readonly code: CliErrorCode;\n\n readonly exitCode: number;\n\n readonly details?: CliErrorDetails;\n\n constructor(\n code: CliErrorCode,\n message: string,\n details: CliErrorDetails = {},\n exitCode: number = cliExitCodeByErrorCode[code],\n ) {\n super(message);\n this.code = code;\n this.exitCode = exitCode;\n\n if (Object.keys(details).length > 0) {\n this.details = details;\n }\n }\n\n toJSON(): CliErrorPayload {\n const payload: CliErrorPayload = {\n code: this.code,\n message: this.message,\n exitCode: this.exitCode,\n };\n\n if (this.details) {\n payload.details = this.details;\n }\n\n return payload;\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction readString(value: unknown): string | undefined {\n return typeof value === \"string\" && value.trim().length > 0 ? value : undefined;\n}\n\nfunction readNumber(value: unknown): number | undefined {\n return typeof value === \"number\" ? value : undefined;\n}\n\nfunction extractApiErrorDetails(error: ApiClientError): {\n message: string;\n details: CliErrorDetails;\n meta: JsonEnvelopeMeta;\n} {\n const details: CliErrorDetails = {};\n const meta: JsonEnvelopeMeta = {};\n const responseBody = isRecord(error.responseBody) ? error.responseBody : undefined;\n const errorBody = responseBody?.error;\n const backendError = isRecord(errorBody) ? errorBody : responseBody;\n const backendMeta = isRecord(responseBody?.meta) ? responseBody.meta : undefined;\n const reason =\n readString(backendError?.reason) ??\n readString(backendError?.code);\n const action = readString(backendError?.action);\n const requestId =\n readString(backendMeta?.requestId) ??\n readString(responseBody?.requestId) ??\n readString(backendError?.requestId);\n const status =\n readNumber(backendError?.status) ??\n readNumber(responseBody?.status) ??\n error.status;\n const backendMessage = readString(backendError?.message);\n\n if (reason !== undefined) {\n details.reason = reason;\n }\n\n if (action !== undefined) {\n details.action = action;\n }\n\n if (requestId !== undefined) {\n details.requestId = requestId;\n meta.requestId = requestId;\n }\n\n if (status !== undefined) {\n details.status = status;\n meta.status = status;\n }\n\n return {\n message: backendMessage ?? error.message,\n details,\n meta,\n };\n}\n\nexport function toCliError(error: unknown): CliError {\n if (error instanceof CliError) {\n return error;\n }\n\n if (error instanceof ApiClientError) {\n const apiError = extractApiErrorDetails(error);\n\n return new CliError(error.code, apiError.message, apiError.details);\n }\n\n if (error instanceof Error) {\n return new CliError(errorCodeByName[error.name] ?? \"unknown_error\", error.message);\n }\n\n return new CliError(\"unknown_error\", \"Unknown error\");\n}\n\nexport function getExitCode(error: unknown): number {\n return toCliError(error).exitCode;\n}\n\nexport function buildJsonCliError<TMeta extends JsonEnvelopeMeta = JsonEnvelopeMeta>(\n error: unknown,\n meta: TMeta = {} as TMeta,\n): JsonErrorEnvelope<CliErrorPayload, TMeta> {\n const cliError = toCliError(error);\n const apiErrorMeta =\n error instanceof ApiClientError\n ? extractApiErrorDetails(error).meta\n : {};\n\n return buildJsonError(cliError.toJSON(), { ...apiErrorMeta, ...meta } as TMeta);\n}\n\nexport function formatCliErrorText(error: unknown): string {\n return toCliError(error).message;\n}\n\nexport function formatCliErrorJson<TMeta extends JsonEnvelopeMeta = JsonEnvelopeMeta>(\n error: unknown,\n meta: TMeta = {} as TMeta,\n): string {\n return JSON.stringify(buildJsonCliError(error, meta));\n}\n","import type { JsonObject } from \"../types.js\";\nimport { CliError } from \"./errors.js\";\n\nexport type SchemaFieldTypeKey =\n | \"text\"\n | \"number\"\n | \"date\"\n | \"option\"\n | \"file\"\n | \"reference\"\n | \"formula\"\n | \"member\"\n | \"autoincremental\"\n | \"schedule\";\n\nexport interface SchemaFieldExamplePayload {\n name: string;\n payload: JsonObject;\n}\n\nexport interface SchemaFieldTypeDefinition {\n key: SchemaFieldTypeKey;\n className: string;\n aliases: readonly string[];\n description: string;\n rawShape: string;\n examplePayloads: readonly SchemaFieldExamplePayload[];\n}\n\nfunction isJsonObject(value: unknown): value is JsonObject {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction toJsonObject(value: unknown): JsonObject | undefined {\n return isJsonObject(value) ? value : undefined;\n}\n\nfunction toStringValue(value: unknown): string | undefined {\n return typeof value === \"string\" && value.trim().length > 0 ? value : undefined;\n}\n\nfunction toNumberValue(value: unknown): number | undefined {\n if (typeof value === \"number\" && Number.isFinite(value)) {\n return value;\n }\n\n if (typeof value === \"string\" && value.trim().length > 0) {\n const parsed = Number(value);\n if (Number.isFinite(parsed)) {\n return parsed;\n }\n }\n\n return undefined;\n}\n\nconst fieldTypeDefinitions = [\n {\n key: \"text\",\n className: \"TextField\",\n aliases: [\"text\", \"TextField\"],\n description: \"Plain text field.\",\n rawShape:\n '{\"type\":\"TextField\",\"slug\":\"name\",\"label\":\"Name\",\"config\":{\"textType\":\"NORMAL\"}}',\n examplePayloads: [\n {\n name: \"Text field (normal)\",\n payload: {\n type: \"TextField\",\n slug: \"customer-name\",\n label: \"Customer Name\",\n required: true,\n config: {\n textType: \"NORMAL\",\n defaultValue: null,\n conditionalFormatting: [],\n },\n },\n },\n {\n name: \"Text field (long)\",\n payload: {\n type: \"TextField\",\n slug: \"customer-notes\",\n label: \"Customer Notes\",\n required: false,\n config: {\n textType: \"LONG\",\n defaultValue: \"Add internal notes here...\",\n conditionalFormatting: [],\n },\n },\n },\n ],\n },\n {\n key: \"number\",\n className: \"NumberField\",\n aliases: [\"number\", \"NumberField\"],\n description: \"Numeric field.\",\n rawShape:\n '{\"type\":\"NumberField\",\"slug\":\"quantity\",\"label\":\"Quantity\",\"config\":{\"defaultValue\":\"0\",\"formatOptions\":{\"format\":\"number\",\"decimals\":0,\"thousandsSeparator\":false}}}',\n examplePayloads: [\n {\n name: \"Number field (plain integer)\",\n payload: {\n type: \"NumberField\",\n slug: \"quantity\",\n label: \"Quantity\",\n required: false,\n config: {\n defaultValue: \"0\",\n formatOptions: {\n format: \"number\",\n decimals: 0,\n thousandsSeparator: false,\n },\n conditionalFormatting: [],\n },\n },\n },\n {\n name: \"Number field (decimal with thousands)\",\n payload: {\n type: \"NumberField\",\n slug: \"weight\",\n label: \"Weight (kg)\",\n required: false,\n config: {\n defaultValue: \"0\",\n formatOptions: {\n format: \"number\",\n decimals: 2,\n thousandsSeparator: true,\n negativesInRed: false,\n },\n conditionalFormatting: [],\n },\n },\n },\n {\n name: \"Number field (currency € prefix)\",\n payload: {\n type: \"NumberField\",\n slug: \"amount-eur\",\n label: \"Amount (EUR)\",\n required: false,\n config: {\n defaultValue: \"0\",\n formatOptions: {\n format: \"currency\",\n decimals: 2,\n negativesInRed: true,\n thousandsSeparator: true,\n symbolEnabled: true,\n symbolPosition: \"before\",\n symbolValue: \"€\",\n },\n conditionalFormatting: [],\n },\n },\n },\n {\n name: \"Number field (currency $ suffix)\",\n payload: {\n type: \"NumberField\",\n slug: \"amount-usd\",\n label: \"Amount (USD)\",\n required: false,\n config: {\n defaultValue: \"0\",\n formatOptions: {\n format: \"currency\",\n decimals: 2,\n negativesInRed: false,\n thousandsSeparator: true,\n symbolEnabled: true,\n symbolPosition: \"right\",\n symbolValue: \" $\",\n },\n conditionalFormatting: [],\n },\n },\n },\n {\n name: \"Number field (percentage)\",\n payload: {\n type: \"NumberField\",\n slug: \"discount-rate\",\n label: \"Discount Rate\",\n required: false,\n config: {\n defaultValue: \"0\",\n formatOptions: {\n format: \"percentage\",\n decimals: 1,\n negativesInRed: true,\n },\n conditionalFormatting: [],\n },\n },\n },\n {\n name: \"Number field (duration HH:MM)\",\n payload: {\n type: \"NumberField\",\n slug: \"tracked-time\",\n label: \"Tracked Time\",\n required: false,\n config: {\n defaultValue: \"0\",\n formatOptions: {\n format: \"duration\",\n durationFormat: \"HH:MM\",\n },\n conditionalFormatting: [],\n },\n },\n },\n ],\n },\n {\n key: \"date\",\n className: \"DateField\",\n aliases: [\"date\", \"DateField\"],\n description: \"Date or datetime field.\",\n rawShape:\n '{\"type\":\"DateField\",\"slug\":\"due-date\",\"label\":\"Due Date\",\"config\":{\"formatOptions\":{\"format\":\"date\",\"dateFormat\":\"YYYY-MM-DD\",\"showTime\":false}}}',\n examplePayloads: [\n {\n name: \"Date field (date only)\",\n payload: {\n type: \"DateField\",\n slug: \"birth-date\",\n label: \"Birth Date\",\n required: false,\n config: {\n defaultValue: null,\n formatOptions: {\n format: \"date\",\n dateFormat: \"YYYY-MM-DD\",\n showTime: false,\n },\n conditionalFormatting: [],\n },\n },\n },\n {\n name: \"Date field (datetime EU)\",\n payload: {\n type: \"DateField\",\n slug: \"due-date\",\n label: \"Due Date\",\n required: false,\n config: {\n defaultValue: null,\n formatOptions: {\n format: \"datetime\",\n dateFormat: \"DD/MM/YYYY\",\n showTime: true,\n },\n conditionalFormatting: [],\n },\n },\n },\n {\n name: \"Date field (datetime US)\",\n payload: {\n type: \"DateField\",\n slug: \"appointment-at\",\n label: \"Appointment\",\n required: false,\n config: {\n defaultValue: null,\n formatOptions: {\n format: \"datetime\",\n dateFormat: \"MM/DD/YYYY\",\n showTime: true,\n },\n conditionalFormatting: [],\n },\n },\n },\n ],\n },\n {\n key: \"option\",\n className: \"OptionField\",\n aliases: [\"option\", \"OptionField\"],\n description: \"Dropdown/select field with options.\",\n rawShape:\n '{\"type\":\"OptionField\",\"slug\":\"status\",\"label\":\"Status\",\"config\":{\"options\":[{\"id\":1,\"name\":\"Open\",\"color\":\"default\"},{\"id\":2,\"name\":\"Closed\",\"color\":\"success\"}]}}',\n examplePayloads: [\n {\n name: \"Option field (select dropdown)\",\n payload: {\n type: \"OptionField\",\n slug: \"priority\",\n label: \"Priority\",\n required: false,\n config: {\n options: [\n { id: 1, name: \"Low\", color: \"default\" },\n { id: 2, name: \"Medium\", color: \"warning\" },\n { id: 3, name: \"High\", color: \"cond-critico\" },\n ],\n defaultValue: 1,\n conditionalFormatting: [],\n buttonConfig: null,\n },\n },\n },\n {\n name: \"Option field (button cycle)\",\n payload: {\n type: \"OptionField\",\n slug: \"stage\",\n label: \"Stage\",\n required: false,\n config: {\n options: [\n { id: 1, name: \"To Do\", color: \"default\" },\n { id: 2, name: \"Doing\", color: \"warning\" },\n { id: 3, name: \"Done\", color: \"success\" },\n ],\n defaultValue: 1,\n conditionalFormatting: [],\n buttonConfig: {\n displayMode: \"button\",\n buttonBehavior: {\n mode: \"cycle\",\n cycleOrder: [1, 2, 3],\n requireConfirmation: false,\n lockAfterSelection: false,\n allowReselect: true,\n },\n },\n },\n },\n },\n {\n name: \"Option field (button dropdown w/ confirm)\",\n payload: {\n type: \"OptionField\",\n slug: \"status\",\n label: \"Status\",\n required: false,\n config: {\n options: [\n { id: 1, name: \"Open\", color: \"default\" },\n { id: 2, name: \"In Progress\", color: \"warning\" },\n { id: 3, name: \"Done\", color: \"success\" },\n ],\n defaultValue: 1,\n conditionalFormatting: [],\n buttonConfig: {\n displayMode: \"button\",\n buttonBehavior: {\n mode: \"dropdown\",\n requireConfirmation: true,\n confirmationMessage: \"Confirm status change\",\n useFixedLabel: true,\n buttonLabel: \"Set status\",\n allowReselect: true,\n },\n },\n },\n },\n },\n ],\n },\n {\n key: \"file\",\n className: \"FileField\",\n aliases: [\"file\", \"FileField\"],\n description: \"File attachment field.\",\n rawShape:\n '{\"type\":\"FileField\",\"slug\":\"attachment\",\"label\":\"Attachment\",\"config\":{}}',\n examplePayloads: [\n {\n name: \"File field\",\n payload: {\n type: \"FileField\",\n slug: \"attachment\",\n label: \"Attachment\",\n required: false,\n config: {},\n },\n },\n ],\n },\n {\n key: \"reference\",\n className: \"ReferenceField\",\n aliases: [\"reference\", \"ReferenceField\"],\n description: \"Reference to another schema.\",\n rawShape:\n '{\"type\":\"ReferenceField\",\"slug\":\"company-ref\",\"label\":\"Company\",\"config\":{\"targetSchema\":\"<schema-uuid>\",\"targetDisplayField\":\"<field-uuid>\"}}',\n examplePayloads: [\n {\n name: \"Reference field (minimal)\",\n payload: {\n type: \"ReferenceField\",\n slug: \"company-ref\",\n label: \"Company\",\n required: false,\n config: {\n targetSchema: \"5223cbc8-8c6c-4694-93bc-dd176364df9b\",\n targetDisplayField: \"c60b8526-5835-4c9f-aecd-9a16c7704a34\",\n },\n },\n },\n {\n name: \"Reference field (restrict + filter + description)\",\n payload: {\n type: \"ReferenceField\",\n slug: \"customer-ref\",\n label: \"Customer\",\n required: false,\n config: {\n targetSchema: \"5223cbc8-8c6c-4694-93bc-dd176364df9b\",\n targetDisplayField: \"c60b8526-5835-4c9f-aecd-9a16c7704a34\",\n deleteBehavior: \"RESTRICT\",\n defaultValue: \"CUST-12\",\n filterFields: [\n {\n fatherField: \"c60b8526-5835-4c9f-aecd-9a16c7704a34\",\n currentField: \"45c5da96-0dc2-4cc1-ba61-7660a9c6da32\",\n comparison: \"EQUAL\",\n value: null,\n },\n ],\n descriptionFields: [\n {\n id: \"c52efe3f-2825-4c60-a7e3-34dd4c1ce043\",\n fieldType: \"NumberField\",\n options: null,\n format: \"number\",\n },\n ],\n conditionalFormatting: [],\n },\n },\n },\n ],\n },\n {\n key: \"formula\",\n className: \"FormulaField\",\n aliases: [\"formula\", \"FormulaField\"],\n description: \"Calculated field from a formula.\",\n rawShape:\n '{\"type\":\"FormulaField\",\"slug\":\"formula-code\",\"label\":\"Formula Code\",\"config\":{\"formulaText\":\"concat(\\\\\"CUST-\\\\\", f1e1d000-0000-0000-0000-000000000005)\",\"uiFormatKind\":\"none\"}}',\n examplePayloads: [\n {\n name: \"Formula field (none)\",\n payload: {\n type: \"FormulaField\",\n slug: \"formula-code\",\n label: \"Formula Code\",\n required: false,\n config: {\n formulaText:\n 'concat(\"CUST-\", f1e1d000-0000-0000-0000-000000000005)',\n uiFormatKind: \"none\",\n status: \"ACTIVE\",\n conditionalFormatting: [],\n },\n },\n },\n {\n name: \"Formula field (number)\",\n payload: {\n type: \"FormulaField\",\n slug: \"formula-total\",\n label: \"Formula Total\",\n required: false,\n config: {\n formulaText: \"c52efe3f-2825-4c60-a7e3-34dd4c1ce043 * 1.21\",\n uiFormatKind: \"number\",\n status: \"ACTIVE\",\n numberFormatOptions: {\n format: \"number\",\n decimals: 2,\n thousandsSeparator: true,\n },\n conditionalFormatting: [],\n },\n },\n },\n {\n name: \"Formula field (date)\",\n payload: {\n type: \"FormulaField\",\n slug: \"formula-period\",\n label: \"Formula Period\",\n required: false,\n config: {\n formulaText:\n 'date_format(d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90, \"AAAA-MM\")',\n uiFormatKind: \"date\",\n status: \"ACTIVE\",\n dateFormatOptions: {\n format: \"date\",\n dateFormat: \"DD/MM/YYYY\",\n showTime: false,\n },\n conditionalFormatting: [],\n },\n },\n },\n {\n name: \"Formula field (member)\",\n payload: {\n type: \"FormulaField\",\n slug: \"formula-assignee\",\n label: \"Computed Assignee\",\n required: false,\n config: {\n formulaText: \"a7b8c9d0-e1f2-3a4b-5c6d-7e8f90123456\",\n uiFormatKind: \"member\",\n status: \"ACTIVE\",\n conditionalFormatting: [],\n },\n },\n },\n ],\n },\n {\n key: \"member\",\n className: \"MemberField\",\n aliases: [\"member\", \"MemberField\"],\n description: \"Workspace member field.\",\n rawShape:\n '{\"type\":\"MemberField\",\"slug\":\"owner\",\"label\":\"Owner\",\"config\":{\"defaultValue\":null}}',\n examplePayloads: [\n {\n name: \"Member field\",\n payload: {\n type: \"MemberField\",\n slug: \"owner\",\n label: \"Owner\",\n required: false,\n config: {\n defaultValue: null,\n conditionalFormatting: [],\n },\n },\n },\n ],\n },\n {\n key: \"autoincremental\",\n className: \"AutoIncrementalField\",\n aliases: [\n \"autoincremental\",\n \"auto-incremental\",\n \"auto_incremental\",\n \"AutoIncrementalField\",\n ],\n description: \"Auto-generated incremental counter.\",\n rawShape:\n '{\"type\":\"AutoIncrementalField\",\"slug\":\"order-number\",\"label\":\"Order Number\",\"config\":{\"segmentedByFieldId\":null}}',\n examplePayloads: [\n {\n name: \"Autoincremental (global counter)\",\n payload: {\n type: \"AutoIncrementalField\",\n slug: \"order-number\",\n label: \"Order Number\",\n required: false,\n config: {\n segmentedByFieldId: null,\n conditionalFormatting: [],\n },\n },\n },\n {\n name: \"Autoincremental (segmented)\",\n payload: {\n type: \"AutoIncrementalField\",\n slug: \"sequence-code\",\n label: \"Sequence Code\",\n required: false,\n config: {\n segmentedByFieldId: \"45c5da96-0dc2-4cc1-ba61-7660a9c6da32\",\n conditionalFormatting: [],\n },\n },\n },\n ],\n },\n {\n key: \"schedule\",\n className: \"ScheduleField\",\n aliases: [\"schedule\", \"ScheduleField\"],\n description:\n \"Recurrence/schedule field bound to a number reference and a date period (frequency: monthly or daily).\",\n rawShape:\n '{\"type\":\"ScheduleField\",\"slug\":\"recurrence\",\"label\":\"Recurrence\",\"config\":{\"referenceField\":\"<number-field-uuid>\",\"beginningPeriodField\":\"<date-field-uuid>\",\"endingPeriodField\":\"<date-field-uuid>\",\"frequency\":\"monthly\"}}',\n examplePayloads: [\n {\n name: \"Schedule field (monthly)\",\n payload: {\n type: \"ScheduleField\",\n slug: \"monthly-recurrence\",\n label: \"Monthly Recurrence\",\n required: false,\n config: {\n referenceField: \"c52efe3f-2825-4c60-a7e3-34dd4c1ce043\",\n beginningPeriodField: \"d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90\",\n endingPeriodField: \"d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90\",\n frequency: \"monthly\",\n },\n },\n },\n {\n name: \"Schedule field (daily)\",\n payload: {\n type: \"ScheduleField\",\n slug: \"daily-recurrence\",\n label: \"Daily Recurrence\",\n required: false,\n config: {\n referenceField: \"c52efe3f-2825-4c60-a7e3-34dd4c1ce043\",\n beginningPeriodField: \"d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90\",\n endingPeriodField: \"d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90\",\n frequency: \"daily\",\n },\n },\n },\n ],\n },\n] as const satisfies readonly SchemaFieldTypeDefinition[];\n\nconst fieldTypeDefinitionByAlias = new Map(\n fieldTypeDefinitions.flatMap((definition) =>\n definition.aliases.map((alias) => [alias.trim().toLowerCase(), definition] as const),\n ),\n);\n\nconst fieldTypeDefinitionByClassName = new Map<string, SchemaFieldTypeDefinition>(\n fieldTypeDefinitions.map((definition) => [definition.className, definition] as const),\n);\n\nconst optionValidationMessage =\n 'Option fields require an \"options\" array with at least one entry like {\"id\":1,\"name\":\"Open\",\"color\":\"default\"}.';\n\n// Mirrors the frontend OptionColorId palette; the UI rejects any other value.\nexport const OPTION_COLORS = [\n \"none\",\n \"default\",\n \"secondary\",\n \"success\",\n \"warning\",\n \"cond-verde-intenso\",\n \"cond-positivo\",\n \"cond-naranja\",\n \"cond-destacado\",\n \"cond-negativo\",\n \"cond-critico\",\n \"cond-morado\",\n \"cond-bajo\",\n \"cond-azul-intenso\",\n \"cond-vacio\",\n \"cond-gris-oscuro\",\n \"cond-rosa\",\n \"cond-morado-medio\",\n \"cond-azul-medio\",\n \"cond-amarillo-claro\",\n \"cond-amarillo-oscuro\",\n \"cond-naranja-medio\",\n] as const;\n\nconst optionColorSet = new Set<string>(OPTION_COLORS);\n\nexport function getSchemaFieldTypeDefinitions(): readonly SchemaFieldTypeDefinition[] {\n return fieldTypeDefinitions;\n}\n\nexport function listSchemaFieldTypes(): readonly SchemaFieldTypeKey[] {\n return fieldTypeDefinitions.map((definition) => definition.key);\n}\n\nexport function formatSchemaFieldTypes(): string {\n return listSchemaFieldTypes().join(\", \");\n}\n\nexport function resolveSchemaFieldType(\n input: string | undefined,\n): SchemaFieldTypeDefinition | undefined {\n if (!input) {\n return undefined;\n }\n\n return fieldTypeDefinitionByAlias.get(input.trim().toLowerCase());\n}\n\nexport function resolveSchemaFieldTypeByClassName(\n className: string | undefined,\n): SchemaFieldTypeDefinition | undefined {\n if (!className) {\n return undefined;\n }\n\n return fieldTypeDefinitionByClassName.get(className);\n}\n\nexport function normalizeSchemaFieldType(input: string): string {\n const definition = resolveSchemaFieldType(input);\n\n if (definition) {\n return definition.className;\n }\n\n if (/^[a-z]/.test(input) && !input.endsWith(\"Field\")) {\n return `${input.charAt(0).toUpperCase()}${input.slice(1)}Field`;\n }\n\n return input;\n}\n\nexport function assertSupportedSchemaFieldType(type: string): void {\n if (!resolveSchemaFieldTypeByClassName(type)) {\n throw new CliError(\n \"invalid_cli_usage\",\n `Unsupported field type \"${type}\". Valid types: ${formatSchemaFieldTypes()}.`,\n );\n }\n}\n\ninterface OptionEntry {\n [key: string]: string | number;\n id: number;\n name: string;\n color: string;\n}\n\nfunction normalizeOptionEntries(entries: readonly unknown[]): OptionEntry[] {\n const namesById = new Map<number, string>();\n const seenNames = new Set<string>();\n\n return entries.map((entry, index) => {\n if (!isJsonObject(entry)) {\n throw new CliError(\n \"invalid_cli_usage\",\n `Option ${index + 1} must be an object like {\"id\":1,\"name\":\"Open\",\"color\":\"default\"}.`,\n );\n }\n\n const name = toStringValue(entry.name) ?? toStringValue(entry.label);\n const color = toStringValue(entry.color) ?? \"default\";\n\n if (!name) {\n throw new CliError(\n \"invalid_cli_usage\",\n `Option ${index + 1} requires a non-empty \"name\".`,\n );\n }\n\n if (entry.id === undefined || entry.id === null) {\n throw new CliError(\n \"invalid_cli_usage\",\n `Option \"${name}\" requires a numeric \"id\" (unique integer >= 0), e.g. {\"id\":1,\"name\":\"Open\",\"color\":\"default\"}.`,\n );\n }\n\n const id = toNumberValue(entry.id);\n\n if (id === undefined || !Number.isInteger(id) || id < 0) {\n throw new CliError(\n \"invalid_cli_usage\",\n `Invalid option id ${JSON.stringify(entry.id)} for option \"${name}\". Option ids must be integers >= 0.`,\n );\n }\n\n const optionWithSameId = namesById.get(id);\n if (optionWithSameId !== undefined) {\n throw new CliError(\n \"invalid_cli_usage\",\n `Duplicate option id ${id} for options \"${optionWithSameId}\" and \"${name}\". Option ids must be unique.`,\n );\n }\n\n const nameKey = name.trim().toLowerCase();\n if (seenNames.has(nameKey)) {\n throw new CliError(\n \"invalid_cli_usage\",\n `Duplicate option name \"${name}\". Option names must be unique (case-insensitive).`,\n );\n }\n\n if (!optionColorSet.has(color)) {\n throw new CliError(\n \"invalid_cli_usage\",\n `Invalid option color \"${color}\" for option \"${name}\". Valid colors: ${OPTION_COLORS.join(\", \")}.`,\n );\n }\n\n namesById.set(id, name);\n seenNames.add(nameKey);\n return { id, name, color };\n });\n}\n\nfunction hasOptionEntries(input: JsonObject): boolean {\n return [\n input.options,\n toJsonObject(input.config)?.options,\n toJsonObject(input.additionalProperties)?.options,\n ].some((options) => options !== undefined);\n}\n\nfunction normalizeOptionPayload(input: JsonObject): JsonObject {\n const additionalProperties = toJsonObject(input.additionalProperties) ?? {};\n const config = toJsonObject(input.config);\n const rootOptions = Array.isArray(input.options) ? input.options : undefined;\n const nestedOptions = Array.isArray(additionalProperties.options)\n ? additionalProperties.options\n : Array.isArray(config?.options)\n ? config.options\n : undefined;\n const optionObjects = normalizeOptionEntries(\n nestedOptions ??\n (Array.isArray(rootOptions) ? rootOptions : []),\n );\n\n if (optionObjects.length === 0) {\n throw new CliError(\"invalid_cli_usage\", optionValidationMessage);\n }\n\n const { options: _options, additionalProperties: _additionalProperties, ...rest } = input;\n const defaultValue =\n config?.defaultValue ?? input.defaultValue ?? additionalProperties.defaultValue;\n const conditionalFormatting =\n config?.conditionalFormatting ?? additionalProperties.conditionalFormatting;\n const buttonConfig = config?.buttonConfig ?? additionalProperties.buttonConfig;\n\n return {\n ...rest,\n config: {\n ...(config ?? {}),\n options: optionObjects,\n ...(defaultValue !== undefined ? { defaultValue } : {}),\n ...(conditionalFormatting !== undefined ? { conditionalFormatting } : {}),\n ...(buttonConfig !== undefined ? { buttonConfig } : {}),\n },\n };\n}\n\nfunction normalizeReferencePayload(input: JsonObject): JsonObject {\n const additionalProperties = toJsonObject(input.additionalProperties) ?? {};\n const config = toJsonObject(input.config) ?? {};\n const targetSchema =\n config.targetSchema ?? input.targetSchema ?? additionalProperties.targetSchema;\n const targetDisplayField =\n config.targetDisplayField ??\n input.targetDisplayField ??\n additionalProperties.targetDisplayField;\n const deleteBehavior =\n config.deleteBehavior ?? input.deleteBehavior ?? additionalProperties.deleteBehavior;\n const defaultValue =\n config.defaultValue ?? input.defaultValue ?? additionalProperties.defaultValue;\n const filterFields =\n config.filterFields ?? input.filterFields ?? additionalProperties.filterFields;\n const descriptionFields =\n config.descriptionFields ??\n input.descriptionFields ??\n additionalProperties.descriptionFields;\n const conditionalFormatting =\n config.conditionalFormatting ??\n input.conditionalFormatting ??\n additionalProperties.conditionalFormatting;\n\n const normalized: JsonObject = {\n ...input,\n };\n\n normalized.config = {\n ...config,\n ...(targetSchema !== undefined ? { targetSchema } : {}),\n ...(targetDisplayField !== undefined ? { targetDisplayField } : {}),\n ...(deleteBehavior !== undefined ? { deleteBehavior } : {}),\n ...(defaultValue !== undefined ? { defaultValue } : {}),\n ...(filterFields !== undefined ? { filterFields } : {}),\n ...(descriptionFields !== undefined ? { descriptionFields } : {}),\n ...(conditionalFormatting !== undefined ? { conditionalFormatting } : {}),\n };\n\n const normalizedConfig = toJsonObject(normalized.config) ?? {};\n\n if (\n !toStringValue(normalizedConfig.targetSchema) ||\n !toStringValue(normalizedConfig.targetDisplayField)\n ) {\n const definition = resolveSchemaFieldType(\"reference\")!;\n throw new CliError(\n \"invalid_cli_usage\",\n `Reference fields require \"targetSchema\" and \"targetDisplayField\". Expected raw shape: ${definition.rawShape}`,\n );\n }\n\n return normalized;\n}\n\nconst scheduleAllowedFrequencies = new Set([\"monthly\", \"daily\"]);\n\nfunction normalizeSchedulePayload(input: JsonObject): JsonObject {\n const additionalProperties = toJsonObject(input.additionalProperties) ?? {};\n const config = toJsonObject(input.config) ?? {};\n const referenceField =\n config.referenceField ?? input.referenceField ?? additionalProperties.referenceField;\n const beginningPeriodField =\n config.beginningPeriodField ??\n input.beginningPeriodField ??\n additionalProperties.beginningPeriodField;\n const endingPeriodField =\n config.endingPeriodField ??\n input.endingPeriodField ??\n additionalProperties.endingPeriodField;\n const frequency =\n config.frequency ?? input.frequency ?? additionalProperties.frequency;\n\n const {\n referenceField: _referenceField,\n beginningPeriodField: _beginningPeriodField,\n endingPeriodField: _endingPeriodField,\n frequency: _frequency,\n additionalProperties: _additionalProperties,\n ...rest\n } = input;\n\n const normalized: JsonObject = {\n ...rest,\n config: {\n ...config,\n ...(referenceField !== undefined ? { referenceField } : {}),\n ...(beginningPeriodField !== undefined ? { beginningPeriodField } : {}),\n ...(endingPeriodField !== undefined ? { endingPeriodField } : {}),\n ...(frequency !== undefined ? { frequency } : {}),\n },\n };\n\n const normalizedConfig = toJsonObject(normalized.config) ?? {};\n const definition = resolveSchemaFieldType(\"schedule\")!;\n\n if (\n !toStringValue(normalizedConfig.referenceField) ||\n !toStringValue(normalizedConfig.beginningPeriodField) ||\n !toStringValue(normalizedConfig.endingPeriodField) ||\n !toStringValue(normalizedConfig.frequency)\n ) {\n throw new CliError(\n \"invalid_cli_usage\",\n `Schedule fields require \"referenceField\", \"beginningPeriodField\", \"endingPeriodField\" and \"frequency\". Expected raw shape: ${definition.rawShape}`,\n );\n }\n\n const frequencyValue = toStringValue(normalizedConfig.frequency)!;\n if (!scheduleAllowedFrequencies.has(frequencyValue)) {\n throw new CliError(\n \"invalid_cli_usage\",\n `Schedule \"frequency\" must be \"monthly\" or \"daily\" (received \"${frequencyValue}\").`,\n );\n }\n\n return normalized;\n}\n\nfunction normalizeFormulaPayload(input: JsonObject): JsonObject {\n const { status: _status, ...rest } = input;\n const rawAdditionalProperties = toJsonObject(input.additionalProperties);\n const rawConfig = toJsonObject(input.config);\n const { status: _additionalStatus, ...additionalProperties } =\n rawAdditionalProperties ?? {};\n const { status: _configStatus, ...config } = rawConfig ?? {};\n const formulaText =\n config.formulaText ??\n rest.formulaText ??\n rest.expression ??\n additionalProperties.formulaText ??\n additionalProperties.expression;\n\n const normalized: JsonObject = {\n ...rest,\n };\n\n normalized.config = {\n ...config,\n ...(formulaText !== undefined ? { formulaText } : {}),\n ...(config.uiFormatKind !== undefined ? { uiFormatKind: config.uiFormatKind } : {}),\n ...(config.defaultValue !== undefined ? { defaultValue: config.defaultValue } : {}),\n ...(config.numberFormatOptions !== undefined\n ? { numberFormatOptions: config.numberFormatOptions }\n : {}),\n ...(config.dateFormatOptions !== undefined\n ? { dateFormatOptions: config.dateFormatOptions }\n : {}),\n ...(config.conditionalFormatting !== undefined\n ? { conditionalFormatting: config.conditionalFormatting }\n : {}),\n };\n\n const normalizedConfig = toJsonObject(normalized.config) ?? {};\n\n if (!toStringValue(normalizedConfig.formulaText)) {\n const definition = resolveSchemaFieldType(\"formula\")!;\n throw new CliError(\n \"invalid_cli_usage\",\n `Formula fields require \"formulaText\". Expected raw shape: ${definition.rawShape}`,\n );\n }\n\n return normalized;\n}\n\nexport function normalizeSchemaFieldCreatePayload(input: JsonObject): JsonObject {\n const rawType = toStringValue(input.type);\n const normalizedType = rawType ? normalizeSchemaFieldType(rawType) : undefined;\n const definition = resolveSchemaFieldTypeByClassName(normalizedType);\n\n if (!definition) {\n return input;\n }\n\n const normalizedWithType: JsonObject = {\n ...input,\n type: definition.className,\n };\n\n switch (definition.key) {\n case \"option\":\n return normalizeOptionPayload(normalizedWithType);\n case \"reference\":\n return normalizeReferencePayload(normalizedWithType);\n case \"formula\":\n return normalizeFormulaPayload(normalizedWithType);\n case \"schedule\":\n return normalizeSchedulePayload(normalizedWithType);\n case \"autoincremental\": {\n const config = toJsonObject(normalizedWithType.config) ?? {};\n const segmentedByFieldId =\n config.segmentedByFieldId ??\n normalizedWithType.segmentedByFieldId ??\n null;\n return {\n ...normalizedWithType,\n config: {\n ...config,\n segmentedByFieldId,\n ...(config.conditionalFormatting !== undefined\n ? { conditionalFormatting: config.conditionalFormatting }\n : {}),\n },\n };\n }\n default:\n return normalizedWithType;\n }\n}\n\nexport function normalizeSchemaFieldUpdatePayload(\n type: string,\n input: JsonObject,\n): JsonObject {\n const definition = resolveSchemaFieldTypeByClassName(type);\n\n if (definition?.key === \"formula\") {\n return normalizeFormulaPayload(input);\n }\n\n // A patch replaces the whole option list, so validate it like a create when it is sent.\n if (definition?.key === \"option\" && hasOptionEntries(input)) {\n return normalizeOptionPayload(input);\n }\n\n return input;\n}\n\nexport function buildSchemaFieldCreateHelpText(): string {\n const sections = fieldTypeDefinitions.map(\n (definition) =>\n ` - ${definition.key}: ${definition.description}\\n raw: ${definition.rawShape}`,\n );\n\n return [\n \"\",\n \"Valid field types:\",\n ` ${formatSchemaFieldTypes()}`,\n \"\",\n \"Raw payload shapes by type:\",\n ...sections,\n \"\",\n 'Use \"zinkee --example schemas fields create --type <type>\" to show a concrete example for one type.',\n ].join(\"\\n\");\n}\n\nexport function buildSchemaFieldCreateValidationMessage(type: string): string {\n const definition = resolveSchemaFieldTypeByClassName(type);\n\n if (!definition) {\n return `Invalid payload for field type \"${type}\". Valid types: ${formatSchemaFieldTypes()}.`;\n }\n\n return `Invalid payload for field type \"${definition.key}\". Expected raw shape: ${definition.rawShape}`;\n}\n"],"mappings":";AAAA,SAAS,qBAAqB;AAQ9B,IAAMA,WAAU,cAAc,YAAY,GAAG;AAM7C,SAAS,mBAAmB,OAAwB;AAClD,MAAI,UAAU,QAAQ,UAAU,QAAW;AACzC,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,UAAU,YAAY,OAAO,UAAU,aAAa,OAAO,UAAU,UAAU;AACxF,WAAO,OAAO,KAAK;AAAA,EACrB;AAEA,SAAO,KAAK,UAAU,KAAK;AAC7B;AAEO,SAAS,iBACd,MACA,OAAc,CAAC,GACoB;AACnC,SAAO,EAAE,MAAM,KAAK;AACtB;AAEO,SAAS,eACd,OACA,OAAc,CAAC,GACiB;AAChC,SAAO,EAAE,OAAO,KAAK;AACvB;AASO,IAAM,oBAAoB,CAAC,YAAY,cAAc,cAAc;AAOnE,SAAS,cAAc,QAI5B;AACA,MAAI,CAAC,QAAQ;AACX,WAAO,EAAE,UAAU,IAAI,YAAY,IAAI,cAAc,GAAG;AAAA,EAC1D;AAEA,SAAO;AAAA,IACL,UAAU,OAAO,MAAM;AAAA,IACvB,YAAY,OAAO,SAAS,OAAO,WAAW,OAAO,WAAW;AAAA,IAChE,cAAc,OAAO,WAAW,SAAY,KAAK,OAAO,OAAO,MAAM;AAAA,EACvE;AACF;AAEO,SAAS,WACd,MACA,MACA,QACM;AACN,QAAM,SAAS,UAAU,QAAQ;AACjC,QAAM,WAAW,KAAK,CAAC;AAEvB,MAAI,CAAC,UAAU;AAC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EA,SAAO,mCAAmC,WAAW,GAAG,0BAA0B,WAAW,QAAQ;AACvG;","names":["require","createRequire","require"]}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
buildJsonSuccess,
|
|
3
3
|
getSchemaFieldTypeDefinitions,
|
|
4
4
|
resolveSchemaFieldType
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-W3BI6KES.js";
|
|
6
6
|
|
|
7
7
|
// src/utils/examples.ts
|
|
8
8
|
var SAMPLE_UUID = "550e8400-e29b-41d4-a716-446655440001";
|
|
@@ -669,6 +669,43 @@ var specificExamples = {
|
|
|
669
669
|
{ "field": "contact-name", "direction": "ASC" }
|
|
670
670
|
],
|
|
671
671
|
"page": { "offset": 0, "limit": 25 }
|
|
672
|
+
}`
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
description: "OR between different fields with a nested AND group. --where-json takes the native where: an array of conditions (AND) or a single condition/group object.",
|
|
676
|
+
command: `zinkee --json records query deals --select id,deal-name,status,amount,close-date --where-json '{"or":[{"and":[{"field":"status","op":"eq","value":"OPEN"},{"field":"amount","op":"gt","value":10000}]},{"field":"close-date","op":"between","value":["2026-10-01","2026-10-31"]}]}' --sort amount:desc --limit 25`,
|
|
677
|
+
raw: `{
|
|
678
|
+
"select": ["id", "deal-name", "status", "amount", "close-date"],
|
|
679
|
+
"where": {
|
|
680
|
+
"or": [
|
|
681
|
+
{
|
|
682
|
+
"and": [
|
|
683
|
+
{ "field": "status", "op": "eq", "value": "OPEN" },
|
|
684
|
+
{ "field": "amount", "op": "gt", "value": 10000 }
|
|
685
|
+
]
|
|
686
|
+
},
|
|
687
|
+
{ "field": "close-date", "op": "between", "value": ["2026-10-01", "2026-10-31"] }
|
|
688
|
+
]
|
|
689
|
+
},
|
|
690
|
+
"sort": [
|
|
691
|
+
{ "field": "amount", "direction": "DESC" }
|
|
692
|
+
],
|
|
693
|
+
"page": { "offset": 0, "limit": 25 }
|
|
694
|
+
}`
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
description: "Array of conditions (implicit AND) with an OR group that mixes id in and not_contains, sent as a raw payload.",
|
|
698
|
+
command: `zinkee --json records query deals --raw '{"where":[{"field":"status","op":"neq","value":"LOST"},{"or":[{"field":"id","op":"in","value":["550e8400-e29b-41d4-a716-446655440000","6fa459ea-ee8a-3ca4-894e-db77e160355e"]},{"field":"deal-name","op":"not_contains","value":"test"}]}]}'`,
|
|
699
|
+
raw: `{
|
|
700
|
+
"where": [
|
|
701
|
+
{ "field": "status", "op": "neq", "value": "LOST" },
|
|
702
|
+
{
|
|
703
|
+
"or": [
|
|
704
|
+
{ "field": "id", "op": "in", "value": ["550e8400-e29b-41d4-a716-446655440000", "6fa459ea-ee8a-3ca4-894e-db77e160355e"] },
|
|
705
|
+
{ "field": "deal-name", "op": "not_contains", "value": "test" }
|
|
706
|
+
]
|
|
707
|
+
}
|
|
708
|
+
]
|
|
672
709
|
}`
|
|
673
710
|
},
|
|
674
711
|
{
|
|
@@ -692,6 +729,24 @@ var specificExamples = {
|
|
|
692
729
|
{ "field": "contact-name", "op": "contains", "value": "Lovelace" }
|
|
693
730
|
],
|
|
694
731
|
"page": { "offset": 0, "limit": 50 }
|
|
732
|
+
}`
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
description: "Text does not contain search.",
|
|
736
|
+
command: 'zinkee --json records query contacts --where "contact-name not_contains test"',
|
|
737
|
+
raw: `{
|
|
738
|
+
"where": [
|
|
739
|
+
{ "field": "contact-name", "op": "not_contains", "value": "test" }
|
|
740
|
+
]
|
|
741
|
+
}`
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
description: "Records whose due-date is between two dates (both included).",
|
|
745
|
+
command: 'zinkee --json records query contacts --where "due-date between 2026-10-01,2026-10-31"',
|
|
746
|
+
raw: `{
|
|
747
|
+
"where": [
|
|
748
|
+
{ "field": "due-date", "op": "between", "value": ["2026-10-01", "2026-10-31"] }
|
|
749
|
+
]
|
|
695
750
|
}`
|
|
696
751
|
},
|
|
697
752
|
{
|
|
@@ -827,6 +882,23 @@ var specificExamples = {
|
|
|
827
882
|
"action": "Use an existing record id or an existing display value for this reference field."
|
|
828
883
|
}
|
|
829
884
|
]
|
|
885
|
+
}`
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
description: "Create a record safely retryable with --idempotency-key (1-128 of A-Z a-z 0-9 . _ : -). Re-running the same command with the same key within 24 h returns the first response instead of creating it again; the same key with a different payload fails with 422 'idempotency_key_reused'. Use a new key for each distinct write.",
|
|
889
|
+
command: `zinkee --json records create contacts --set contact-name="Ada Lovelace" --idempotency-key import-2026-10-22-row-17`,
|
|
890
|
+
raw: `{
|
|
891
|
+
"records": [
|
|
892
|
+
{
|
|
893
|
+
"contact-name": "Ada Lovelace"
|
|
894
|
+
}
|
|
895
|
+
]
|
|
896
|
+
}`,
|
|
897
|
+
response: `{
|
|
898
|
+
"created": [
|
|
899
|
+
"550e8400-e29b-41d4-a716-446655440000"
|
|
900
|
+
],
|
|
901
|
+
"errors": []
|
|
830
902
|
}`
|
|
831
903
|
}
|
|
832
904
|
],
|
|
@@ -4482,4 +4554,4 @@ function withResponseEnvelope(example, commandName) {
|
|
|
4482
4554
|
export {
|
|
4483
4555
|
getCommandExamples
|
|
4484
4556
|
};
|
|
4485
|
-
//# sourceMappingURL=examples-
|
|
4557
|
+
//# sourceMappingURL=examples-VXDDPC3X.js.map
|