@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.
- package/README.md +36 -15
- package/dist/cli.js +6 -6
- package/dist/{index-C08kwqyS.js → index-C5ANE_rn.js} +230 -231
- package/dist/index-C5ANE_rn.js.map +1 -0
- package/dist/{index-COp1U6eU.js → index-D66L9JNw.js} +220 -219
- package/dist/index-D66L9JNw.js.map +1 -0
- package/dist/index.js +30 -25
- package/dist/schema.d.ts +256 -91
- package/dist/src/converter/heuristics.d.ts.map +1 -1
- package/dist/src/converter/heuristics.js +1 -0
- package/dist/src/converter/index.d.ts.map +1 -1
- package/dist/src/converter/index.js +6 -4
- package/dist/src/converter/types.d.ts +6 -6
- package/dist/src/converter/types.d.ts.map +1 -1
- package/dist/src/doctype.d.ts +4 -35
- package/dist/src/doctype.d.ts.map +1 -1
- package/dist/src/doctype.js +2 -2
- package/dist/src/field.d.ts +163 -18
- package/dist/src/field.d.ts.map +1 -1
- package/dist/src/field.js +108 -72
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/validation.d.ts +4 -5
- package/dist/src/validation.d.ts.map +1 -1
- package/dist/src/validation.js +5 -5
- package/package.json +1 -1
- package/dist/index-C08kwqyS.js.map +0 -1
- package/dist/index-COp1U6eU.js.map +0 -1
- package/dist/index-leHOZ3ll.js +0 -502
- package/dist/index-leHOZ3ll.js.map +0 -1
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
|
-
import { isScalarType as x, isEnumType as N, isObjectType as
|
|
3
|
-
const
|
|
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
|
-
],
|
|
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
|
|
63
|
+
return V.includes(t);
|
|
52
64
|
}
|
|
53
|
-
const
|
|
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
|
|
87
|
-
return
|
|
98
|
+
function z(t) {
|
|
99
|
+
return W[t]?.component ?? "ATextInput";
|
|
88
100
|
}
|
|
89
|
-
function
|
|
90
|
-
return Q(t) ?
|
|
101
|
+
function be(t) {
|
|
102
|
+
return Q(t) ? z(t) : "ATextInput";
|
|
91
103
|
}
|
|
92
|
-
const
|
|
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
|
-
}),
|
|
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
|
-
})
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
192
|
+
}), ee = e.discriminatedUnion("method", [Z, H, X]).meta({
|
|
200
193
|
title: "FetchStrategy",
|
|
201
194
|
description: "Fetch strategy for link data loading"
|
|
202
|
-
}),
|
|
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:
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
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(),
|
|
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
|
-
}),
|
|
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(),
|
|
245
|
+
links: e.record(e.string(), te).optional(),
|
|
253
246
|
/** Workflow configuration */
|
|
254
|
-
workflow:
|
|
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
|
|
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((
|
|
266
|
-
path:
|
|
267
|
-
message:
|
|
258
|
+
errors: n.error.issues.map((o) => ({
|
|
259
|
+
path: o.path,
|
|
260
|
+
message: o.message
|
|
268
261
|
}))
|
|
269
262
|
};
|
|
270
263
|
}
|
|
271
|
-
function
|
|
272
|
-
const n =
|
|
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((
|
|
276
|
-
path:
|
|
277
|
-
message:
|
|
268
|
+
errors: n.error.issues.map((o) => ({
|
|
269
|
+
path: o.path,
|
|
270
|
+
message: o.message
|
|
278
271
|
}))
|
|
279
272
|
};
|
|
280
273
|
}
|
|
281
|
-
function
|
|
274
|
+
function we(t) {
|
|
282
275
|
return k.parse(t);
|
|
283
276
|
}
|
|
284
|
-
function
|
|
285
|
-
return
|
|
277
|
+
function Oe(t) {
|
|
278
|
+
return _.parse(t);
|
|
286
279
|
}
|
|
287
|
-
function
|
|
288
|
-
return t.replace(/_([a-z])/g, (n,
|
|
280
|
+
function je(t) {
|
|
281
|
+
return t.replace(/_([a-z])/g, (n, o) => o.toUpperCase());
|
|
289
282
|
}
|
|
290
|
-
function
|
|
283
|
+
function Me(t) {
|
|
291
284
|
return t.replace(/[A-Z]/g, (n) => `_${n.toLowerCase()}`);
|
|
292
285
|
}
|
|
293
|
-
function
|
|
286
|
+
function Ee(t) {
|
|
294
287
|
return t.split("_").map((n) => n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
|
|
295
288
|
}
|
|
296
|
-
function
|
|
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
|
|
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
|
|
299
|
+
function xe(t) {
|
|
307
300
|
return t.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase();
|
|
308
301
|
}
|
|
309
|
-
const
|
|
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
|
-
},
|
|
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
|
-
},
|
|
336
|
-
function
|
|
337
|
-
const n = { ...
|
|
338
|
-
for (const [
|
|
339
|
-
n[
|
|
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 [
|
|
342
|
-
n[
|
|
343
|
-
component:
|
|
344
|
-
fieldtype:
|
|
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
|
|
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
|
-
],
|
|
365
|
-
function
|
|
366
|
-
if (t.startsWith("__") ||
|
|
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
|
|
369
|
-
if (t.endsWith(
|
|
361
|
+
for (const a of pe)
|
|
362
|
+
if (t.endsWith(a))
|
|
370
363
|
return !1;
|
|
371
|
-
const
|
|
372
|
-
return Object.keys(
|
|
364
|
+
const o = n.getFields();
|
|
365
|
+
return Object.keys(o).length !== 0;
|
|
373
366
|
}
|
|
374
|
-
const
|
|
375
|
-
function
|
|
376
|
-
return !
|
|
367
|
+
const me = /* @__PURE__ */ new Set(["nodeId", "__typename", "clientMutationId"]);
|
|
368
|
+
function fe(t, n, o) {
|
|
369
|
+
return !me.has(t);
|
|
377
370
|
}
|
|
378
|
-
function
|
|
379
|
-
let n = !1,
|
|
380
|
-
if (
|
|
381
|
-
throw new Error(`Expected a named GraphQL type, got: ${String(
|
|
382
|
-
return { namedType:
|
|
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
|
|
385
|
-
const
|
|
386
|
-
if (!
|
|
387
|
-
const { namedType:
|
|
388
|
-
if (!r || !
|
|
389
|
-
const d =
|
|
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 } =
|
|
392
|
-
if (
|
|
384
|
+
const { namedType: u } = b(d.type);
|
|
385
|
+
if (T(u))
|
|
393
386
|
return u.name;
|
|
394
387
|
}
|
|
395
|
-
function
|
|
396
|
-
const { namedType: r, required: y, isList: d } =
|
|
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:
|
|
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 (
|
|
404
|
-
return i._unmapped = !0,
|
|
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 =
|
|
407
|
-
if (
|
|
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
|
|
411
|
-
return
|
|
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((
|
|
415
|
-
if (
|
|
416
|
-
if (!d &&
|
|
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
|
|
419
|
-
return
|
|
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,
|
|
415
|
+
return i._unmapped = !0, a.includeUnmappedMeta && (i._graphqlType = r.name), i;
|
|
422
416
|
}
|
|
423
|
-
function
|
|
424
|
-
const
|
|
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 ??
|
|
427
|
-
for (const [
|
|
428
|
-
|
|
429
|
-
let m =
|
|
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
|
|
432
|
-
m = new Set([...
|
|
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
|
|
436
|
-
m = new Set([...m].filter((
|
|
429
|
+
const c = new Set(n.exclude);
|
|
430
|
+
m = new Set([...m].filter((p) => !c.has(p)));
|
|
437
431
|
}
|
|
438
|
-
const
|
|
439
|
-
for (const
|
|
440
|
-
const
|
|
441
|
-
if (!
|
|
442
|
-
const
|
|
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(
|
|
438
|
+
const f = n.classifyField(l, g, p);
|
|
445
439
|
if (f != null)
|
|
446
440
|
return {
|
|
447
|
-
|
|
448
|
-
|
|
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
|
|
455
|
-
return
|
|
456
|
-
}), D = {}, M =
|
|
457
|
-
target:
|
|
458
|
-
cardinality:
|
|
459
|
-
}, !1) : !0).map((
|
|
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:
|
|
456
|
+
const { _graphqlType: f, _unmapped: Fe, _isLink: Ae, ...E } = l;
|
|
462
457
|
return E;
|
|
463
458
|
}
|
|
464
|
-
const { _isLink: g, ...
|
|
465
|
-
return
|
|
459
|
+
const { _isLink: g, ...F } = l;
|
|
460
|
+
return F;
|
|
466
461
|
}), S = {
|
|
467
|
-
name:
|
|
468
|
-
slug: h(
|
|
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 =
|
|
467
|
+
Object.keys(D).length > 0 && (S.links = D), n.includeUnmappedMeta && (S._graphqlTypeName = c), I.push(S);
|
|
472
468
|
}
|
|
473
|
-
return
|
|
469
|
+
return I;
|
|
474
470
|
}
|
|
475
|
-
function
|
|
476
|
-
return typeof t == "string" ?
|
|
471
|
+
function he(t) {
|
|
472
|
+
return typeof t == "string" ? U(t) : q(t);
|
|
477
473
|
}
|
|
478
474
|
export {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
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-
|
|
506
|
+
//# sourceMappingURL=index-D66L9JNw.js.map
|