zinkee 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1615,132 +1615,484 @@ var fieldTypeDefinitions = [
1615
1615
  className: "TextField",
1616
1616
  aliases: ["text", "TextField"],
1617
1617
  description: "Plain text field.",
1618
- rawShape: '{"type":"text","slug":"name","label":"Name"}',
1619
- examplePayload: {
1620
- type: "text",
1621
- slug: "name",
1622
- label: "Name"
1623
- }
1618
+ rawShape: '{"type":"TextField","slug":"name","label":"Name","config":{"textType":"NORMAL"}}',
1619
+ examplePayloads: [
1620
+ {
1621
+ name: "Text field (normal)",
1622
+ payload: {
1623
+ type: "TextField",
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
+ ]
1624
1649
  },
1625
1650
  {
1626
1651
  key: "number",
1627
1652
  className: "NumberField",
1628
1653
  aliases: ["number", "NumberField"],
1629
1654
  description: "Numeric field.",
1630
- 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"}}}',
1631
- examplePayload: {
1632
- type: "number",
1633
- slug: "price-eur",
1634
- label: "Price EUR",
1635
- config: {
1636
- defaultValue: "0",
1637
- formatOptions: {
1638
- format: "number",
1639
- decimals: 2,
1640
- thousandsSeparator: true,
1641
- symbolEnabled: true,
1642
- symbolValue: " \u20AC",
1643
- symbolPosition: "right"
1655
+ rawShape: '{"type":"NumberField","slug":"quantity","label":"Quantity","config":{"defaultValue":"0","formatOptions":{"format":"number","decimals":0,"thousandsSeparator":false}}}',
1656
+ examplePayloads: [
1657
+ {
1658
+ name: "Number field (plain integer)",
1659
+ payload: {
1660
+ type: "NumberField",
1661
+ slug: "quantity",
1662
+ label: "Quantity",
1663
+ required: false,
1664
+ config: {
1665
+ defaultValue: "0",
1666
+ formatOptions: {
1667
+ format: "number",
1668
+ decimals: 0,
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
+ }
1644
1771
  }
1645
1772
  }
1646
- }
1773
+ ]
1647
1774
  },
1648
1775
  {
1649
1776
  key: "date",
1650
1777
  className: "DateField",
1651
1778
  aliases: ["date", "DateField"],
1652
1779
  description: "Date or datetime field.",
1653
- rawShape: '{"type":"date","slug":"due-date","label":"Due date"}',
1654
- examplePayload: {
1655
- type: "date",
1656
- slug: "due-date",
1657
- label: "Due date"
1658
- }
1780
+ rawShape: '{"type":"DateField","slug":"due-date","label":"Due Date","config":{"formatOptions":{"format":"date","dateFormat":"YYYY-MM-DD","showTime":false}}}',
1781
+ examplePayloads: [
1782
+ {
1783
+ name: "Date field (date only)",
1784
+ payload: {
1785
+ type: "DateField",
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
+ ]
1659
1837
  },
1660
1838
  {
1661
1839
  key: "option",
1662
1840
  className: "OptionField",
1663
1841
  aliases: ["option", "OptionField"],
1664
1842
  description: "Dropdown/select field with options.",
1665
- rawShape: '{"type":"option","slug":"status","label":"Status","config":{"options":[{"id":1,"name":"Open","color":"default"},{"id":2,"name":"Closed","color":"success"}]}}',
1666
- examplePayload: {
1667
- type: "option",
1668
- slug: "status",
1669
- label: "Status",
1670
- config: {
1671
- options: [
1672
- {
1673
- id: 1,
1674
- name: "Open",
1675
- color: "default"
1676
- },
1677
- {
1678
- id: 2,
1679
- name: "Closed",
1680
- color: "success"
1843
+ rawShape: '{"type":"OptionField","slug":"status","label":"Status","config":{"options":[{"id":1,"name":"Open","color":"default"},{"id":2,"name":"Closed","color":"success"}]}}',
1844
+ examplePayloads: [
1845
+ {
1846
+ name: "Option field (select dropdown)",
1847
+ payload: {
1848
+ type: "OptionField",
1849
+ slug: "priority",
1850
+ label: "Priority",
1851
+ required: false,
1852
+ config: {
1853
+ options: [
1854
+ { id: 1, name: "Low", color: "default" },
1855
+ { id: 2, name: "Medium", color: "warning" },
1856
+ { id: 3, name: "High", color: "danger" }
1857
+ ],
1858
+ defaultValue: 1,
1859
+ conditionalFormatting: [],
1860
+ buttonConfig: null
1681
1861
  }
1682
- ]
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
+ }
1918
+ }
1919
+ }
1683
1920
  }
1684
- }
1921
+ ]
1685
1922
  },
1686
1923
  {
1687
1924
  key: "file",
1688
1925
  className: "FileField",
1689
1926
  aliases: ["file", "FileField"],
1690
1927
  description: "File attachment field.",
1691
- rawShape: '{"type":"file","slug":"attachment","label":"Attachment"}',
1692
- examplePayload: {
1693
- type: "file",
1694
- slug: "attachment",
1695
- label: "Attachment"
1696
- }
1928
+ rawShape: '{"type":"FileField","slug":"attachment","label":"Attachment","config":{}}',
1929
+ examplePayloads: [
1930
+ {
1931
+ name: "File field",
1932
+ payload: {
1933
+ type: "FileField",
1934
+ slug: "attachment",
1935
+ label: "Attachment",
1936
+ required: false,
1937
+ config: {}
1938
+ }
1939
+ }
1940
+ ]
1697
1941
  },
1698
1942
  {
1699
1943
  key: "reference",
1700
1944
  className: "ReferenceField",
1701
1945
  aliases: ["reference", "ReferenceField"],
1702
1946
  description: "Reference to another schema.",
1703
- rawShape: '{"type":"reference","slug":"project","label":"Project","config":{"targetSchema":"<schema-uuid>","targetDisplayField":"<field-uuid>","deleteBehavior":"SET_NULL"}}',
1704
- examplePayload: {
1705
- type: "reference",
1706
- slug: "project",
1707
- label: "Project",
1708
- config: {
1709
- targetSchema: "<schema-uuid>",
1710
- targetDisplayField: "<field-uuid>",
1711
- deleteBehavior: "SET_NULL"
1947
+ rawShape: '{"type":"ReferenceField","slug":"company-ref","label":"Company","config":{"targetSchema":"<schema-uuid>","targetDisplayField":"<field-uuid>"}}',
1948
+ examplePayloads: [
1949
+ {
1950
+ name: "Reference field (minimal)",
1951
+ payload: {
1952
+ type: "ReferenceField",
1953
+ slug: "company-ref",
1954
+ label: "Company",
1955
+ required: false,
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
+ }
1712
1993
  }
1713
- }
1994
+ ]
1714
1995
  },
1715
1996
  {
1716
1997
  key: "formula",
1717
1998
  className: "FormulaField",
1718
1999
  aliases: ["formula", "FormulaField"],
1719
2000
  description: "Calculated field from a formula.",
1720
- rawShape: '{"type":"formula","slug":"total","label":"Total","config":{"formulaText":"{price} * {quantity}"}}',
1721
- examplePayload: {
1722
- type: "formula",
1723
- slug: "total",
1724
- label: "Total",
1725
- config: {
1726
- formulaText: "{price} * {quantity}"
2001
+ rawShape: `{"type":"FormulaField","slug":"formula-summary","label":"Formula Summary","config":{"formulaText":"concat(firstName, ' ', lastName)","uiFormatKind":"none"}}`,
2002
+ examplePayloads: [
2003
+ {
2004
+ name: "Formula field (none)",
2005
+ payload: {
2006
+ type: "FormulaField",
2007
+ slug: "formula-summary",
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
+ }
1727
2072
  }
1728
- }
2073
+ ]
1729
2074
  },
1730
2075
  {
1731
2076
  key: "member",
1732
2077
  className: "MemberField",
1733
2078
  aliases: ["member", "MemberField"],
1734
2079
  description: "Workspace member field.",
1735
- rawShape: '{"type":"member","slug":"owner","label":"Owner","config":{"defaultValue":"<member-id>"}}',
1736
- examplePayload: {
1737
- type: "member",
1738
- slug: "owner",
1739
- label: "Owner",
1740
- config: {
1741
- defaultValue: "<member-id>"
2080
+ rawShape: '{"type":"MemberField","slug":"owner","label":"Owner","config":{"defaultValue":null}}',
2081
+ examplePayloads: [
2082
+ {
2083
+ name: "Member field",
2084
+ payload: {
2085
+ type: "MemberField",
2086
+ slug: "owner",
2087
+ label: "Owner",
2088
+ required: false,
2089
+ config: {
2090
+ defaultValue: null,
2091
+ conditionalFormatting: []
2092
+ }
2093
+ }
1742
2094
  }
1743
- }
2095
+ ]
1744
2096
  },
1745
2097
  {
1746
2098
  key: "autoincremental",
@@ -1752,15 +2104,74 @@ var fieldTypeDefinitions = [
1752
2104
  "AutoIncrementalField"
1753
2105
  ],
1754
2106
  description: "Auto-generated incremental counter.",
1755
- rawShape: '{"type":"autoincremental","slug":"counter","label":"Counter","config":{"segmentedByFieldId":null}}',
1756
- examplePayload: {
1757
- type: "autoincremental",
1758
- slug: "counter",
1759
- label: "Counter",
1760
- config: {
1761
- segmentedByFieldId: null
2107
+ rawShape: '{"type":"AutoIncrementalField","slug":"order-number","label":"Order Number","config":{"segmentedByFieldId":null}}',
2108
+ examplePayloads: [
2109
+ {
2110
+ name: "Autoincremental (global counter)",
2111
+ payload: {
2112
+ type: "AutoIncrementalField",
2113
+ slug: "order-number",
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
+ }
1762
2134
  }
1763
- }
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
+ ]
1764
2175
  }
1765
2176
  ];
1766
2177
  var fieldTypeDefinitionByAlias = new Map(
@@ -1884,6 +2295,49 @@ function normalizeReferencePayload(input) {
1884
2295
  }
1885
2296
  return normalized;
1886
2297
  }
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
+ }
1887
2341
  function normalizeFormulaPayload(input) {
1888
2342
  const { status: _status, ...rest } = input;
1889
2343
  const rawAdditionalProperties = toJsonObject(input.additionalProperties);
@@ -1931,6 +2385,8 @@ function normalizeSchemaFieldCreatePayload(input) {
1931
2385
  return normalizeReferencePayload(normalizedWithType);
1932
2386
  case "formula":
1933
2387
  return normalizeFormulaPayload(normalizedWithType);
2388
+ case "schedule":
2389
+ return normalizeSchedulePayload(normalizedWithType);
1934
2390
  case "autoincremental": {
1935
2391
  const config = toJsonObject(normalizedWithType.config) ?? {};
1936
2392
  const segmentedByFieldId = config.segmentedByFieldId ?? normalizedWithType.segmentedByFieldId ?? null;
@@ -2167,13 +2623,10 @@ var specificExamples = {
2167
2623
  ]),
2168
2624
  "schemas update": buildCommandExamples([
2169
2625
  {
2170
- description: "Rename a schema and change its slug.",
2171
- command: 'zinkee --json schemas update contacts --name "Customer Contacts" --slug customer-contacts',
2626
+ description: "Toggle the commentable flag on a schema.",
2627
+ command: "zinkee --json schemas update contacts --commentable true",
2172
2628
  raw: `{
2173
- "set": {
2174
- "name": "Customer Contacts",
2175
- "slug": "customer-contacts"
2176
- }
2629
+ "commentable": true
2177
2630
  }`,
2178
2631
  response: `{
2179
2632
  "id": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
@@ -2186,37 +2639,46 @@ var specificExamples = {
2186
2639
  },
2187
2640
  "auditable": true,
2188
2641
  "commentable": true,
2189
- "fields": []
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
+ ]
2190
2657
  }`
2191
2658
  },
2192
2659
  {
2193
- description: "Enable the audit log on a schema.",
2194
- command: "zinkee --json schemas update contacts --auditable true",
2660
+ description: "Rename a schema and change its slug.",
2661
+ command: 'zinkee --json schemas update contacts --name "Customer Contacts" --slug customer-contacts',
2195
2662
  raw: `{
2196
- "set": {
2197
- "auditable": true
2198
- }
2663
+ "name": "Customer Contacts",
2664
+ "slug": "customer-contacts"
2199
2665
  }`
2200
2666
  },
2201
2667
  {
2202
- description: "Toggle commentable off.",
2203
- command: "zinkee --json schemas update contacts --commentable false",
2668
+ description: "Enable the audit log on a schema.",
2669
+ command: "zinkee --json schemas update contacts --auditable true",
2204
2670
  raw: `{
2205
- "set": {
2206
- "commentable": false
2207
- }
2671
+ "auditable": true
2208
2672
  }`
2209
2673
  }
2210
2674
  ]),
2211
2675
  "schemas fields update": buildCommandExamples([
2212
2676
  {
2213
- description: "Rename a field label and drop the required flag.",
2214
- command: 'zinkee --json schemas fields update contacts contact-name --label "Customer Full Name" --required false',
2677
+ description: "Rename slug and label.",
2678
+ command: `zinkee --json schemas fields update contacts contact-name --label "Customer Full Name" --raw '{"slug":"customer-full-name"}'`,
2215
2679
  raw: `{
2216
- "set": {
2217
- "label": "Customer Full Name",
2218
- "required": false
2219
- }
2680
+ "slug": "customer-full-name",
2681
+ "label": "Customer Full Name"
2220
2682
  }`,
2221
2683
  response: `{
2222
2684
  "schemaId": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
@@ -2225,26 +2687,162 @@ var specificExamples = {
2225
2687
  }`
2226
2688
  },
2227
2689
  {
2228
- description: "Make a field required.",
2690
+ description: "Toggle required.",
2229
2691
  command: "zinkee --json schemas fields update contacts status --required true",
2230
2692
  raw: `{
2231
- "set": {
2232
- "required": true
2693
+ "required": true
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": []
2233
2707
  }
2234
2708
  }`
2235
2709
  },
2236
2710
  {
2237
- description: "Patch the format options of a number field through a raw set payload (no dedicated flag exists for nested config paths).",
2238
- command: `zinkee --json schemas fields update contacts amount --raw '{"set":{"config":{"formatOptions":{"format":"percent","decimals":1}}}}'`,
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":[]}}'`,
2239
2713
  raw: `{
2240
- "set": {
2241
- "config": {
2242
- "formatOptions": {
2243
- "format": "percent",
2244
- "decimals": 1
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": []
2757
+ }
2758
+ }`
2759
+ },
2760
+ {
2761
+ description: "Patch option field (button cycle).",
2762
+ command: `zinkee --json schemas fields update contacts stage --raw '{"type":"OptionField","config":{"options":[{"id":1,"name":"To Do","color":"default"},{"id":2,"name":"Doing","color":"warning"},{"id":3,"name":"Done","color":"success"}],"defaultValue":1,"conditionalFormatting":[],"buttonConfig":{"displayMode":"button","buttonBehavior":{"mode":"cycle","cycleOrder":[1,2,3],"allowReselect":true}}}}'`,
2763
+ raw: `{
2764
+ "type": "OptionField",
2765
+ "config": {
2766
+ "options": [
2767
+ { "id": 1, "name": "To Do", "color": "default" },
2768
+ { "id": 2, "name": "Doing", "color": "warning" },
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
2245
2779
  }
2246
2780
  }
2247
2781
  }
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
+ }
2248
2846
  }`
2249
2847
  }
2250
2848
  ]),
@@ -3460,27 +4058,22 @@ var specificExamples = {
3460
4058
  "required": true,
3461
4059
  "system": false,
3462
4060
  "config": {
3463
- "textType": "LONG",
4061
+ "textType": "NORMAL",
3464
4062
  "defaultValue": "Unknown",
3465
4063
  "conditionalFormatting": []
3466
4064
  }
3467
4065
  },
3468
4066
  {
3469
- "id": "a8f1d7e3-2b5c-4d9e-8a1b-3c4d5e6f7890",
3470
- "type": "OptionField",
3471
- "slug": "status",
3472
- "label": "Status",
4067
+ "id": "1d2e3f4a-5b6c-7d8e-9f01-23456789abcd",
4068
+ "type": "TextField",
4069
+ "slug": "notes",
4070
+ "label": "Notes",
3473
4071
  "required": false,
3474
4072
  "system": false,
3475
4073
  "config": {
3476
- "options": [
3477
- { "id": 1, "name": "Open", "color": "default" },
3478
- { "id": 2, "name": "In Progress", "color": "warning" },
3479
- { "id": 3, "name": "Done", "color": "success" }
3480
- ],
3481
- "defaultValue": 1,
3482
- "conditionalFormatting": [],
3483
- "buttonConfig": null
4074
+ "textType": "LONG",
4075
+ "defaultValue": null,
4076
+ "conditionalFormatting": []
3484
4077
  }
3485
4078
  },
3486
4079
  {
@@ -3504,6 +4097,40 @@ var specificExamples = {
3504
4097
  "conditionalFormatting": []
3505
4098
  }
3506
4099
  },
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
+ },
3507
4134
  {
3508
4135
  "id": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
3509
4136
  "type": "DateField",
@@ -3521,6 +4148,203 @@ var specificExamples = {
3521
4148
  "conditionalFormatting": []
3522
4149
  }
3523
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",
4339
+ "required": false,
4340
+ "system": false,
4341
+ "config": {
4342
+ "referenceField": "c52efe3f-2825-4c60-a7e3-34dd4c1ce043",
4343
+ "beginningPeriodField": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
4344
+ "endingPeriodField": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
4345
+ "frequency": "daily"
4346
+ }
4347
+ },
3524
4348
  {
3525
4349
  "id": "a7b8c9d0-e1f2-3a4b-5c6d-7e8f90123456",
3526
4350
  "type": "MemberField",
@@ -5055,24 +5879,28 @@ function buildSchemaFieldCreateExamples(type) {
5055
5879
  const definitions = getSchemaFieldTypeDefinitions();
5056
5880
  const selectedDefinition = resolveSchemaFieldType(type);
5057
5881
  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
+ );
5058
5885
  return buildCommandExamples(
5059
- filteredDefinitions.flatMap((definition) => {
5060
- if (definition.key !== "number") {
5061
- return [{
5062
- description: `Create a ${definition.key} field`,
5063
- command: `zinkee --json schemas fields create contacts --raw '${JSON.stringify(definition.examplePayload)}'`
5064
- }];
5886
+ flat.map(({ example }, index) => {
5887
+ const slug = typeof example.payload.slug === "string" ? example.payload.slug : "field";
5888
+ const command = `zinkee --json schemas fields create contacts --raw '${JSON.stringify(example.payload)}'`;
5889
+ if (index === 0) {
5890
+ return {
5891
+ description: example.name,
5892
+ command,
5893
+ response: `{
5894
+ "schemaId": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
5895
+ "fieldId": "a8f1d7e3-2b5c-4d9e-8a1b-3c4d5e6f7890",
5896
+ "slug": "${slug}"
5897
+ }`
5898
+ };
5065
5899
  }
5066
- return [
5067
- {
5068
- description: "Create a plain number field",
5069
- command: `zinkee --json schemas fields create contacts --raw '{"type":"number","slug":"amount","label":"Amount"}'`
5070
- },
5071
- {
5072
- description: "Create a number field formatted like Moneda",
5073
- command: `zinkee --json schemas fields create contacts --raw '${JSON.stringify(definition.examplePayload)}'`
5074
- }
5075
- ];
5900
+ return {
5901
+ description: example.name,
5902
+ command
5903
+ };
5076
5904
  })
5077
5905
  );
5078
5906
  }