Liking cljdoc? Tell your friends :D

com.fulcrologic.rad.middleware.save-middleware


rewrite-valueclj/smultimethod

[save-env ident save-diff]

Given the save-env, ident of an entity, and incoming save diff (map from :before to :after for each changed attribute): Return an updated save-diff. The default method for this simply returns save-diff. Returning nil from this method will have the effect of removing all values for ident from the save.

[save-env ident save-diff]

Given the save-env, ident of an entity, and incoming save diff (map from :before to :after for each
changed attribute): Return an updated save-diff.  The default method for this simply returns save-diff.
Returning nil from this method will have the effect of removing all values for `ident` from the save.
sourceraw docstring

rewrite-valuesclj/s

(rewrite-values pathom-env)

Rewrite the delta in ::form/params of save-env. Returns the new save-env.

Rewrite the delta in ::form/params of save-env. Returns the new save-env.
sourceraw docstring

wrap-rewrite-deltaclj/s

(wrap-rewrite-delta handler rewrite-fn)

Save middleware that adds a step in the middleware that can rewrite the incoming delta of a save. The rewrite is allowed to do anything at all to the delta: add extra entities, create relations, augment entities, or even clear the delta to an empty map so nothing will be saved.

The rewrite-fn should be a (fn [pathom-env delta] updated-delta). You can return nil to indicate no rewrite is needed, but any other return will be used as the new thing to save (instead of what was sent).

The delta has the format of a normalized Fulcro form save:

{[:account/id 19] {:account/age {:before 42 :after 43}
                   :account/items {:before [] :after [[:item/id 1]]}}
 [:item/id 1] {:item/value {:before 22M :after 19.53M}}}
Save middleware that adds a step in the middleware that can rewrite the incoming delta of a save.
The rewrite is allowed to do anything at all to the delta: add extra entities, create relations, augment
entities, or even clear the delta to an empty map so nothing will be saved.

The `rewrite-fn` should be a `(fn [pathom-env delta] updated-delta)`. You *can* return nil to indicate no
rewrite is needed, but any other return will be used as the new thing to save (instead of what was sent).

The `delta` has the format of a normalized Fulcro form save:

```
{[:account/id 19] {:account/age {:before 42 :after 43}
                   :account/items {:before [] :after [[:item/id 1]]}}
 [:item/id 1] {:item/value {:before 22M :after 19.53M}}}
```
sourceraw docstring

wrap-rewrite-valuesclj/s

(wrap-rewrite-values handler)

Middleware that allows the distribution of incoming save diff rewrite across models. Should be at the bottom (early side) of the middleware if used.

Middleware that allows the distribution of incoming save diff rewrite across models. Should be at the bottom
(early side) of the middleware if used.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close