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