@stonecrop/schema 0.10.2 → 0.10.4

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 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 { h as P, v as j } from "./index-CzoRIy1-.js";
6
+ import { h as P, v as j } from "./index-BatnoC-J.js";
7
7
  async function C(e, m) {
8
8
  const t = await fetch(e, {
9
9
  method: "POST",
package/dist/doctype.js CHANGED
@@ -4,7 +4,8 @@ import { FieldMeta } from './field';
4
4
  * Action definition within a workflow
5
5
  * @public
6
6
  */
7
- export const ActionDefinition = z.object({
7
+ export const ActionDefinition = z
8
+ .object({
8
9
  /** Display label for the action */
9
10
  label: z.string().min(1),
10
11
  /** Handler function name or path */
@@ -17,22 +18,32 @@ export const ActionDefinition = z.object({
17
18
  confirm: z.boolean().optional(),
18
19
  /** Additional arguments for the action */
19
20
  args: z.record(z.string(), z.unknown()).optional(),
21
+ })
22
+ .meta({
23
+ title: 'ActionDefinition',
24
+ description: 'Action definition within a workflow',
20
25
  });
21
26
  /**
22
27
  * Workflow metadata - states and actions for a doctype
23
28
  * @public
24
29
  */
25
- export const WorkflowMeta = z.object({
30
+ export const WorkflowMeta = z
31
+ .object({
26
32
  /** List of workflow states */
27
33
  states: z.array(z.string()).optional(),
28
34
  /** Actions available in this workflow */
29
35
  actions: z.record(z.string(), ActionDefinition).optional(),
36
+ })
37
+ .meta({
38
+ title: 'WorkflowMeta',
39
+ description: 'Workflow metadata - states and actions for a doctype',
30
40
  });
31
41
  /**
32
42
  * Doctype metadata - complete definition of a doctype
33
43
  * @public
34
44
  */
35
- export const DoctypeMeta = z.object({
45
+ export const DoctypeMeta = z
46
+ .object({
36
47
  /** Display name of the doctype */
37
48
  name: z.string().min(1),
38
49
  /** URL-friendly slug (kebab-case) */
@@ -49,4 +60,8 @@ export const DoctypeMeta = z.object({
49
60
  listDoctype: z.string().optional(),
50
61
  /** Parent doctype for child tables */
51
62
  parentDoctype: z.string().optional(),
63
+ })
64
+ .meta({
65
+ title: 'DoctypeMeta',
66
+ description: 'Doctype metadata - complete definition of a doctype',
52
67
  });
package/dist/field.js CHANGED
@@ -11,21 +11,29 @@ import { StonecropFieldType } from './fieldtype';
11
11
  *
12
12
  * @public
13
13
  */
14
- export const FieldOptions = z.union([
14
+ export const FieldOptions = z
15
+ .union([
15
16
  z.string(), // Link/Doctype target: "customer"
16
17
  z.array(z.string()), // Select choices: ["A", "B", "C"]
17
18
  z.record(z.string(), z.unknown()), // Config: \{ precision: 10, scale: 2 \}
18
- ]);
19
+ ])
20
+ .meta({
21
+ title: 'FieldOptions',
22
+ description: 'Field options - flexible bag for type-specific configuration',
23
+ });
19
24
  /**
20
25
  * Validation configuration for form fields
21
26
  * @public
22
27
  */
23
28
  export const FieldValidation = z
24
- .object({
29
+ .looseObject({
25
30
  /** Error message to display when validation fails */
26
31
  errorMessage: z.string(),
27
32
  })
28
- .passthrough();
33
+ .meta({
34
+ title: 'FieldValidation',
35
+ description: 'Validation configuration for form fields',
36
+ });
29
37
  /**
30
38
  * Unified field metadata - the single source of truth for field definitions.
31
39
  * Works for both forms (AForm) and tables (ATable).
@@ -34,7 +42,8 @@ export const FieldValidation = z
34
42
  *
35
43
  * @public
36
44
  */
37
- export const FieldMeta = z.object({
45
+ export const FieldMeta = z
46
+ .object({
38
47
  // === CORE (required) ===
39
48
  /** Unique identifier for the field within its doctype */
40
49
  fieldname: z.string().min(1),
@@ -86,4 +95,8 @@ export const FieldMeta = z.object({
86
95
  // === VALIDATION ===
87
96
  /** Validation configuration */
88
97
  validation: FieldValidation.optional(),
98
+ })
99
+ .meta({
100
+ title: 'FieldMeta',
101
+ description: 'Unified field metadata - the single source of truth for field definitions, works for both forms (AForm) and tables (ATable)',
89
102
  });
package/dist/fieldtype.js CHANGED
@@ -4,7 +4,8 @@ import { z } from 'zod';
4
4
  * These are consistent across forms and tables.
5
5
  * @public
6
6
  */
7
- export const StonecropFieldType = z.enum([
7
+ export const StonecropFieldType = z
8
+ .enum([
8
9
  'Data', // Short text, varchar
9
10
  'Text', // Long text
10
11
  'Int', // Integer
@@ -24,7 +25,11 @@ export const StonecropFieldType = z.enum([
24
25
  'Currency', // Currency value
25
26
  'Quantity', // Quantity with unit
26
27
  'Select', // Dropdown selection
27
- ]);
28
+ ])
29
+ .meta({
30
+ title: 'StonecropFieldType',
31
+ description: 'Semantic field types for Stonecrop doctypes, consistent across forms and tables',
32
+ });
28
33
  /**
29
34
  * Mapping from StonecropFieldType to default Vue component.
30
35
  * Components can be overridden in the field definition.
@@ -1,6 +1,6 @@
1
1
  import { z as e } from "zod";
2
- import { isScalarType as E, isEnumType as M, isObjectType as g, isNonNullType as _, isListType as v, buildSchema as x, buildClientSchema as j } from "graphql";
3
- const P = e.enum([
2
+ import { isScalarType as M, isEnumType as E, isObjectType as g, isNonNullType as k, isListType as x, buildSchema as v, buildClientSchema as j } from "graphql";
3
+ const U = e.enum([
4
4
  "Data",
5
5
  // Short text, varchar
6
6
  "Text",
@@ -39,7 +39,10 @@ const P = e.enum([
39
39
  // Quantity with unit
40
40
  "Select"
41
41
  // Dropdown selection
42
- ]), R = {
42
+ ]).meta({
43
+ title: "StonecropFieldType",
44
+ description: "Semantic field types for Stonecrop doctypes, consistent across forms and tables"
45
+ }), P = {
43
46
  // Text
44
47
  Data: { component: "ATextInput", fieldtype: "Data" },
45
48
  Text: { component: "ATextInput", fieldtype: "Text" },
@@ -69,24 +72,30 @@ const P = e.enum([
69
72
  Select: { component: "ADropdown", fieldtype: "Select" }
70
73
  };
71
74
  function ae(t) {
72
- return R[t]?.component ?? "ATextInput";
75
+ return P[t]?.component ?? "ATextInput";
73
76
  }
74
- const U = e.union([
77
+ const R = e.union([
75
78
  e.string(),
76
79
  // Link/Doctype target: "customer"
77
80
  e.array(e.string()),
78
81
  // Select choices: ["A", "B", "C"]
79
82
  e.record(e.string(), e.unknown())
80
83
  // Config: \{ precision: 10, scale: 2 \}
81
- ]), q = e.object({
84
+ ]).meta({
85
+ title: "FieldOptions",
86
+ description: "Field options - flexible bag for type-specific configuration"
87
+ }), q = e.looseObject({
82
88
  /** Error message to display when validation fails */
83
89
  errorMessage: e.string()
84
- }).passthrough(), S = e.object({
90
+ }).meta({
91
+ title: "FieldValidation",
92
+ description: "Validation configuration for form fields"
93
+ }), I = e.object({
85
94
  // === CORE (required) ===
86
95
  /** Unique identifier for the field within its doctype */
87
96
  fieldname: e.string().min(1),
88
97
  /** Semantic field type - determines behavior and default component */
89
- fieldtype: P,
98
+ fieldtype: U,
90
99
  // === COMPONENT (optional - derived from fieldtype when not specified) ===
91
100
  /** Vue component to render this field. If not specified, derived from TYPE_MAP */
92
101
  component: e.string().optional(),
@@ -120,7 +129,7 @@ const U = e.union([
120
129
  * - Decimal: \{ precision, scale \}
121
130
  * - Code: \{ language \}
122
131
  */
123
- options: U.optional(),
132
+ options: R.optional(),
124
133
  /**
125
134
  * Input mask pattern. Accepts either a plain mask string or a stringified
126
135
  * arrow function that receives `locale` and returns a mask string.
@@ -133,6 +142,9 @@ const U = e.union([
133
142
  // === VALIDATION ===
134
143
  /** Validation configuration */
135
144
  validation: q.optional()
145
+ }).meta({
146
+ title: "FieldMeta",
147
+ description: "Unified field metadata - the single source of truth for field definitions, works for both forms (AForm) and tables (ATable)"
136
148
  }), J = e.object({
137
149
  /** Display label for the action */
138
150
  label: e.string().min(1),
@@ -146,12 +158,18 @@ const U = e.union([
146
158
  confirm: e.boolean().optional(),
147
159
  /** Additional arguments for the action */
148
160
  args: e.record(e.string(), e.unknown()).optional()
161
+ }).meta({
162
+ title: "ActionDefinition",
163
+ description: "Action definition within a workflow"
149
164
  }), Q = e.object({
150
165
  /** List of workflow states */
151
166
  states: e.array(e.string()).optional(),
152
167
  /** Actions available in this workflow */
153
168
  actions: e.record(e.string(), J).optional()
154
- }), k = e.object({
169
+ }).meta({
170
+ title: "WorkflowMeta",
171
+ description: "Workflow metadata - states and actions for a doctype"
172
+ }), _ = e.object({
155
173
  /** Display name of the doctype */
156
174
  name: e.string().min(1),
157
175
  /** URL-friendly slug (kebab-case) */
@@ -159,7 +177,7 @@ const U = e.union([
159
177
  /** Database table name */
160
178
  tableName: e.string().optional(),
161
179
  /** Field definitions */
162
- fields: e.array(S),
180
+ fields: e.array(I),
163
181
  /** Workflow configuration */
164
182
  workflow: Q.optional(),
165
183
  /** Parent doctype for inheritance */
@@ -168,9 +186,12 @@ const U = e.union([
168
186
  listDoctype: e.string().optional(),
169
187
  /** Parent doctype for child tables */
170
188
  parentDoctype: e.string().optional()
189
+ }).meta({
190
+ title: "DoctypeMeta",
191
+ description: "Doctype metadata - complete definition of a doctype"
171
192
  });
172
193
  function re(t) {
173
- const n = S.safeParse(t);
194
+ const n = I.safeParse(t);
174
195
  return n.success ? { success: !0, errors: [] } : {
175
196
  success: !1,
176
197
  errors: n.error.issues.map((i) => ({
@@ -180,7 +201,7 @@ function re(t) {
180
201
  };
181
202
  }
182
203
  function pe(t) {
183
- const n = k.safeParse(t);
204
+ const n = _.safeParse(t);
184
205
  return n.success ? { success: !0, errors: [] } : {
185
206
  success: !1,
186
207
  errors: n.error.issues.map((i) => ({
@@ -190,18 +211,18 @@ function pe(t) {
190
211
  };
191
212
  }
192
213
  function se(t) {
193
- return S.parse(t);
214
+ return I.parse(t);
194
215
  }
195
216
  function ce(t) {
196
- return k.parse(t);
217
+ return _.parse(t);
197
218
  }
198
219
  function le(t) {
199
220
  return t.replace(/_([a-z])/g, (n, i) => i.toUpperCase());
200
221
  }
201
- function ue(t) {
222
+ function de(t) {
202
223
  return t.replace(/[A-Z]/g, (n) => `_${n.toLowerCase()}`);
203
224
  }
204
- function de(t) {
225
+ function ue(t) {
205
226
  return t.split("_").map((n) => n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join(" ");
206
227
  }
207
228
  function W(t) {
@@ -211,7 +232,7 @@ function W(t) {
211
232
  function fe(t) {
212
233
  return t.split(/[-_\s]+/).map((n) => n.charAt(0).toUpperCase() + n.slice(1).toLowerCase()).join("");
213
234
  }
214
- function A(t) {
235
+ function T(t) {
215
236
  return t.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
216
237
  }
217
238
  function $(t) {
@@ -244,7 +265,7 @@ const B = {
244
265
  JSONObject: { component: "ACodeEditor", fieldtype: "JSON" },
245
266
  JsonNode: { component: "ACodeEditor", fieldtype: "JSON" }
246
267
  }, G = /* @__PURE__ */ new Set(["Cursor"]);
247
- function Z(t) {
268
+ function V(t) {
248
269
  const n = { ...z };
249
270
  for (const [i, a] of Object.entries(B))
250
271
  n[i] = a;
@@ -256,7 +277,7 @@ function Z(t) {
256
277
  };
257
278
  return n;
258
279
  }
259
- const Y = [
280
+ const Z = [
260
281
  "Connection",
261
282
  "Edge",
262
283
  "Input",
@@ -272,11 +293,11 @@ const Y = [
272
293
  "InsertResponse",
273
294
  "UpdateResponse",
274
295
  "MutationResponse"
275
- ], K = /* @__PURE__ */ new Set(["Query", "Mutation", "Subscription"]);
276
- function V(t, n) {
277
- if (t.startsWith("__") || K.has(t) || t === "Node")
296
+ ], Y = /* @__PURE__ */ new Set(["Query", "Mutation", "Subscription"]);
297
+ function K(t, n) {
298
+ if (t.startsWith("__") || Y.has(t) || t === "Node")
278
299
  return !1;
279
- for (const a of Y)
300
+ for (const a of Z)
280
301
  if (t.endsWith(a))
281
302
  return !1;
282
303
  const i = n.getFields();
@@ -286,123 +307,123 @@ const H = /* @__PURE__ */ new Set(["nodeId", "__typename", "clientMutationId"]);
286
307
  function X(t, n, i) {
287
308
  return !H.has(t);
288
309
  }
289
- function I(t) {
310
+ function S(t) {
290
311
  let n = !1, i = !1, a = t;
291
- return _(a) && (n = !0, a = a.ofType), v(a) && (i = !0, a = a.ofType, _(a) && (a = a.ofType)), { namedType: a, required: n, isList: i };
312
+ return k(a) && (n = !0, a = a.ofType), x(a) && (i = !0, a = a.ofType, k(a) && (a = a.ofType)), { namedType: a, required: n, isList: i };
292
313
  }
293
314
  function ee(t) {
294
315
  const i = t.getFields().edges;
295
316
  if (!i) return;
296
- const { namedType: a, isList: r } = I(i.type);
317
+ const { namedType: a, isList: r } = S(i.type);
297
318
  if (!r || !g(a)) return;
298
- const u = a.getFields().node;
299
- if (!u) return;
300
- const { namedType: f } = I(u.type);
319
+ const d = a.getFields().node;
320
+ if (!d) return;
321
+ const { namedType: f } = S(d.type);
301
322
  if (g(f))
302
323
  return f.name;
303
324
  }
304
325
  function te(t, n, i, a = {}) {
305
- const { namedType: r, required: m, isList: u } = I(n.type), f = Z(a.customScalars), o = {
326
+ const { namedType: r, required: m, isList: d } = S(n.type), f = V(a.customScalars), o = {
306
327
  fieldname: t,
307
328
  label: W(t),
308
329
  component: "ATextInput",
309
330
  fieldtype: "Data"
310
331
  };
311
- if (m && (o.required = !0), E(r)) {
332
+ if (m && (o.required = !0), M(r)) {
312
333
  if (G.has(r.name))
313
334
  return o._unmapped = !0, a.includeUnmappedMeta && (o._graphqlType = r.name), o;
314
335
  const s = f[r.name];
315
336
  return s ? (o.component = s.component, o.fieldtype = s.fieldtype) : (o._unmapped = !0, a.includeUnmappedMeta && (o._graphqlType = r.name)), o;
316
337
  }
317
- if (M(r))
338
+ if (E(r))
318
339
  return o.component = "ADropdown", o.fieldtype = "Select", o.options = r.getValues().map((s) => s.name), o;
319
340
  if (g(r)) {
320
- if (!u && i.has(r.name))
321
- return o.component = "ALink", o.fieldtype = "Link", o.options = A(r.name), o;
341
+ if (!d && i.has(r.name))
342
+ return o.component = "ALink", o.fieldtype = "Link", o.options = T(r.name), o;
322
343
  const s = ee(r);
323
- return s && i.has(s) ? (o.component = "ATable", o.fieldtype = "Doctype", o.options = A(s), o) : u && i.has(r.name) ? (o.component = "ATable", o.fieldtype = "Doctype", o.options = A(r.name), o) : (o._unmapped = !0, a.includeUnmappedMeta && (o._graphqlType = r.name), o);
344
+ return s && i.has(s) ? (o.component = "ATable", o.fieldtype = "Doctype", o.options = T(s), o) : d && i.has(r.name) ? (o.component = "ATable", o.fieldtype = "Doctype", o.options = T(r.name), o) : (o._unmapped = !0, a.includeUnmappedMeta && (o._graphqlType = r.name), o);
324
345
  }
325
346
  return o._unmapped = !0, a.includeUnmappedMeta && (o._graphqlType = r.name), o;
326
347
  }
327
348
  function me(t, n = {}) {
328
- const i = ne(t), a = i.getTypeMap(), r = /* @__PURE__ */ new Set(), m = i.getQueryType(), u = i.getMutationType(), f = i.getSubscriptionType();
329
- m && r.add(m.name), u && r.add(u.name), f && r.add(f.name);
330
- const o = n.isEntityType ?? V, s = /* @__PURE__ */ new Set();
349
+ const i = ne(t), a = i.getTypeMap(), r = /* @__PURE__ */ new Set(), m = i.getQueryType(), d = i.getMutationType(), f = i.getSubscriptionType();
350
+ m && r.add(m.name), d && r.add(d.name), f && r.add(f.name);
351
+ const o = n.isEntityType ?? K, s = /* @__PURE__ */ new Set();
331
352
  for (const [p, c] of Object.entries(a))
332
353
  g(c) && (r.has(p) || o(p, c) && s.add(p));
333
- let T = s;
354
+ let A = s;
334
355
  if (n.include) {
335
356
  const p = new Set(n.include);
336
- T = new Set([...s].filter((c) => p.has(c)));
357
+ A = new Set([...s].filter((c) => p.has(c)));
337
358
  }
338
359
  if (n.exclude) {
339
360
  const p = new Set(n.exclude);
340
- T = new Set([...T].filter((c) => !p.has(c)));
361
+ A = new Set([...A].filter((c) => !p.has(c)));
341
362
  }
342
- const L = n.isEntityField ?? X, N = n.deriveTableName ?? ((p) => $(p)), b = [];
343
- for (const p of T) {
363
+ const w = n.isEntityField ?? X, L = n.deriveTableName ?? ((p) => $(p)), b = [];
364
+ for (const p of A) {
344
365
  const c = a[p];
345
366
  if (!g(c)) continue;
346
- const w = c.getFields(), C = n.typeOverrides?.[p], O = Object.entries(w).filter(([l, y]) => L(l, y, c)).map(([l, y]) => {
367
+ const N = c.getFields(), F = n.typeOverrides?.[p], O = Object.entries(N).filter(([l, y]) => w(l, y, c)).map(([l, y]) => {
347
368
  if (n.classifyField) {
348
- const d = n.classifyField(l, y, c);
349
- if (d != null)
369
+ const u = n.classifyField(l, y, c);
370
+ if (u != null)
350
371
  return {
351
372
  fieldname: l,
352
- label: d.label ?? l,
353
- component: d.component ?? "ATextInput",
354
- fieldtype: d.fieldtype ?? "Data",
355
- ...d
373
+ label: u.label ?? l,
374
+ component: u.component ?? "ATextInput",
375
+ fieldtype: u.fieldtype ?? "Data",
376
+ ...u
356
377
  };
357
378
  }
358
379
  const h = te(l, y, s, n);
359
- return C?.[l] ? { ...h, ...C[l] } : h;
380
+ return F?.[l] ? { ...h, ...F[l] } : h;
360
381
  }).map((l) => {
361
382
  if (!n.includeUnmappedMeta) {
362
- const { _graphqlType: y, _unmapped: h, ...d } = l;
363
- return d;
383
+ const { _graphqlType: y, _unmapped: h, ...u } = l;
384
+ return u;
364
385
  }
365
386
  return l;
366
387
  }), D = {
367
388
  name: p,
368
- slug: A(p),
389
+ slug: T(p),
369
390
  fields: O
370
- }, F = N(p);
371
- F && (D.tableName = F), n.includeUnmappedMeta && (D._graphqlTypeName = p), b.push(D);
391
+ }, C = L(p);
392
+ C && (D.tableName = C), n.includeUnmappedMeta && (D._graphqlTypeName = p), b.push(D);
372
393
  }
373
394
  return b;
374
395
  }
375
396
  function ne(t) {
376
- return typeof t == "string" ? x(t) : j(t);
397
+ return typeof t == "string" ? v(t) : j(t);
377
398
  }
378
399
  export {
379
400
  J as A,
380
- k as D,
381
- S as F,
401
+ _ as D,
402
+ I as F,
382
403
  B as G,
383
404
  G as I,
384
- P as S,
385
- R as T,
405
+ U as S,
406
+ P as T,
386
407
  z as W,
387
- U as a,
408
+ R as a,
388
409
  q as b,
389
410
  Q as c,
390
- Z as d,
411
+ V as d,
391
412
  W as e,
392
- ue as f,
413
+ de as f,
393
414
  te as g,
394
415
  me as h,
395
416
  X as i,
396
- V as j,
417
+ K as j,
397
418
  ae as k,
398
419
  se as l,
399
420
  $ as m,
400
- de as n,
401
- A as o,
421
+ ue as n,
422
+ T as o,
402
423
  ce as p,
403
424
  re as q,
404
425
  le as s,
405
426
  fe as t,
406
427
  pe as v
407
428
  };
408
- //# sourceMappingURL=index-CzoRIy1-.js.map
429
+ //# sourceMappingURL=index-BatnoC-J.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BatnoC-J.js","sources":["../src/fieldtype.ts","../src/field.ts","../src/doctype.ts","../src/validation.ts","../src/naming.ts","../src/converter/scalars.ts","../src/converter/heuristics.ts","../src/converter/index.ts"],"sourcesContent":["import { z } from 'zod'\n\n/**\n * Stonecrop field types - the semantic type of the field.\n * These are consistent across forms and tables.\n * @public\n */\nexport const StonecropFieldType = z\n\t.enum([\n\t\t'Data', // Short text, varchar\n\t\t'Text', // Long text\n\t\t'Int', // Integer\n\t\t'Float', // Floating point (IEEE 754)\n\t\t'Decimal', // Arbitrary precision decimal\n\t\t'Check', // Boolean/checkbox\n\t\t'Date', // Date only\n\t\t'Time', // Time only\n\t\t'Datetime', // Date and time\n\t\t'Duration', // Time interval\n\t\t'DateRange', // Date range\n\t\t'JSON', // JSON data\n\t\t'Code', // Code/source (with syntax highlighting)\n\t\t'Link', // Reference to another doctype\n\t\t'Doctype', // Child doctype (renders as table)\n\t\t'Attach', // File attachment\n\t\t'Currency', // Currency value\n\t\t'Quantity', // Quantity with unit\n\t\t'Select', // Dropdown selection\n\t])\n\t.meta({\n\t\ttitle: 'StonecropFieldType',\n\t\tdescription: 'Semantic field types for Stonecrop doctypes, consistent across forms and tables',\n\t})\n\n/**\n * Stonecrop field type enum inferred from Zod schema\n * @public\n */\nexport type StonecropFieldType = z.infer<typeof StonecropFieldType>\n\n/**\n * Field template for TYPE_MAP entries.\n * Defines the default component and semantic field type for a field.\n * @public\n */\nexport interface FieldTemplate {\n\t/**\n\t * The Vue component name to render this field (e.g., 'ATextInput', 'ADropdown')\n\t */\n\tcomponent: string\n\t/**\n\t * The semantic field type (e.g., 'Data', 'Int', 'Select')\n\t */\n\tfieldtype: StonecropFieldType\n}\n\n/**\n * Mapping from StonecropFieldType to default Vue component.\n * Components can be overridden in the field definition.\n * @public\n */\nexport const TYPE_MAP: Record<StonecropFieldType, FieldTemplate> = {\n\t// Text\n\tData: { component: 'ATextInput', fieldtype: 'Data' },\n\tText: { component: 'ATextInput', fieldtype: 'Text' },\n\n\t// Numeric\n\tInt: { component: 'ANumericInput', fieldtype: 'Int' },\n\tFloat: { component: 'ANumericInput', fieldtype: 'Float' },\n\tDecimal: { component: 'ADecimalInput', fieldtype: 'Decimal' },\n\n\t// Boolean\n\tCheck: { component: 'ACheckbox', fieldtype: 'Check' },\n\n\t// Date/Time\n\tDate: { component: 'ADate', fieldtype: 'Date' },\n\tTime: { component: 'ATimeInput', fieldtype: 'Time' },\n\tDatetime: { component: 'ADatetimePicker', fieldtype: 'Datetime' },\n\tDuration: { component: 'ADurationInput', fieldtype: 'Duration' },\n\tDateRange: { component: 'ADateRangePicker', fieldtype: 'DateRange' },\n\n\t// Structured\n\tJSON: { component: 'ACodeEditor', fieldtype: 'JSON' },\n\tCode: { component: 'ACodeEditor', fieldtype: 'Code' },\n\n\t// Relational\n\tLink: { component: 'ALink', fieldtype: 'Link' },\n\tDoctype: { component: 'ATable', fieldtype: 'Doctype' },\n\n\t// Files\n\tAttach: { component: 'AFileAttach', fieldtype: 'Attach' },\n\n\t// Specialized\n\tCurrency: { component: 'ACurrencyInput', fieldtype: 'Currency' },\n\tQuantity: { component: 'AQuantityInput', fieldtype: 'Quantity' },\n\tSelect: { component: 'ADropdown', fieldtype: 'Select' },\n}\n\n/**\n * Get the default component for a field type\n * @param fieldtype - The semantic field type\n * @returns The default component name\n * @public\n */\nexport function getDefaultComponent(fieldtype: StonecropFieldType): string {\n\treturn TYPE_MAP[fieldtype]?.component ?? 'ATextInput'\n}\n","import { z } from 'zod'\n\nimport { StonecropFieldType } from './fieldtype'\n\n/**\n * Field options - flexible bag for type-specific configuration.\n *\n * Usage by fieldtype:\n * - Link/Doctype: target doctype slug as string (\"customer\", \"sales-order-item\")\n * - Select: array of choices ([\"Draft\", \"Submitted\", \"Cancelled\"])\n * - Decimal: config object (\\{ precision: 10, scale: 2 \\})\n * - Code: config object (\\{ language: \"python\" \\})\n *\n * @public\n */\nexport const FieldOptions = z\n\t.union([\n\t\tz.string(), // Link/Doctype target: \"customer\"\n\t\tz.array(z.string()), // Select choices: [\"A\", \"B\", \"C\"]\n\t\tz.record(z.string(), z.unknown()), // Config: \\{ precision: 10, scale: 2 \\}\n\t])\n\t.meta({\n\t\ttitle: 'FieldOptions',\n\t\tdescription: 'Field options - flexible bag for type-specific configuration',\n\t})\n\n/**\n * Field options type inferred from Zod schema\n * @public\n */\nexport type FieldOptions = z.infer<typeof FieldOptions>\n\n/**\n * Validation configuration for form fields\n * @public\n */\nexport const FieldValidation = z\n\t.looseObject({\n\t\t/** Error message to display when validation fails */\n\t\terrorMessage: z.string(),\n\t})\n\t.meta({\n\t\ttitle: 'FieldValidation',\n\t\tdescription: 'Validation configuration for form fields',\n\t})\n\n/**\n * Field validation type inferred from Zod schema\n * @public\n */\nexport type FieldValidation = z.infer<typeof FieldValidation>\n\n/**\n * Unified field metadata - the single source of truth for field definitions.\n * Works for both forms (AForm) and tables (ATable).\n *\n * Core principle: \"Text\" is \"Text\" regardless of rendering context.\n *\n * @public\n */\nexport const FieldMeta = z\n\t.object({\n\t\t// === CORE (required) ===\n\n\t\t/** Unique identifier for the field within its doctype */\n\t\tfieldname: z.string().min(1),\n\n\t\t/** Semantic field type - determines behavior and default component */\n\t\tfieldtype: StonecropFieldType,\n\n\t\t// === COMPONENT (optional - derived from fieldtype when not specified) ===\n\n\t\t/** Vue component to render this field. If not specified, derived from TYPE_MAP */\n\t\tcomponent: z.string().optional(),\n\n\t\t// === DISPLAY ===\n\n\t\t/** Human-readable label for the field */\n\t\tlabel: z.string().optional(),\n\n\t\t/** Width of the field (CSS value, e.g., \"40ch\", \"200px\") */\n\t\twidth: z.string().optional(),\n\n\t\t/** Text alignment within the field */\n\t\talign: z.enum(['left', 'center', 'right', 'start', 'end']).optional(),\n\n\t\t// === BEHAVIOR ===\n\n\t\t/** Whether the field is required */\n\t\trequired: z.boolean().optional(),\n\n\t\t/** Whether the field is read-only */\n\t\treadOnly: z.boolean().optional(),\n\n\t\t/** Whether the field is editable (for table cells) */\n\t\tedit: z.boolean().optional(),\n\n\t\t/** Whether the field is hidden from the UI */\n\t\thidden: z.boolean().optional(),\n\n\t\t// === VALUE ===\n\n\t\t/** Current value of the field */\n\t\tvalue: z.unknown().optional(),\n\n\t\t/** Default value for new records */\n\t\tdefault: z.unknown().optional(),\n\n\t\t// === TYPE-SPECIFIC ===\n\n\t\t/**\n\t\t * Type-specific options:\n\t\t * - Link: target doctype slug (\"customer\")\n\t\t * - Doctype: child doctype slug (\"sales-order-item\")\n\t\t * - Select: choices array ([\"Draft\", \"Submitted\"])\n\t\t * - Decimal: \\{ precision, scale \\}\n\t\t * - Code: \\{ language \\}\n\t\t */\n\t\toptions: FieldOptions.optional(),\n\n\t\t/**\n\t\t * Input mask pattern. Accepts either a plain mask string or a stringified\n\t\t * arrow function that receives `locale` and returns a mask string.\n\t\t *\n\t\t * Plain pattern: `\"##/##/####\"`\n\t\t *\n\t\t * Function pattern: `\"(locale) => locale === 'en-US' ? '(###) ###-####' : '####-######'\"`\n\t\t */\n\t\tmask: z.string().optional(),\n\n\t\t// === VALIDATION ===\n\n\t\t/** Validation configuration */\n\t\tvalidation: FieldValidation.optional(),\n\t})\n\t.meta({\n\t\ttitle: 'FieldMeta',\n\t\tdescription:\n\t\t\t'Unified field metadata - the single source of truth for field definitions, works for both forms (AForm) and tables (ATable)',\n\t})\n\n/**\n * Field metadata type inferred from Zod schema\n * @public\n */\nexport type FieldMeta = z.infer<typeof FieldMeta>\n","import { z } from 'zod'\n\nimport { FieldMeta } from './field'\n\n/**\n * Action definition within a workflow\n * @public\n */\nexport const ActionDefinition = z\n\t.object({\n\t\t/** Display label for the action */\n\t\tlabel: z.string().min(1),\n\n\t\t/** Handler function name or path */\n\t\thandler: z.string().min(1),\n\n\t\t/** Fields that must have values before action can execute */\n\t\trequiredFields: z.array(z.string()).optional(),\n\n\t\t/** Workflow states where this action is available */\n\t\tallowedStates: z.array(z.string()).optional(),\n\n\t\t/** Whether to show a confirmation dialog */\n\t\tconfirm: z.boolean().optional(),\n\n\t\t/** Additional arguments for the action */\n\t\targs: z.record(z.string(), z.unknown()).optional(),\n\t})\n\t.meta({\n\t\ttitle: 'ActionDefinition',\n\t\tdescription: 'Action definition within a workflow',\n\t})\n\n/**\n * Action definition type inferred from Zod schema\n * @public\n */\nexport type ActionDefinition = z.infer<typeof ActionDefinition>\n\n/**\n * Workflow metadata - states and actions for a doctype\n * @public\n */\nexport const WorkflowMeta = z\n\t.object({\n\t\t/** List of workflow states */\n\t\tstates: z.array(z.string()).optional(),\n\n\t\t/** Actions available in this workflow */\n\t\tactions: z.record(z.string(), ActionDefinition).optional(),\n\t})\n\t.meta({\n\t\ttitle: 'WorkflowMeta',\n\t\tdescription: 'Workflow metadata - states and actions for a doctype',\n\t})\n\n/**\n * Workflow metadata type inferred from Zod schema\n * @public\n */\nexport type WorkflowMeta = z.infer<typeof WorkflowMeta>\n\n/**\n * Doctype metadata - complete definition of a doctype\n * @public\n */\nexport const DoctypeMeta = z\n\t.object({\n\t\t/** Display name of the doctype */\n\t\tname: z.string().min(1),\n\n\t\t/** URL-friendly slug (kebab-case) */\n\t\tslug: z.string().min(1).optional(),\n\n\t\t/** Database table name */\n\t\ttableName: z.string().optional(),\n\n\t\t/** Field definitions */\n\t\tfields: z.array(FieldMeta),\n\n\t\t/** Workflow configuration */\n\t\tworkflow: WorkflowMeta.optional(),\n\n\t\t/** Parent doctype for inheritance */\n\t\tinherits: z.string().optional(),\n\n\t\t/** Doctype to use for list views */\n\t\tlistDoctype: z.string().optional(),\n\n\t\t/** Parent doctype for child tables */\n\t\tparentDoctype: z.string().optional(),\n\t})\n\t.meta({\n\t\ttitle: 'DoctypeMeta',\n\t\tdescription: 'Doctype metadata - complete definition of a doctype',\n\t})\n\n/**\n * Doctype metadata type inferred from Zod schema\n * @public\n */\nexport type DoctypeMeta = z.infer<typeof DoctypeMeta>\n\n/**\n * Context for identifying what doctype/record we're working with.\n * Used by graphql-middleware and graphql-client to resolve schema metadata.\n * @public\n */\nexport interface DoctypeContext {\n\t/** Doctype name (e.g., 'Task', 'Customer') */\n\tdoctype: string\n\t/** Optional record ID for viewing/editing a specific record */\n\trecordId?: string\n\t/** Additional context properties */\n\t[key: string]: unknown\n}\n\n/**\n * Base interface for doctype metadata passed to DataClient methods.\n * Only requires properties needed for record fetching.\n * @public\n */\nexport interface DoctypeRef {\n\t/** Doctype name (e.g., 'Task', 'Customer') */\n\tname: string\n\t/** URL-friendly slug (e.g., 'task', 'customer') */\n\tslug?: string\n}\n\n/**\n * Interface for data clients that fetch doctype metadata and records.\n * Implemented by \\@stonecrop/graphql-client's StonecropClient.\n * Custom implementations can use any backend (REST, local storage, etc.).\n *\n * @typeParam T - Doctype reference type for record operations (defaults to DoctypeRef)\n * @typeParam M - Doctype metadata return type for getMeta (defaults to DoctypeMeta)\n * @public\n */\nexport interface DataClient<T extends DoctypeRef = DoctypeRef, M = DoctypeMeta> {\n\t/**\n\t * Fetch doctype metadata\n\t * @param context - Doctype context identifying the doctype\n\t * @returns Doctype metadata or null if not found\n\t */\n\tgetMeta(context: DoctypeContext): Promise<M | null>\n\n\t/**\n\t * Fetch a single record by ID\n\t * @param doctype - Doctype reference (name and optional slug)\n\t * @param recordId - Record ID to fetch\n\t * @returns Record data or null if not found\n\t */\n\tgetRecord(doctype: T, recordId: string): Promise<Record<string, unknown> | null>\n\n\t/**\n\t * Fetch multiple records\n\t * @param doctype - Doctype reference (name and optional slug)\n\t * @param options - Optional filters, pagination, sorting\n\t * @returns Array of record data\n\t */\n\tgetRecords(\n\t\tdoctype: T,\n\t\toptions?: {\n\t\t\tfilters?: Record<string, unknown>\n\t\t\torderBy?: string\n\t\t\tlimit?: number\n\t\t\toffset?: number\n\t\t}\n\t): Promise<Record<string, unknown>[]>\n\n\t/**\n\t * Execute a doctype action (e.g., SUBMIT, APPROVE, save).\n\t * All state changes flow through this single mutation endpoint.\n\t *\n\t * @param doctype - Doctype reference (name and optional slug)\n\t * @param action - Action name to execute (e.g., 'SUBMIT', 'APPROVE', 'save')\n\t * @param args - Action arguments (typically record ID and/or form data)\n\t * @returns Action result with success status, response data, and any error\n\t */\n\trunAction(\n\t\tdoctype: T,\n\t\taction: string,\n\t\targs?: unknown[]\n\t): Promise<{ success: boolean; data: unknown; error: string | null }>\n}\n","import { FieldMeta } from './field'\nimport { DoctypeMeta } from './doctype'\n\n/**\n * Validation error with path information\n * @public\n */\nexport interface ValidationError {\n\t/** Path to the invalid property */\n\tpath: PropertyKey[]\n\n\t/** Error message */\n\tmessage: string\n}\n\n/**\n * Result of a validation operation\n * @public\n */\nexport interface ValidationResult {\n\t/** Whether validation passed */\n\tsuccess: boolean\n\n\t/** List of validation errors (empty if success) */\n\terrors: ValidationError[]\n}\n\n/**\n * Validate a field definition\n * @param data - Data to validate\n * @returns Validation result\n * @public\n */\nexport function validateField(data: unknown): ValidationResult {\n\tconst result = FieldMeta.safeParse(data)\n\n\tif (result.success) {\n\t\treturn { success: true, errors: [] }\n\t}\n\n\treturn {\n\t\tsuccess: false,\n\t\terrors: result.error.issues.map(issue => ({\n\t\t\tpath: issue.path,\n\t\t\tmessage: issue.message,\n\t\t})),\n\t}\n}\n\n/**\n * Validate a doctype definition\n * @param data - Data to validate\n * @returns Validation result\n * @public\n */\nexport function validateDoctype(data: unknown): ValidationResult {\n\tconst result = DoctypeMeta.safeParse(data)\n\n\tif (result.success) {\n\t\treturn { success: true, errors: [] }\n\t}\n\n\treturn {\n\t\tsuccess: false,\n\t\terrors: result.error.issues.map(issue => ({\n\t\t\tpath: issue.path,\n\t\t\tmessage: issue.message,\n\t\t})),\n\t}\n}\n\n/**\n * Parse and validate a field, throwing on failure\n * @param data - Data to parse\n * @returns Validated FieldMeta\n * @throws ZodError if validation fails\n * @public\n */\nexport function parseField(data: unknown): FieldMeta {\n\treturn FieldMeta.parse(data)\n}\n\n/**\n * Parse and validate a doctype, throwing on failure\n * @param data - Data to parse\n * @returns Validated DoctypeMeta\n * @throws ZodError if validation fails\n * @public\n */\nexport function parseDoctype(data: unknown): DoctypeMeta {\n\treturn DoctypeMeta.parse(data)\n}\n\n// Re-export types for convenience\nexport type { FieldMeta } from './field'\nexport type { DoctypeMeta } from './doctype'\n","/**\n * Naming Convention Utilities\n * Converts between various naming conventions (snake_case, camelCase, PascalCase, kebab-case)\n * @packageDocumentation\n */\n\n/**\n * Converts snake_case to camelCase\n * @param snakeCase - Snake case string\n * @returns Camel case string\n * @public\n * @example\n * ```typescript\n * snakeToCamel('user_email') // 'userEmail'\n * snakeToCamel('created_at') // 'createdAt'\n * ```\n */\nexport function snakeToCamel(snakeCase: string): string {\n\treturn snakeCase.replace(/_([a-z])/g, (_: string, letter: string) => letter.toUpperCase())\n}\n\n/**\n * Converts camelCase to snake_case\n * @param camelCase - Camel case string\n * @returns Snake case string\n * @public\n * @example\n * ```typescript\n * camelToSnake('userEmail') // 'user_email'\n * camelToSnake('createdAt') // 'created_at'\n * ```\n */\nexport function camelToSnake(camelCase: string): string {\n\treturn camelCase.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`)\n}\n\n/**\n * Converts snake_case to Title Case label\n * @param snakeCase - Snake case string\n * @returns Title case label\n * @public\n * @example\n * ```typescript\n * snakeToLabel('user_email') // 'User Email'\n * snakeToLabel('first_name') // 'First Name'\n * ```\n */\nexport function snakeToLabel(snakeCase: string): string {\n\treturn snakeCase\n\t\t.split('_')\n\t\t.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n\t\t.join(' ')\n}\n\n/**\n * Converts camelCase to Title Case label\n * @param camelCase - Camel case string\n * @returns Title case label\n * @public\n * @example\n * ```typescript\n * camelToLabel('userEmail') // 'User Email'\n * camelToLabel('firstName') // 'First Name'\n * ```\n */\nexport function camelToLabel(camelCase: string): string {\n\tconst withSpaces = camelCase.replace(/([A-Z])/g, ' $1').trim()\n\treturn withSpaces.charAt(0).toUpperCase() + withSpaces.slice(1)\n}\n\n/**\n * Convert table name to PascalCase doctype name\n * @param tableName - SQL table name (snake_case)\n * @returns PascalCase name\n * @public\n */\nexport function toPascalCase(tableName: string): string {\n\treturn tableName\n\t\t.split(/[-_\\s]+/)\n\t\t.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n\t\t.join('')\n}\n\n/**\n * Convert to kebab-case slug\n * @param name - Name to convert\n * @returns kebab-case slug\n * @public\n */\nexport function toSlug(name: string): string {\n\treturn name\n\t\t.replace(/([a-z])([A-Z])/g, '$1-$2')\n\t\t.replace(/[\\s_]+/g, '-')\n\t\t.toLowerCase()\n}\n\n/**\n * Convert PascalCase to snake_case (e.g., for deriving table names from type names)\n * @param pascal - PascalCase string\n * @returns snake_case string\n * @public\n * @example\n * ```typescript\n * pascalToSnake('SalesOrder') // 'sales_order'\n * pascalToSnake('SalesOrderItem') // 'sales_order_item'\n * ```\n */\nexport function pascalToSnake(pascal: string): string {\n\treturn pascal\n\t\t.replace(/([a-z])([A-Z])/g, '$1_$2')\n\t\t.replace(/[\\s-]+/g, '_')\n\t\t.toLowerCase()\n}\n","/**\n * GraphQL Scalar Type Mappings\n *\n * Maps standard GraphQL scalars and well-known custom scalars to Stonecrop field types.\n * Source-agnostic — covers scalars commonly emitted by PostGraphile, Hasura, Apollo, etc.\n *\n * Users can extend these via the `customScalars` option in `GraphQLConversionOptions`.\n *\n * @packageDocumentation\n */\n\nimport type { FieldTemplate } from '../fieldtype'\n\n/**\n * Mapping from standard GraphQL scalar types to Stonecrop field types.\n * These are defined by the GraphQL specification and are always available.\n *\n * @public\n */\nexport const GQL_SCALAR_MAP: Record<string, FieldTemplate> = {\n\tString: { component: 'ATextInput', fieldtype: 'Data' },\n\tInt: { component: 'ANumericInput', fieldtype: 'Int' },\n\tFloat: { component: 'ANumericInput', fieldtype: 'Float' },\n\tBoolean: { component: 'ACheckbox', fieldtype: 'Check' },\n\tID: { component: 'ATextInput', fieldtype: 'Data' },\n}\n\n/**\n * Mapping from well-known custom GraphQL scalars to Stonecrop field types.\n * These cover scalars commonly used across GraphQL servers (PostGraphile, Hasura, etc.)\n * without baking in knowledge of any specific server.\n *\n * Entries here have lower precedence than `customScalars` from options, but higher\n * precedence than unknown/unmapped scalars.\n *\n * @public\n */\nexport const WELL_KNOWN_SCALARS: Record<string, FieldTemplate> = {\n\t// Arbitrary precision / large numbers\n\tBigFloat: { component: 'ADecimalInput', fieldtype: 'Decimal' },\n\tBigDecimal: { component: 'ADecimalInput', fieldtype: 'Decimal' },\n\tDecimal: { component: 'ADecimalInput', fieldtype: 'Decimal' },\n\tBigInt: { component: 'ANumericInput', fieldtype: 'Int' },\n\tLong: { component: 'ANumericInput', fieldtype: 'Int' },\n\n\t// Identifiers\n\tUUID: { component: 'ATextInput', fieldtype: 'Data' },\n\n\t// Date / Time\n\tDateTime: { component: 'ADatetimePicker', fieldtype: 'Datetime' },\n\tDatetime: { component: 'ADatetimePicker', fieldtype: 'Datetime' },\n\tDate: { component: 'ADate', fieldtype: 'Date' },\n\tTime: { component: 'ATimeInput', fieldtype: 'Time' },\n\tInterval: { component: 'ADurationInput', fieldtype: 'Duration' },\n\tDuration: { component: 'ADurationInput', fieldtype: 'Duration' },\n\n\t// Structured data\n\tJSON: { component: 'ACodeEditor', fieldtype: 'JSON' },\n\tJSONObject: { component: 'ACodeEditor', fieldtype: 'JSON' },\n\tJsonNode: { component: 'ACodeEditor', fieldtype: 'JSON' },\n}\n\n/**\n * Set of scalar type names that are internal to GraphQL servers and should be skipped\n * during field conversion (they don't represent meaningful data fields).\n *\n * @public\n */\nexport const INTERNAL_SCALARS = new Set(['Cursor'])\n\n/**\n * Build a merged scalar map from the built-in maps and user-provided custom scalars.\n * Precedence (highest to lowest): customScalars → GQL_SCALAR_MAP → WELL_KNOWN_SCALARS\n *\n * @param customScalars - User-provided scalar overrides\n * @returns Merged scalar map\n * @public\n */\nexport function buildScalarMap(customScalars?: Record<string, Partial<FieldTemplate>>): Record<string, FieldTemplate> {\n\tconst merged: Record<string, FieldTemplate> = { ...WELL_KNOWN_SCALARS }\n\n\t// Standard scalars override well-known\n\tfor (const [key, value] of Object.entries(GQL_SCALAR_MAP)) {\n\t\tmerged[key] = value\n\t}\n\n\t// Custom scalars override everything\n\tif (customScalars) {\n\t\tfor (const [key, value] of Object.entries(customScalars)) {\n\t\t\tmerged[key] = {\n\t\t\t\tcomponent: value.component ?? 'ATextInput',\n\t\t\t\tfieldtype: value.fieldtype ?? 'Data',\n\t\t\t}\n\t\t}\n\t}\n\n\treturn merged\n}\n","/**\n * Default heuristics for identifying entity types and fields in a GraphQL schema.\n *\n * These heuristics work across common GraphQL servers (PostGraphile, Hasura, Apollo, etc.)\n * by detecting widely-adopted conventions like the Relay connection pattern.\n *\n * All heuristics can be overridden via the `isEntityType`, `isEntityField`, and\n * `classifyField` options in `GraphQLConversionOptions`.\n *\n * @packageDocumentation\n */\n\nimport {\n\tisScalarType,\n\tisEnumType,\n\tisObjectType,\n\tisListType,\n\tisNonNullType,\n\ttype GraphQLObjectType,\n\ttype GraphQLField,\n\ttype GraphQLOutputType,\n\ttype GraphQLNamedType,\n} from 'graphql'\n\nimport type { FieldTemplate } from '../fieldtype'\nimport type { GraphQLConversionFieldMeta, GraphQLConversionOptions } from './types'\nimport { buildScalarMap, INTERNAL_SCALARS } from './scalars'\nimport { toSlug, camelToLabel } from '../naming'\n\n/**\n * Suffixes that identify synthetic/framework types generated by GraphQL servers.\n * Types ending with these suffixes are typically not entities.\n */\nconst SYNTHETIC_SUFFIXES = [\n\t'Connection',\n\t'Edge',\n\t'Input',\n\t'Patch',\n\t'Payload',\n\t'Condition',\n\t'Filter',\n\t'OrderBy',\n\t'Aggregate',\n\t'AggregateResult',\n\t'AggregateFilter',\n\t'DeleteResponse',\n\t'InsertResponse',\n\t'UpdateResponse',\n\t'MutationResponse',\n]\n\n/**\n * Root operation type names that are never entities.\n */\nconst ROOT_TYPE_NAMES = new Set(['Query', 'Mutation', 'Subscription'])\n\n/**\n * Default heuristic to determine if a GraphQL object type represents an entity.\n * An entity type becomes a Stonecrop doctype.\n *\n * This heuristic excludes:\n * - Introspection types (`__*`)\n * - Root operation types (`Query`, `Mutation`, `Subscription`)\n * - Types with synthetic suffixes (e.g., `*Connection`, `*Edge`, `*Input`)\n * - Types starting with `Node` interface marker (exact match only)\n *\n * @param typeName - The GraphQL type name\n * @param type - The GraphQL object type definition\n * @returns `true` if this type should become a Stonecrop doctype\n * @public\n */\nexport function defaultIsEntityType(typeName: string, type: GraphQLObjectType): boolean {\n\t// Exclude introspection types\n\tif (typeName.startsWith('__')) {\n\t\treturn false\n\t}\n\n\t// Exclude root operation types\n\tif (ROOT_TYPE_NAMES.has(typeName)) {\n\t\treturn false\n\t}\n\n\t// Exclude the Node interface marker type\n\tif (typeName === 'Node') {\n\t\treturn false\n\t}\n\n\t// Exclude types matching synthetic suffixes\n\tfor (const suffix of SYNTHETIC_SUFFIXES) {\n\t\tif (typeName.endsWith(suffix)) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// Must have at least one field\n\tconst fields = type.getFields()\n\tif (Object.keys(fields).length === 0) {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\n/**\n * Fields to skip by default on entity types.\n * These are internal to GraphQL servers and don't represent semantic data.\n */\nconst SKIP_FIELDS = new Set(['nodeId', '__typename', 'clientMutationId'])\n\n/**\n * Default heuristic to filter fields on entity types.\n * Skips internal fields that don't represent meaningful data.\n *\n * @param fieldName - The GraphQL field name\n * @param _field - The GraphQL field definition (unused in default implementation)\n * @param _parentType - The parent entity type (unused in default implementation)\n * @returns `true` if this field should be included\n * @public\n */\nexport function defaultIsEntityField(\n\tfieldName: string,\n\t_field: GraphQLField<unknown, unknown>,\n\t_parentType: GraphQLObjectType\n): boolean {\n\treturn !SKIP_FIELDS.has(fieldName)\n}\n\n/**\n * Unwrap NonNull and List wrappers from a GraphQL type, tracking nullability.\n *\n * @param type - The GraphQL output type\n * @returns The unwrapped named type, whether it's required, and whether it's a list\n * @internal\n */\nfunction unwrapType(type: GraphQLOutputType): {\n\tnamedType: GraphQLNamedType\n\trequired: boolean\n\tisList: boolean\n} {\n\tlet required = false\n\tlet isList = false\n\tlet current: GraphQLOutputType = type\n\n\t// Unwrap outer NonNull\n\tif (isNonNullType(current)) {\n\t\trequired = true\n\t\tcurrent = current.ofType\n\t}\n\n\t// Unwrap List\n\tif (isListType(current)) {\n\t\tisList = true\n\t\tcurrent = current.ofType\n\n\t\t// Unwrap inner NonNull (e.g., [Type!])\n\t\tif (isNonNullType(current)) {\n\t\t\tcurrent = current.ofType\n\t\t}\n\t}\n\n\t// At this point, current should be a named type\n\treturn { namedType: current as GraphQLNamedType, required, isList }\n}\n\n/**\n * Check if a GraphQL object type looks like a Relay Connection type.\n * A connection type has an `edges` field returning a list of edge types,\n * where each edge has a `node` field.\n *\n * @param type - The GraphQL object type to check\n * @returns The node type name if this is a connection, or `undefined`\n * @internal\n */\nfunction getConnectionNodeType(type: GraphQLObjectType): string | undefined {\n\tconst fields = type.getFields()\n\n\t// Must have an 'edges' field\n\tconst edgesField = fields['edges']\n\tif (!edgesField) return undefined\n\n\t// edges must be a list\n\tconst { namedType: edgesType, isList: edgesIsList } = unwrapType(edgesField.type)\n\tif (!edgesIsList || !isObjectType(edgesType)) return undefined\n\n\t// Each edge must have a 'node' field\n\tconst edgeFields = edgesType.getFields()\n\tconst nodeField = edgeFields['node']\n\tif (!nodeField) return undefined\n\n\tconst { namedType: nodeType } = unwrapType(nodeField.type)\n\tif (!isObjectType(nodeType)) return undefined\n\n\treturn nodeType.name\n}\n\n/**\n * Classify a single GraphQL field into a Stonecrop field definition.\n *\n * Classification rules (in order):\n * 1. Scalar types → look up in merged scalar map\n * 2. Enum types → `Select` with enum values as options\n * 3. Object types that are entities → `Link` with slug as options\n * 4. Object types that are Connections → `Doctype` with node type slug as options\n * 5. List of entity type → `Doctype` with item type slug as options\n * 6. Anything else → `Data` with `_unmapped: true`\n *\n * @param fieldName - The GraphQL field name\n * @param field - The GraphQL field definition\n * @param entityTypes - Set of type names classified as entities\n * @param options - Conversion options (for custom scalars, unmapped meta, etc.)\n * @returns The Stonecrop field definition\n * @public\n */\nexport function classifyFieldType(\n\tfieldName: string,\n\tfield: GraphQLField<unknown, unknown>,\n\tentityTypes: Set<string>,\n\toptions: GraphQLConversionOptions = {}\n): GraphQLConversionFieldMeta {\n\tconst { namedType, required, isList } = unwrapType(field.type)\n\tconst scalarMap = buildScalarMap(options.customScalars)\n\n\tconst base: GraphQLConversionFieldMeta = {\n\t\tfieldname: fieldName,\n\t\tlabel: camelToLabel(fieldName),\n\t\tcomponent: 'ATextInput',\n\t\tfieldtype: 'Data',\n\t}\n\n\tif (required) {\n\t\tbase.required = true\n\t}\n\n\t// 1. Scalar types\n\tif (isScalarType(namedType)) {\n\t\t// Skip internal scalars (e.g., Cursor)\n\t\tif (INTERNAL_SCALARS.has(namedType.name)) {\n\t\t\tbase._unmapped = true\n\t\t\tif (options.includeUnmappedMeta) {\n\t\t\t\tbase._graphqlType = namedType.name\n\t\t\t}\n\t\t\treturn base\n\t\t}\n\n\t\tconst template: FieldTemplate | undefined = scalarMap[namedType.name]\n\t\tif (template) {\n\t\t\tbase.component = template.component\n\t\t\tbase.fieldtype = template.fieldtype\n\t\t} else {\n\t\t\t// Unknown scalar — default to Data with unmapped marker\n\t\t\tbase._unmapped = true\n\t\t\tif (options.includeUnmappedMeta) {\n\t\t\t\tbase._graphqlType = namedType.name\n\t\t\t}\n\t\t}\n\t\treturn base\n\t}\n\n\t// 2. Enum types → Select\n\tif (isEnumType(namedType)) {\n\t\tbase.component = 'ADropdown'\n\t\tbase.fieldtype = 'Select'\n\t\tbase.options = namedType.getValues().map(v => v.name)\n\t\treturn base\n\t}\n\n\t// 3–5. Object types\n\tif (isObjectType(namedType)) {\n\t\t// 3. Direct reference to an entity type → Link\n\t\tif (!isList && entityTypes.has(namedType.name)) {\n\t\t\tbase.component = 'ALink'\n\t\t\tbase.fieldtype = 'Link'\n\t\t\tbase.options = toSlug(namedType.name)\n\t\t\treturn base\n\t\t}\n\n\t\t// 4. Connection type → Doctype (child table)\n\t\tconst connectionNodeTypeName = getConnectionNodeType(namedType)\n\t\tif (connectionNodeTypeName && entityTypes.has(connectionNodeTypeName)) {\n\t\t\tbase.component = 'ATable'\n\t\t\tbase.fieldtype = 'Doctype'\n\t\t\tbase.options = toSlug(connectionNodeTypeName)\n\t\t\treturn base\n\t\t}\n\n\t\t// 5. List of entity type → Doctype\n\t\tif (isList && entityTypes.has(namedType.name)) {\n\t\t\tbase.component = 'ATable'\n\t\t\tbase.fieldtype = 'Doctype'\n\t\t\tbase.options = toSlug(namedType.name)\n\t\t\treturn base\n\t\t}\n\n\t\t// Unknown object type — mark as unmapped\n\t\tbase._unmapped = true\n\t\tif (options.includeUnmappedMeta) {\n\t\t\tbase._graphqlType = namedType.name\n\t\t}\n\t\treturn base\n\t}\n\n\t// Fallback — shouldn't normally be reached\n\tbase._unmapped = true\n\tif (options.includeUnmappedMeta) {\n\t\tbase._graphqlType = namedType.name\n\t}\n\treturn base\n}\n","/**\n * GraphQL Introspection to Stonecrop Schema Converter\n *\n * Converts a standard GraphQL introspection result (or SDL string) into\n * Stonecrop doctype schemas. Source-agnostic — works with any GraphQL server.\n *\n * @packageDocumentation\n */\n\nimport { buildClientSchema, buildSchema, isObjectType, type GraphQLSchema } from 'graphql'\n\nimport { toSlug, pascalToSnake } from '../naming'\nimport type { IntrospectionSource, GraphQLConversionOptions, ConvertedGraphQLDoctype } from './types'\nimport { defaultIsEntityType, defaultIsEntityField, classifyFieldType } from './heuristics'\n\n/**\n * Convert a GraphQL schema to Stonecrop doctype schemas.\n *\n * Accepts either an `IntrospectionQuery` result object or an SDL string.\n * Entity types are identified using heuristics (or a custom `isEntityType` function)\n * and converted to `DoctypeMeta`-compatible JSON objects.\n *\n * @param source - GraphQL introspection result or SDL string\n * @param options - Conversion options for controlling output format and behavior\n * @returns Array of converted Stonecrop doctype definitions\n *\n * @example\n * ```typescript\n * // From introspection result (fetched from any GraphQL server)\n * const introspection = await fetchIntrospection('http://localhost:5000/graphql')\n * const doctypes = convertGraphQLSchema(introspection)\n *\n * // From SDL string\n * const sdl = fs.readFileSync('schema.graphql', 'utf-8')\n * const doctypes = convertGraphQLSchema(sdl)\n *\n * // With PostGraphile custom scalars\n * const doctypes = convertGraphQLSchema(introspection, {\n * customScalars: {\n * BigFloat: { component: 'ADecimalInput', fieldtype: 'Decimal' }\n * }\n * })\n * ```\n *\n * @public\n */\nexport function convertGraphQLSchema(\n\tsource: IntrospectionSource,\n\toptions: GraphQLConversionOptions = {}\n): ConvertedGraphQLDoctype[] {\n\tconst schema = buildGraphQLSchema(source)\n\tconst typeMap = schema.getTypeMap()\n\n\t// Determine the root operation type names to exclude\n\tconst rootTypeNames = new Set<string>()\n\tconst queryType = schema.getQueryType()\n\tconst mutationType = schema.getMutationType()\n\tconst subscriptionType = schema.getSubscriptionType()\n\tif (queryType) rootTypeNames.add(queryType.name)\n\tif (mutationType) rootTypeNames.add(mutationType.name)\n\tif (subscriptionType) rootTypeNames.add(subscriptionType.name)\n\n\t// Use custom or default entity type detector\n\tconst isEntityType = options.isEntityType ?? defaultIsEntityType\n\n\t// Phase 1: Identify all entity types\n\tconst entityTypes = new Set<string>()\n\tfor (const [typeName, type] of Object.entries(typeMap)) {\n\t\tif (!isObjectType(type)) continue\n\n\t\t// Always skip root operation types (even if custom isEntityType doesn't)\n\t\tif (rootTypeNames.has(typeName)) continue\n\n\t\tif (isEntityType(typeName, type)) {\n\t\t\tentityTypes.add(typeName)\n\t\t}\n\t}\n\n\t// Phase 2: Apply include/exclude filters\n\tlet filteredEntityTypes = entityTypes\n\n\tif (options.include) {\n\t\tconst includeSet = new Set(options.include)\n\t\tfilteredEntityTypes = new Set([...entityTypes].filter(t => includeSet.has(t)))\n\t}\n\n\tif (options.exclude) {\n\t\tconst excludeSet = new Set(options.exclude)\n\t\tfilteredEntityTypes = new Set([...filteredEntityTypes].filter(t => !excludeSet.has(t)))\n\t}\n\n\t// Phase 3: Convert each entity type to a doctype\n\tconst isEntityField = options.isEntityField ?? defaultIsEntityField\n\tconst deriveTableName = options.deriveTableName ?? ((typeName: string) => pascalToSnake(typeName))\n\n\tconst doctypes: ConvertedGraphQLDoctype[] = []\n\n\tfor (const typeName of filteredEntityTypes) {\n\t\tconst type = typeMap[typeName]\n\t\tif (!isObjectType(type)) continue\n\n\t\tconst fields = type.getFields()\n\t\tconst typeOverrides = options.typeOverrides?.[typeName]\n\n\t\tconst convertedFields = Object.entries(fields)\n\t\t\t.filter(([fieldName, field]) => isEntityField(fieldName, field, type))\n\t\t\t.map(([fieldName, field]) => {\n\t\t\t\t// Check for full custom classification first\n\t\t\t\tif (options.classifyField) {\n\t\t\t\t\tconst custom = options.classifyField(fieldName, field, type)\n\t\t\t\t\tif (custom !== null && custom !== undefined) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tfieldname: fieldName,\n\t\t\t\t\t\t\tlabel: custom.label ?? fieldName,\n\t\t\t\t\t\t\tcomponent: custom.component ?? 'ATextInput',\n\t\t\t\t\t\t\tfieldtype: custom.fieldtype ?? 'Data',\n\t\t\t\t\t\t\t...custom,\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Default classification\n\t\t\t\tconst classified = classifyFieldType(fieldName, field, entityTypes, options)\n\n\t\t\t\t// Apply per-field overrides\n\t\t\t\tif (typeOverrides?.[fieldName]) {\n\t\t\t\t\treturn { ...classified, ...typeOverrides[fieldName] }\n\t\t\t\t}\n\n\t\t\t\treturn classified\n\t\t\t})\n\t\t\t// Clean up internal metadata unless requested\n\t\t\t.map(field => {\n\t\t\t\tif (!options.includeUnmappedMeta) {\n\t\t\t\t\tconst { _graphqlType, _unmapped, ...clean } = field\n\t\t\t\t\treturn clean\n\t\t\t\t}\n\t\t\t\treturn field\n\t\t\t})\n\n\t\tconst doctype: ConvertedGraphQLDoctype = {\n\t\t\tname: typeName,\n\t\t\tslug: toSlug(typeName),\n\t\t\tfields: convertedFields,\n\t\t}\n\n\t\tconst tableName = deriveTableName(typeName)\n\t\tif (tableName) {\n\t\t\tdoctype.tableName = tableName\n\t\t}\n\n\t\tif (options.includeUnmappedMeta) {\n\t\t\tdoctype._graphqlTypeName = typeName\n\t\t}\n\n\t\tdoctypes.push(doctype)\n\t}\n\n\treturn doctypes\n}\n\n/**\n * Build a GraphQLSchema from either an introspection result or SDL string.\n *\n * @param source - IntrospectionQuery object or SDL string\n * @returns A complete GraphQLSchema\n * @internal\n */\nfunction buildGraphQLSchema(source: IntrospectionSource): GraphQLSchema {\n\tif (typeof source === 'string') {\n\t\t// SDL string\n\t\treturn buildSchema(source)\n\t}\n\n\t// IntrospectionQuery result\n\treturn buildClientSchema(source)\n}\n\n// ═══════════════════════════════════════════════════════════════\n// Re-exports\n// ═══════════════════════════════════════════════════════════════\n\n// Main converter (this file)\nexport { convertGraphQLSchema as default }\n\n// Types\nexport type {\n\tIntrospectionSource,\n\tGraphQLConversionOptions,\n\tGraphQLConversionFieldMeta,\n\tConvertedGraphQLDoctype,\n} from './types'\n\n// Scalar maps\nexport { GQL_SCALAR_MAP, WELL_KNOWN_SCALARS, INTERNAL_SCALARS, buildScalarMap } from './scalars'\n\n// Heuristics\nexport { defaultIsEntityType, defaultIsEntityField, classifyFieldType } from './heuristics'\n\n// Naming utilities\nexport { toSlug, toPascalCase, pascalToSnake, snakeToCamel, camelToSnake, snakeToLabel, camelToLabel } from '../naming'\n"],"names":["StonecropFieldType","z","TYPE_MAP","getDefaultComponent","fieldtype","FieldOptions","FieldValidation","FieldMeta","ActionDefinition","WorkflowMeta","DoctypeMeta","validateField","data","result","issue","validateDoctype","parseField","parseDoctype","snakeToCamel","snakeCase","_","letter","camelToSnake","camelCase","snakeToLabel","word","camelToLabel","withSpaces","toPascalCase","tableName","toSlug","name","pascalToSnake","pascal","GQL_SCALAR_MAP","WELL_KNOWN_SCALARS","INTERNAL_SCALARS","buildScalarMap","customScalars","merged","key","value","SYNTHETIC_SUFFIXES","ROOT_TYPE_NAMES","defaultIsEntityType","typeName","type","suffix","fields","SKIP_FIELDS","defaultIsEntityField","fieldName","_field","_parentType","unwrapType","required","isList","current","isNonNullType","isListType","getConnectionNodeType","edgesField","edgesType","edgesIsList","isObjectType","nodeField","nodeType","classifyFieldType","field","entityTypes","options","namedType","scalarMap","base","isScalarType","template","isEnumType","v","connectionNodeTypeName","convertGraphQLSchema","source","schema","buildGraphQLSchema","typeMap","rootTypeNames","queryType","mutationType","subscriptionType","isEntityType","filteredEntityTypes","includeSet","t","excludeSet","isEntityField","deriveTableName","doctypes","typeOverrides","convertedFields","custom","classified","_graphqlType","_unmapped","clean","doctype","buildSchema","buildClientSchema"],"mappings":";;AAOO,MAAMA,IAAqBC,EAChC,KAAK;AAAA,EACL;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACD,CAAC,EACA,KAAK;AAAA,EACL,OAAO;AAAA,EACP,aAAa;AACd,CAAC,GA6BWC,IAAsD;AAAA;AAAA,EAElE,MAAM,EAAE,WAAW,cAAc,WAAW,OAAA;AAAA,EAC5C,MAAM,EAAE,WAAW,cAAc,WAAW,OAAA;AAAA;AAAA,EAG5C,KAAK,EAAE,WAAW,iBAAiB,WAAW,MAAA;AAAA,EAC9C,OA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GAAGA;AAAA,UAAA;AAAA,MAGN;AAGA,YAAMC,IAAahC,GAAkBhB,GAAWiB,GAAOC,GAAaC,CAAO;AAG3E,aAAI0B,IAAgB7C,CAAS,IACrB,EAAE,GAAGgD,GAAY,GAAGH,EAAc7C,CAAS,EAAA,IAG5CgD;AAAA,IACR,CAAC,EAEA,IAAI,CAAA/B,MAAS;AACb,UAAI,CAACE,EAAQ,qBAAqB;AACjC,cAAM,EAAE,cAAA8B,GAAc,WAAAC,GAAW,GAAGC,MAAUlC;AAC9C,eAAOkC;AAAA,MACR;AACA,aAAOlC;AAAA,IACR,CAAC,GAEImC,IAAmC;AAAA,MACxC,MAAM1D;AAAA,MACN,MAAMf,EAAOe,CAAQ;AAAA,MACrB,QAAQoD;AAAA,IAAA,GAGHpE,IAAYiE,EAAgBjD,CAAQ;AAC1C,IAAIhB,MACH0E,EAAQ,YAAY1E,IAGjByC,EAAQ,wBACXiC,EAAQ,mBAAmB1D,IAG5BkD,EAAS,KAAKQ,CAAO;AAAA,EACtB;AAEA,SAAOR;AACR;AASA,SAASb,GAAmBF,GAA4C;AACvE,SAAI,OAAOA,KAAW,WAEdwB,EAAYxB,CAAM,IAInByB,EAAkBzB,CAAM;AAChC;"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as s, D as l, F as t, a as o, b as i, G as n, I as p, S as d, T as c, W as S, c as A, d as T, e as L, f as r, g as y, h as F, i as f, j as m, k, p as C, l as D, m as M, s as _, n as u, t as E, o as b, v, q as I } from "./index-CzoRIy1-.js";
1
+ import { A as s, D as l, F as t, a as o, b as i, G as n, I as p, S as d, T as c, W as S, c as A, d as T, e as L, f as r, g as y, h as F, i as f, j as m, k, p as C, l as D, m as M, s as _, n as u, t as E, o as b, v, q as I } from "./index-BatnoC-J.js";
2
2
  export {
3
3
  s as ActionDefinition,
4
4
  l as DoctypeMeta,