@stonecrop/graphql-middleware 0.34.0 → 0.36.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.
@@ -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. Returning the updated record makes it the
13
- * client writeback payload; returning `undefined` leaves the doctype's own outcome to decide.
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 (so the client writeback reflects it).
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
- * Returning a full record makes it the client writeback payload; returning `undefined` leaves
314
- * the doctype's own outcome to decide what comes back.
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