zinkee 0.1.20 → 0.1.22
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 +2 -1
- package/dist/index.js +104 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/displays.ts +7 -4
- package/src/utils/examples.ts +102 -9
package/package.json
CHANGED
package/src/commands/displays.ts
CHANGED
|
@@ -17,6 +17,9 @@ import type { RuntimeOverrides } from "../types.js";
|
|
|
17
17
|
import { CliError } from "../utils/errors.js";
|
|
18
18
|
import { buildJsonSuccess, printTable } from "../utils/output.js";
|
|
19
19
|
|
|
20
|
+
const DATE_DYNAMIC_OPTIONS =
|
|
21
|
+
"today, thisWeek, thisMonth, thisQuarter, thisSemester, thisYear, next7Days, next30Days, next6Months, next12Months, last12Months";
|
|
22
|
+
|
|
20
23
|
interface CommandIo {
|
|
21
24
|
write(chunk: string): unknown;
|
|
22
25
|
}
|
|
@@ -674,7 +677,7 @@ export function registerDisplaysCommands(
|
|
|
674
677
|
.option("--type <type>").option("--name <name>").option("--allow-multiple").option("--static")
|
|
675
678
|
.option("--default <value>").option("--default-value <value>", "repeatable default value", (v, p: string[] = []) => [...p, v], [])
|
|
676
679
|
.option("--source-schema <id>").option("--source-field <id>").option("--filter <expr>", "repeatable filter", collectFilters, [])
|
|
677
|
-
.option("--date-mode <mode>").option("--date-dynamic-option <option>").option("--date-specific <iso>").option("--date-range-start <iso>").option("--date-range-end <iso>")
|
|
680
|
+
.option("--date-mode <mode>").option("--date-dynamic-option <option>", `dynamic date period (${DATE_DYNAMIC_OPTIONS})`).option("--date-specific <iso>").option("--date-range-start <iso>").option("--date-range-end <iso>")
|
|
678
681
|
.option("--raw <json>").option("--raw-file <path>")
|
|
679
682
|
.action(async function action(this: Command, display: NormalizedUuidOrSlug, commandOptions: VariableMutationOptions) {
|
|
680
683
|
const { api, json, readOnly } = createDisplaysApi(this, filePath); ensureWritable("displays variables create", readOnly, "write");
|
|
@@ -686,7 +689,7 @@ export function registerDisplaysCommands(
|
|
|
686
689
|
.option("--type <type>").option("--name <name>").option("--allow-multiple").option("--static")
|
|
687
690
|
.option("--default <value>").option("--default-value <value>", "repeatable default value", (v, p: string[] = []) => [...p, v], [])
|
|
688
691
|
.option("--source-schema <id>").option("--source-field <id>").option("--filter <expr>", "repeatable filter", collectFilters, [])
|
|
689
|
-
.option("--date-mode <mode>").option("--date-dynamic-option <option>").option("--date-specific <iso>").option("--date-range-start <iso>").option("--date-range-end <iso>")
|
|
692
|
+
.option("--date-mode <mode>").option("--date-dynamic-option <option>", `dynamic date period (${DATE_DYNAMIC_OPTIONS})`).option("--date-specific <iso>").option("--date-range-start <iso>").option("--date-range-end <iso>")
|
|
690
693
|
.option("--raw <json>").option("--raw-file <path>")
|
|
691
694
|
.action(async function action(this: Command, display: NormalizedUuidOrSlug, variableId: string, commandOptions: VariableMutationOptions) {
|
|
692
695
|
const { api, json, readOnly } = createDisplaysApi(this, filePath); ensureWritable("displays variables update", readOnly, "write");
|
|
@@ -720,7 +723,7 @@ export function registerDisplaysCommands(
|
|
|
720
723
|
.option("--filter <expr>", "repeatable filter", collectFilters, [])
|
|
721
724
|
.option("--widget-read-only").option("--hide-add-button").option("--hide-delete-button").option("--hide-sort-button").option("--hide-filter-button").option("--hide-see-button")
|
|
722
725
|
.option("--calc <type>").option("--calc-field <uuid>").option("--kpi-config <json>")
|
|
723
|
-
.option("--chart-type <type>").option("--x-axis-field <uuid>").option("--x-axis-date-format <granularity>").option("--x-axis-time-series")
|
|
726
|
+
.option("--chart-type <type>", "chart type (lines, bars, stackedBars, combined)").option("--x-axis-field <uuid>").option("--x-axis-date-format <granularity>", "time granularity (DATE, MONTH_YEAR, QUARTER_YEAR, YEAR)").option("--x-axis-time-series")
|
|
724
727
|
.option("--y-axis-serie <json>", "repeatable y axis serie", (v, p: string[] = []) => [...p, v], [])
|
|
725
728
|
.option("--legend <json>").option("--raw <json>").option("--raw-file <path>")
|
|
726
729
|
.action(async function action(this: Command, display: NormalizedUuidOrSlug, commandOptions: WidgetMutationOptions) {
|
|
@@ -738,7 +741,7 @@ export function registerDisplaysCommands(
|
|
|
738
741
|
.option("--filter <expr>", "repeatable filter", collectFilters, [])
|
|
739
742
|
.option("--widget-read-only").option("--hide-add-button").option("--hide-delete-button").option("--hide-sort-button").option("--hide-filter-button").option("--hide-see-button")
|
|
740
743
|
.option("--calc <type>").option("--calc-field <uuid>").option("--kpi-config <json>")
|
|
741
|
-
.option("--chart-type <type>").option("--x-axis-field <uuid>").option("--x-axis-date-format <granularity>").option("--x-axis-time-series")
|
|
744
|
+
.option("--chart-type <type>", "chart type (lines, bars, stackedBars, combined)").option("--x-axis-field <uuid>").option("--x-axis-date-format <granularity>", "time granularity (DATE, MONTH_YEAR, QUARTER_YEAR, YEAR)").option("--x-axis-time-series")
|
|
742
745
|
.option("--y-axis-serie <json>", "repeatable y axis serie", (v, p: string[] = []) => [...p, v], [])
|
|
743
746
|
.option("--legend <json>").option("--raw <json>").option("--raw-file <path>")
|
|
744
747
|
.action(async function action(this: Command, display: NormalizedUuidOrSlug, widgetId: string, commandOptions: WidgetMutationOptions) {
|
package/src/utils/examples.ts
CHANGED
|
@@ -1298,13 +1298,13 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
1298
1298
|
}`,
|
|
1299
1299
|
},
|
|
1300
1300
|
{
|
|
1301
|
-
description: "Change a DATE variable to use
|
|
1301
|
+
description: "Change a DATE variable to use last12Months.",
|
|
1302
1302
|
command:
|
|
1303
|
-
'zinkee --json displays variables update 0f6f062f-1478-4df2-96a1-c495d037d260 bbbbbbbb-2222-4222-a222-222222222222 --date-mode dynamic --date-dynamic-option
|
|
1303
|
+
'zinkee --json displays variables update 0f6f062f-1478-4df2-96a1-c495d037d260 bbbbbbbb-2222-4222-a222-222222222222 --date-mode dynamic --date-dynamic-option last12Months',
|
|
1304
1304
|
raw: `{
|
|
1305
1305
|
"date": {
|
|
1306
1306
|
"mode": "dynamic",
|
|
1307
|
-
"dynamicOption": "
|
|
1307
|
+
"dynamicOption": "last12Months"
|
|
1308
1308
|
}
|
|
1309
1309
|
}`,
|
|
1310
1310
|
},
|
|
@@ -1385,9 +1385,40 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
1385
1385
|
}`,
|
|
1386
1386
|
},
|
|
1387
1387
|
{
|
|
1388
|
-
description: "Create a
|
|
1388
|
+
description: "Create a CHART widget with a daily time-serie x-axis.",
|
|
1389
1389
|
command:
|
|
1390
|
-
`zinkee --json displays widgets create 0f6f062f-1478-4df2-96a1-c495d037d260 --type CHART --name "Revenue by
|
|
1390
|
+
`zinkee --json displays widgets create 0f6f062f-1478-4df2-96a1-c495d037d260 --type CHART --name "Revenue by day" --origin-resource 2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e --layout '{"x":0,"y":0,"w":8,"h":6}' --chart-type lines --x-axis-field due-date --x-axis-date-format DATE --x-axis-time-series --y-axis-serie '{"typeCalc":"SUM","fieldCalc":"amount","color":"#4B9CD3","axisType":"PRIMARY"}' --legend '{"position":"bottom"}'`,
|
|
1391
|
+
raw: `{
|
|
1392
|
+
"type": "CHART",
|
|
1393
|
+
"source": {
|
|
1394
|
+
"originResourceId": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
|
|
1395
|
+
"isOriginSubSchema": false
|
|
1396
|
+
},
|
|
1397
|
+
"placement": {
|
|
1398
|
+
"layout": { "x": 0, "y": 0, "w": 8, "h": 6 }
|
|
1399
|
+
},
|
|
1400
|
+
"presentation": { "name": "Revenue by day" },
|
|
1401
|
+
"chart": {
|
|
1402
|
+
"chartType": "lines",
|
|
1403
|
+
"xAxisFieldId": "due-date",
|
|
1404
|
+
"xAxisDateFormat": "DATE",
|
|
1405
|
+
"xAxisAsTimeSerie": true,
|
|
1406
|
+
"yAxisSeries": [
|
|
1407
|
+
{
|
|
1408
|
+
"typeCalc": "SUM",
|
|
1409
|
+
"fieldCalc": "amount",
|
|
1410
|
+
"color": "#4B9CD3",
|
|
1411
|
+
"axisType": "PRIMARY"
|
|
1412
|
+
}
|
|
1413
|
+
],
|
|
1414
|
+
"legend": { "position": "bottom" }
|
|
1415
|
+
}
|
|
1416
|
+
}`,
|
|
1417
|
+
},
|
|
1418
|
+
{
|
|
1419
|
+
description: "Create a bars CHART widget with a monthly time-serie x-axis and two y-axis series.",
|
|
1420
|
+
command:
|
|
1421
|
+
`zinkee --json displays widgets create 0f6f062f-1478-4df2-96a1-c495d037d260 --type CHART --name "Revenue by month" --origin-resource 2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e --layout '{"x":0,"y":0,"w":8,"h":6}' --chart-type bars --x-axis-field due-date --x-axis-date-format MONTH_YEAR --x-axis-time-series --y-axis-serie '{"typeCalc":"SUM","fieldCalc":"amount","color":"#4B9CD3","axisType":"PRIMARY"}' --y-axis-serie '{"typeCalc":"COUNT","fieldCalc":"id","color":"#E57373","axisType":"SECONDARY"}' --legend '{"position":"bottom"}'`,
|
|
1391
1422
|
raw: `{
|
|
1392
1423
|
"type": "CHART",
|
|
1393
1424
|
"source": {
|
|
@@ -1401,7 +1432,7 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
1401
1432
|
"chart": {
|
|
1402
1433
|
"chartType": "bars",
|
|
1403
1434
|
"xAxisFieldId": "due-date",
|
|
1404
|
-
"xAxisDateFormat": "
|
|
1435
|
+
"xAxisDateFormat": "MONTH_YEAR",
|
|
1405
1436
|
"xAxisAsTimeSerie": true,
|
|
1406
1437
|
"yAxisSeries": [
|
|
1407
1438
|
{
|
|
@@ -1419,6 +1450,68 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
1419
1450
|
],
|
|
1420
1451
|
"legend": { "position": "bottom" }
|
|
1421
1452
|
}
|
|
1453
|
+
}`,
|
|
1454
|
+
},
|
|
1455
|
+
{
|
|
1456
|
+
description: "Create a bars CHART widget with a quarterly time-serie x-axis.",
|
|
1457
|
+
command:
|
|
1458
|
+
`zinkee --json displays widgets create 0f6f062f-1478-4df2-96a1-c495d037d260 --type CHART --name "Revenue by quarter" --origin-resource 2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e --layout '{"x":0,"y":0,"w":8,"h":6}' --chart-type bars --x-axis-field due-date --x-axis-date-format QUARTER_YEAR --x-axis-time-series --y-axis-serie '{"typeCalc":"SUM","fieldCalc":"amount","color":"#4B9CD3","axisType":"PRIMARY"}' --legend '{"position":"bottom"}'`,
|
|
1459
|
+
raw: `{
|
|
1460
|
+
"type": "CHART",
|
|
1461
|
+
"source": {
|
|
1462
|
+
"originResourceId": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
|
|
1463
|
+
"isOriginSubSchema": false
|
|
1464
|
+
},
|
|
1465
|
+
"placement": {
|
|
1466
|
+
"layout": { "x": 0, "y": 0, "w": 8, "h": 6 }
|
|
1467
|
+
},
|
|
1468
|
+
"presentation": { "name": "Revenue by quarter" },
|
|
1469
|
+
"chart": {
|
|
1470
|
+
"chartType": "bars",
|
|
1471
|
+
"xAxisFieldId": "due-date",
|
|
1472
|
+
"xAxisDateFormat": "QUARTER_YEAR",
|
|
1473
|
+
"xAxisAsTimeSerie": true,
|
|
1474
|
+
"yAxisSeries": [
|
|
1475
|
+
{
|
|
1476
|
+
"typeCalc": "SUM",
|
|
1477
|
+
"fieldCalc": "amount",
|
|
1478
|
+
"color": "#4B9CD3",
|
|
1479
|
+
"axisType": "PRIMARY"
|
|
1480
|
+
}
|
|
1481
|
+
],
|
|
1482
|
+
"legend": { "position": "bottom" }
|
|
1483
|
+
}
|
|
1484
|
+
}`,
|
|
1485
|
+
},
|
|
1486
|
+
{
|
|
1487
|
+
description: "Create a CHART widget with a yearly time-serie x-axis.",
|
|
1488
|
+
command:
|
|
1489
|
+
`zinkee --json displays widgets create 0f6f062f-1478-4df2-96a1-c495d037d260 --type CHART --name "Revenue by year" --origin-resource 2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e --layout '{"x":0,"y":0,"w":8,"h":6}' --chart-type lines --x-axis-field due-date --x-axis-date-format YEAR --x-axis-time-series --y-axis-serie '{"typeCalc":"SUM","fieldCalc":"amount","color":"#4B9CD3","axisType":"PRIMARY"}' --legend '{"position":"bottom"}'`,
|
|
1490
|
+
raw: `{
|
|
1491
|
+
"type": "CHART",
|
|
1492
|
+
"source": {
|
|
1493
|
+
"originResourceId": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
|
|
1494
|
+
"isOriginSubSchema": false
|
|
1495
|
+
},
|
|
1496
|
+
"placement": {
|
|
1497
|
+
"layout": { "x": 0, "y": 0, "w": 8, "h": 6 }
|
|
1498
|
+
},
|
|
1499
|
+
"presentation": { "name": "Revenue by year" },
|
|
1500
|
+
"chart": {
|
|
1501
|
+
"chartType": "lines",
|
|
1502
|
+
"xAxisFieldId": "due-date",
|
|
1503
|
+
"xAxisDateFormat": "YEAR",
|
|
1504
|
+
"xAxisAsTimeSerie": true,
|
|
1505
|
+
"yAxisSeries": [
|
|
1506
|
+
{
|
|
1507
|
+
"typeCalc": "SUM",
|
|
1508
|
+
"fieldCalc": "amount",
|
|
1509
|
+
"color": "#4B9CD3",
|
|
1510
|
+
"axisType": "PRIMARY"
|
|
1511
|
+
}
|
|
1512
|
+
],
|
|
1513
|
+
"legend": { "position": "bottom" }
|
|
1514
|
+
}
|
|
1422
1515
|
}`,
|
|
1423
1516
|
},
|
|
1424
1517
|
{
|
|
@@ -1580,14 +1673,14 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
1580
1673
|
}`,
|
|
1581
1674
|
},
|
|
1582
1675
|
{
|
|
1583
|
-
description: "Replace the chart series with
|
|
1676
|
+
description: "Replace the chart series with quarterly lines.",
|
|
1584
1677
|
command:
|
|
1585
|
-
`zinkee --json displays widgets update 0f6f062f-1478-4df2-96a1-c495d037d260 22222222-2222-4222-a222-222222222222 --chart-type lines --x-axis-field due-date --x-axis-date-format
|
|
1678
|
+
`zinkee --json displays widgets update 0f6f062f-1478-4df2-96a1-c495d037d260 22222222-2222-4222-a222-222222222222 --chart-type lines --x-axis-field due-date --x-axis-date-format QUARTER_YEAR --x-axis-time-series --y-axis-serie '{"typeCalc":"SUM","fieldCalc":"amount","color":"#2E7D32","axisType":"PRIMARY"}'`,
|
|
1586
1679
|
raw: `{
|
|
1587
1680
|
"chart": {
|
|
1588
1681
|
"chartType": "lines",
|
|
1589
1682
|
"xAxisFieldId": "due-date",
|
|
1590
|
-
"xAxisDateFormat": "
|
|
1683
|
+
"xAxisDateFormat": "QUARTER_YEAR",
|
|
1591
1684
|
"xAxisAsTimeSerie": true,
|
|
1592
1685
|
"yAxisSeries": [
|
|
1593
1686
|
{
|