zinkee 0.1.32 → 0.1.34
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 +9 -3
- package/dist/index.js +197 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/records.ts +21 -11
- package/src/commands/records.test.ts +236 -10
- package/src/commands/records.ts +169 -22
- package/src/utils/examples.ts +60 -25
package/src/utils/examples.ts
CHANGED
|
@@ -677,38 +677,58 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
677
677
|
]),
|
|
678
678
|
"records create": buildCommandExamples([
|
|
679
679
|
{
|
|
680
|
-
description:
|
|
680
|
+
description:
|
|
681
|
+
"Create a single record with --set/--set-json (the single-record flags build one record, sent as a one-element 'records' array).",
|
|
681
682
|
command:
|
|
682
683
|
`zinkee --json records create contacts --set contact-name="Ada Lovelace" --set contact-email=ada@example.com`,
|
|
683
684
|
raw: `{
|
|
684
|
-
"
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
685
|
+
"records": [
|
|
686
|
+
{
|
|
687
|
+
"contact-name": "Ada Lovelace",
|
|
688
|
+
"contact-email": "ada@example.com"
|
|
689
|
+
}
|
|
690
|
+
]
|
|
688
691
|
}`,
|
|
689
692
|
response: `{
|
|
690
|
-
"
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
}
|
|
693
|
+
"created": [
|
|
694
|
+
"550e8400-e29b-41d4-a716-446655440000"
|
|
695
|
+
],
|
|
696
|
+
"errors": []
|
|
695
697
|
}`,
|
|
696
698
|
},
|
|
697
699
|
{
|
|
698
700
|
description:
|
|
699
|
-
"Create a
|
|
700
|
-
command:
|
|
701
|
-
`zinkee --json records create contacts --set contact-name="Grace Hopper" --set contact-email=grace@example.com --set status=2 --set amount=1999.99 --set due-date=2026-06-01T09:00:00Z --set customer-ref="CUST-12" --set owner=6c8a3e0d-4e5f-4a1b-9c2d-3e4f5a6b7c8d`,
|
|
701
|
+
"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.",
|
|
702
|
+
command: `zinkee --json records create contacts --records-file ./records.json`,
|
|
702
703
|
raw: `{
|
|
703
|
-
"
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
704
|
+
"records": [
|
|
705
|
+
{
|
|
706
|
+
"contact-name": "Ada Lovelace",
|
|
707
|
+
"contact-email": "ada@example.com"
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
"contact-name": "Grace Hopper",
|
|
711
|
+
"contact-email": "grace@example.com",
|
|
712
|
+
"status": 2,
|
|
713
|
+
"amount": 1999.99,
|
|
714
|
+
"due-date": "2026-06-01T09:00:00Z",
|
|
715
|
+
"customer-ref": "8ad602a1-f6e3-43f6-9ab2-f1c5afc99621",
|
|
716
|
+
"owner": "6c8a3e0d-4e5f-4a1b-9c2d-3e4f5a6b7c8d"
|
|
717
|
+
}
|
|
718
|
+
]
|
|
719
|
+
}`,
|
|
720
|
+
response: `{
|
|
721
|
+
"created": [
|
|
722
|
+
"550e8400-e29b-41d4-a716-446655440000"
|
|
723
|
+
],
|
|
724
|
+
"errors": [
|
|
725
|
+
{
|
|
726
|
+
"index": 1,
|
|
727
|
+
"reason": "record_field_not_found",
|
|
728
|
+
"message": "Field 'contact-emial' was not found in schema '2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e'.",
|
|
729
|
+
"action": "Use a valid field slug from the schema and retry."
|
|
730
|
+
}
|
|
731
|
+
]
|
|
712
732
|
}`,
|
|
713
733
|
},
|
|
714
734
|
]),
|
|
@@ -2461,10 +2481,25 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
2461
2481
|
]),
|
|
2462
2482
|
"records delete": buildCommandExamples([
|
|
2463
2483
|
{
|
|
2464
|
-
description: "Delete
|
|
2465
|
-
command: `zinkee --json records delete contacts
|
|
2484
|
+
description: "Delete one or more records by id (--record is repeatable).",
|
|
2485
|
+
command: `zinkee --json records delete contacts --record 550e8400-e29b-41d4-a716-446655440000 --record 6c8a3e0d-4e5f-4a1b-9c2d-3e4f5a6b7c8d`,
|
|
2466
2486
|
response: `{
|
|
2467
|
-
"
|
|
2487
|
+
"recordIds": [
|
|
2488
|
+
"550e8400-e29b-41d4-a716-446655440000",
|
|
2489
|
+
"6c8a3e0d-4e5f-4a1b-9c2d-3e4f5a6b7c8d"
|
|
2490
|
+
],
|
|
2491
|
+
"deleted": true
|
|
2492
|
+
}`,
|
|
2493
|
+
},
|
|
2494
|
+
{
|
|
2495
|
+
description:
|
|
2496
|
+
"Delete many records listing one uuid per line in a file (merged with any --record flags and de-duplicated).",
|
|
2497
|
+
command: `zinkee --json records delete contacts --records-file ./record-ids.txt`,
|
|
2498
|
+
response: `{
|
|
2499
|
+
"recordIds": [
|
|
2500
|
+
"550e8400-e29b-41d4-a716-446655440000",
|
|
2501
|
+
"6c8a3e0d-4e5f-4a1b-9c2d-3e4f5a6b7c8d"
|
|
2502
|
+
],
|
|
2468
2503
|
"deleted": true
|
|
2469
2504
|
}`,
|
|
2470
2505
|
},
|