zinkee 0.1.67 → 0.1.69
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/dist/index.js
CHANGED
|
@@ -253,7 +253,7 @@ ${list}`
|
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
255
|
async function showExamples(commandName, json, stdout, filters = {}) {
|
|
256
|
-
const { getCommandExamples } = await import("./examples-
|
|
256
|
+
const { getCommandExamples } = await import("./examples-AJAJZ6QM.js");
|
|
257
257
|
const examples = getCommandExamples(commandName, filters);
|
|
258
258
|
if (examples.length === 0) {
|
|
259
259
|
throw new CliError("invalid_cli_usage", `No examples registered for "${commandName}".`);
|
|
@@ -3328,12 +3328,13 @@ function buildWidgetBody(options) {
|
|
|
3328
3328
|
config: readNamedJsonOption(options.kpiConfig, void 0, "--kpi-config")
|
|
3329
3329
|
};
|
|
3330
3330
|
}
|
|
3331
|
-
const hasChartFlags = options.chartType !== void 0 || options.xAxisField !== void 0 || options.xAxisDateFormat !== void 0 || options.xAxisTimeSeries !== void 0 || (options.yAxisSerie?.length ?? 0) > 0 || options.legend !== void 0;
|
|
3331
|
+
const hasChartFlags = options.chartType !== void 0 || options.chartSortOrder !== void 0 || options.xAxisField !== void 0 || options.xAxisDateFormat !== void 0 || options.xAxisTimeSeries !== void 0 || (options.yAxisSerie?.length ?? 0) > 0 || options.legend !== void 0;
|
|
3332
3332
|
if (hasChartFlags) {
|
|
3333
3333
|
const legend = readNamedJsonOption(options.legend, void 0, "--legend");
|
|
3334
3334
|
body.chart = {
|
|
3335
3335
|
...typeof body.chart === "object" && body.chart ? body.chart : {},
|
|
3336
3336
|
...options.chartType !== void 0 ? { chartType: options.chartType } : {},
|
|
3337
|
+
...options.chartSortOrder !== void 0 ? { sortOrder: options.chartSortOrder } : {},
|
|
3337
3338
|
...options.xAxisField !== void 0 ? { xAxisFieldId: options.xAxisField } : {},
|
|
3338
3339
|
...options.xAxisDateFormat !== void 0 ? { xAxisDateFormat: options.xAxisDateFormat } : {},
|
|
3339
3340
|
...options.xAxisTimeSeries !== void 0 ? { xAxisAsTimeSerie: options.xAxisTimeSeries } : {},
|
|
@@ -3687,7 +3688,7 @@ function registerDisplaysCommands(program, options = {}) {
|
|
|
3687
3688
|
}
|
|
3688
3689
|
printTable([data], void 0, stdout);
|
|
3689
3690
|
});
|
|
3690
|
-
widgets.command("create").description("Create widget").argument("<display>", "display uuid or slug", parseUuidOrSlugSelector).requiredOption("--type <type>", "widget type").option("--name <name>").option("--description <text>").option("--icon <icon>").option("--color <color>").option("--origin-resource <uuid>").option("--origin-subschema").option("--tab <tabId>").option("--slot <slotId>").option("--layout <json>").option("--layout-file <path>").option("--field <field>", "repeatable field", (v, p = []) => [...p, v], []).option("--sort <sort>", "repeatable sort", (v, p = []) => [...p, v], []).option("--filter <expr>", "repeatable filter", collectFilters, []).option("--widget-read-only").option("--hide-add-button").option("--hide-delete-button").option("--hide-sort-button").option("--hide-filter-button").option("--hide-see-button").option("--allow-export", "TABLE only: users of the display can export to CSV the records and columns they see in the widget").option("--no-allow-export", "TABLE only: turn CSV export of the widget off").option("--lock-field <field>", "lock a field permanently in this widget (repeatable; field UUID or slug)", (v, p = []) => [...p, v], []).option("--lock-condition <expr>", 'conditional lock "<lockedField>:<field>:<comparator>[:<value>]"; locks <lockedField> when all its conditions match, or any with --lock-match (repeatable)', collectLockConditions, []).option("--lock-match <field:all|any>", "how the conditions of a lock combine: all (default) or any (repeatable)", collectLockMatches, []).option("--lock-option <field:option>", "lock only this option of an option field (repeatable; option name or id); its other options and leaving it empty stay allowed", collectLockOptions, []).option("--lock-message-before <field:text>", "message shown while a conditional lock is not met yet (repeatable)", collectLockMessages, []).option("--lock-message-after <field:text>", "message shown once the field is locked (repeatable)", collectLockMessages, []).option("--clear-locked-fields", "clear the widget locked-fields configuration").option("--calc <type>").option("--calc-field <uuid>").option("--kpi-config <json>").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").option("--y-axis-serie <json>", "repeatable y axis serie", (v, p = []) => [...p, v], []).option("--legend <json>").option("--column-field <uuid>", "KANBAN column field (UUID, not slug)").option("--swimlane-field <uuid>", "KANBAN swimlane field (UUID, not slug)").option("--start-date-field <uuid>", "TIMELINE start date field (UUID, not slug)").option("--end-date-field <uuid>", "TIMELINE end date field (UUID, not slug)").option("--label-field <uuid>", "TIMELINE label field (UUID, not slug)").option("--group-field <uuid>", "TIMELINE group field (UUID, not slug)").option("--subgroup-field <uuid>", "TIMELINE subgroup field (UUID, not slug)").option("--progress-field <uuid>", "TIMELINE progress field (UUID, not slug)").option("--card-title-field <uuid>", "KANBAN/TIMELINE card title field (UUID, not slug)").option("--card-category1-field <uuid>", "KANBAN/TIMELINE card category 1 field (UUID, not slug)").option("--card-category2-field <uuid>", "KANBAN/TIMELINE card category 2 field (UUID, not slug)").option("--card-category3-field <uuid>", "KANBAN card category 3 field (UUID, not slug)").option("--card-category4-field <uuid>", "TIMELINE card category 4 field (UUID, not slug)").option("--card-description-field <uuid>", "KANBAN/TIMELINE card description field (UUID, not slug)").option("--aggregation-method <method>", "KANBAN card aggregation method (e.g. sum)").option("--aggregation-field <uuid>", "KANBAN card aggregation field (UUID, not slug)").option("--view-state <json>", "KANBAN/TIMELINE viewState UI scalars (columnOrder, granularity, sidebarWidth, show* ...)").option("--view-state-file <path>", "read --view-state JSON from a file").option("--hierarchy-label <name>", "HIERARCHY label column name").option("--hierarchy-info <id:name>", "HIERARCHY info column; id is a unique opaque column id you choose (e.g. col_1779975207355_zfndknslw), not the name, and is reused as columnId in mappings (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-number <id:name:aggregation>", "HIERARCHY number column; id is a unique opaque column id (e.g. col_1779975207355_zfndknslw), not the name; aggregation SUM|AVERAGE|MINIMUM|MAXIMUM|COUNT|COUNT_DISTINCT (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-root-name <name>", "HIERARCHY root level name").option("--hierarchy-root-label-field <uuid>", "HIERARCHY root level label field (UUID, not slug)").option("--hierarchy-root-info <columnId:fieldId>", "HIERARCHY root info mapping; columnId must match a --hierarchy-info id (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-root-number <columnId:fieldId>", "HIERARCHY root number mapping; columnId must match a --hierarchy-number id (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-child <json>", "HIERARCHY child level JSON {name,schemaId,childFieldId,labelFieldId,infoMappings,numberMappings} (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-config <json>", "HIERARCHY full hierarchyConfig JSON (escape hatch)").option("--hierarchy-config-file <path>", "read --hierarchy-config JSON from a file").option("--raw <json>").option("--raw-file <path>").action(async function action(display, commandOptions) {
|
|
3691
|
+
widgets.command("create").description("Create widget").argument("<display>", "display uuid or slug", parseUuidOrSlugSelector).requiredOption("--type <type>", "widget type").option("--name <name>").option("--description <text>").option("--icon <icon>").option("--color <color>").option("--origin-resource <uuid>").option("--origin-subschema").option("--tab <tabId>").option("--slot <slotId>").option("--layout <json>").option("--layout-file <path>").option("--field <field>", "repeatable field", (v, p = []) => [...p, v], []).option("--sort <sort>", "repeatable sort", (v, p = []) => [...p, v], []).option("--filter <expr>", "repeatable filter", collectFilters, []).option("--widget-read-only").option("--hide-add-button").option("--hide-delete-button").option("--hide-sort-button").option("--hide-filter-button").option("--hide-see-button").option("--allow-export", "TABLE only: users of the display can export to CSV the records and columns they see in the widget").option("--no-allow-export", "TABLE only: turn CSV export of the widget off").option("--lock-field <field>", "lock a field permanently in this widget (repeatable; field UUID or slug)", (v, p = []) => [...p, v], []).option("--lock-condition <expr>", 'conditional lock "<lockedField>:<field>:<comparator>[:<value>]"; locks <lockedField> when all its conditions match, or any with --lock-match (repeatable)', collectLockConditions, []).option("--lock-match <field:all|any>", "how the conditions of a lock combine: all (default) or any (repeatable)", collectLockMatches, []).option("--lock-option <field:option>", "lock only this option of an option field (repeatable; option name or id); its other options and leaving it empty stay allowed", collectLockOptions, []).option("--lock-message-before <field:text>", "message shown while a conditional lock is not met yet (repeatable)", collectLockMessages, []).option("--lock-message-after <field:text>", "message shown once the field is locked (repeatable)", collectLockMessages, []).option("--clear-locked-fields", "clear the widget locked-fields configuration").option("--calc <type>").option("--calc-field <uuid>").option("--kpi-config <json>").option("--chart-type <type>", "chart type (lines, bars, horizontalBars, stackedBars, combined); horizontalBars puts one category per row, for rankings").option("--chart-sort-order <order>", "category order (alphabetical, valueDesc, valueAsc) by the first series; only bars and horizontalBars sort by value, and a chart grouped by a date is always chronological (the API refuses a value order there)").option("--x-axis-field <uuid>").option("--x-axis-date-format <granularity>", "time granularity (DATE, MONTH_YEAR, QUARTER_YEAR, YEAR)").option("--x-axis-time-series").option("--y-axis-serie <json>", "repeatable y axis serie", (v, p = []) => [...p, v], []).option("--legend <json>", "accepted for compatibility and ignored: the web shows the legend when there are 2+ series").option("--column-field <uuid>", "KANBAN column field (UUID, not slug)").option("--swimlane-field <uuid>", "KANBAN swimlane field (UUID, not slug)").option("--start-date-field <uuid>", "TIMELINE start date field (UUID, not slug)").option("--end-date-field <uuid>", "TIMELINE end date field (UUID, not slug)").option("--label-field <uuid>", "TIMELINE label field (UUID, not slug)").option("--group-field <uuid>", "TIMELINE group field (UUID, not slug)").option("--subgroup-field <uuid>", "TIMELINE subgroup field (UUID, not slug)").option("--progress-field <uuid>", "TIMELINE progress field (UUID, not slug)").option("--card-title-field <uuid>", "KANBAN/TIMELINE card title field (UUID, not slug)").option("--card-category1-field <uuid>", "KANBAN/TIMELINE card category 1 field (UUID, not slug)").option("--card-category2-field <uuid>", "KANBAN/TIMELINE card category 2 field (UUID, not slug)").option("--card-category3-field <uuid>", "KANBAN card category 3 field (UUID, not slug)").option("--card-category4-field <uuid>", "TIMELINE card category 4 field (UUID, not slug)").option("--card-description-field <uuid>", "KANBAN/TIMELINE card description field (UUID, not slug)").option("--aggregation-method <method>", "KANBAN card aggregation method (e.g. sum)").option("--aggregation-field <uuid>", "KANBAN card aggregation field (UUID, not slug)").option("--view-state <json>", "KANBAN/TIMELINE viewState UI scalars (columnOrder, granularity, sidebarWidth, show* ...)").option("--view-state-file <path>", "read --view-state JSON from a file").option("--hierarchy-label <name>", "HIERARCHY label column name").option("--hierarchy-info <id:name>", "HIERARCHY info column; id is a unique opaque column id you choose (e.g. col_1779975207355_zfndknslw), not the name, and is reused as columnId in mappings (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-number <id:name:aggregation>", "HIERARCHY number column; id is a unique opaque column id (e.g. col_1779975207355_zfndknslw), not the name; aggregation SUM|AVERAGE|MINIMUM|MAXIMUM|COUNT|COUNT_DISTINCT (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-root-name <name>", "HIERARCHY root level name").option("--hierarchy-root-label-field <uuid>", "HIERARCHY root level label field (UUID, not slug)").option("--hierarchy-root-info <columnId:fieldId>", "HIERARCHY root info mapping; columnId must match a --hierarchy-info id (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-root-number <columnId:fieldId>", "HIERARCHY root number mapping; columnId must match a --hierarchy-number id (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-child <json>", "HIERARCHY child level JSON {name,schemaId,childFieldId,labelFieldId,infoMappings,numberMappings} (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-config <json>", "HIERARCHY full hierarchyConfig JSON (escape hatch)").option("--hierarchy-config-file <path>", "read --hierarchy-config JSON from a file").option("--raw <json>").option("--raw-file <path>").action(async function action(display, commandOptions) {
|
|
3691
3692
|
const { api, json, readOnly } = createDisplaysApi(this, filePath);
|
|
3692
3693
|
ensureWritable("displays widgets create", readOnly, "write");
|
|
3693
3694
|
const data = await api.createWidget(display, buildWidgetBody(commandOptions));
|
|
@@ -3697,7 +3698,7 @@ function registerDisplaysCommands(program, options = {}) {
|
|
|
3697
3698
|
}
|
|
3698
3699
|
writeLine(stdout, `Created widget on display "${display.value}".`);
|
|
3699
3700
|
});
|
|
3700
|
-
widgets.command("update").description("Update widget").argument("<display>", "display uuid or slug", parseUuidOrSlugSelector).argument("<widget>", "widget id").option("--type <type>").option("--name <name>").option("--description <text>").option("--icon <icon>").option("--color <color>").option("--origin-resource <uuid>").option("--origin-subschema").option("--tab <tabId>").option("--slot <slotId>").option("--layout <json>").option("--layout-file <path>").option("--field <field>", "visible field (repeatable); merged into the saved view: visible columns keep position/width, hidden or new ones go to the end, omitted ones are hidden", (v, p = []) => [...p, v], []).option("--sort <sort>", "repeatable sort", (v, p = []) => [...p, v], []).option("--filter <expr>", "repeatable filter", collectFilters, []).option("--widget-read-only").option("--hide-add-button").option("--hide-delete-button").option("--hide-sort-button").option("--hide-filter-button").option("--hide-see-button").option("--allow-export", "TABLE only: users of the display can export to CSV the records and columns they see in the widget").option("--no-allow-export", "TABLE only: turn CSV export of the widget off").option("--lock-field <field>", "lock a field permanently in this widget (repeatable; field UUID or slug)", (v, p = []) => [...p, v], []).option("--lock-condition <expr>", 'conditional lock "<lockedField>:<field>:<comparator>[:<value>]"; locks <lockedField> when all its conditions match, or any with --lock-match (repeatable)', collectLockConditions, []).option("--lock-match <field:all|any>", "how the conditions of a lock combine: all (default) or any (repeatable)", collectLockMatches, []).option("--lock-option <field:option>", "lock only this option of an option field (repeatable; option name or id); its other options and leaving it empty stay allowed", collectLockOptions, []).option("--lock-message-before <field:text>", "message shown while a conditional lock is not met yet (repeatable)", collectLockMessages, []).option("--lock-message-after <field:text>", "message shown once the field is locked (repeatable)", collectLockMessages, []).option("--clear-locked-fields", "clear the widget locked-fields configuration").option("--calc <type>").option("--calc-field <uuid>").option("--kpi-config <json>").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").option("--y-axis-serie <json>", "repeatable y axis serie", (v, p = []) => [...p, v], []).option("--legend <json>").option("--column-field <uuid>", "KANBAN column field (UUID, not slug)").option("--swimlane-field <uuid>", "KANBAN swimlane field (UUID, not slug)").option("--start-date-field <uuid>", "TIMELINE start date field (UUID, not slug)").option("--end-date-field <uuid>", "TIMELINE end date field (UUID, not slug)").option("--label-field <uuid>", "TIMELINE label field (UUID, not slug)").option("--group-field <uuid>", "TIMELINE group field (UUID, not slug)").option("--subgroup-field <uuid>", "TIMELINE subgroup field (UUID, not slug)").option("--progress-field <uuid>", "TIMELINE progress field (UUID, not slug)").option("--card-title-field <uuid>", "KANBAN/TIMELINE card title field (UUID, not slug)").option("--card-category1-field <uuid>", "KANBAN/TIMELINE card category 1 field (UUID, not slug)").option("--card-category2-field <uuid>", "KANBAN/TIMELINE card category 2 field (UUID, not slug)").option("--card-category3-field <uuid>", "KANBAN card category 3 field (UUID, not slug)").option("--card-category4-field <uuid>", "TIMELINE card category 4 field (UUID, not slug)").option("--card-description-field <uuid>", "KANBAN/TIMELINE card description field (UUID, not slug)").option("--aggregation-method <method>", "KANBAN card aggregation method (e.g. sum)").option("--aggregation-field <uuid>", "KANBAN card aggregation field (UUID, not slug)").option("--view-state <json>", "KANBAN/TIMELINE viewState UI scalars (columnOrder, granularity, sidebarWidth, show* ...); merged key by key into the saved viewState").option("--view-state-file <path>", "read --view-state JSON from a file").option("--hierarchy-label <name>", "HIERARCHY label column name").option("--hierarchy-info <id:name>", "HIERARCHY info column; id is a unique opaque column id you choose (e.g. col_1779975207355_zfndknslw), not the name, and is reused as columnId in mappings (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-number <id:name:aggregation>", "HIERARCHY number column; id is a unique opaque column id (e.g. col_1779975207355_zfndknslw), not the name; aggregation SUM|AVERAGE|MINIMUM|MAXIMUM|COUNT|COUNT_DISTINCT (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-root-name <name>", "HIERARCHY root level name").option("--hierarchy-root-label-field <uuid>", "HIERARCHY root level label field (UUID, not slug)").option("--hierarchy-root-info <columnId:fieldId>", "HIERARCHY root info mapping; columnId must match a --hierarchy-info id (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-root-number <columnId:fieldId>", "HIERARCHY root number mapping; columnId must match a --hierarchy-number id (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-child <json>", "HIERARCHY child level JSON {name,schemaId,childFieldId,labelFieldId,infoMappings,numberMappings} (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-config <json>", "HIERARCHY full hierarchyConfig JSON (escape hatch)").option("--hierarchy-config-file <path>", "read --hierarchy-config JSON from a file").option("--raw <json>").option("--raw-file <path>").action(async function action(display, widgetId, commandOptions) {
|
|
3701
|
+
widgets.command("update").description("Update widget").argument("<display>", "display uuid or slug", parseUuidOrSlugSelector).argument("<widget>", "widget id").option("--type <type>").option("--name <name>").option("--description <text>").option("--icon <icon>").option("--color <color>").option("--origin-resource <uuid>").option("--origin-subschema").option("--tab <tabId>").option("--slot <slotId>").option("--layout <json>").option("--layout-file <path>").option("--field <field>", "visible field (repeatable); merged into the saved view: visible columns keep position/width, hidden or new ones go to the end, omitted ones are hidden", (v, p = []) => [...p, v], []).option("--sort <sort>", "repeatable sort", (v, p = []) => [...p, v], []).option("--filter <expr>", "repeatable filter", collectFilters, []).option("--widget-read-only").option("--hide-add-button").option("--hide-delete-button").option("--hide-sort-button").option("--hide-filter-button").option("--hide-see-button").option("--allow-export", "TABLE only: users of the display can export to CSV the records and columns they see in the widget").option("--no-allow-export", "TABLE only: turn CSV export of the widget off").option("--lock-field <field>", "lock a field permanently in this widget (repeatable; field UUID or slug)", (v, p = []) => [...p, v], []).option("--lock-condition <expr>", 'conditional lock "<lockedField>:<field>:<comparator>[:<value>]"; locks <lockedField> when all its conditions match, or any with --lock-match (repeatable)', collectLockConditions, []).option("--lock-match <field:all|any>", "how the conditions of a lock combine: all (default) or any (repeatable)", collectLockMatches, []).option("--lock-option <field:option>", "lock only this option of an option field (repeatable; option name or id); its other options and leaving it empty stay allowed", collectLockOptions, []).option("--lock-message-before <field:text>", "message shown while a conditional lock is not met yet (repeatable)", collectLockMessages, []).option("--lock-message-after <field:text>", "message shown once the field is locked (repeatable)", collectLockMessages, []).option("--clear-locked-fields", "clear the widget locked-fields configuration").option("--calc <type>").option("--calc-field <uuid>").option("--kpi-config <json>").option("--chart-type <type>", "chart type (lines, bars, horizontalBars, stackedBars, combined); horizontalBars puts one category per row, for rankings").option("--chart-sort-order <order>", "category order (alphabetical, valueDesc, valueAsc) by the first series; only bars and horizontalBars sort by value, and a chart grouped by a date is always chronological (the API refuses a value order there)").option("--x-axis-field <uuid>").option("--x-axis-date-format <granularity>", "time granularity (DATE, MONTH_YEAR, QUARTER_YEAR, YEAR)").option("--x-axis-time-series").option("--y-axis-serie <json>", "repeatable y axis serie", (v, p = []) => [...p, v], []).option("--legend <json>", "accepted for compatibility and ignored: the web shows the legend when there are 2+ series").option("--column-field <uuid>", "KANBAN column field (UUID, not slug)").option("--swimlane-field <uuid>", "KANBAN swimlane field (UUID, not slug)").option("--start-date-field <uuid>", "TIMELINE start date field (UUID, not slug)").option("--end-date-field <uuid>", "TIMELINE end date field (UUID, not slug)").option("--label-field <uuid>", "TIMELINE label field (UUID, not slug)").option("--group-field <uuid>", "TIMELINE group field (UUID, not slug)").option("--subgroup-field <uuid>", "TIMELINE subgroup field (UUID, not slug)").option("--progress-field <uuid>", "TIMELINE progress field (UUID, not slug)").option("--card-title-field <uuid>", "KANBAN/TIMELINE card title field (UUID, not slug)").option("--card-category1-field <uuid>", "KANBAN/TIMELINE card category 1 field (UUID, not slug)").option("--card-category2-field <uuid>", "KANBAN/TIMELINE card category 2 field (UUID, not slug)").option("--card-category3-field <uuid>", "KANBAN card category 3 field (UUID, not slug)").option("--card-category4-field <uuid>", "TIMELINE card category 4 field (UUID, not slug)").option("--card-description-field <uuid>", "KANBAN/TIMELINE card description field (UUID, not slug)").option("--aggregation-method <method>", "KANBAN card aggregation method (e.g. sum)").option("--aggregation-field <uuid>", "KANBAN card aggregation field (UUID, not slug)").option("--view-state <json>", "KANBAN/TIMELINE viewState UI scalars (columnOrder, granularity, sidebarWidth, show* ...); merged key by key into the saved viewState").option("--view-state-file <path>", "read --view-state JSON from a file").option("--hierarchy-label <name>", "HIERARCHY label column name").option("--hierarchy-info <id:name>", "HIERARCHY info column; id is a unique opaque column id you choose (e.g. col_1779975207355_zfndknslw), not the name, and is reused as columnId in mappings (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-number <id:name:aggregation>", "HIERARCHY number column; id is a unique opaque column id (e.g. col_1779975207355_zfndknslw), not the name; aggregation SUM|AVERAGE|MINIMUM|MAXIMUM|COUNT|COUNT_DISTINCT (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-root-name <name>", "HIERARCHY root level name").option("--hierarchy-root-label-field <uuid>", "HIERARCHY root level label field (UUID, not slug)").option("--hierarchy-root-info <columnId:fieldId>", "HIERARCHY root info mapping; columnId must match a --hierarchy-info id (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-root-number <columnId:fieldId>", "HIERARCHY root number mapping; columnId must match a --hierarchy-number id (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-child <json>", "HIERARCHY child level JSON {name,schemaId,childFieldId,labelFieldId,infoMappings,numberMappings} (repeatable)", (v, p = []) => [...p, v], []).option("--hierarchy-config <json>", "HIERARCHY full hierarchyConfig JSON (escape hatch)").option("--hierarchy-config-file <path>", "read --hierarchy-config JSON from a file").option("--raw <json>").option("--raw-file <path>").action(async function action(display, widgetId, commandOptions) {
|
|
3701
3702
|
const { api, json, readOnly } = createDisplaysApi(this, filePath);
|
|
3702
3703
|
ensureWritable("displays widgets update", readOnly, "write");
|
|
3703
3704
|
const data = await api.updateWidget(display, widgetId, buildWidgetBody(commandOptions));
|
|
@@ -3932,6 +3933,7 @@ async function downloadToOutput(download, stdout, outputPath) {
|
|
|
3932
3933
|
}
|
|
3933
3934
|
|
|
3934
3935
|
// src/commands/document-templates.ts
|
|
3936
|
+
var FILE_NAME_PATTERN_HELP = 'generated file name: text plus record variables, e.g. "Budget {{ record.number }} - {{ record.client }}"; each PDF is named <resolved name>-vN.pdf';
|
|
3935
3937
|
function createDocumentTemplatesApi(command, filePath) {
|
|
3936
3938
|
const { client, ...runtime } = createCommandContext(command, filePath);
|
|
3937
3939
|
return { api: new DocumentTemplatesApi(client), ...runtime };
|
|
@@ -3974,6 +3976,7 @@ function templateRows(templates) {
|
|
|
3974
3976
|
return templates.map((template) => ({
|
|
3975
3977
|
id: template.id ?? "",
|
|
3976
3978
|
name: template.name ?? "",
|
|
3979
|
+
fileNamePattern: template.fileNamePattern ?? "",
|
|
3977
3980
|
assetCount: Array.isArray(template.assets) ? template.assets.length : 0,
|
|
3978
3981
|
updatedAt: template.updatedAt ?? ""
|
|
3979
3982
|
}));
|
|
@@ -4027,6 +4030,9 @@ function buildCreateInput(options) {
|
|
|
4027
4030
|
if (typeof input.name !== "string" || input.name.trim().length === 0) {
|
|
4028
4031
|
throw new CliError("invalid_cli_usage", 'Provide template name via "--name".');
|
|
4029
4032
|
}
|
|
4033
|
+
if (options.fileNamePattern !== void 0) {
|
|
4034
|
+
input.fileNamePattern = options.fileNamePattern;
|
|
4035
|
+
}
|
|
4030
4036
|
if (input.assets === void 0) {
|
|
4031
4037
|
input.assets = [];
|
|
4032
4038
|
}
|
|
@@ -4037,11 +4043,34 @@ function buildUpdateInput(options) {
|
|
|
4037
4043
|
if (options.name !== void 0) {
|
|
4038
4044
|
input.name = options.name;
|
|
4039
4045
|
}
|
|
4046
|
+
if (options.fileNamePattern !== void 0 && options.clearFileNamePattern) {
|
|
4047
|
+
throw new CliError(
|
|
4048
|
+
"invalid_cli_usage",
|
|
4049
|
+
'Use either "--file-name-pattern" or "--clear-file-name-pattern", not both.'
|
|
4050
|
+
);
|
|
4051
|
+
}
|
|
4052
|
+
if (options.fileNamePattern !== void 0) {
|
|
4053
|
+
input.fileNamePattern = options.fileNamePattern;
|
|
4054
|
+
} else if (options.clearFileNamePattern) {
|
|
4055
|
+
input.fileNamePattern = null;
|
|
4056
|
+
}
|
|
4040
4057
|
if (isEmptyObject(input)) {
|
|
4041
|
-
throw new CliError(
|
|
4058
|
+
throw new CliError(
|
|
4059
|
+
"invalid_cli_usage",
|
|
4060
|
+
'Provide template updates via "--name", "--file-name-pattern" or "--clear-file-name-pattern".'
|
|
4061
|
+
);
|
|
4042
4062
|
}
|
|
4043
4063
|
return input;
|
|
4044
4064
|
}
|
|
4065
|
+
function ensureFileNamePatternSupported(input, response) {
|
|
4066
|
+
if ("fileNamePattern" in input && !("fileNamePattern" in response)) {
|
|
4067
|
+
throw new CliError(
|
|
4068
|
+
"http_error",
|
|
4069
|
+
"The API saved the template but did not apply fileNamePattern: this server does not support generated file names yet.",
|
|
4070
|
+
{ template: response.id ?? null }
|
|
4071
|
+
);
|
|
4072
|
+
}
|
|
4073
|
+
}
|
|
4045
4074
|
function registerDocumentTemplatesCommands(program, options = {}) {
|
|
4046
4075
|
const filePath = options.configPath ?? defaultConfigPath;
|
|
4047
4076
|
const stdout = options.stdout ?? process.stdout;
|
|
@@ -4053,7 +4082,11 @@ function registerDocumentTemplatesCommands(program, options = {}) {
|
|
|
4053
4082
|
emitJson(stdout, "document-templates list", data, filePath);
|
|
4054
4083
|
return;
|
|
4055
4084
|
}
|
|
4056
|
-
printTable(
|
|
4085
|
+
printTable(
|
|
4086
|
+
templateRows(data),
|
|
4087
|
+
["id", "name", "fileNamePattern", "assetCount", "updatedAt"],
|
|
4088
|
+
stdout
|
|
4089
|
+
);
|
|
4057
4090
|
});
|
|
4058
4091
|
templates.command("get").description("Get a document template by UUID or exact name").argument("<template>", "template UUID or exact name", parseUuidOrSlugSelector).action(async function action(template) {
|
|
4059
4092
|
const { api, json } = createDocumentTemplatesApi(this, filePath);
|
|
@@ -4065,21 +4098,28 @@ function registerDocumentTemplatesCommands(program, options = {}) {
|
|
|
4065
4098
|
}
|
|
4066
4099
|
printTable([data], void 0, stdout);
|
|
4067
4100
|
});
|
|
4068
|
-
templates.command("create").description("Create a document template").option("--name <name>", "template name").option("--raw <json>", "raw create JSON payload").option("--raw-file <path>", "path to raw create JSON payload").action(async function action(commandOptions) {
|
|
4101
|
+
templates.command("create").description("Create a document template").option("--name <name>", "template name").option("--file-name-pattern <pattern>", FILE_NAME_PATTERN_HELP).option("--raw <json>", "raw create JSON payload").option("--raw-file <path>", "path to raw create JSON payload").action(async function action(commandOptions) {
|
|
4069
4102
|
const { api, json, readOnly } = createDocumentTemplatesApi(this, filePath);
|
|
4070
4103
|
ensureWritable("document-templates create", readOnly, "write");
|
|
4071
|
-
const
|
|
4104
|
+
const input = buildCreateInput(commandOptions);
|
|
4105
|
+
const data = await api.createTemplate(input);
|
|
4106
|
+
ensureFileNamePatternSupported(input, data);
|
|
4072
4107
|
if (json) {
|
|
4073
4108
|
emitJson(stdout, "document-templates create", data, filePath);
|
|
4074
4109
|
return;
|
|
4075
4110
|
}
|
|
4076
4111
|
writeLine(stdout, `Created document template "${String(data.name ?? commandOptions.name)}".`);
|
|
4077
4112
|
});
|
|
4078
|
-
templates.command("update").description("Rename a document template").argument("<template>", "template UUID or exact name", parseUuidOrSlugSelector).option("--name <name>", "new template name").
|
|
4113
|
+
templates.command("update").description("Rename a document template or set its generated file name").argument("<template>", "template UUID or exact name", parseUuidOrSlugSelector).option("--name <name>", "new template name").option("--file-name-pattern <pattern>", FILE_NAME_PATTERN_HELP).option(
|
|
4114
|
+
"--clear-file-name-pattern",
|
|
4115
|
+
"remove the generated file name: generated files are named after the template again"
|
|
4116
|
+
).action(async function action(template, commandOptions) {
|
|
4079
4117
|
const { api, json, readOnly } = createDocumentTemplatesApi(this, filePath);
|
|
4080
4118
|
ensureWritable("document-templates update", readOnly, "write");
|
|
4119
|
+
const input = buildUpdateInput(commandOptions);
|
|
4081
4120
|
const resolved = await resolveTemplateSelector(api, template);
|
|
4082
|
-
const data = await api.updateTemplate(resolved,
|
|
4121
|
+
const data = await api.updateTemplate(resolved, input);
|
|
4122
|
+
ensureFileNamePatternSupported(input, data);
|
|
4083
4123
|
if (json) {
|
|
4084
4124
|
emitJson(stdout, "document-templates update", data, filePath);
|
|
4085
4125
|
return;
|