@stonecrop/schema 0.13.8 → 0.13.10

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