zinkee 0.1.8 → 0.1.9
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 +7 -1
- package/dist/index.js +358 -1325
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/schemas.test.ts +136 -0
- package/src/commands/schemas.ts +31 -0
- package/src/index.test.ts +1 -0
- package/.claude/settings.local.json +0 -16
package/dist/index.js
CHANGED
|
@@ -674,13 +674,6 @@ var commandRegistry = {
|
|
|
674
674
|
supportsRaw: true,
|
|
675
675
|
output: writeOutput
|
|
676
676
|
},
|
|
677
|
-
"logs list": {
|
|
678
|
-
command: "logs list",
|
|
679
|
-
accessLevel: "read",
|
|
680
|
-
supportsExample: true,
|
|
681
|
-
supportsRaw: false,
|
|
682
|
-
output: readOutput
|
|
683
|
-
},
|
|
684
677
|
"teamspace folders list": {
|
|
685
678
|
command: "teamspace folders list",
|
|
686
679
|
accessLevel: "read",
|
|
@@ -1615,484 +1608,132 @@ var fieldTypeDefinitions = [
|
|
|
1615
1608
|
className: "TextField",
|
|
1616
1609
|
aliases: ["text", "TextField"],
|
|
1617
1610
|
description: "Plain text field.",
|
|
1618
|
-
rawShape: '{"type":"
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
slug: "customer-name",
|
|
1625
|
-
label: "Customer Name",
|
|
1626
|
-
required: true,
|
|
1627
|
-
config: {
|
|
1628
|
-
textType: "NORMAL",
|
|
1629
|
-
defaultValue: null,
|
|
1630
|
-
conditionalFormatting: []
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
},
|
|
1634
|
-
{
|
|
1635
|
-
name: "Text field (long)",
|
|
1636
|
-
payload: {
|
|
1637
|
-
type: "TextField",
|
|
1638
|
-
slug: "customer-notes",
|
|
1639
|
-
label: "Customer Notes",
|
|
1640
|
-
required: false,
|
|
1641
|
-
config: {
|
|
1642
|
-
textType: "LONG",
|
|
1643
|
-
defaultValue: "Add internal notes here...",
|
|
1644
|
-
conditionalFormatting: []
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
]
|
|
1611
|
+
rawShape: '{"type":"text","slug":"name","label":"Name"}',
|
|
1612
|
+
examplePayload: {
|
|
1613
|
+
type: "text",
|
|
1614
|
+
slug: "name",
|
|
1615
|
+
label: "Name"
|
|
1616
|
+
}
|
|
1649
1617
|
},
|
|
1650
1618
|
{
|
|
1651
1619
|
key: "number",
|
|
1652
1620
|
className: "NumberField",
|
|
1653
1621
|
aliases: ["number", "NumberField"],
|
|
1654
1622
|
description: "Numeric field.",
|
|
1655
|
-
rawShape: '{"type":"
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
thousandsSeparator: false
|
|
1670
|
-
},
|
|
1671
|
-
conditionalFormatting: []
|
|
1672
|
-
}
|
|
1673
|
-
}
|
|
1674
|
-
},
|
|
1675
|
-
{
|
|
1676
|
-
name: "Number field (decimal with thousands)",
|
|
1677
|
-
payload: {
|
|
1678
|
-
type: "NumberField",
|
|
1679
|
-
slug: "weight",
|
|
1680
|
-
label: "Weight (kg)",
|
|
1681
|
-
required: false,
|
|
1682
|
-
config: {
|
|
1683
|
-
defaultValue: "0",
|
|
1684
|
-
formatOptions: {
|
|
1685
|
-
format: "number",
|
|
1686
|
-
decimals: 2,
|
|
1687
|
-
thousandsSeparator: true,
|
|
1688
|
-
negativesInRed: false
|
|
1689
|
-
},
|
|
1690
|
-
conditionalFormatting: []
|
|
1691
|
-
}
|
|
1692
|
-
}
|
|
1693
|
-
},
|
|
1694
|
-
{
|
|
1695
|
-
name: "Number field (currency \u20AC prefix)",
|
|
1696
|
-
payload: {
|
|
1697
|
-
type: "NumberField",
|
|
1698
|
-
slug: "amount-eur",
|
|
1699
|
-
label: "Amount (EUR)",
|
|
1700
|
-
required: false,
|
|
1701
|
-
config: {
|
|
1702
|
-
defaultValue: "0",
|
|
1703
|
-
formatOptions: {
|
|
1704
|
-
format: "currency",
|
|
1705
|
-
decimals: 2,
|
|
1706
|
-
negativesInRed: true,
|
|
1707
|
-
thousandsSeparator: true,
|
|
1708
|
-
symbolEnabled: true,
|
|
1709
|
-
symbolPosition: "before",
|
|
1710
|
-
symbolValue: "\u20AC"
|
|
1711
|
-
},
|
|
1712
|
-
conditionalFormatting: []
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
|
-
},
|
|
1716
|
-
{
|
|
1717
|
-
name: "Number field (currency $ suffix)",
|
|
1718
|
-
payload: {
|
|
1719
|
-
type: "NumberField",
|
|
1720
|
-
slug: "amount-usd",
|
|
1721
|
-
label: "Amount (USD)",
|
|
1722
|
-
required: false,
|
|
1723
|
-
config: {
|
|
1724
|
-
defaultValue: "0",
|
|
1725
|
-
formatOptions: {
|
|
1726
|
-
format: "currency",
|
|
1727
|
-
decimals: 2,
|
|
1728
|
-
negativesInRed: false,
|
|
1729
|
-
thousandsSeparator: true,
|
|
1730
|
-
symbolEnabled: true,
|
|
1731
|
-
symbolPosition: "right",
|
|
1732
|
-
symbolValue: " $"
|
|
1733
|
-
},
|
|
1734
|
-
conditionalFormatting: []
|
|
1735
|
-
}
|
|
1736
|
-
}
|
|
1737
|
-
},
|
|
1738
|
-
{
|
|
1739
|
-
name: "Number field (percentage)",
|
|
1740
|
-
payload: {
|
|
1741
|
-
type: "NumberField",
|
|
1742
|
-
slug: "discount-rate",
|
|
1743
|
-
label: "Discount Rate",
|
|
1744
|
-
required: false,
|
|
1745
|
-
config: {
|
|
1746
|
-
defaultValue: "0",
|
|
1747
|
-
formatOptions: {
|
|
1748
|
-
format: "percentage",
|
|
1749
|
-
decimals: 1,
|
|
1750
|
-
negativesInRed: true
|
|
1751
|
-
},
|
|
1752
|
-
conditionalFormatting: []
|
|
1753
|
-
}
|
|
1754
|
-
}
|
|
1755
|
-
},
|
|
1756
|
-
{
|
|
1757
|
-
name: "Number field (duration HH:MM)",
|
|
1758
|
-
payload: {
|
|
1759
|
-
type: "NumberField",
|
|
1760
|
-
slug: "tracked-time",
|
|
1761
|
-
label: "Tracked Time",
|
|
1762
|
-
required: false,
|
|
1763
|
-
config: {
|
|
1764
|
-
defaultValue: "0",
|
|
1765
|
-
formatOptions: {
|
|
1766
|
-
format: "duration",
|
|
1767
|
-
durationFormat: "HH:MM"
|
|
1768
|
-
},
|
|
1769
|
-
conditionalFormatting: []
|
|
1770
|
-
}
|
|
1623
|
+
rawShape: '{"type":"number","slug":"price-eur","label":"Price EUR","config":{"defaultValue":"0","formatOptions":{"format":"number","decimals":2,"thousandsSeparator":true,"symbolEnabled":true,"symbolValue":" \u20AC","symbolPosition":"right"}}}',
|
|
1624
|
+
examplePayload: {
|
|
1625
|
+
type: "number",
|
|
1626
|
+
slug: "price-eur",
|
|
1627
|
+
label: "Price EUR",
|
|
1628
|
+
config: {
|
|
1629
|
+
defaultValue: "0",
|
|
1630
|
+
formatOptions: {
|
|
1631
|
+
format: "number",
|
|
1632
|
+
decimals: 2,
|
|
1633
|
+
thousandsSeparator: true,
|
|
1634
|
+
symbolEnabled: true,
|
|
1635
|
+
symbolValue: " \u20AC",
|
|
1636
|
+
symbolPosition: "right"
|
|
1771
1637
|
}
|
|
1772
1638
|
}
|
|
1773
|
-
|
|
1639
|
+
}
|
|
1774
1640
|
},
|
|
1775
1641
|
{
|
|
1776
1642
|
key: "date",
|
|
1777
1643
|
className: "DateField",
|
|
1778
1644
|
aliases: ["date", "DateField"],
|
|
1779
1645
|
description: "Date or datetime field.",
|
|
1780
|
-
rawShape: '{"type":"
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
slug: "birth-date",
|
|
1787
|
-
label: "Birth Date",
|
|
1788
|
-
required: false,
|
|
1789
|
-
config: {
|
|
1790
|
-
defaultValue: null,
|
|
1791
|
-
formatOptions: {
|
|
1792
|
-
format: "date",
|
|
1793
|
-
dateFormat: "YYYY-MM-DD",
|
|
1794
|
-
showTime: false
|
|
1795
|
-
},
|
|
1796
|
-
conditionalFormatting: []
|
|
1797
|
-
}
|
|
1798
|
-
}
|
|
1799
|
-
},
|
|
1800
|
-
{
|
|
1801
|
-
name: "Date field (datetime EU)",
|
|
1802
|
-
payload: {
|
|
1803
|
-
type: "DateField",
|
|
1804
|
-
slug: "due-date",
|
|
1805
|
-
label: "Due Date",
|
|
1806
|
-
required: false,
|
|
1807
|
-
config: {
|
|
1808
|
-
defaultValue: null,
|
|
1809
|
-
formatOptions: {
|
|
1810
|
-
format: "datetime",
|
|
1811
|
-
dateFormat: "DD/MM/YYYY",
|
|
1812
|
-
showTime: true
|
|
1813
|
-
},
|
|
1814
|
-
conditionalFormatting: []
|
|
1815
|
-
}
|
|
1816
|
-
}
|
|
1817
|
-
},
|
|
1818
|
-
{
|
|
1819
|
-
name: "Date field (datetime US)",
|
|
1820
|
-
payload: {
|
|
1821
|
-
type: "DateField",
|
|
1822
|
-
slug: "appointment-at",
|
|
1823
|
-
label: "Appointment",
|
|
1824
|
-
required: false,
|
|
1825
|
-
config: {
|
|
1826
|
-
defaultValue: null,
|
|
1827
|
-
formatOptions: {
|
|
1828
|
-
format: "datetime",
|
|
1829
|
-
dateFormat: "MM/DD/YYYY",
|
|
1830
|
-
showTime: true
|
|
1831
|
-
},
|
|
1832
|
-
conditionalFormatting: []
|
|
1833
|
-
}
|
|
1834
|
-
}
|
|
1835
|
-
}
|
|
1836
|
-
]
|
|
1646
|
+
rawShape: '{"type":"date","slug":"due-date","label":"Due date"}',
|
|
1647
|
+
examplePayload: {
|
|
1648
|
+
type: "date",
|
|
1649
|
+
slug: "due-date",
|
|
1650
|
+
label: "Due date"
|
|
1651
|
+
}
|
|
1837
1652
|
},
|
|
1838
1653
|
{
|
|
1839
1654
|
key: "option",
|
|
1840
1655
|
className: "OptionField",
|
|
1841
1656
|
aliases: ["option", "OptionField"],
|
|
1842
1657
|
description: "Dropdown/select field with options.",
|
|
1843
|
-
rawShape: '{"type":"
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
conditionalFormatting: [],
|
|
1860
|
-
buttonConfig: null
|
|
1861
|
-
}
|
|
1862
|
-
}
|
|
1863
|
-
},
|
|
1864
|
-
{
|
|
1865
|
-
name: "Option field (button cycle)",
|
|
1866
|
-
payload: {
|
|
1867
|
-
type: "OptionField",
|
|
1868
|
-
slug: "stage",
|
|
1869
|
-
label: "Stage",
|
|
1870
|
-
required: false,
|
|
1871
|
-
config: {
|
|
1872
|
-
options: [
|
|
1873
|
-
{ id: 1, name: "To Do", color: "default" },
|
|
1874
|
-
{ id: 2, name: "Doing", color: "warning" },
|
|
1875
|
-
{ id: 3, name: "Done", color: "success" }
|
|
1876
|
-
],
|
|
1877
|
-
defaultValue: 1,
|
|
1878
|
-
conditionalFormatting: [],
|
|
1879
|
-
buttonConfig: {
|
|
1880
|
-
displayMode: "button",
|
|
1881
|
-
buttonBehavior: {
|
|
1882
|
-
mode: "cycle",
|
|
1883
|
-
cycleOrder: [1, 2, 3],
|
|
1884
|
-
requireConfirmation: false,
|
|
1885
|
-
lockAfterSelection: false,
|
|
1886
|
-
allowReselect: true
|
|
1887
|
-
}
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
}
|
|
1891
|
-
},
|
|
1892
|
-
{
|
|
1893
|
-
name: "Option field (button dropdown w/ confirm)",
|
|
1894
|
-
payload: {
|
|
1895
|
-
type: "OptionField",
|
|
1896
|
-
slug: "status",
|
|
1897
|
-
label: "Status",
|
|
1898
|
-
required: false,
|
|
1899
|
-
config: {
|
|
1900
|
-
options: [
|
|
1901
|
-
{ id: 1, name: "Open", color: "default" },
|
|
1902
|
-
{ id: 2, name: "In Progress", color: "warning" },
|
|
1903
|
-
{ id: 3, name: "Done", color: "success" }
|
|
1904
|
-
],
|
|
1905
|
-
defaultValue: 1,
|
|
1906
|
-
conditionalFormatting: [],
|
|
1907
|
-
buttonConfig: {
|
|
1908
|
-
displayMode: "button",
|
|
1909
|
-
buttonBehavior: {
|
|
1910
|
-
mode: "dropdown",
|
|
1911
|
-
requireConfirmation: true,
|
|
1912
|
-
confirmationMessage: "Confirm status change",
|
|
1913
|
-
useFixedLabel: true,
|
|
1914
|
-
buttonLabel: "Set status",
|
|
1915
|
-
allowReselect: true
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
1658
|
+
rawShape: '{"type":"option","slug":"status","label":"Status","config":{"options":[{"id":1,"name":"Open","color":"default"},{"id":2,"name":"Closed","color":"success"}]}}',
|
|
1659
|
+
examplePayload: {
|
|
1660
|
+
type: "option",
|
|
1661
|
+
slug: "status",
|
|
1662
|
+
label: "Status",
|
|
1663
|
+
config: {
|
|
1664
|
+
options: [
|
|
1665
|
+
{
|
|
1666
|
+
id: 1,
|
|
1667
|
+
name: "Open",
|
|
1668
|
+
color: "default"
|
|
1669
|
+
},
|
|
1670
|
+
{
|
|
1671
|
+
id: 2,
|
|
1672
|
+
name: "Closed",
|
|
1673
|
+
color: "success"
|
|
1918
1674
|
}
|
|
1919
|
-
|
|
1675
|
+
]
|
|
1920
1676
|
}
|
|
1921
|
-
|
|
1677
|
+
}
|
|
1922
1678
|
},
|
|
1923
1679
|
{
|
|
1924
1680
|
key: "file",
|
|
1925
1681
|
className: "FileField",
|
|
1926
1682
|
aliases: ["file", "FileField"],
|
|
1927
1683
|
description: "File attachment field.",
|
|
1928
|
-
rawShape: '{"type":"
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
slug: "attachment",
|
|
1935
|
-
label: "Attachment",
|
|
1936
|
-
required: false,
|
|
1937
|
-
config: {}
|
|
1938
|
-
}
|
|
1939
|
-
}
|
|
1940
|
-
]
|
|
1684
|
+
rawShape: '{"type":"file","slug":"attachment","label":"Attachment"}',
|
|
1685
|
+
examplePayload: {
|
|
1686
|
+
type: "file",
|
|
1687
|
+
slug: "attachment",
|
|
1688
|
+
label: "Attachment"
|
|
1689
|
+
}
|
|
1941
1690
|
},
|
|
1942
1691
|
{
|
|
1943
1692
|
key: "reference",
|
|
1944
1693
|
className: "ReferenceField",
|
|
1945
1694
|
aliases: ["reference", "ReferenceField"],
|
|
1946
1695
|
description: "Reference to another schema.",
|
|
1947
|
-
rawShape: '{"type":"
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
config: {
|
|
1957
|
-
targetSchema: "5223cbc8-8c6c-4694-93bc-dd176364df9b",
|
|
1958
|
-
targetDisplayField: "c60b8526-5835-4c9f-aecd-9a16c7704a34"
|
|
1959
|
-
}
|
|
1960
|
-
}
|
|
1961
|
-
},
|
|
1962
|
-
{
|
|
1963
|
-
name: "Reference field (restrict + filter + description)",
|
|
1964
|
-
payload: {
|
|
1965
|
-
type: "ReferenceField",
|
|
1966
|
-
slug: "customer-ref",
|
|
1967
|
-
label: "Customer",
|
|
1968
|
-
required: false,
|
|
1969
|
-
config: {
|
|
1970
|
-
targetSchema: "5223cbc8-8c6c-4694-93bc-dd176364df9b",
|
|
1971
|
-
targetDisplayField: "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
1972
|
-
deleteBehavior: "RESTRICT",
|
|
1973
|
-
defaultValue: "8ad602a1-f6e3-43f6-9ab2-f1c5afc99621::Ref A",
|
|
1974
|
-
filterFields: [
|
|
1975
|
-
{
|
|
1976
|
-
fatherField: "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
1977
|
-
currentField: "45c5da96-0dc2-4cc1-ba61-7660a9c6da32",
|
|
1978
|
-
comparison: "EQUAL",
|
|
1979
|
-
value: null
|
|
1980
|
-
}
|
|
1981
|
-
],
|
|
1982
|
-
descriptionFields: [
|
|
1983
|
-
{
|
|
1984
|
-
id: "c52efe3f-2825-4c60-a7e3-34dd4c1ce043",
|
|
1985
|
-
fieldType: "NumberField",
|
|
1986
|
-
options: null,
|
|
1987
|
-
format: "number"
|
|
1988
|
-
}
|
|
1989
|
-
],
|
|
1990
|
-
conditionalFormatting: []
|
|
1991
|
-
}
|
|
1992
|
-
}
|
|
1696
|
+
rawShape: '{"type":"reference","slug":"project","label":"Project","config":{"targetSchema":"<schema-uuid>","targetDisplayField":"<field-uuid>","deleteBehavior":"SET_NULL"}}',
|
|
1697
|
+
examplePayload: {
|
|
1698
|
+
type: "reference",
|
|
1699
|
+
slug: "project",
|
|
1700
|
+
label: "Project",
|
|
1701
|
+
config: {
|
|
1702
|
+
targetSchema: "<schema-uuid>",
|
|
1703
|
+
targetDisplayField: "<field-uuid>",
|
|
1704
|
+
deleteBehavior: "SET_NULL"
|
|
1993
1705
|
}
|
|
1994
|
-
|
|
1706
|
+
}
|
|
1995
1707
|
},
|
|
1996
1708
|
{
|
|
1997
1709
|
key: "formula",
|
|
1998
1710
|
className: "FormulaField",
|
|
1999
1711
|
aliases: ["formula", "FormulaField"],
|
|
2000
1712
|
description: "Calculated field from a formula.",
|
|
2001
|
-
rawShape:
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
label: "Formula Summary",
|
|
2009
|
-
required: false,
|
|
2010
|
-
config: {
|
|
2011
|
-
formulaText: "concat(firstName, ' ', lastName)",
|
|
2012
|
-
uiFormatKind: "none",
|
|
2013
|
-
status: "ACTIVE",
|
|
2014
|
-
conditionalFormatting: []
|
|
2015
|
-
}
|
|
2016
|
-
}
|
|
2017
|
-
},
|
|
2018
|
-
{
|
|
2019
|
-
name: "Formula field (number)",
|
|
2020
|
-
payload: {
|
|
2021
|
-
type: "FormulaField",
|
|
2022
|
-
slug: "formula-total",
|
|
2023
|
-
label: "Formula Total",
|
|
2024
|
-
required: false,
|
|
2025
|
-
config: {
|
|
2026
|
-
formulaText: "amount * 1.21",
|
|
2027
|
-
uiFormatKind: "number",
|
|
2028
|
-
status: "ACTIVE",
|
|
2029
|
-
numberFormatOptions: {
|
|
2030
|
-
format: "number",
|
|
2031
|
-
decimals: 2,
|
|
2032
|
-
thousandsSeparator: true
|
|
2033
|
-
},
|
|
2034
|
-
conditionalFormatting: []
|
|
2035
|
-
}
|
|
2036
|
-
}
|
|
2037
|
-
},
|
|
2038
|
-
{
|
|
2039
|
-
name: "Formula field (date)",
|
|
2040
|
-
payload: {
|
|
2041
|
-
type: "FormulaField",
|
|
2042
|
-
slug: "formula-deadline",
|
|
2043
|
-
label: "Computed Deadline",
|
|
2044
|
-
required: false,
|
|
2045
|
-
config: {
|
|
2046
|
-
formulaText: "addDays(startDate, 7)",
|
|
2047
|
-
uiFormatKind: "date",
|
|
2048
|
-
status: "ACTIVE",
|
|
2049
|
-
dateFormatOptions: {
|
|
2050
|
-
format: "date",
|
|
2051
|
-
dateFormat: "DD/MM/YYYY",
|
|
2052
|
-
showTime: false
|
|
2053
|
-
},
|
|
2054
|
-
conditionalFormatting: []
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
},
|
|
2058
|
-
{
|
|
2059
|
-
name: "Formula field (member)",
|
|
2060
|
-
payload: {
|
|
2061
|
-
type: "FormulaField",
|
|
2062
|
-
slug: "formula-assignee",
|
|
2063
|
-
label: "Computed Assignee",
|
|
2064
|
-
required: false,
|
|
2065
|
-
config: {
|
|
2066
|
-
formulaText: "manager",
|
|
2067
|
-
uiFormatKind: "member",
|
|
2068
|
-
status: "ACTIVE",
|
|
2069
|
-
conditionalFormatting: []
|
|
2070
|
-
}
|
|
2071
|
-
}
|
|
1713
|
+
rawShape: '{"type":"formula","slug":"total","label":"Total","config":{"formulaText":"{price} * {quantity}"}}',
|
|
1714
|
+
examplePayload: {
|
|
1715
|
+
type: "formula",
|
|
1716
|
+
slug: "total",
|
|
1717
|
+
label: "Total",
|
|
1718
|
+
config: {
|
|
1719
|
+
formulaText: "{price} * {quantity}"
|
|
2072
1720
|
}
|
|
2073
|
-
|
|
1721
|
+
}
|
|
2074
1722
|
},
|
|
2075
1723
|
{
|
|
2076
1724
|
key: "member",
|
|
2077
1725
|
className: "MemberField",
|
|
2078
1726
|
aliases: ["member", "MemberField"],
|
|
2079
1727
|
description: "Workspace member field.",
|
|
2080
|
-
rawShape: '{"type":"
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
label: "Owner",
|
|
2088
|
-
required: false,
|
|
2089
|
-
config: {
|
|
2090
|
-
defaultValue: null,
|
|
2091
|
-
conditionalFormatting: []
|
|
2092
|
-
}
|
|
2093
|
-
}
|
|
1728
|
+
rawShape: '{"type":"member","slug":"owner","label":"Owner","config":{"defaultValue":"<member-id>"}}',
|
|
1729
|
+
examplePayload: {
|
|
1730
|
+
type: "member",
|
|
1731
|
+
slug: "owner",
|
|
1732
|
+
label: "Owner",
|
|
1733
|
+
config: {
|
|
1734
|
+
defaultValue: "<member-id>"
|
|
2094
1735
|
}
|
|
2095
|
-
|
|
1736
|
+
}
|
|
2096
1737
|
},
|
|
2097
1738
|
{
|
|
2098
1739
|
key: "autoincremental",
|
|
@@ -2104,74 +1745,15 @@ var fieldTypeDefinitions = [
|
|
|
2104
1745
|
"AutoIncrementalField"
|
|
2105
1746
|
],
|
|
2106
1747
|
description: "Auto-generated incremental counter.",
|
|
2107
|
-
rawShape: '{"type":"
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
label: "Order Number",
|
|
2115
|
-
required: false,
|
|
2116
|
-
config: {
|
|
2117
|
-
segmentedByFieldId: null,
|
|
2118
|
-
conditionalFormatting: []
|
|
2119
|
-
}
|
|
2120
|
-
}
|
|
2121
|
-
},
|
|
2122
|
-
{
|
|
2123
|
-
name: "Autoincremental (segmented)",
|
|
2124
|
-
payload: {
|
|
2125
|
-
type: "AutoIncrementalField",
|
|
2126
|
-
slug: "sequence-code",
|
|
2127
|
-
label: "Sequence Code",
|
|
2128
|
-
required: false,
|
|
2129
|
-
config: {
|
|
2130
|
-
segmentedByFieldId: "45c5da96-0dc2-4cc1-ba61-7660a9c6da32",
|
|
2131
|
-
conditionalFormatting: []
|
|
2132
|
-
}
|
|
2133
|
-
}
|
|
1748
|
+
rawShape: '{"type":"autoincremental","slug":"counter","label":"Counter","config":{"segmentedByFieldId":null}}',
|
|
1749
|
+
examplePayload: {
|
|
1750
|
+
type: "autoincremental",
|
|
1751
|
+
slug: "counter",
|
|
1752
|
+
label: "Counter",
|
|
1753
|
+
config: {
|
|
1754
|
+
segmentedByFieldId: null
|
|
2134
1755
|
}
|
|
2135
|
-
|
|
2136
|
-
},
|
|
2137
|
-
{
|
|
2138
|
-
key: "schedule",
|
|
2139
|
-
className: "ScheduleField",
|
|
2140
|
-
aliases: ["schedule", "ScheduleField"],
|
|
2141
|
-
description: "Recurrence/schedule field bound to a number reference and a date period (frequency: monthly or daily).",
|
|
2142
|
-
rawShape: '{"type":"ScheduleField","slug":"recurrence","label":"Recurrence","config":{"referenceField":"<number-field-uuid>","beginningPeriodField":"<date-field-uuid>","endingPeriodField":"<date-field-uuid>","frequency":"monthly"}}',
|
|
2143
|
-
examplePayloads: [
|
|
2144
|
-
{
|
|
2145
|
-
name: "Schedule field (monthly)",
|
|
2146
|
-
payload: {
|
|
2147
|
-
type: "ScheduleField",
|
|
2148
|
-
slug: "monthly-recurrence",
|
|
2149
|
-
label: "Monthly Recurrence",
|
|
2150
|
-
required: false,
|
|
2151
|
-
config: {
|
|
2152
|
-
referenceField: "c52efe3f-2825-4c60-a7e3-34dd4c1ce043",
|
|
2153
|
-
beginningPeriodField: "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
2154
|
-
endingPeriodField: "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
2155
|
-
frequency: "monthly"
|
|
2156
|
-
}
|
|
2157
|
-
}
|
|
2158
|
-
},
|
|
2159
|
-
{
|
|
2160
|
-
name: "Schedule field (daily)",
|
|
2161
|
-
payload: {
|
|
2162
|
-
type: "ScheduleField",
|
|
2163
|
-
slug: "daily-recurrence",
|
|
2164
|
-
label: "Daily Recurrence",
|
|
2165
|
-
required: false,
|
|
2166
|
-
config: {
|
|
2167
|
-
referenceField: "c52efe3f-2825-4c60-a7e3-34dd4c1ce043",
|
|
2168
|
-
beginningPeriodField: "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
2169
|
-
endingPeriodField: "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
2170
|
-
frequency: "daily"
|
|
2171
|
-
}
|
|
2172
|
-
}
|
|
2173
|
-
}
|
|
2174
|
-
]
|
|
1756
|
+
}
|
|
2175
1757
|
}
|
|
2176
1758
|
];
|
|
2177
1759
|
var fieldTypeDefinitionByAlias = new Map(
|
|
@@ -2295,49 +1877,6 @@ function normalizeReferencePayload(input) {
|
|
|
2295
1877
|
}
|
|
2296
1878
|
return normalized;
|
|
2297
1879
|
}
|
|
2298
|
-
var scheduleAllowedFrequencies = /* @__PURE__ */ new Set(["monthly", "daily"]);
|
|
2299
|
-
function normalizeSchedulePayload(input) {
|
|
2300
|
-
const additionalProperties = toJsonObject(input.additionalProperties) ?? {};
|
|
2301
|
-
const config = toJsonObject(input.config) ?? {};
|
|
2302
|
-
const referenceField = config.referenceField ?? input.referenceField ?? additionalProperties.referenceField;
|
|
2303
|
-
const beginningPeriodField = config.beginningPeriodField ?? input.beginningPeriodField ?? additionalProperties.beginningPeriodField;
|
|
2304
|
-
const endingPeriodField = config.endingPeriodField ?? input.endingPeriodField ?? additionalProperties.endingPeriodField;
|
|
2305
|
-
const frequency = config.frequency ?? input.frequency ?? additionalProperties.frequency;
|
|
2306
|
-
const {
|
|
2307
|
-
referenceField: _referenceField,
|
|
2308
|
-
beginningPeriodField: _beginningPeriodField,
|
|
2309
|
-
endingPeriodField: _endingPeriodField,
|
|
2310
|
-
frequency: _frequency,
|
|
2311
|
-
additionalProperties: _additionalProperties,
|
|
2312
|
-
...rest
|
|
2313
|
-
} = input;
|
|
2314
|
-
const normalized = {
|
|
2315
|
-
...rest,
|
|
2316
|
-
config: {
|
|
2317
|
-
...config,
|
|
2318
|
-
...referenceField !== void 0 ? { referenceField } : {},
|
|
2319
|
-
...beginningPeriodField !== void 0 ? { beginningPeriodField } : {},
|
|
2320
|
-
...endingPeriodField !== void 0 ? { endingPeriodField } : {},
|
|
2321
|
-
...frequency !== void 0 ? { frequency } : {}
|
|
2322
|
-
}
|
|
2323
|
-
};
|
|
2324
|
-
const normalizedConfig = toJsonObject(normalized.config) ?? {};
|
|
2325
|
-
const definition = resolveSchemaFieldType("schedule");
|
|
2326
|
-
if (!toStringValue2(normalizedConfig.referenceField) || !toStringValue2(normalizedConfig.beginningPeriodField) || !toStringValue2(normalizedConfig.endingPeriodField) || !toStringValue2(normalizedConfig.frequency)) {
|
|
2327
|
-
throw new CliError(
|
|
2328
|
-
"invalid_cli_usage",
|
|
2329
|
-
`Schedule fields require "referenceField", "beginningPeriodField", "endingPeriodField" and "frequency". Expected raw shape: ${definition.rawShape}`
|
|
2330
|
-
);
|
|
2331
|
-
}
|
|
2332
|
-
const frequencyValue = toStringValue2(normalizedConfig.frequency);
|
|
2333
|
-
if (!scheduleAllowedFrequencies.has(frequencyValue)) {
|
|
2334
|
-
throw new CliError(
|
|
2335
|
-
"invalid_cli_usage",
|
|
2336
|
-
`Schedule "frequency" must be "monthly" or "daily" (received "${frequencyValue}").`
|
|
2337
|
-
);
|
|
2338
|
-
}
|
|
2339
|
-
return normalized;
|
|
2340
|
-
}
|
|
2341
1880
|
function normalizeFormulaPayload(input) {
|
|
2342
1881
|
const { status: _status, ...rest } = input;
|
|
2343
1882
|
const rawAdditionalProperties = toJsonObject(input.additionalProperties);
|
|
@@ -2385,8 +1924,6 @@ function normalizeSchemaFieldCreatePayload(input) {
|
|
|
2385
1924
|
return normalizeReferencePayload(normalizedWithType);
|
|
2386
1925
|
case "formula":
|
|
2387
1926
|
return normalizeFormulaPayload(normalizedWithType);
|
|
2388
|
-
case "schedule":
|
|
2389
|
-
return normalizeSchedulePayload(normalizedWithType);
|
|
2390
1927
|
case "autoincremental": {
|
|
2391
1928
|
const config = toJsonObject(normalizedWithType.config) ?? {};
|
|
2392
1929
|
const segmentedByFieldId = config.segmentedByFieldId ?? normalizedWithType.segmentedByFieldId ?? null;
|
|
@@ -2623,10 +2160,13 @@ var specificExamples = {
|
|
|
2623
2160
|
]),
|
|
2624
2161
|
"schemas update": buildCommandExamples([
|
|
2625
2162
|
{
|
|
2626
|
-
description: "
|
|
2627
|
-
command:
|
|
2163
|
+
description: "Rename a schema and change its slug.",
|
|
2164
|
+
command: 'zinkee --json schemas update contacts --name "Customer Contacts" --slug customer-contacts',
|
|
2628
2165
|
raw: `{
|
|
2629
|
-
"
|
|
2166
|
+
"set": {
|
|
2167
|
+
"name": "Customer Contacts",
|
|
2168
|
+
"slug": "customer-contacts"
|
|
2169
|
+
}
|
|
2630
2170
|
}`,
|
|
2631
2171
|
response: `{
|
|
2632
2172
|
"id": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
|
|
@@ -2639,46 +2179,37 @@ var specificExamples = {
|
|
|
2639
2179
|
},
|
|
2640
2180
|
"auditable": true,
|
|
2641
2181
|
"commentable": true,
|
|
2642
|
-
"fields": [
|
|
2643
|
-
{
|
|
2644
|
-
"id": "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
2645
|
-
"type": "TextField",
|
|
2646
|
-
"slug": "contact-name",
|
|
2647
|
-
"label": "Customer Name",
|
|
2648
|
-
"required": true,
|
|
2649
|
-
"system": false,
|
|
2650
|
-
"config": {
|
|
2651
|
-
"textType": "LONG",
|
|
2652
|
-
"defaultValue": "Unknown",
|
|
2653
|
-
"conditionalFormatting": []
|
|
2654
|
-
}
|
|
2655
|
-
}
|
|
2656
|
-
]
|
|
2182
|
+
"fields": []
|
|
2657
2183
|
}`
|
|
2658
2184
|
},
|
|
2659
2185
|
{
|
|
2660
|
-
description: "
|
|
2661
|
-
command:
|
|
2186
|
+
description: "Enable the audit log on a schema.",
|
|
2187
|
+
command: "zinkee --json schemas update contacts --auditable true",
|
|
2662
2188
|
raw: `{
|
|
2663
|
-
"
|
|
2664
|
-
|
|
2189
|
+
"set": {
|
|
2190
|
+
"auditable": true
|
|
2191
|
+
}
|
|
2665
2192
|
}`
|
|
2666
2193
|
},
|
|
2667
2194
|
{
|
|
2668
|
-
description: "
|
|
2669
|
-
command: "zinkee --json schemas update contacts --
|
|
2195
|
+
description: "Toggle commentable off.",
|
|
2196
|
+
command: "zinkee --json schemas update contacts --commentable false",
|
|
2670
2197
|
raw: `{
|
|
2671
|
-
"
|
|
2198
|
+
"set": {
|
|
2199
|
+
"commentable": false
|
|
2200
|
+
}
|
|
2672
2201
|
}`
|
|
2673
2202
|
}
|
|
2674
2203
|
]),
|
|
2675
2204
|
"schemas fields update": buildCommandExamples([
|
|
2676
2205
|
{
|
|
2677
|
-
description: "Rename
|
|
2678
|
-
command:
|
|
2206
|
+
description: "Rename a field label and drop the required flag.",
|
|
2207
|
+
command: 'zinkee --json schemas fields update contacts contact-name --label "Customer Full Name" --required false',
|
|
2679
2208
|
raw: `{
|
|
2680
|
-
"
|
|
2681
|
-
|
|
2209
|
+
"set": {
|
|
2210
|
+
"label": "Customer Full Name",
|
|
2211
|
+
"required": false
|
|
2212
|
+
}
|
|
2682
2213
|
}`,
|
|
2683
2214
|
response: `{
|
|
2684
2215
|
"schemaId": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
|
|
@@ -2687,162 +2218,26 @@ var specificExamples = {
|
|
|
2687
2218
|
}`
|
|
2688
2219
|
},
|
|
2689
2220
|
{
|
|
2690
|
-
description: "
|
|
2221
|
+
description: "Make a field required.",
|
|
2691
2222
|
command: "zinkee --json schemas fields update contacts status --required true",
|
|
2692
2223
|
raw: `{
|
|
2693
|
-
"
|
|
2694
|
-
|
|
2695
|
-
},
|
|
2696
|
-
{
|
|
2697
|
-
description: "Patch text field (long with default).",
|
|
2698
|
-
command: `zinkee --json schemas fields update contacts contact-name --raw '{"type":"TextField","label":"Customer Full Name","required":false,"config":{"textType":"LONG","defaultValue":"Unknown","conditionalFormatting":[]}}'`,
|
|
2699
|
-
raw: `{
|
|
2700
|
-
"type": "TextField",
|
|
2701
|
-
"label": "Customer Full Name",
|
|
2702
|
-
"required": false,
|
|
2703
|
-
"config": {
|
|
2704
|
-
"textType": "LONG",
|
|
2705
|
-
"defaultValue": "Unknown",
|
|
2706
|
-
"conditionalFormatting": []
|
|
2707
|
-
}
|
|
2708
|
-
}`
|
|
2709
|
-
},
|
|
2710
|
-
{
|
|
2711
|
-
description: "Patch number field (to currency).",
|
|
2712
|
-
command: `zinkee --json schemas fields update contacts amount --raw '{"type":"NumberField","config":{"defaultValue":"0","formatOptions":{"format":"currency","decimals":2,"thousandsSeparator":true,"symbolEnabled":true,"symbolPosition":"before","symbolValue":"\u20AC"},"conditionalFormatting":[]}}'`,
|
|
2713
|
-
raw: `{
|
|
2714
|
-
"type": "NumberField",
|
|
2715
|
-
"config": {
|
|
2716
|
-
"defaultValue": "0",
|
|
2717
|
-
"formatOptions": {
|
|
2718
|
-
"format": "currency",
|
|
2719
|
-
"decimals": 2,
|
|
2720
|
-
"thousandsSeparator": true,
|
|
2721
|
-
"symbolEnabled": true,
|
|
2722
|
-
"symbolPosition": "before",
|
|
2723
|
-
"symbolValue": "\u20AC"
|
|
2724
|
-
},
|
|
2725
|
-
"conditionalFormatting": []
|
|
2726
|
-
}
|
|
2727
|
-
}`
|
|
2728
|
-
},
|
|
2729
|
-
{
|
|
2730
|
-
description: "Patch number field (to percentage).",
|
|
2731
|
-
command: `zinkee --json schemas fields update contacts discount-rate --raw '{"type":"NumberField","config":{"defaultValue":"0","formatOptions":{"format":"percentage","decimals":1},"conditionalFormatting":[]}}'`,
|
|
2732
|
-
raw: `{
|
|
2733
|
-
"type": "NumberField",
|
|
2734
|
-
"config": {
|
|
2735
|
-
"defaultValue": "0",
|
|
2736
|
-
"formatOptions": {
|
|
2737
|
-
"format": "percentage",
|
|
2738
|
-
"decimals": 1
|
|
2739
|
-
},
|
|
2740
|
-
"conditionalFormatting": []
|
|
2741
|
-
}
|
|
2742
|
-
}`
|
|
2743
|
-
},
|
|
2744
|
-
{
|
|
2745
|
-
description: "Patch date field (to date only).",
|
|
2746
|
-
command: `zinkee --json schemas fields update contacts due-date --raw '{"type":"DateField","config":{"defaultValue":null,"formatOptions":{"format":"date","dateFormat":"YYYY-MM-DD","showTime":false},"conditionalFormatting":[]}}'`,
|
|
2747
|
-
raw: `{
|
|
2748
|
-
"type": "DateField",
|
|
2749
|
-
"config": {
|
|
2750
|
-
"defaultValue": null,
|
|
2751
|
-
"formatOptions": {
|
|
2752
|
-
"format": "date",
|
|
2753
|
-
"dateFormat": "YYYY-MM-DD",
|
|
2754
|
-
"showTime": false
|
|
2755
|
-
},
|
|
2756
|
-
"conditionalFormatting": []
|
|
2224
|
+
"set": {
|
|
2225
|
+
"required": true
|
|
2757
2226
|
}
|
|
2758
2227
|
}`
|
|
2759
2228
|
},
|
|
2760
2229
|
{
|
|
2761
|
-
description: "Patch
|
|
2762
|
-
command: `zinkee --json schemas fields update contacts
|
|
2230
|
+
description: "Patch the format options of a number field through a raw set payload (no dedicated flag exists for nested config paths).",
|
|
2231
|
+
command: `zinkee --json schemas fields update contacts amount --raw '{"set":{"config":{"formatOptions":{"format":"percent","decimals":1}}}}'`,
|
|
2763
2232
|
raw: `{
|
|
2764
|
-
"
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
{ "id": 3, "name": "Done", "color": "success" }
|
|
2770
|
-
],
|
|
2771
|
-
"defaultValue": 1,
|
|
2772
|
-
"conditionalFormatting": [],
|
|
2773
|
-
"buttonConfig": {
|
|
2774
|
-
"displayMode": "button",
|
|
2775
|
-
"buttonBehavior": {
|
|
2776
|
-
"mode": "cycle",
|
|
2777
|
-
"cycleOrder": [1, 2, 3],
|
|
2778
|
-
"allowReselect": true
|
|
2233
|
+
"set": {
|
|
2234
|
+
"config": {
|
|
2235
|
+
"formatOptions": {
|
|
2236
|
+
"format": "percent",
|
|
2237
|
+
"decimals": 1
|
|
2779
2238
|
}
|
|
2780
2239
|
}
|
|
2781
2240
|
}
|
|
2782
|
-
}`
|
|
2783
|
-
},
|
|
2784
|
-
{
|
|
2785
|
-
description: "Patch option field (drop button mode).",
|
|
2786
|
-
command: `zinkee --json schemas fields update contacts status --raw '{"type":"OptionField","config":{"options":[{"id":1,"name":"Open","color":"default"},{"id":2,"name":"In Progress","color":"warning"},{"id":3,"name":"Done","color":"success"}],"defaultValue":1,"conditionalFormatting":[],"buttonConfig":null}}'`,
|
|
2787
|
-
raw: `{
|
|
2788
|
-
"type": "OptionField",
|
|
2789
|
-
"config": {
|
|
2790
|
-
"options": [
|
|
2791
|
-
{ "id": 1, "name": "Open", "color": "default" },
|
|
2792
|
-
{ "id": 2, "name": "In Progress", "color": "warning" },
|
|
2793
|
-
{ "id": 3, "name": "Done", "color": "success" }
|
|
2794
|
-
],
|
|
2795
|
-
"defaultValue": 1,
|
|
2796
|
-
"conditionalFormatting": [],
|
|
2797
|
-
"buttonConfig": null
|
|
2798
|
-
}
|
|
2799
|
-
}`
|
|
2800
|
-
},
|
|
2801
|
-
{
|
|
2802
|
-
description: "Patch formula field (formula text).",
|
|
2803
|
-
command: `zinkee --json schemas fields update contacts formula-total --raw '{"type":"FormulaField","config":{"formulaText":"amount * 1.10","uiFormatKind":"number","status":"ACTIVE","numberFormatOptions":{"format":"number","decimals":2,"thousandsSeparator":true},"conditionalFormatting":[]}}'`,
|
|
2804
|
-
raw: `{
|
|
2805
|
-
"type": "FormulaField",
|
|
2806
|
-
"config": {
|
|
2807
|
-
"formulaText": "amount * 1.10",
|
|
2808
|
-
"uiFormatKind": "number",
|
|
2809
|
-
"status": "ACTIVE",
|
|
2810
|
-
"numberFormatOptions": {
|
|
2811
|
-
"format": "number",
|
|
2812
|
-
"decimals": 2,
|
|
2813
|
-
"thousandsSeparator": true
|
|
2814
|
-
},
|
|
2815
|
-
"conditionalFormatting": []
|
|
2816
|
-
}
|
|
2817
|
-
}`
|
|
2818
|
-
},
|
|
2819
|
-
{
|
|
2820
|
-
description: "Patch reference field (delete behavior).",
|
|
2821
|
-
command: `zinkee --json schemas fields update contacts customer-ref --raw '{"type":"ReferenceField","config":{"targetSchema":"5223cbc8-8c6c-4694-93bc-dd176364df9b","targetDisplayField":"c60b8526-5835-4c9f-aecd-9a16c7704a34","deleteBehavior":"RESTRICT","defaultValue":null,"filterFields":[],"descriptionFields":[],"conditionalFormatting":[]}}'`,
|
|
2822
|
-
raw: `{
|
|
2823
|
-
"type": "ReferenceField",
|
|
2824
|
-
"config": {
|
|
2825
|
-
"targetSchema": "5223cbc8-8c6c-4694-93bc-dd176364df9b",
|
|
2826
|
-
"targetDisplayField": "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
2827
|
-
"deleteBehavior": "RESTRICT",
|
|
2828
|
-
"defaultValue": null,
|
|
2829
|
-
"filterFields": [],
|
|
2830
|
-
"descriptionFields": [],
|
|
2831
|
-
"conditionalFormatting": []
|
|
2832
|
-
}
|
|
2833
|
-
}`
|
|
2834
|
-
},
|
|
2835
|
-
{
|
|
2836
|
-
description: "Patch schedule field (to daily).",
|
|
2837
|
-
command: `zinkee --json schemas fields update contacts recurrence --raw '{"type":"ScheduleField","config":{"referenceField":"c52efe3f-2825-4c60-a7e3-34dd4c1ce043","beginningPeriodField":"d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90","endingPeriodField":"d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90","frequency":"daily"}}'`,
|
|
2838
|
-
raw: `{
|
|
2839
|
-
"type": "ScheduleField",
|
|
2840
|
-
"config": {
|
|
2841
|
-
"referenceField": "c52efe3f-2825-4c60-a7e3-34dd4c1ce043",
|
|
2842
|
-
"beginningPeriodField": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
2843
|
-
"endingPeriodField": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
2844
|
-
"frequency": "daily"
|
|
2845
|
-
}
|
|
2846
2241
|
}`
|
|
2847
2242
|
}
|
|
2848
2243
|
]),
|
|
@@ -4058,22 +3453,27 @@ var specificExamples = {
|
|
|
4058
3453
|
"required": true,
|
|
4059
3454
|
"system": false,
|
|
4060
3455
|
"config": {
|
|
4061
|
-
"textType": "
|
|
3456
|
+
"textType": "LONG",
|
|
4062
3457
|
"defaultValue": "Unknown",
|
|
4063
3458
|
"conditionalFormatting": []
|
|
4064
3459
|
}
|
|
4065
3460
|
},
|
|
4066
3461
|
{
|
|
4067
|
-
"id": "
|
|
4068
|
-
"type": "
|
|
4069
|
-
"slug": "
|
|
4070
|
-
"label": "
|
|
3462
|
+
"id": "a8f1d7e3-2b5c-4d9e-8a1b-3c4d5e6f7890",
|
|
3463
|
+
"type": "OptionField",
|
|
3464
|
+
"slug": "status",
|
|
3465
|
+
"label": "Status",
|
|
4071
3466
|
"required": false,
|
|
4072
3467
|
"system": false,
|
|
4073
3468
|
"config": {
|
|
4074
|
-
"
|
|
4075
|
-
|
|
4076
|
-
|
|
3469
|
+
"options": [
|
|
3470
|
+
{ "id": 1, "name": "Open", "color": "default" },
|
|
3471
|
+
{ "id": 2, "name": "In Progress", "color": "warning" },
|
|
3472
|
+
{ "id": 3, "name": "Done", "color": "success" }
|
|
3473
|
+
],
|
|
3474
|
+
"defaultValue": 1,
|
|
3475
|
+
"conditionalFormatting": [],
|
|
3476
|
+
"buttonConfig": null
|
|
4077
3477
|
}
|
|
4078
3478
|
},
|
|
4079
3479
|
{
|
|
@@ -4097,252 +3497,21 @@ var specificExamples = {
|
|
|
4097
3497
|
"conditionalFormatting": []
|
|
4098
3498
|
}
|
|
4099
3499
|
},
|
|
4100
|
-
{
|
|
4101
|
-
"id": "2f3a4b5c-6d7e-8f90-1234-56789abcdef0",
|
|
4102
|
-
"type": "NumberField",
|
|
4103
|
-
"slug": "quantity",
|
|
4104
|
-
"label": "Quantity",
|
|
4105
|
-
"required": false,
|
|
4106
|
-
"system": false,
|
|
4107
|
-
"config": {
|
|
4108
|
-
"defaultValue": "0",
|
|
4109
|
-
"formatOptions": {
|
|
4110
|
-
"format": "number",
|
|
4111
|
-
"decimals": 0,
|
|
4112
|
-
"thousandsSeparator": false
|
|
4113
|
-
},
|
|
4114
|
-
"conditionalFormatting": []
|
|
4115
|
-
}
|
|
4116
|
-
},
|
|
4117
|
-
{
|
|
4118
|
-
"id": "3a4b5c6d-7e8f-9012-3456-789abcdef012",
|
|
4119
|
-
"type": "NumberField",
|
|
4120
|
-
"slug": "discount-rate",
|
|
4121
|
-
"label": "Discount Rate",
|
|
4122
|
-
"required": false,
|
|
4123
|
-
"system": false,
|
|
4124
|
-
"config": {
|
|
4125
|
-
"defaultValue": "0",
|
|
4126
|
-
"formatOptions": {
|
|
4127
|
-
"format": "percentage",
|
|
4128
|
-
"decimals": 1,
|
|
4129
|
-
"negativesInRed": true
|
|
4130
|
-
},
|
|
4131
|
-
"conditionalFormatting": []
|
|
4132
|
-
}
|
|
4133
|
-
},
|
|
4134
3500
|
{
|
|
4135
3501
|
"id": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
4136
3502
|
"type": "DateField",
|
|
4137
3503
|
"slug": "due-date",
|
|
4138
|
-
"label": "Due Date",
|
|
4139
|
-
"required": false,
|
|
4140
|
-
"system": false,
|
|
4141
|
-
"config": {
|
|
4142
|
-
"defaultValue": null,
|
|
4143
|
-
"formatOptions": {
|
|
4144
|
-
"format": "datetime",
|
|
4145
|
-
"dateFormat": "DD/MM/YYYY",
|
|
4146
|
-
"showTime": true
|
|
4147
|
-
},
|
|
4148
|
-
"conditionalFormatting": []
|
|
4149
|
-
}
|
|
4150
|
-
},
|
|
4151
|
-
{
|
|
4152
|
-
"id": "4b5c6d7e-8f90-1234-5678-9abcdef01234",
|
|
4153
|
-
"type": "DateField",
|
|
4154
|
-
"slug": "birth-date",
|
|
4155
|
-
"label": "Birth Date",
|
|
4156
|
-
"required": false,
|
|
4157
|
-
"system": false,
|
|
4158
|
-
"config": {
|
|
4159
|
-
"defaultValue": null,
|
|
4160
|
-
"formatOptions": {
|
|
4161
|
-
"format": "date",
|
|
4162
|
-
"dateFormat": "YYYY-MM-DD",
|
|
4163
|
-
"showTime": false
|
|
4164
|
-
},
|
|
4165
|
-
"conditionalFormatting": []
|
|
4166
|
-
}
|
|
4167
|
-
},
|
|
4168
|
-
{
|
|
4169
|
-
"id": "a8f1d7e3-2b5c-4d9e-8a1b-3c4d5e6f7890",
|
|
4170
|
-
"type": "OptionField",
|
|
4171
|
-
"slug": "status",
|
|
4172
|
-
"label": "Status",
|
|
4173
|
-
"required": false,
|
|
4174
|
-
"system": false,
|
|
4175
|
-
"config": {
|
|
4176
|
-
"options": [
|
|
4177
|
-
{ "id": 1, "name": "Open", "color": "default" },
|
|
4178
|
-
{ "id": 2, "name": "In Progress", "color": "warning" },
|
|
4179
|
-
{ "id": 3, "name": "Done", "color": "success" }
|
|
4180
|
-
],
|
|
4181
|
-
"defaultValue": 1,
|
|
4182
|
-
"conditionalFormatting": [],
|
|
4183
|
-
"buttonConfig": null
|
|
4184
|
-
}
|
|
4185
|
-
},
|
|
4186
|
-
{
|
|
4187
|
-
"id": "5c6d7e8f-9012-3456-789a-bcdef0123456",
|
|
4188
|
-
"type": "OptionField",
|
|
4189
|
-
"slug": "stage",
|
|
4190
|
-
"label": "Stage",
|
|
4191
|
-
"required": false,
|
|
4192
|
-
"system": false,
|
|
4193
|
-
"config": {
|
|
4194
|
-
"options": [
|
|
4195
|
-
{ "id": 1, "name": "To Do", "color": "default" },
|
|
4196
|
-
{ "id": 2, "name": "Doing", "color": "warning" },
|
|
4197
|
-
{ "id": 3, "name": "Done", "color": "success" }
|
|
4198
|
-
],
|
|
4199
|
-
"defaultValue": 1,
|
|
4200
|
-
"conditionalFormatting": [],
|
|
4201
|
-
"buttonConfig": {
|
|
4202
|
-
"displayMode": "button",
|
|
4203
|
-
"buttonBehavior": {
|
|
4204
|
-
"mode": "cycle",
|
|
4205
|
-
"cycleOrder": [1, 2, 3],
|
|
4206
|
-
"requireConfirmation": false,
|
|
4207
|
-
"lockAfterSelection": false,
|
|
4208
|
-
"allowReselect": true
|
|
4209
|
-
}
|
|
4210
|
-
}
|
|
4211
|
-
}
|
|
4212
|
-
},
|
|
4213
|
-
{
|
|
4214
|
-
"id": "3e9f8c12-4a5b-6c7d-8e9f-0a1b2c3d4e5f",
|
|
4215
|
-
"type": "FormulaField",
|
|
4216
|
-
"slug": "formula-total",
|
|
4217
|
-
"label": "Formula Total",
|
|
4218
|
-
"required": false,
|
|
4219
|
-
"system": false,
|
|
4220
|
-
"config": {
|
|
4221
|
-
"formulaText": "amount * 1.21",
|
|
4222
|
-
"uiFormatKind": "number",
|
|
4223
|
-
"status": "ACTIVE",
|
|
4224
|
-
"defaultValue": null,
|
|
4225
|
-
"numberFormatOptions": {
|
|
4226
|
-
"format": "number",
|
|
4227
|
-
"decimals": 2,
|
|
4228
|
-
"thousandsSeparator": true
|
|
4229
|
-
},
|
|
4230
|
-
"conditionalFormatting": []
|
|
4231
|
-
}
|
|
4232
|
-
},
|
|
4233
|
-
{
|
|
4234
|
-
"id": "6d7e8f90-1234-5678-9abc-def012345678",
|
|
4235
|
-
"type": "FormulaField",
|
|
4236
|
-
"slug": "formula-deadline",
|
|
4237
|
-
"label": "Computed Deadline",
|
|
4238
|
-
"required": false,
|
|
4239
|
-
"system": false,
|
|
4240
|
-
"config": {
|
|
4241
|
-
"formulaText": "addDays(startDate, 7)",
|
|
4242
|
-
"uiFormatKind": "date",
|
|
4243
|
-
"status": "ACTIVE",
|
|
4244
|
-
"defaultValue": null,
|
|
4245
|
-
"dateFormatOptions": {
|
|
4246
|
-
"format": "date",
|
|
4247
|
-
"dateFormat": "DD/MM/YYYY",
|
|
4248
|
-
"showTime": false
|
|
4249
|
-
},
|
|
4250
|
-
"conditionalFormatting": []
|
|
4251
|
-
}
|
|
4252
|
-
},
|
|
4253
|
-
{
|
|
4254
|
-
"id": "45c5da96-0dc2-4cc1-ba61-7660a9c6da32",
|
|
4255
|
-
"type": "ReferenceField",
|
|
4256
|
-
"slug": "customer-ref",
|
|
4257
|
-
"label": "Customer",
|
|
4258
|
-
"required": false,
|
|
4259
|
-
"system": false,
|
|
4260
|
-
"config": {
|
|
4261
|
-
"targetSchema": "5223cbc8-8c6c-4694-93bc-dd176364df9b",
|
|
4262
|
-
"targetDisplayField": "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
4263
|
-
"deleteBehavior": "SET_NULL",
|
|
4264
|
-
"defaultValue": null,
|
|
4265
|
-
"filterFields": [],
|
|
4266
|
-
"descriptionFields": [],
|
|
4267
|
-
"conditionalFormatting": []
|
|
4268
|
-
}
|
|
4269
|
-
},
|
|
4270
|
-
{
|
|
4271
|
-
"id": "7e8f9012-3456-789a-bcde-f01234567890",
|
|
4272
|
-
"type": "ReferenceField",
|
|
4273
|
-
"slug": "company-ref",
|
|
4274
|
-
"label": "Company",
|
|
4275
|
-
"required": false,
|
|
4276
|
-
"system": false,
|
|
4277
|
-
"config": {
|
|
4278
|
-
"targetSchema": "5223cbc8-8c6c-4694-93bc-dd176364df9b",
|
|
4279
|
-
"targetDisplayField": "c60b8526-5835-4c9f-aecd-9a16c7704a34",
|
|
4280
|
-
"deleteBehavior": "RESTRICT",
|
|
4281
|
-
"defaultValue": null,
|
|
4282
|
-
"filterFields": [],
|
|
4283
|
-
"descriptionFields": [],
|
|
4284
|
-
"conditionalFormatting": []
|
|
4285
|
-
}
|
|
4286
|
-
},
|
|
4287
|
-
{
|
|
4288
|
-
"id": "b2c3d4e5-f6a7-8b9c-0d1e-2f3a4b5c6d7e",
|
|
4289
|
-
"type": "AutoIncrementalField",
|
|
4290
|
-
"slug": "sequence-code",
|
|
4291
|
-
"label": "Sequence Code",
|
|
4292
|
-
"required": false,
|
|
4293
|
-
"system": true,
|
|
4294
|
-
"config": {
|
|
4295
|
-
"segmentedByFieldId": "45c5da96-0dc2-4cc1-ba61-7660a9c6da32",
|
|
4296
|
-
"conditionalFormatting": []
|
|
4297
|
-
}
|
|
4298
|
-
},
|
|
4299
|
-
{
|
|
4300
|
-
"id": "8f901234-5678-9abc-def0-123456789012",
|
|
4301
|
-
"type": "AutoIncrementalField",
|
|
4302
|
-
"slug": "order-number",
|
|
4303
|
-
"label": "Order Number",
|
|
4304
|
-
"required": false,
|
|
4305
|
-
"system": true,
|
|
4306
|
-
"config": {
|
|
4307
|
-
"segmentedByFieldId": null,
|
|
4308
|
-
"conditionalFormatting": []
|
|
4309
|
-
}
|
|
4310
|
-
},
|
|
4311
|
-
{
|
|
4312
|
-
"id": "e5f6a7b8-c9d0-1e2f-3a4b-5c6d7e8f9012",
|
|
4313
|
-
"type": "FileField",
|
|
4314
|
-
"slug": "attachment",
|
|
4315
|
-
"label": "Attachment",
|
|
4316
|
-
"required": false,
|
|
4317
|
-
"system": false,
|
|
4318
|
-
"config": {}
|
|
4319
|
-
},
|
|
4320
|
-
{
|
|
4321
|
-
"id": "f6a7b8c9-d0e1-2f3a-4b5c-6d7e8f901234",
|
|
4322
|
-
"type": "ScheduleField",
|
|
4323
|
-
"slug": "recurrence",
|
|
4324
|
-
"label": "Recurrence",
|
|
4325
|
-
"required": false,
|
|
4326
|
-
"system": false,
|
|
4327
|
-
"config": {
|
|
4328
|
-
"referenceField": "c52efe3f-2825-4c60-a7e3-34dd4c1ce043",
|
|
4329
|
-
"beginningPeriodField": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
4330
|
-
"endingPeriodField": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
|
4331
|
-
"frequency": "monthly"
|
|
4332
|
-
}
|
|
4333
|
-
},
|
|
4334
|
-
{
|
|
4335
|
-
"id": "9012abcd-ef01-2345-6789-abcdef012345",
|
|
4336
|
-
"type": "ScheduleField",
|
|
4337
|
-
"slug": "daily-recurrence",
|
|
4338
|
-
"label": "Daily Recurrence",
|
|
3504
|
+
"label": "Due Date",
|
|
4339
3505
|
"required": false,
|
|
4340
3506
|
"system": false,
|
|
4341
3507
|
"config": {
|
|
4342
|
-
"
|
|
4343
|
-
"
|
|
4344
|
-
|
|
4345
|
-
|
|
3508
|
+
"defaultValue": null,
|
|
3509
|
+
"formatOptions": {
|
|
3510
|
+
"format": "datetime",
|
|
3511
|
+
"dateFormat": "DD/MM/YYYY",
|
|
3512
|
+
"showTime": true
|
|
3513
|
+
},
|
|
3514
|
+
"conditionalFormatting": []
|
|
4346
3515
|
}
|
|
4347
3516
|
},
|
|
4348
3517
|
{
|
|
@@ -4548,47 +3717,6 @@ var specificExamples = {
|
|
|
4548
3717
|
{ "type": "TEXT", "value": " for follow up." }
|
|
4549
3718
|
]
|
|
4550
3719
|
}
|
|
4551
|
-
]`
|
|
4552
|
-
}
|
|
4553
|
-
]),
|
|
4554
|
-
"logs list": buildCommandExamples([
|
|
4555
|
-
{
|
|
4556
|
-
description: "List the change history for a record (CREATE entry plus UPDATE entries with before/after values per field).",
|
|
4557
|
-
command: `zinkee --json logs list contacts ${SAMPLE_UUID}`,
|
|
4558
|
-
response: `[
|
|
4559
|
-
{
|
|
4560
|
-
"recordId": "550e8400-e29b-41d4-a716-446655440000",
|
|
4561
|
-
"timestamp": "2026-04-22T10:00:00Z",
|
|
4562
|
-
"changeField": "",
|
|
4563
|
-
"change": {
|
|
4564
|
-
"beforeValue": null,
|
|
4565
|
-
"afterValue": null,
|
|
4566
|
-
"author": "developer@zinkee.com",
|
|
4567
|
-
"operation": "CREATE"
|
|
4568
|
-
}
|
|
4569
|
-
},
|
|
4570
|
-
{
|
|
4571
|
-
"recordId": "550e8400-e29b-41d4-a716-446655440000",
|
|
4572
|
-
"timestamp": "2026-04-22T10:15:00Z",
|
|
4573
|
-
"changeField": "status",
|
|
4574
|
-
"change": {
|
|
4575
|
-
"beforeValue": "1",
|
|
4576
|
-
"afterValue": "2",
|
|
4577
|
-
"author": "developer@zinkee.com",
|
|
4578
|
-
"operation": "UPDATE"
|
|
4579
|
-
}
|
|
4580
|
-
},
|
|
4581
|
-
{
|
|
4582
|
-
"recordId": "550e8400-e29b-41d4-a716-446655440000",
|
|
4583
|
-
"timestamp": "2026-04-22T10:20:00Z",
|
|
4584
|
-
"changeField": "amount",
|
|
4585
|
-
"change": {
|
|
4586
|
-
"beforeValue": "1000.00",
|
|
4587
|
-
"afterValue": "1250.50",
|
|
4588
|
-
"author": "developer@zinkee.com",
|
|
4589
|
-
"operation": "UPDATE"
|
|
4590
|
-
}
|
|
4591
|
-
}
|
|
4592
3720
|
]`
|
|
4593
3721
|
}
|
|
4594
3722
|
]),
|
|
@@ -5879,28 +5007,24 @@ function buildSchemaFieldCreateExamples(type) {
|
|
|
5879
5007
|
const definitions = getSchemaFieldTypeDefinitions();
|
|
5880
5008
|
const selectedDefinition = resolveSchemaFieldType(type);
|
|
5881
5009
|
const filteredDefinitions = selectedDefinition ? definitions.filter((definition) => definition.key === selectedDefinition.key) : definitions;
|
|
5882
|
-
const flat = filteredDefinitions.flatMap(
|
|
5883
|
-
(definition) => definition.examplePayloads.map((example) => ({ definition, example }))
|
|
5884
|
-
);
|
|
5885
5010
|
return buildCommandExamples(
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
command,
|
|
5893
|
-
response: `{
|
|
5894
|
-
"schemaId": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
|
|
5895
|
-
"fieldId": "a8f1d7e3-2b5c-4d9e-8a1b-3c4d5e6f7890",
|
|
5896
|
-
"slug": "${slug}"
|
|
5897
|
-
}`
|
|
5898
|
-
};
|
|
5011
|
+
filteredDefinitions.flatMap((definition) => {
|
|
5012
|
+
if (definition.key !== "number") {
|
|
5013
|
+
return [{
|
|
5014
|
+
description: `Create a ${definition.key} field`,
|
|
5015
|
+
command: `zinkee --json schemas fields create contacts --raw '${JSON.stringify(definition.examplePayload)}'`
|
|
5016
|
+
}];
|
|
5899
5017
|
}
|
|
5900
|
-
return
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5018
|
+
return [
|
|
5019
|
+
{
|
|
5020
|
+
description: "Create a required number field with a default value",
|
|
5021
|
+
command: "zinkee --json schemas fields create contacts --type number --slug amount --label Amount --required true --default 0"
|
|
5022
|
+
},
|
|
5023
|
+
{
|
|
5024
|
+
description: "Create a number field formatted like Moneda",
|
|
5025
|
+
command: `zinkee --json schemas fields create contacts --raw '${JSON.stringify(definition.examplePayload)}'`
|
|
5026
|
+
}
|
|
5027
|
+
];
|
|
5904
5028
|
})
|
|
5905
5029
|
);
|
|
5906
5030
|
}
|
|
@@ -6493,7 +5617,7 @@ ${index + 1}. ${example.description}
|
|
|
6493
5617
|
|
|
6494
5618
|
// src/program.ts
|
|
6495
5619
|
import { createRequire } from "module";
|
|
6496
|
-
import { Command as
|
|
5620
|
+
import { Command as Command9 } from "commander";
|
|
6497
5621
|
|
|
6498
5622
|
// src/commands/config.ts
|
|
6499
5623
|
function getCommandIo(stdout) {
|
|
@@ -8986,117 +8110,9 @@ function registerFilesCommands(program, options = {}) {
|
|
|
8986
8110
|
});
|
|
8987
8111
|
}
|
|
8988
8112
|
|
|
8989
|
-
// src/commands/logs.ts
|
|
8990
|
-
import { InvalidArgumentError as InvalidArgumentError5 } from "commander";
|
|
8991
|
-
|
|
8992
|
-
// src/api/logs.ts
|
|
8993
|
-
function selectorValue6(selector2) {
|
|
8994
|
-
return selector2.value;
|
|
8995
|
-
}
|
|
8996
|
-
var LogsApi = class {
|
|
8997
|
-
constructor(client) {
|
|
8998
|
-
this.client = client;
|
|
8999
|
-
}
|
|
9000
|
-
listLogs(schema, recordId) {
|
|
9001
|
-
return this.client.getJson(
|
|
9002
|
-
`/api/v2/schemas/${selectorValue6(schema)}/records/${recordId}/logs`
|
|
9003
|
-
);
|
|
9004
|
-
}
|
|
9005
|
-
};
|
|
9006
|
-
|
|
9007
|
-
// src/commands/logs.ts
|
|
9008
|
-
function getCommandIo6(stdout) {
|
|
9009
|
-
return stdout ?? process.stdout;
|
|
9010
|
-
}
|
|
9011
|
-
function writeLine6(stdout, value) {
|
|
9012
|
-
stdout.write(`${value}
|
|
9013
|
-
`);
|
|
9014
|
-
}
|
|
9015
|
-
function getGlobalOptions6(command) {
|
|
9016
|
-
return command.optsWithGlobals();
|
|
9017
|
-
}
|
|
9018
|
-
function emitJson6(stdout, commandName, data, ..._extra) {
|
|
9019
|
-
writeLine6(
|
|
9020
|
-
stdout,
|
|
9021
|
-
JSON.stringify(buildJsonSuccess(data, { command: commandName }))
|
|
9022
|
-
);
|
|
9023
|
-
}
|
|
9024
|
-
function toConfigurationError6(filePath, error) {
|
|
9025
|
-
if (error instanceof CliError) {
|
|
9026
|
-
throw error;
|
|
9027
|
-
}
|
|
9028
|
-
if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
|
|
9029
|
-
throw new CliError("configuration_error", `Config file not found at ${filePath}.`);
|
|
9030
|
-
}
|
|
9031
|
-
if (error instanceof Error) {
|
|
9032
|
-
throw new CliError("configuration_error", error.message);
|
|
9033
|
-
}
|
|
9034
|
-
throw error;
|
|
9035
|
-
}
|
|
9036
|
-
function createLogsApi(command, filePath) {
|
|
9037
|
-
try {
|
|
9038
|
-
const config = readRuntimeConfig(filePath);
|
|
9039
|
-
const runtime = resolveRuntimeContext(config, getGlobalOptions6(command));
|
|
9040
|
-
if (!runtime.baseUrl) {
|
|
9041
|
-
throw new CliError(
|
|
9042
|
-
"configuration_error",
|
|
9043
|
-
`Resolved profile "${runtime.profile}" is missing a base URL.`
|
|
9044
|
-
);
|
|
9045
|
-
}
|
|
9046
|
-
return {
|
|
9047
|
-
api: new LogsApi(
|
|
9048
|
-
new ApiClient({
|
|
9049
|
-
baseUrl: runtime.baseUrl,
|
|
9050
|
-
apiKey: runtime.apiKey
|
|
9051
|
-
})
|
|
9052
|
-
),
|
|
9053
|
-
json: runtime.json
|
|
9054
|
-
};
|
|
9055
|
-
} catch (error) {
|
|
9056
|
-
toConfigurationError6(filePath, error);
|
|
9057
|
-
}
|
|
9058
|
-
}
|
|
9059
|
-
function parseUuidOrSlugSelector5(input) {
|
|
9060
|
-
try {
|
|
9061
|
-
return normalizeUuidOrSlug(input);
|
|
9062
|
-
} catch (error) {
|
|
9063
|
-
const message = error instanceof Error ? error.message : "Invalid selector.";
|
|
9064
|
-
throw new InvalidArgumentError5(message);
|
|
9065
|
-
}
|
|
9066
|
-
}
|
|
9067
|
-
function isJsonObject4(value) {
|
|
9068
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9069
|
-
}
|
|
9070
|
-
function toTableRows3(data) {
|
|
9071
|
-
if (Array.isArray(data)) {
|
|
9072
|
-
return data.map((entry) => isJsonObject4(entry) ? entry : { value: entry });
|
|
9073
|
-
}
|
|
9074
|
-
if (isJsonObject4(data)) {
|
|
9075
|
-
return [data];
|
|
9076
|
-
}
|
|
9077
|
-
return [{ value: data }];
|
|
9078
|
-
}
|
|
9079
|
-
function emitTable3(stdout, data) {
|
|
9080
|
-
printTable(toTableRows3(data), void 0, stdout);
|
|
9081
|
-
}
|
|
9082
|
-
function registerLogsCommands(program, options = {}) {
|
|
9083
|
-
const filePath = options.configPath ?? defaultConfigPath;
|
|
9084
|
-
const stdout = getCommandIo6(options.stdout);
|
|
9085
|
-
const logs = program.command("logs").description("Inspect record change logs");
|
|
9086
|
-
logs.command("list").description("List change logs for a record").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector5).argument("<record>", "record uuid or slug", parseUuidOrSlugSelector5).action(async function action(schema, record) {
|
|
9087
|
-
const { api, json } = createLogsApi(this, filePath);
|
|
9088
|
-
const data = await api.listLogs(schema, record.value);
|
|
9089
|
-
if (json) {
|
|
9090
|
-
emitJson6(stdout, "logs list", data, filePath);
|
|
9091
|
-
return;
|
|
9092
|
-
}
|
|
9093
|
-
emitTable3(stdout, data);
|
|
9094
|
-
});
|
|
9095
|
-
}
|
|
9096
|
-
|
|
9097
8113
|
// src/commands/navigation.ts
|
|
9098
8114
|
import { readFileSync as readFileSync6 } from "fs";
|
|
9099
|
-
import { InvalidArgumentError as
|
|
8115
|
+
import { InvalidArgumentError as InvalidArgumentError5 } from "commander";
|
|
9100
8116
|
|
|
9101
8117
|
// src/api/navigation.ts
|
|
9102
8118
|
function jsonOptions5(body, method) {
|
|
@@ -9108,7 +8124,7 @@ function jsonOptions5(body, method) {
|
|
|
9108
8124
|
body: JSON.stringify(body)
|
|
9109
8125
|
};
|
|
9110
8126
|
}
|
|
9111
|
-
function
|
|
8127
|
+
function selectorValue6(selector2) {
|
|
9112
8128
|
return selector2.value;
|
|
9113
8129
|
}
|
|
9114
8130
|
var NavigationApi = class {
|
|
@@ -9126,13 +8142,13 @@ var NavigationApi = class {
|
|
|
9126
8142
|
}
|
|
9127
8143
|
updateFolder(folder, body) {
|
|
9128
8144
|
return this.client.requestJson(
|
|
9129
|
-
`/api/v2/navigation/folders/${
|
|
8145
|
+
`/api/v2/navigation/folders/${selectorValue6(folder)}`,
|
|
9130
8146
|
jsonOptions5(body, "PATCH")
|
|
9131
8147
|
);
|
|
9132
8148
|
}
|
|
9133
8149
|
deleteFolder(folder) {
|
|
9134
8150
|
return this.client.requestJson(
|
|
9135
|
-
`/api/v2/navigation/folders/${
|
|
8151
|
+
`/api/v2/navigation/folders/${selectorValue6(folder)}`,
|
|
9136
8152
|
{ method: "DELETE" }
|
|
9137
8153
|
);
|
|
9138
8154
|
}
|
|
@@ -9145,20 +8161,20 @@ var NavigationApi = class {
|
|
|
9145
8161
|
};
|
|
9146
8162
|
|
|
9147
8163
|
// src/commands/navigation.ts
|
|
9148
|
-
function
|
|
8164
|
+
function getCommandIo6(stdout) {
|
|
9149
8165
|
return stdout ?? process.stdout;
|
|
9150
8166
|
}
|
|
9151
|
-
function
|
|
8167
|
+
function writeLine6(stdout, value) {
|
|
9152
8168
|
stdout.write(`${value}
|
|
9153
8169
|
`);
|
|
9154
8170
|
}
|
|
9155
|
-
function
|
|
8171
|
+
function getGlobalOptions6(command) {
|
|
9156
8172
|
return command.optsWithGlobals();
|
|
9157
8173
|
}
|
|
9158
|
-
function
|
|
9159
|
-
|
|
8174
|
+
function emitJson6(stdout, commandName, data, configPath) {
|
|
8175
|
+
writeLine6(stdout, JSON.stringify(buildJsonSuccess(data, { command: commandName, configPath })));
|
|
9160
8176
|
}
|
|
9161
|
-
function
|
|
8177
|
+
function toConfigurationError6(filePath, error) {
|
|
9162
8178
|
if (error instanceof CliError) {
|
|
9163
8179
|
throw error;
|
|
9164
8180
|
}
|
|
@@ -9173,7 +8189,7 @@ function toConfigurationError7(filePath, error) {
|
|
|
9173
8189
|
function createNavigationApi(command, filePath) {
|
|
9174
8190
|
try {
|
|
9175
8191
|
const config = readRuntimeConfig(filePath);
|
|
9176
|
-
const runtime = resolveRuntimeContext(config,
|
|
8192
|
+
const runtime = resolveRuntimeContext(config, getGlobalOptions6(command));
|
|
9177
8193
|
if (!runtime.baseUrl) {
|
|
9178
8194
|
throw new CliError("configuration_error", `Resolved profile "${runtime.profile}" is missing a base URL.`);
|
|
9179
8195
|
}
|
|
@@ -9188,7 +8204,7 @@ function createNavigationApi(command, filePath) {
|
|
|
9188
8204
|
readOnly: runtime.readOnly
|
|
9189
8205
|
};
|
|
9190
8206
|
} catch (error) {
|
|
9191
|
-
|
|
8207
|
+
toConfigurationError6(filePath, error);
|
|
9192
8208
|
}
|
|
9193
8209
|
}
|
|
9194
8210
|
function ensureWritable5(commandName, readOnly, mode) {
|
|
@@ -9200,12 +8216,12 @@ function ensureWritable5(commandName, readOnly, mode) {
|
|
|
9200
8216
|
);
|
|
9201
8217
|
}
|
|
9202
8218
|
}
|
|
9203
|
-
function
|
|
8219
|
+
function parseUuidOrSlugSelector5(input) {
|
|
9204
8220
|
try {
|
|
9205
8221
|
return normalizeUuidOrSlug(input);
|
|
9206
8222
|
} catch (error) {
|
|
9207
8223
|
const message = error instanceof Error ? error.message : "Invalid selector.";
|
|
9208
|
-
throw new
|
|
8224
|
+
throw new InvalidArgumentError5(message);
|
|
9209
8225
|
}
|
|
9210
8226
|
}
|
|
9211
8227
|
function parseInteger(value, flagName) {
|
|
@@ -9284,24 +8300,24 @@ function folderRows2(folders) {
|
|
|
9284
8300
|
}
|
|
9285
8301
|
function registerNavigationCommands(program, options = {}) {
|
|
9286
8302
|
const filePath = options.configPath ?? defaultConfigPath;
|
|
9287
|
-
const stdout =
|
|
8303
|
+
const stdout = getCommandIo6(options.stdout);
|
|
9288
8304
|
const navigation = program.command("navigation").description("Manage workspace navigation");
|
|
9289
8305
|
const folders = navigation.command("folders").description("Manage navigation folders");
|
|
9290
8306
|
folders.command("list").description("List navigation folders").action(async function action() {
|
|
9291
8307
|
const { api, json } = createNavigationApi(this, filePath);
|
|
9292
8308
|
const data = await api.listFolders();
|
|
9293
8309
|
if (json) {
|
|
9294
|
-
|
|
8310
|
+
emitJson6(stdout, "navigation folders list", data, filePath);
|
|
9295
8311
|
return;
|
|
9296
8312
|
}
|
|
9297
8313
|
printTable(folderRows2(data), ["id", "order", "name", "resourceCount"], stdout);
|
|
9298
8314
|
});
|
|
9299
|
-
folders.command("get").description("Get a navigation folder by UUID or exact name").argument("<folder>", "folder UUID or exact name",
|
|
8315
|
+
folders.command("get").description("Get a navigation folder by UUID or exact name").argument("<folder>", "folder UUID or exact name", parseUuidOrSlugSelector5).action(async function action(folder) {
|
|
9300
8316
|
const { api, json } = createNavigationApi(this, filePath);
|
|
9301
8317
|
const data = await api.listFolders();
|
|
9302
8318
|
const resolved = resolveFolder2(data, folder);
|
|
9303
8319
|
if (json) {
|
|
9304
|
-
|
|
8320
|
+
emitJson6(stdout, "navigation folders get", resolved, filePath);
|
|
9305
8321
|
return;
|
|
9306
8322
|
}
|
|
9307
8323
|
printTable(folderRows2([resolved]), ["id", "order", "name", "resourceCount"], stdout);
|
|
@@ -9311,12 +8327,12 @@ function registerNavigationCommands(program, options = {}) {
|
|
|
9311
8327
|
ensureWritable5("navigation folders create", readOnly, "write");
|
|
9312
8328
|
const data = await api.createFolder(buildFolderBody(commandOptions));
|
|
9313
8329
|
if (json) {
|
|
9314
|
-
|
|
8330
|
+
emitJson6(stdout, "navigation folders create", data, filePath);
|
|
9315
8331
|
return;
|
|
9316
8332
|
}
|
|
9317
|
-
|
|
8333
|
+
writeLine6(stdout, `Created navigation folder "${String(data.name ?? commandOptions.name)}".`);
|
|
9318
8334
|
});
|
|
9319
|
-
folders.command("update").description("Update a navigation folder").argument("<folder>", "folder UUID or exact name",
|
|
8335
|
+
folders.command("update").description("Update a navigation folder").argument("<folder>", "folder UUID or exact name", parseUuidOrSlugSelector5).option("--name <name>", "folder name").option("--order <n>", "folder order").option("--props <json>", "folder additionalProperties JSON").option("--props-file <path>", "folder additionalProperties JSON file").action(async function action(folder, commandOptions) {
|
|
9320
8336
|
const { api, json, readOnly } = createNavigationApi(this, filePath);
|
|
9321
8337
|
ensureWritable5("navigation folders update", readOnly, "write");
|
|
9322
8338
|
const allFolders = await api.listFolders();
|
|
@@ -9327,54 +8343,54 @@ function registerNavigationCommands(program, options = {}) {
|
|
|
9327
8343
|
}
|
|
9328
8344
|
const data = await api.updateFolder({ kind: "uuid", value: resolved.id }, body);
|
|
9329
8345
|
if (json) {
|
|
9330
|
-
|
|
8346
|
+
emitJson6(stdout, "navigation folders update", data, filePath);
|
|
9331
8347
|
return;
|
|
9332
8348
|
}
|
|
9333
|
-
|
|
8349
|
+
writeLine6(stdout, `Updated navigation folder "${String(data.name ?? resolved.name ?? resolved.id)}".`);
|
|
9334
8350
|
});
|
|
9335
|
-
folders.command("delete").description("Delete a navigation folder").argument("<folder>", "folder UUID or exact name",
|
|
8351
|
+
folders.command("delete").description("Delete a navigation folder").argument("<folder>", "folder UUID or exact name", parseUuidOrSlugSelector5).action(async function action(folder) {
|
|
9336
8352
|
const { api, json, readOnly } = createNavigationApi(this, filePath);
|
|
9337
8353
|
ensureWritable5("navigation folders delete", readOnly, "destructive");
|
|
9338
8354
|
const allFolders = await api.listFolders();
|
|
9339
8355
|
const resolved = resolveFolder2(allFolders, folder);
|
|
9340
8356
|
const data = await api.deleteFolder({ kind: "uuid", value: resolved.id });
|
|
9341
8357
|
if (json) {
|
|
9342
|
-
|
|
8358
|
+
emitJson6(stdout, "navigation folders delete", data, filePath);
|
|
9343
8359
|
return;
|
|
9344
8360
|
}
|
|
9345
|
-
|
|
8361
|
+
writeLine6(stdout, `Deleted navigation folder "${resolved.name ?? resolved.id}".`);
|
|
9346
8362
|
});
|
|
9347
8363
|
navigation.command("resources").description("Manage navigation resources").command("move").description("Move a resource into a folder").argument("<resource>", "resource UUID").requiredOption("--type <type>", "resource type").requiredOption("--to <folder>", "target folder UUID or exact name").action(async function action(resourceId, commandOptions) {
|
|
9348
8364
|
const { api, json, readOnly } = createNavigationApi(this, filePath);
|
|
9349
8365
|
ensureWritable5("navigation resources move", readOnly, "write");
|
|
9350
8366
|
const allFolders = await api.listFolders();
|
|
9351
|
-
const resolved = resolveFolder2(allFolders,
|
|
8367
|
+
const resolved = resolveFolder2(allFolders, parseUuidOrSlugSelector5(commandOptions.to));
|
|
9352
8368
|
const data = await api.moveResource({
|
|
9353
8369
|
resourceId,
|
|
9354
8370
|
resourceType: commandOptions.type.toUpperCase(),
|
|
9355
8371
|
targetFolderId: resolved.id
|
|
9356
8372
|
});
|
|
9357
8373
|
if (json) {
|
|
9358
|
-
|
|
8374
|
+
emitJson6(stdout, "navigation resources move", data, filePath);
|
|
9359
8375
|
return;
|
|
9360
8376
|
}
|
|
9361
|
-
|
|
8377
|
+
writeLine6(stdout, `Moved resource "${resourceId}" to "${resolved.name ?? resolved.id}".`);
|
|
9362
8378
|
});
|
|
9363
8379
|
}
|
|
9364
8380
|
|
|
9365
8381
|
// src/commands/profiles.ts
|
|
9366
|
-
function
|
|
8382
|
+
function getCommandIo7(stdout) {
|
|
9367
8383
|
return stdout ?? process.stdout;
|
|
9368
8384
|
}
|
|
9369
|
-
function
|
|
8385
|
+
function writeLine7(stdout, value) {
|
|
9370
8386
|
stdout.write(`${value}
|
|
9371
8387
|
`);
|
|
9372
8388
|
}
|
|
9373
|
-
function
|
|
8389
|
+
function getGlobalOptions7(command) {
|
|
9374
8390
|
return command.optsWithGlobals();
|
|
9375
8391
|
}
|
|
9376
|
-
function
|
|
9377
|
-
|
|
8392
|
+
function emitJson7(stdout, commandName, data, configPath) {
|
|
8393
|
+
writeLine7(
|
|
9378
8394
|
stdout,
|
|
9379
8395
|
JSON.stringify(buildJsonSuccess(data, { command: commandName, configPath }))
|
|
9380
8396
|
);
|
|
@@ -9417,15 +8433,15 @@ function emitProfilesTable(stdout, data) {
|
|
|
9417
8433
|
}
|
|
9418
8434
|
function registerProfilesCommands(program, options = {}) {
|
|
9419
8435
|
const filePath = options.configPath ?? defaultConfigPath;
|
|
9420
|
-
const stdout =
|
|
8436
|
+
const stdout = getCommandIo7(options.stdout);
|
|
9421
8437
|
const profiles = program.command("profiles").description("Manage local CLI profiles");
|
|
9422
8438
|
profiles.command("list").description("List configured profiles").action(function action() {
|
|
9423
8439
|
const config = readRequiredConfig(filePath);
|
|
9424
8440
|
const data = Object.entries(config.profiles).map(
|
|
9425
8441
|
([name, profile]) => toDisplayProfile(name, profile, config.defaultProfile)
|
|
9426
8442
|
);
|
|
9427
|
-
if (
|
|
9428
|
-
|
|
8443
|
+
if (getGlobalOptions7(this).json) {
|
|
8444
|
+
emitJson7(stdout, "profiles list", data, filePath);
|
|
9429
8445
|
return;
|
|
9430
8446
|
}
|
|
9431
8447
|
emitProfilesTable(stdout, data);
|
|
@@ -9434,8 +8450,8 @@ function registerProfilesCommands(program, options = {}) {
|
|
|
9434
8450
|
const config = readRequiredConfig(filePath);
|
|
9435
8451
|
const profile = getRequiredProfile(config, profileName);
|
|
9436
8452
|
const data = toDisplayProfile(profileName, profile, config.defaultProfile);
|
|
9437
|
-
if (
|
|
9438
|
-
|
|
8453
|
+
if (getGlobalOptions7(this).json) {
|
|
8454
|
+
emitJson7(stdout, "profiles get", data, filePath);
|
|
9439
8455
|
return;
|
|
9440
8456
|
}
|
|
9441
8457
|
emitProfilesTable(stdout, [data]);
|
|
@@ -9449,11 +8465,11 @@ function registerProfilesCommands(program, options = {}) {
|
|
|
9449
8465
|
profile: profileName,
|
|
9450
8466
|
defaultProfile: nextConfig.defaultProfile
|
|
9451
8467
|
};
|
|
9452
|
-
if (
|
|
9453
|
-
|
|
8468
|
+
if (getGlobalOptions7(this).json) {
|
|
8469
|
+
emitJson7(stdout, "profiles use", data, filePath);
|
|
9454
8470
|
return;
|
|
9455
8471
|
}
|
|
9456
|
-
|
|
8472
|
+
writeLine7(stdout, `Using profile "${profileName}".`);
|
|
9457
8473
|
});
|
|
9458
8474
|
profiles.command("add").description("Add a profile to the local config").argument("<profile>", "profile name").requiredOption("--api-key <token>", "API key").option("--base-url <url>", "base URL").action(function action(profileName, commandOptions) {
|
|
9459
8475
|
const config = loadConfigForAdd(filePath);
|
|
@@ -9476,11 +8492,11 @@ function registerProfilesCommands(program, options = {}) {
|
|
|
9476
8492
|
nextConfig.profiles[profileName] ?? {},
|
|
9477
8493
|
nextConfig.defaultProfile
|
|
9478
8494
|
);
|
|
9479
|
-
if (
|
|
9480
|
-
|
|
8495
|
+
if (getGlobalOptions7(this).json) {
|
|
8496
|
+
emitJson7(stdout, "profiles add", data, filePath);
|
|
9481
8497
|
return;
|
|
9482
8498
|
}
|
|
9483
|
-
|
|
8499
|
+
writeLine7(stdout, `Added profile "${profileName}".`);
|
|
9484
8500
|
});
|
|
9485
8501
|
profiles.command("update").description("Update an existing profile").argument("<profile>", "profile name").option("--api-key <token>", "API key").option("--base-url <url>", "base URL").action(function action(profileName, commandOptions) {
|
|
9486
8502
|
if (commandOptions.apiKey === void 0 && commandOptions.baseUrl === void 0) {
|
|
@@ -9501,11 +8517,11 @@ function registerProfilesCommands(program, options = {}) {
|
|
|
9501
8517
|
nextConfig.profiles[profileName] ?? {},
|
|
9502
8518
|
nextConfig.defaultProfile
|
|
9503
8519
|
);
|
|
9504
|
-
if (
|
|
9505
|
-
|
|
8520
|
+
if (getGlobalOptions7(this).json) {
|
|
8521
|
+
emitJson7(stdout, "profiles update", data, filePath);
|
|
9506
8522
|
return;
|
|
9507
8523
|
}
|
|
9508
|
-
|
|
8524
|
+
writeLine7(stdout, `Updated profile "${profileName}".`);
|
|
9509
8525
|
});
|
|
9510
8526
|
profiles.command("remove").description("Remove a profile from the local config").argument("<profile>", "profile name").action(function action(profileName) {
|
|
9511
8527
|
const config = readRequiredConfig(filePath);
|
|
@@ -9516,17 +8532,17 @@ function registerProfilesCommands(program, options = {}) {
|
|
|
9516
8532
|
profile: profileName,
|
|
9517
8533
|
defaultProfile: nextConfig.defaultProfile
|
|
9518
8534
|
};
|
|
9519
|
-
if (
|
|
9520
|
-
|
|
8535
|
+
if (getGlobalOptions7(this).json) {
|
|
8536
|
+
emitJson7(stdout, "profiles remove", data, filePath);
|
|
9521
8537
|
return;
|
|
9522
8538
|
}
|
|
9523
|
-
|
|
8539
|
+
writeLine7(stdout, `Removed profile "${profileName}".`);
|
|
9524
8540
|
});
|
|
9525
8541
|
}
|
|
9526
8542
|
|
|
9527
8543
|
// src/commands/records.ts
|
|
9528
8544
|
import { readFileSync as readFileSync7 } from "fs";
|
|
9529
|
-
import { InvalidArgumentError as
|
|
8545
|
+
import { InvalidArgumentError as InvalidArgumentError6 } from "commander";
|
|
9530
8546
|
|
|
9531
8547
|
// src/api/records.ts
|
|
9532
8548
|
function jsonOptions6(body, method) {
|
|
@@ -9538,7 +8554,7 @@ function jsonOptions6(body, method) {
|
|
|
9538
8554
|
body: JSON.stringify(body)
|
|
9539
8555
|
};
|
|
9540
8556
|
}
|
|
9541
|
-
function
|
|
8557
|
+
function selectorValue7(selector2) {
|
|
9542
8558
|
return selector2.value;
|
|
9543
8559
|
}
|
|
9544
8560
|
var RecordsApi = class {
|
|
@@ -9553,7 +8569,7 @@ var RecordsApi = class {
|
|
|
9553
8569
|
if (query.offset !== void 0) {
|
|
9554
8570
|
params.set("offset", String(query.offset));
|
|
9555
8571
|
}
|
|
9556
|
-
const path = `/api/v2/schemas/${
|
|
8572
|
+
const path = `/api/v2/schemas/${selectorValue7(schema)}/records`;
|
|
9557
8573
|
const queryString = params.toString();
|
|
9558
8574
|
return this.client.getJson(
|
|
9559
8575
|
queryString ? `${path}?${queryString}` : path
|
|
@@ -9562,30 +8578,30 @@ var RecordsApi = class {
|
|
|
9562
8578
|
queryRecords(schema, query) {
|
|
9563
8579
|
const body = this.normalizeQueryInput(query);
|
|
9564
8580
|
return this.client.requestJson(
|
|
9565
|
-
`/api/v2/schemas/${
|
|
8581
|
+
`/api/v2/schemas/${selectorValue7(schema)}/records:query`,
|
|
9566
8582
|
jsonOptions6(body, "POST")
|
|
9567
8583
|
);
|
|
9568
8584
|
}
|
|
9569
8585
|
getRecord(schema, record) {
|
|
9570
8586
|
return this.client.getJson(
|
|
9571
|
-
`/api/v2/schemas/${
|
|
8587
|
+
`/api/v2/schemas/${selectorValue7(schema)}/records/${selectorValue7(record)}`
|
|
9572
8588
|
);
|
|
9573
8589
|
}
|
|
9574
8590
|
createRecord(schema, input) {
|
|
9575
8591
|
return this.client.requestJson(
|
|
9576
|
-
`/api/v2/schemas/${
|
|
8592
|
+
`/api/v2/schemas/${selectorValue7(schema)}/records`,
|
|
9577
8593
|
jsonOptions6(input, "POST")
|
|
9578
8594
|
);
|
|
9579
8595
|
}
|
|
9580
8596
|
updateRecord(schema, record, input) {
|
|
9581
8597
|
return this.client.requestJson(
|
|
9582
|
-
`/api/v2/schemas/${
|
|
8598
|
+
`/api/v2/schemas/${selectorValue7(schema)}/records/${selectorValue7(record)}`,
|
|
9583
8599
|
jsonOptions6(input, "PATCH")
|
|
9584
8600
|
);
|
|
9585
8601
|
}
|
|
9586
8602
|
deleteRecord(schema, record) {
|
|
9587
8603
|
return this.client.requestJson(
|
|
9588
|
-
`/api/v2/schemas/${
|
|
8604
|
+
`/api/v2/schemas/${selectorValue7(schema)}/records/${selectorValue7(record)}`,
|
|
9589
8605
|
{ method: "DELETE" }
|
|
9590
8606
|
);
|
|
9591
8607
|
}
|
|
@@ -9698,23 +8714,23 @@ function parseExpression(input) {
|
|
|
9698
8714
|
}
|
|
9699
8715
|
|
|
9700
8716
|
// src/commands/records.ts
|
|
9701
|
-
function
|
|
8717
|
+
function getCommandIo8(stdout) {
|
|
9702
8718
|
return stdout ?? process.stdout;
|
|
9703
8719
|
}
|
|
9704
|
-
function
|
|
8720
|
+
function writeLine8(stdout, value) {
|
|
9705
8721
|
stdout.write(`${value}
|
|
9706
8722
|
`);
|
|
9707
8723
|
}
|
|
9708
|
-
function
|
|
8724
|
+
function getGlobalOptions8(command) {
|
|
9709
8725
|
return command.optsWithGlobals();
|
|
9710
8726
|
}
|
|
9711
|
-
function
|
|
9712
|
-
|
|
8727
|
+
function emitJson8(stdout, commandName, data, configPath, meta = {}) {
|
|
8728
|
+
writeLine8(
|
|
9713
8729
|
stdout,
|
|
9714
8730
|
JSON.stringify(buildJsonSuccess(data, { command: commandName, configPath, ...meta }))
|
|
9715
8731
|
);
|
|
9716
8732
|
}
|
|
9717
|
-
function
|
|
8733
|
+
function toConfigurationError7(filePath, error) {
|
|
9718
8734
|
if (error instanceof CliError) {
|
|
9719
8735
|
throw error;
|
|
9720
8736
|
}
|
|
@@ -9729,7 +8745,7 @@ function toConfigurationError8(filePath, error) {
|
|
|
9729
8745
|
function createRecordsApi(command, filePath) {
|
|
9730
8746
|
try {
|
|
9731
8747
|
const config = readRuntimeConfig(filePath);
|
|
9732
|
-
const runtime = resolveRuntimeContext(config,
|
|
8748
|
+
const runtime = resolveRuntimeContext(config, getGlobalOptions8(command));
|
|
9733
8749
|
if (!runtime.baseUrl) {
|
|
9734
8750
|
throw new CliError(
|
|
9735
8751
|
"configuration_error",
|
|
@@ -9748,7 +8764,7 @@ function createRecordsApi(command, filePath) {
|
|
|
9748
8764
|
readOnly: runtime.readOnly
|
|
9749
8765
|
};
|
|
9750
8766
|
} catch (error) {
|
|
9751
|
-
|
|
8767
|
+
toConfigurationError7(filePath, error);
|
|
9752
8768
|
}
|
|
9753
8769
|
}
|
|
9754
8770
|
function ensureWritable6(commandName, readOnly, commandMode) {
|
|
@@ -9763,24 +8779,24 @@ function ensureWritable6(commandName, readOnly, commandMode) {
|
|
|
9763
8779
|
);
|
|
9764
8780
|
}
|
|
9765
8781
|
}
|
|
9766
|
-
function
|
|
8782
|
+
function parseUuidOrSlugSelector6(input) {
|
|
9767
8783
|
try {
|
|
9768
8784
|
return normalizeUuidOrSlug(input);
|
|
9769
8785
|
} catch (error) {
|
|
9770
8786
|
const message = error instanceof Error ? error.message : "Invalid selector.";
|
|
9771
|
-
throw new
|
|
8787
|
+
throw new InvalidArgumentError6(message);
|
|
9772
8788
|
}
|
|
9773
8789
|
}
|
|
9774
8790
|
function parseNonNegativeInteger2(input) {
|
|
9775
8791
|
if (!/^\d+$/.test(input.trim())) {
|
|
9776
|
-
throw new
|
|
8792
|
+
throw new InvalidArgumentError6(`Expected a non-negative integer, received "${input}".`);
|
|
9777
8793
|
}
|
|
9778
8794
|
return Number(input);
|
|
9779
8795
|
}
|
|
9780
8796
|
function parseCommaSeparatedValues(input, label) {
|
|
9781
8797
|
const values = input.split(",").map((value) => value.trim()).filter(Boolean);
|
|
9782
8798
|
if (values.length === 0) {
|
|
9783
|
-
throw new
|
|
8799
|
+
throw new InvalidArgumentError6(`Expected ${label} to contain at least one value.`);
|
|
9784
8800
|
}
|
|
9785
8801
|
return values;
|
|
9786
8802
|
}
|
|
@@ -9789,7 +8805,7 @@ function parseExpressionValue(input) {
|
|
|
9789
8805
|
return parseExpression(input);
|
|
9790
8806
|
} catch (error) {
|
|
9791
8807
|
const message = error instanceof Error ? error.message : "Invalid expression.";
|
|
9792
|
-
throw new
|
|
8808
|
+
throw new InvalidArgumentError6(message);
|
|
9793
8809
|
}
|
|
9794
8810
|
}
|
|
9795
8811
|
function parseKeyValueAssignment(input) {
|
|
@@ -9797,7 +8813,7 @@ function parseKeyValueAssignment(input) {
|
|
|
9797
8813
|
return parseKeyValue(input);
|
|
9798
8814
|
} catch (error) {
|
|
9799
8815
|
const message = error instanceof Error ? error.message : "Invalid assignment.";
|
|
9800
|
-
throw new
|
|
8816
|
+
throw new InvalidArgumentError6(message);
|
|
9801
8817
|
}
|
|
9802
8818
|
}
|
|
9803
8819
|
function parseJsonKeyValueAssignment(input) {
|
|
@@ -9805,7 +8821,7 @@ function parseJsonKeyValueAssignment(input) {
|
|
|
9805
8821
|
return parseJsonAssignment(input);
|
|
9806
8822
|
} catch (error) {
|
|
9807
8823
|
const message = error instanceof Error ? error.message : "Invalid JSON assignment.";
|
|
9808
|
-
throw new
|
|
8824
|
+
throw new InvalidArgumentError6(message);
|
|
9809
8825
|
}
|
|
9810
8826
|
}
|
|
9811
8827
|
function collectStringValues(value, previous = []) {
|
|
@@ -9823,7 +8839,7 @@ function collectKeyValueAssignments(value, previous = []) {
|
|
|
9823
8839
|
function collectJsonAssignments(value, previous = []) {
|
|
9824
8840
|
return [...previous, parseJsonKeyValueAssignment(value)];
|
|
9825
8841
|
}
|
|
9826
|
-
function
|
|
8842
|
+
function isJsonObject4(value) {
|
|
9827
8843
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9828
8844
|
}
|
|
9829
8845
|
function parseRawJsonObject2(input, sourceLabel) {
|
|
@@ -9837,7 +8853,7 @@ function parseRawJsonObject2(input, sourceLabel) {
|
|
|
9837
8853
|
`Failed to parse JSON from ${sourceLabel}: ${message}`
|
|
9838
8854
|
);
|
|
9839
8855
|
}
|
|
9840
|
-
if (!
|
|
8856
|
+
if (!isJsonObject4(parsed)) {
|
|
9841
8857
|
throw new CliError(
|
|
9842
8858
|
"invalid_cli_usage",
|
|
9843
8859
|
`Expected ${sourceLabel} to contain a JSON object.`
|
|
@@ -9931,7 +8947,7 @@ function readRawSetPayload2(raw) {
|
|
|
9931
8947
|
if (setValue === void 0) {
|
|
9932
8948
|
return {};
|
|
9933
8949
|
}
|
|
9934
|
-
if (!
|
|
8950
|
+
if (!isJsonObject4(setValue)) {
|
|
9935
8951
|
throw new CliError(
|
|
9936
8952
|
"invalid_cli_usage",
|
|
9937
8953
|
'Expected raw update payload field "set" to be a JSON object.'
|
|
@@ -9984,17 +9000,17 @@ function buildRecordUpdateInput(options) {
|
|
|
9984
9000
|
}
|
|
9985
9001
|
return input;
|
|
9986
9002
|
}
|
|
9987
|
-
function
|
|
9003
|
+
function toTableRows3(data) {
|
|
9988
9004
|
if (Array.isArray(data)) {
|
|
9989
|
-
return data.map((entry) =>
|
|
9005
|
+
return data.map((entry) => isJsonObject4(entry) ? entry : { value: entry });
|
|
9990
9006
|
}
|
|
9991
|
-
if (
|
|
9007
|
+
if (isJsonObject4(data)) {
|
|
9992
9008
|
return [data];
|
|
9993
9009
|
}
|
|
9994
9010
|
return [{ value: data }];
|
|
9995
9011
|
}
|
|
9996
|
-
function
|
|
9997
|
-
printTable(
|
|
9012
|
+
function emitTable3(stdout, data) {
|
|
9013
|
+
printTable(toTableRows3(data), void 0, stdout);
|
|
9998
9014
|
}
|
|
9999
9015
|
function getQueryRecords(result) {
|
|
10000
9016
|
return Array.isArray(result.records) ? result.records : [];
|
|
@@ -10018,9 +9034,9 @@ async function resolveSchemaSelector(api, selector2) {
|
|
|
10018
9034
|
}
|
|
10019
9035
|
function registerRecordsCommands(program, options = {}) {
|
|
10020
9036
|
const filePath = options.configPath ?? defaultConfigPath;
|
|
10021
|
-
const stdout =
|
|
9037
|
+
const stdout = getCommandIo8(options.stdout);
|
|
10022
9038
|
const records = program.command("records").description("Manage schema records");
|
|
10023
|
-
records.command("list").description("List records for a schema with simple pagination").argument("<schema>", "schema uuid or slug",
|
|
9039
|
+
records.command("list").description("List records for a schema with simple pagination").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector6).option("--limit <number>", "limit results", parseNonNegativeInteger2).option("--offset <number>", "offset results", parseNonNegativeInteger2).action(async function action(schema, commandOptions) {
|
|
10024
9040
|
const { api, schemasApi, json } = createRecordsApi(this, filePath);
|
|
10025
9041
|
const resolvedSchema = await resolveSchemaSelector(schemasApi, schema);
|
|
10026
9042
|
const data = await api.listRecords(
|
|
@@ -10029,7 +9045,7 @@ function registerRecordsCommands(program, options = {}) {
|
|
|
10029
9045
|
);
|
|
10030
9046
|
const recordsData = getQueryRecords(data);
|
|
10031
9047
|
if (json) {
|
|
10032
|
-
|
|
9048
|
+
emitJson8(
|
|
10033
9049
|
stdout,
|
|
10034
9050
|
"records list",
|
|
10035
9051
|
recordsData,
|
|
@@ -10038,9 +9054,9 @@ function registerRecordsCommands(program, options = {}) {
|
|
|
10038
9054
|
);
|
|
10039
9055
|
return;
|
|
10040
9056
|
}
|
|
10041
|
-
|
|
9057
|
+
emitTable3(stdout, recordsData);
|
|
10042
9058
|
});
|
|
10043
|
-
records.command("query").description("Query records for a schema").argument("<schema>", "schema uuid or slug",
|
|
9059
|
+
records.command("query").description("Query records for a schema").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector6).option("--select <fields>", "comma-separated field selection", (value) => parseCommaSeparatedValues(value, "--select")).option("--where <expression>", "where expression", collectWhereExpressions, []).option("--sort <field:direction>", "sort field(s)", collectSortValues, []).option("--limit <number>", "limit results", parseNonNegativeInteger2).option("--offset <number>", "offset results", parseNonNegativeInteger2).option("--raw <json>", "raw JSON object payload").option("--raw-file <path>", "path to a raw JSON object payload").action(async function action(schema, commandOptions) {
|
|
10044
9060
|
const { api, schemasApi, json } = createRecordsApi(this, filePath);
|
|
10045
9061
|
const resolvedSchema = await resolveSchemaSelector(schemasApi, schema);
|
|
10046
9062
|
const data = await api.queryRecords(
|
|
@@ -10049,7 +9065,7 @@ function registerRecordsCommands(program, options = {}) {
|
|
|
10049
9065
|
);
|
|
10050
9066
|
const recordsData = getQueryRecords(data);
|
|
10051
9067
|
if (json) {
|
|
10052
|
-
|
|
9068
|
+
emitJson8(
|
|
10053
9069
|
stdout,
|
|
10054
9070
|
"records query",
|
|
10055
9071
|
recordsData,
|
|
@@ -10058,19 +9074,19 @@ function registerRecordsCommands(program, options = {}) {
|
|
|
10058
9074
|
);
|
|
10059
9075
|
return;
|
|
10060
9076
|
}
|
|
10061
|
-
|
|
9077
|
+
emitTable3(stdout, recordsData);
|
|
10062
9078
|
});
|
|
10063
|
-
records.command("get").description("Get a record by UUID or slug").argument("<schema>", "schema uuid or slug",
|
|
9079
|
+
records.command("get").description("Get a record by UUID or slug").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector6).argument("<record>", "record uuid or slug", parseUuidOrSlugSelector6).action(async function action(schema, record) {
|
|
10064
9080
|
const { api, schemasApi, json } = createRecordsApi(this, filePath);
|
|
10065
9081
|
const resolvedSchema = await resolveSchemaSelector(schemasApi, schema);
|
|
10066
9082
|
const data = await api.getRecord(resolvedSchema, record);
|
|
10067
9083
|
if (json) {
|
|
10068
|
-
|
|
9084
|
+
emitJson8(stdout, "records get", data, filePath);
|
|
10069
9085
|
return;
|
|
10070
9086
|
}
|
|
10071
|
-
|
|
9087
|
+
emitTable3(stdout, data);
|
|
10072
9088
|
});
|
|
10073
|
-
records.command("create").description("Create a record").argument("<schema>", "schema uuid or slug",
|
|
9089
|
+
records.command("create").description("Create a record").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector6).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").action(async function action(schema, commandOptions) {
|
|
10074
9090
|
const { api, schemasApi, json, readOnly } = createRecordsApi(this, filePath);
|
|
10075
9091
|
ensureWritable6("records create", readOnly, "write");
|
|
10076
9092
|
const resolvedSchema = await resolveSchemaSelector(schemasApi, schema);
|
|
@@ -10079,12 +9095,12 @@ function registerRecordsCommands(program, options = {}) {
|
|
|
10079
9095
|
buildRecordCreateInput(commandOptions)
|
|
10080
9096
|
);
|
|
10081
9097
|
if (json) {
|
|
10082
|
-
|
|
9098
|
+
emitJson8(stdout, "records create", data, filePath);
|
|
10083
9099
|
return;
|
|
10084
9100
|
}
|
|
10085
|
-
|
|
9101
|
+
writeLine8(stdout, `Created record "${getRecordIdentifier(data)}".`);
|
|
10086
9102
|
});
|
|
10087
|
-
records.command("update").description("Update a record").argument("<schema>", "schema uuid or slug",
|
|
9103
|
+
records.command("update").description("Update a record").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector6).argument("<record>", "record uuid or slug", parseUuidOrSlugSelector6).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 payload").option("--raw-file <path>", "path to a raw JSON object payload").action(async function action(schema, record, commandOptions) {
|
|
10088
9104
|
const { api, schemasApi, json, readOnly } = createRecordsApi(this, filePath);
|
|
10089
9105
|
ensureWritable6("records update", readOnly, "write");
|
|
10090
9106
|
const resolvedSchema = await resolveSchemaSelector(schemasApi, schema);
|
|
@@ -10094,12 +9110,12 @@ function registerRecordsCommands(program, options = {}) {
|
|
|
10094
9110
|
buildRecordUpdateInput(commandOptions)
|
|
10095
9111
|
);
|
|
10096
9112
|
if (json) {
|
|
10097
|
-
|
|
9113
|
+
emitJson8(stdout, "records update", data, filePath);
|
|
10098
9114
|
return;
|
|
10099
9115
|
}
|
|
10100
|
-
|
|
9116
|
+
writeLine8(stdout, `Updated record "${getRecordIdentifier(data)}".`);
|
|
10101
9117
|
});
|
|
10102
|
-
records.command("delete").description("Delete a record").argument("<schema>", "schema uuid or slug",
|
|
9118
|
+
records.command("delete").description("Delete a record").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector6).argument("<record>", "record uuid or slug", parseUuidOrSlugSelector6).action(async function action(schema, record) {
|
|
10103
9119
|
const { api, schemasApi, json, readOnly } = createRecordsApi(this, filePath);
|
|
10104
9120
|
ensureWritable6("records delete", readOnly, "destructive");
|
|
10105
9121
|
const resolvedSchema = await resolveSchemaSelector(schemasApi, schema);
|
|
@@ -10110,33 +9126,33 @@ function registerRecordsCommands(program, options = {}) {
|
|
|
10110
9126
|
deleted: true
|
|
10111
9127
|
};
|
|
10112
9128
|
if (json) {
|
|
10113
|
-
|
|
9129
|
+
emitJson8(stdout, "records delete", data, filePath);
|
|
10114
9130
|
return;
|
|
10115
9131
|
}
|
|
10116
|
-
|
|
9132
|
+
writeLine8(stdout, `Deleted record "${record.value}" from schema "${schema.value}".`);
|
|
10117
9133
|
});
|
|
10118
9134
|
}
|
|
10119
9135
|
|
|
10120
9136
|
// src/commands/schemas.ts
|
|
10121
9137
|
import { readFileSync as readFileSync8 } from "fs";
|
|
10122
|
-
import { InvalidArgumentError as
|
|
10123
|
-
function
|
|
9138
|
+
import { InvalidArgumentError as InvalidArgumentError7 } from "commander";
|
|
9139
|
+
function getCommandIo9(stdout) {
|
|
10124
9140
|
return stdout ?? process.stdout;
|
|
10125
9141
|
}
|
|
10126
|
-
function
|
|
9142
|
+
function writeLine9(stdout, value) {
|
|
10127
9143
|
stdout.write(`${value}
|
|
10128
9144
|
`);
|
|
10129
9145
|
}
|
|
10130
|
-
function
|
|
9146
|
+
function getGlobalOptions9(command) {
|
|
10131
9147
|
return command.optsWithGlobals();
|
|
10132
9148
|
}
|
|
10133
|
-
function
|
|
10134
|
-
|
|
9149
|
+
function emitJson9(stdout, commandName, data, configPath) {
|
|
9150
|
+
writeLine9(
|
|
10135
9151
|
stdout,
|
|
10136
9152
|
JSON.stringify(buildJsonSuccess(data, { command: commandName, configPath }))
|
|
10137
9153
|
);
|
|
10138
9154
|
}
|
|
10139
|
-
function
|
|
9155
|
+
function toConfigurationError8(filePath, error) {
|
|
10140
9156
|
if (error instanceof CliError) {
|
|
10141
9157
|
throw error;
|
|
10142
9158
|
}
|
|
@@ -10151,7 +9167,7 @@ function toConfigurationError9(filePath, error) {
|
|
|
10151
9167
|
function createSchemasApi(command, filePath) {
|
|
10152
9168
|
try {
|
|
10153
9169
|
const config = readRuntimeConfig(filePath);
|
|
10154
|
-
const runtime = resolveRuntimeContext(config,
|
|
9170
|
+
const runtime = resolveRuntimeContext(config, getGlobalOptions9(command));
|
|
10155
9171
|
if (!runtime.baseUrl) {
|
|
10156
9172
|
throw new CliError(
|
|
10157
9173
|
"configuration_error",
|
|
@@ -10170,7 +9186,7 @@ function createSchemasApi(command, filePath) {
|
|
|
10170
9186
|
readOnly: runtime.readOnly
|
|
10171
9187
|
};
|
|
10172
9188
|
} catch (error) {
|
|
10173
|
-
|
|
9189
|
+
toConfigurationError8(filePath, error);
|
|
10174
9190
|
}
|
|
10175
9191
|
}
|
|
10176
9192
|
function ensureWritable7(commandName, readOnly, commandMode) {
|
|
@@ -10185,12 +9201,12 @@ function ensureWritable7(commandName, readOnly, commandMode) {
|
|
|
10185
9201
|
);
|
|
10186
9202
|
}
|
|
10187
9203
|
}
|
|
10188
|
-
function
|
|
9204
|
+
function parseUuidOrSlugSelector7(input) {
|
|
10189
9205
|
try {
|
|
10190
9206
|
return normalizeUuidOrSlug(input);
|
|
10191
9207
|
} catch (error) {
|
|
10192
9208
|
const message = error instanceof Error ? error.message : "Invalid selector.";
|
|
10193
|
-
throw new
|
|
9209
|
+
throw new InvalidArgumentError7(message);
|
|
10194
9210
|
}
|
|
10195
9211
|
}
|
|
10196
9212
|
function parseBooleanFlag(input) {
|
|
@@ -10201,9 +9217,9 @@ function parseBooleanFlag(input) {
|
|
|
10201
9217
|
if (["false", "0", "no", "n", "off"].includes(normalized)) {
|
|
10202
9218
|
return false;
|
|
10203
9219
|
}
|
|
10204
|
-
throw new
|
|
9220
|
+
throw new InvalidArgumentError7(`Expected a boolean value, received "${input}".`);
|
|
10205
9221
|
}
|
|
10206
|
-
function
|
|
9222
|
+
function isJsonObject5(value) {
|
|
10207
9223
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10208
9224
|
}
|
|
10209
9225
|
function parseRawJsonObject3(input, sourceLabel) {
|
|
@@ -10217,7 +9233,7 @@ function parseRawJsonObject3(input, sourceLabel) {
|
|
|
10217
9233
|
`Failed to parse JSON from ${sourceLabel}: ${message}`
|
|
10218
9234
|
);
|
|
10219
9235
|
}
|
|
10220
|
-
if (!
|
|
9236
|
+
if (!isJsonObject5(parsed)) {
|
|
10221
9237
|
throw new CliError(
|
|
10222
9238
|
"invalid_cli_usage",
|
|
10223
9239
|
`Expected ${sourceLabel} to contain a JSON object.`
|
|
@@ -10292,6 +9308,22 @@ function buildSchemaUpdateInput(options) {
|
|
|
10292
9308
|
}
|
|
10293
9309
|
return input;
|
|
10294
9310
|
}
|
|
9311
|
+
function applyFieldDefaultValue(input, defaultValue) {
|
|
9312
|
+
if (defaultValue === void 0) {
|
|
9313
|
+
return;
|
|
9314
|
+
}
|
|
9315
|
+
const config = input.config;
|
|
9316
|
+
if (config !== void 0 && !isJsonObject5(config)) {
|
|
9317
|
+
throw new CliError(
|
|
9318
|
+
"invalid_cli_usage",
|
|
9319
|
+
'Expected field "config" to be a JSON object when using "--default".'
|
|
9320
|
+
);
|
|
9321
|
+
}
|
|
9322
|
+
input.config = {
|
|
9323
|
+
...config ?? {},
|
|
9324
|
+
defaultValue
|
|
9325
|
+
};
|
|
9326
|
+
}
|
|
10295
9327
|
function buildFieldCreateInput(options) {
|
|
10296
9328
|
const raw = normalizeSchemaFieldCreatePayload(readRawObject4(options.raw, options.rawFile));
|
|
10297
9329
|
const rawType = typeof raw.type === "string" ? raw.type : void 0;
|
|
@@ -10320,7 +9352,8 @@ function buildFieldCreateInput(options) {
|
|
|
10320
9352
|
if (options.required !== void 0) {
|
|
10321
9353
|
input.required = options.required;
|
|
10322
9354
|
}
|
|
10323
|
-
|
|
9355
|
+
applyFieldDefaultValue(input, options.default);
|
|
9356
|
+
if ("config" in input && isJsonObject5(input.config) && isEmptyObject5(input.config)) {
|
|
10324
9357
|
delete input.config;
|
|
10325
9358
|
}
|
|
10326
9359
|
return input;
|
|
@@ -10362,6 +9395,7 @@ function buildFieldUpdateInput(currentType, options) {
|
|
|
10362
9395
|
if (options.required !== void 0) {
|
|
10363
9396
|
input.required = options.required;
|
|
10364
9397
|
}
|
|
9398
|
+
applyFieldDefaultValue(input, options.default);
|
|
10365
9399
|
return input;
|
|
10366
9400
|
}
|
|
10367
9401
|
async function resolveSchemaSelector2(api, selector2) {
|
|
@@ -10397,23 +9431,23 @@ function isEmptyObject5(value) {
|
|
|
10397
9431
|
}
|
|
10398
9432
|
function registerSchemasCommands(program, options = {}) {
|
|
10399
9433
|
const filePath = options.configPath ?? defaultConfigPath;
|
|
10400
|
-
const stdout =
|
|
9434
|
+
const stdout = getCommandIo9(options.stdout);
|
|
10401
9435
|
const schemas = program.command("schemas").description("Manage schemas and schema fields");
|
|
10402
9436
|
schemas.command("list").description("List schemas").action(async function action() {
|
|
10403
9437
|
const { api, json } = createSchemasApi(this, filePath);
|
|
10404
9438
|
const data = await api.listSchemas();
|
|
10405
9439
|
if (json) {
|
|
10406
|
-
|
|
9440
|
+
emitJson9(stdout, "schemas list", data, filePath);
|
|
10407
9441
|
return;
|
|
10408
9442
|
}
|
|
10409
9443
|
emitSchemasTable(stdout, data);
|
|
10410
9444
|
});
|
|
10411
|
-
schemas.command("get").description("Get a schema by UUID or slug").argument("<schema>", "schema uuid or slug",
|
|
9445
|
+
schemas.command("get").description("Get a schema by UUID or slug").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector7).action(async function action(schema) {
|
|
10412
9446
|
const { api, json } = createSchemasApi(this, filePath);
|
|
10413
9447
|
const resolvedSchema = await resolveSchemaSelector2(api, schema);
|
|
10414
9448
|
const data = await api.getSchema(resolvedSchema);
|
|
10415
9449
|
if (json) {
|
|
10416
|
-
|
|
9450
|
+
emitJson9(stdout, "schemas get", data, filePath);
|
|
10417
9451
|
return;
|
|
10418
9452
|
}
|
|
10419
9453
|
emitSchemasTable(stdout, [data]);
|
|
@@ -10429,12 +9463,12 @@ function registerSchemasCommands(program, options = {}) {
|
|
|
10429
9463
|
};
|
|
10430
9464
|
const data = await api.createSchema(input);
|
|
10431
9465
|
if (json) {
|
|
10432
|
-
|
|
9466
|
+
emitJson9(stdout, "schemas create", data, filePath);
|
|
10433
9467
|
return;
|
|
10434
9468
|
}
|
|
10435
|
-
|
|
9469
|
+
writeLine9(stdout, `Created schema "${data.slug ?? commandOptions.slug}".`);
|
|
10436
9470
|
});
|
|
10437
|
-
schemas.command("update").description("Update a schema").argument("<schema>", "schema uuid or slug",
|
|
9471
|
+
schemas.command("update").description("Update a schema").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector7).option("--name <name>", "schema name").option("--slug <slug>", "schema slug").option("--auditable <bool>", "auditable flag", parseBooleanFlag).option("--commentable <bool>", "commentable flag", parseBooleanFlag).action(async function action(schema, commandOptions) {
|
|
10438
9472
|
const { api, json, readOnly } = createSchemasApi(this, filePath);
|
|
10439
9473
|
ensureWritable7("schemas update", readOnly, "write");
|
|
10440
9474
|
const resolvedSchema = await resolveSchemaSelector2(api, schema);
|
|
@@ -10447,12 +9481,12 @@ function registerSchemasCommands(program, options = {}) {
|
|
|
10447
9481
|
}
|
|
10448
9482
|
const data = await api.updateSchema(resolvedSchema, input);
|
|
10449
9483
|
if (json) {
|
|
10450
|
-
|
|
9484
|
+
emitJson9(stdout, "schemas update", data, filePath);
|
|
10451
9485
|
return;
|
|
10452
9486
|
}
|
|
10453
|
-
|
|
9487
|
+
writeLine9(stdout, `Updated schema "${data.slug ?? schema.value}".`);
|
|
10454
9488
|
});
|
|
10455
|
-
schemas.command("delete").description("Delete a schema").argument("<schema>", "schema uuid or slug",
|
|
9489
|
+
schemas.command("delete").description("Delete a schema").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector7).action(async function action(schema) {
|
|
10456
9490
|
const { api, json, readOnly } = createSchemasApi(this, filePath);
|
|
10457
9491
|
ensureWritable7("schemas delete", readOnly, "destructive");
|
|
10458
9492
|
const resolvedSchema = await resolveSchemaSelector2(api, schema);
|
|
@@ -10462,34 +9496,34 @@ function registerSchemasCommands(program, options = {}) {
|
|
|
10462
9496
|
deleted: true
|
|
10463
9497
|
};
|
|
10464
9498
|
if (json) {
|
|
10465
|
-
|
|
9499
|
+
emitJson9(stdout, "schemas delete", data, filePath);
|
|
10466
9500
|
return;
|
|
10467
9501
|
}
|
|
10468
|
-
|
|
9502
|
+
writeLine9(stdout, `Deleted schema "${schema.value}".`);
|
|
10469
9503
|
});
|
|
10470
9504
|
const fields = schemas.command("fields").description("Manage schema fields");
|
|
10471
|
-
fields.command("list").description("List fields for a schema").argument("<schema>", "schema uuid or slug",
|
|
9505
|
+
fields.command("list").description("List fields for a schema").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector7).action(async function action(schema) {
|
|
10472
9506
|
const { api, json } = createSchemasApi(this, filePath);
|
|
10473
9507
|
const resolvedSchema = await resolveSchemaSelector2(api, schema);
|
|
10474
9508
|
const data = await api.listFields(resolvedSchema);
|
|
10475
9509
|
if (json) {
|
|
10476
|
-
|
|
9510
|
+
emitJson9(stdout, "schemas fields list", data, filePath);
|
|
10477
9511
|
return;
|
|
10478
9512
|
}
|
|
10479
9513
|
emitFieldsTable(stdout, data);
|
|
10480
9514
|
});
|
|
10481
|
-
fields.command("get").description("Get a field by UUID or slug").argument("<schema>", "schema uuid or slug",
|
|
9515
|
+
fields.command("get").description("Get a field by UUID or slug").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector7).argument("<field>", "field uuid or slug", parseUuidOrSlugSelector7).action(async function action(schema, field) {
|
|
10482
9516
|
const { api, json } = createSchemasApi(this, filePath);
|
|
10483
9517
|
const resolvedSchema = await resolveSchemaSelector2(api, schema);
|
|
10484
9518
|
const resolvedField = await resolveFieldSelector(api, resolvedSchema, field);
|
|
10485
9519
|
const data = await api.getField(resolvedSchema, resolvedField);
|
|
10486
9520
|
if (json) {
|
|
10487
|
-
|
|
9521
|
+
emitJson9(stdout, "schemas fields get", data, filePath);
|
|
10488
9522
|
return;
|
|
10489
9523
|
}
|
|
10490
9524
|
emitFieldsTable(stdout, [data]);
|
|
10491
9525
|
});
|
|
10492
|
-
fields.command("create").description(`Create a field in a schema.${buildSchemaFieldCreateHelpText()}`).argument("<schema>", "schema uuid or slug",
|
|
9526
|
+
fields.command("create").description(`Create a field in a schema.${buildSchemaFieldCreateHelpText()}`).argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector7).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) {
|
|
10493
9527
|
const { api, json, readOnly } = createSchemasApi(this, filePath);
|
|
10494
9528
|
ensureWritable7("schemas fields create", readOnly, "write");
|
|
10495
9529
|
const input = buildFieldCreateInput(commandOptions);
|
|
@@ -10501,12 +9535,12 @@ function registerSchemasCommands(program, options = {}) {
|
|
|
10501
9535
|
toFieldCreateError(error, input);
|
|
10502
9536
|
}
|
|
10503
9537
|
if (json) {
|
|
10504
|
-
|
|
9538
|
+
emitJson9(stdout, "schemas fields create", data, filePath);
|
|
10505
9539
|
return;
|
|
10506
9540
|
}
|
|
10507
|
-
|
|
9541
|
+
writeLine9(stdout, `Created field "${data.slug ?? commandOptions.slug}".`);
|
|
10508
9542
|
});
|
|
10509
|
-
fields.command("update").description("Update a field in a schema").argument("<schema>", "schema uuid or slug",
|
|
9543
|
+
fields.command("update").description("Update a field in a schema").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector7).argument("<field>", "field uuid or slug", parseUuidOrSlugSelector7).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) {
|
|
10510
9544
|
const { api, json, readOnly } = createSchemasApi(this, filePath);
|
|
10511
9545
|
ensureWritable7("schemas fields update", readOnly, "write");
|
|
10512
9546
|
const resolvedSchema = await resolveSchemaSelector2(api, schema);
|
|
@@ -10525,12 +9559,12 @@ function registerSchemasCommands(program, options = {}) {
|
|
|
10525
9559
|
}
|
|
10526
9560
|
const data = await api.updateField(resolvedSchema, resolvedField, input);
|
|
10527
9561
|
if (json) {
|
|
10528
|
-
|
|
9562
|
+
emitJson9(stdout, "schemas fields update", data, filePath);
|
|
10529
9563
|
return;
|
|
10530
9564
|
}
|
|
10531
|
-
|
|
9565
|
+
writeLine9(stdout, `Updated field "${data.slug ?? field.value}".`);
|
|
10532
9566
|
});
|
|
10533
|
-
fields.command("delete").description("Delete a field from a schema").argument("<schema>", "schema uuid or slug",
|
|
9567
|
+
fields.command("delete").description("Delete a field from a schema").argument("<schema>", "schema uuid or slug", parseUuidOrSlugSelector7).argument("<field>", "field uuid or slug", parseUuidOrSlugSelector7).action(async function action(schema, field) {
|
|
10534
9568
|
const { api, json, readOnly } = createSchemasApi(this, filePath);
|
|
10535
9569
|
ensureWritable7("schemas fields delete", readOnly, "destructive");
|
|
10536
9570
|
const resolvedSchema = await resolveSchemaSelector2(api, schema);
|
|
@@ -10542,16 +9576,16 @@ function registerSchemasCommands(program, options = {}) {
|
|
|
10542
9576
|
deleted: true
|
|
10543
9577
|
};
|
|
10544
9578
|
if (json) {
|
|
10545
|
-
|
|
9579
|
+
emitJson9(stdout, "schemas fields delete", data, filePath);
|
|
10546
9580
|
return;
|
|
10547
9581
|
}
|
|
10548
|
-
|
|
9582
|
+
writeLine9(stdout, `Deleted field "${field.value}" from schema "${schema.value}".`);
|
|
10549
9583
|
});
|
|
10550
9584
|
}
|
|
10551
9585
|
|
|
10552
9586
|
// src/commands/teamspace.ts
|
|
10553
9587
|
import { readFileSync as readFileSync9 } from "fs";
|
|
10554
|
-
import { InvalidArgumentError as
|
|
9588
|
+
import { InvalidArgumentError as InvalidArgumentError8 } from "commander";
|
|
10555
9589
|
|
|
10556
9590
|
// src/api/teamspace.ts
|
|
10557
9591
|
function jsonOptions7(body, method) {
|
|
@@ -10563,7 +9597,7 @@ function jsonOptions7(body, method) {
|
|
|
10563
9597
|
body: JSON.stringify(body)
|
|
10564
9598
|
};
|
|
10565
9599
|
}
|
|
10566
|
-
function
|
|
9600
|
+
function selectorValue8(selector2) {
|
|
10567
9601
|
return selector2.value;
|
|
10568
9602
|
}
|
|
10569
9603
|
var TeamspaceApi = class {
|
|
@@ -10589,13 +9623,13 @@ var TeamspaceApi = class {
|
|
|
10589
9623
|
}
|
|
10590
9624
|
updateFolder(folder, input) {
|
|
10591
9625
|
return this.client.requestJson(
|
|
10592
|
-
`/api/v2/teamspaces/folders/${
|
|
9626
|
+
`/api/v2/teamspaces/folders/${selectorValue8(folder)}`,
|
|
10593
9627
|
jsonOptions7(input, "PATCH")
|
|
10594
9628
|
);
|
|
10595
9629
|
}
|
|
10596
9630
|
deleteFolder(folder) {
|
|
10597
9631
|
return this.client.requestJson(
|
|
10598
|
-
`/api/v2/teamspaces/folders/${
|
|
9632
|
+
`/api/v2/teamspaces/folders/${selectorValue8(folder)}`,
|
|
10599
9633
|
{ method: "DELETE" }
|
|
10600
9634
|
);
|
|
10601
9635
|
}
|
|
@@ -10614,23 +9648,23 @@ var TeamspaceApi = class {
|
|
|
10614
9648
|
};
|
|
10615
9649
|
|
|
10616
9650
|
// src/commands/teamspace.ts
|
|
10617
|
-
function
|
|
9651
|
+
function getCommandIo10(stdout) {
|
|
10618
9652
|
return stdout ?? process.stdout;
|
|
10619
9653
|
}
|
|
10620
|
-
function
|
|
9654
|
+
function writeLine10(stdout, value) {
|
|
10621
9655
|
stdout.write(`${value}
|
|
10622
9656
|
`);
|
|
10623
9657
|
}
|
|
10624
|
-
function
|
|
9658
|
+
function getGlobalOptions10(command) {
|
|
10625
9659
|
return command.optsWithGlobals();
|
|
10626
9660
|
}
|
|
10627
|
-
function
|
|
10628
|
-
|
|
9661
|
+
function emitJson10(stdout, commandName, data, configPath) {
|
|
9662
|
+
writeLine10(
|
|
10629
9663
|
stdout,
|
|
10630
9664
|
JSON.stringify(buildJsonSuccess(data, { command: commandName, configPath }))
|
|
10631
9665
|
);
|
|
10632
9666
|
}
|
|
10633
|
-
function
|
|
9667
|
+
function toConfigurationError9(filePath, error) {
|
|
10634
9668
|
if (error instanceof CliError) {
|
|
10635
9669
|
throw error;
|
|
10636
9670
|
}
|
|
@@ -10645,7 +9679,7 @@ function toConfigurationError10(filePath, error) {
|
|
|
10645
9679
|
function createTeamspaceApi(command, filePath) {
|
|
10646
9680
|
try {
|
|
10647
9681
|
const config = readRuntimeConfig(filePath);
|
|
10648
|
-
const runtime = resolveRuntimeContext(config,
|
|
9682
|
+
const runtime = resolveRuntimeContext(config, getGlobalOptions10(command));
|
|
10649
9683
|
if (!runtime.baseUrl) {
|
|
10650
9684
|
throw new CliError(
|
|
10651
9685
|
"configuration_error",
|
|
@@ -10663,7 +9697,7 @@ function createTeamspaceApi(command, filePath) {
|
|
|
10663
9697
|
readOnly: runtime.readOnly
|
|
10664
9698
|
};
|
|
10665
9699
|
} catch (error) {
|
|
10666
|
-
|
|
9700
|
+
toConfigurationError9(filePath, error);
|
|
10667
9701
|
}
|
|
10668
9702
|
}
|
|
10669
9703
|
function ensureWritable8(commandName, readOnly, commandMode) {
|
|
@@ -10678,21 +9712,21 @@ function ensureWritable8(commandName, readOnly, commandMode) {
|
|
|
10678
9712
|
);
|
|
10679
9713
|
}
|
|
10680
9714
|
}
|
|
10681
|
-
function
|
|
9715
|
+
function parseUuidOrSlugSelector8(input) {
|
|
10682
9716
|
try {
|
|
10683
9717
|
return normalizeUuidOrSlug(input);
|
|
10684
9718
|
} catch (error) {
|
|
10685
9719
|
const message = error instanceof Error ? error.message : "Invalid selector.";
|
|
10686
|
-
throw new
|
|
9720
|
+
throw new InvalidArgumentError8(message);
|
|
10687
9721
|
}
|
|
10688
9722
|
}
|
|
10689
9723
|
function parseNonNegativeInteger3(input) {
|
|
10690
9724
|
if (!/^\d+$/.test(input.trim())) {
|
|
10691
|
-
throw new
|
|
9725
|
+
throw new InvalidArgumentError8(`Expected a non-negative integer, received "${input}".`);
|
|
10692
9726
|
}
|
|
10693
9727
|
return Number(input);
|
|
10694
9728
|
}
|
|
10695
|
-
function
|
|
9729
|
+
function isJsonObject6(value) {
|
|
10696
9730
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10697
9731
|
}
|
|
10698
9732
|
function parseRawJsonObject4(input, sourceLabel) {
|
|
@@ -10706,7 +9740,7 @@ function parseRawJsonObject4(input, sourceLabel) {
|
|
|
10706
9740
|
`Failed to parse JSON from ${sourceLabel}: ${message}`
|
|
10707
9741
|
);
|
|
10708
9742
|
}
|
|
10709
|
-
if (!
|
|
9743
|
+
if (!isJsonObject6(parsed)) {
|
|
10710
9744
|
throw new CliError(
|
|
10711
9745
|
"invalid_cli_usage",
|
|
10712
9746
|
`Expected ${sourceLabel} to contain a JSON object.`
|
|
@@ -10778,17 +9812,17 @@ function buildFolderUpdateInput(options) {
|
|
|
10778
9812
|
}
|
|
10779
9813
|
return input;
|
|
10780
9814
|
}
|
|
10781
|
-
function
|
|
9815
|
+
function toTableRows4(data) {
|
|
10782
9816
|
if (Array.isArray(data)) {
|
|
10783
|
-
return data.map((entry) =>
|
|
9817
|
+
return data.map((entry) => isJsonObject6(entry) ? entry : { value: entry });
|
|
10784
9818
|
}
|
|
10785
|
-
if (
|
|
9819
|
+
if (isJsonObject6(data)) {
|
|
10786
9820
|
return [data];
|
|
10787
9821
|
}
|
|
10788
9822
|
return [{ value: data }];
|
|
10789
9823
|
}
|
|
10790
|
-
function
|
|
10791
|
-
printTable(
|
|
9824
|
+
function emitTable4(stdout, data) {
|
|
9825
|
+
printTable(toTableRows4(data), void 0, stdout);
|
|
10792
9826
|
}
|
|
10793
9827
|
function getFolderIdentifier(folder) {
|
|
10794
9828
|
return typeof folder.id === "string" ? folder.id : typeof folder.name === "string" ? folder.name : "unknown";
|
|
@@ -10844,63 +9878,63 @@ async function resolveFolderSelector2(api, selector2) {
|
|
|
10844
9878
|
}
|
|
10845
9879
|
function registerTeamspaceCommands(program, options = {}) {
|
|
10846
9880
|
const filePath = options.configPath ?? defaultConfigPath;
|
|
10847
|
-
const stdout =
|
|
9881
|
+
const stdout = getCommandIo10(options.stdout);
|
|
10848
9882
|
const teamspace = program.command("teamspace").description("Manage teamspace folders and resources");
|
|
10849
9883
|
const folders = teamspace.command("folders").description("Manage teamspace folders");
|
|
10850
9884
|
folders.command("list").description("List teamspace folders").option("--include-resources", "include nested resources").action(async function action(commandOptions) {
|
|
10851
9885
|
const { api, json } = createTeamspaceApi(this, filePath);
|
|
10852
9886
|
const data = await api.listFolders(Boolean(commandOptions.includeResources));
|
|
10853
9887
|
if (json) {
|
|
10854
|
-
|
|
9888
|
+
emitJson10(stdout, "teamspace folders list", data, filePath);
|
|
10855
9889
|
return;
|
|
10856
9890
|
}
|
|
10857
|
-
|
|
9891
|
+
emitTable4(stdout, data);
|
|
10858
9892
|
});
|
|
10859
|
-
folders.command("get").description("Get a teamspace folder by exact name or UUID").argument("<folder>", "folder UUID or exact name",
|
|
9893
|
+
folders.command("get").description("Get a teamspace folder by exact name or UUID").argument("<folder>", "folder UUID or exact name", parseUuidOrSlugSelector8).option("--include-resources", "include nested resources").action(async function action(folder, commandOptions) {
|
|
10860
9894
|
const { api, json } = createTeamspaceApi(this, filePath);
|
|
10861
9895
|
const resolvedFolder = await resolveFolderSelector2(api, folder);
|
|
10862
9896
|
const allFolders = await api.listFolders(Boolean(commandOptions.includeResources));
|
|
10863
9897
|
const data = findFolderEntity(allFolders, resolvedFolder);
|
|
10864
9898
|
if (json) {
|
|
10865
|
-
|
|
9899
|
+
emitJson10(stdout, "teamspace folders get", data, filePath);
|
|
10866
9900
|
return;
|
|
10867
9901
|
}
|
|
10868
|
-
|
|
9902
|
+
emitTable4(stdout, data);
|
|
10869
9903
|
});
|
|
10870
9904
|
folders.command("create").description("Create a teamspace folder").requiredOption("--name <name>", "folder name").option("--order <n>", "folder order", parseNonNegativeInteger3).option("--props <json>", "folder properties payload").option("--props-file <path>", "path to a folder properties JSON payload").action(async function action(commandOptions) {
|
|
10871
9905
|
const { api, json, readOnly } = createTeamspaceApi(this, filePath);
|
|
10872
9906
|
ensureWritable8("teamspace folders create", readOnly, "write");
|
|
10873
9907
|
const data = await api.createFolder(buildFolderCreateInput(commandOptions));
|
|
10874
9908
|
if (json) {
|
|
10875
|
-
|
|
9909
|
+
emitJson10(stdout, "teamspace folders create", data, filePath);
|
|
10876
9910
|
return;
|
|
10877
9911
|
}
|
|
10878
|
-
|
|
9912
|
+
writeLine10(stdout, `Created folder "${getFolderIdentifier(data)}".`);
|
|
10879
9913
|
});
|
|
10880
|
-
folders.command("update").description("Update a teamspace folder").argument("<folder>", "folder UUID or exact name",
|
|
9914
|
+
folders.command("update").description("Update a teamspace folder").argument("<folder>", "folder UUID or exact name", parseUuidOrSlugSelector8).option("--name <name>", "folder name").option("--order <n>", "folder order", parseNonNegativeInteger3).option("--props <json>", "folder properties payload").option("--props-file <path>", "path to a folder properties JSON payload").action(async function action(folder, commandOptions) {
|
|
10881
9915
|
const { api, json, readOnly } = createTeamspaceApi(this, filePath);
|
|
10882
9916
|
ensureWritable8("teamspace folders update", readOnly, "write");
|
|
10883
9917
|
const resolvedFolder = await resolveFolderSelector2(api, folder);
|
|
10884
9918
|
const data = await api.updateFolder(resolvedFolder, buildFolderUpdateInput(commandOptions));
|
|
10885
9919
|
if (json) {
|
|
10886
|
-
|
|
9920
|
+
emitJson10(stdout, "teamspace folders update", data, filePath);
|
|
10887
9921
|
return;
|
|
10888
9922
|
}
|
|
10889
|
-
|
|
9923
|
+
writeLine10(stdout, `Updated folder "${getFolderIdentifier(data)}".`);
|
|
10890
9924
|
});
|
|
10891
|
-
folders.command("delete").description("Delete a teamspace folder").argument("<folder>", "folder UUID or exact name",
|
|
9925
|
+
folders.command("delete").description("Delete a teamspace folder").argument("<folder>", "folder UUID or exact name", parseUuidOrSlugSelector8).action(async function action(folder) {
|
|
10892
9926
|
const { api, json, readOnly } = createTeamspaceApi(this, filePath);
|
|
10893
9927
|
ensureWritable8("teamspace folders delete", readOnly, "destructive");
|
|
10894
9928
|
const resolvedFolder = await resolveFolderSelector2(api, folder);
|
|
10895
9929
|
const data = await api.deleteFolder(resolvedFolder);
|
|
10896
9930
|
if (json) {
|
|
10897
|
-
|
|
9931
|
+
emitJson10(stdout, "teamspace folders delete", data, filePath);
|
|
10898
9932
|
return;
|
|
10899
9933
|
}
|
|
10900
|
-
|
|
9934
|
+
writeLine10(stdout, `Deleted folder "${resolvedFolder.value}".`);
|
|
10901
9935
|
});
|
|
10902
9936
|
const resources = teamspace.command("resources").description("Manage teamspace resources");
|
|
10903
|
-
resources.command("publish").description("Publish a resource to a teamspace folder").argument("<resource>", "resource UUID or exact name",
|
|
9937
|
+
resources.command("publish").description("Publish a resource to a teamspace folder").argument("<resource>", "resource UUID or exact name", parseUuidOrSlugSelector8).requiredOption("--to <folder>", "target folder", parseUuidOrSlugSelector8).action(async function action(resource, commandOptions) {
|
|
10904
9938
|
const { api, json, readOnly } = createTeamspaceApi(this, filePath);
|
|
10905
9939
|
ensureWritable8("teamspace resources publish", readOnly, "write");
|
|
10906
9940
|
const folder = await resolveFolderSelector2(api, commandOptions.to);
|
|
@@ -10909,20 +9943,20 @@ function registerTeamspaceCommands(program, options = {}) {
|
|
|
10909
9943
|
targetFolderId: folder.value
|
|
10910
9944
|
});
|
|
10911
9945
|
if (json) {
|
|
10912
|
-
|
|
9946
|
+
emitJson10(stdout, "teamspace resources publish", data, filePath);
|
|
10913
9947
|
return;
|
|
10914
9948
|
}
|
|
10915
|
-
|
|
9949
|
+
writeLine10(stdout, `Published resource "${resource.value}" to folder "${folder.value}".`);
|
|
10916
9950
|
});
|
|
10917
|
-
resources.command("unpublish").description("Unpublish a resource from teamspace").argument("<resource>", "resource UUID or exact name",
|
|
9951
|
+
resources.command("unpublish").description("Unpublish a resource from teamspace").argument("<resource>", "resource UUID or exact name", parseUuidOrSlugSelector8).action(async function action(resource) {
|
|
10918
9952
|
const { api, json, readOnly } = createTeamspaceApi(this, filePath);
|
|
10919
9953
|
ensureWritable8("teamspace resources unpublish", readOnly, "write");
|
|
10920
9954
|
const data = await api.unpublishResource(resource.value);
|
|
10921
9955
|
if (json) {
|
|
10922
|
-
|
|
9956
|
+
emitJson10(stdout, "teamspace resources unpublish", data, filePath);
|
|
10923
9957
|
return;
|
|
10924
9958
|
}
|
|
10925
|
-
|
|
9959
|
+
writeLine10(stdout, `Unpublished resource "${resource.value}".`);
|
|
10926
9960
|
});
|
|
10927
9961
|
}
|
|
10928
9962
|
|
|
@@ -10930,7 +9964,7 @@ function registerTeamspaceCommands(program, options = {}) {
|
|
|
10930
9964
|
var require2 = createRequire(import.meta.url);
|
|
10931
9965
|
var { version } = require2("../package.json");
|
|
10932
9966
|
function buildProgram(options = {}) {
|
|
10933
|
-
const program = new
|
|
9967
|
+
const program = new Command9();
|
|
10934
9968
|
program.name("zinkee").description("CLI for Zinkee API v2").version(version).enablePositionalOptions().showHelpAfterError().option("--profile <name>", "select a profile from config").option("--base-url <url>", "override the configured base URL").option("--api-key <token>", "override the configured API key").option("--read-only", "run in read-only mode").option("--example", "show examples for a command").option("--json", "emit JSON output");
|
|
10935
9969
|
registerProfilesCommands(program, options);
|
|
10936
9970
|
registerAutomationsCommands(program, options);
|
|
@@ -10941,7 +9975,6 @@ function buildProgram(options = {}) {
|
|
|
10941
9975
|
registerSchemasCommands(program, options);
|
|
10942
9976
|
registerRecordsCommands(program, options);
|
|
10943
9977
|
registerCommentsCommands(program, options);
|
|
10944
|
-
registerLogsCommands(program, options);
|
|
10945
9978
|
registerTeamspaceCommands(program, options);
|
|
10946
9979
|
return program;
|
|
10947
9980
|
}
|