@stonecrop/graphql-middleware 0.23.0 → 0.24.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/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import { readdirSync as ge, statSync as me, readFileSync as ye } from "node:fs";
2
- import { join as we } from "node:path";
3
- import { flattenFields as Y, validateDoctype as ue, parseDoctype as fe, isActionAllowedInState as Se, pascalToSnake as $e, camelToSnake as A, resolveLinkRenderMode as oe, getRecordIdField as ke } from "@stonecrop/schema";
4
- import { sideEffectWithPgClient as Ee, loadOneWithPgClient as ce } from "@dataplan/pg";
5
- import { object as ee, constant as be, lambda as ve } from "postgraphile/grafast";
6
- import { gql as Re, extendSchema as Ae, wrapPlans as Me } from "postgraphile/utils";
7
- import { PostGraphileAmberPreset as Oe } from "postgraphile/presets/amber";
8
- import { makePgService as rt } from "postgraphile/adaptors/pg";
9
- function X(e) {
10
- return Y(e).filter((t) => t.kind === "field" && !t.computed);
1
+ import { readdirSync as Se, statSync as $e, readFileSync as ke } from "node:fs";
2
+ import { join as Ee } from "node:path";
3
+ import { flattenFields as z, validateDoctype as pe, parseDoctype as ge, isActionAllowedInState as be, pascalToSnake as ve, camelToSnake as R, getDisplayField as Re, getRecordIdField as me, resolveLinkRenderMode as ie } from "@stonecrop/schema";
4
+ import { sideEffectWithPgClient as Ae, loadOneWithPgClient as de } from "@dataplan/pg";
5
+ import { object as ne, constant as Me, lambda as Oe } from "postgraphile/grafast";
6
+ import { gql as xe, extendSchema as Fe, wrapPlans as Te } from "postgraphile/utils";
7
+ import { PostGraphileAmberPreset as Le } from "postgraphile/presets/amber";
8
+ import { makePgService as ct } from "postgraphile/adaptors/pg";
9
+ function ee(e) {
10
+ return z(e).filter((t) => t.kind === "field" && !t.computed);
11
11
  }
12
- const P = /* @__PURE__ */ new Map();
13
- class re extends Error {
12
+ const W = /* @__PURE__ */ new Map();
13
+ class ae extends Error {
14
14
  constructor(t, o) {
15
15
  const n = o.map((r) => ` ${r.path.join(".")}: ${r.message}`).join(`
16
16
  `);
@@ -20,126 +20,126 @@ ${n}`), this.file = t, this.errors = o, this.name = "DoctypeValidationError";
20
20
  file;
21
21
  errors;
22
22
  }
23
- function xe(e, t = {}) {
24
- const o = ge(e);
23
+ function Ne(e, t = {}) {
24
+ const o = Se(e);
25
25
  for (const n of o) {
26
- const r = we(e, n);
27
- me(r).isDirectory() ? xe(r, t) : n.endsWith(".json") && Te(r, t);
26
+ const r = Ee(e, n);
27
+ $e(r).isDirectory() ? Ne(r, t) : n.endsWith(".json") && De(r, t);
28
28
  }
29
29
  }
30
- function Te(e, t) {
31
- const o = ye(e, "utf-8");
30
+ function De(e, t) {
31
+ const o = ke(e, "utf-8");
32
32
  let n;
33
33
  try {
34
34
  n = JSON.parse(o);
35
- } catch (l) {
36
- const d = {
35
+ } catch (a) {
36
+ const u = {
37
37
  path: [],
38
- message: `Invalid JSON: ${l instanceof Error ? l.message : String(l)}`
38
+ message: `Invalid JSON: ${a instanceof Error ? a.message : String(a)}`
39
39
  };
40
40
  if (t.continueOnError) {
41
- t.onError?.(e, [d]);
41
+ t.onError?.(e, [u]);
42
42
  return;
43
43
  }
44
- throw new re(e, [d]);
44
+ throw new ae(e, [u]);
45
45
  }
46
- const r = ue(n);
46
+ const r = pe(n);
47
47
  if (!r.success) {
48
48
  if (t.continueOnError) {
49
49
  t.onError?.(e, r.errors);
50
50
  return;
51
51
  }
52
- throw new re(e, r.errors);
52
+ throw new ae(e, r.errors);
53
53
  }
54
- const i = fe(n);
55
- P.set(i.name, i);
54
+ const i = ge(n);
55
+ W.set(i.name, i);
56
56
  }
57
- function Qe(e, t = {}) {
57
+ function Ze(e, t = {}) {
58
58
  for (const [o, n] of Object.entries(e)) {
59
- const r = { ...typeof n == "object" && n !== null ? n : {}, name: o }, i = ue(r);
59
+ const r = { ...typeof n == "object" && n !== null ? n : {}, name: o }, i = pe(r);
60
60
  if (!i.success) {
61
61
  if (t.continueOnError) {
62
62
  t.onError?.(o, i.errors);
63
63
  continue;
64
64
  }
65
- throw new re(o, i.errors);
65
+ throw new ae(o, i.errors);
66
66
  }
67
- const l = fe(r);
68
- P.set(l.name, l);
67
+ const a = ge(r);
68
+ W.set(a.name, a);
69
69
  }
70
70
  }
71
- function I(e) {
72
- const t = P.get(e);
71
+ function L(e) {
72
+ const t = W.get(e);
73
73
  if (t) return t;
74
- for (const o of P.values())
74
+ for (const o of W.values())
75
75
  if (o.slug === e) return o;
76
76
  }
77
- function he() {
78
- return Array.from(P.values());
77
+ function ye() {
78
+ return Array.from(W.values());
79
79
  }
80
- function Ve(e) {
81
- return P.has(e);
80
+ function et(e) {
81
+ return W.has(e);
82
82
  }
83
- function ze() {
84
- P.clear();
83
+ function tt() {
84
+ W.clear();
85
85
  }
86
- function Le() {
86
+ function Ie() {
87
87
  const e = [];
88
- for (const t of P.values()) {
89
- t.inherits && I(t.inherits) === void 0 && e.push({
88
+ for (const t of W.values()) {
89
+ t.inherits && L(t.inherits) === void 0 && e.push({
90
90
  path: [t.name, "inherits"],
91
91
  message: `References unknown doctype: ${t.inherits}`
92
92
  });
93
- const o = Y(t.fields);
93
+ const o = z(t.fields);
94
94
  for (const n of o) {
95
95
  if (n.kind !== "field") continue;
96
96
  const r = n.doctype;
97
- r !== void 0 && I(r) === void 0 && e.push({
97
+ r !== void 0 && L(r) === void 0 && e.push({
98
98
  path: [t.name, "fields", n.fieldname, "doctype"],
99
99
  message: `Link references unknown doctype: ${r}`
100
100
  });
101
101
  }
102
102
  if (t.links) {
103
- const n = new Set(o.map((i) => i.fieldname)), r = new Set(X(t.fields).map((i) => i.fieldname));
104
- for (const [i, l] of Object.entries(t.links)) {
105
- if (I(l.target) === void 0 && e.push({
103
+ const n = new Set(o.map((i) => i.fieldname)), r = new Set(ee(t.fields).map((i) => i.fieldname));
104
+ for (const [i, a] of Object.entries(t.links)) {
105
+ if (L(a.target) === void 0 && e.push({
106
106
  path: [t.name, "links", i, "target"],
107
- message: `Link references unknown doctype: ${l.target}`
108
- }), l.fetch?.method === "custom") continue;
109
- if (l.cardinality === "noneOrMany" || l.cardinality === "atLeastOne") {
110
- l.backlink || e.push({
107
+ message: `Link references unknown doctype: ${a.target}`
108
+ }), a.fetch?.method === "custom") continue;
109
+ if (a.cardinality === "noneOrMany" || a.cardinality === "atLeastOne") {
110
+ a.backlink || e.push({
111
111
  path: [t.name, "links", i, "backlink"],
112
- message: `Link "${i}" is ${l.cardinality} but names no \`backlink\`, so the runtime cannot find the target rows and drops the link with no error. Name the field on "${l.target}" that points back to this doctype.`
112
+ message: `Link "${i}" is ${a.cardinality} but names no \`backlink\`, so the runtime cannot find the target rows and drops the link with no error. Name the field on "${a.target}" that points back to this doctype.`
113
113
  });
114
114
  continue;
115
115
  }
116
- const d = l.fieldname ?? i;
117
- r.has(d) || e.push({
116
+ const u = a.fieldname ?? i;
117
+ r.has(u) || e.push({
118
118
  // Point at whichever half actually carries the binding: the `fieldname`
119
119
  // property when it is set, otherwise the key itself. Naming `target` here
120
120
  // would send the reader to the one part that resolved correctly.
121
- path: l.fieldname ? [t.name, "links", i, "fieldname"] : [t.name, "links", i],
121
+ path: a.fieldname ? [t.name, "links", i, "fieldname"] : [t.name, "links", i],
122
122
  // Two different repairs, so two different diagnoses: a name nothing declares
123
123
  // is a typo, while a name that resolves to a column-less field is a binding
124
124
  // pointed at the wrong one of several real fields.
125
- message: n.has(d) ? `Link "${i}" binds to field "${d}", which has no database column of its own — it is computed, or a container rather than a value — so there is no foreign key to read and the record read fails on the missing column. Bind the link to the field holding the foreign key.` : `Link "${i}" binds to field "${d}", which this doctype does not declare, so it resolves to null with no error. Declare that field, or set \`fieldname\` to the field holding the foreign key. (A link's key is its fieldname unless \`fieldname\` overrides it.)`
125
+ message: n.has(u) ? `Link "${i}" binds to field "${u}", which has no database column of its own — it is computed, or a container rather than a value — so there is no foreign key to read and the record read fails on the missing column. Bind the link to the field holding the foreign key.` : `Link "${i}" binds to field "${u}", which this doctype does not declare, so it resolves to null with no error. Declare that field, or set \`fieldname\` to the field holding the foreign key. (A link's key is its fieldname unless \`fieldname\` overrides it.)`
126
126
  });
127
127
  }
128
128
  }
129
129
  }
130
130
  return e;
131
131
  }
132
- const ie = /* @__PURE__ */ new Map();
133
- function Ye(e, t) {
134
- ie.set(e, t);
132
+ const se = /* @__PURE__ */ new Map();
133
+ function nt(e, t) {
134
+ se.set(e, t);
135
135
  }
136
- function Ne(e) {
137
- return ie.get(e);
136
+ function Be(e) {
137
+ return se.get(e);
138
138
  }
139
- function Xe() {
140
- ie.clear();
139
+ function ot() {
140
+ se.clear();
141
141
  }
142
- async function Fe(e, t, o) {
142
+ async function je(e, t, o) {
143
143
  const n = e.label ?? "unknown", r = e.selfTransition === !0, i = r || e.nextState != null;
144
144
  if (!i && !t.runEffect)
145
145
  return {
@@ -153,18 +153,18 @@ async function Fe(e, t, o) {
153
153
  data: null,
154
154
  error: `Action "${n}" persists record data in place, which this backend does not support.`
155
155
  };
156
- const l = (e.allowedStates?.length ?? 0) > 0;
157
- let d;
158
- if (l || i) {
159
- const v = await t.readState();
160
- if (v === null) {
156
+ const a = (e.allowedStates?.length ?? 0) > 0;
157
+ let u;
158
+ if (a || i) {
159
+ const k = await t.readState();
160
+ if (k === null) {
161
161
  if (r && t.writeData) {
162
- const R = await t.writeData(o ?? {}, !1);
163
- return !R || Object.keys(R).length === 0 ? {
162
+ const E = await t.writeData(o ?? {}, !1);
163
+ return !E || Object.keys(E).length === 0 ? {
164
164
  success: !1,
165
165
  data: null,
166
166
  error: `Action "${n}" targets a record that does not exist, and the backend did not create it.`
167
- } : { success: !0, data: R, error: null };
167
+ } : { success: !0, data: E, error: null };
168
168
  }
169
169
  return {
170
170
  success: !1,
@@ -172,36 +172,86 @@ async function Fe(e, t, o) {
172
172
  error: `Action "${n}" targets a record that does not exist — nothing was executed.`
173
173
  };
174
174
  }
175
- d = v ?? "";
175
+ u = k ?? "";
176
176
  }
177
- if (!Se(e, d ?? ""))
177
+ if (!be(e, u ?? ""))
178
178
  return {
179
179
  success: !1,
180
180
  data: null,
181
- error: `Action not allowed from state: ${d || "(unknown)"}`
181
+ error: `Action not allowed from state: ${u || "(unknown)"}`
182
182
  };
183
- let b;
183
+ let $;
184
184
  if (t.runEffect)
185
185
  try {
186
- b = await t.runEffect(d);
187
- } catch (v) {
186
+ $ = await t.runEffect(u);
187
+ } catch (k) {
188
188
  return {
189
189
  success: !1,
190
190
  data: null,
191
- error: `Action "${n}" failed: ${v instanceof Error ? v.message : String(v)}`
191
+ error: `Action "${n}" failed: ${k instanceof Error ? k.message : String(k)}`
192
192
  };
193
193
  }
194
- return r ? { success: !0, data: (t.writeData ? await t.writeData(o ?? {}, !0) : b) ?? null, error: null } : e.nextState == null ? { success: !0, data: b ?? null, error: null } : (await t.writeState(e.nextState), {
194
+ return r ? { success: !0, data: (t.writeData ? await t.writeData(o ?? {}, !0) : $) ?? null, error: null } : e.nextState == null ? { success: !0, data: $ ?? null, error: null } : (await t.writeState(e.nextState), {
195
195
  success: !0,
196
- data: b ?? { state: e.nextState },
196
+ data: $ ?? { state: e.nextState },
197
197
  error: null
198
198
  });
199
199
  }
200
- function W(e, t) {
201
- const o = t?.[e] ?? $e(e), n = o.indexOf(".");
200
+ function P(e, t) {
201
+ const o = t?.[e] ?? ve(e), n = o.indexOf(".");
202
202
  return n > 0 ? `"${o.slice(0, n)}"."${o.slice(n + 1)}"` : `"${o}"`;
203
203
  }
204
- const De = Re`
204
+ function X(e) {
205
+ if (!(e == null || typeof e == "object")) {
206
+ if (typeof e == "string") return e === "" ? void 0 : e;
207
+ if (typeof e == "number" || typeof e == "boolean" || typeof e == "bigint")
208
+ return String(e);
209
+ }
210
+ }
211
+ function Ce(e, t) {
212
+ const o = [];
213
+ for (const n of z(e.fields)) {
214
+ if (n.kind !== "field" || !n.doctype) continue;
215
+ const r = L(n.doctype);
216
+ if (!r) continue;
217
+ const i = Re(r.fields, r.displayField);
218
+ i && o.push({
219
+ fieldname: n.fieldname,
220
+ displayField: i.fieldname,
221
+ targetPkFieldname: me(r.fields),
222
+ targetTable: P(r.name, t)
223
+ });
224
+ }
225
+ return o;
226
+ }
227
+ async function ue(e, t, o, n, r) {
228
+ const i = Ce(t, n);
229
+ i.length === 0 || o.length === 0 || await Promise.all(
230
+ i.map(async (a) => {
231
+ const u = /* @__PURE__ */ new Set();
232
+ for (const w of o) {
233
+ const f = X(w[a.fieldname]);
234
+ f !== void 0 && u.add(f);
235
+ }
236
+ if (u.size === 0) return;
237
+ const $ = R(a.targetPkFieldname), k = R(a.displayField), E = k !== a.displayField ? `"${k}" AS "${a.displayField}"` : `"${a.displayField}"`, { rows: h } = await r(e, {
238
+ text: `SELECT "${$}" AS "${a.targetPkFieldname}", ${E} FROM ${a.targetTable} WHERE "${$}"::text = ANY($1::text[])`,
239
+ values: [Array.from(u)]
240
+ }), y = /* @__PURE__ */ new Map();
241
+ for (const w of h) {
242
+ const f = X(w[a.targetPkFieldname]), s = X(w[a.displayField]);
243
+ f === void 0 || s === void 0 || y.set(f, s);
244
+ }
245
+ for (const w of o) {
246
+ const f = w[a.fieldname], s = X(f);
247
+ if (s === void 0) continue;
248
+ const p = y.get(s);
249
+ p !== void 0 && (w[a.fieldname] = { id: f, displayText: p });
250
+ }
251
+ })
252
+ );
253
+ }
254
+ const Pe = xe`
205
255
  type StonecropFieldMeta {
206
256
  kind: String!
207
257
  fieldname: String!
@@ -312,186 +362,191 @@ const De = Re`
312
362
  stonecropAction(doctype: String!, action: String!, args: JSON): StonecropActionResult!
313
363
  }
314
364
  `;
315
- class le extends Error {
365
+ class fe extends Error {
316
366
  constructor(t) {
317
367
  super(t.error ?? "Action failed"), this.outcome = t, this.name = "ActionRolledBack";
318
368
  }
319
369
  outcome;
320
370
  }
321
- const de = "__stonecropLinkFk_", Q = "status", Ze = (e = {}) => {
371
+ const he = "__stonecropLinkFk_", V = "status", rt = (e = {}) => {
322
372
  const t = e.debug ? (n, r) => (console.log(`[@stonecrop/graphql-middleware] ${r.text}`, r.values ?? []), n.query(r)) : (n, r) => n.query(r), o = e.defaultRecordLimit === void 0 ? 200 : e.defaultRecordLimit;
323
- return Ae((n) => {
373
+ return Fe((n) => {
324
374
  const r = n.input?.pgRegistry?.pgExecutors, i = r ? Object.values(r)[0] : void 0;
325
375
  if (!i)
326
376
  throw new Error("StonecropPlugin: no pgExecutors found — ensure pgServices is configured");
327
- return e.actionHandlers && Be(e.actionHandlers), je(), {
328
- typeDefs: De,
377
+ return e.actionHandlers && He(e.actionHandlers), qe(), {
378
+ typeDefs: Pe,
329
379
  objects: {
330
380
  Query: {
331
381
  plans: {
332
- stonecropMeta(l, { $doctype: d }) {
333
- return ve(d, (b) => I(String(b)) ?? null);
382
+ stonecropMeta(a, { $doctype: u }) {
383
+ return Oe(u, ($) => L(String($)) ?? null);
334
384
  },
335
385
  stonecropAllMeta() {
336
- return be(he());
386
+ return Me(ye());
337
387
  },
338
- stonecropRecord(l, { $doctype: d, $id: b, $options: v }) {
339
- return ce(
388
+ stonecropRecord(a, { $doctype: u, $id: $, $options: k }) {
389
+ return de(
340
390
  i,
341
- ee({ doctype: d, id: b, options: v }),
342
- async (R, h) => {
343
- const w = /* @__PURE__ */ new Map();
344
- for (let g = 0; g < h.length; g++) {
345
- const c = String(h[g].doctype);
346
- w.has(c) || w.set(c, []), w.get(c).push(g);
391
+ ne({ doctype: u, id: $, options: k }),
392
+ async (E, h) => {
393
+ const y = /* @__PURE__ */ new Map();
394
+ for (let f = 0; f < h.length; f++) {
395
+ const s = String(h[f].doctype);
396
+ y.has(s) || y.set(s, []), y.get(s).push(f);
347
397
  }
348
- const M = Array.from({ length: h.length });
349
- for (const [g, c] of w) {
350
- const m = I(g);
351
- if (!m) {
352
- for (const a of c) M[a] = { data: null, doctype: g };
398
+ const w = Array.from({ length: h.length });
399
+ for (const [f, s] of y) {
400
+ const p = L(f);
401
+ if (!p) {
402
+ for (const c of s) w[c] = { data: null, doctype: f };
353
403
  continue;
354
404
  }
355
- const p = te(m);
356
- if (!p) throw ne(g);
357
- const B = A(p.fieldname), H = z(m), O = c.map((a) => String(h[a].id)), F = new Map(Y(m.fields).map((a) => [a.fieldname, a])), L = [];
358
- for (const [a, f] of Object.entries(m.links ?? {})) {
359
- if (f.cardinality === "noneOrMany" || f.cardinality === "atLeastOne") continue;
360
- const y = f.fieldname ?? a;
361
- oe(f, F.get(y)?.component) !== "inline" && L.push({ fieldname: y, alias: `${de}${y}` });
405
+ const m = oe(p);
406
+ if (!m) throw re(f);
407
+ const I = R(m.fieldname), q = Z(p), x = s.map((c) => String(h[c].id)), N = new Map(z(p.fields).map((c) => [c.fieldname, c])), T = [];
408
+ for (const [c, g] of Object.entries(p.links ?? {})) {
409
+ if (g.cardinality === "noneOrMany" || g.cardinality === "atLeastOne") continue;
410
+ const M = g.fieldname ?? c;
411
+ ie(g, N.get(M)?.component) !== "inline" && T.push({ fieldname: M, alias: `${he}${M}` });
362
412
  }
363
- const q = [
364
- H,
365
- ...L.map(({ fieldname: a, alias: f }) => `"${A(a)}" AS "${f}"`)
366
- ].filter(Boolean).join(", "), { rows: s } = await t(R, {
367
- text: `SELECT ${q} FROM ${W(m.name, e.tables)} WHERE "${B}"::text = ANY($1::text[])`,
368
- values: [O]
369
- }), $ = new Map(s.map((a) => [String(a[p.fieldname]), a]));
370
- if (s.length !== $.size)
413
+ const U = [
414
+ q,
415
+ ...T.map(({ fieldname: c, alias: g }) => `"${R(c)}" AS "${g}"`)
416
+ ].filter(Boolean).join(", "), { rows: l } = await t(E, {
417
+ text: `SELECT ${U} FROM ${P(p.name, e.tables)} WHERE "${I}"::text = ANY($1::text[])`,
418
+ values: [x]
419
+ }), b = new Map(l.map((c) => [String(c[m.fieldname]), c]));
420
+ if (l.length !== b.size)
371
421
  throw new Error(
372
- `Doctype "${g}" declares "${p.fieldname}" as its identity, but that column is not unique in ${W(m.name, e.tables)} — ${s.length} rows matched ${$.size} distinct values, so a lookup cannot say which record it means. Declare a field that uniquely identifies a record, or add a unique constraint.`
422
+ `Doctype "${f}" declares "${m.fieldname}" as its identity, but that column is not unique in ${P(p.name, e.tables)} — ${l.length} rows matched ${b.size} distinct values, so a lookup cannot say which record it means. Declare a field that uniquely identifies a record, or add a unique constraint.`
373
423
  );
374
- for (const a of c) {
375
- const f = String(h[a].id), y = $.get(f);
376
- if (!y) {
377
- M[a] = { data: null, doctype: g };
424
+ const S = [];
425
+ for (const c of s) {
426
+ const g = String(h[c].id), M = b.get(g);
427
+ if (!M) {
428
+ w[c] = { data: null, doctype: f };
378
429
  continue;
379
430
  }
380
- const k = { ...y }, u = [], E = h[a].options ?? {}, N = E.includeNested === !0, S = Array.isArray(E.includeNested) ? new Set(E.includeNested) : null;
381
- if (m.links)
382
- for (const [x, T] of Object.entries(m.links)) {
383
- const j = T.fieldname ?? x, J = T.fetch, Z = T.cardinality === "noneOrMany" || T.cardinality === "atLeastOne", se = J?.method ?? (Z ? "sync" : "lazy"), pe = J?.method === "sync" ? J.limit : void 0, G = Z ? pe ?? o : void 0;
384
- if (!(N || (S ? S.has(x) : se === "sync"))) continue;
385
- if (se === "custom" && J?.method === "custom") {
386
- const _ = J.handler, C = Ne(_);
387
- C && (k[j] = await C(R, k, T));
431
+ const d = { ...M };
432
+ S.push(d);
433
+ const v = [], O = h[c].options ?? {}, A = O.includeNested === !0, F = Array.isArray(O.includeNested) ? new Set(O.includeNested) : null;
434
+ if (p.links)
435
+ for (const [B, D] of Object.entries(p.links)) {
436
+ const j = D.fieldname ?? B, K = D.fetch, te = D.cardinality === "noneOrMany" || D.cardinality === "atLeastOne", le = K?.method ?? (te ? "sync" : "lazy"), we = K?.method === "sync" ? K.limit : void 0, G = te ? we ?? o : void 0;
437
+ if (!(A || (F ? F.has(B) : le === "sync"))) continue;
438
+ if (le === "custom" && K?.method === "custom") {
439
+ const J = K.handler, C = Be(J);
440
+ C && (d[j] = await C(E, d, D));
388
441
  continue;
389
442
  }
390
- if (oe(T, F.get(j)?.component) === "inline") continue;
391
- const U = I(T.target);
392
- if (!U) continue;
393
- const ae = z(U);
394
- if (Z) {
395
- if (!T.backlink) continue;
396
- const _ = A(T.backlink);
397
- let C = `SELECT ${ae} FROM ${W(U.name, e.tables)} WHERE "${_}"::text = $1`;
398
- const V = [f];
399
- G != null && (C += " LIMIT $2", V.push(G + 1));
400
- const { rows: K } = await t(R, {
443
+ if (ie(D, N.get(j)?.component) === "inline") continue;
444
+ const _ = L(D.target);
445
+ if (!_) continue;
446
+ const ce = Z(_);
447
+ if (te) {
448
+ if (!D.backlink) continue;
449
+ const J = R(D.backlink);
450
+ let C = `SELECT ${ce} FROM ${P(_.name, e.tables)} WHERE "${J}"::text = $1`;
451
+ const Y = [g];
452
+ G != null && (C += " LIMIT $2", Y.push(G + 1));
453
+ const { rows: Q } = await t(E, {
401
454
  text: C,
402
- values: V
455
+ values: Y
403
456
  });
404
- G != null && K.length > G ? (u.push(j), k[j] = K.slice(0, G)) : k[j] = K;
457
+ G != null && Q.length > G ? (v.push(j), d[j] = Q.slice(0, G)) : d[j] = Q;
405
458
  } else {
406
- const _ = k[`${de}${j}`];
407
- if (_ == null) {
408
- k[j] = null;
459
+ const J = d[`${he}${j}`];
460
+ if (J == null) {
461
+ d[j] = null;
409
462
  continue;
410
463
  }
411
- const C = te(U);
412
- if (!C) throw ne(U.name);
413
- const V = A(C.fieldname), { rows: K } = await t(R, {
414
- text: `SELECT ${ae} FROM ${W(U.name, e.tables)} WHERE "${V}" = $1`,
415
- values: [_]
464
+ const C = oe(_);
465
+ if (!C) throw re(_.name);
466
+ const Y = R(C.fieldname), { rows: Q } = await t(E, {
467
+ text: `SELECT ${ce} FROM ${P(_.name, e.tables)} WHERE "${Y}" = $1`,
468
+ values: [J]
416
469
  });
417
- k[j] = K[0] ?? null;
470
+ d[j] = Q[0] ?? null;
418
471
  }
419
472
  }
420
- for (const { alias: x } of L) delete k[x];
421
- const D = S && m.links ? [...S].filter((x) => !(x in m.links)) : void 0;
422
- M[a] = {
423
- data: k,
424
- doctype: g,
425
- unknownLinks: D?.length ? D : void 0,
426
- truncatedLinks: u.length ? u : void 0
473
+ for (const { alias: B } of T) delete d[B];
474
+ const H = F && p.links ? [...F].filter((B) => !(B in p.links)) : void 0;
475
+ w[c] = {
476
+ data: d,
477
+ doctype: f,
478
+ unknownLinks: H?.length ? H : void 0,
479
+ truncatedLinks: v.length ? v : void 0
427
480
  };
428
481
  }
482
+ await ue(E, p, S, e.tables, t);
429
483
  }
430
- return M;
484
+ return w;
431
485
  }
432
486
  );
433
487
  },
434
- stonecropRecords(l, { $doctype: d, $filters: b, $orderBy: v, $limit: R, $offset: h, $includeTotal: w }) {
435
- return ce(
488
+ stonecropRecords(a, { $doctype: u, $filters: $, $orderBy: k, $limit: E, $offset: h, $includeTotal: y }) {
489
+ return de(
436
490
  i,
437
- ee({
438
- doctype: d,
439
- filters: b,
440
- orderBy: v,
441
- limit: R,
491
+ ne({
492
+ doctype: u,
493
+ filters: $,
494
+ orderBy: k,
495
+ limit: E,
442
496
  offset: h,
443
- includeTotal: w
497
+ includeTotal: y
444
498
  }),
445
- async (M, g) => await Promise.all(
446
- g.map(async (c) => {
447
- const m = String(c.doctype), p = I(m);
448
- if (!p)
449
- return { data: [], doctype: m, hasMore: !1, count: c.includeTotal === !0 ? 0 : null };
450
- const B = new Set(Y(p.fields).map((u) => u.fieldname)), H = z(p), O = [], F = [];
451
- if (c.filters != null)
452
- for (const [u, E] of Object.entries(c.filters)) {
453
- if (!B.has(u))
454
- throw new Error(`Unknown filter field: ${u} for doctype ${p.name}`);
455
- O.push(E), F.push(`"${A(u)}" = $${O.length}`);
499
+ async (w, f) => await Promise.all(
500
+ f.map(async (s) => {
501
+ const p = String(s.doctype), m = L(p);
502
+ if (!m)
503
+ return { data: [], doctype: p, hasMore: !1, count: s.includeTotal === !0 ? 0 : null };
504
+ const I = new Set(z(m.fields).map((d) => d.fieldname)), q = Z(m), x = [], N = [];
505
+ if (s.filters != null)
506
+ for (const [d, v] of Object.entries(s.filters)) {
507
+ if (!I.has(d))
508
+ throw new Error(`Unknown filter field: ${d} for doctype ${m.name}`);
509
+ x.push(v), N.push(`"${R(d)}" = $${x.length}`);
456
510
  }
457
- const L = F.length > 0 ? ` WHERE ${F.join(" AND ")}` : "";
458
- let q = "";
459
- if (c.orderBy != null) {
460
- if (typeof c.orderBy != "string")
461
- throw new Error(`Invalid orderBy: expected string, got ${typeof c.orderBy}`);
462
- const u = c.orderBy, E = u.lastIndexOf("_");
463
- if (E <= 0)
464
- throw new Error(`Invalid orderBy format: "${u}". Expected FIELD_ASC or FIELD_DESC`);
465
- const N = u.slice(E + 1).toUpperCase();
466
- if (N !== "ASC" && N !== "DESC")
467
- throw new Error(`Invalid orderBy direction: "${N}". Must be ASC or DESC`);
468
- const S = u.slice(0, E);
469
- if (!B.has(S))
470
- throw new Error(`Unknown orderBy field: "${S}" for doctype ${p.name}`);
471
- q = ` ORDER BY "${A(S)}" ${N}`;
511
+ const T = N.length > 0 ? ` WHERE ${N.join(" AND ")}` : "";
512
+ let U = "";
513
+ if (s.orderBy != null) {
514
+ if (typeof s.orderBy != "string")
515
+ throw new Error(`Invalid orderBy: expected string, got ${typeof s.orderBy}`);
516
+ const d = s.orderBy, v = d.lastIndexOf("_");
517
+ if (v <= 0)
518
+ throw new Error(`Invalid orderBy format: "${d}". Expected FIELD_ASC or FIELD_DESC`);
519
+ const O = d.slice(v + 1).toUpperCase();
520
+ if (O !== "ASC" && O !== "DESC")
521
+ throw new Error(`Invalid orderBy direction: "${O}". Must be ASC or DESC`);
522
+ const A = d.slice(0, v);
523
+ if (!I.has(A))
524
+ throw new Error(`Unknown orderBy field: "${A}" for doctype ${m.name}`);
525
+ U = ` ORDER BY "${R(A)}" ${O}`;
472
526
  }
473
- if (c.limit != null && typeof c.limit != "number")
474
- throw new Error(`Invalid limit: expected number, got ${typeof c.limit}`);
475
- const s = c.limit ?? o;
476
- let $ = "";
477
- s != null && (O.push(s + 1), $ += ` LIMIT $${O.length}`), c.offset != null && (O.push(c.offset), $ += ` OFFSET $${O.length}`);
478
- const { rows: a } = await t(M, {
479
- text: `SELECT ${H} FROM ${W(p.name, e.tables)}${L}${q}${$}`,
480
- values: O
481
- }), f = s != null && a.length > s, y = [...f ? a.slice(0, s ?? a.length) : a];
482
- let k = null;
483
- if (c.includeTotal === !0) {
484
- const u = [], E = [];
485
- if (c.filters != null)
486
- for (const [D, x] of Object.entries(c.filters))
487
- B.has(D) && (u.push(x), E.push(`"${A(D)}" = $${u.length}`));
488
- const N = E.length > 0 ? ` WHERE ${E.join(" AND ")}` : "", { rows: S } = await t(M, {
489
- text: `SELECT COUNT(*) AS row_count FROM ${W(p.name, e.tables)}${N}`,
490
- values: u
527
+ if (s.limit != null && typeof s.limit != "number")
528
+ throw new Error(`Invalid limit: expected number, got ${typeof s.limit}`);
529
+ const l = s.limit ?? o;
530
+ let b = "";
531
+ l != null && (x.push(l + 1), b += ` LIMIT $${x.length}`), s.offset != null && (x.push(s.offset), b += ` OFFSET $${x.length}`);
532
+ const { rows: S } = await t(w, {
533
+ text: `SELECT ${q} FROM ${P(m.name, e.tables)}${T}${U}${b}`,
534
+ values: x
535
+ }), c = l != null && S.length > l, g = [...c ? S.slice(0, l ?? S.length) : S];
536
+ await ue(w, m, g, e.tables, t);
537
+ let M = null;
538
+ if (s.includeTotal === !0) {
539
+ const d = [], v = [];
540
+ if (s.filters != null)
541
+ for (const [F, H] of Object.entries(s.filters))
542
+ I.has(F) && (d.push(H), v.push(`"${R(F)}" = $${d.length}`));
543
+ const O = v.length > 0 ? ` WHERE ${v.join(" AND ")}` : "", { rows: A } = await t(w, {
544
+ text: `SELECT COUNT(*) AS row_count FROM ${P(m.name, e.tables)}${O}`,
545
+ values: d
491
546
  });
492
- k = parseInt(S[0]?.row_count ?? "0", 10);
547
+ M = parseInt(A[0]?.row_count ?? "0", 10);
493
548
  }
494
- return { data: y, doctype: m, hasMore: f, count: k };
549
+ return { data: g, doctype: p, hasMore: c, count: M };
495
550
  })
496
551
  )
497
552
  );
@@ -500,67 +555,67 @@ const de = "__stonecropLinkFk_", Q = "status", Ze = (e = {}) => {
500
555
  },
501
556
  Mutation: {
502
557
  plans: {
503
- stonecropAction(l, { $doctype: d, $action: b, $args: v }) {
504
- return Ee(
558
+ stonecropAction(a, { $doctype: u, $action: $, $args: k }) {
559
+ return Ae(
505
560
  i,
506
- ee({ doctype: d, action: b, actionArgs: v }),
507
- async (R, h) => {
508
- const w = I(String(h.doctype));
509
- if (!w)
561
+ ne({ doctype: u, action: $, actionArgs: k }),
562
+ async (E, h) => {
563
+ const y = L(String(h.doctype));
564
+ if (!y)
510
565
  return {
511
566
  success: !1,
512
567
  data: null,
513
568
  error: `Unknown doctype: ${h.doctype}`
514
569
  };
515
- const M = w.workflow?.actions?.[h.action];
516
- if (!M)
570
+ const w = y.workflow?.actions?.[h.action];
571
+ if (!w)
517
572
  return {
518
573
  success: !1,
519
574
  data: null,
520
575
  error: `Unknown action: ${h.action} on ${h.doctype}`
521
576
  };
522
- const g = W(w.name, e.tables), c = () => {
523
- const s = te(w);
524
- if (!s) throw ne(String(h.doctype));
525
- return A(s.fieldname);
526
- }, m = Array.isArray(h.actionArgs) ? h.actionArgs : [], p = m[0]?.id, B = m[0]?.data ?? {}, H = e.actionHandlers?.[w.name]?.[String(h.action)], O = new Map(
527
- X(w.fields).filter((s) => A(s.fieldname) !== Q).map((s) => [s.fieldname, s])
528
- ), F = X(w.fields).some(
529
- (s) => A(s.fieldname) === Q
530
- ), L = [], q = (s) => {
531
- const $ = [], a = [];
532
- for (const [f, y] of Object.entries(s)) {
533
- if (!O.has(f)) {
534
- L.push(f);
577
+ const f = P(y.name, e.tables), s = () => {
578
+ const l = oe(y);
579
+ if (!l) throw re(String(h.doctype));
580
+ return R(l.fieldname);
581
+ }, p = Array.isArray(h.actionArgs) ? h.actionArgs : [], m = p[0]?.id, I = p[0]?.data ?? {}, q = e.actionHandlers?.[y.name]?.[String(h.action)], x = new Map(
582
+ ee(y.fields).filter((l) => R(l.fieldname) !== V).map((l) => [l.fieldname, l])
583
+ ), N = ee(y.fields).some(
584
+ (l) => R(l.fieldname) === V
585
+ ), T = [], U = (l) => {
586
+ const b = [], S = [];
587
+ for (const [c, g] of Object.entries(l)) {
588
+ if (!x.has(c)) {
589
+ T.push(c);
535
590
  continue;
536
591
  }
537
- if (y !== null && typeof y == "object") {
538
- L.push(f);
592
+ if (g !== null && typeof g == "object") {
593
+ T.push(c);
539
594
  continue;
540
595
  }
541
- $.push(A(f)), a.push(y);
596
+ b.push(R(c)), S.push(g);
542
597
  }
543
- return { cols: $, values: a };
598
+ return { cols: b, values: S };
544
599
  };
545
600
  try {
546
- return await R.withTransaction(async (s) => {
547
- const $ = await Fe(
548
- M,
601
+ return await E.withTransaction(async (l) => {
602
+ const b = await je(
603
+ w,
549
604
  {
550
605
  readState: async () => {
551
- if (p == null) return null;
552
- const a = F ? `"${Q}"` : `"${c()}"`, { rows: f } = await t(s, {
553
- text: `SELECT ${a} FROM ${g} WHERE "${c()}"::text = $1 FOR UPDATE`,
554
- values: [String(p)]
606
+ if (m == null) return null;
607
+ const S = N ? `"${V}"` : `"${s()}"`, { rows: c } = await t(l, {
608
+ text: `SELECT ${S} FROM ${f} WHERE "${s()}"::text = $1 FOR UPDATE`,
609
+ values: [String(m)]
555
610
  });
556
- if (f.length === 0) return null;
557
- if (F)
558
- return f[0][Q] ?? void 0;
611
+ if (c.length === 0) return null;
612
+ if (N)
613
+ return c[0][V] ?? void 0;
559
614
  },
560
- writeState: async (a) => {
561
- await t(s, {
562
- text: `UPDATE ${g} SET "${Q}" = $1 WHERE "${c()}"::text = $2`,
563
- values: [a, String(p)]
615
+ writeState: async (S) => {
616
+ await t(l, {
617
+ text: `UPDATE ${f} SET "${V}" = $1 WHERE "${s()}"::text = $2`,
618
+ values: [S, String(m)]
564
619
  });
565
620
  },
566
621
  // The upsert, and the only write path for record data. `exists`
@@ -572,53 +627,53 @@ const de = "__stonecropLinkFk_", Q = "status", Ze = (e = {}) => {
572
627
  // `itemId` would receive `item_id`, find no identity, and file a
573
628
  // created record nowhere — which is that exact bug, already once
574
629
  // shipped and patched downstream.
575
- writeData: async (a, f) => {
576
- const { cols: y, values: k } = q(a), u = z(w);
577
- if (!f) {
578
- if (p != null)
630
+ writeData: async (S, c) => {
631
+ const { cols: g, values: M } = U(S), d = Z(y);
632
+ if (!c) {
633
+ if (m != null)
579
634
  throw new Error(
580
- `Action "${M.label ?? h.action}" targets ${w.name} "${String(p)}", which no longer exists. Nothing was created — a record dispatched with an identity is an update, and creating one is what dispatching no identity means.`
635
+ `Action "${w.label ?? h.action}" targets ${y.name} "${String(m)}", which no longer exists. Nothing was created — a record dispatched with an identity is an update, and creating one is what dispatching no identity means.`
581
636
  );
582
- const S = y.length ? `INSERT INTO ${g} (${y.map((x) => `"${x}"`).join(", ")}) VALUES (${y.map((x, T) => `$${T + 1}`).join(", ")}) RETURNING ${u}` : `INSERT INTO ${g} DEFAULT VALUES RETURNING ${u}`, { rows: D } = await t(s, { text: S, values: k });
583
- return D[0] ?? {};
637
+ const A = g.length ? `INSERT INTO ${f} (${g.map((H) => `"${H}"`).join(", ")}) VALUES (${g.map((H, B) => `$${B + 1}`).join(", ")}) RETURNING ${d}` : `INSERT INTO ${f} DEFAULT VALUES RETURNING ${d}`, { rows: F } = await t(l, { text: A, values: M });
638
+ return F[0] ?? {};
584
639
  }
585
- if (y.length === 0) {
586
- const { rows: S } = await t(s, {
587
- text: `SELECT ${u} FROM ${g} WHERE "${c()}"::text = $1`,
588
- values: [String(p)]
640
+ if (g.length === 0) {
641
+ const { rows: A } = await t(l, {
642
+ text: `SELECT ${d} FROM ${f} WHERE "${s()}"::text = $1`,
643
+ values: [String(m)]
589
644
  });
590
- return S[0] ?? {};
645
+ return A[0] ?? {};
591
646
  }
592
- const E = y.map((S, D) => `"${S}" = $${D + 1}`).join(", "), { rows: N } = await t(s, {
593
- text: `UPDATE ${g} SET ${E} WHERE "${c()}"::text = $${y.length + 1} RETURNING ${u}`,
594
- values: [...k, String(p)]
647
+ const v = g.map((A, F) => `"${A}" = $${F + 1}`).join(", "), { rows: O } = await t(l, {
648
+ text: `UPDATE ${f} SET ${v} WHERE "${s()}"::text = $${g.length + 1} RETURNING ${d}`,
649
+ values: [...M, String(m)]
595
650
  });
596
- return N[0] ?? {};
651
+ return O[0] ?? {};
597
652
  },
598
- runEffect: H ? (a) => H({
599
- pgClient: s,
653
+ runEffect: q ? (S) => q({
654
+ pgClient: l,
600
655
  doctype: String(h.doctype),
601
656
  action: String(h.action),
602
- meta: w,
603
- recordId: p,
604
- data: B,
605
- args: m,
606
- currentState: a
657
+ meta: y,
658
+ recordId: m,
659
+ data: I,
660
+ args: p,
661
+ currentState: S
607
662
  }) : void 0
608
663
  },
609
664
  // The patch a self-transition persists. This adapter never passed it, which
610
665
  // was moot while it had no `writeData` — nothing consumed it. Wiring the write
611
666
  // without this argument saves an empty record and reports success.
612
- B
667
+ I
613
668
  );
614
- if (!$.success) throw new le($);
615
- return L.length ? { ...$, droppedFields: L } : $;
669
+ if (!b.success) throw new fe(b);
670
+ return T.length ? { ...b, droppedFields: T } : b;
616
671
  });
617
- } catch (s) {
618
- return s instanceof le ? s.outcome : {
672
+ } catch (l) {
673
+ return l instanceof fe ? l.outcome : {
619
674
  success: !1,
620
675
  data: null,
621
- error: s instanceof Error ? s.message : String(s)
676
+ error: l instanceof Error ? l.message : String(l)
622
677
  };
623
678
  }
624
679
  }
@@ -630,31 +685,31 @@ const de = "__stonecropLinkFk_", Q = "status", Ze = (e = {}) => {
630
685
  };
631
686
  });
632
687
  };
633
- function Ie(e, t) {
688
+ function We(e, t) {
634
689
  const o = [];
635
- for (const n of X(e)) {
690
+ for (const n of ee(e)) {
636
691
  const r = t.get(n.fieldname);
637
- if (r && oe(r, n.component) !== "inline") continue;
638
- const i = A(n.fieldname);
692
+ if (r && ie(r, n.component) !== "inline") continue;
693
+ const i = R(n.fieldname);
639
694
  o.push(i !== n.fieldname ? `"${i}" AS "${n.fieldname}"` : `"${n.fieldname}"`);
640
695
  }
641
696
  return o;
642
697
  }
643
- function z(e) {
698
+ function Z(e) {
644
699
  const t = /* @__PURE__ */ new Map();
645
700
  if (e.links)
646
701
  for (const [o, n] of Object.entries(e.links))
647
702
  t.set(n.fieldname ?? o, n);
648
- return Ie(e.fields, t).join(", ");
703
+ return We(e.fields, t).join(", ");
649
704
  }
650
- function te(e) {
651
- const t = ke(e.fields);
705
+ function oe(e) {
706
+ const t = me(e.fields);
652
707
  return e.fields.find((o) => o.kind === "field" && o.fieldname === t);
653
708
  }
654
- function Be(e) {
709
+ function He(e) {
655
710
  const t = Object.entries(e);
656
711
  if (t.length === 0) return;
657
- if (he().length === 0) {
712
+ if (ye().length === 0) {
658
713
  console.warn(
659
714
  "[@stonecrop/graphql-middleware] Schema built with no doctypes registered, so the `actionHandlers` map could not be verified. Load doctypes before building the schema to have stale handler keys reported."
660
715
  );
@@ -662,7 +717,7 @@ function Be(e) {
662
717
  }
663
718
  const o = [];
664
719
  for (const [n, r] of t) {
665
- const i = I(n);
720
+ const i = L(n);
666
721
  if (!i) {
667
722
  o.push(`"${n}": no doctype by that name is registered`);
668
723
  continue;
@@ -673,9 +728,9 @@ function Be(e) {
673
728
  );
674
729
  continue;
675
730
  }
676
- const l = i.workflow?.actions ?? {};
677
- for (const d of Object.keys(r))
678
- d in l || o.push(`"${n}.${d}": the doctype declares no action by that key`);
731
+ const a = i.workflow?.actions ?? {};
732
+ for (const u of Object.keys(r))
733
+ u in a || o.push(`"${n}.${u}": the doctype declares no action by that key`);
679
734
  }
680
735
  if (o.length > 0)
681
736
  throw new Error(
@@ -684,8 +739,8 @@ function Be(e) {
684
739
  `)}`
685
740
  );
686
741
  }
687
- function je() {
688
- const e = Le();
742
+ function qe() {
743
+ const e = Ie();
689
744
  if (e.length !== 0)
690
745
  throw new Error(
691
746
  `StonecropPlugin: ${e.length} doctype reference${e.length === 1 ? "" : "s"} cannot be resolved and would silently drop the relation:
@@ -693,22 +748,22 @@ function je() {
693
748
  `)
694
749
  );
695
750
  }
696
- function ne(e) {
751
+ function re(e) {
697
752
  return new Error(
698
753
  `Doctype "${e}" has no identity field: it declares no field with \`primaryKey: true\` and no field named \`id\`. Declare one of the two — records cannot be fetched or acted on until then.`
699
754
  );
700
755
  }
701
- const et = (e = {}) => {
756
+ const it = (e = {}) => {
702
757
  const { logPlans: t = !0, logTiming: o = !1 } = e, n = (r, i) => ({
703
- plan: (l) => {
758
+ plan: (a) => {
704
759
  t && console.log(`[@stonecrop/graphql-middleware] Building plan for ${r}.${i}`);
705
- const d = o ? Date.now() : 0, b = l();
760
+ const u = o ? Date.now() : 0, $ = a();
706
761
  return o && console.log(
707
- `[@stonecrop/graphql-middleware] Plan built for ${r}.${i} in ${Date.now() - d}ms`
708
- ), b;
762
+ `[@stonecrop/graphql-middleware] Plan built for ${r}.${i} in ${Date.now() - u}ms`
763
+ ), $;
709
764
  }
710
765
  });
711
- return Me({
766
+ return Te({
712
767
  Query: {
713
768
  stonecropRecord: n("Query", "stonecropRecord"),
714
769
  stonecropRecords: n("Query", "stonecropRecords"),
@@ -719,7 +774,7 @@ const et = (e = {}) => {
719
774
  stonecropAction: n("Mutation", "stonecropAction")
720
775
  }
721
776
  });
722
- }, Ce = {
777
+ }, Ue = {
723
778
  name: "StonecropFieldCasingPlugin",
724
779
  version: "0.0.0",
725
780
  inflection: {
@@ -729,27 +784,27 @@ const et = (e = {}) => {
729
784
  }
730
785
  }
731
786
  }
732
- }, Pe = (e) => ({
733
- extends: [Oe],
734
- plugins: e?.fieldCasing === "pascal" ? [Ce] : []
735
- }), tt = Pe();
787
+ }, _e = (e) => ({
788
+ extends: [Le],
789
+ plugins: e?.fieldCasing === "pascal" ? [Ue] : []
790
+ }), at = _e();
736
791
  export {
737
- re as DoctypeValidationError,
738
- tt as StonecropPreset,
739
- Fe as applyGuardedTransition,
740
- Xe as clearFetchHandlers,
741
- ze as clearRegistry,
742
- et as createDebugPlugin,
743
- Ze as createStonecropPlugin,
744
- Pe as createStonecropPreset,
745
- he as getAllMeta,
746
- Ne as getFetchHandler,
747
- I as getMeta,
748
- Ve as hasMeta,
749
- xe as loadDoctypes,
750
- Qe as loadDoctypesFromObject,
751
- rt as makePgService,
752
- Ye as registerFetchHandler,
753
- De as typeDefs
792
+ ae as DoctypeValidationError,
793
+ at as StonecropPreset,
794
+ je as applyGuardedTransition,
795
+ ot as clearFetchHandlers,
796
+ tt as clearRegistry,
797
+ it as createDebugPlugin,
798
+ rt as createStonecropPlugin,
799
+ _e as createStonecropPreset,
800
+ ye as getAllMeta,
801
+ Be as getFetchHandler,
802
+ L as getMeta,
803
+ et as hasMeta,
804
+ Ne as loadDoctypes,
805
+ Ze as loadDoctypesFromObject,
806
+ ct as makePgService,
807
+ nt as registerFetchHandler,
808
+ Pe as typeDefs
754
809
  };
755
810
  //# sourceMappingURL=index.js.map