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