@stonecrop/graphql-middleware 0.23.0 → 0.25.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) {
1
+ import { readdirSync as $e, statSync as ke, readFileSync as Ee } from "node:fs";
2
+ import { join as be } from "node:path";
3
+ import { flattenFields as Y, validateDoctype as ge, parseDoctype as me, isActionAllowedInState as ve, pascalToSnake as Re, camelToSnake as E, getDisplayField as Ae, getRecordIdField as ye, resolveLinkRenderMode as ae } from "@stonecrop/schema";
4
+ import { sideEffectWithPgClient as Me, loadOneWithPgClient as ue } from "@dataplan/pg";
5
+ import { object as re, constant as Oe, lambda as xe } from "postgraphile/grafast";
6
+ import { gql as Fe, 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 te(e) {
10
10
  return Y(e).filter((t) => t.kind === "field" && !t.computed);
11
11
  }
12
- const P = /* @__PURE__ */ new Map();
13
- class re extends Error {
12
+ const H = /* @__PURE__ */ new Map();
13
+ class se extends Error {
14
14
  constructor(t, o) {
15
15
  const n = o.map((r) => ` ${r.path.join(".")}: ${r.message}`).join(`
16
16
  `);
@@ -20,73 +20,73 @@ ${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 De(e, t = {}) {
24
+ const o = $e(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 = be(e, n);
27
+ ke(r).isDirectory() ? De(r, t) : n.endsWith(".json") && Be(r, t);
28
28
  }
29
29
  }
30
- function Te(e, t) {
31
- const o = ye(e, "utf-8");
30
+ function Be(e, t) {
31
+ const o = Ee(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 se(e, [u]);
45
45
  }
46
- const r = ue(n);
46
+ const r = ge(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 se(e, r.errors);
53
53
  }
54
- const i = fe(n);
55
- P.set(i.name, i);
54
+ const i = me(n);
55
+ H.set(i.name, i);
56
56
  }
57
- function Qe(e, t = {}) {
57
+ function et(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 = ge(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 se(o, i.errors);
66
66
  }
67
- const l = fe(r);
68
- P.set(l.name, l);
67
+ const a = me(r);
68
+ H.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 = H.get(e);
73
73
  if (t) return t;
74
- for (const o of P.values())
74
+ for (const o of H.values())
75
75
  if (o.slug === e) return o;
76
76
  }
77
- function he() {
78
- return Array.from(P.values());
77
+ function we() {
78
+ return Array.from(H.values());
79
79
  }
80
- function Ve(e) {
81
- return P.has(e);
80
+ function tt(e) {
81
+ return H.has(e);
82
82
  }
83
- function ze() {
84
- P.clear();
83
+ function nt() {
84
+ H.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 H.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
  });
@@ -94,52 +94,52 @@ function Le() {
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(te(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 le = /* @__PURE__ */ new Map();
133
+ function ot(e, t) {
134
+ le.set(e, t);
135
135
  }
136
- function Ne(e) {
137
- return ie.get(e);
136
+ function Ce(e) {
137
+ return le.get(e);
138
138
  }
139
- function Xe() {
140
- ie.clear();
139
+ function rt() {
140
+ le.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 b = await t.writeData(o ?? {}, !1);
163
+ return !b || Object.keys(b).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: b, 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 (!ve(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
200
  function W(e, t) {
201
- const o = t?.[e] ?? $e(e), n = o.indexOf(".");
201
+ const o = t?.[e] ?? Re(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 Z(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 Y(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: ye(r.fields),
222
+ targetTable: W(r.name, t)
223
+ });
224
+ }
225
+ return o;
226
+ }
227
+ async function fe(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 w of o) {
233
+ const f = Z(w[a.fieldname]);
234
+ f !== void 0 && u.add(f);
235
+ }
236
+ if (u.size === 0) return;
237
+ const $ = E(a.targetPkFieldname), k = E(a.displayField), b = k !== a.displayField ? `"${k}" AS "${a.displayField}"` : `"${a.displayField}"`, { rows: h } = await r(e, {
238
+ text: `SELECT "${$}" AS "${a.targetPkFieldname}", ${b} 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 = Z(w[a.targetPkFieldname]), s = Z(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 = Z(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 We = Fe`
205
255
  type StonecropFieldMeta {
206
256
  kind: String!
207
257
  fieldname: String!
@@ -312,186 +362,195 @@ const De = Re`
312
362
  stonecropAction(doctype: String!, action: String!, args: JSON): StonecropActionResult!
313
363
  }
314
364
  `;
315
- class le extends Error {
365
+ class he 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 pe = "__stonecropLinkFk_", Q = "status", it = (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 Te((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 && qe(e.actionHandlers), Ue(), {
378
+ typeDefs: We,
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 xe(u, ($) => L(String($)) ?? null);
334
384
  },
335
385
  stonecropAllMeta() {
336
- return be(he());
386
+ return Oe(we());
337
387
  },
338
- stonecropRecord(l, { $doctype: d, $id: b, $options: v }) {
339
- return ce(
388
+ stonecropRecord(a, { $doctype: u, $id: $, $options: k }) {
389
+ return ue(
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
+ re({ doctype: u, id: $, options: k }),
392
+ async (b, 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 d of s) w[d] = { 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 g = V(p);
406
+ if (!g) throw ie(f);
407
+ const I = E(g.fieldname), _ = ee(p), x = s.map((d) => String(h[d].id)), N = new Map(Y(p.fields).map((d) => [d.fieldname, d])), T = [];
408
+ for (const [d, m] of Object.entries(p.links ?? {})) {
409
+ if (m.cardinality === "noneOrMany" || m.cardinality === "atLeastOne") continue;
410
+ const M = m.fieldname ?? d;
411
+ ae(m, N.get(M)?.component) !== "inline" && T.push({ fieldname: M, alias: `${pe}${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 C = [
414
+ _,
415
+ ...T.map(({ fieldname: d, alias: m }) => `"${E(d)}" AS "${m}"`)
416
+ ].filter(Boolean).join(", "), { rows: l } = await t(b, {
417
+ text: `SELECT ${C} FROM ${W(p.name, e.tables)} WHERE "${I}"::text = ANY($1::text[])`,
418
+ values: [x]
419
+ }), v = new Map(l.map((d) => [String(d[g.fieldname]), d]));
420
+ if (l.length !== v.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 "${g.fieldname}" as its identity, but that column is not unique in ${W(p.name, e.tables)} — ${l.length} rows matched ${v.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 d of s) {
426
+ const m = String(h[d].id), M = v.get(m);
427
+ if (!M) {
428
+ w[d] = { 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 c = { ...M };
432
+ S.push(c);
433
+ const R = [], O = h[d].options ?? {}, A = O.includeNested === !0, F = Array.isArray(O.includeNested) ? new Set(O.includeNested) : null;
434
+ if (p.links)
435
+ for (const [j, D] of Object.entries(p.links)) {
436
+ const P = D.fieldname ?? j, K = D.fetch, ne = D.cardinality === "noneOrMany" || D.cardinality === "atLeastOne", ce = K?.method ?? (ne ? "sync" : "lazy"), Se = K?.method === "sync" ? K.limit : void 0, G = ne ? Se ?? o : void 0;
437
+ if (!(A || (F ? F.has(j) : ce === "sync"))) continue;
438
+ if (ce === "custom" && K?.method === "custom") {
439
+ const J = K.handler, B = Ce(J);
440
+ B && (c[P] = await B(b, c, D));
388
441
  continue;
389
442
  }
390
- if (oe(T, F.get(j)?.component) === "inline") continue;
391
- const U = I(T.target);
443
+ if (ae(D, N.get(P)?.component) === "inline") continue;
444
+ const U = L(D.target);
392
445
  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, {
401
- text: C,
402
- values: V
446
+ const de = ee(U);
447
+ if (ne) {
448
+ if (!D.backlink) continue;
449
+ const J = E(D.backlink);
450
+ let B = `SELECT ${de} FROM ${W(U.name, e.tables)} WHERE "${J}"::text = $1`;
451
+ const z = [m], X = V(U);
452
+ X && (B += ` ORDER BY "${E(X.fieldname)}" ASC`), G != null && (B += " LIMIT $2", z.push(G + 1));
453
+ const { rows: oe } = await t(b, {
454
+ text: B,
455
+ values: z
403
456
  });
404
- G != null && K.length > G ? (u.push(j), k[j] = K.slice(0, G)) : k[j] = K;
457
+ G != null && oe.length > G ? (R.push(P), c[P] = oe.slice(0, G)) : c[P] = oe;
405
458
  } else {
406
- const _ = k[`${de}${j}`];
407
- if (_ == null) {
408
- k[j] = null;
459
+ const J = c[`${pe}${P}`];
460
+ if (J == null) {
461
+ c[P] = 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 B = V(U);
465
+ if (!B) throw ie(U.name);
466
+ const z = E(B.fieldname), { rows: X } = await t(b, {
467
+ text: `SELECT ${de} FROM ${W(U.name, e.tables)} WHERE "${z}" = $1`,
468
+ values: [J]
416
469
  });
417
- k[j] = K[0] ?? null;
470
+ c[P] = X[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: j } of T) delete c[j];
474
+ const q = F && p.links ? [...F].filter((j) => !(j in p.links)) : void 0;
475
+ w[d] = {
476
+ data: c,
477
+ doctype: f,
478
+ unknownLinks: q?.length ? q : void 0,
479
+ truncatedLinks: R.length ? R : void 0
427
480
  };
428
481
  }
482
+ await fe(b, 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: b, $offset: h, $includeTotal: y }) {
489
+ return ue(
436
490
  i,
437
- ee({
438
- doctype: d,
439
- filters: b,
440
- orderBy: v,
441
- limit: R,
491
+ re({
492
+ doctype: u,
493
+ filters: $,
494
+ orderBy: k,
495
+ limit: b,
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), g = L(p);
502
+ if (!g)
503
+ return { data: [], doctype: p, hasMore: !1, count: s.includeTotal === !0 ? 0 : null };
504
+ const I = new Set(Y(g.fields).map((c) => c.fieldname)), _ = ee(g), x = [], N = [];
505
+ if (s.filters != null)
506
+ for (const [c, R] of Object.entries(s.filters)) {
507
+ if (!I.has(c))
508
+ throw new Error(`Unknown filter field: ${c} for doctype ${g.name}`);
509
+ x.push(R), N.push(`"${E(c)}" = $${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 C = "";
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 c = s.orderBy, R = c.lastIndexOf("_");
517
+ if (R <= 0)
518
+ throw new Error(`Invalid orderBy format: "${c}". Expected FIELD_ASC or FIELD_DESC`);
519
+ const O = c.slice(R + 1).toUpperCase();
520
+ if (O !== "ASC" && O !== "DESC")
521
+ throw new Error(`Invalid orderBy direction: "${O}". Must be ASC or DESC`);
522
+ const A = c.slice(0, R);
523
+ if (!I.has(A))
524
+ throw new Error(`Unknown orderBy field: "${A}" for doctype ${g.name}`);
525
+ C = ` ORDER BY "${E(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 (C === "") {
528
+ const c = V(g);
529
+ c && (C = ` ORDER BY "${E(c.fieldname)}" ASC`);
530
+ }
531
+ if (s.limit != null && typeof s.limit != "number")
532
+ throw new Error(`Invalid limit: expected number, got ${typeof s.limit}`);
533
+ const l = s.limit ?? o;
534
+ let v = "";
535
+ l != null && (x.push(l + 1), v += ` LIMIT $${x.length}`), s.offset != null && (x.push(s.offset), v += ` OFFSET $${x.length}`);
536
+ const { rows: S } = await t(w, {
537
+ text: `SELECT ${_} FROM ${W(g.name, e.tables)}${T}${C}${v}`,
538
+ values: x
539
+ }), d = l != null && S.length > l, m = [...d ? S.slice(0, l ?? S.length) : S];
540
+ await fe(w, g, m, e.tables, t);
541
+ let M = null;
542
+ if (s.includeTotal === !0) {
543
+ const c = [], R = [];
544
+ if (s.filters != null)
545
+ for (const [F, q] of Object.entries(s.filters))
546
+ I.has(F) && (c.push(q), R.push(`"${E(F)}" = $${c.length}`));
547
+ const O = R.length > 0 ? ` WHERE ${R.join(" AND ")}` : "", { rows: A } = await t(w, {
548
+ text: `SELECT COUNT(*) AS row_count FROM ${W(g.name, e.tables)}${O}`,
549
+ values: c
491
550
  });
492
- k = parseInt(S[0]?.row_count ?? "0", 10);
551
+ M = parseInt(A[0]?.row_count ?? "0", 10);
493
552
  }
494
- return { data: y, doctype: m, hasMore: f, count: k };
553
+ return { data: m, doctype: p, hasMore: d, count: M };
495
554
  })
496
555
  )
497
556
  );
@@ -500,67 +559,67 @@ const de = "__stonecropLinkFk_", Q = "status", Ze = (e = {}) => {
500
559
  },
501
560
  Mutation: {
502
561
  plans: {
503
- stonecropAction(l, { $doctype: d, $action: b, $args: v }) {
504
- return Ee(
562
+ stonecropAction(a, { $doctype: u, $action: $, $args: k }) {
563
+ return Me(
505
564
  i,
506
- ee({ doctype: d, action: b, actionArgs: v }),
507
- async (R, h) => {
508
- const w = I(String(h.doctype));
509
- if (!w)
565
+ re({ doctype: u, action: $, actionArgs: k }),
566
+ async (b, h) => {
567
+ const y = L(String(h.doctype));
568
+ if (!y)
510
569
  return {
511
570
  success: !1,
512
571
  data: null,
513
572
  error: `Unknown doctype: ${h.doctype}`
514
573
  };
515
- const M = w.workflow?.actions?.[h.action];
516
- if (!M)
574
+ const w = y.workflow?.actions?.[h.action];
575
+ if (!w)
517
576
  return {
518
577
  success: !1,
519
578
  data: null,
520
579
  error: `Unknown action: ${h.action} on ${h.doctype}`
521
580
  };
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);
581
+ const f = W(y.name, e.tables), s = () => {
582
+ const l = V(y);
583
+ if (!l) throw ie(String(h.doctype));
584
+ return E(l.fieldname);
585
+ }, p = Array.isArray(h.actionArgs) ? h.actionArgs : [], g = p[0]?.id, I = p[0]?.data ?? {}, _ = e.actionHandlers?.[y.name]?.[String(h.action)], x = new Map(
586
+ te(y.fields).filter((l) => E(l.fieldname) !== Q).map((l) => [l.fieldname, l])
587
+ ), N = te(y.fields).some(
588
+ (l) => E(l.fieldname) === Q
589
+ ), T = [], C = (l) => {
590
+ const v = [], S = [];
591
+ for (const [d, m] of Object.entries(l)) {
592
+ if (!x.has(d)) {
593
+ T.push(d);
535
594
  continue;
536
595
  }
537
- if (y !== null && typeof y == "object") {
538
- L.push(f);
596
+ if (m !== null && typeof m == "object") {
597
+ T.push(d);
539
598
  continue;
540
599
  }
541
- $.push(A(f)), a.push(y);
600
+ v.push(E(d)), S.push(m);
542
601
  }
543
- return { cols: $, values: a };
602
+ return { cols: v, values: S };
544
603
  };
545
604
  try {
546
- return await R.withTransaction(async (s) => {
547
- const $ = await Fe(
548
- M,
605
+ return await b.withTransaction(async (l) => {
606
+ const v = await je(
607
+ w,
549
608
  {
550
609
  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)]
610
+ if (g == null) return null;
611
+ const S = N ? `"${Q}"` : `"${s()}"`, { rows: d } = await t(l, {
612
+ text: `SELECT ${S} FROM ${f} WHERE "${s()}"::text = $1 FOR UPDATE`,
613
+ values: [String(g)]
555
614
  });
556
- if (f.length === 0) return null;
557
- if (F)
558
- return f[0][Q] ?? void 0;
615
+ if (d.length === 0) return null;
616
+ if (N)
617
+ return d[0][Q] ?? void 0;
559
618
  },
560
- writeState: async (a) => {
561
- await t(s, {
562
- text: `UPDATE ${g} SET "${Q}" = $1 WHERE "${c()}"::text = $2`,
563
- values: [a, String(p)]
619
+ writeState: async (S) => {
620
+ await t(l, {
621
+ text: `UPDATE ${f} SET "${Q}" = $1 WHERE "${s()}"::text = $2`,
622
+ values: [S, String(g)]
564
623
  });
565
624
  },
566
625
  // The upsert, and the only write path for record data. `exists`
@@ -572,53 +631,53 @@ const de = "__stonecropLinkFk_", Q = "status", Ze = (e = {}) => {
572
631
  // `itemId` would receive `item_id`, find no identity, and file a
573
632
  // created record nowhere — which is that exact bug, already once
574
633
  // 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)
634
+ writeData: async (S, d) => {
635
+ const { cols: m, values: M } = C(S), c = ee(y);
636
+ if (!d) {
637
+ if (g != null)
579
638
  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.`
639
+ `Action "${w.label ?? h.action}" targets ${y.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.`
581
640
  );
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] ?? {};
641
+ const A = m.length ? `INSERT INTO ${f} (${m.map((q) => `"${q}"`).join(", ")}) VALUES (${m.map((q, j) => `$${j + 1}`).join(", ")}) RETURNING ${c}` : `INSERT INTO ${f} DEFAULT VALUES RETURNING ${c}`, { rows: F } = await t(l, { text: A, values: M });
642
+ return F[0] ?? {};
584
643
  }
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)]
644
+ if (m.length === 0) {
645
+ const { rows: A } = await t(l, {
646
+ text: `SELECT ${c} FROM ${f} WHERE "${s()}"::text = $1`,
647
+ values: [String(g)]
589
648
  });
590
- return S[0] ?? {};
649
+ return A[0] ?? {};
591
650
  }
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)]
651
+ const R = m.map((A, F) => `"${A}" = $${F + 1}`).join(", "), { rows: O } = await t(l, {
652
+ text: `UPDATE ${f} SET ${R} WHERE "${s()}"::text = $${m.length + 1} RETURNING ${c}`,
653
+ values: [...M, String(g)]
595
654
  });
596
- return N[0] ?? {};
655
+ return O[0] ?? {};
597
656
  },
598
- runEffect: H ? (a) => H({
599
- pgClient: s,
657
+ runEffect: _ ? (S) => _({
658
+ pgClient: l,
600
659
  doctype: String(h.doctype),
601
660
  action: String(h.action),
602
- meta: w,
603
- recordId: p,
604
- data: B,
605
- args: m,
606
- currentState: a
661
+ meta: y,
662
+ recordId: g,
663
+ data: I,
664
+ args: p,
665
+ currentState: S
607
666
  }) : void 0
608
667
  },
609
668
  // The patch a self-transition persists. This adapter never passed it, which
610
669
  // was moot while it had no `writeData` — nothing consumed it. Wiring the write
611
670
  // without this argument saves an empty record and reports success.
612
- B
671
+ I
613
672
  );
614
- if (!$.success) throw new le($);
615
- return L.length ? { ...$, droppedFields: L } : $;
673
+ if (!v.success) throw new he(v);
674
+ return T.length ? { ...v, droppedFields: T } : v;
616
675
  });
617
- } catch (s) {
618
- return s instanceof le ? s.outcome : {
676
+ } catch (l) {
677
+ return l instanceof he ? l.outcome : {
619
678
  success: !1,
620
679
  data: null,
621
- error: s instanceof Error ? s.message : String(s)
680
+ error: l instanceof Error ? l.message : String(l)
622
681
  };
623
682
  }
624
683
  }
@@ -630,31 +689,31 @@ const de = "__stonecropLinkFk_", Q = "status", Ze = (e = {}) => {
630
689
  };
631
690
  });
632
691
  };
633
- function Ie(e, t) {
692
+ function He(e, t) {
634
693
  const o = [];
635
- for (const n of X(e)) {
694
+ for (const n of te(e)) {
636
695
  const r = t.get(n.fieldname);
637
- if (r && oe(r, n.component) !== "inline") continue;
638
- const i = A(n.fieldname);
696
+ if (r && ae(r, n.component) !== "inline") continue;
697
+ const i = E(n.fieldname);
639
698
  o.push(i !== n.fieldname ? `"${i}" AS "${n.fieldname}"` : `"${n.fieldname}"`);
640
699
  }
641
700
  return o;
642
701
  }
643
- function z(e) {
702
+ function ee(e) {
644
703
  const t = /* @__PURE__ */ new Map();
645
704
  if (e.links)
646
705
  for (const [o, n] of Object.entries(e.links))
647
706
  t.set(n.fieldname ?? o, n);
648
- return Ie(e.fields, t).join(", ");
707
+ return He(e.fields, t).join(", ");
649
708
  }
650
- function te(e) {
651
- const t = ke(e.fields);
709
+ function V(e) {
710
+ const t = ye(e.fields);
652
711
  return e.fields.find((o) => o.kind === "field" && o.fieldname === t);
653
712
  }
654
- function Be(e) {
713
+ function qe(e) {
655
714
  const t = Object.entries(e);
656
715
  if (t.length === 0) return;
657
- if (he().length === 0) {
716
+ if (we().length === 0) {
658
717
  console.warn(
659
718
  "[@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
719
  );
@@ -662,7 +721,7 @@ function Be(e) {
662
721
  }
663
722
  const o = [];
664
723
  for (const [n, r] of t) {
665
- const i = I(n);
724
+ const i = L(n);
666
725
  if (!i) {
667
726
  o.push(`"${n}": no doctype by that name is registered`);
668
727
  continue;
@@ -673,9 +732,9 @@ function Be(e) {
673
732
  );
674
733
  continue;
675
734
  }
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`);
735
+ const a = i.workflow?.actions ?? {};
736
+ for (const u of Object.keys(r))
737
+ u in a || o.push(`"${n}.${u}": the doctype declares no action by that key`);
679
738
  }
680
739
  if (o.length > 0)
681
740
  throw new Error(
@@ -684,8 +743,8 @@ function Be(e) {
684
743
  `)}`
685
744
  );
686
745
  }
687
- function je() {
688
- const e = Le();
746
+ function Ue() {
747
+ const e = Ie();
689
748
  if (e.length !== 0)
690
749
  throw new Error(
691
750
  `StonecropPlugin: ${e.length} doctype reference${e.length === 1 ? "" : "s"} cannot be resolved and would silently drop the relation:
@@ -693,22 +752,22 @@ function je() {
693
752
  `)
694
753
  );
695
754
  }
696
- function ne(e) {
755
+ function ie(e) {
697
756
  return new Error(
698
757
  `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
758
  );
700
759
  }
701
- const et = (e = {}) => {
760
+ const at = (e = {}) => {
702
761
  const { logPlans: t = !0, logTiming: o = !1 } = e, n = (r, i) => ({
703
- plan: (l) => {
762
+ plan: (a) => {
704
763
  t && console.log(`[@stonecrop/graphql-middleware] Building plan for ${r}.${i}`);
705
- const d = o ? Date.now() : 0, b = l();
764
+ const u = o ? Date.now() : 0, $ = a();
706
765
  return o && console.log(
707
- `[@stonecrop/graphql-middleware] Plan built for ${r}.${i} in ${Date.now() - d}ms`
708
- ), b;
766
+ `[@stonecrop/graphql-middleware] Plan built for ${r}.${i} in ${Date.now() - u}ms`
767
+ ), $;
709
768
  }
710
769
  });
711
- return Me({
770
+ return Le({
712
771
  Query: {
713
772
  stonecropRecord: n("Query", "stonecropRecord"),
714
773
  stonecropRecords: n("Query", "stonecropRecords"),
@@ -719,7 +778,7 @@ const et = (e = {}) => {
719
778
  stonecropAction: n("Mutation", "stonecropAction")
720
779
  }
721
780
  });
722
- }, Ce = {
781
+ }, _e = {
723
782
  name: "StonecropFieldCasingPlugin",
724
783
  version: "0.0.0",
725
784
  inflection: {
@@ -729,27 +788,27 @@ const et = (e = {}) => {
729
788
  }
730
789
  }
731
790
  }
732
- }, Pe = (e) => ({
733
- extends: [Oe],
734
- plugins: e?.fieldCasing === "pascal" ? [Ce] : []
735
- }), tt = Pe();
791
+ }, Je = (e) => ({
792
+ extends: [Ne],
793
+ plugins: e?.fieldCasing === "pascal" ? [_e] : []
794
+ }), st = Je();
736
795
  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
796
+ se as DoctypeValidationError,
797
+ st as StonecropPreset,
798
+ je as applyGuardedTransition,
799
+ rt as clearFetchHandlers,
800
+ nt as clearRegistry,
801
+ at as createDebugPlugin,
802
+ it as createStonecropPlugin,
803
+ Je as createStonecropPreset,
804
+ we as getAllMeta,
805
+ Ce as getFetchHandler,
806
+ L as getMeta,
807
+ tt as hasMeta,
808
+ De as loadDoctypes,
809
+ et as loadDoctypesFromObject,
810
+ dt as makePgService,
811
+ ot as registerFetchHandler,
812
+ We as typeDefs
754
813
  };
755
814
  //# sourceMappingURL=index.js.map