zinkee 0.1.42 → 0.1.44

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 CHANGED
@@ -144,7 +144,7 @@ zinkee --json schemas get projects
144
144
  Simple field types use `--type`, `--slug`, `--label`:
145
145
 
146
146
  ```bash
147
- zinkee schemas fields create projects --type text --slug name --label "Name"
147
+ zinkee schemas fields create projects --type text --slug name --label "Name" --description "Primary project name"
148
148
  zinkee schemas fields create projects --type number --slug budget --label "Budget" --required true --default 0
149
149
  zinkee schemas fields create projects --type date --slug start-date --label "Start Date"
150
150
  zinkee schemas fields create projects --type file --slug attachment --label "Attachment"
@@ -206,6 +206,8 @@ Use `--default <value>` for the common default-value case:
206
206
 
207
207
  ```bash
208
208
  zinkee schemas fields update projects budget --default 0
209
+ zinkee schemas fields update projects budget --description "Approved project budget"
210
+ zinkee schemas fields update projects budget --description "" # Clear the description
209
211
  ```
210
212
 
211
213
  PATCH bodies are flat (no `set` / `unset` wrapper). Config properties must be wrapped inside a `config` key:
@@ -454,8 +456,8 @@ zinkee displays folders delete "Executive Dashboards"
454
456
  ### Creation flow
455
457
 
456
458
  1. Create the display
457
- 2. Create context variables
458
- 3. Create widgets with `variableMap` bindings
459
+ 2. Create context variables — optional; a display without variables shows every widget unfiltered
460
+ 3. Create widgets, binding them to the variables through `variableMap` if the display has any
459
461
  4. Set freeform layout positions
460
462
 
461
463
  ### Templates
@@ -469,7 +471,11 @@ zinkee displays folders delete "Executive Dashboards"
469
471
  ### Create a freeform display
470
472
 
471
473
  ```bash
472
- zinkee --json displays create --name "Project Dashboard" --template freeform
474
+ zinkee --json displays create --name "Project Dashboard" \
475
+ --description "Project delivery overview" \
476
+ --template freeform
477
+ zinkee --json displays update <display-uuid> --description "Updated overview"
478
+ zinkee --json displays update <display-uuid> --description "" # Clear the description
473
479
  ```
474
480
 
475
481
  ### Add a context variable
@@ -486,11 +492,12 @@ Variables accept slugs for `--source-schema` and `--source-field`.
486
492
 
487
493
  ### Add widgets
488
494
 
489
- Every widget MUST include a `variableMap` that maps each display variable to a field in the widget's schema:
495
+ A widget's `variableMap` maps display variables to fields in the widget's schema. It is optional: a
496
+ widget that binds no variable shows its whole table, bounded only by its own filters.
490
497
 
491
498
  - **Same schema as variable**: bind to the same display field (e.g., `project-name`)
492
499
  - **Different schema**: bind to the ReferenceField pointing to the variable's schema (e.g., `task-project`)
493
- - **No filtering**: set to `null`
500
+ - **No filtering**: set to `null`, or leave the variable out of the map
494
501
 
495
502
  ```bash
496
503
  # Table widget (--field accepts slugs)
package/dist/index.js CHANGED
@@ -2611,6 +2611,20 @@ var specificExamples = {
2611
2611
  }
2612
2612
  ]),
2613
2613
  "schemas fields update": buildCommandExamples([
2614
+ {
2615
+ description: "Set the field description without changing its label or configuration.",
2616
+ command: 'zinkee --json schemas fields update contacts contact-name --description "Primary name shown for the customer"',
2617
+ raw: `{
2618
+ "description": "Primary name shown for the customer"
2619
+ }`
2620
+ },
2621
+ {
2622
+ description: "Clear the field description.",
2623
+ command: 'zinkee --json schemas fields update contacts contact-name --description ""',
2624
+ raw: `{
2625
+ "description": ""
2626
+ }`
2627
+ },
2614
2628
  {
2615
2629
  description: "Rename slug and label.",
2616
2630
  command: `zinkee --json schemas fields update contacts contact-name --label "Customer Full Name" --raw '{"slug":"customer-full-name"}'`,
@@ -3380,10 +3394,11 @@ var specificExamples = {
3380
3394
  ]),
3381
3395
  "displays create": buildCommandExamples([
3382
3396
  {
3383
- description: "Create a freeform display with an initial widget layout. Freeform layouts travel through --freeform-layouts.",
3384
- command: `zinkee --json displays create --name "Control Proyecto Freeform" --template freeform --freeform-layouts '{"lg":[{"i":"widget-1","x":0,"y":0,"w":6,"h":5}]}'`,
3397
+ description: "Create a described freeform display with an initial widget layout. Freeform layouts travel through --freeform-layouts.",
3398
+ command: `zinkee --json displays create --name "Control Proyecto Freeform" --description "Project delivery overview" --template freeform --freeform-layouts '{"lg":[{"i":"widget-1","x":0,"y":0,"w":6,"h":5}]}'`,
3385
3399
  raw: `{
3386
3400
  "name": "Control Proyecto Freeform",
3401
+ "description": "Project delivery overview",
3387
3402
  "layout": {
3388
3403
  "template": "freeform",
3389
3404
  "freeformLayouts": {
@@ -5220,6 +5235,20 @@ var specificExamples = {
5220
5235
  }
5221
5236
  ]),
5222
5237
  "displays update": buildCommandExamples([
5238
+ {
5239
+ description: "Update only the display description.",
5240
+ command: 'zinkee --json displays update 0f6f062f-1478-4df2-96a1-c495d037d260 --description "Sales pipeline overview"',
5241
+ raw: `{
5242
+ "description": "Sales pipeline overview"
5243
+ }`
5244
+ },
5245
+ {
5246
+ description: "Clear the display description.",
5247
+ command: 'zinkee --json displays update 0f6f062f-1478-4df2-96a1-c495d037d260 --description ""',
5248
+ raw: `{
5249
+ "description": ""
5250
+ }`
5251
+ },
5223
5252
  {
5224
5253
  description: "Rename a display (patch of top-level metadata only).",
5225
5254
  command: 'zinkee --json displays update 0f6f062f-1478-4df2-96a1-c495d037d260 --name "Pipeline overview (renamed)"',
@@ -6516,8 +6545,21 @@ function buildSchemaFieldCreateExamples(type) {
6516
6545
  const flat = filteredDefinitions.flatMap(
6517
6546
  (definition) => definition.examplePayloads.map((example) => ({ definition, example }))
6518
6547
  );
6519
- return buildCommandExamples(
6520
- flat.map(({ example }, index) => {
6548
+ const flagExamples = selectedDefinition === void 0 || selectedDefinition.key === "text" ? [
6549
+ {
6550
+ description: "Text field with a description.",
6551
+ command: 'zinkee --json schemas fields create contacts --type text --slug customer-name --label "Customer Name" --description "Primary name shown for the customer"',
6552
+ raw: `{
6553
+ "type": "TextField",
6554
+ "slug": "customer-name",
6555
+ "label": "Customer Name",
6556
+ "description": "Primary name shown for the customer"
6557
+ }`
6558
+ }
6559
+ ] : [];
6560
+ return buildCommandExamples([
6561
+ ...flagExamples,
6562
+ ...flat.map(({ example }, index) => {
6521
6563
  const slug = typeof example.payload.slug === "string" ? example.payload.slug : "field";
6522
6564
  const command = `zinkee --json schemas fields create contacts --raw '${JSON.stringify(example.payload)}'`;
6523
6565
  if (index === 0) {
@@ -6536,7 +6578,7 @@ function buildSchemaFieldCreateExamples(type) {
6536
6578
  command
6537
6579
  };
6538
6580
  })
6539
- );
6581
+ ]);
6540
6582
  }
6541
6583
  function getCommandExamples(commandName, filters = {}) {
6542
6584
  const examples = commandName === "schemas fields create" ? buildSchemaFieldCreateExamples(filters.type) : specificExamples[commandName] ?? fallbackExamples(commandName);
@@ -9647,7 +9689,7 @@ function registerDisplaysCommands(program, options = {}) {
9647
9689
  }
9648
9690
  printTable([{ id: data.id, name: data.name ?? "", layoutTemplate: data.layout?.template ?? "" }], ["id", "name", "layoutTemplate"], stdout);
9649
9691
  });
9650
- displays.command("create").description("Create a display").requiredOption("--name <name>", "display name").requiredOption("--template <template>", "layout template").option("--freeform-layouts <json>", "freeform layouts JSON").option("--freeform-layouts-file <path>", "freeform layouts JSON file").action(async function action(commandOptions) {
9692
+ displays.command("create").description("Create a display").requiredOption("--name <name>", "display name").option("--description <text>", "display description").requiredOption("--template <template>", "layout template").option("--freeform-layouts <json>", "freeform layouts JSON").option("--freeform-layouts-file <path>", "freeform layouts JSON file").action(async function action(commandOptions) {
9651
9693
  const { api, json, readOnly } = createDisplaysApi(this, filePath);
9652
9694
  ensureWritable3("displays create", readOnly, "write");
9653
9695
  const layout2 = { template: commandOptions.template };
@@ -9658,18 +9700,30 @@ function registerDisplaysCommands(program, options = {}) {
9658
9700
  "--freeform-layouts-file"
9659
9701
  );
9660
9702
  if (freeformLayouts !== void 0) layout2.freeformLayouts = freeformLayouts;
9661
- const data = await api.createDisplay({ name: commandOptions.name, layout: layout2 });
9703
+ const data = await api.createDisplay({
9704
+ name: commandOptions.name,
9705
+ description: commandOptions.description,
9706
+ layout: layout2
9707
+ });
9662
9708
  if (json) {
9663
9709
  emitJson4(stdout, "displays create", data);
9664
9710
  return;
9665
9711
  }
9666
9712
  writeLine4(stdout, `Created display "${commandOptions.name}".`);
9667
9713
  });
9668
- displays.command("update").description("Update a display").argument("<display>", "display uuid or slug", parseUuidOrSlugSelector3).option("--name <name>", "display name").action(async function action(display, commandOptions) {
9714
+ displays.command("update").description("Update a display").argument("<display>", "display uuid or slug", parseUuidOrSlugSelector3).option("--name <name>", "display name").option("--description <text>", 'display description (use "" to clear)').action(async function action(display, commandOptions) {
9669
9715
  const { api, json, readOnly } = createDisplaysApi(this, filePath);
9670
9716
  ensureWritable3("displays update", readOnly, "write");
9671
- if (!commandOptions.name) throw new CliError("invalid_cli_usage", "Nothing to update.");
9672
- const data = await api.updateDisplay(display, { name: commandOptions.name });
9717
+ if (commandOptions.name === void 0 && commandOptions.description === void 0) {
9718
+ throw new CliError("invalid_cli_usage", "Nothing to update.");
9719
+ }
9720
+ if (commandOptions.name !== void 0 && commandOptions.name.trim().length === 0) {
9721
+ throw new CliError("invalid_cli_usage", "Display name cannot be empty.");
9722
+ }
9723
+ const data = await api.updateDisplay(display, {
9724
+ name: commandOptions.name,
9725
+ description: commandOptions.description
9726
+ });
9673
9727
  if (json) {
9674
9728
  emitJson4(stdout, "displays update", data);
9675
9729
  return;
@@ -12285,6 +12339,9 @@ function buildFieldCreateInput(options) {
12285
12339
  if (options.required !== void 0) {
12286
12340
  input.required = options.required;
12287
12341
  }
12342
+ if (options.description !== void 0) {
12343
+ input.description = options.description;
12344
+ }
12288
12345
  applyFieldDefaultValue(input, options.default);
12289
12346
  if ("config" in input && isJsonObject7(input.config) && isEmptyObject6(input.config)) {
12290
12347
  delete input.config;
@@ -12328,6 +12385,9 @@ function buildFieldUpdateInput(currentType, options) {
12328
12385
  if (options.required !== void 0) {
12329
12386
  input.required = options.required;
12330
12387
  }
12388
+ if (options.description !== void 0) {
12389
+ input.description = options.description;
12390
+ }
12331
12391
  applyFieldDefaultValue(input, options.default);
12332
12392
  return input;
12333
12393
  }
@@ -12511,7 +12571,7 @@ function registerSchemasCommands(program, options = {}) {
12511
12571
  }
12512
12572
  emitFieldsTable(stdout, [data]);
12513
12573
  });
12514
- fields.command("create").description(`Create a field in a schema.${buildSchemaFieldCreateHelpText()}`).argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector10).option("--type <type>", `field type (${formatSchemaFieldTypes()})`).option("--slug <slug>", "field slug").option("--label <label>", "field label").option("--required <bool>", "required flag", parseBooleanFlag).option("--default <value>", "default field value").option("--raw <json>", "raw JSON object payload (see type-specific shapes in --help)").option("--raw-file <path>", "path to a raw JSON object payload").action(async function action(schema, commandOptions) {
12574
+ fields.command("create").description(`Create a field in a schema.${buildSchemaFieldCreateHelpText()}`).argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector10).option("--type <type>", `field type (${formatSchemaFieldTypes()})`).option("--slug <slug>", "field slug").option("--label <label>", "field label").option("--description <text>", "field description").option("--required <bool>", "required flag", parseBooleanFlag).option("--default <value>", "default field value").option("--raw <json>", "raw JSON object payload (see type-specific shapes in --help)").option("--raw-file <path>", "path to a raw JSON object payload").action(async function action(schema, commandOptions) {
12515
12575
  const { api, json, readOnly } = createSchemasApi(this, filePath);
12516
12576
  ensureWritable9("schemas fields create", readOnly, "write");
12517
12577
  const input = buildFieldCreateInput(commandOptions);
@@ -12528,7 +12588,7 @@ function registerSchemasCommands(program, options = {}) {
12528
12588
  }
12529
12589
  writeLine12(stdout, `Created field "${data.slug ?? commandOptions.slug}".`);
12530
12590
  });
12531
- fields.command("update").description("Update a field in a schema").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector10).argument("<field>", "field uuid or slug", parseUuidOrSlugSelector10).option("--label <label>", "field label").option("--required <bool>", "required flag", parseBooleanFlag).option("--default <value>", "default field value").option("--raw <json>", "raw JSON object payload").option("--raw-file <path>", "path to a raw JSON object payload").action(async function action(schema, field, commandOptions) {
12591
+ fields.command("update").description("Update a field in a schema").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector10).argument("<field>", "field uuid or slug", parseUuidOrSlugSelector10).option("--label <label>", "field label").option("--description <text>", 'field description (use "" to clear)').option("--required <bool>", "required flag", parseBooleanFlag).option("--default <value>", "default field value").option("--raw <json>", "raw JSON object payload").option("--raw-file <path>", "path to a raw JSON object payload").action(async function action(schema, field, commandOptions) {
12532
12592
  const { api, json, readOnly } = createSchemasApi(this, filePath);
12533
12593
  ensureWritable9("schemas fields update", readOnly, "write");
12534
12594
  const resolvedSchema = await resolveSchemaSelector2(api, schema);
@@ -12542,7 +12602,7 @@ function registerSchemasCommands(program, options = {}) {
12542
12602
  if (isEmptyObject6(input)) {
12543
12603
  throw new CliError(
12544
12604
  "invalid_cli_usage",
12545
- 'Provide at least one field update via "--label", "--required", "--raw", or "--raw-file".'
12605
+ 'Provide at least one field update via "--label", "--description", "--required", "--default", "--raw", or "--raw-file".'
12546
12606
  );
12547
12607
  }
12548
12608
  const data = await api.updateField(resolvedSchema, resolvedField, input);