@stonecrop/schema 0.14.0 → 0.15.0

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 (138) hide show
  1. package/package.json +14 -9
  2. package/dist/cli.cjs +0 -41
  3. package/dist/cli.cjs.map +0 -1
  4. package/dist/converter/heuristics.js +0 -258
  5. package/dist/converter/index.js +0 -181
  6. package/dist/converter/scalars.js +0 -86
  7. package/dist/converter/types.js +0 -5
  8. package/dist/converter-CYNFRwPg.js +0 -512
  9. package/dist/converter-CYNFRwPg.js.map +0 -1
  10. package/dist/converter-DNwpowpq.js +0 -459
  11. package/dist/converter-DNwpowpq.js.map +0 -1
  12. package/dist/doctype.js +0 -152
  13. package/dist/field.js +0 -110
  14. package/dist/fieldtype.js +0 -97
  15. package/dist/index--rNo7Kel.js +0 -494
  16. package/dist/index--rNo7Kel.js.map +0 -1
  17. package/dist/index-0qWNlDQ5.js +0 -450
  18. package/dist/index-0qWNlDQ5.js.map +0 -1
  19. package/dist/index-2UVTfbcY.js +0 -448
  20. package/dist/index-2UVTfbcY.js.map +0 -1
  21. package/dist/index-9QjWZ_PC.js +0 -449
  22. package/dist/index-9QjWZ_PC.js.map +0 -1
  23. package/dist/index-BCADNO5M.js +0 -449
  24. package/dist/index-BCADNO5M.js.map +0 -1
  25. package/dist/index-BJjSlCSo.js +0 -496
  26. package/dist/index-BJjSlCSo.js.map +0 -1
  27. package/dist/index-BRQJGVFR.js +0 -453
  28. package/dist/index-BRQJGVFR.js.map +0 -1
  29. package/dist/index-BatnoC-J.js +0 -429
  30. package/dist/index-BatnoC-J.js.map +0 -1
  31. package/dist/index-BbG7Mzvg.js +0 -495
  32. package/dist/index-BbG7Mzvg.js.map +0 -1
  33. package/dist/index-BdCmYHg0.js +0 -493
  34. package/dist/index-BdCmYHg0.js.map +0 -1
  35. package/dist/index-BhMd2_xl.js +0 -454
  36. package/dist/index-BhMd2_xl.js.map +0 -1
  37. package/dist/index-BzhZpuzA.js +0 -556
  38. package/dist/index-BzhZpuzA.js.map +0 -1
  39. package/dist/index-C1oC7Xwz.js +0 -552
  40. package/dist/index-C1oC7Xwz.js.map +0 -1
  41. package/dist/index-C5ANE_rn.js +0 -501
  42. package/dist/index-C5ANE_rn.js.map +0 -1
  43. package/dist/index-C8F23K8c.js +0 -555
  44. package/dist/index-C8F23K8c.js.map +0 -1
  45. package/dist/index-CD5wQNH-.js +0 -516
  46. package/dist/index-CD5wQNH-.js.map +0 -1
  47. package/dist/index-CLc5mUMQ.js +0 -478
  48. package/dist/index-CLc5mUMQ.js.map +0 -1
  49. package/dist/index-CMeexvC6.js +0 -459
  50. package/dist/index-CMeexvC6.js.map +0 -1
  51. package/dist/index-COrltkHl.js +0 -401
  52. package/dist/index-COrltkHl.js.map +0 -1
  53. package/dist/index-CX662Zb2.js +0 -551
  54. package/dist/index-CX662Zb2.js.map +0 -1
  55. package/dist/index-Cq_yfoqI.js +0 -553
  56. package/dist/index-Cq_yfoqI.js.map +0 -1
  57. package/dist/index-Cu-6609R.js +0 -493
  58. package/dist/index-Cu-6609R.js.map +0 -1
  59. package/dist/index-CvN9xK1B.js +0 -453
  60. package/dist/index-CvN9xK1B.js.map +0 -1
  61. package/dist/index-CzoRIy1-.js +0 -408
  62. package/dist/index-CzoRIy1-.js.map +0 -1
  63. package/dist/index-D66L9JNw.js +0 -506
  64. package/dist/index-D66L9JNw.js.map +0 -1
  65. package/dist/index-D68mWfHm.js +0 -510
  66. package/dist/index-D68mWfHm.js.map +0 -1
  67. package/dist/index-D6Up-BP5.js +0 -435
  68. package/dist/index-D6Up-BP5.js.map +0 -1
  69. package/dist/index-D8R5ppAg.js +0 -529
  70. package/dist/index-D8R5ppAg.js.map +0 -1
  71. package/dist/index-D9qPYlSk.js +0 -491
  72. package/dist/index-D9qPYlSk.js.map +0 -1
  73. package/dist/index-DCjAX4l-.js +0 -516
  74. package/dist/index-DCjAX4l-.js.map +0 -1
  75. package/dist/index-DE0b6fs6.js +0 -515
  76. package/dist/index-DE0b6fs6.js.map +0 -1
  77. package/dist/index-DEkR-1RC.js +0 -496
  78. package/dist/index-DEkR-1RC.js.map +0 -1
  79. package/dist/index-DIY_FLR2.js +0 -516
  80. package/dist/index-DIY_FLR2.js.map +0 -1
  81. package/dist/index-DIb_Z0wI.js +0 -476
  82. package/dist/index-DIb_Z0wI.js.map +0 -1
  83. package/dist/index-DNROIEMe.js +0 -449
  84. package/dist/index-DNROIEMe.js.map +0 -1
  85. package/dist/index-DT-NJBvW.js +0 -510
  86. package/dist/index-DT-NJBvW.js.map +0 -1
  87. package/dist/index-DUFcQC-H.js +0 -449
  88. package/dist/index-DUFcQC-H.js.map +0 -1
  89. package/dist/index-DVVTsJNb.js +0 -495
  90. package/dist/index-DVVTsJNb.js.map +0 -1
  91. package/dist/index-DYy5E1cU.js +0 -508
  92. package/dist/index-DYy5E1cU.js.map +0 -1
  93. package/dist/index-DdC5tpt-.js +0 -488
  94. package/dist/index-DdC5tpt-.js.map +0 -1
  95. package/dist/index-Dk593rMz.js +0 -512
  96. package/dist/index-Dk593rMz.js.map +0 -1
  97. package/dist/index-DmD8vmuB.js +0 -449
  98. package/dist/index-DmD8vmuB.js.map +0 -1
  99. package/dist/index-DpCFgELB.js +0 -514
  100. package/dist/index-DpCFgELB.js.map +0 -1
  101. package/dist/index-DqxTn6jG.js +0 -488
  102. package/dist/index-DqxTn6jG.js.map +0 -1
  103. package/dist/index-DyK5-0kh.js +0 -514
  104. package/dist/index-DyK5-0kh.js.map +0 -1
  105. package/dist/index-Vd0_gZjr.js +0 -451
  106. package/dist/index-Vd0_gZjr.js.map +0 -1
  107. package/dist/index-XSSAHj8g.js +0 -495
  108. package/dist/index-XSSAHj8g.js.map +0 -1
  109. package/dist/index-XZZbfFxT.js +0 -434
  110. package/dist/index-XZZbfFxT.js.map +0 -1
  111. package/dist/index-YP0m26Y5.js +0 -555
  112. package/dist/index-YP0m26Y5.js.map +0 -1
  113. package/dist/index-_3q9Bzka.js +0 -512
  114. package/dist/index-_3q9Bzka.js.map +0 -1
  115. package/dist/index-aeXXzPET.cjs +0 -2
  116. package/dist/index-aeXXzPET.cjs.map +0 -1
  117. package/dist/index-glU_Uw7z.js +0 -543
  118. package/dist/index-glU_Uw7z.js.map +0 -1
  119. package/dist/index-i0Uz8G2K.js +0 -554
  120. package/dist/index-i0Uz8G2K.js.map +0 -1
  121. package/dist/index-neVkjlgB.js +0 -446
  122. package/dist/index-neVkjlgB.js.map +0 -1
  123. package/dist/index-xdlVWldg.js +0 -408
  124. package/dist/index-xdlVWldg.js.map +0 -1
  125. package/dist/index.cjs +0 -2
  126. package/dist/index.cjs.map +0 -1
  127. package/dist/jsonschema.js +0 -225
  128. package/dist/naming.js +0 -106
  129. package/dist/src/fieldtype.d.ts +0 -63
  130. package/dist/src/fieldtype.d.ts.map +0 -1
  131. package/dist/src/fieldtype.js +0 -106
  132. package/dist/src/jsonschema.d.ts +0 -95
  133. package/dist/src/jsonschema.d.ts.map +0 -1
  134. package/dist/src/schema-field.d.ts +0 -66
  135. package/dist/src/schema-field.d.ts.map +0 -1
  136. package/dist/src/schema-field.js +0 -0
  137. package/dist/src/tsdoc-metadata.json +0 -11
  138. package/dist/validation.js +0 -60
@@ -1,555 +0,0 @@
1
- import { z as e } from "zod";
2
- import { isScalarType as M, isEnumType as E, isObjectType as T, isNonNullType as L, isListType as v, isNamedType as U, buildSchema as P, buildClientSchema as q } from "graphql";
3
- const R = e.object({
4
- /** The table view type */
5
- view: e.enum(["list", "uncounted", "list-expansion", "tree", "gantt", "tree-gantt"]).optional(),
6
- /** Allow the table to use the full width of its container */
7
- fullWidth: e.boolean().optional(),
8
- /** Default expansion state for tree views */
9
- defaultTreeExpansion: e.enum(["root", "branch", "leaf"]).optional(),
10
- /** Enable dependency graph connections for Gantt views */
11
- dependencyGraph: e.boolean().optional()
12
- }).meta({
13
- title: "TableViewConfig",
14
- description: "JSON-safe view configuration for table fields in doctype authoring"
15
- }), V = [
16
- "Data",
17
- // Short text, varchar
18
- "Text",
19
- // Long text
20
- "Int",
21
- // Integer
22
- "Float",
23
- // Floating point (IEEE 754)
24
- "Decimal",
25
- // Arbitrary precision decimal
26
- "Check",
27
- // Boolean/checkbox
28
- "Date",
29
- // Date only
30
- "Time",
31
- // Time only
32
- "Datetime",
33
- // Date and time
34
- "Duration",
35
- // Time interval
36
- "DateRange",
37
- // Date range
38
- "JSON",
39
- // JSON data
40
- "Code",
41
- // Code/source (with syntax highlighting)
42
- "Link",
43
- // Reference to another doctype
44
- "Attach",
45
- // File attachment
46
- "Currency",
47
- // Currency value
48
- "Quantity",
49
- // Quantity with unit
50
- "Select",
51
- // Dropdown selection
52
- "PrimaryKey",
53
- // Primary key field — used by the middleware to identify the record's PK column
54
- "Fieldset",
55
- // UI grouping container — no DB column; children are flat columns
56
- "Display"
57
- // Computed/read-only field — no DB column; excluded from SQL SELECT
58
- ], W = e.string().min(1).meta({
59
- title: "StonecropFieldType",
60
- description: "Semantic field types for Stonecrop doctypes, consistent across forms and tables"
61
- });
62
- function J(t) {
63
- return V.includes(t);
64
- }
65
- const z = {
66
- // Text
67
- Data: { component: "ATextInput", fieldtype: "Data" },
68
- Text: { component: "ATextarea", fieldtype: "Text" },
69
- // Numeric — all numeric variants render with ANumericInput; display differences (currency,
70
- // precision, unit) are carried by `format`/`mask`, not a distinct component.
71
- Int: { component: "ANumericInput", fieldtype: "Int" },
72
- Float: { component: "ANumericInput", fieldtype: "Float" },
73
- Decimal: { component: "ANumericInput", fieldtype: "Decimal" },
74
- // Boolean
75
- Check: { component: "ACheckbox", fieldtype: "Check" },
76
- // Date/Time — no dedicated Time SFC exists; Time falls back to a plain text input.
77
- Date: { component: "ADate", fieldtype: "Date" },
78
- Time: { component: "ATextInput", fieldtype: "Time" },
79
- Datetime: { component: "ADateTime", fieldtype: "Datetime" },
80
- Duration: { component: "ADuration", fieldtype: "Duration" },
81
- DateRange: { component: "ADateRange", fieldtype: "DateRange" },
82
- // Structured — JSON vs Code is disambiguated by the field's `language`, not the component.
83
- JSON: { component: "ACodeEditor", fieldtype: "JSON" },
84
- Code: { component: "ACodeEditor", fieldtype: "Code" },
85
- // Relational
86
- Link: { component: "AFormLink", fieldtype: "Link" },
87
- // Files
88
- Attach: { component: "AFileAttach", fieldtype: "Attach" },
89
- // Specialized — Currency/Quantity are numeric with a display format.
90
- Currency: { component: "ANumericInput", fieldtype: "Currency" },
91
- Quantity: { component: "ANumericInput", fieldtype: "Quantity" },
92
- Select: { component: "ADropdown", fieldtype: "Select" },
93
- // Identity — PK fields are typically hidden; no interactive component is needed
94
- PrimaryKey: { component: "ATextInput", fieldtype: "PrimaryKey" },
95
- // Layout — UI grouping containers and computed fields with no backing DB column
96
- Fieldset: { component: "AFieldset", fieldtype: "Fieldset" },
97
- Display: { component: "ATextInput", fieldtype: "Display" }
98
- };
99
- function Q(t) {
100
- return z[t]?.component ?? "ATextInput";
101
- }
102
- function Ie(t) {
103
- return J(t) ? Q(t) : "ATextInput";
104
- }
105
- const B = e.union([
106
- e.string(),
107
- // Link/Doctype target: "customer"
108
- e.array(e.string()),
109
- // Select choices: ["A", "B", "C"]
110
- e.record(e.string(), e.unknown())
111
- // Config: \{ precision: 10, scale: 2 \}
112
- ]).meta({
113
- title: "FieldOptions",
114
- description: "Field options - flexible bag for type-specific configuration"
115
- }), K = e.looseObject({
116
- /** Error message to display when validation fails */
117
- errorMessage: e.string()
118
- }).meta({
119
- title: "FieldValidation",
120
- description: "Validation configuration for form fields"
121
- });
122
- function $(t) {
123
- if (typeof t != "object" || t === null || Array.isArray(t)) return t;
124
- const n = t;
125
- return "kind" in n ? t : "schema" in n ? { kind: "fieldset", ...n } : "columns" in n ? { kind: "table", ...n } : { kind: "field", ...n };
126
- }
127
- function G() {
128
- const t = e.object({
129
- kind: e.literal("field"),
130
- fieldname: e.string().min(1),
131
- fieldtype: W.optional(),
132
- component: e.string().optional(),
133
- primaryKey: e.boolean().optional(),
134
- computed: e.boolean().optional(),
135
- language: e.string().optional(),
136
- label: e.string().optional(),
137
- width: e.string().optional(),
138
- align: e.enum(["left", "center", "right", "start", "end"]).optional(),
139
- edit: e.boolean().optional(),
140
- mask: e.string().optional(),
141
- format: e.string().optional(),
142
- mode: e.enum(["edit", "read", "display"]).optional(),
143
- options: B.optional(),
144
- required: e.boolean().optional(),
145
- readOnly: e.boolean().optional(),
146
- hidden: e.boolean().optional(),
147
- default: e.unknown().optional(),
148
- validation: K.optional(),
149
- cardinality: e.enum(["atMostOne", "one", "noneOrMany", "atLeastOne"]).optional(),
150
- source: e.literal("introspected").optional()
151
- }).meta({ title: "ValueField" }), n = e.object({
152
- kind: e.literal("table"),
153
- fieldname: e.string().min(1),
154
- component: e.string().optional(),
155
- label: e.string().optional(),
156
- // Validates that each column has fieldname; allows all other ColumnSchema properties
157
- columns: e.array(e.object({ fieldname: e.string().min(1) }).passthrough()),
158
- config: R.optional(),
159
- mode: e.enum(["edit", "read", "display"]).optional()
160
- }).meta({ title: "TableField" });
161
- let o = e.never();
162
- const a = e.object({
163
- kind: e.literal("fieldset"),
164
- fieldname: e.string().min(1),
165
- component: e.string().optional(),
166
- label: e.string().optional(),
167
- collapsible: e.boolean().optional(),
168
- mode: e.enum(["edit", "read", "display"]).optional(),
169
- schema: e.lazy(() => o.array())
170
- }).meta({ title: "FieldsetField" }), r = e.discriminatedUnion("kind", [t, a, n]);
171
- return o = e.preprocess($, r), { ValueFieldSchema: t, TableFieldSchema: n, FieldsetFieldSchema: a, DoctypeFieldSchema: o };
172
- }
173
- const F = G(), Ce = F.ValueFieldSchema, Le = F.FieldsetFieldSchema, _e = F.TableFieldSchema, k = F.DoctypeFieldSchema, Y = e.enum(["atMostOne", "one", "noneOrMany", "atLeastOne"]).meta({
174
- title: "Cardinality",
175
- description: "Cardinality for relationship links between doctypes"
176
- }), Z = e.object({
177
- /** Fetch method type */
178
- method: e.literal("sync"),
179
- /** Optional limit on number of records to fetch */
180
- limit: e.number().int().positive().optional()
181
- }).meta({
182
- title: "SyncFetch",
183
- description: "Sync fetch strategy - data is fetched in the initial query"
184
- }), H = e.object({
185
- /** Fetch method type */
186
- method: e.literal("lazy")
187
- }).meta({
188
- title: "LazyFetch",
189
- description: "Lazy fetch strategy - data is fetched on demand in a separate query"
190
- }), X = e.object({
191
- /** Fetch method type */
192
- method: e.literal("custom"),
193
- /** Serialized handler function to invoke */
194
- handler: e.string()
195
- }).meta({
196
- title: "CustomFetch",
197
- description: "Custom fetch strategy - uses a custom handler function"
198
- }), ee = e.discriminatedUnion("method", [Z, H, X]).meta({
199
- title: "FetchStrategy",
200
- description: "Fetch strategy for link data loading"
201
- }), te = e.object({
202
- /** Target doctype slug */
203
- target: e.string().min(1),
204
- /** Cardinality of the relationship */
205
- cardinality: Y,
206
- /** Backlink fieldname on the target doctype that points back to this link */
207
- backlink: e.string().optional(),
208
- /** Override default rendering component (AForm for 1:1, ATable for 1:many) */
209
- component: e.string().optional(),
210
- /** Fieldname of the corresponding Link field in the fields array */
211
- fieldname: e.string().min(1).optional(),
212
- /** Fetch strategy for loading nested data */
213
- fetch: ee.optional(),
214
- /** Whether to block workflow actions until nested data is loaded (default: true) */
215
- blockWorkflows: e.boolean().optional()
216
- }).meta({
217
- title: "LinkDeclaration",
218
- description: "Declares a relationship from one doctype to another"
219
- }), ne = e.object({
220
- /** Display label for the action */
221
- label: e.string().min(1),
222
- /** Fields that must have values before action can execute */
223
- requiredFields: e.array(e.string()).optional(),
224
- /** Workflow states where this action is available */
225
- allowedStates: e.array(e.string()).optional(),
226
- /** The state the record transitions to after this action executes */
227
- nextState: e.string().optional(),
228
- /** True for stateless command actions with no workflow effect at all (print, email, etc.) */
229
- stateless: e.boolean().optional(),
230
- /**
231
- * True for an internal self-transition: the action runs within the current state without
232
- * advancing the workflow (e.g. `save`, which mutates record data but stays put). Scoped by
233
- * `allowedStates`, rendered as a self-loop in the graph, and has no `nextState`. Distinct from
234
- * `stateless` (which has no workflow presence at all): a self-transition is graph-owned and,
235
- * unlike a stateless command, persists record data on dispatch.
236
- */
237
- selfTransition: e.boolean().optional(),
238
- /** JS function body stored as a string; executed client-side via AsyncFunction with injected API surface */
239
- clientHandler: e.string().optional()
240
- }).meta({
241
- title: "ActionDefinition",
242
- description: "Action definition within a workflow"
243
- }), ie = e.object({
244
- /** Optional display label; the map key is the trigger's identity */
245
- label: e.string().optional(),
246
- /** Fieldnames whose edits fire this trigger (fires when any listed field changes) */
247
- on: e.array(e.string()),
248
- /** JS function body stored as a string; run client-side with `{ record, value, setError }`. Advisory. */
249
- clientHandler: e.string()
250
- }).meta({
251
- title: "TriggerDefinition",
252
- description: "Reactive field-validation trigger — advisory client-side"
253
- });
254
- function we(t, n) {
255
- const o = t.allowedStates;
256
- return !o || o.length === 0 ? !0 : o.includes(n);
257
- }
258
- const oe = e.record(
259
- e.string(),
260
- e.object({
261
- position: e.object({ x: e.number(), y: e.number() }).optional(),
262
- targetPosition: e.enum(["left", "top", "right", "bottom"]).optional(),
263
- sourcePosition: e.enum(["left", "top", "right", "bottom"]).optional()
264
- })
265
- ), ae = e.object({
266
- /** List of workflow states */
267
- states: e.array(e.string()).optional(),
268
- /** Actions available in this workflow */
269
- actions: e.record(e.string(), ne).optional(),
270
- /** Reactive field-validation triggers (advisory, client-side), keyed by trigger name */
271
- triggers: e.record(e.string(), ie).optional(),
272
- /**
273
- * DocBuilder node positions keyed by state name — authoring view-state. Persisted here so a
274
- * doctype author's manual graph arrangement survives reloads; like `triggers`, it is client-only
275
- * and never enters the runtime GraphQL SDL. See {@link (WorkflowLayout:variable)}.
276
- */
277
- layout: oe.optional()
278
- }).meta({
279
- title: "WorkflowMeta",
280
- description: "Workflow metadata - states and actions for a doctype"
281
- }), _ = e.object({
282
- /** Display name of the doctype */
283
- name: e.string().min(1),
284
- /** URL-friendly slug (kebab-case) */
285
- slug: e.string().min(1).optional(),
286
- /** Field definitions (including link fields with fieldtype: 'Link') */
287
- fields: e.array(k),
288
- /** Relationship links to other doctypes */
289
- links: e.record(e.string(), te).optional(),
290
- /** Workflow configuration */
291
- workflow: ae.optional(),
292
- /** Parent doctype for inheritance */
293
- inherits: e.string().optional()
294
- }).meta({
295
- title: "DoctypeMeta",
296
- description: "Doctype metadata - complete definition of a doctype"
297
- });
298
- function Oe(t) {
299
- const n = k.safeParse(t);
300
- return n.success ? { success: !0, errors: [] } : {
301
- success: !1,
302
- errors: n.error.issues.map((o) => ({
303
- path: o.path,
304
- message: o.message
305
- }))
306
- };
307
- }
308
- function je(t) {
309
- const n = _.safeParse(t);
310
- return n.success ? { success: !0, errors: [] } : {
311
- success: !1,
312
- errors: n.error.issues.map((o) => ({
313
- path: o.path,
314
- message: o.message
315
- }))
316
- };
317
- }
318
- function xe(t) {
319
- return k.parse(t);
320
- }
321
- function Ne(t) {
322
- return _.parse(t);
323
- }
324
- function Me(t) {
325
- return t.replace(/_([a-z])/g, (n, o) => o.toUpperCase());
326
- }
327
- function Ee(t) {
328
- return t.replace(/[A-Z]/g, (n) => `_${n.toLowerCase()}`);
329
- }
330
- function ve(t) {
331
- return t.split("_").map((n) => n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
332
- }
333
- function re(t) {
334
- const n = t.replace(/([A-Z])/g, " $1").trim();
335
- return n.charAt(0).toUpperCase() + n.slice(1);
336
- }
337
- function le(t) {
338
- return t.split(/[-_\s]+/).map((n) => n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join("");
339
- }
340
- function h(t) {
341
- return t.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
342
- }
343
- function Ue(t) {
344
- return t.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase();
345
- }
346
- const se = {
347
- String: { component: "ATextInput", fieldtype: "Data" },
348
- Int: { component: "ANumericInput", fieldtype: "Int" },
349
- Float: { component: "ANumericInput", fieldtype: "Float" },
350
- Boolean: { component: "ACheckbox", fieldtype: "Check" },
351
- ID: { component: "ATextInput", fieldtype: "Data" }
352
- }, ce = {
353
- // Arbitrary precision / large numbers — all numeric variants render with ANumericInput.
354
- BigFloat: { component: "ANumericInput", fieldtype: "Decimal" },
355
- BigDecimal: { component: "ANumericInput", fieldtype: "Decimal" },
356
- Decimal: { component: "ANumericInput", fieldtype: "Decimal" },
357
- BigInt: { component: "ANumericInput", fieldtype: "Int" },
358
- Long: { component: "ANumericInput", fieldtype: "Int" },
359
- // Identifiers
360
- UUID: { component: "ATextInput", fieldtype: "Data" },
361
- // Date / Time — no dedicated Time SFC exists; Time falls back to a plain text input.
362
- DateTime: { component: "ADateTime", fieldtype: "Datetime" },
363
- Datetime: { component: "ADateTime", fieldtype: "Datetime" },
364
- Date: { component: "ADate", fieldtype: "Date" },
365
- Time: { component: "ATextInput", fieldtype: "Time" },
366
- Interval: { component: "ADuration", fieldtype: "Duration" },
367
- Duration: { component: "ADuration", fieldtype: "Duration" },
368
- // Structured data
369
- JSON: { component: "ACodeEditor", fieldtype: "JSON" },
370
- JSONObject: { component: "ACodeEditor", fieldtype: "JSON" },
371
- JsonNode: { component: "ACodeEditor", fieldtype: "JSON" }
372
- }, pe = /* @__PURE__ */ new Set(["Cursor"]);
373
- function de(t) {
374
- const n = { ...ce };
375
- for (const [o, a] of Object.entries(se))
376
- n[o] = a;
377
- if (t)
378
- for (const [o, a] of Object.entries(t))
379
- n[o] = {
380
- component: a.component ?? "ATextInput",
381
- fieldtype: a.fieldtype ?? "Data"
382
- };
383
- return n;
384
- }
385
- const ue = [
386
- "Connection",
387
- "Edge",
388
- "Input",
389
- "Patch",
390
- "Payload",
391
- "Condition",
392
- "Filter",
393
- "OrderBy",
394
- "Aggregate",
395
- "AggregateResult",
396
- "AggregateFilter",
397
- "DeleteResponse",
398
- "InsertResponse",
399
- "UpdateResponse",
400
- "MutationResponse"
401
- ], me = /* @__PURE__ */ new Set(["Query", "Mutation", "Subscription"]);
402
- function fe(t, n) {
403
- if (t.startsWith("__") || me.has(t) || t === "Node")
404
- return !1;
405
- for (const a of ue)
406
- if (t.endsWith(a))
407
- return !1;
408
- const o = n.getFields();
409
- return Object.keys(o).length !== 0;
410
- }
411
- const ye = /* @__PURE__ */ new Set(["nodeId", "__typename", "clientMutationId"]);
412
- function ge(t, n, o) {
413
- return !ye.has(t);
414
- }
415
- function D(t) {
416
- let n = !1, o = !1, a = t;
417
- if (L(a) && (n = !0, a = a.ofType), v(a) && (o = !0, a = a.ofType, L(a) && (a = a.ofType)), !U(a))
418
- throw new Error(`Expected a named GraphQL type, got: ${String(a)}`);
419
- return { namedType: a, required: n, isList: o };
420
- }
421
- function he(t) {
422
- const o = t.getFields().edges;
423
- if (!o) return;
424
- const { namedType: a, isList: r } = D(o.type);
425
- if (!r || !T(a)) return;
426
- const d = a.getFields().node;
427
- if (!d) return;
428
- const { namedType: u } = D(d.type);
429
- if (T(u))
430
- return u.name;
431
- }
432
- function Te(t, n, o, a = {}) {
433
- const { namedType: r, required: y, isList: d } = D(n.type), u = de(a.customScalars), i = {
434
- kind: "field",
435
- fieldname: t,
436
- label: re(t),
437
- component: "ATextInput",
438
- fieldtype: "Data"
439
- };
440
- if (y && (i.required = !0), M(r)) {
441
- if (pe.has(r.name))
442
- return i._unmapped = !0, a.includeUnmappedMeta && (i._graphqlType = r.name), i;
443
- if (r.name === "ID") {
444
- const m = le(t);
445
- if (o.has(m))
446
- return i.component = "AFormLink", i.fieldtype = "Link", i.options = h(m), i;
447
- }
448
- const s = u[r.name];
449
- return s ? (i.component = s.component, i.fieldtype = s.fieldtype) : (i._unmapped = !0, a.includeUnmappedMeta && (i._graphqlType = r.name)), i;
450
- }
451
- if (E(r))
452
- return i.component = "ADropdown", i.fieldtype = "Select", i.options = r.getValues().map((s) => s.name), i;
453
- if (T(r)) {
454
- if (!d && o.has(r.name))
455
- return i.component = "AFormLink", i.fieldtype = "Link", i.options = h(r.name), i;
456
- const s = he(r);
457
- return s && o.has(s) ? (i.component = "ATable", i._isLink = !0, i.options = h(s), i.cardinality = "noneOrMany", delete i.fieldtype, i) : d && o.has(r.name) ? (i.component = "ATable", i._isLink = !0, i.options = h(r.name), i.cardinality = "noneOrMany", delete i.fieldtype, i) : (i._unmapped = !0, a.includeUnmappedMeta && (i._graphqlType = r.name), i);
458
- }
459
- return i._unmapped = !0, a.includeUnmappedMeta && (i._graphqlType = r.name), i;
460
- }
461
- function Pe(t, n = {}) {
462
- const o = be(t), a = o.getTypeMap(), r = /* @__PURE__ */ new Set(), y = o.getQueryType(), d = o.getMutationType(), u = o.getSubscriptionType();
463
- y && r.add(y.name), d && r.add(d.name), u && r.add(u.name);
464
- const i = n.isEntityType ?? fe, s = /* @__PURE__ */ new Set();
465
- for (const [c, p] of Object.entries(a))
466
- T(p) && (r.has(c) || i(c, p) && s.add(c));
467
- let m = s;
468
- if (n.include) {
469
- const c = new Set(n.include);
470
- m = new Set([...s].filter((p) => c.has(p)));
471
- }
472
- if (n.exclude) {
473
- const c = new Set(n.exclude);
474
- m = new Set([...m].filter((p) => !c.has(p)));
475
- }
476
- const w = n.isEntityField ?? ge, I = [];
477
- for (const c of m) {
478
- const p = a[c];
479
- if (!T(p)) continue;
480
- const O = p.getFields(), C = n.typeOverrides?.[c], j = Object.entries(O).filter(([l, g]) => w(l, g, p)).map(([l, g]) => {
481
- if (n.classifyField) {
482
- const f = n.classifyField(l, g, p);
483
- if (f != null)
484
- return {
485
- kind: "field",
486
- fieldname: l,
487
- label: f.label ?? l,
488
- component: f.component ?? "ATextInput",
489
- fieldtype: f.fieldtype ?? "Data",
490
- ...f
491
- };
492
- }
493
- const b = Te(l, g, s, n);
494
- return C?.[l] ? Object.assign(b, C[l]) : b;
495
- }), A = {}, x = j.filter((l) => l._isLink && typeof l.options == "string" && l.cardinality ? (A[l.fieldname] = {
496
- target: l.options,
497
- cardinality: l.cardinality
498
- }, !1) : !0).map((l) => {
499
- if (!n.includeUnmappedMeta) {
500
- const { _graphqlType: f, _unmapped: Ae, _isLink: Se, ...N } = l;
501
- return Object.assign(N, { source: "introspected" });
502
- }
503
- const { _isLink: g, ...b } = l;
504
- return Object.assign(b, { source: "introspected" });
505
- }), S = {
506
- name: c,
507
- slug: h(c),
508
- // oxlint-disable-next-line typescript/no-unsafe-type-assertion -- safe: heuristics always set a fieldtype default ('Data'); the optional fieldtype on GraphQLConversionFieldMeta is for intermediate processing, not because output fields lack fieldtype
509
- fields: x
510
- };
511
- Object.keys(A).length > 0 && (S.links = A), n.includeUnmappedMeta && (S._graphqlTypeName = c), I.push(S);
512
- }
513
- return I;
514
- }
515
- function be(t) {
516
- return typeof t == "string" ? P(t) : q(t);
517
- }
518
- export {
519
- ne as A,
520
- V as B,
521
- k as D,
522
- Le as F,
523
- se as G,
524
- pe as I,
525
- W as S,
526
- z as T,
527
- Ce as V,
528
- ce as W,
529
- _e as a,
530
- R as b,
531
- ie as c,
532
- oe as d,
533
- ae as e,
534
- de as f,
535
- re as g,
536
- Ee as h,
537
- Te as i,
538
- Pe as j,
539
- ge as k,
540
- fe as l,
541
- Q as m,
542
- we as n,
543
- J as o,
544
- Ne as p,
545
- xe as q,
546
- Ue as r,
547
- Ie as s,
548
- Me as t,
549
- ve as u,
550
- le as v,
551
- h as w,
552
- je as x,
553
- Oe as y
554
- };
555
- //# sourceMappingURL=index-C8F23K8c.js.map