@stonecrop/schema 0.13.8 → 0.13.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,18 @@
1
1
  import { z as e } from "zod";
2
- import { isScalarType as x, isEnumType as N, isObjectType as A, isNonNullType as C, isListType as j, isNamedType as v, buildSchema as P, buildClientSchema as U } from "graphql";
3
- const q = [
2
+ import { isScalarType as x, 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 = [
4
16
  "Data",
5
17
  // Short text, varchar
6
18
  "Text",
@@ -43,14 +55,14 @@ const q = [
43
55
  // UI grouping container — no DB column; children are flat columns
44
56
  "Display"
45
57
  // Computed/read-only field — no DB column; excluded from SQL SELECT
46
- ], R = e.string().min(1).meta({
58
+ ], J = e.string().min(1).meta({
47
59
  title: "StonecropFieldType",
48
60
  description: "Semantic field types for Stonecrop doctypes, consistent across forms and tables"
49
61
  });
50
62
  function Q(t) {
51
- return q.includes(t);
63
+ return V.includes(t);
52
64
  }
53
- const J = {
65
+ const W = {
54
66
  // Text
55
67
  Data: { component: "ATextInput", fieldtype: "Data" },
56
68
  Text: { component: "ATextInput", fieldtype: "Text" },
@@ -83,13 +95,13 @@ const J = {
83
95
  Fieldset: { component: "AFieldset", fieldtype: "Fieldset" },
84
96
  Display: { component: "ATextInput", fieldtype: "Display" }
85
97
  };
86
- function W(t) {
87
- return J[t]?.component ?? "ATextInput";
98
+ function z(t) {
99
+ return W[t]?.component ?? "ATextInput";
88
100
  }
89
- function Te(t) {
90
- return Q(t) ? W(t) : "ATextInput";
101
+ function be(t) {
102
+ return Q(t) ? z(t) : "ATextInput";
91
103
  }
92
- const z = e.union([
104
+ const B = e.union([
93
105
  e.string(),
94
106
  // Link/Doctype target: "customer"
95
107
  e.array(e.string()),
@@ -99,82 +111,63 @@ const z = e.union([
99
111
  ]).meta({
100
112
  title: "FieldOptions",
101
113
  description: "Field options - flexible bag for type-specific configuration"
102
- }), B = e.looseObject({
114
+ }), $ = e.looseObject({
103
115
  /** Error message to display when validation fails */
104
116
  errorMessage: e.string()
105
117
  }).meta({
106
118
  title: "FieldValidation",
107
119
  description: "Validation configuration for form fields"
108
- }), k = e.object({
109
- // === CORE (required) ===
110
- /** Unique identifier for the field within its doctype */
111
- fieldname: e.string().min(1),
112
- /** Semantic field type - determines behavior and default component */
113
- fieldtype: R,
114
- // === COMPONENT (optional - derived from fieldtype when not specified) ===
115
- /** Vue component to render this field. If not specified, derived from TYPE_MAP */
116
- component: e.string().optional(),
117
- // === DISPLAY ===
118
- /** Human-readable label for the field */
119
- label: e.string().optional(),
120
- /** Width of the field (CSS value, e.g., "40ch", "200px") */
121
- width: e.string().optional(),
122
- /** Text alignment within the field */
123
- align: e.enum(["left", "center", "right", "start", "end"]).optional(),
124
- // === BEHAVIOR ===
125
- /** Whether the field is required */
126
- required: e.boolean().optional(),
127
- /** Whether the field is read-only */
128
- readOnly: e.boolean().optional(),
129
- /** Whether the field is editable (for table cells) */
130
- edit: e.boolean().optional(),
131
- /** Whether the field is hidden from the UI */
132
- hidden: e.boolean().optional(),
133
- // === VALUE ===
134
- /** Current value of the field */
135
- value: e.unknown().optional(),
136
- /** Default value for new records */
137
- default: e.unknown().optional(),
138
- // === TYPE-SPECIFIC ===
139
- /**
140
- * Type-specific options:
141
- * - Link: target doctype slug ("customer")
142
- * - Doctype: child doctype slug ("sales-order-item")
143
- * - Select: choices array (["Draft", "Submitted"])
144
- * - Decimal: \{ precision, scale \}
145
- * - Code: \{ language \}
146
- */
147
- options: z.optional(),
148
- /**
149
- * Cardinality for Doctype fields:
150
- * - 'one': exactly 1 (default)
151
- * - 'atMostOne': 0 or 1
152
- * - 'noneOrMany': 0 or more
153
- * - 'atLeastOne': 1 or more
154
- */
155
- cardinality: e.enum(["one", "atMostOne", "noneOrMany", "atLeastOne"]).optional(),
156
- /**
157
- * Input mask pattern. Accepts either a plain mask string or a stringified
158
- * arrow function that receives `locale` and returns a mask string.
159
- *
160
- * Plain pattern: `"##/##/####"`
161
- *
162
- * Function pattern: `"(locale) => locale === 'en-US' ? '(###) ###-####' : '####-######'"`
163
- */
164
- mask: e.string().optional(),
165
- // === VALIDATION ===
166
- /** Validation configuration */
167
- validation: B.optional(),
168
- // === LAYOUT ===
169
- /** Nested field definitions for Fieldset containers — UI grouping only, no DB column */
170
- schema: e.array(e.record(e.string(), e.unknown())).optional()
171
- }).meta({
172
- title: "FieldMeta",
173
- description: "Unified field metadata - the single source of truth for field definitions, works for both forms (AForm) and tables (ATable)"
174
- }), $ = e.enum(["atMostOne", "one", "noneOrMany", "atLeastOne"]).meta({
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
+ mode: e.enum(["edit", "read", "display"]).optional(),
138
+ options: B.optional(),
139
+ required: e.boolean().optional(),
140
+ readOnly: e.boolean().optional(),
141
+ hidden: e.boolean().optional(),
142
+ default: e.unknown().optional(),
143
+ validation: $.optional(),
144
+ cardinality: e.enum(["atMostOne", "one", "noneOrMany", "atLeastOne"]).optional()
145
+ }).meta({ title: "ValueField" }), n = e.object({
146
+ kind: e.literal("table"),
147
+ fieldname: e.string().min(1),
148
+ component: e.string().optional(),
149
+ label: e.string().optional(),
150
+ // Validates that each column has fieldname; allows all other ColumnSchema properties
151
+ columns: e.array(e.object({ fieldname: e.string().min(1) }).passthrough()),
152
+ config: R.optional(),
153
+ mode: e.enum(["edit", "read", "display"]).optional()
154
+ }).meta({ title: "TableField" });
155
+ let o = e.never();
156
+ const a = e.object({
157
+ kind: e.literal("fieldset"),
158
+ fieldname: e.string().min(1),
159
+ component: e.string().optional(),
160
+ label: e.string().optional(),
161
+ collapsible: e.boolean().optional(),
162
+ mode: e.enum(["edit", "read", "display"]).optional(),
163
+ schema: e.lazy(() => o.array())
164
+ }).meta({ title: "FieldsetField" }), r = e.discriminatedUnion("kind", [t, a, n]);
165
+ return o = e.preprocess(G, r), { ValueFieldSchema: t, TableFieldSchema: n, FieldsetFieldSchema: a, DoctypeFieldSchema: o };
166
+ }
167
+ const A = K(), ke = A.ValueFieldSchema, Ie = A.FieldsetFieldSchema, Ce = A.TableFieldSchema, k = A.DoctypeFieldSchema, Y = e.enum(["atMostOne", "one", "noneOrMany", "atLeastOne"]).meta({
175
168
  title: "Cardinality",
176
169
  description: "Cardinality for relationship links between doctypes"
177
- }), G = e.object({
170
+ }), Z = e.object({
178
171
  /** Fetch method type */
179
172
  method: e.literal("sync"),
180
173
  /** Optional limit on number of records to fetch */
@@ -182,13 +175,13 @@ const z = e.union([
182
175
  }).meta({
183
176
  title: "SyncFetch",
184
177
  description: "Sync fetch strategy - data is fetched in the initial query"
185
- }), K = e.object({
178
+ }), H = e.object({
186
179
  /** Fetch method type */
187
180
  method: e.literal("lazy")
188
181
  }).meta({
189
182
  title: "LazyFetch",
190
183
  description: "Lazy fetch strategy - data is fetched on demand in a separate query"
191
- }), V = e.object({
184
+ }), X = e.object({
192
185
  /** Fetch method type */
193
186
  method: e.literal("custom"),
194
187
  /** Serialized handler function to invoke */
@@ -196,14 +189,14 @@ const z = e.union([
196
189
  }).meta({
197
190
  title: "CustomFetch",
198
191
  description: "Custom fetch strategy - uses a custom handler function"
199
- }), Y = e.discriminatedUnion("method", [G, K, V]).meta({
192
+ }), ee = e.discriminatedUnion("method", [Z, H, X]).meta({
200
193
  title: "FetchStrategy",
201
194
  description: "Fetch strategy for link data loading"
202
- }), Z = e.object({
195
+ }), te = e.object({
203
196
  /** Target doctype slug */
204
197
  target: e.string().min(1),
205
198
  /** Cardinality of the relationship */
206
- cardinality: $,
199
+ cardinality: Y,
207
200
  /** Backlink fieldname on the target doctype that points back to this link */
208
201
  backlink: e.string().optional(),
209
202
  /** Override default rendering component (AForm for 1:1, ATable for 1:many) */
@@ -211,13 +204,13 @@ const z = e.union([
211
204
  /** Fieldname of the corresponding Link field in the fields array */
212
205
  fieldname: e.string().min(1).optional(),
213
206
  /** Fetch strategy for loading nested data */
214
- fetch: Y.optional(),
207
+ fetch: ee.optional(),
215
208
  /** Whether to block workflow actions until nested data is loaded (default: true) */
216
209
  blockWorkflows: e.boolean().optional()
217
210
  }).meta({
218
211
  title: "LinkDeclaration",
219
212
  description: "Declares a relationship from one doctype to another"
220
- }), H = e.object({
213
+ }), ne = e.object({
221
214
  /** Display label for the action */
222
215
  label: e.string().min(1),
223
216
  /** Handler function name or path */
@@ -233,15 +226,15 @@ const z = e.union([
233
226
  }).meta({
234
227
  title: "ActionDefinition",
235
228
  description: "Action definition within a workflow"
236
- }), X = e.object({
229
+ }), ie = e.object({
237
230
  /** List of workflow states */
238
231
  states: e.array(e.string()).optional(),
239
232
  /** Actions available in this workflow */
240
- actions: e.record(e.string(), H).optional()
233
+ actions: e.record(e.string(), ne).optional()
241
234
  }).meta({
242
235
  title: "WorkflowMeta",
243
236
  description: "Workflow metadata - states and actions for a doctype"
244
- }), L = e.object({
237
+ }), _ = e.object({
245
238
  /** Display name of the doctype */
246
239
  name: e.string().min(1),
247
240
  /** URL-friendly slug (kebab-case) */
@@ -249,70 +242,70 @@ const z = e.union([
249
242
  /** Field definitions (including link fields with fieldtype: 'Link') */
250
243
  fields: e.array(k),
251
244
  /** Relationship links to other doctypes */
252
- links: e.record(e.string(), Z).optional(),
245
+ links: e.record(e.string(), te).optional(),
253
246
  /** Workflow configuration */
254
- workflow: X.optional(),
247
+ workflow: ie.optional(),
255
248
  /** Parent doctype for inheritance */
256
249
  inherits: e.string().optional()
257
250
  }).meta({
258
251
  title: "DoctypeMeta",
259
252
  description: "Doctype metadata - complete definition of a doctype"
260
253
  });
261
- function De(t) {
254
+ function Le(t) {
262
255
  const n = k.safeParse(t);
263
256
  return n.success ? { success: !0, errors: [] } : {
264
257
  success: !1,
265
- errors: n.error.issues.map((a) => ({
266
- path: a.path,
267
- message: a.message
258
+ errors: n.error.issues.map((o) => ({
259
+ path: o.path,
260
+ message: o.message
268
261
  }))
269
262
  };
270
263
  }
271
- function Se(t) {
272
- const n = L.safeParse(t);
264
+ function _e(t) {
265
+ const n = _.safeParse(t);
273
266
  return n.success ? { success: !0, errors: [] } : {
274
267
  success: !1,
275
- errors: n.error.issues.map((a) => ({
276
- path: a.path,
277
- message: a.message
268
+ errors: n.error.issues.map((o) => ({
269
+ path: o.path,
270
+ message: o.message
278
271
  }))
279
272
  };
280
273
  }
281
- function Ie(t) {
274
+ function we(t) {
282
275
  return k.parse(t);
283
276
  }
284
- function ke(t) {
285
- return L.parse(t);
277
+ function Oe(t) {
278
+ return _.parse(t);
286
279
  }
287
- function Fe(t) {
288
- return t.replace(/_([a-z])/g, (n, a) => a.toUpperCase());
280
+ function je(t) {
281
+ return t.replace(/_([a-z])/g, (n, o) => o.toUpperCase());
289
282
  }
290
- function be(t) {
283
+ function Me(t) {
291
284
  return t.replace(/[A-Z]/g, (n) => `_${n.toLowerCase()}`);
292
285
  }
293
- function Ce(t) {
286
+ function Ee(t) {
294
287
  return t.split("_").map((n) => n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
295
288
  }
296
- function ee(t) {
289
+ function oe(t) {
297
290
  const n = t.replace(/([A-Z])/g, " $1").trim();
298
291
  return n.charAt(0).toUpperCase() + n.slice(1);
299
292
  }
300
- function te(t) {
293
+ function ae(t) {
301
294
  return t.split(/[-_\s]+/).map((n) => n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join("");
302
295
  }
303
296
  function h(t) {
304
297
  return t.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
305
298
  }
306
- function Le(t) {
299
+ function xe(t) {
307
300
  return t.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase();
308
301
  }
309
- const ne = {
302
+ const re = {
310
303
  String: { component: "ATextInput", fieldtype: "Data" },
311
304
  Int: { component: "ANumericInput", fieldtype: "Int" },
312
305
  Float: { component: "ANumericInput", fieldtype: "Float" },
313
306
  Boolean: { component: "ACheckbox", fieldtype: "Check" },
314
307
  ID: { component: "ATextInput", fieldtype: "Data" }
315
- }, ie = {
308
+ }, le = {
316
309
  // Arbitrary precision / large numbers
317
310
  BigFloat: { component: "ADecimalInput", fieldtype: "Decimal" },
318
311
  BigDecimal: { component: "ADecimalInput", fieldtype: "Decimal" },
@@ -332,20 +325,20 @@ const ne = {
332
325
  JSON: { component: "ACodeEditor", fieldtype: "JSON" },
333
326
  JSONObject: { component: "ACodeEditor", fieldtype: "JSON" },
334
327
  JsonNode: { component: "ACodeEditor", fieldtype: "JSON" }
335
- }, oe = /* @__PURE__ */ new Set(["Cursor"]);
336
- function ae(t) {
337
- const n = { ...ie };
338
- for (const [a, o] of Object.entries(ne))
339
- n[a] = o;
328
+ }, se = /* @__PURE__ */ new Set(["Cursor"]);
329
+ function ce(t) {
330
+ const n = { ...le };
331
+ for (const [o, a] of Object.entries(re))
332
+ n[o] = a;
340
333
  if (t)
341
- for (const [a, o] of Object.entries(t))
342
- n[a] = {
343
- component: o.component ?? "ATextInput",
344
- fieldtype: o.fieldtype ?? "Data"
334
+ for (const [o, a] of Object.entries(t))
335
+ n[o] = {
336
+ component: a.component ?? "ATextInput",
337
+ fieldtype: a.fieldtype ?? "Data"
345
338
  };
346
339
  return n;
347
340
  }
348
- const re = [
341
+ const pe = [
349
342
  "Connection",
350
343
  "Edge",
351
344
  "Input",
@@ -361,145 +354,153 @@ const re = [
361
354
  "InsertResponse",
362
355
  "UpdateResponse",
363
356
  "MutationResponse"
364
- ], se = /* @__PURE__ */ new Set(["Query", "Mutation", "Subscription"]);
365
- function ce(t, n) {
366
- if (t.startsWith("__") || se.has(t) || t === "Node")
357
+ ], de = /* @__PURE__ */ new Set(["Query", "Mutation", "Subscription"]);
358
+ function ue(t, n) {
359
+ if (t.startsWith("__") || de.has(t) || t === "Node")
367
360
  return !1;
368
- for (const o of re)
369
- if (t.endsWith(o))
361
+ for (const a of pe)
362
+ if (t.endsWith(a))
370
363
  return !1;
371
- const a = n.getFields();
372
- return Object.keys(a).length !== 0;
364
+ const o = n.getFields();
365
+ return Object.keys(o).length !== 0;
373
366
  }
374
- const pe = /* @__PURE__ */ new Set(["nodeId", "__typename", "clientMutationId"]);
375
- function le(t, n, a) {
376
- return !pe.has(t);
367
+ const me = /* @__PURE__ */ new Set(["nodeId", "__typename", "clientMutationId"]);
368
+ function fe(t, n, o) {
369
+ return !me.has(t);
377
370
  }
378
- function I(t) {
379
- let n = !1, a = !1, o = t;
380
- if (C(o) && (n = !0, o = o.ofType), j(o) && (a = !0, o = o.ofType, C(o) && (o = o.ofType)), !v(o))
381
- throw new Error(`Expected a named GraphQL type, got: ${String(o)}`);
382
- return { namedType: o, required: n, isList: a };
371
+ function b(t) {
372
+ let n = !1, o = !1, a = t;
373
+ if (L(a) && (n = !0, a = a.ofType), v(a) && (o = !0, a = a.ofType, L(a) && (a = a.ofType)), !P(a))
374
+ throw new Error(`Expected a named GraphQL type, got: ${String(a)}`);
375
+ return { namedType: a, required: n, isList: o };
383
376
  }
384
- function de(t) {
385
- const a = t.getFields().edges;
386
- if (!a) return;
387
- const { namedType: o, isList: r } = I(a.type);
388
- if (!r || !A(o)) return;
389
- const d = o.getFields().node;
377
+ function ye(t) {
378
+ const o = t.getFields().edges;
379
+ if (!o) return;
380
+ const { namedType: a, isList: r } = b(o.type);
381
+ if (!r || !T(a)) return;
382
+ const d = a.getFields().node;
390
383
  if (!d) return;
391
- const { namedType: u } = I(d.type);
392
- if (A(u))
384
+ const { namedType: u } = b(d.type);
385
+ if (T(u))
393
386
  return u.name;
394
387
  }
395
- function ue(t, n, a, o = {}) {
396
- const { namedType: r, required: y, isList: d } = I(n.type), u = ae(o.customScalars), i = {
388
+ function ge(t, n, o, a = {}) {
389
+ const { namedType: r, required: y, isList: d } = b(n.type), u = ce(a.customScalars), i = {
390
+ kind: "field",
397
391
  fieldname: t,
398
- label: ee(t),
392
+ label: oe(t),
399
393
  component: "ATextInput",
400
394
  fieldtype: "Data"
401
395
  };
402
396
  if (y && (i.required = !0), x(r)) {
403
- if (oe.has(r.name))
404
- return i._unmapped = !0, o.includeUnmappedMeta && (i._graphqlType = r.name), i;
397
+ if (se.has(r.name))
398
+ return i._unmapped = !0, a.includeUnmappedMeta && (i._graphqlType = r.name), i;
405
399
  if (r.name === "ID") {
406
- const m = te(t);
407
- if (a.has(m))
400
+ const m = ae(t);
401
+ if (o.has(m))
408
402
  return i.component = "ALink", i.fieldtype = "Link", i.options = h(m), i;
409
403
  }
410
- const c = u[r.name];
411
- return c ? (i.component = c.component, i.fieldtype = c.fieldtype) : (i._unmapped = !0, o.includeUnmappedMeta && (i._graphqlType = r.name)), i;
404
+ const s = u[r.name];
405
+ return s ? (i.component = s.component, i.fieldtype = s.fieldtype) : (i._unmapped = !0, a.includeUnmappedMeta && (i._graphqlType = r.name)), i;
412
406
  }
413
407
  if (N(r))
414
- return i.component = "ADropdown", i.fieldtype = "Select", i.options = r.getValues().map((c) => c.name), i;
415
- if (A(r)) {
416
- if (!d && a.has(r.name))
408
+ return i.component = "ADropdown", i.fieldtype = "Select", i.options = r.getValues().map((s) => s.name), i;
409
+ if (T(r)) {
410
+ if (!d && o.has(r.name))
417
411
  return i.component = "ALink", i.fieldtype = "Link", i.options = h(r.name), i;
418
- const c = de(r);
419
- return c && a.has(c) ? (i.component = "ATable", i._isLink = !0, i.options = h(c), i.cardinality = "noneOrMany", delete i.fieldtype, i) : d && a.has(r.name) ? (i.component = "ATable", i._isLink = !0, i.options = h(r.name), i.cardinality = "noneOrMany", delete i.fieldtype, i) : (i._unmapped = !0, o.includeUnmappedMeta && (i._graphqlType = r.name), i);
412
+ const s = ye(r);
413
+ 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);
420
414
  }
421
- return i._unmapped = !0, o.includeUnmappedMeta && (i._graphqlType = r.name), i;
415
+ return i._unmapped = !0, a.includeUnmappedMeta && (i._graphqlType = r.name), i;
422
416
  }
423
- function _e(t, n = {}) {
424
- const a = me(t), o = a.getTypeMap(), r = /* @__PURE__ */ new Set(), y = a.getQueryType(), d = a.getMutationType(), u = a.getSubscriptionType();
417
+ function Ne(t, n = {}) {
418
+ const o = he(t), a = o.getTypeMap(), r = /* @__PURE__ */ new Set(), y = o.getQueryType(), d = o.getMutationType(), u = o.getSubscriptionType();
425
419
  y && r.add(y.name), d && r.add(d.name), u && r.add(u.name);
426
- const i = n.isEntityType ?? ce, c = /* @__PURE__ */ new Set();
427
- for (const [p, l] of Object.entries(o))
428
- A(l) && (r.has(p) || i(p, l) && c.add(p));
429
- let m = c;
420
+ const i = n.isEntityType ?? ue, s = /* @__PURE__ */ new Set();
421
+ for (const [c, p] of Object.entries(a))
422
+ T(p) && (r.has(c) || i(c, p) && s.add(c));
423
+ let m = s;
430
424
  if (n.include) {
431
- const p = new Set(n.include);
432
- m = new Set([...c].filter((l) => p.has(l)));
425
+ const c = new Set(n.include);
426
+ m = new Set([...s].filter((p) => c.has(p)));
433
427
  }
434
428
  if (n.exclude) {
435
- const p = new Set(n.exclude);
436
- m = new Set([...m].filter((l) => !p.has(l)));
429
+ const c = new Set(n.exclude);
430
+ m = new Set([...m].filter((p) => !c.has(p)));
437
431
  }
438
- const _ = n.isEntityField ?? le, F = [];
439
- for (const p of m) {
440
- const l = o[p];
441
- if (!A(l)) continue;
442
- const w = l.getFields(), b = n.typeOverrides?.[p], O = Object.entries(w).filter(([s, g]) => _(s, g, l)).map(([s, g]) => {
432
+ const w = n.isEntityField ?? fe, I = [];
433
+ for (const c of m) {
434
+ const p = a[c];
435
+ if (!T(p)) continue;
436
+ const O = p.getFields(), C = n.typeOverrides?.[c], j = Object.entries(O).filter(([l, g]) => w(l, g, p)).map(([l, g]) => {
443
437
  if (n.classifyField) {
444
- const f = n.classifyField(s, g, l);
438
+ const f = n.classifyField(l, g, p);
445
439
  if (f != null)
446
440
  return {
447
- fieldname: s,
448
- label: f.label ?? s,
441
+ kind: "field",
442
+ fieldname: l,
443
+ label: f.label ?? l,
449
444
  component: f.component ?? "ATextInput",
450
445
  fieldtype: f.fieldtype ?? "Data",
451
446
  ...f
452
447
  };
453
448
  }
454
- const T = ue(s, g, c, n);
455
- return b?.[s] ? { ...T, ...b[s] } : T;
456
- }), D = {}, M = O.filter((s) => s._isLink && typeof s.options == "string" && s.cardinality ? (D[s.fieldname] = {
457
- target: s.options,
458
- cardinality: s.cardinality
459
- }, !1) : !0).map((s) => {
449
+ const F = ge(l, g, s, n);
450
+ return C?.[l] ? Object.assign(F, C[l]) : F;
451
+ }), D = {}, M = j.filter((l) => l._isLink && typeof l.options == "string" && l.cardinality ? (D[l.fieldname] = {
452
+ target: l.options,
453
+ cardinality: l.cardinality
454
+ }, !1) : !0).map((l) => {
460
455
  if (!n.includeUnmappedMeta) {
461
- const { _graphqlType: f, _unmapped: ye, _isLink: ge, ...E } = s;
456
+ const { _graphqlType: f, _unmapped: Fe, _isLink: Ae, ...E } = l;
462
457
  return E;
463
458
  }
464
- const { _isLink: g, ...T } = s;
465
- return T;
459
+ const { _isLink: g, ...F } = l;
460
+ return F;
466
461
  }), S = {
467
- name: p,
468
- slug: h(p),
462
+ name: c,
463
+ slug: h(c),
464
+ // 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
469
465
  fields: M
470
466
  };
471
- Object.keys(D).length > 0 && (S.links = D), n.includeUnmappedMeta && (S._graphqlTypeName = p), F.push(S);
467
+ Object.keys(D).length > 0 && (S.links = D), n.includeUnmappedMeta && (S._graphqlTypeName = c), I.push(S);
472
468
  }
473
- return F;
469
+ return I;
474
470
  }
475
- function me(t) {
476
- return typeof t == "string" ? P(t) : U(t);
471
+ function he(t) {
472
+ return typeof t == "string" ? U(t) : q(t);
477
473
  }
478
474
  export {
479
- q as B,
480
- ne as G,
481
- oe as I,
482
- R as S,
483
- J as T,
484
- ie as W,
485
- be as a,
486
- ae as b,
487
- ee as c,
488
- ue as d,
489
- _e as e,
490
- le as f,
491
- ce as g,
492
- W as h,
493
- Q as i,
494
- Ie as j,
495
- Le as k,
496
- Ce as l,
497
- h as m,
498
- De as n,
499
- ke as p,
500
- Te as r,
501
- Fe as s,
502
- te as t,
503
- Se as v
475
+ V as B,
476
+ k as D,
477
+ Ie as F,
478
+ re as G,
479
+ se as I,
480
+ J as S,
481
+ W as T,
482
+ ke as V,
483
+ le as W,
484
+ Ce as a,
485
+ R as b,
486
+ ce as c,
487
+ oe as d,
488
+ Me as e,
489
+ ge as f,
490
+ Ne as g,
491
+ fe as h,
492
+ ue as i,
493
+ z as j,
494
+ Q as k,
495
+ we as l,
496
+ xe as m,
497
+ Ee as n,
498
+ h as o,
499
+ Oe as p,
500
+ Le as q,
501
+ be as r,
502
+ je as s,
503
+ ae as t,
504
+ _e as v
504
505
  };
505
- //# sourceMappingURL=index-COp1U6eU.js.map
506
+ //# sourceMappingURL=index-D66L9JNw.js.map