@stonecrop/schema 0.30.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/dist/cli.js +194 -121
- package/dist/cli.js.map +1 -1
- package/dist/converter-CLwduvT_.js +2102 -0
- package/dist/converter-CLwduvT_.js.map +1 -0
- package/dist/flatten-Bx2cfvw3.js +37 -0
- package/dist/flatten-Bx2cfvw3.js.map +1 -0
- package/dist/index.js +123 -117
- package/dist/index.js.map +1 -1
- package/dist/record-BQOOi83C.js +134 -0
- package/dist/record-BQOOi83C.js.map +1 -0
- package/dist/record.js +2 -6
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +34 -18
- package/dist/flatten-C1MjkzFh.js +0 -10
- package/dist/flatten-C1MjkzFh.js.map +0 -1
- package/dist/record-Bc0lI9Rq.js +0 -61
- package/dist/record-Bc0lI9Rq.js.map +0 -1
- package/dist/record.js.map +0 -1
- package/dist/schema.tsbuildinfo +0 -1
- package/dist/src/badge.d.ts +0 -74
- package/dist/src/badge.d.ts.map +0 -1
- package/dist/src/badge.js +0 -158
- package/dist/src/cli.d.ts +0 -3
- package/dist/src/cli.d.ts.map +0 -1
- package/dist/src/cli.js +0 -292
- package/dist/src/column-schema.d.ts +0 -163
- package/dist/src/column-schema.d.ts.map +0 -1
- package/dist/src/column-schema.js +0 -0
- package/dist/src/component-meta.d.ts +0 -96
- package/dist/src/component-meta.d.ts.map +0 -1
- package/dist/src/component-meta.js +0 -88
- package/dist/src/converter/aggregate.d.ts +0 -127
- package/dist/src/converter/aggregate.d.ts.map +0 -1
- package/dist/src/converter/aggregate.js +0 -235
- package/dist/src/converter/authored.d.ts +0 -43
- package/dist/src/converter/authored.d.ts.map +0 -1
- package/dist/src/converter/authored.js +0 -52
- package/dist/src/converter/heuristics.d.ts +0 -60
- package/dist/src/converter/heuristics.d.ts.map +0 -1
- package/dist/src/converter/heuristics.js +0 -304
- package/dist/src/converter/index.d.ts +0 -51
- package/dist/src/converter/index.d.ts.map +0 -1
- package/dist/src/converter/index.js +0 -195
- package/dist/src/converter/merge.d.ts +0 -102
- package/dist/src/converter/merge.d.ts.map +0 -1
- package/dist/src/converter/merge.js +0 -136
- package/dist/src/converter/scalars.d.ts +0 -46
- package/dist/src/converter/scalars.d.ts.map +0 -1
- package/dist/src/converter/scalars.js +0 -83
- package/dist/src/converter/types.d.ts +0 -157
- package/dist/src/converter/types.d.ts.map +0 -1
- package/dist/src/converter/types.js +0 -5
- package/dist/src/doctype.d.ts +0 -516
- package/dist/src/doctype.d.ts.map +0 -1
- package/dist/src/doctype.js +0 -343
- package/dist/src/field.d.ts +0 -423
- package/dist/src/field.d.ts.map +0 -1
- package/dist/src/field.js +0 -378
- package/dist/src/flatten.d.ts +0 -29
- package/dist/src/flatten.d.ts.map +0 -1
- package/dist/src/flatten.js +0 -38
- package/dist/src/index.d.ts +0 -16
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -20
- package/dist/src/mode.d.ts +0 -15
- package/dist/src/mode.d.ts.map +0 -1
- package/dist/src/mode.js +0 -0
- package/dist/src/naming.d.ts +0 -80
- package/dist/src/naming.d.ts.map +0 -1
- package/dist/src/naming.js +0 -106
- package/dist/src/record.d.ts +0 -29
- package/dist/src/record.d.ts.map +0 -1
- package/dist/src/record.js +0 -55
- package/dist/src/table.d.ts +0 -33
- package/dist/src/table.d.ts.map +0 -1
- package/dist/src/table.js +0 -25
- package/dist/src/validation.d.ts +0 -54
- package/dist/src/validation.d.ts.map +0 -1
- package/dist/src/validation.js +0 -60
- package/dist/validation-C9P__pRF.js +0 -994
- package/dist/validation-C9P__pRF.js.map +0 -1
|
@@ -1,994 +0,0 @@
|
|
|
1
|
-
import { f as T } from "./flatten-C1MjkzFh.js";
|
|
2
|
-
import { isScalarType as J, isEnumType as Q, isObjectType as D, isNonNullType as E, isListType as Y, isNamedType as H, buildSchema as Z, buildClientSchema as X } from "graphql";
|
|
3
|
-
import { z as n } from "zod";
|
|
4
|
-
function I(e) {
|
|
5
|
-
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
6
|
-
}
|
|
7
|
-
function x(e) {
|
|
8
|
-
const t = [];
|
|
9
|
-
for (const i of e)
|
|
10
|
-
Array.isArray(i.schema) ? t.push(...x(i.schema.filter(I))) : t.push(i);
|
|
11
|
-
return t;
|
|
12
|
-
}
|
|
13
|
-
function ee(e) {
|
|
14
|
-
if (!Array.isArray(e.fields)) return;
|
|
15
|
-
const t = x(e.fields.filter(I)).find((i) => i.primaryKey === !0);
|
|
16
|
-
return typeof t?.fieldname == "string" ? t.fieldname : void 0;
|
|
17
|
-
}
|
|
18
|
-
function He(e) {
|
|
19
|
-
return e.replace(/_([a-z])/g, (t, i) => i.toUpperCase());
|
|
20
|
-
}
|
|
21
|
-
function Ze(e) {
|
|
22
|
-
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
23
|
-
}
|
|
24
|
-
function Xe(e) {
|
|
25
|
-
return e.split("_").map((t) => t.charAt(0).toUpperCase() + t.slice(1).toLowerCase()).join(" ");
|
|
26
|
-
}
|
|
27
|
-
function te(e) {
|
|
28
|
-
const t = e.replace(/([A-Z])/g, " $1").trim();
|
|
29
|
-
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
30
|
-
}
|
|
31
|
-
function ne(e) {
|
|
32
|
-
return e.split(/[-_\s]+/).map((t) => t.charAt(0).toUpperCase() + t.slice(1).toLowerCase()).join("");
|
|
33
|
-
}
|
|
34
|
-
function k(e) {
|
|
35
|
-
return e.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
36
|
-
}
|
|
37
|
-
function et(e) {
|
|
38
|
-
return e.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase();
|
|
39
|
-
}
|
|
40
|
-
const ie = {
|
|
41
|
-
String: { component: "ATextInput" },
|
|
42
|
-
Int: { component: "ANumericInput" },
|
|
43
|
-
Float: { component: "ANumericInput" },
|
|
44
|
-
Boolean: { component: "ACheckbox" },
|
|
45
|
-
ID: { component: "ATextInput" }
|
|
46
|
-
}, ae = {
|
|
47
|
-
// Arbitrary precision / large numbers — all numeric variants render with ANumericInput.
|
|
48
|
-
BigFloat: { component: "ANumericInput" },
|
|
49
|
-
BigDecimal: { component: "ANumericInput" },
|
|
50
|
-
Decimal: { component: "ANumericInput" },
|
|
51
|
-
BigInt: { component: "ANumericInput" },
|
|
52
|
-
Long: { component: "ANumericInput" },
|
|
53
|
-
// Identifiers
|
|
54
|
-
UUID: { component: "ATextInput" },
|
|
55
|
-
// Date / Time — no dedicated Time SFC exists; Time falls back to a plain text input.
|
|
56
|
-
DateTime: { component: "ADateTime" },
|
|
57
|
-
Datetime: { component: "ADateTime" },
|
|
58
|
-
Date: { component: "ADate" },
|
|
59
|
-
Time: { component: "ATextInput" },
|
|
60
|
-
Interval: { component: "ADuration" },
|
|
61
|
-
Duration: { component: "ADuration" },
|
|
62
|
-
// Structured data
|
|
63
|
-
JSON: { component: "ACodeEditor" },
|
|
64
|
-
JSONObject: { component: "ACodeEditor" },
|
|
65
|
-
JsonNode: { component: "ACodeEditor" }
|
|
66
|
-
}, oe = /* @__PURE__ */ new Set(["Cursor"]);
|
|
67
|
-
function re(e) {
|
|
68
|
-
const t = { ...ae };
|
|
69
|
-
for (const [i, a] of Object.entries(ie))
|
|
70
|
-
t[i] = a;
|
|
71
|
-
if (e)
|
|
72
|
-
for (const [i, a] of Object.entries(e))
|
|
73
|
-
t[i] = { component: a.component ?? "ATextInput" };
|
|
74
|
-
return t;
|
|
75
|
-
}
|
|
76
|
-
const se = [
|
|
77
|
-
"Connection",
|
|
78
|
-
"Edge",
|
|
79
|
-
"Input",
|
|
80
|
-
"Patch",
|
|
81
|
-
"Payload",
|
|
82
|
-
"Condition",
|
|
83
|
-
"Filter",
|
|
84
|
-
"OrderBy",
|
|
85
|
-
"Aggregate",
|
|
86
|
-
"AggregateResult",
|
|
87
|
-
"AggregateFilter",
|
|
88
|
-
"DeleteResponse",
|
|
89
|
-
"InsertResponse",
|
|
90
|
-
"UpdateResponse",
|
|
91
|
-
"MutationResponse"
|
|
92
|
-
], le = /* @__PURE__ */ new Set(["Query", "Mutation", "Subscription"]);
|
|
93
|
-
function ce(e, t) {
|
|
94
|
-
if (e.startsWith("__") || le.has(e) || e === "Node")
|
|
95
|
-
return !1;
|
|
96
|
-
for (const a of se)
|
|
97
|
-
if (e.endsWith(a))
|
|
98
|
-
return !1;
|
|
99
|
-
const i = t.getFields();
|
|
100
|
-
return Object.keys(i).length !== 0;
|
|
101
|
-
}
|
|
102
|
-
const ue = /* @__PURE__ */ new Set(["__typename", "clientMutationId"]), de = "Node";
|
|
103
|
-
function pe(e) {
|
|
104
|
-
for (const t of e.getInterfaces()) {
|
|
105
|
-
if (t.name !== de) continue;
|
|
106
|
-
const i = Object.values(t.getFields());
|
|
107
|
-
if (i.length !== 1) continue;
|
|
108
|
-
const { namedType: a, required: o, isList: c } = C(i[0].type);
|
|
109
|
-
if (o && !c && a.name === "ID") return i[0].name;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
function me(e, t, i) {
|
|
113
|
-
return ue.has(e) ? !1 : e !== pe(i);
|
|
114
|
-
}
|
|
115
|
-
function C(e) {
|
|
116
|
-
let t = !1, i = !1, a = e;
|
|
117
|
-
if (E(a) && (t = !0, a = a.ofType), Y(a) && (i = !0, a = a.ofType, E(a) && (a = a.ofType)), !H(a))
|
|
118
|
-
throw new Error(`Expected a named GraphQL type, got: ${String(a)}`);
|
|
119
|
-
return { namedType: a, required: t, isList: i };
|
|
120
|
-
}
|
|
121
|
-
function fe(e) {
|
|
122
|
-
const i = e.getFields().edges;
|
|
123
|
-
if (!i) return;
|
|
124
|
-
const { namedType: a, isList: o } = C(i.type);
|
|
125
|
-
if (!o || !D(a)) return;
|
|
126
|
-
const d = a.getFields().node;
|
|
127
|
-
if (!d) return;
|
|
128
|
-
const { namedType: $ } = C(d.type);
|
|
129
|
-
if (D($))
|
|
130
|
-
return $.name;
|
|
131
|
-
}
|
|
132
|
-
function he(e, t, i, a = {}) {
|
|
133
|
-
const { namedType: o, required: c, isList: d } = C(t.type), $ = re(a.customScalars), s = {
|
|
134
|
-
kind: "field",
|
|
135
|
-
fieldname: e,
|
|
136
|
-
label: te(e),
|
|
137
|
-
component: "ATextInput"
|
|
138
|
-
};
|
|
139
|
-
if (c && (s.required = !0), J(o)) {
|
|
140
|
-
if (oe.has(o.name))
|
|
141
|
-
return s._unmapped = !0, a.includeUnmappedMeta && (s._graphqlType = o.name), s;
|
|
142
|
-
if (o.name === "ID") {
|
|
143
|
-
const g = ne(e);
|
|
144
|
-
if (i.has(g))
|
|
145
|
-
return s.component = "AFormLink", s.doctype = k(g), s;
|
|
146
|
-
}
|
|
147
|
-
const m = $[o.name];
|
|
148
|
-
return m ? s.component = m.component : (s._unmapped = !0, a.includeUnmappedMeta && (s._graphqlType = o.name)), s;
|
|
149
|
-
}
|
|
150
|
-
if (Q(o))
|
|
151
|
-
return s.component = "ADropdown", s.options = o.getValues().map((m) => m.name), s;
|
|
152
|
-
if (D(o)) {
|
|
153
|
-
if (!d && i.has(o.name))
|
|
154
|
-
return s.component = "AFormLink", s.doctype = k(o.name), s;
|
|
155
|
-
const m = fe(o);
|
|
156
|
-
return m && i.has(m) ? (s.component = "ATable", s._isLink = !0, s.doctype = k(m), s.cardinality = "noneOrMany", s) : d && i.has(o.name) ? (s.component = "ATable", s._isLink = !0, s.doctype = k(o.name), s.cardinality = "noneOrMany", s) : (s._unmapped = !0, a.includeUnmappedMeta && (s._graphqlType = o.name), s);
|
|
157
|
-
}
|
|
158
|
-
return s._unmapped = !0, a.includeUnmappedMeta && (s._graphqlType = o.name), s;
|
|
159
|
-
}
|
|
160
|
-
function ge(e) {
|
|
161
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
162
|
-
}
|
|
163
|
-
function ye(e) {
|
|
164
|
-
throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
165
|
-
}
|
|
166
|
-
var L = { exports: {} }, be = L.exports, P;
|
|
167
|
-
function $e() {
|
|
168
|
-
return P || (P = 1, (function(e, t) {
|
|
169
|
-
(function(i, a) {
|
|
170
|
-
typeof ye == "function" ? e.exports = a() : i.pluralize = a();
|
|
171
|
-
})(be, function() {
|
|
172
|
-
var i = [], a = [], o = {}, c = {}, d = {};
|
|
173
|
-
function $(r) {
|
|
174
|
-
return typeof r == "string" ? new RegExp("^" + r + "$", "i") : r;
|
|
175
|
-
}
|
|
176
|
-
function s(r, l) {
|
|
177
|
-
return r === l ? l : r === r.toLowerCase() ? l.toLowerCase() : r === r.toUpperCase() ? l.toUpperCase() : r[0] === r[0].toUpperCase() ? l.charAt(0).toUpperCase() + l.substr(1).toLowerCase() : l.toLowerCase();
|
|
178
|
-
}
|
|
179
|
-
function m(r, l) {
|
|
180
|
-
return r.replace(/\$(\d{1,2})/g, function(v, b) {
|
|
181
|
-
return l[b] || "";
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
function g(r, l) {
|
|
185
|
-
return r.replace(l[0], function(v, b) {
|
|
186
|
-
var F = m(l[1], arguments);
|
|
187
|
-
return s(v === "" ? r[b - 1] : v, F);
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
function p(r, l, v) {
|
|
191
|
-
if (!r.length || o.hasOwnProperty(r))
|
|
192
|
-
return l;
|
|
193
|
-
for (var b = v.length; b--; ) {
|
|
194
|
-
var F = v[b];
|
|
195
|
-
if (F[0].test(l)) return g(l, F);
|
|
196
|
-
}
|
|
197
|
-
return l;
|
|
198
|
-
}
|
|
199
|
-
function y(r, l, v) {
|
|
200
|
-
return function(b) {
|
|
201
|
-
var F = b.toLowerCase();
|
|
202
|
-
return l.hasOwnProperty(F) ? s(b, F) : r.hasOwnProperty(F) ? s(b, r[F]) : p(F, b, v);
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
function f(r, l, v, b) {
|
|
206
|
-
return function(F) {
|
|
207
|
-
var w = F.toLowerCase();
|
|
208
|
-
return l.hasOwnProperty(w) ? !0 : r.hasOwnProperty(w) ? !1 : p(w, w, v) === w;
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
function u(r, l, v) {
|
|
212
|
-
var b = l === 1 ? u.singular(r) : u.plural(r);
|
|
213
|
-
return (v ? l + " " : "") + b;
|
|
214
|
-
}
|
|
215
|
-
return u.plural = y(
|
|
216
|
-
d,
|
|
217
|
-
c,
|
|
218
|
-
i
|
|
219
|
-
), u.isPlural = f(
|
|
220
|
-
d,
|
|
221
|
-
c,
|
|
222
|
-
i
|
|
223
|
-
), u.singular = y(
|
|
224
|
-
c,
|
|
225
|
-
d,
|
|
226
|
-
a
|
|
227
|
-
), u.isSingular = f(
|
|
228
|
-
c,
|
|
229
|
-
d,
|
|
230
|
-
a
|
|
231
|
-
), u.addPluralRule = function(r, l) {
|
|
232
|
-
i.push([$(r), l]);
|
|
233
|
-
}, u.addSingularRule = function(r, l) {
|
|
234
|
-
a.push([$(r), l]);
|
|
235
|
-
}, u.addUncountableRule = function(r) {
|
|
236
|
-
if (typeof r == "string") {
|
|
237
|
-
o[r.toLowerCase()] = !0;
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
u.addPluralRule(r, "$0"), u.addSingularRule(r, "$0");
|
|
241
|
-
}, u.addIrregularRule = function(r, l) {
|
|
242
|
-
l = l.toLowerCase(), r = r.toLowerCase(), d[r] = l, c[l] = r;
|
|
243
|
-
}, [
|
|
244
|
-
// Pronouns.
|
|
245
|
-
["I", "we"],
|
|
246
|
-
["me", "us"],
|
|
247
|
-
["he", "they"],
|
|
248
|
-
["she", "they"],
|
|
249
|
-
["them", "them"],
|
|
250
|
-
["myself", "ourselves"],
|
|
251
|
-
["yourself", "yourselves"],
|
|
252
|
-
["itself", "themselves"],
|
|
253
|
-
["herself", "themselves"],
|
|
254
|
-
["himself", "themselves"],
|
|
255
|
-
["themself", "themselves"],
|
|
256
|
-
["is", "are"],
|
|
257
|
-
["was", "were"],
|
|
258
|
-
["has", "have"],
|
|
259
|
-
["this", "these"],
|
|
260
|
-
["that", "those"],
|
|
261
|
-
// Words ending in with a consonant and `o`.
|
|
262
|
-
["echo", "echoes"],
|
|
263
|
-
["dingo", "dingoes"],
|
|
264
|
-
["volcano", "volcanoes"],
|
|
265
|
-
["tornado", "tornadoes"],
|
|
266
|
-
["torpedo", "torpedoes"],
|
|
267
|
-
// Ends with `us`.
|
|
268
|
-
["genus", "genera"],
|
|
269
|
-
["viscus", "viscera"],
|
|
270
|
-
// Ends with `ma`.
|
|
271
|
-
["stigma", "stigmata"],
|
|
272
|
-
["stoma", "stomata"],
|
|
273
|
-
["dogma", "dogmata"],
|
|
274
|
-
["lemma", "lemmata"],
|
|
275
|
-
["schema", "schemata"],
|
|
276
|
-
["anathema", "anathemata"],
|
|
277
|
-
// Other irregular rules.
|
|
278
|
-
["ox", "oxen"],
|
|
279
|
-
["axe", "axes"],
|
|
280
|
-
["die", "dice"],
|
|
281
|
-
["yes", "yeses"],
|
|
282
|
-
["foot", "feet"],
|
|
283
|
-
["eave", "eaves"],
|
|
284
|
-
["goose", "geese"],
|
|
285
|
-
["tooth", "teeth"],
|
|
286
|
-
["quiz", "quizzes"],
|
|
287
|
-
["human", "humans"],
|
|
288
|
-
["proof", "proofs"],
|
|
289
|
-
["carve", "carves"],
|
|
290
|
-
["valve", "valves"],
|
|
291
|
-
["looey", "looies"],
|
|
292
|
-
["thief", "thieves"],
|
|
293
|
-
["groove", "grooves"],
|
|
294
|
-
["pickaxe", "pickaxes"],
|
|
295
|
-
["passerby", "passersby"]
|
|
296
|
-
].forEach(function(r) {
|
|
297
|
-
return u.addIrregularRule(r[0], r[1]);
|
|
298
|
-
}), [
|
|
299
|
-
[/s?$/i, "s"],
|
|
300
|
-
[/[^\u0000-\u007F]$/i, "$0"],
|
|
301
|
-
[/([^aeiou]ese)$/i, "$1"],
|
|
302
|
-
[/(ax|test)is$/i, "$1es"],
|
|
303
|
-
[/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"],
|
|
304
|
-
[/(e[mn]u)s?$/i, "$1s"],
|
|
305
|
-
[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"],
|
|
306
|
-
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1i"],
|
|
307
|
-
[/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"],
|
|
308
|
-
[/(seraph|cherub)(?:im)?$/i, "$1im"],
|
|
309
|
-
[/(her|at|gr)o$/i, "$1oes"],
|
|
310
|
-
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, "$1a"],
|
|
311
|
-
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, "$1a"],
|
|
312
|
-
[/sis$/i, "ses"],
|
|
313
|
-
[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"],
|
|
314
|
-
[/([^aeiouy]|qu)y$/i, "$1ies"],
|
|
315
|
-
[/([^ch][ieo][ln])ey$/i, "$1ies"],
|
|
316
|
-
[/(x|ch|ss|sh|zz)$/i, "$1es"],
|
|
317
|
-
[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"],
|
|
318
|
-
[/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"],
|
|
319
|
-
[/(pe)(?:rson|ople)$/i, "$1ople"],
|
|
320
|
-
[/(child)(?:ren)?$/i, "$1ren"],
|
|
321
|
-
[/eaux$/i, "$0"],
|
|
322
|
-
[/m[ae]n$/i, "men"],
|
|
323
|
-
["thou", "you"]
|
|
324
|
-
].forEach(function(r) {
|
|
325
|
-
return u.addPluralRule(r[0], r[1]);
|
|
326
|
-
}), [
|
|
327
|
-
[/s$/i, ""],
|
|
328
|
-
[/(ss)$/i, "$1"],
|
|
329
|
-
[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"],
|
|
330
|
-
[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"],
|
|
331
|
-
[/ies$/i, "y"],
|
|
332
|
-
[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, "$1ie"],
|
|
333
|
-
[/\b(mon|smil)ies$/i, "$1ey"],
|
|
334
|
-
[/\b((?:tit)?m|l)ice$/i, "$1ouse"],
|
|
335
|
-
[/(seraph|cherub)im$/i, "$1"],
|
|
336
|
-
[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, "$1"],
|
|
337
|
-
[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, "$1sis"],
|
|
338
|
-
[/(movie|twelve|abuse|e[mn]u)s$/i, "$1"],
|
|
339
|
-
[/(test)(?:is|es)$/i, "$1is"],
|
|
340
|
-
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1us"],
|
|
341
|
-
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, "$1um"],
|
|
342
|
-
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, "$1on"],
|
|
343
|
-
[/(alumn|alg|vertebr)ae$/i, "$1a"],
|
|
344
|
-
[/(cod|mur|sil|vert|ind)ices$/i, "$1ex"],
|
|
345
|
-
[/(matr|append)ices$/i, "$1ix"],
|
|
346
|
-
[/(pe)(rson|ople)$/i, "$1rson"],
|
|
347
|
-
[/(child)ren$/i, "$1"],
|
|
348
|
-
[/(eau)x?$/i, "$1"],
|
|
349
|
-
[/men$/i, "man"]
|
|
350
|
-
].forEach(function(r) {
|
|
351
|
-
return u.addSingularRule(r[0], r[1]);
|
|
352
|
-
}), [
|
|
353
|
-
// Singular words with no plurals.
|
|
354
|
-
"adulthood",
|
|
355
|
-
"advice",
|
|
356
|
-
"agenda",
|
|
357
|
-
"aid",
|
|
358
|
-
"aircraft",
|
|
359
|
-
"alcohol",
|
|
360
|
-
"ammo",
|
|
361
|
-
"analytics",
|
|
362
|
-
"anime",
|
|
363
|
-
"athletics",
|
|
364
|
-
"audio",
|
|
365
|
-
"bison",
|
|
366
|
-
"blood",
|
|
367
|
-
"bream",
|
|
368
|
-
"buffalo",
|
|
369
|
-
"butter",
|
|
370
|
-
"carp",
|
|
371
|
-
"cash",
|
|
372
|
-
"chassis",
|
|
373
|
-
"chess",
|
|
374
|
-
"clothing",
|
|
375
|
-
"cod",
|
|
376
|
-
"commerce",
|
|
377
|
-
"cooperation",
|
|
378
|
-
"corps",
|
|
379
|
-
"debris",
|
|
380
|
-
"diabetes",
|
|
381
|
-
"digestion",
|
|
382
|
-
"elk",
|
|
383
|
-
"energy",
|
|
384
|
-
"equipment",
|
|
385
|
-
"excretion",
|
|
386
|
-
"expertise",
|
|
387
|
-
"firmware",
|
|
388
|
-
"flounder",
|
|
389
|
-
"fun",
|
|
390
|
-
"gallows",
|
|
391
|
-
"garbage",
|
|
392
|
-
"graffiti",
|
|
393
|
-
"hardware",
|
|
394
|
-
"headquarters",
|
|
395
|
-
"health",
|
|
396
|
-
"herpes",
|
|
397
|
-
"highjinks",
|
|
398
|
-
"homework",
|
|
399
|
-
"housework",
|
|
400
|
-
"information",
|
|
401
|
-
"jeans",
|
|
402
|
-
"justice",
|
|
403
|
-
"kudos",
|
|
404
|
-
"labour",
|
|
405
|
-
"literature",
|
|
406
|
-
"machinery",
|
|
407
|
-
"mackerel",
|
|
408
|
-
"mail",
|
|
409
|
-
"media",
|
|
410
|
-
"mews",
|
|
411
|
-
"moose",
|
|
412
|
-
"music",
|
|
413
|
-
"mud",
|
|
414
|
-
"manga",
|
|
415
|
-
"news",
|
|
416
|
-
"only",
|
|
417
|
-
"personnel",
|
|
418
|
-
"pike",
|
|
419
|
-
"plankton",
|
|
420
|
-
"pliers",
|
|
421
|
-
"police",
|
|
422
|
-
"pollution",
|
|
423
|
-
"premises",
|
|
424
|
-
"rain",
|
|
425
|
-
"research",
|
|
426
|
-
"rice",
|
|
427
|
-
"salmon",
|
|
428
|
-
"scissors",
|
|
429
|
-
"series",
|
|
430
|
-
"sewage",
|
|
431
|
-
"shambles",
|
|
432
|
-
"shrimp",
|
|
433
|
-
"software",
|
|
434
|
-
"species",
|
|
435
|
-
"staff",
|
|
436
|
-
"swine",
|
|
437
|
-
"tennis",
|
|
438
|
-
"traffic",
|
|
439
|
-
"transportation",
|
|
440
|
-
"trout",
|
|
441
|
-
"tuna",
|
|
442
|
-
"wealth",
|
|
443
|
-
"welfare",
|
|
444
|
-
"whiting",
|
|
445
|
-
"wildebeest",
|
|
446
|
-
"wildlife",
|
|
447
|
-
"you",
|
|
448
|
-
/pok[eé]mon$/i,
|
|
449
|
-
// Regexes.
|
|
450
|
-
/[^aeiou]ese$/i,
|
|
451
|
-
// "chinese", "japanese"
|
|
452
|
-
/deer$/i,
|
|
453
|
-
// "deer", "reindeer"
|
|
454
|
-
/fish$/i,
|
|
455
|
-
// "fish", "blowfish", "angelfish"
|
|
456
|
-
/measles$/i,
|
|
457
|
-
/o[iu]s$/i,
|
|
458
|
-
// "carnivorous"
|
|
459
|
-
/pox$/i,
|
|
460
|
-
// "chickpox", "smallpox"
|
|
461
|
-
/sheep$/i
|
|
462
|
-
].forEach(u.addUncountableRule), u;
|
|
463
|
-
});
|
|
464
|
-
})(L)), L.exports;
|
|
465
|
-
}
|
|
466
|
-
var Fe = $e();
|
|
467
|
-
const ve = /* @__PURE__ */ ge(Fe), we = n.object({
|
|
468
|
-
/** The table view type */
|
|
469
|
-
view: n.enum(["list", "uncounted", "list-expansion", "tree", "gantt", "tree-gantt"]).optional(),
|
|
470
|
-
/** Allow the table to use the full width of its container */
|
|
471
|
-
fullWidth: n.boolean().optional(),
|
|
472
|
-
/** Default expansion state for tree views */
|
|
473
|
-
defaultTreeExpansion: n.enum(["root", "branch", "leaf"]).optional(),
|
|
474
|
-
/** Enable dependency graph connections for Gantt views */
|
|
475
|
-
dependencyGraph: n.boolean().optional()
|
|
476
|
-
}).meta({
|
|
477
|
-
title: "TableViewConfig",
|
|
478
|
-
description: "JSON-safe view configuration for table fields in doctype authoring"
|
|
479
|
-
}), Se = n.union([
|
|
480
|
-
n.array(n.string()),
|
|
481
|
-
// Select choices: ["A", "B", "C"]
|
|
482
|
-
n.record(n.string(), n.unknown())
|
|
483
|
-
// Config: \{ precision: 10, scale: 2 \}
|
|
484
|
-
]).meta({
|
|
485
|
-
title: "FieldOptions",
|
|
486
|
-
description: "Field options - flexible bag for type-specific configuration"
|
|
487
|
-
}), ke = n.looseObject({
|
|
488
|
-
/** Error message to display when validation fails */
|
|
489
|
-
errorMessage: n.string()
|
|
490
|
-
}).meta({
|
|
491
|
-
title: "FieldValidation",
|
|
492
|
-
description: "Validation configuration for form fields"
|
|
493
|
-
});
|
|
494
|
-
function z(e) {
|
|
495
|
-
return typeof e != "object" || e === null || Array.isArray(e) ? "field" : "schema" in e ? "fieldset" : "columns" in e ? "table" : "field";
|
|
496
|
-
}
|
|
497
|
-
function M(e) {
|
|
498
|
-
if (typeof e != "object" || e === null || Array.isArray(e)) return e;
|
|
499
|
-
const t = e;
|
|
500
|
-
return "kind" in t ? e : { kind: z(t), ...t };
|
|
501
|
-
}
|
|
502
|
-
function Ae(e) {
|
|
503
|
-
const t = M(e);
|
|
504
|
-
if (typeof t != "object" || t === null) return t;
|
|
505
|
-
const i = t;
|
|
506
|
-
return i.kind === "fieldset" && Array.isArray(i.schema) ? { ...i, schema: i.schema.map(Ae) } : t;
|
|
507
|
-
}
|
|
508
|
-
function Te(e) {
|
|
509
|
-
if (typeof e != "object" || e === null || Array.isArray(e)) return e;
|
|
510
|
-
const t = e;
|
|
511
|
-
if (t.kind !== void 0 && t.kind !== z(t)) return e;
|
|
512
|
-
const { kind: i, ...a } = t;
|
|
513
|
-
return Array.isArray(a.schema) ? { ...a, schema: a.schema.map(Te) } : a;
|
|
514
|
-
}
|
|
515
|
-
const De = [
|
|
516
|
-
"fieldname",
|
|
517
|
-
"primaryKey",
|
|
518
|
-
"required",
|
|
519
|
-
"options",
|
|
520
|
-
"cardinality",
|
|
521
|
-
"doctype"
|
|
522
|
-
];
|
|
523
|
-
function N(e) {
|
|
524
|
-
return T(e).find((t) => t.kind === "field" && !!t.primaryKey);
|
|
525
|
-
}
|
|
526
|
-
function je(e, t) {
|
|
527
|
-
if (t)
|
|
528
|
-
return T(e).find(
|
|
529
|
-
(i) => i.kind === "field" && !i.computed && i.fieldname === t
|
|
530
|
-
);
|
|
531
|
-
}
|
|
532
|
-
function tt(e) {
|
|
533
|
-
return N(e)?.fieldname ?? "id";
|
|
534
|
-
}
|
|
535
|
-
function nt(e, t) {
|
|
536
|
-
const i = N(e), a = i ? [t[i.fieldname], t.id] : [t.id];
|
|
537
|
-
for (const o of a) {
|
|
538
|
-
if (typeof o == "number") return String(o);
|
|
539
|
-
if (typeof o == "string" && o !== "") return o;
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
function Le() {
|
|
543
|
-
const e = n.object({
|
|
544
|
-
kind: n.literal("field"),
|
|
545
|
-
fieldname: n.string().min(1),
|
|
546
|
-
component: n.string().min(1),
|
|
547
|
-
primaryKey: n.boolean().optional(),
|
|
548
|
-
computed: n.boolean().optional(),
|
|
549
|
-
language: n.string().optional(),
|
|
550
|
-
doctype: n.string().min(1).optional(),
|
|
551
|
-
label: n.string().optional(),
|
|
552
|
-
width: n.string().optional(),
|
|
553
|
-
height: n.string().optional(),
|
|
554
|
-
align: n.enum(["left", "center", "right", "start", "end"]).optional(),
|
|
555
|
-
edit: n.boolean().optional(),
|
|
556
|
-
mask: n.string().optional(),
|
|
557
|
-
format: n.string().optional(),
|
|
558
|
-
mode: n.enum(["edit", "read", "display"]).optional(),
|
|
559
|
-
options: Se.optional(),
|
|
560
|
-
required: n.boolean().optional(),
|
|
561
|
-
readOnly: n.boolean().optional(),
|
|
562
|
-
hidden: n.boolean().optional(),
|
|
563
|
-
default: n.unknown().optional(),
|
|
564
|
-
validation: ke.optional(),
|
|
565
|
-
cardinality: n.enum(["atMostOne", "one", "noneOrMany", "atLeastOne"]).optional(),
|
|
566
|
-
source: n.literal("introspected").optional()
|
|
567
|
-
}).meta({ title: "ValueField" }), t = n.object({
|
|
568
|
-
kind: n.literal("table"),
|
|
569
|
-
fieldname: n.string().min(1),
|
|
570
|
-
component: n.string().optional(),
|
|
571
|
-
label: n.string().optional(),
|
|
572
|
-
// Validates that each column has fieldname; allows all other ColumnSchema properties
|
|
573
|
-
columns: n.array(n.object({ fieldname: n.string().min(1) }).passthrough()),
|
|
574
|
-
config: we.optional(),
|
|
575
|
-
mode: n.enum(["edit", "read", "display"]).optional()
|
|
576
|
-
}).meta({ title: "TableField" });
|
|
577
|
-
let i = n.never();
|
|
578
|
-
const a = n.object({
|
|
579
|
-
kind: n.literal("fieldset"),
|
|
580
|
-
fieldname: n.string().min(1),
|
|
581
|
-
component: n.string().optional(),
|
|
582
|
-
label: n.string().optional(),
|
|
583
|
-
collapsible: n.boolean().optional(),
|
|
584
|
-
mode: n.enum(["edit", "read", "display"]).optional(),
|
|
585
|
-
schema: n.lazy(() => i.array())
|
|
586
|
-
}).meta({ title: "FieldsetField" }), o = n.discriminatedUnion("kind", [e, a, t]);
|
|
587
|
-
return i = n.preprocess(M, o), { ValueFieldSchema: e, TableFieldSchema: t, FieldsetFieldSchema: a, DoctypeFieldSchema: i };
|
|
588
|
-
}
|
|
589
|
-
const _ = Le(), it = _.ValueFieldSchema, at = _.FieldsetFieldSchema, ot = _.TableFieldSchema, q = _.DoctypeFieldSchema, Ie = n.enum(["atMostOne", "one", "noneOrMany", "atLeastOne"]).meta({
|
|
590
|
-
title: "Cardinality",
|
|
591
|
-
description: "Cardinality for relationship links between doctypes"
|
|
592
|
-
}), Ce = n.object({
|
|
593
|
-
/** Fetch method type */
|
|
594
|
-
method: n.literal("sync"),
|
|
595
|
-
/** Optional limit on number of records to fetch */
|
|
596
|
-
limit: n.number().int().positive().optional()
|
|
597
|
-
}).meta({
|
|
598
|
-
title: "SyncFetch",
|
|
599
|
-
description: "Sync fetch strategy - data is fetched in the initial query"
|
|
600
|
-
}), _e = n.object({
|
|
601
|
-
/** Fetch method type */
|
|
602
|
-
method: n.literal("lazy")
|
|
603
|
-
}).meta({
|
|
604
|
-
title: "LazyFetch",
|
|
605
|
-
description: "Lazy fetch strategy - data is fetched on demand in a separate query"
|
|
606
|
-
}), Oe = n.object({
|
|
607
|
-
/** Fetch method type */
|
|
608
|
-
method: n.literal("custom"),
|
|
609
|
-
/** Serialized handler function to invoke */
|
|
610
|
-
handler: n.string()
|
|
611
|
-
}).meta({
|
|
612
|
-
title: "CustomFetch",
|
|
613
|
-
description: "Custom fetch strategy - uses a custom handler function"
|
|
614
|
-
}), xe = n.discriminatedUnion("method", [Ce, _e, Oe]).meta({
|
|
615
|
-
title: "FetchStrategy",
|
|
616
|
-
description: "Fetch strategy for link data loading"
|
|
617
|
-
}), Ne = n.object({
|
|
618
|
-
/** Target doctype slug */
|
|
619
|
-
target: n.string().min(1),
|
|
620
|
-
/** Cardinality of the relationship */
|
|
621
|
-
cardinality: Ie,
|
|
622
|
-
/** Backlink fieldname on the target doctype that points back to this link */
|
|
623
|
-
backlink: n.string().optional(),
|
|
624
|
-
/** Override default rendering component (AForm for 1:1, ATable for 1:many) */
|
|
625
|
-
component: n.string().optional(),
|
|
626
|
-
/** Fieldname of the corresponding Link field in the fields array */
|
|
627
|
-
fieldname: n.string().min(1).optional(),
|
|
628
|
-
/** Fetch strategy for loading nested data */
|
|
629
|
-
fetch: xe.optional(),
|
|
630
|
-
/** Whether to block workflow actions until nested data is loaded (default: true) */
|
|
631
|
-
blockWorkflows: n.boolean().optional()
|
|
632
|
-
}).meta({
|
|
633
|
-
title: "LinkDeclaration",
|
|
634
|
-
description: "Declares a relationship from one doctype to another"
|
|
635
|
-
}), qe = n.object({
|
|
636
|
-
/** Display label for the action */
|
|
637
|
-
label: n.string().min(1),
|
|
638
|
-
/** Fields that must have values before action can execute */
|
|
639
|
-
requiredFields: n.array(n.string()).optional(),
|
|
640
|
-
/** Workflow states where this action is available */
|
|
641
|
-
allowedStates: n.array(n.string()).optional(),
|
|
642
|
-
/** The state the record transitions to after this action executes */
|
|
643
|
-
nextState: n.string().optional(),
|
|
644
|
-
/** True for stateless command actions with no workflow effect at all (print, email, etc.) */
|
|
645
|
-
stateless: n.boolean().optional(),
|
|
646
|
-
/**
|
|
647
|
-
* True for an internal self-transition: the action runs within the current state without
|
|
648
|
-
* advancing the workflow (e.g. `save`, which mutates record data but stays put). Scoped by
|
|
649
|
-
* `allowedStates`, rendered as a self-loop in the graph, and has no `nextState`. Distinct from
|
|
650
|
-
* `stateless` (which has no workflow presence at all): a self-transition is graph-owned and,
|
|
651
|
-
* unlike a stateless command, persists record data on dispatch.
|
|
652
|
-
*/
|
|
653
|
-
selfTransition: n.boolean().optional(),
|
|
654
|
-
/** JS function body stored as a string; executed client-side via AsyncFunction with injected API surface */
|
|
655
|
-
clientHandler: n.string().optional()
|
|
656
|
-
}).meta({
|
|
657
|
-
title: "ActionDefinition",
|
|
658
|
-
description: "Action definition within a workflow"
|
|
659
|
-
}), Re = n.object({
|
|
660
|
-
/** Optional display label; the map key is the trigger's identity */
|
|
661
|
-
label: n.string().optional(),
|
|
662
|
-
/** Fieldnames whose edits fire this trigger (fires when any listed field changes) */
|
|
663
|
-
on: n.array(n.string()),
|
|
664
|
-
/** JS function body stored as a string; run client-side with `{ record, value, setError }`. Advisory. */
|
|
665
|
-
clientHandler: n.string()
|
|
666
|
-
}).meta({
|
|
667
|
-
title: "TriggerDefinition",
|
|
668
|
-
description: "Reactive field-validation trigger — advisory client-side"
|
|
669
|
-
});
|
|
670
|
-
function rt(e, t) {
|
|
671
|
-
const i = e.allowedStates;
|
|
672
|
-
return !i || i.length === 0 ? !0 : i.includes(t);
|
|
673
|
-
}
|
|
674
|
-
const Ee = n.record(
|
|
675
|
-
n.string(),
|
|
676
|
-
n.object({
|
|
677
|
-
position: n.object({ x: n.number(), y: n.number() }).optional(),
|
|
678
|
-
targetPosition: n.enum(["left", "top", "right", "bottom"]).optional(),
|
|
679
|
-
sourcePosition: n.enum(["left", "top", "right", "bottom"]).optional()
|
|
680
|
-
})
|
|
681
|
-
), Pe = n.object({
|
|
682
|
-
/** List of workflow states */
|
|
683
|
-
states: n.array(n.string()).optional(),
|
|
684
|
-
/** Actions available in this workflow */
|
|
685
|
-
actions: n.record(n.string(), qe).optional(),
|
|
686
|
-
/** Reactive field-validation triggers (advisory, client-side), keyed by trigger name */
|
|
687
|
-
triggers: n.record(n.string(), Re).optional(),
|
|
688
|
-
/**
|
|
689
|
-
* DocBuilder node positions keyed by state name — authoring view-state. Persisted here so a
|
|
690
|
-
* doctype author's manual graph arrangement survives reloads; like `triggers`, it is client-only
|
|
691
|
-
* and never enters the runtime GraphQL SDL. See {@link (WorkflowLayout:variable)}.
|
|
692
|
-
*/
|
|
693
|
-
layout: Ee.optional()
|
|
694
|
-
}).meta({
|
|
695
|
-
title: "WorkflowMeta",
|
|
696
|
-
description: "Workflow metadata - states and actions for a doctype"
|
|
697
|
-
}), U = n.object({
|
|
698
|
-
/** Display name of the doctype */
|
|
699
|
-
name: n.string().min(1),
|
|
700
|
-
/** URL-friendly slug (kebab-case) */
|
|
701
|
-
slug: n.string().min(1).optional(),
|
|
702
|
-
/**
|
|
703
|
-
* Field on this doctype used when displaying a reference to one of its records.
|
|
704
|
-
* When a record elsewhere holds an inline foreign key to this doctype, the middleware
|
|
705
|
-
* returns that field as `{ id, displayText }`, reading `displayText` from this field.
|
|
706
|
-
*/
|
|
707
|
-
displayField: n.string().min(1).optional(),
|
|
708
|
-
/**
|
|
709
|
-
* URL path this doctype registers at, written literally — `/order` for a collection,
|
|
710
|
-
* `/order/:id` for a record. Absent means the doctype has no page of its own, which is the
|
|
711
|
-
* common case: a child table is reached inside its parent, never at a URL.
|
|
712
|
-
*
|
|
713
|
-
* A path rather than a segment because the record parameter has to be somewhere, and a host
|
|
714
|
-
* that reads a bare segment has to know which kind of doctype it is holding to decide where
|
|
715
|
-
* to put it. Writing it out means nothing downstream re-derives it.
|
|
716
|
-
*/
|
|
717
|
-
route: n.string().startsWith("/").optional(),
|
|
718
|
-
/** Field definitions (a link field is one carrying `doctype`) */
|
|
719
|
-
fields: n.array(q),
|
|
720
|
-
/** Relationship links to other doctypes */
|
|
721
|
-
links: n.record(n.string(), Ne).optional(),
|
|
722
|
-
/** Workflow configuration */
|
|
723
|
-
workflow: Pe.optional(),
|
|
724
|
-
/** Parent doctype for inheritance */
|
|
725
|
-
inherits: n.string().optional()
|
|
726
|
-
}).meta({
|
|
727
|
-
title: "DoctypeMeta",
|
|
728
|
-
description: "Doctype metadata - complete definition of a doctype"
|
|
729
|
-
}).superRefine((e, t) => {
|
|
730
|
-
const i = T(e.fields).filter((a) => a.kind === "field" && a.primaryKey);
|
|
731
|
-
if (i.length > 1 && t.addIssue({
|
|
732
|
-
code: "custom",
|
|
733
|
-
path: ["fields"],
|
|
734
|
-
message: `Doctype declares ${i.length} primaryKey fields (${i.map((a) => a.kind === "field" ? a.fieldname : "").join(
|
|
735
|
-
", "
|
|
736
|
-
)}); a record is identified by exactly one field. A composite database key is mapped to a single identity by the adapter, so a doctype never declares its parts`
|
|
737
|
-
}), e.displayField && !je(e.fields, e.displayField)) {
|
|
738
|
-
const a = T(e.fields).find((o) => o.fieldname === e.displayField);
|
|
739
|
-
t.addIssue({
|
|
740
|
-
code: "custom",
|
|
741
|
-
path: ["displayField"],
|
|
742
|
-
message: a ? `displayField "${e.displayField}" names a computed field, which has no column to read a display value from` : `displayField "${e.displayField}" is not declared on this doctype`
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
});
|
|
746
|
-
function K(e) {
|
|
747
|
-
return e.slug || k(e.name);
|
|
748
|
-
}
|
|
749
|
-
const ze = "__display";
|
|
750
|
-
function st(e) {
|
|
751
|
-
return `${e}${ze}`;
|
|
752
|
-
}
|
|
753
|
-
function W(e) {
|
|
754
|
-
return ve.plural(e);
|
|
755
|
-
}
|
|
756
|
-
function Me(e, t) {
|
|
757
|
-
const i = Ue(e.fields, t);
|
|
758
|
-
if (!i) return;
|
|
759
|
-
const a = W(e.name);
|
|
760
|
-
if (a === e.name) return;
|
|
761
|
-
const { source: o, ...c } = i;
|
|
762
|
-
return {
|
|
763
|
-
name: a,
|
|
764
|
-
slug: k(a),
|
|
765
|
-
fields: [{ ...c, primaryKey: !0, ...o === void 0 ? {} : { source: o } }]
|
|
766
|
-
};
|
|
767
|
-
}
|
|
768
|
-
function Ue(e, t) {
|
|
769
|
-
return t !== void 0 ? e.find((i) => i.fieldname === t) : N(e) ?? e.find((i) => i.fieldname === "id");
|
|
770
|
-
}
|
|
771
|
-
function Ke(e) {
|
|
772
|
-
const t = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
773
|
-
for (const a of e) {
|
|
774
|
-
for (const o of Object.values(a.links ?? {}))
|
|
775
|
-
o.cardinality === "noneOrMany" || o.cardinality === "atLeastOne" ? t.add(o.target) : i.add(o.target);
|
|
776
|
-
for (const o of T(a.fields))
|
|
777
|
-
"doctype" in o && typeof o.doctype == "string" && i.add(o.doctype);
|
|
778
|
-
}
|
|
779
|
-
return new Set(
|
|
780
|
-
e.filter((a) => {
|
|
781
|
-
const o = K(a);
|
|
782
|
-
return i.has(o) || !t.has(o);
|
|
783
|
-
}).map((a) => a.name)
|
|
784
|
-
);
|
|
785
|
-
}
|
|
786
|
-
function lt(e, t = {}) {
|
|
787
|
-
const i = new Set(e.map((c) => c.name)), a = /* @__PURE__ */ new Set(), o = Ke(e);
|
|
788
|
-
return e.flatMap((c) => {
|
|
789
|
-
const d = `/${K(c)}`, $ = o.has(c.name) ? { ...c, route: `${d}/:id` } : c, s = { generated: $, basis: $, subset: !1 };
|
|
790
|
-
if (t.noAggregates) return [s];
|
|
791
|
-
const m = W(c.name);
|
|
792
|
-
if (m === c.name)
|
|
793
|
-
return t.onWarning?.(
|
|
794
|
-
`${c.name} is already plural, so its aggregate would take the same name and the same file. No aggregate was generated. Rename the doctype to its singular form, or author ${c.slug}.json's collection view by hand.`
|
|
795
|
-
), [s];
|
|
796
|
-
if (i.has(m) || a.has(m))
|
|
797
|
-
return t.onWarning?.(
|
|
798
|
-
`${c.name}'s aggregate would be named ${m}, which is already taken by another doctype in this run. No aggregate was generated — one of the two needs an explicit name via the doctypeNames option.`
|
|
799
|
-
), [s];
|
|
800
|
-
const g = t.identity?.[c.name];
|
|
801
|
-
if (g !== void 0 && !c.fields.some((f) => f.fieldname === g))
|
|
802
|
-
return t.onWarning?.(
|
|
803
|
-
`${c.name} declares its primaryKey on '${g}', which the schema has no column for. No aggregate was generated — correct the declaration in ${c.slug}.json, or restore the column to the table.`
|
|
804
|
-
), [s];
|
|
805
|
-
const p = Me(c, g);
|
|
806
|
-
if (!p)
|
|
807
|
-
return t.onWarning?.(
|
|
808
|
-
`${c.name} has no derivable identity column, so no aggregate doctype was generated. Declare a primaryKey on ${c.slug}.json and re-run.`
|
|
809
|
-
), [s];
|
|
810
|
-
a.add(m);
|
|
811
|
-
const y = o.has(c.name) ? { ...p, route: d } : p;
|
|
812
|
-
return [s, { generated: y, basis: c, subset: !0 }];
|
|
813
|
-
});
|
|
814
|
-
}
|
|
815
|
-
function j(e) {
|
|
816
|
-
return e === void 0 ? "—" : JSON.stringify(e);
|
|
817
|
-
}
|
|
818
|
-
function ct(e, t, i = {}) {
|
|
819
|
-
const a = Array.isArray(e.fields) ? e.fields.filter(I) : [], o = new Map(t.fields.map((p) => [p.fieldname, p])), c = new Set(Object.keys(t.links ?? {})), d = {
|
|
820
|
-
doctype: typeof e.name == "string" ? e.name : "(unnamed)",
|
|
821
|
-
mode: "clean",
|
|
822
|
-
tagged: [],
|
|
823
|
-
orphan: [],
|
|
824
|
-
omitted: [],
|
|
825
|
-
componentDrift: [],
|
|
826
|
-
requiredDrift: [],
|
|
827
|
-
identityDrift: []
|
|
828
|
-
}, $ = (p) => {
|
|
829
|
-
if (Array.isArray(p.schema))
|
|
830
|
-
return { ...p, schema: p.schema.filter(I).map($) };
|
|
831
|
-
const y = typeof p.fieldname == "string" ? p.fieldname : "", f = o.get(y);
|
|
832
|
-
if (!f)
|
|
833
|
-
return p.computed !== !0 && !c.has(y) && d.orphan.push(y), p;
|
|
834
|
-
d.tagged.push(y), f.component !== p.component && d.componentDrift.push(`${y}: authored=${j(p.component)} schema=${j(f.component)}`), !!f.required != !!p.required && d.requiredDrift.push(`${y}: authored=${!!p.required} schema=${!!f.required}`);
|
|
835
|
-
for (const u of De) {
|
|
836
|
-
if (u === "fieldname" || u === "required") continue;
|
|
837
|
-
const r = p[u], l = f[u];
|
|
838
|
-
r === void 0 && l === void 0 || JSON.stringify(r) !== JSON.stringify(l) && d.identityDrift.push(`${y}.${u}: authored=${j(r)} schema=${j(l)}`);
|
|
839
|
-
}
|
|
840
|
-
return { ...p, source: "introspected" };
|
|
841
|
-
}, s = { ...e, fields: a.map($) };
|
|
842
|
-
if (!i.subset) {
|
|
843
|
-
const p = new Set(x(a).map((y) => y.fieldname));
|
|
844
|
-
d.omitted = t.fields.map((y) => y.fieldname).filter((y) => !p.has(y));
|
|
845
|
-
}
|
|
846
|
-
const m = ee(e), g = t.fields.find((p) => p.primaryKey === !0);
|
|
847
|
-
return m && g && m !== g.fieldname ? (d.mode = "partial", d.reason = `authored primary key '${m}' is not the derivable '${g.fieldname}' — left as authored`) : m && !g ? (d.mode = "partial", d.reason = `authored primary key '${m}' is not derivable from the schema — left as authored`) : !m && g && (d.mode = "partial", d.reason = `schema suggests '${g.fieldname}' as primary key but the doctype declares none — not applied`), { doctype: s, drift: d };
|
|
848
|
-
}
|
|
849
|
-
function ut(e) {
|
|
850
|
-
const t = [];
|
|
851
|
-
e.reason && t.push(` ${e.doctype}: ${e.reason}`);
|
|
852
|
-
const i = (a, o) => {
|
|
853
|
-
o.length && t.push(` ${e.doctype}: ${a} ${o.join("; ")}`);
|
|
854
|
-
};
|
|
855
|
-
return i("identity drift", e.identityDrift), i("component drift", e.componentDrift), i("required drift", e.requiredDrift), i("authored fields with no schema field:", e.orphan), i("schema fields not modelled:", e.omitted), t;
|
|
856
|
-
}
|
|
857
|
-
function dt(e, t = {}) {
|
|
858
|
-
const i = We(e), a = i.getTypeMap(), o = /* @__PURE__ */ new Set(), c = i.getQueryType(), d = i.getMutationType(), $ = i.getSubscriptionType();
|
|
859
|
-
c && o.add(c.name), d && o.add(d.name), $ && o.add($.name);
|
|
860
|
-
const s = t.isEntityType ?? ce, m = /* @__PURE__ */ new Set();
|
|
861
|
-
for (const [f, u] of Object.entries(a))
|
|
862
|
-
D(u) && (o.has(f) || s(f, u) && m.add(f));
|
|
863
|
-
let g = m;
|
|
864
|
-
if (t.include) {
|
|
865
|
-
const f = new Set(t.include);
|
|
866
|
-
g = new Set([...m].filter((u) => f.has(u)));
|
|
867
|
-
}
|
|
868
|
-
if (t.exclude) {
|
|
869
|
-
const f = new Set(t.exclude);
|
|
870
|
-
g = new Set([...g].filter((u) => !f.has(u)));
|
|
871
|
-
}
|
|
872
|
-
const p = t.isEntityField ?? me, y = [];
|
|
873
|
-
for (const f of g) {
|
|
874
|
-
const u = a[f];
|
|
875
|
-
if (!D(u)) continue;
|
|
876
|
-
const r = u.getFields(), l = "id" in r && "rowId" in r;
|
|
877
|
-
l && t.onWarning?.(
|
|
878
|
-
`${f}: schema exposes both 'id' (Relay identifier) and 'rowId' (the real column). Skipping 'id' and emitting 'rowId' verbatim — no primary key can be derived. Override the '_attributeName' and 'nodeIdFieldName' inflectors so the column keeps its own name.`
|
|
879
|
-
);
|
|
880
|
-
const b = Object.entries(r).filter(
|
|
881
|
-
([h, S]) => p(h, S, u) && !(l && h === "id")
|
|
882
|
-
).map(([h, S]) => {
|
|
883
|
-
if (t.classifyField) {
|
|
884
|
-
const A = t.classifyField(h, S, u);
|
|
885
|
-
if (A != null)
|
|
886
|
-
return {
|
|
887
|
-
kind: "field",
|
|
888
|
-
fieldname: h,
|
|
889
|
-
label: A.label ?? h,
|
|
890
|
-
component: A.component ?? "ATextInput",
|
|
891
|
-
...A
|
|
892
|
-
};
|
|
893
|
-
}
|
|
894
|
-
return he(h, S, m, t);
|
|
895
|
-
}), F = b.find(
|
|
896
|
-
(h) => h.fieldname === "id" && h.required && !h.doctype && !h._isLink
|
|
897
|
-
)?.fieldname, w = {}, V = b.filter((h) => h._isLink && h.doctype && h.cardinality ? (w[h.fieldname] = {
|
|
898
|
-
target: h.doctype,
|
|
899
|
-
cardinality: h.cardinality
|
|
900
|
-
}, !1) : !0).map((h) => {
|
|
901
|
-
const S = h.fieldname === F ? { primaryKey: !0 } : {};
|
|
902
|
-
if (!t.includeUnmappedMeta) {
|
|
903
|
-
const { _graphqlType: Ve, _unmapped: Be, _isLink: Ge, ...G } = h;
|
|
904
|
-
return Object.assign(G, S, { source: "introspected" });
|
|
905
|
-
}
|
|
906
|
-
const { _isLink: A, ...B } = h;
|
|
907
|
-
return Object.assign(B, S, { source: "introspected" });
|
|
908
|
-
}), R = t.doctypeNames?.[f] ?? f, O = {
|
|
909
|
-
name: R,
|
|
910
|
-
slug: k(R),
|
|
911
|
-
fields: V
|
|
912
|
-
};
|
|
913
|
-
Object.keys(w).length > 0 && (O.links = w), t.includeUnmappedMeta && (O._graphqlTypeName = f), y.push(O);
|
|
914
|
-
}
|
|
915
|
-
return y;
|
|
916
|
-
}
|
|
917
|
-
function We(e) {
|
|
918
|
-
return typeof e == "string" ? Z(e) : X(e);
|
|
919
|
-
}
|
|
920
|
-
function pt(e) {
|
|
921
|
-
const t = q.safeParse(e);
|
|
922
|
-
return t.success ? { success: !0, errors: [] } : {
|
|
923
|
-
success: !1,
|
|
924
|
-
errors: t.error.issues.map((i) => ({
|
|
925
|
-
path: i.path,
|
|
926
|
-
message: i.message
|
|
927
|
-
}))
|
|
928
|
-
};
|
|
929
|
-
}
|
|
930
|
-
function mt(e) {
|
|
931
|
-
const t = U.safeParse(e);
|
|
932
|
-
return t.success ? { success: !0, errors: [] } : {
|
|
933
|
-
success: !1,
|
|
934
|
-
errors: t.error.issues.map((i) => ({
|
|
935
|
-
path: i.path,
|
|
936
|
-
message: i.message
|
|
937
|
-
}))
|
|
938
|
-
};
|
|
939
|
-
}
|
|
940
|
-
function ft(e) {
|
|
941
|
-
return q.parse(e);
|
|
942
|
-
}
|
|
943
|
-
function ht(e) {
|
|
944
|
-
return U.parse(e);
|
|
945
|
-
}
|
|
946
|
-
export {
|
|
947
|
-
qe as A,
|
|
948
|
-
rt as B,
|
|
949
|
-
st as C,
|
|
950
|
-
q as D,
|
|
951
|
-
Ae as E,
|
|
952
|
-
at as F,
|
|
953
|
-
ie as G,
|
|
954
|
-
ht as H,
|
|
955
|
-
oe as I,
|
|
956
|
-
ft as J,
|
|
957
|
-
et as K,
|
|
958
|
-
ze as L,
|
|
959
|
-
He as M,
|
|
960
|
-
Xe as N,
|
|
961
|
-
ne as O,
|
|
962
|
-
k as P,
|
|
963
|
-
pt as Q,
|
|
964
|
-
ot as T,
|
|
965
|
-
it as V,
|
|
966
|
-
ae as W,
|
|
967
|
-
ee as a,
|
|
968
|
-
De as b,
|
|
969
|
-
dt as c,
|
|
970
|
-
we as d,
|
|
971
|
-
Re as e,
|
|
972
|
-
ut as f,
|
|
973
|
-
Ee as g,
|
|
974
|
-
Pe as h,
|
|
975
|
-
W as i,
|
|
976
|
-
Me as j,
|
|
977
|
-
re as k,
|
|
978
|
-
te as l,
|
|
979
|
-
ct as m,
|
|
980
|
-
Ze as n,
|
|
981
|
-
he as o,
|
|
982
|
-
lt as p,
|
|
983
|
-
me as q,
|
|
984
|
-
ce as r,
|
|
985
|
-
Te as s,
|
|
986
|
-
je as t,
|
|
987
|
-
K as u,
|
|
988
|
-
mt as v,
|
|
989
|
-
N as w,
|
|
990
|
-
tt as x,
|
|
991
|
-
nt as y,
|
|
992
|
-
z
|
|
993
|
-
};
|
|
994
|
-
//# sourceMappingURL=validation-C9P__pRF.js.map
|