zinkee 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +3 -1
- package/README.md +36 -16
- package/dist/index.js +975 -147
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/schemas.test.ts +93 -6
- package/src/index.test.ts +10 -5
- package/src/utils/examples.test.ts +44 -8
- package/src/utils/examples.ts +447 -66
- package/src/utils/schema-fields.ts +571 -86
package/src/utils/examples.ts
CHANGED
|
@@ -225,14 +225,10 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
225
225
|
]),
|
|
226
226
|
"schemas update": buildCommandExamples([
|
|
227
227
|
{
|
|
228
|
-
description: "
|
|
229
|
-
command:
|
|
230
|
-
'zinkee --json schemas update contacts --name "Customer Contacts" --slug customer-contacts',
|
|
228
|
+
description: "Toggle the commentable flag on a schema.",
|
|
229
|
+
command: 'zinkee --json schemas update contacts --commentable true',
|
|
231
230
|
raw: `{
|
|
232
|
-
"
|
|
233
|
-
"name": "Customer Contacts",
|
|
234
|
-
"slug": "customer-contacts"
|
|
235
|
-
}
|
|
231
|
+
"commentable": true
|
|
236
232
|
}`,
|
|
237
233
|
response: `{
|
|
238
234
|
"id": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
|
|
@@ -245,38 +241,48 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
245
241
|
},
|
|
246
242
|
"auditable": true,
|
|
247
243
|
"commentable": true,
|
|
248
|
-
"fields": [
|
|
244
|
+
"fields": [
|
|
245
|
+
{
|
|
246
|
+
"id": "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
247
|
+
"type": "TextField",
|
|
248
|
+
"slug": "contact-name",
|
|
249
|
+
"label": "Customer Name",
|
|
250
|
+
"required": true,
|
|
251
|
+
"system": false,
|
|
252
|
+
"config": {
|
|
253
|
+
"textType": "LONG",
|
|
254
|
+
"defaultValue": "Unknown",
|
|
255
|
+
"conditionalFormatting": []
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
]
|
|
249
259
|
}`,
|
|
250
260
|
},
|
|
251
261
|
{
|
|
252
|
-
description: "
|
|
253
|
-
command:
|
|
262
|
+
description: "Rename a schema and change its slug.",
|
|
263
|
+
command:
|
|
264
|
+
'zinkee --json schemas update contacts --name "Customer Contacts" --slug customer-contacts',
|
|
254
265
|
raw: `{
|
|
255
|
-
"
|
|
256
|
-
|
|
257
|
-
}
|
|
266
|
+
"name": "Customer Contacts",
|
|
267
|
+
"slug": "customer-contacts"
|
|
258
268
|
}`,
|
|
259
269
|
},
|
|
260
270
|
{
|
|
261
|
-
description: "
|
|
262
|
-
command: 'zinkee --json schemas update contacts --
|
|
271
|
+
description: "Enable the audit log on a schema.",
|
|
272
|
+
command: 'zinkee --json schemas update contacts --auditable true',
|
|
263
273
|
raw: `{
|
|
264
|
-
"
|
|
265
|
-
"commentable": false
|
|
266
|
-
}
|
|
274
|
+
"auditable": true
|
|
267
275
|
}`,
|
|
268
276
|
},
|
|
269
277
|
]),
|
|
270
278
|
"schemas fields update": buildCommandExamples([
|
|
271
279
|
{
|
|
272
|
-
description: "Rename
|
|
280
|
+
description: "Rename slug and label.",
|
|
273
281
|
command:
|
|
274
|
-
|
|
282
|
+
`zinkee --json schemas fields update contacts contact-name --label "Customer Full Name" --raw '{"slug":"customer-full-name"}'`,
|
|
275
283
|
raw: `{
|
|
276
|
-
"
|
|
277
|
-
|
|
278
|
-
"required": false
|
|
279
|
-
}
|
|
284
|
+
"slug": "customer-full-name",
|
|
285
|
+
"label": "Customer Full Name"
|
|
280
286
|
}`,
|
|
281
287
|
response: `{
|
|
282
288
|
"schemaId": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
|
|
@@ -285,28 +291,171 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
285
291
|
}`,
|
|
286
292
|
},
|
|
287
293
|
{
|
|
288
|
-
description: "
|
|
289
|
-
command:
|
|
294
|
+
description: "Toggle required.",
|
|
295
|
+
command: "zinkee --json schemas fields update contacts status --required true",
|
|
290
296
|
raw: `{
|
|
291
|
-
"
|
|
292
|
-
|
|
297
|
+
"required": true
|
|
298
|
+
}`,
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
description: "Patch text field (long with default).",
|
|
302
|
+
command:
|
|
303
|
+
`zinkee --json schemas fields update contacts contact-name --raw '{"type":"TextField","label":"Customer Full Name","required":false,"config":{"textType":"LONG","defaultValue":"Unknown","conditionalFormatting":[]}}'`,
|
|
304
|
+
raw: `{
|
|
305
|
+
"type": "TextField",
|
|
306
|
+
"label": "Customer Full Name",
|
|
307
|
+
"required": false,
|
|
308
|
+
"config": {
|
|
309
|
+
"textType": "LONG",
|
|
310
|
+
"defaultValue": "Unknown",
|
|
311
|
+
"conditionalFormatting": []
|
|
293
312
|
}
|
|
294
313
|
}`,
|
|
295
314
|
},
|
|
296
315
|
{
|
|
297
|
-
description:
|
|
298
|
-
"Patch the format options of a number field through a raw set payload (no dedicated flag exists for nested config paths).",
|
|
316
|
+
description: "Patch number field (to currency).",
|
|
299
317
|
command:
|
|
300
|
-
`zinkee --json schemas fields update contacts amount --raw '{"
|
|
318
|
+
`zinkee --json schemas fields update contacts amount --raw '{"type":"NumberField","config":{"defaultValue":"0","formatOptions":{"format":"currency","decimals":2,"thousandsSeparator":true,"symbolEnabled":true,"symbolPosition":"before","symbolValue":"€"},"conditionalFormatting":[]}}'`,
|
|
301
319
|
raw: `{
|
|
302
|
-
"
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
320
|
+
"type": "NumberField",
|
|
321
|
+
"config": {
|
|
322
|
+
"defaultValue": "0",
|
|
323
|
+
"formatOptions": {
|
|
324
|
+
"format": "currency",
|
|
325
|
+
"decimals": 2,
|
|
326
|
+
"thousandsSeparator": true,
|
|
327
|
+
"symbolEnabled": true,
|
|
328
|
+
"symbolPosition": "before",
|
|
329
|
+
"symbolValue": "€"
|
|
330
|
+
},
|
|
331
|
+
"conditionalFormatting": []
|
|
332
|
+
}
|
|
333
|
+
}`,
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
description: "Patch number field (to percentage).",
|
|
337
|
+
command:
|
|
338
|
+
`zinkee --json schemas fields update contacts discount-rate --raw '{"type":"NumberField","config":{"defaultValue":"0","formatOptions":{"format":"percentage","decimals":1},"conditionalFormatting":[]}}'`,
|
|
339
|
+
raw: `{
|
|
340
|
+
"type": "NumberField",
|
|
341
|
+
"config": {
|
|
342
|
+
"defaultValue": "0",
|
|
343
|
+
"formatOptions": {
|
|
344
|
+
"format": "percentage",
|
|
345
|
+
"decimals": 1
|
|
346
|
+
},
|
|
347
|
+
"conditionalFormatting": []
|
|
348
|
+
}
|
|
349
|
+
}`,
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
description: "Patch date field (to date only).",
|
|
353
|
+
command:
|
|
354
|
+
`zinkee --json schemas fields update contacts due-date --raw '{"type":"DateField","config":{"defaultValue":null,"formatOptions":{"format":"date","dateFormat":"YYYY-MM-DD","showTime":false},"conditionalFormatting":[]}}'`,
|
|
355
|
+
raw: `{
|
|
356
|
+
"type": "DateField",
|
|
357
|
+
"config": {
|
|
358
|
+
"defaultValue": null,
|
|
359
|
+
"formatOptions": {
|
|
360
|
+
"format": "date",
|
|
361
|
+
"dateFormat": "YYYY-MM-DD",
|
|
362
|
+
"showTime": false
|
|
363
|
+
},
|
|
364
|
+
"conditionalFormatting": []
|
|
365
|
+
}
|
|
366
|
+
}`,
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
description: "Patch option field (button cycle).",
|
|
370
|
+
command:
|
|
371
|
+
`zinkee --json schemas fields update contacts stage --raw '{"type":"OptionField","config":{"options":[{"id":1,"name":"To Do","color":"default"},{"id":2,"name":"Doing","color":"warning"},{"id":3,"name":"Done","color":"success"}],"defaultValue":1,"conditionalFormatting":[],"buttonConfig":{"displayMode":"button","buttonBehavior":{"mode":"cycle","cycleOrder":[1,2,3],"allowReselect":true}}}}'`,
|
|
372
|
+
raw: `{
|
|
373
|
+
"type": "OptionField",
|
|
374
|
+
"config": {
|
|
375
|
+
"options": [
|
|
376
|
+
{ "id": 1, "name": "To Do", "color": "default" },
|
|
377
|
+
{ "id": 2, "name": "Doing", "color": "warning" },
|
|
378
|
+
{ "id": 3, "name": "Done", "color": "success" }
|
|
379
|
+
],
|
|
380
|
+
"defaultValue": 1,
|
|
381
|
+
"conditionalFormatting": [],
|
|
382
|
+
"buttonConfig": {
|
|
383
|
+
"displayMode": "button",
|
|
384
|
+
"buttonBehavior": {
|
|
385
|
+
"mode": "cycle",
|
|
386
|
+
"cycleOrder": [1, 2, 3],
|
|
387
|
+
"allowReselect": true
|
|
307
388
|
}
|
|
308
389
|
}
|
|
309
390
|
}
|
|
391
|
+
}`,
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
description: "Patch option field (drop button mode).",
|
|
395
|
+
command:
|
|
396
|
+
`zinkee --json schemas fields update contacts status --raw '{"type":"OptionField","config":{"options":[{"id":1,"name":"Open","color":"default"},{"id":2,"name":"In Progress","color":"warning"},{"id":3,"name":"Done","color":"success"}],"defaultValue":1,"conditionalFormatting":[],"buttonConfig":null}}'`,
|
|
397
|
+
raw: `{
|
|
398
|
+
"type": "OptionField",
|
|
399
|
+
"config": {
|
|
400
|
+
"options": [
|
|
401
|
+
{ "id": 1, "name": "Open", "color": "default" },
|
|
402
|
+
{ "id": 2, "name": "In Progress", "color": "warning" },
|
|
403
|
+
{ "id": 3, "name": "Done", "color": "success" }
|
|
404
|
+
],
|
|
405
|
+
"defaultValue": 1,
|
|
406
|
+
"conditionalFormatting": [],
|
|
407
|
+
"buttonConfig": null
|
|
408
|
+
}
|
|
409
|
+
}`,
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
description: "Patch formula field (formula text).",
|
|
413
|
+
command:
|
|
414
|
+
`zinkee --json schemas fields update contacts formula-total --raw '{"type":"FormulaField","config":{"formulaText":"amount * 1.10","uiFormatKind":"number","status":"ACTIVE","numberFormatOptions":{"format":"number","decimals":2,"thousandsSeparator":true},"conditionalFormatting":[]}}'`,
|
|
415
|
+
raw: `{
|
|
416
|
+
"type": "FormulaField",
|
|
417
|
+
"config": {
|
|
418
|
+
"formulaText": "amount * 1.10",
|
|
419
|
+
"uiFormatKind": "number",
|
|
420
|
+
"status": "ACTIVE",
|
|
421
|
+
"numberFormatOptions": {
|
|
422
|
+
"format": "number",
|
|
423
|
+
"decimals": 2,
|
|
424
|
+
"thousandsSeparator": true
|
|
425
|
+
},
|
|
426
|
+
"conditionalFormatting": []
|
|
427
|
+
}
|
|
428
|
+
}`,
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
description: "Patch reference field (delete behavior).",
|
|
432
|
+
command:
|
|
433
|
+
`zinkee --json schemas fields update contacts customer-ref --raw '{"type":"ReferenceField","config":{"targetSchema":"5223cbc8-8c6c-4694-93bc-dd176364df9b","targetDisplayField":"c60b8526-5835-4c9f-aecd-9a16c7704a34","deleteBehavior":"RESTRICT","defaultValue":null,"filterFields":[],"descriptionFields":[],"conditionalFormatting":[]}}'`,
|
|
434
|
+
raw: `{
|
|
435
|
+
"type": "ReferenceField",
|
|
436
|
+
"config": {
|
|
437
|
+
"targetSchema": "5223cbc8-8c6c-4694-93bc-dd176364df9b",
|
|
438
|
+
"targetDisplayField": "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
439
|
+
"deleteBehavior": "RESTRICT",
|
|
440
|
+
"defaultValue": null,
|
|
441
|
+
"filterFields": [],
|
|
442
|
+
"descriptionFields": [],
|
|
443
|
+
"conditionalFormatting": []
|
|
444
|
+
}
|
|
445
|
+
}`,
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
description: "Patch schedule field (to daily).",
|
|
449
|
+
command:
|
|
450
|
+
`zinkee --json schemas fields update contacts recurrence --raw '{"type":"ScheduleField","config":{"referenceField":"c52efe3f-2825-4c60-a7e3-34dd4c1ce043","beginningPeriodField":"d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90","endingPeriodField":"d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90","frequency":"daily"}}'`,
|
|
451
|
+
raw: `{
|
|
452
|
+
"type": "ScheduleField",
|
|
453
|
+
"config": {
|
|
454
|
+
"referenceField": "c52efe3f-2825-4c60-a7e3-34dd4c1ce043",
|
|
455
|
+
"beginningPeriodField": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
456
|
+
"endingPeriodField": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
457
|
+
"frequency": "daily"
|
|
458
|
+
}
|
|
310
459
|
}`,
|
|
311
460
|
},
|
|
312
461
|
]),
|
|
@@ -1610,27 +1759,22 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
1610
1759
|
"required": true,
|
|
1611
1760
|
"system": false,
|
|
1612
1761
|
"config": {
|
|
1613
|
-
"textType": "
|
|
1762
|
+
"textType": "NORMAL",
|
|
1614
1763
|
"defaultValue": "Unknown",
|
|
1615
1764
|
"conditionalFormatting": []
|
|
1616
1765
|
}
|
|
1617
1766
|
},
|
|
1618
1767
|
{
|
|
1619
|
-
"id": "
|
|
1620
|
-
"type": "
|
|
1621
|
-
"slug": "
|
|
1622
|
-
"label": "
|
|
1768
|
+
"id": "1d2e3f4a-5b6c-7d8e-9f01-23456789abcd",
|
|
1769
|
+
"type": "TextField",
|
|
1770
|
+
"slug": "notes",
|
|
1771
|
+
"label": "Notes",
|
|
1623
1772
|
"required": false,
|
|
1624
1773
|
"system": false,
|
|
1625
1774
|
"config": {
|
|
1626
|
-
"
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
{ "id": 3, "name": "Done", "color": "success" }
|
|
1630
|
-
],
|
|
1631
|
-
"defaultValue": 1,
|
|
1632
|
-
"conditionalFormatting": [],
|
|
1633
|
-
"buttonConfig": null
|
|
1775
|
+
"textType": "LONG",
|
|
1776
|
+
"defaultValue": null,
|
|
1777
|
+
"conditionalFormatting": []
|
|
1634
1778
|
}
|
|
1635
1779
|
},
|
|
1636
1780
|
{
|
|
@@ -1654,6 +1798,40 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
1654
1798
|
"conditionalFormatting": []
|
|
1655
1799
|
}
|
|
1656
1800
|
},
|
|
1801
|
+
{
|
|
1802
|
+
"id": "2f3a4b5c-6d7e-8f90-1234-56789abcdef0",
|
|
1803
|
+
"type": "NumberField",
|
|
1804
|
+
"slug": "quantity",
|
|
1805
|
+
"label": "Quantity",
|
|
1806
|
+
"required": false,
|
|
1807
|
+
"system": false,
|
|
1808
|
+
"config": {
|
|
1809
|
+
"defaultValue": "0",
|
|
1810
|
+
"formatOptions": {
|
|
1811
|
+
"format": "number",
|
|
1812
|
+
"decimals": 0,
|
|
1813
|
+
"thousandsSeparator": false
|
|
1814
|
+
},
|
|
1815
|
+
"conditionalFormatting": []
|
|
1816
|
+
}
|
|
1817
|
+
},
|
|
1818
|
+
{
|
|
1819
|
+
"id": "3a4b5c6d-7e8f-9012-3456-789abcdef012",
|
|
1820
|
+
"type": "NumberField",
|
|
1821
|
+
"slug": "discount-rate",
|
|
1822
|
+
"label": "Discount Rate",
|
|
1823
|
+
"required": false,
|
|
1824
|
+
"system": false,
|
|
1825
|
+
"config": {
|
|
1826
|
+
"defaultValue": "0",
|
|
1827
|
+
"formatOptions": {
|
|
1828
|
+
"format": "percentage",
|
|
1829
|
+
"decimals": 1,
|
|
1830
|
+
"negativesInRed": true
|
|
1831
|
+
},
|
|
1832
|
+
"conditionalFormatting": []
|
|
1833
|
+
}
|
|
1834
|
+
},
|
|
1657
1835
|
{
|
|
1658
1836
|
"id": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
1659
1837
|
"type": "DateField",
|
|
@@ -1671,6 +1849,203 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
1671
1849
|
"conditionalFormatting": []
|
|
1672
1850
|
}
|
|
1673
1851
|
},
|
|
1852
|
+
{
|
|
1853
|
+
"id": "4b5c6d7e-8f90-1234-5678-9abcdef01234",
|
|
1854
|
+
"type": "DateField",
|
|
1855
|
+
"slug": "birth-date",
|
|
1856
|
+
"label": "Birth Date",
|
|
1857
|
+
"required": false,
|
|
1858
|
+
"system": false,
|
|
1859
|
+
"config": {
|
|
1860
|
+
"defaultValue": null,
|
|
1861
|
+
"formatOptions": {
|
|
1862
|
+
"format": "date",
|
|
1863
|
+
"dateFormat": "YYYY-MM-DD",
|
|
1864
|
+
"showTime": false
|
|
1865
|
+
},
|
|
1866
|
+
"conditionalFormatting": []
|
|
1867
|
+
}
|
|
1868
|
+
},
|
|
1869
|
+
{
|
|
1870
|
+
"id": "a8f1d7e3-2b5c-4d9e-8a1b-3c4d5e6f7890",
|
|
1871
|
+
"type": "OptionField",
|
|
1872
|
+
"slug": "status",
|
|
1873
|
+
"label": "Status",
|
|
1874
|
+
"required": false,
|
|
1875
|
+
"system": false,
|
|
1876
|
+
"config": {
|
|
1877
|
+
"options": [
|
|
1878
|
+
{ "id": 1, "name": "Open", "color": "default" },
|
|
1879
|
+
{ "id": 2, "name": "In Progress", "color": "warning" },
|
|
1880
|
+
{ "id": 3, "name": "Done", "color": "success" }
|
|
1881
|
+
],
|
|
1882
|
+
"defaultValue": 1,
|
|
1883
|
+
"conditionalFormatting": [],
|
|
1884
|
+
"buttonConfig": null
|
|
1885
|
+
}
|
|
1886
|
+
},
|
|
1887
|
+
{
|
|
1888
|
+
"id": "5c6d7e8f-9012-3456-789a-bcdef0123456",
|
|
1889
|
+
"type": "OptionField",
|
|
1890
|
+
"slug": "stage",
|
|
1891
|
+
"label": "Stage",
|
|
1892
|
+
"required": false,
|
|
1893
|
+
"system": false,
|
|
1894
|
+
"config": {
|
|
1895
|
+
"options": [
|
|
1896
|
+
{ "id": 1, "name": "To Do", "color": "default" },
|
|
1897
|
+
{ "id": 2, "name": "Doing", "color": "warning" },
|
|
1898
|
+
{ "id": 3, "name": "Done", "color": "success" }
|
|
1899
|
+
],
|
|
1900
|
+
"defaultValue": 1,
|
|
1901
|
+
"conditionalFormatting": [],
|
|
1902
|
+
"buttonConfig": {
|
|
1903
|
+
"displayMode": "button",
|
|
1904
|
+
"buttonBehavior": {
|
|
1905
|
+
"mode": "cycle",
|
|
1906
|
+
"cycleOrder": [1, 2, 3],
|
|
1907
|
+
"requireConfirmation": false,
|
|
1908
|
+
"lockAfterSelection": false,
|
|
1909
|
+
"allowReselect": true
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
},
|
|
1914
|
+
{
|
|
1915
|
+
"id": "3e9f8c12-4a5b-6c7d-8e9f-0a1b2c3d4e5f",
|
|
1916
|
+
"type": "FormulaField",
|
|
1917
|
+
"slug": "formula-total",
|
|
1918
|
+
"label": "Formula Total",
|
|
1919
|
+
"required": false,
|
|
1920
|
+
"system": false,
|
|
1921
|
+
"config": {
|
|
1922
|
+
"formulaText": "amount * 1.21",
|
|
1923
|
+
"uiFormatKind": "number",
|
|
1924
|
+
"status": "ACTIVE",
|
|
1925
|
+
"defaultValue": null,
|
|
1926
|
+
"numberFormatOptions": {
|
|
1927
|
+
"format": "number",
|
|
1928
|
+
"decimals": 2,
|
|
1929
|
+
"thousandsSeparator": true
|
|
1930
|
+
},
|
|
1931
|
+
"conditionalFormatting": []
|
|
1932
|
+
}
|
|
1933
|
+
},
|
|
1934
|
+
{
|
|
1935
|
+
"id": "6d7e8f90-1234-5678-9abc-def012345678",
|
|
1936
|
+
"type": "FormulaField",
|
|
1937
|
+
"slug": "formula-deadline",
|
|
1938
|
+
"label": "Computed Deadline",
|
|
1939
|
+
"required": false,
|
|
1940
|
+
"system": false,
|
|
1941
|
+
"config": {
|
|
1942
|
+
"formulaText": "addDays(startDate, 7)",
|
|
1943
|
+
"uiFormatKind": "date",
|
|
1944
|
+
"status": "ACTIVE",
|
|
1945
|
+
"defaultValue": null,
|
|
1946
|
+
"dateFormatOptions": {
|
|
1947
|
+
"format": "date",
|
|
1948
|
+
"dateFormat": "DD/MM/YYYY",
|
|
1949
|
+
"showTime": false
|
|
1950
|
+
},
|
|
1951
|
+
"conditionalFormatting": []
|
|
1952
|
+
}
|
|
1953
|
+
},
|
|
1954
|
+
{
|
|
1955
|
+
"id": "45c5da96-0dc2-4cc1-ba61-7660a9c6da32",
|
|
1956
|
+
"type": "ReferenceField",
|
|
1957
|
+
"slug": "customer-ref",
|
|
1958
|
+
"label": "Customer",
|
|
1959
|
+
"required": false,
|
|
1960
|
+
"system": false,
|
|
1961
|
+
"config": {
|
|
1962
|
+
"targetSchema": "5223cbc8-8c6c-4694-93bc-dd176364df9b",
|
|
1963
|
+
"targetDisplayField": "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
1964
|
+
"deleteBehavior": "SET_NULL",
|
|
1965
|
+
"defaultValue": null,
|
|
1966
|
+
"filterFields": [],
|
|
1967
|
+
"descriptionFields": [],
|
|
1968
|
+
"conditionalFormatting": []
|
|
1969
|
+
}
|
|
1970
|
+
},
|
|
1971
|
+
{
|
|
1972
|
+
"id": "7e8f9012-3456-789a-bcde-f01234567890",
|
|
1973
|
+
"type": "ReferenceField",
|
|
1974
|
+
"slug": "company-ref",
|
|
1975
|
+
"label": "Company",
|
|
1976
|
+
"required": false,
|
|
1977
|
+
"system": false,
|
|
1978
|
+
"config": {
|
|
1979
|
+
"targetSchema": "5223cbc8-8c6c-4694-93bc-dd176364df9b",
|
|
1980
|
+
"targetDisplayField": "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
1981
|
+
"deleteBehavior": "RESTRICT",
|
|
1982
|
+
"defaultValue": null,
|
|
1983
|
+
"filterFields": [],
|
|
1984
|
+
"descriptionFields": [],
|
|
1985
|
+
"conditionalFormatting": []
|
|
1986
|
+
}
|
|
1987
|
+
},
|
|
1988
|
+
{
|
|
1989
|
+
"id": "b2c3d4e5-f6a7-8b9c-0d1e-2f3a4b5c6d7e",
|
|
1990
|
+
"type": "AutoIncrementalField",
|
|
1991
|
+
"slug": "sequence-code",
|
|
1992
|
+
"label": "Sequence Code",
|
|
1993
|
+
"required": false,
|
|
1994
|
+
"system": true,
|
|
1995
|
+
"config": {
|
|
1996
|
+
"segmentedByFieldId": "45c5da96-0dc2-4cc1-ba61-7660a9c6da32",
|
|
1997
|
+
"conditionalFormatting": []
|
|
1998
|
+
}
|
|
1999
|
+
},
|
|
2000
|
+
{
|
|
2001
|
+
"id": "8f901234-5678-9abc-def0-123456789012",
|
|
2002
|
+
"type": "AutoIncrementalField",
|
|
2003
|
+
"slug": "order-number",
|
|
2004
|
+
"label": "Order Number",
|
|
2005
|
+
"required": false,
|
|
2006
|
+
"system": true,
|
|
2007
|
+
"config": {
|
|
2008
|
+
"segmentedByFieldId": null,
|
|
2009
|
+
"conditionalFormatting": []
|
|
2010
|
+
}
|
|
2011
|
+
},
|
|
2012
|
+
{
|
|
2013
|
+
"id": "e5f6a7b8-c9d0-1e2f-3a4b-5c6d7e8f9012",
|
|
2014
|
+
"type": "FileField",
|
|
2015
|
+
"slug": "attachment",
|
|
2016
|
+
"label": "Attachment",
|
|
2017
|
+
"required": false,
|
|
2018
|
+
"system": false,
|
|
2019
|
+
"config": {}
|
|
2020
|
+
},
|
|
2021
|
+
{
|
|
2022
|
+
"id": "f6a7b8c9-d0e1-2f3a-4b5c-6d7e8f901234",
|
|
2023
|
+
"type": "ScheduleField",
|
|
2024
|
+
"slug": "recurrence",
|
|
2025
|
+
"label": "Recurrence",
|
|
2026
|
+
"required": false,
|
|
2027
|
+
"system": false,
|
|
2028
|
+
"config": {
|
|
2029
|
+
"referenceField": "c52efe3f-2825-4c60-a7e3-34dd4c1ce043",
|
|
2030
|
+
"beginningPeriodField": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
2031
|
+
"endingPeriodField": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
2032
|
+
"frequency": "monthly"
|
|
2033
|
+
}
|
|
2034
|
+
},
|
|
2035
|
+
{
|
|
2036
|
+
"id": "9012abcd-ef01-2345-6789-abcdef012345",
|
|
2037
|
+
"type": "ScheduleField",
|
|
2038
|
+
"slug": "daily-recurrence",
|
|
2039
|
+
"label": "Daily Recurrence",
|
|
2040
|
+
"required": false,
|
|
2041
|
+
"system": false,
|
|
2042
|
+
"config": {
|
|
2043
|
+
"referenceField": "c52efe3f-2825-4c60-a7e3-34dd4c1ce043",
|
|
2044
|
+
"beginningPeriodField": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
2045
|
+
"endingPeriodField": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
2046
|
+
"frequency": "daily"
|
|
2047
|
+
}
|
|
2048
|
+
},
|
|
1674
2049
|
{
|
|
1675
2050
|
"id": "a7b8c9d0-e1f2-3a4b-5c6d-7e8f90123456",
|
|
1676
2051
|
"type": "MemberField",
|
|
@@ -3265,26 +3640,32 @@ function buildSchemaFieldCreateExamples(type?: string): readonly CommandExample[
|
|
|
3265
3640
|
? definitions.filter((definition) => definition.key === selectedDefinition.key)
|
|
3266
3641
|
: definitions;
|
|
3267
3642
|
|
|
3643
|
+
const flat = filteredDefinitions.flatMap((definition) =>
|
|
3644
|
+
definition.examplePayloads.map((example) => ({ definition, example })),
|
|
3645
|
+
);
|
|
3646
|
+
|
|
3268
3647
|
return buildCommandExamples(
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3648
|
+
flat.map(({ example }, index) => {
|
|
3649
|
+
const slug =
|
|
3650
|
+
typeof example.payload.slug === "string" ? example.payload.slug : "field";
|
|
3651
|
+
const command = `zinkee --json schemas fields create contacts --raw '${JSON.stringify(example.payload)}'`;
|
|
3652
|
+
|
|
3653
|
+
if (index === 0) {
|
|
3654
|
+
return {
|
|
3655
|
+
description: example.name,
|
|
3656
|
+
command,
|
|
3657
|
+
response: `{
|
|
3658
|
+
"schemaId": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
|
|
3659
|
+
"fieldId": "a8f1d7e3-2b5c-4d9e-8a1b-3c4d5e6f7890",
|
|
3660
|
+
"slug": "${slug}"
|
|
3661
|
+
}`,
|
|
3662
|
+
};
|
|
3275
3663
|
}
|
|
3276
3664
|
|
|
3277
|
-
return
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
'zinkee --json schemas fields create contacts --raw \'{"type":"number","slug":"amount","label":"Amount"}\'',
|
|
3282
|
-
},
|
|
3283
|
-
{
|
|
3284
|
-
description: "Create a number field formatted like Moneda",
|
|
3285
|
-
command: `zinkee --json schemas fields create contacts --raw '${JSON.stringify(definition.examplePayload)}'`,
|
|
3286
|
-
},
|
|
3287
|
-
];
|
|
3665
|
+
return {
|
|
3666
|
+
description: example.name,
|
|
3667
|
+
command,
|
|
3668
|
+
};
|
|
3288
3669
|
}),
|
|
3289
3670
|
);
|
|
3290
3671
|
}
|