@stonecrop/schema 0.11.4 → 0.11.5
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/dist/cli.js +1 -1
- package/dist/fieldtype.js +33 -9
- package/dist/{index-CLc5mUMQ.js → index-DqxTn6jG.js} +114 -104
- package/dist/index-DqxTn6jG.js.map +1 -0
- package/dist/index.js +24 -21
- package/dist/schema.d.ts +42 -74
- package/dist/src/doctype.d.ts +1 -20
- package/dist/src/doctype.d.ts.map +1 -1
- package/dist/src/field.d.ts +1 -20
- package/dist/src/field.d.ts.map +1 -1
- package/dist/src/fieldtype.d.ts +38 -35
- package/dist/src/fieldtype.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-CLc5mUMQ.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import { readFileSync as u, existsSync as S, mkdirSync as w, writeFileSync as x
|
|
|
3
3
|
import { resolve as c, join as O } from "node:path";
|
|
4
4
|
import { parseArgs as $ } from "node:util";
|
|
5
5
|
import { getIntrospectionQuery as N } from "graphql";
|
|
6
|
-
import { e as P, v as j } from "./index-
|
|
6
|
+
import { e as P, v as j } from "./index-DqxTn6jG.js";
|
|
7
7
|
async function C(e, m) {
|
|
8
8
|
const t = await fetch(e, {
|
|
9
9
|
method: "POST",
|
package/dist/fieldtype.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* The complete list of field types built into Stonecrop.
|
|
4
|
+
* User apps can use any string as a fieldtype; this const is the exhaustive set of types
|
|
5
|
+
* that Stonecrop provides default components for.
|
|
5
6
|
* @public
|
|
6
7
|
*/
|
|
7
|
-
export const
|
|
8
|
-
.enum([
|
|
8
|
+
export const BUILTIN_FIELD_TYPES = [
|
|
9
9
|
'Data', // Short text, varchar
|
|
10
10
|
'Text', // Long text
|
|
11
11
|
'Int', // Integer
|
|
@@ -24,13 +24,26 @@ export const StonecropFieldType = z
|
|
|
24
24
|
'Currency', // Currency value
|
|
25
25
|
'Quantity', // Quantity with unit
|
|
26
26
|
'Select', // Dropdown selection
|
|
27
|
-
]
|
|
28
|
-
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* Stonecrop field type — any non-empty string is valid; Stonecrop provides default components
|
|
30
|
+
* for the builtin types listed in {@link BUILTIN_FIELD_TYPES}. Custom fieldtypes are supported
|
|
31
|
+
* by supplying an explicit `component` on the field definition.
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export const StonecropFieldType = z.string().min(1).meta({
|
|
29
35
|
title: 'StonecropFieldType',
|
|
30
36
|
description: 'Semantic field types for Stonecrop doctypes, consistent across forms and tables',
|
|
31
37
|
});
|
|
32
38
|
/**
|
|
33
|
-
*
|
|
39
|
+
* Returns `true` when `fieldtype` is one of the builtin types Stonecrop ships with.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export function isBuiltinFieldType(fieldtype) {
|
|
43
|
+
return BUILTIN_FIELD_TYPES.includes(fieldtype);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Mapping from builtin fieldtypes to their default Vue component.
|
|
34
47
|
* Components can be overridden in the field definition.
|
|
35
48
|
* @public
|
|
36
49
|
*/
|
|
@@ -63,11 +76,22 @@ export const TYPE_MAP = {
|
|
|
63
76
|
Select: { component: 'ADropdown', fieldtype: 'Select' },
|
|
64
77
|
};
|
|
65
78
|
/**
|
|
66
|
-
* Get the default component for a field type
|
|
67
|
-
*
|
|
79
|
+
* Get the default component for a builtin field type.
|
|
80
|
+
* For an open-string fieldtype that may be custom, use {@link resolveComponent} instead.
|
|
81
|
+
* @param fieldtype - A builtin field type
|
|
68
82
|
* @returns The default component name
|
|
69
83
|
* @public
|
|
70
84
|
*/
|
|
71
85
|
export function getDefaultComponent(fieldtype) {
|
|
72
86
|
return TYPE_MAP[fieldtype]?.component ?? 'ATextInput';
|
|
73
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Resolve the component name for any fieldtype string, falling back to `'ATextInput'`
|
|
90
|
+
* for unknown custom types.
|
|
91
|
+
* @param fieldtype - Any fieldtype string (builtin or custom)
|
|
92
|
+
* @returns The component name to use for rendering
|
|
93
|
+
* @public
|
|
94
|
+
*/
|
|
95
|
+
export function resolveComponent(fieldtype) {
|
|
96
|
+
return isBuiltinFieldType(fieldtype) ? getDefaultComponent(fieldtype) : 'ATextInput';
|
|
97
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
|
-
import { isScalarType as
|
|
3
|
-
const R =
|
|
2
|
+
import { isScalarType as x, isEnumType as j, isObjectType as g, isNonNullType as L, isListType as U, buildSchema as P, buildClientSchema as q } from "graphql";
|
|
3
|
+
const R = [
|
|
4
4
|
"Data",
|
|
5
5
|
// Short text, varchar
|
|
6
6
|
"Text",
|
|
@@ -37,10 +37,14 @@ const R = e.enum([
|
|
|
37
37
|
// Quantity with unit
|
|
38
38
|
"Select"
|
|
39
39
|
// Dropdown selection
|
|
40
|
-
]).meta({
|
|
40
|
+
], J = e.string().min(1).meta({
|
|
41
41
|
title: "StonecropFieldType",
|
|
42
42
|
description: "Semantic field types for Stonecrop doctypes, consistent across forms and tables"
|
|
43
|
-
})
|
|
43
|
+
});
|
|
44
|
+
function Q(t) {
|
|
45
|
+
return R.includes(t);
|
|
46
|
+
}
|
|
47
|
+
const W = {
|
|
44
48
|
// Text
|
|
45
49
|
Data: { component: "ATextInput", fieldtype: "Data" },
|
|
46
50
|
Text: { component: "ATextInput", fieldtype: "Text" },
|
|
@@ -68,10 +72,13 @@ const R = e.enum([
|
|
|
68
72
|
Quantity: { component: "AQuantityInput", fieldtype: "Quantity" },
|
|
69
73
|
Select: { component: "ADropdown", fieldtype: "Select" }
|
|
70
74
|
};
|
|
71
|
-
function
|
|
72
|
-
return
|
|
75
|
+
function z(t) {
|
|
76
|
+
return W[t]?.component ?? "ATextInput";
|
|
77
|
+
}
|
|
78
|
+
function Ae(t) {
|
|
79
|
+
return Q(t) ? z(t) : "ATextInput";
|
|
73
80
|
}
|
|
74
|
-
const
|
|
81
|
+
const B = e.union([
|
|
75
82
|
e.string(),
|
|
76
83
|
// Link/Doctype target: "customer"
|
|
77
84
|
e.array(e.string()),
|
|
@@ -81,18 +88,18 @@ const Q = e.union([
|
|
|
81
88
|
]).meta({
|
|
82
89
|
title: "FieldOptions",
|
|
83
90
|
description: "Field options - flexible bag for type-specific configuration"
|
|
84
|
-
}),
|
|
91
|
+
}), $ = e.looseObject({
|
|
85
92
|
/** Error message to display when validation fails */
|
|
86
93
|
errorMessage: e.string()
|
|
87
94
|
}).meta({
|
|
88
95
|
title: "FieldValidation",
|
|
89
96
|
description: "Validation configuration for form fields"
|
|
90
|
-
}),
|
|
97
|
+
}), I = e.object({
|
|
91
98
|
// === CORE (required) ===
|
|
92
99
|
/** Unique identifier for the field within its doctype */
|
|
93
100
|
fieldname: e.string().min(1),
|
|
94
101
|
/** Semantic field type - determines behavior and default component */
|
|
95
|
-
fieldtype:
|
|
102
|
+
fieldtype: J,
|
|
96
103
|
// === COMPONENT (optional - derived from fieldtype when not specified) ===
|
|
97
104
|
/** Vue component to render this field. If not specified, derived from TYPE_MAP */
|
|
98
105
|
component: e.string().optional(),
|
|
@@ -126,7 +133,7 @@ const Q = e.union([
|
|
|
126
133
|
* - Decimal: \{ precision, scale \}
|
|
127
134
|
* - Code: \{ language \}
|
|
128
135
|
*/
|
|
129
|
-
options:
|
|
136
|
+
options: B.optional(),
|
|
130
137
|
/**
|
|
131
138
|
* Cardinality for Doctype fields:
|
|
132
139
|
* - 'one': exactly 1 (default)
|
|
@@ -146,14 +153,14 @@ const Q = e.union([
|
|
|
146
153
|
mask: e.string().optional(),
|
|
147
154
|
// === VALIDATION ===
|
|
148
155
|
/** Validation configuration */
|
|
149
|
-
validation:
|
|
156
|
+
validation: $.optional()
|
|
150
157
|
}).meta({
|
|
151
158
|
title: "FieldMeta",
|
|
152
159
|
description: "Unified field metadata - the single source of truth for field definitions, works for both forms (AForm) and tables (ATable)"
|
|
153
|
-
}),
|
|
160
|
+
}), G = e.enum(["atMostOne", "one", "noneOrMany", "atLeastOne"]).meta({
|
|
154
161
|
title: "Cardinality",
|
|
155
162
|
description: "Cardinality for relationship links between doctypes"
|
|
156
|
-
}),
|
|
163
|
+
}), V = e.object({
|
|
157
164
|
/** Fetch method type */
|
|
158
165
|
method: e.literal("sync"),
|
|
159
166
|
/** Optional limit on number of records to fetch */
|
|
@@ -161,13 +168,13 @@ const Q = e.union([
|
|
|
161
168
|
}).meta({
|
|
162
169
|
title: "SyncFetch",
|
|
163
170
|
description: "Sync fetch strategy - data is fetched in the initial query"
|
|
164
|
-
}),
|
|
171
|
+
}), Y = e.object({
|
|
165
172
|
/** Fetch method type */
|
|
166
173
|
method: e.literal("lazy")
|
|
167
174
|
}).meta({
|
|
168
175
|
title: "LazyFetch",
|
|
169
176
|
description: "Lazy fetch strategy - data is fetched on demand in a separate query"
|
|
170
|
-
}),
|
|
177
|
+
}), Z = e.object({
|
|
171
178
|
/** Fetch method type */
|
|
172
179
|
method: e.literal("custom"),
|
|
173
180
|
/** Serialized handler function to invoke */
|
|
@@ -175,14 +182,14 @@ const Q = e.union([
|
|
|
175
182
|
}).meta({
|
|
176
183
|
title: "CustomFetch",
|
|
177
184
|
description: "Custom fetch strategy - uses a custom handler function"
|
|
178
|
-
}),
|
|
185
|
+
}), K = e.discriminatedUnion("method", [V, Y, Z]).meta({
|
|
179
186
|
title: "FetchStrategy",
|
|
180
187
|
description: "Fetch strategy for link data loading"
|
|
181
|
-
}),
|
|
188
|
+
}), H = e.object({
|
|
182
189
|
/** Target doctype slug */
|
|
183
190
|
target: e.string().min(1),
|
|
184
191
|
/** Cardinality of the relationship */
|
|
185
|
-
cardinality:
|
|
192
|
+
cardinality: G,
|
|
186
193
|
/** Backlink fieldname on the target doctype that points back to this link */
|
|
187
194
|
backlink: e.string().optional(),
|
|
188
195
|
/** Override default rendering component (AForm for 1:1, ATable for 1:many) */
|
|
@@ -190,13 +197,13 @@ const Q = e.union([
|
|
|
190
197
|
/** Fieldname of the corresponding Link field in the fields array */
|
|
191
198
|
fieldname: e.string().min(1).optional(),
|
|
192
199
|
/** Fetch strategy for loading nested data */
|
|
193
|
-
fetch:
|
|
200
|
+
fetch: K.optional(),
|
|
194
201
|
/** Whether to block workflow actions until nested data is loaded (default: true) */
|
|
195
202
|
blockWorkflows: e.boolean().optional()
|
|
196
203
|
}).meta({
|
|
197
204
|
title: "LinkDeclaration",
|
|
198
205
|
description: "Declares a relationship from one doctype to another"
|
|
199
|
-
}),
|
|
206
|
+
}), X = e.object({
|
|
200
207
|
/** Display label for the action */
|
|
201
208
|
label: e.string().min(1),
|
|
202
209
|
/** Handler function name or path */
|
|
@@ -212,11 +219,11 @@ const Q = e.union([
|
|
|
212
219
|
}).meta({
|
|
213
220
|
title: "ActionDefinition",
|
|
214
221
|
description: "Action definition within a workflow"
|
|
215
|
-
}),
|
|
222
|
+
}), ee = e.object({
|
|
216
223
|
/** List of workflow states */
|
|
217
224
|
states: e.array(e.string()).optional(),
|
|
218
225
|
/** Actions available in this workflow */
|
|
219
|
-
actions: e.record(e.string(),
|
|
226
|
+
actions: e.record(e.string(), X).optional()
|
|
220
227
|
}).meta({
|
|
221
228
|
title: "WorkflowMeta",
|
|
222
229
|
description: "Workflow metadata - states and actions for a doctype"
|
|
@@ -228,19 +235,19 @@ const Q = e.union([
|
|
|
228
235
|
/** Database table name */
|
|
229
236
|
tableName: e.string().optional(),
|
|
230
237
|
/** Field definitions (including link fields with fieldtype: 'Link') */
|
|
231
|
-
fields: e.array(
|
|
238
|
+
fields: e.array(I),
|
|
232
239
|
/** Relationship links to other doctypes */
|
|
233
|
-
links: e.record(e.string(),
|
|
240
|
+
links: e.record(e.string(), H).optional(),
|
|
234
241
|
/** Workflow configuration */
|
|
235
|
-
workflow:
|
|
242
|
+
workflow: ee.optional(),
|
|
236
243
|
/** Parent doctype for inheritance */
|
|
237
244
|
inherits: e.string().optional()
|
|
238
245
|
}).meta({
|
|
239
246
|
title: "DoctypeMeta",
|
|
240
247
|
description: "Doctype metadata - complete definition of a doctype"
|
|
241
248
|
});
|
|
242
|
-
function
|
|
243
|
-
const n =
|
|
249
|
+
function De(t) {
|
|
250
|
+
const n = I.safeParse(t);
|
|
244
251
|
return n.success ? { success: !0, errors: [] } : {
|
|
245
252
|
success: !1,
|
|
246
253
|
errors: n.error.issues.map((o) => ({
|
|
@@ -249,7 +256,7 @@ function he(t) {
|
|
|
249
256
|
}))
|
|
250
257
|
};
|
|
251
258
|
}
|
|
252
|
-
function
|
|
259
|
+
function Se(t) {
|
|
253
260
|
const n = _.safeParse(t);
|
|
254
261
|
return n.success ? { success: !0, errors: [] } : {
|
|
255
262
|
success: !1,
|
|
@@ -259,41 +266,41 @@ function Ae(t) {
|
|
|
259
266
|
}))
|
|
260
267
|
};
|
|
261
268
|
}
|
|
262
|
-
function
|
|
263
|
-
return
|
|
269
|
+
function be(t) {
|
|
270
|
+
return I.parse(t);
|
|
264
271
|
}
|
|
265
|
-
function
|
|
272
|
+
function Ie(t) {
|
|
266
273
|
return _.parse(t);
|
|
267
274
|
}
|
|
268
|
-
function
|
|
275
|
+
function ke(t) {
|
|
269
276
|
return t.replace(/_([a-z])/g, (n, o) => o.toUpperCase());
|
|
270
277
|
}
|
|
271
|
-
function
|
|
278
|
+
function Fe(t) {
|
|
272
279
|
return t.replace(/[A-Z]/g, (n) => `_${n.toLowerCase()}`);
|
|
273
280
|
}
|
|
274
|
-
function
|
|
281
|
+
function Ce(t) {
|
|
275
282
|
return t.split("_").map((n) => n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
|
|
276
283
|
}
|
|
277
|
-
function
|
|
284
|
+
function te(t) {
|
|
278
285
|
const n = t.replace(/([A-Z])/g, " $1").trim();
|
|
279
286
|
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
280
287
|
}
|
|
281
|
-
function
|
|
288
|
+
function Le(t) {
|
|
282
289
|
return t.split(/[-_\s]+/).map((n) => n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join("");
|
|
283
290
|
}
|
|
284
291
|
function D(t) {
|
|
285
292
|
return t.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
286
293
|
}
|
|
287
|
-
function
|
|
294
|
+
function ne(t) {
|
|
288
295
|
return t.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase();
|
|
289
296
|
}
|
|
290
|
-
const
|
|
297
|
+
const ie = {
|
|
291
298
|
String: { component: "ATextInput", fieldtype: "Data" },
|
|
292
299
|
Int: { component: "ANumericInput", fieldtype: "Int" },
|
|
293
300
|
Float: { component: "ANumericInput", fieldtype: "Float" },
|
|
294
301
|
Boolean: { component: "ACheckbox", fieldtype: "Check" },
|
|
295
302
|
ID: { component: "ATextInput", fieldtype: "Data" }
|
|
296
|
-
},
|
|
303
|
+
}, oe = {
|
|
297
304
|
// Arbitrary precision / large numbers
|
|
298
305
|
BigFloat: { component: "ADecimalInput", fieldtype: "Decimal" },
|
|
299
306
|
BigDecimal: { component: "ADecimalInput", fieldtype: "Decimal" },
|
|
@@ -313,10 +320,10 @@ const ee = {
|
|
|
313
320
|
JSON: { component: "ACodeEditor", fieldtype: "JSON" },
|
|
314
321
|
JSONObject: { component: "ACodeEditor", fieldtype: "JSON" },
|
|
315
322
|
JsonNode: { component: "ACodeEditor", fieldtype: "JSON" }
|
|
316
|
-
},
|
|
317
|
-
function
|
|
318
|
-
const n = { ...
|
|
319
|
-
for (const [o, a] of Object.entries(
|
|
323
|
+
}, ae = /* @__PURE__ */ new Set(["Cursor"]);
|
|
324
|
+
function re(t) {
|
|
325
|
+
const n = { ...oe };
|
|
326
|
+
for (const [o, a] of Object.entries(ie))
|
|
320
327
|
n[o] = a;
|
|
321
328
|
if (t)
|
|
322
329
|
for (const [o, a] of Object.entries(t))
|
|
@@ -326,7 +333,7 @@ function ie(t) {
|
|
|
326
333
|
};
|
|
327
334
|
return n;
|
|
328
335
|
}
|
|
329
|
-
const
|
|
336
|
+
const se = [
|
|
330
337
|
"Connection",
|
|
331
338
|
"Edge",
|
|
332
339
|
"Input",
|
|
@@ -342,62 +349,62 @@ const oe = [
|
|
|
342
349
|
"InsertResponse",
|
|
343
350
|
"UpdateResponse",
|
|
344
351
|
"MutationResponse"
|
|
345
|
-
],
|
|
346
|
-
function
|
|
347
|
-
if (t.startsWith("__") ||
|
|
352
|
+
], ce = /* @__PURE__ */ new Set(["Query", "Mutation", "Subscription"]);
|
|
353
|
+
function le(t, n) {
|
|
354
|
+
if (t.startsWith("__") || ce.has(t) || t === "Node")
|
|
348
355
|
return !1;
|
|
349
|
-
for (const a of
|
|
356
|
+
for (const a of se)
|
|
350
357
|
if (t.endsWith(a))
|
|
351
358
|
return !1;
|
|
352
359
|
const o = n.getFields();
|
|
353
360
|
return Object.keys(o).length !== 0;
|
|
354
361
|
}
|
|
355
|
-
const
|
|
356
|
-
function
|
|
357
|
-
return !
|
|
362
|
+
const pe = /* @__PURE__ */ new Set(["nodeId", "__typename", "clientMutationId"]);
|
|
363
|
+
function de(t, n, o) {
|
|
364
|
+
return !pe.has(t);
|
|
358
365
|
}
|
|
359
|
-
function
|
|
366
|
+
function b(t) {
|
|
360
367
|
let n = !1, o = !1, a = t;
|
|
361
368
|
return L(a) && (n = !0, a = a.ofType), U(a) && (o = !0, a = a.ofType, L(a) && (a = a.ofType)), { namedType: a, required: n, isList: o };
|
|
362
369
|
}
|
|
363
|
-
function
|
|
370
|
+
function ue(t) {
|
|
364
371
|
const o = t.getFields().edges;
|
|
365
372
|
if (!o) return;
|
|
366
|
-
const { namedType: a, isList: r } =
|
|
373
|
+
const { namedType: a, isList: r } = b(o.type);
|
|
367
374
|
if (!r || !g(a)) return;
|
|
368
375
|
const d = a.getFields().node;
|
|
369
376
|
if (!d) return;
|
|
370
|
-
const { namedType: u } =
|
|
377
|
+
const { namedType: u } = b(d.type);
|
|
371
378
|
if (g(u))
|
|
372
379
|
return u.name;
|
|
373
380
|
}
|
|
374
|
-
function
|
|
375
|
-
const { namedType: r, required: f, isList: d } =
|
|
381
|
+
function me(t, n, o, a = {}) {
|
|
382
|
+
const { namedType: r, required: f, isList: d } = b(n.type), u = re(a.customScalars), i = {
|
|
376
383
|
fieldname: t,
|
|
377
|
-
label:
|
|
384
|
+
label: te(t),
|
|
378
385
|
component: "ATextInput",
|
|
379
386
|
fieldtype: "Data"
|
|
380
387
|
};
|
|
381
|
-
if (f && (i.required = !0),
|
|
382
|
-
if (
|
|
388
|
+
if (f && (i.required = !0), x(r)) {
|
|
389
|
+
if (ae.has(r.name))
|
|
383
390
|
return i._unmapped = !0, a.includeUnmappedMeta && (i._graphqlType = r.name), i;
|
|
384
391
|
const l = u[r.name];
|
|
385
392
|
return l ? (i.component = l.component, i.fieldtype = l.fieldtype) : (i._unmapped = !0, a.includeUnmappedMeta && (i._graphqlType = r.name)), i;
|
|
386
393
|
}
|
|
387
|
-
if (
|
|
394
|
+
if (j(r))
|
|
388
395
|
return i.component = "ADropdown", i.fieldtype = "Select", i.options = r.getValues().map((l) => l.name), i;
|
|
389
396
|
if (g(r)) {
|
|
390
397
|
if (!d && o.has(r.name))
|
|
391
398
|
return i.component = "ALink", i.fieldtype = "Link", i.options = D(r.name), i;
|
|
392
|
-
const l =
|
|
399
|
+
const l = ue(r);
|
|
393
400
|
return l && o.has(l) ? (i.component = "ATable", i._isLink = !0, i.options = D(l), i.cardinality = "noneOrMany", delete i.fieldtype, i) : d && o.has(r.name) ? (i.component = "ATable", i._isLink = !0, i.options = D(r.name), i.cardinality = "noneOrMany", delete i.fieldtype, i) : (i._unmapped = !0, a.includeUnmappedMeta && (i._graphqlType = r.name), i);
|
|
394
401
|
}
|
|
395
402
|
return i._unmapped = !0, a.includeUnmappedMeta && (i._graphqlType = r.name), i;
|
|
396
403
|
}
|
|
397
|
-
function
|
|
398
|
-
const o =
|
|
404
|
+
function _e(t, n = {}) {
|
|
405
|
+
const o = fe(t), a = o.getTypeMap(), r = /* @__PURE__ */ new Set(), f = o.getQueryType(), d = o.getMutationType(), u = o.getSubscriptionType();
|
|
399
406
|
f && r.add(f.name), d && r.add(d.name), u && r.add(u.name);
|
|
400
|
-
const i = n.isEntityType ??
|
|
407
|
+
const i = n.isEntityType ?? le, l = /* @__PURE__ */ new Set();
|
|
401
408
|
for (const [c, p] of Object.entries(a))
|
|
402
409
|
g(p) && (r.has(c) || i(c, p) && l.add(c));
|
|
403
410
|
let h = l;
|
|
@@ -409,11 +416,11 @@ function Ie(t, n = {}) {
|
|
|
409
416
|
const c = new Set(n.exclude);
|
|
410
417
|
h = new Set([...h].filter((p) => !c.has(p)));
|
|
411
418
|
}
|
|
412
|
-
const O = n.isEntityField ??
|
|
419
|
+
const O = n.isEntityField ?? de, w = n.deriveTableName ?? ((c) => ne(c)), k = [];
|
|
413
420
|
for (const c of h) {
|
|
414
421
|
const p = a[c];
|
|
415
422
|
if (!g(p)) continue;
|
|
416
|
-
const M = p.getFields(),
|
|
423
|
+
const M = p.getFields(), F = n.typeOverrides?.[c], N = Object.entries(M).filter(([s, y]) => O(s, y, p)).map(([s, y]) => {
|
|
417
424
|
if (n.classifyField) {
|
|
418
425
|
const m = n.classifyField(s, y, p);
|
|
419
426
|
if (m != null)
|
|
@@ -425,54 +432,57 @@ function Ie(t, n = {}) {
|
|
|
425
432
|
...m
|
|
426
433
|
};
|
|
427
434
|
}
|
|
428
|
-
const
|
|
429
|
-
return
|
|
430
|
-
}),
|
|
435
|
+
const A = me(s, y, l, n);
|
|
436
|
+
return F?.[s] ? { ...A, ...F[s] } : A;
|
|
437
|
+
}), S = {}, E = N.filter((s) => s._isLink && typeof s.options == "string" && s.cardinality ? (S[s.fieldname] = {
|
|
431
438
|
target: s.options,
|
|
432
439
|
cardinality: s.cardinality
|
|
433
440
|
}, !1) : !0).map((s) => {
|
|
434
441
|
if (!n.includeUnmappedMeta) {
|
|
435
|
-
const { _graphqlType: m, _unmapped:
|
|
436
|
-
return
|
|
442
|
+
const { _graphqlType: m, _unmapped: ye, _isLink: ge, ...v } = s;
|
|
443
|
+
return v;
|
|
437
444
|
}
|
|
438
|
-
const { _isLink: y, ...
|
|
439
|
-
return
|
|
440
|
-
}),
|
|
445
|
+
const { _isLink: y, ...A } = s;
|
|
446
|
+
return A;
|
|
447
|
+
}), T = {
|
|
441
448
|
name: c,
|
|
442
449
|
slug: D(c),
|
|
443
450
|
fields: E
|
|
444
451
|
};
|
|
445
|
-
Object.keys(
|
|
452
|
+
Object.keys(S).length > 0 && (T.links = S);
|
|
446
453
|
const C = w(c);
|
|
447
|
-
C && (
|
|
454
|
+
C && (T.tableName = C), n.includeUnmappedMeta && (T._graphqlTypeName = c), k.push(T);
|
|
448
455
|
}
|
|
449
|
-
return
|
|
456
|
+
return k;
|
|
450
457
|
}
|
|
451
|
-
function
|
|
452
|
-
return typeof t == "string" ?
|
|
458
|
+
function fe(t) {
|
|
459
|
+
return typeof t == "string" ? P(t) : q(t);
|
|
453
460
|
}
|
|
454
461
|
export {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
J as
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
Ae as
|
|
462
|
+
R as B,
|
|
463
|
+
ie as G,
|
|
464
|
+
ae as I,
|
|
465
|
+
J as S,
|
|
466
|
+
W as T,
|
|
467
|
+
oe as W,
|
|
468
|
+
Fe as a,
|
|
469
|
+
re as b,
|
|
470
|
+
te as c,
|
|
471
|
+
me as d,
|
|
472
|
+
_e as e,
|
|
473
|
+
de as f,
|
|
474
|
+
le as g,
|
|
475
|
+
z as h,
|
|
476
|
+
Q as i,
|
|
477
|
+
be as j,
|
|
478
|
+
ne as k,
|
|
479
|
+
Ce as l,
|
|
480
|
+
D as m,
|
|
481
|
+
De as n,
|
|
482
|
+
Ie as p,
|
|
483
|
+
Ae as r,
|
|
484
|
+
ke as s,
|
|
485
|
+
Le as t,
|
|
486
|
+
Se as v
|
|
477
487
|
};
|
|
478
|
-
//# sourceMappingURL=index-
|
|
488
|
+
//# sourceMappingURL=index-DqxTn6jG.js.map
|