zinkee 0.1.34 → 0.1.35

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
@@ -302,6 +302,11 @@ zinkee --json records get projects <record-uuid>
302
302
  # Update
303
303
  zinkee records update projects <record-uuid> --set status=2
304
304
 
305
+ # Reference fields: pass the target record id (bare UUID or "recordId::label" — the label is
306
+ # ignored) or an exact display value. The server stores the canonical "recordId::displayValue"
307
+ # and rejects unknown references (reason "data_field_reference_not_found").
308
+ zinkee records create deals --set deal-name="Acme renewal" --set customer-ref=<target-record-uuid>
309
+
305
310
  # Delete one or more records (--record is repeatable)
306
311
  zinkee records delete projects --record <record-uuid> --record <record-uuid>
307
312
 
package/dist/index.js CHANGED
@@ -2850,7 +2850,7 @@ var specificExamples = {
2850
2850
  }`
2851
2851
  },
2852
2852
  {
2853
- description: "Create many records from a JSON array file (one object per record, slug -> value). Best-effort: valid records are created and invalid ones are reported per index in 'errors'. ReferenceField values must match the target's current targetDisplayField.",
2853
+ description: "Create many records from a JSON array file (one object per record, slug -> value). Best-effort: valid records are created and invalid ones are reported per index in 'errors'. ReferenceField values accept the target record id (a bare UUID, or the compound 'recordId::anything' whose label is ignored) or an exact display value; the server stores the canonical 'recordId::displayValue'.",
2854
2854
  command: `zinkee --json records create contacts --records-file ./records.json`,
2855
2855
  raw: `{
2856
2856
  "records": [
@@ -2881,6 +2881,29 @@ var specificExamples = {
2881
2881
  "action": "Use a valid field slug from the schema and retry."
2882
2882
  }
2883
2883
  ]
2884
+ }`
2885
+ },
2886
+ {
2887
+ description: "Set a ReferenceField by the target record id (a bare UUID, or the compound 'recordId::anything' whose label is ignored) or by an exact display value. The server resolves and stores the canonical 'recordId::displayValue'. Unknown references are rejected per index with reason 'data_field_reference_not_found'.",
2888
+ command: `zinkee --json records create deals --set deal-name="Acme renewal" --set customer-ref=00000000-0000-0000-0000-000000000000`,
2889
+ raw: `{
2890
+ "records": [
2891
+ {
2892
+ "deal-name": "Acme renewal",
2893
+ "customer-ref": "00000000-0000-0000-0000-000000000000"
2894
+ }
2895
+ ]
2896
+ }`,
2897
+ response: `{
2898
+ "created": [],
2899
+ "errors": [
2900
+ {
2901
+ "index": 0,
2902
+ "reason": "data_field_reference_not_found",
2903
+ "message": "Referenced record was not found in the target schema.",
2904
+ "action": "Use an existing record id or an existing display value for this reference field."
2905
+ }
2906
+ ]
2884
2907
  }`
2885
2908
  }
2886
2909
  ]),
@@ -2922,6 +2945,22 @@ var specificExamples = {
2922
2945
  command: "zinkee --json records update contacts 550e8400-e29b-41d4-a716-446655440000 --unset contact-email --unset due-date",
2923
2946
  raw: `{
2924
2947
  "unset": ["contact-email", "due-date"]
2948
+ }`
2949
+ },
2950
+ {
2951
+ description: "Set a ReferenceField on an existing record. Pass the target record id (a bare UUID, or the compound 'recordId::anything' whose label is ignored) or an exact display value; the response shows the canonical 'recordId::displayValue' the server stored. If the reference doesn't exist the whole update is rejected with reason 'data_field_reference_not_found'.",
2952
+ command: "zinkee --json records update deals 550e8400-e29b-41d4-a716-446655440000 --set customer-ref=8ad602a1-f6e3-43f6-9ab2-f1c5afc99621",
2953
+ raw: `{
2954
+ "set": {
2955
+ "customer-ref": "8ad602a1-f6e3-43f6-9ab2-f1c5afc99621"
2956
+ }
2957
+ }`,
2958
+ response: `{
2959
+ "recordId": "550e8400-e29b-41d4-a716-446655440000",
2960
+ "values": {
2961
+ "deal-name": "Acme renewal",
2962
+ "customer-ref": "8ad602a1-f6e3-43f6-9ab2-f1c5afc99621::Acme Corp"
2963
+ }
2925
2964
  }`
2926
2965
  }
2927
2966
  ]),
@@ -11347,7 +11386,12 @@ function registerRecordsCommands(program, options = {}) {
11347
11386
  }
11348
11387
  emitTable4(stdout, data);
11349
11388
  });
11350
- records.command("create").description("Create one or more records").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector8).option("--set <field=value>", "set a string field", collectKeyValueAssignments, []).option("--set-json <field=json>", "set a structured field", collectJsonAssignments, []).option("--raw <json>", "raw JSON object payload").option("--raw-file <path>", "path to a raw JSON object payload").option(
11389
+ records.command("create").description("Create one or more records").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector8).option(
11390
+ "--set <field=value>",
11391
+ "set a string field (reference fields: a record id, 'recordId::label', or an exact display value)",
11392
+ collectKeyValueAssignments,
11393
+ []
11394
+ ).option("--set-json <field=json>", "set a structured field", collectJsonAssignments, []).option("--raw <json>", "raw JSON object payload").option("--raw-file <path>", "path to a raw JSON object payload").option(
11351
11395
  "--records-file <path>",
11352
11396
  "path to a JSON array of record objects (mutually exclusive with --set/--set-json/--raw/--raw-file)"
11353
11397
  ).action(async function action(schema, commandOptions) {
@@ -11368,7 +11412,12 @@ function registerRecordsCommands(program, options = {}) {
11368
11412
  }
11369
11413
  }
11370
11414
  });
11371
- records.command("update").description("Update a record").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector8).argument("<record>", "record uuid or slug", parseUuidOrSlugSelector8).option("--set <field=value>", "set a string field", collectKeyValueAssignments, []).option("--set-json <field=json>", "set a structured field", collectJsonAssignments, []).option("--unset <field>", "unset a field", collectStringValues, []).option("--raw <json>", "raw JSON object of fields to set").option("--raw-file <path>", "path to a JSON object of fields to set").action(async function action(schema, record, commandOptions) {
11415
+ records.command("update").description("Update a record").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector8).argument("<record>", "record uuid or slug", parseUuidOrSlugSelector8).option(
11416
+ "--set <field=value>",
11417
+ "set a string field (reference fields: a record id, 'recordId::label', or an exact display value)",
11418
+ collectKeyValueAssignments,
11419
+ []
11420
+ ).option("--set-json <field=json>", "set a structured field", collectJsonAssignments, []).option("--unset <field>", "unset a field", collectStringValues, []).option("--raw <json>", "raw JSON object of fields to set").option("--raw-file <path>", "path to a JSON object of fields to set").action(async function action(schema, record, commandOptions) {
11372
11421
  const { api, schemasApi, json, readOnly } = createRecordsApi(this, filePath);
11373
11422
  ensureWritable7("records update", readOnly, "write");
11374
11423
  const resolvedSchema = await resolveSchemaSelector(schemasApi, schema);