@stonecrop/graphql-middleware 0.35.0 → 0.38.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/graphql-middleware.d.ts +7 -5
- package/dist/index.js +351 -175
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
|
@@ -9,8 +9,9 @@ import { ValidationError } from '@stonecrop/schema';
|
|
|
9
9
|
/**
|
|
10
10
|
* A server-side effect for one doctype action, supplied by whoever owns the database.
|
|
11
11
|
*
|
|
12
|
-
* Throwing rejects the action and no state is written.
|
|
13
|
-
*
|
|
12
|
+
* Throwing rejects the action and no state is written. The client stores the result's `record`,
|
|
13
|
+
* the adapter's read of the record after the action, never this return; a return carrying the
|
|
14
|
+
* doctype's declared key names the record read, which is how a handler that creates one says so.
|
|
14
15
|
*
|
|
15
16
|
* The return value is passed through verbatim as `StonecropActionResult.data`, so it must be
|
|
16
17
|
* API-layer data — camelCase fieldname keys, not raw snake_case columns. See `pgClient` above and
|
|
@@ -279,7 +280,7 @@ export declare interface GuardedTransitionIO {
|
|
|
279
280
|
writeState: (nextState: string) => Promise<void>;
|
|
280
281
|
/**
|
|
281
282
|
* Persist a record's field data for a self-transition, returning the full record as it now
|
|
282
|
-
* stands (
|
|
283
|
+
* stands, which states its identity (the only place a created record's key is known).
|
|
283
284
|
*
|
|
284
285
|
* **This is an upsert, and it is the create path.** Saving a record is one request whether or
|
|
285
286
|
* not the row is there yet, so there is no create action and no create mutation — `exists` says
|
|
@@ -310,8 +311,9 @@ export declare interface GuardedTransitionIO {
|
|
|
310
311
|
* and the Postgres adapter in particular dispatches outside one. A handler whose own statements
|
|
311
312
|
* must be all-or-nothing has to wrap them itself.
|
|
312
313
|
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
314
|
+
* What it returns becomes the result's `data`, verbatim; returning `undefined` leaves the
|
|
315
|
+
* doctype's own outcome to decide `data`. The client stores the adapter's read of the record,
|
|
316
|
+
* never this.
|
|
315
317
|
*
|
|
316
318
|
* @param currentState - The state the guard read, or `undefined` when nothing required reading it
|
|
317
319
|
* @returns The updated record, or `undefined` to leave the result payload to the state outcome
|