@ghentcdh/crouton-prisma 0.0.1-alpha.78 → 0.0.1-alpha.80

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.
Files changed (2) hide show
  1. package/dist/generator.cjs +323 -84
  2. package/package.json +3 -3
@@ -3903,9 +3903,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
3903
3903
  return payload;
3904
3904
  }
3905
3905
  const value = input2?.[def.discriminator];
3906
- const opt = disc.value.get(value);
3907
- if (opt && (value !== void 0 || ctx.direction !== "backward")) {
3908
- return opt._zod.run(payload, ctx);
3906
+ const opt2 = disc.value.get(value);
3907
+ if (opt2 && (value !== void 0 || ctx.direction !== "backward")) {
3908
+ return opt2._zod.run(payload, ctx);
3909
3909
  }
3910
3910
  if (def.unionFallback || ctx.direction === "backward") {
3911
3911
  return _super(payload, ctx);
@@ -14149,9 +14149,9 @@ function generateUnionCheck(doc, ctx, schema, accessor) {
14149
14149
  if (options.length === 1) {
14150
14150
  return generateCheck(doc, ctx, options[0], accessor);
14151
14151
  }
14152
- const allLiterals = options.every((opt) => opt._zod.def.type === "literal" && !opt._zod.def.checks?.length);
14152
+ const allLiterals = options.every((opt2) => opt2._zod.def.type === "literal" && !opt2._zod.def.checks?.length);
14153
14153
  if (allLiterals) {
14154
- const values = new Set(options.flatMap((opt) => opt._zod.def.values));
14154
+ const values = new Set(options.flatMap((opt2) => opt2._zod.def.values));
14155
14155
  const valuesConst = addConstant(ctx, values);
14156
14156
  doc.write(`if (!${valuesConst}.has(${accessor})) return INVALID;`);
14157
14157
  return accessor;
@@ -14159,14 +14159,14 @@ function generateUnionCheck(doc, ctx, schema, accessor) {
14159
14159
  const outputVar = newVar(ctx);
14160
14160
  doc.write(`let ${outputVar};`);
14161
14161
  for (let i = 0; i < options.length; i++) {
14162
- const opt = options[i];
14162
+ const opt2 = options[i];
14163
14163
  if (i === 0) {
14164
14164
  doc.write(`${outputVar} = (() => {`);
14165
14165
  } else {
14166
14166
  doc.write(`if (${outputVar} === INVALID) ${outputVar} = (() => {`);
14167
14167
  }
14168
14168
  doc.indented((d) => {
14169
- const branchOutput = generateCheck(d, ctx, opt, accessor);
14169
+ const branchOutput = generateCheck(d, ctx, opt2, accessor);
14170
14170
  d.write(`return ${branchOutput};`);
14171
14171
  });
14172
14172
  doc.write(`})();`);
@@ -19538,9 +19538,9 @@ function visit(schema, fnOrHandlers) {
19538
19538
  const oldOptions = def.options;
19539
19539
  let changed = false;
19540
19540
  const newOptions = [];
19541
- for (const opt of oldOptions) {
19542
- const mapped = run2(opt);
19543
- if (mapped !== opt)
19541
+ for (const opt2 of oldOptions) {
19542
+ const mapped = run2(opt2);
19543
+ if (mapped !== opt2)
19544
19544
  changed = true;
19545
19545
  newOptions.push(mapped);
19546
19546
  }
@@ -19783,7 +19783,7 @@ var LayoutControlSchema = external_exports.union([
19783
19783
  external_exports.object({
19784
19784
  id: external_exports.string(),
19785
19785
  colspan: external_exports.number().int().min(1).max(12).optional(),
19786
- rowspan: external_exports.number().int().min(1).optional(),
19786
+ rowspan: external_exports.number().int().min(1).max(6).optional(),
19787
19787
  width: external_exports.string().optional(),
19788
19788
  label: external_exports.string().optional(),
19789
19789
  hideLabel: external_exports.boolean().optional(),
@@ -19798,7 +19798,7 @@ var LayoutNodeSchema = external_exports.lazy(
19798
19798
  title: external_exports.string().optional(),
19799
19799
  titleKey: external_exports.string().optional(),
19800
19800
  colspan: external_exports.number().int().min(1).max(12).optional(),
19801
- rowspan: external_exports.number().int().min(1).optional(),
19801
+ rowspan: external_exports.number().int().min(1).max(6).optional(),
19802
19802
  label: external_exports.string().optional(),
19803
19803
  controls: external_exports.array(LayoutControlSchema).optional(),
19804
19804
  items: external_exports.array(LayoutNodeSchema).optional()
@@ -19810,127 +19810,346 @@ var LayoutSchema = external_exports.object({
19810
19810
  table: LayoutNodeSchema.optional()
19811
19811
  });
19812
19812
 
19813
+ // ../crouton-core/src/lib/resource/field-input/option-meta.ts
19814
+ var opt = (schema, meta3) => schema.meta(meta3);
19815
+
19813
19816
  // ../crouton-core/src/lib/resource/field-input/base.options.ts
19814
19817
  var BaseOptionsSchema = external_exports.object({
19815
- label: external_exports.string().optional().describe("Override the field label"),
19816
- hideLabel: external_exports.boolean().optional().describe("Hide the label"),
19817
- placeholder: external_exports.string().optional(),
19818
- readonly: external_exports.boolean().optional(),
19819
- colspan: external_exports.number().optional(),
19820
- width: external_exports.string().optional(),
19821
- styles: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
19822
- customRender: external_exports.string().optional()
19823
- }).catchall(external_exports.unknown());
19818
+ label: opt(external_exports.string().optional(), {
19819
+ description: "Override the field label",
19820
+ examples: ["My label"]
19821
+ }),
19822
+ hideLabel: opt(external_exports.boolean().optional(), {
19823
+ description: "Hide the field label"
19824
+ }),
19825
+ placeholder: opt(external_exports.string().optional(), {
19826
+ description: "Placeholder text shown inside the input when empty",
19827
+ examples: ["Search..."]
19828
+ }),
19829
+ readonly: opt(external_exports.boolean().optional(), {
19830
+ description: "Render the field in read-only mode"
19831
+ }),
19832
+ colspan: opt(external_exports.number().optional(), {
19833
+ description: "Grid column span (1\u201312)",
19834
+ examples: [6, 12]
19835
+ }),
19836
+ width: opt(external_exports.string().optional(), {
19837
+ description: "Named width (xs, sm, md, lg, xl, full) or any CSS value",
19838
+ examples: ["md", "240px"]
19839
+ }),
19840
+ styles: opt(external_exports.record(external_exports.string(), external_exports.unknown()).optional(), {
19841
+ description: "Inline CSS style object applied to the field wrapper",
19842
+ examples: [{ color: "red" }]
19843
+ }),
19844
+ customRender: opt(external_exports.string().optional(), {
19845
+ description: "Name of a globally registered Vue component to render instead of the default input",
19846
+ examples: ["MyCustomInput"]
19847
+ })
19848
+ }).catchall(external_exports.unknown()).meta({ title: "Base options", description: "Accepted by every field input type" });
19824
19849
 
19825
19850
  // ../crouton-core/src/lib/resource/field-input/types/array.options.ts
19826
19851
  var ArrayOptionsSchema = BaseOptionsSchema.extend({
19827
- layout: external_exports.enum(["row", "column"]).optional(),
19828
- elementLabelProp: external_exports.string().optional(),
19829
- hideActions: external_exports.boolean().optional()
19830
- });
19852
+ layout: opt(external_exports.enum(["row", "column"]).optional(), {
19853
+ description: "Direction in which array items are stacked",
19854
+ examples: ["row", "column"]
19855
+ }),
19856
+ elementLabelProp: opt(external_exports.string().optional(), {
19857
+ description: "Property of each array item used as its label in the UI",
19858
+ examples: ["name", "title"]
19859
+ }),
19860
+ hideActions: opt(external_exports.boolean().optional(), {
19861
+ description: "Hide the add/remove action buttons"
19862
+ })
19863
+ }).meta({ title: "Array options", description: "Options for the detail/array layout control" });
19831
19864
 
19832
19865
  // ../crouton-core/src/lib/resource/field-input/types/autocomplete.options.ts
19833
19866
  var AutocompleteBaseSchema = BaseOptionsSchema.extend({
19834
- labelKey: external_exports.string().optional(),
19835
- valueKey: external_exports.string().optional(),
19836
- freeText: external_exports.boolean().optional(),
19837
- enableCreate: external_exports.boolean().optional(),
19838
- storeValue: external_exports.boolean().optional()
19867
+ labelKey: opt(external_exports.string().optional(), {
19868
+ description: "Object key used as the display label in the dropdown",
19869
+ examples: ["label", "name"]
19870
+ }),
19871
+ valueKey: opt(external_exports.string().optional(), {
19872
+ description: "Object key used as the stored value",
19873
+ examples: ["value", "id"]
19874
+ }),
19875
+ freeText: opt(external_exports.boolean().optional(), {
19876
+ description: "Allow the user to type a value not in the options list"
19877
+ }),
19878
+ enableCreate: opt(external_exports.boolean().optional(), {
19879
+ description: 'Show a "create" action when no matching option is found'
19880
+ }),
19881
+ storeValue: opt(external_exports.boolean().optional(), {
19882
+ description: "Store option[valueKey] instead of the whole option object"
19883
+ })
19884
+ }).meta({
19885
+ title: "Common autocomplete options",
19886
+ description: "Shared options available on all autocomplete variants"
19839
19887
  });
19840
19888
  var AutocompleteInlineOptionsSchema = AutocompleteBaseSchema.extend({
19841
- options: external_exports.array(external_exports.unknown()),
19842
- values: external_exports.array(external_exports.unknown()).optional()
19843
- });
19889
+ options: opt(external_exports.array(external_exports.unknown()), {
19890
+ description: "Inline array of option items",
19891
+ examples: [[{ label: "Active", value: "active" }]]
19892
+ }),
19893
+ values: opt(external_exports.array(external_exports.unknown()).optional(), {
19894
+ description: "Alias for options (deprecated \u2014 prefer options)",
19895
+ deprecated: true
19896
+ })
19897
+ }).meta({ title: "Inline autocomplete", description: "Options provided as an inline array" });
19844
19898
  var AutocompleteRemoteOptionsSchema = AutocompleteBaseSchema.extend({
19845
- uri: external_exports.string().describe("Remote endpoint URL"),
19846
- dataField: external_exports.string().optional().describe("Field in response containing the data array"),
19847
- skipAuth: external_exports.boolean().optional()
19848
- });
19899
+ uri: opt(external_exports.string(), {
19900
+ description: "Remote endpoint URL that returns option items",
19901
+ examples: ["/api/authors"]
19902
+ }),
19903
+ dataField: opt(external_exports.string().optional(), {
19904
+ description: "Field in the API response containing the data array",
19905
+ examples: ["data", "results"]
19906
+ }),
19907
+ skipAuth: opt(external_exports.boolean().optional(), {
19908
+ description: "Send the request without authentication headers"
19909
+ })
19910
+ }).meta({ title: "Remote autocomplete", description: "Options fetched from a remote endpoint" });
19849
19911
  var AutocompleteResourceOptionsSchema = AutocompleteBaseSchema.extend({
19850
- resource: external_exports.string().describe("Relative path to a resource.json"),
19851
- skipAuth: external_exports.boolean().optional(),
19852
- dataField: external_exports.string().optional()
19912
+ resource: opt(external_exports.string(), {
19913
+ description: "Relative path to a resource.json used to populate the options",
19914
+ examples: ["./author.resource.json"]
19915
+ }),
19916
+ skipAuth: opt(external_exports.boolean().optional(), {
19917
+ description: "Send the request without authentication headers"
19918
+ }),
19919
+ dataField: opt(external_exports.string().optional(), {
19920
+ description: "Field in the API response containing the data array",
19921
+ examples: ["data", "results"]
19922
+ })
19923
+ }).meta({
19924
+ title: "Resource autocomplete",
19925
+ description: "Options populated from a crouton resource"
19853
19926
  });
19854
19927
  var AutocompleteOptionsSchema = external_exports.union([
19855
19928
  AutocompleteInlineOptionsSchema,
19856
19929
  AutocompleteRemoteOptionsSchema,
19857
19930
  AutocompleteResourceOptionsSchema,
19858
19931
  AutocompleteBaseSchema
19859
- ]).describe("Autocomplete options: inline array, remote URI, or resource reference");
19932
+ ]).meta({
19933
+ title: "Autocomplete options",
19934
+ description: "Autocomplete options: inline array, remote URI, or resource reference"
19935
+ });
19860
19936
 
19861
19937
  // ../crouton-core/src/lib/resource/field-input/types/boolean.options.ts
19862
- var BooleanOptionsSchema = BaseOptionsSchema.extend({});
19938
+ var BooleanOptionsSchema = BaseOptionsSchema.extend({}).meta({
19939
+ title: "Boolean options",
19940
+ description: "Checkbox input. All common options apply; no type-specific options."
19941
+ });
19863
19942
 
19864
19943
  // ../crouton-core/src/lib/resource/field-input/types/custom.options.ts
19865
19944
  var CustomOptionsSchema = BaseOptionsSchema.extend({
19866
- customRender: external_exports.string().optional()
19867
- }).catchall(external_exports.unknown());
19945
+ customRender: opt(external_exports.string().optional(), {
19946
+ description: "Name of the globally registered Vue component to render (overrides the base option)",
19947
+ examples: ["MyWidget"]
19948
+ })
19949
+ }).catchall(external_exports.unknown()).meta({
19950
+ title: "Custom options",
19951
+ description: "Options for app-registered custom renderer components"
19952
+ });
19868
19953
 
19869
19954
  // ../crouton-core/src/lib/resource/field-input/types/date-range.options.ts
19870
19955
  var DateRangeOptionsSchema = BaseOptionsSchema.extend({
19871
- fromLabel: external_exports.string().optional().describe('Label above the start date input. Defaults to "From"'),
19872
- toLabel: external_exports.string().optional().describe('Label above the end date input. Defaults to "To"'),
19873
- fromField: external_exports.string().optional().describe('JSON object key for the start date. Defaults to "from"'),
19874
- toField: external_exports.string().optional().describe('JSON object key for the end date. Defaults to "to"')
19956
+ fromLabel: opt(external_exports.string().optional(), {
19957
+ description: "Label above the start date input",
19958
+ default: "From",
19959
+ examples: ["From", "Start date"]
19960
+ }),
19961
+ toLabel: opt(external_exports.string().optional(), {
19962
+ description: "Label above the end date input",
19963
+ default: "To",
19964
+ examples: ["To", "End date"]
19965
+ }),
19966
+ fromField: opt(external_exports.string().optional(), {
19967
+ description: "JSON object key for the start date",
19968
+ default: "from",
19969
+ examples: ["from", "startDate"]
19970
+ }),
19971
+ toField: opt(external_exports.string().optional(), {
19972
+ description: "JSON object key for the end date",
19973
+ default: "to",
19974
+ examples: ["to", "endDate"]
19975
+ })
19976
+ }).meta({
19977
+ title: "Date-range options",
19978
+ description: "Options for the from/to date range picker"
19875
19979
  });
19876
19980
 
19877
19981
  // ../crouton-core/src/lib/resource/field-input/types/date.options.ts
19878
19982
  var DateOptionsSchema = BaseOptionsSchema.extend({
19879
- withTime: external_exports.boolean().optional().describe("Force time input on/off, overrides format"),
19880
- min: external_exports.string().optional().describe("Earliest selectable date, ISO or yyyy-MM-dd"),
19881
- max: external_exports.string().optional().describe("Latest selectable date, ISO or yyyy-MM-dd"),
19882
- locale: external_exports.string().optional().describe("BCP-47 locale for month heading and weekday labels").default("en-GB"),
19883
- firstDayOfWeek: external_exports.number().optional().describe("0 = Sunday, 1 = Monday").default(1)
19884
- });
19983
+ withTime: opt(external_exports.boolean().optional(), {
19984
+ description: "Force time input on/off, overrides format detection"
19985
+ }),
19986
+ min: opt(external_exports.string().optional(), {
19987
+ description: "Earliest selectable date (ISO 8601 or yyyy-MM-dd)",
19988
+ examples: ["2020-01-01"]
19989
+ }),
19990
+ max: opt(external_exports.string().optional(), {
19991
+ description: "Latest selectable date (ISO 8601 or yyyy-MM-dd)",
19992
+ examples: ["2099-12-31"]
19993
+ }),
19994
+ locale: opt(external_exports.string().optional().default("en-GB"), {
19995
+ description: "BCP-47 locale for month heading and weekday labels",
19996
+ examples: ["en-GB", "nl-BE"],
19997
+ default: "en-GB"
19998
+ }),
19999
+ firstDayOfWeek: opt(external_exports.number().optional().default(1), {
20000
+ description: "First day of the week: 0 = Sunday, 1 = Monday",
20001
+ examples: [0, 1],
20002
+ default: 1
20003
+ })
20004
+ }).meta({ title: "Date options", description: "Options for the date picker (and dateTime alias)" });
19885
20005
 
19886
20006
  // ../crouton-core/src/lib/resource/field-input/types/markdown.options.ts
19887
20007
  var MarkdownOptionsSchema = BaseOptionsSchema.extend({
19888
- minHeight: external_exports.string().optional().describe('Minimum editor height, e.g. "200px"')
19889
- });
20008
+ minHeight: opt(external_exports.string().optional(), {
20009
+ description: "Minimum editor height",
20010
+ examples: ["200px", "400px"]
20011
+ })
20012
+ }).meta({ title: "Markdown options", description: "Options for the Markdown rich-text editor" });
19890
20013
 
19891
20014
  // ../crouton-core/src/lib/resource/field-input/types/number.options.ts
19892
- var NumberOptionsSchema = BaseOptionsSchema.extend({});
20015
+ var NumberOptionsSchema = BaseOptionsSchema.extend({}).meta({
20016
+ title: "Number options",
20017
+ description: "Numeric input (also used for Integer alias). All common options apply; no type-specific options."
20018
+ });
19893
20019
 
19894
20020
  // ../crouton-core/src/lib/resource/field-input/types/relation.options.ts
19895
20021
  var RelationOptionsSchema = BaseOptionsSchema.extend({
19896
- colspan: external_exports.number().optional().default(12),
19897
- sort: external_exports.string().optional().describe("Field to sort related records by"),
19898
- sortDir: external_exports.enum(["asc", "desc"]).optional().describe("Sort direction, defaults to asc"),
19899
- direction: external_exports.string().optional().describe("CSS flex direction for the button layout"),
19900
- displayKey: external_exports.string().optional().describe("Key used as display label"),
19901
- resource: external_exports.string().optional().describe("Path to the related resource")
19902
- }).catchall(external_exports.unknown());
20022
+ colspan: opt(external_exports.number().optional().default(12), {
20023
+ description: "Grid column span (1\u201312); defaults to 12 for relation controls",
20024
+ default: 12,
20025
+ examples: [12, 6]
20026
+ }),
20027
+ sort: opt(external_exports.string().optional(), {
20028
+ description: "Field to sort related records by",
20029
+ examples: ["name", "createdAt"]
20030
+ }),
20031
+ sortDir: opt(external_exports.enum(["asc", "desc"]).optional(), {
20032
+ description: "Sort direction",
20033
+ default: "asc",
20034
+ examples: ["asc", "desc"]
20035
+ }),
20036
+ direction: opt(external_exports.string().optional(), {
20037
+ description: "CSS flex direction for the button layout",
20038
+ examples: ["row", "column"]
20039
+ }),
20040
+ displayKey: opt(external_exports.string().optional(), {
20041
+ description: "Key used as the display label for related records",
20042
+ examples: ["name", "title"]
20043
+ }),
20044
+ resource: opt(external_exports.string().optional(), {
20045
+ description: "Path to the related resource.json",
20046
+ examples: ["./author.resource.json"]
20047
+ })
20048
+ }).catchall(external_exports.unknown()).meta({
20049
+ title: "Relation options",
20050
+ description: "Options for the sub-resource relation control"
20051
+ });
19903
20052
 
19904
20053
  // ../crouton-core/src/lib/resource/field-input/types/select.options.ts
19905
20054
  var SelectOptionsSchema = BaseOptionsSchema.extend({
19906
- options: external_exports.array(external_exports.unknown()).optional(),
19907
- values: external_exports.array(external_exports.unknown()).optional(),
19908
- resource: external_exports.string().optional(),
19909
- labelKey: external_exports.string().optional(),
19910
- valueKey: external_exports.string().optional(),
19911
- uri: external_exports.string().optional().describe("Remote endpoint URL for fetching options"),
19912
- dataField: external_exports.string().optional().describe("Field in response containing the data array"),
19913
- clearable: external_exports.boolean().optional().describe("Allow clearing the selected value"),
19914
- storeValue: external_exports.boolean().optional().describe("Store option[valueKey] instead of the whole object")
20055
+ options: opt(external_exports.array(external_exports.unknown()).optional(), {
20056
+ description: "Inline array of option items",
20057
+ examples: [[{ label: "Active", value: "active" }]]
20058
+ }),
20059
+ values: opt(external_exports.array(external_exports.unknown()).optional(), {
20060
+ description: "Alias for options (deprecated \u2014 prefer options)",
20061
+ deprecated: true
20062
+ }),
20063
+ resource: opt(external_exports.string().optional(), {
20064
+ description: "Relative path to a resource.json used to populate the options",
20065
+ examples: ["./status.resource.json"]
20066
+ }),
20067
+ labelKey: opt(external_exports.string().optional(), {
20068
+ description: "Object key used as the display label",
20069
+ examples: ["label", "name"]
20070
+ }),
20071
+ valueKey: opt(external_exports.string().optional(), {
20072
+ description: "Object key used as the stored value",
20073
+ examples: ["value", "id"]
20074
+ }),
20075
+ uri: opt(external_exports.string().optional(), {
20076
+ description: "Remote endpoint URL for fetching options",
20077
+ examples: ["/api/statuses"]
20078
+ }),
20079
+ dataField: opt(external_exports.string().optional(), {
20080
+ description: "Field in the API response containing the data array",
20081
+ examples: ["data", "results"]
20082
+ }),
20083
+ clearable: opt(external_exports.boolean().optional(), {
20084
+ description: "Show a clear button to remove the selected value"
20085
+ }),
20086
+ storeValue: opt(external_exports.boolean().optional(), {
20087
+ description: "Store option[valueKey] instead of the whole option object"
20088
+ })
20089
+ }).meta({
20090
+ title: "Select options",
20091
+ description: "Options for the select dropdown and multi-select (mutliSelect alias)"
19915
20092
  });
19916
20093
 
19917
20094
  // ../crouton-core/src/lib/resource/field-input/types/string.options.ts
19918
- var StringOptionsSchema = BaseOptionsSchema.extend({});
20095
+ var NormalizedUniqueSchema = external_exports.object({
20096
+ enabled: external_exports.boolean(),
20097
+ scope: external_exports.array(external_exports.string()).optional(),
20098
+ caseInsensitive: external_exports.boolean().optional(),
20099
+ message: external_exports.string().optional()
20100
+ });
20101
+ var StringOptionsSchema = BaseOptionsSchema.extend({
20102
+ /** Async uniqueness validation: present when the column declares `unique`. */
20103
+ unique: NormalizedUniqueSchema.optional().meta({
20104
+ description: "Async uniqueness validation: present when the column declares `unique`."
20105
+ })
20106
+ }).meta({
20107
+ title: "String options",
20108
+ description: "Plain text input. All common options apply; no type-specific options."
20109
+ });
19919
20110
 
19920
20111
  // ../crouton-core/src/lib/resource/field-input/types/textarea.options.ts
19921
- var TextareaOptionsSchema = BaseOptionsSchema.extend({});
20112
+ var TextareaOptionsSchema = BaseOptionsSchema.extend({}).meta({
20113
+ title: "Textarea options",
20114
+ description: "Multi-line text input. All common options apply; no type-specific options."
20115
+ });
19922
20116
 
19923
20117
  // ../crouton-core/src/lib/resource/field-input/types/toggle.options.ts
19924
20118
  var ToggleOptionsSchema = BaseOptionsSchema.extend({
19925
- options: external_exports.array(external_exports.unknown()).optional(),
19926
- values: external_exports.array(external_exports.unknown()).optional(),
19927
- labelKey: external_exports.string().optional(),
19928
- valueKey: external_exports.string().optional(),
19929
- storeValue: external_exports.boolean().optional().describe("Store option[valueKey] instead of the whole object"),
19930
- clearable: external_exports.boolean().optional().describe("Clicking active button clears the value").default(true),
19931
- color: external_exports.string().optional().describe("Btn color for the active button").default("primary"),
19932
- size: external_exports.string().optional().describe("Btn size").default("sm")
19933
- });
20119
+ options: opt(external_exports.array(external_exports.unknown()).optional(), {
20120
+ description: "Array of option items rendered as toggle buttons",
20121
+ examples: [[{ label: "Yes", value: true }, { label: "No", value: false }]]
20122
+ }),
20123
+ values: opt(external_exports.array(external_exports.unknown()).optional(), {
20124
+ description: "Alias for options (deprecated \u2014 prefer options)",
20125
+ deprecated: true
20126
+ }),
20127
+ labelKey: opt(external_exports.string().optional(), {
20128
+ description: "Object key used as the button label",
20129
+ examples: ["label"]
20130
+ }),
20131
+ valueKey: opt(external_exports.string().optional(), {
20132
+ description: "Object key used as the stored value",
20133
+ examples: ["value"]
20134
+ }),
20135
+ storeValue: opt(external_exports.boolean().optional(), {
20136
+ description: "Store option[valueKey] instead of the whole option object"
20137
+ }),
20138
+ clearable: opt(external_exports.boolean().optional().default(true), {
20139
+ description: "Clicking the active button again clears the value",
20140
+ default: true
20141
+ }),
20142
+ color: opt(external_exports.string().optional().default("primary"), {
20143
+ description: "Color token applied to the active button",
20144
+ examples: ["primary", "secondary"],
20145
+ default: "primary"
20146
+ }),
20147
+ size: opt(external_exports.string().optional().default("sm"), {
20148
+ description: "Size token for the buttons",
20149
+ examples: ["sm", "md", "lg"],
20150
+ default: "sm"
20151
+ })
20152
+ }).meta({ title: "Toggle options", description: "Options for the toggle button-group control" });
19934
20153
 
19935
20154
  // ../crouton-core/src/lib/resource/field-input/registry.ts
19936
20155
  var fieldInputRegistry = /* @__PURE__ */ new Map([
@@ -20129,6 +20348,15 @@ var NESTED_SHORTHANDS = {
20129
20348
  };
20130
20349
 
20131
20350
  // ../crouton-core/src/lib/resource/Column.ts
20351
+ var UniqueConfigSchema = external_exports.object({
20352
+ /** Other column ids the uniqueness is scoped by (composite unique). */
20353
+ scope: external_exports.array(external_exports.string()).optional(),
20354
+ /** Compare case-insensitively (maps to Prisma `mode: 'insensitive'`). */
20355
+ caseInsensitive: external_exports.boolean().optional(),
20356
+ /** Message shown on the field when the value is already taken. */
20357
+ message: external_exports.string().optional()
20358
+ });
20359
+ var UniqueSchema = external_exports.union([external_exports.boolean(), UniqueConfigSchema]);
20132
20360
  var WhenConditionSchema = external_exports.object({
20133
20361
  field: external_exports.string(),
20134
20362
  // required
@@ -20182,6 +20410,17 @@ var JsonColumnSchema = external_exports.object({
20182
20410
  // default: false — exactly one column should set this
20183
20411
  showInLookup: external_exports.boolean().default(false),
20184
20412
  // default: false
20413
+ /**
20414
+ * Enforce that this column's value is unique across the resource. `true` is
20415
+ * simple single-column uniqueness; the object form allows a composite
20416
+ * `scope`, case-insensitive comparison, and a custom `message`.
20417
+ *
20418
+ * Requires a matching DB unique constraint (`@unique` in Prisma) to be
20419
+ * actually enforceable - the flag alone does not create one. The form uses it
20420
+ * to validate as-you-type against a lightweight check endpoint; the API maps
20421
+ * a Prisma unique violation back to this field on write.
20422
+ */
20423
+ unique: UniqueSchema.optional(),
20185
20424
  /**
20186
20425
  * Data type of the column, as a shorthand name (`"string"`, `"integer"`, …)
20187
20426
  * or a full JSON Schema fragment:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghentcdh/crouton-prisma",
3
- "version": "0.0.1-alpha.78",
3
+ "version": "0.0.1-alpha.80",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/GhentCDH/crouton",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "type": "module",
13
13
  "bin": {
14
- "crouton-prisma": "dist/generator.js"
14
+ "crouton-prisma": "dist/generator.cjs"
15
15
  },
16
16
  "exports": {
17
17
  ".": "./dist/generator.cjs"
@@ -30,7 +30,7 @@
30
30
  "tsup": "^8.0.0",
31
31
  "typescript": "^5.0.0",
32
32
  "@ghentcdh/crouton-codegen": "0.0.1",
33
- "@ghentcdh/crouton-core": "0.0.1-alpha.78"
33
+ "@ghentcdh/crouton-core": "0.0.1-alpha.80"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup",