repos / starfx

supercharged async flow control library.
git clone https://github.com/neurosnap/starfx.git

commit
e0dffb4
parent
fec6a2d
author
Eric Bower
date
2023-09-15 17:56:40 +0000 UTC
chore: update deps

chore: update `saga-query` changes
8 files changed,  +54, -20
M npm.ts
M deno.lock
+36, -0
 1@@ -135,6 +135,40 @@
 2     "https://deno.land/x/effection@3.0.0-alpha.13/lib/sleep.ts": "d7000c05ace8143efd80f1e35243f5521316bc334e4051afe692e1a0c7268304",
 3     "https://deno.land/x/effection@3.0.0-alpha.13/lib/types.ts": "87787b9280ad041eaf7cbbfc1986260764590c01af6f79535b61b5ce4262052e",
 4     "https://deno.land/x/effection@3.0.0-alpha.13/mod.ts": "ffae461c16d4a1bf24c2179582ab8d5c81ad0df61e4ae2fba51ef5e5bdf90345",
 5+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/abort-signal.ts": "31224b5f61f1ef58a2acf72bfc1cb9c9bf589f15c263b6555eb06f1b49f77b54",
 6+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/all.ts": "acadab8258228e290192f587c8c532428f9093337a9b7688ae55cbc2cacd5caf",
 7+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/async.ts": "3e007ef245abb240de07029f523c7ef74b9bc383db5716f89d261a5150295777",
 8+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/call.ts": "69c465573031e6315e375c17e01e820239e01a93107866dd9f5ef584b79d13dd",
 9+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/channel.ts": "cdd48c80c05dfbd9b248bd50bf16a80f973e51b5e35b219386e82a65eb4477b6",
10+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/context.ts": "108989ac839d6756e30f6c0afc458bfa3975dd0f970d5173b6b8f8473ce4c335",
11+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/deps.ts": "91062b4b97089a8cf36550d4f9605d325a0fd19bebc72d15524481a3b56ea669",
12+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/each.ts": "756f82d8b4ec43623776416b6de6558e7584bbfd437a6a35d44e088667842d32",
13+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/ensure.ts": "c3640cc12c1bc747a8a4086af476840db026d04ea22f45a697d53617b2b1cc66",
14+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/events.ts": "a69c69bf61b197a39a9393d8da4d9f5e47afd1039dbdfa8e8953574a919b961d",
15+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/filter.ts": "ad3ba0ce59923306620da410393c8f248fb9885a55c8cbd1f3670521cd96cc68",
16+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/first.ts": "6dfacc67b5c6b11bf1df1cf272491ed24a88431ea2eb8a36216b848fbfbe2e8e",
17+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/future.ts": "7800fde82168c9be4644ec9d2fe532b35a8300baf34a8e1673c6fe6067365bfc",
18+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/instructions.ts": "d1c1c71b0d28770bf50591750895d6c0f9e8a85eba893543c6c895b5a8cb48f7",
19+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/lazy.ts": "92ea526c5ad7d88290f2a87168e038d482f97421379508d85cf2e049ee60639b",
20+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/log.ts": "312b6fb4226be5554b945bc9eb7b05ed7b2dd53dd139ca86971bef256eb78997",
21+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/main.ts": "a0deaf1d1d958ef7a5821d8ac3dfbd190a47608d603798a5fc3b0c2309a724da",
22+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/map.ts": "26184b51211c87e37396f336c7a8212ea46d9fdea210df208127a6394eee69f9",
23+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/mod.ts": "fa9d6c5f3b630113615444efcb60845bb08aede2371cef1dde4460e4401e62e6",
24+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/op.ts": "483465a66fb9fa7529eb8cafbaf94c085b1a5e72876e5d34e44cd4f875b2141b",
25+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/pipe.ts": "4a28fa93a1ba53661bafb84265f3fcb5614920bbecc0db1c261e1093da3b2cdf",
26+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/queue.ts": "d64a3a4c5a4ec4e6a0570852654f4c1c4aba40f6ef03d45062855b62c2de4703",
27+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/race.ts": "0c43f24ce5006768f5cbac8d6f5dc07848bafa625cc0bc6c24fb6a2f2a8808f2",
28+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/result.ts": "41414d8f376f73c95483982fe81fe9c256a6d836f9b2e4ae31d1a6fc09dec69d",
29+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/run.ts": "25523b60a9b5cd64be2f4502062c1d04d8281e2c9cb088ae178e31f2e47ff37e",
30+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/run/block.ts": "3647f52a4a5b9f7747b78918e70bb8e255030b994285d685850d91e7dcc8c71c",
31+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/run/create.ts": "be9139af2fbe15908256d2d159dec8dca079f94cf02d488074c94fa26fc651fa",
32+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/run/event-stream.ts": "8c6d40bf315652535a85aa02a61256678dc4e537a4fb436fbe5fecdad794c076",
33+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/run/frame.ts": "508ec136d72dbc704c5bc7ccedf579094e5d3057cea7c1ed04b36608599d52b0",
34+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/run/scope.ts": "358f89062c1d49f8bd8b49c9145c46ad84a8e521711b07ee47bec1cac9836d7c",
35+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/signal.ts": "1501d13af4e3f9bb7746e7c0f25d6935b28e2aeffe8b68d3a2875dbc14810a0a",
36+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/sleep.ts": "d7000c05ace8143efd80f1e35243f5521316bc334e4051afe692e1a0c7268304",
37+    "https://deno.land/x/effection@3.0.0-alpha.14/lib/types.ts": "6bc4c99c58b258ce23be0cfe0e5f18fd0b55392ed22f512d67ce8a614a965007",
38+    "https://deno.land/x/effection@3.0.0-alpha.14/mod.ts": "ffae461c16d4a1bf24c2179582ab8d5c81ad0df61e4ae2fba51ef5e5bdf90345",
39     "https://deno.land/x/expect@v0.3.0/expect.ts": "5e6717eddc9df376f7b2c9be6403e016130bb2edbb1acd261a2d6ea9608ee196",
40     "https://deno.land/x/expect@v0.3.0/matchers.ts": "a37ef4577739247af77a852cdcd69484f999a41ad86ec16bb63a88a7a47a2372",
41     "https://deno.land/x/expect@v0.3.0/mock.ts": "562d4b1d735d15b0b8e935f342679096b64fe452f86e96714fe8616c0c884914",
42@@ -155,6 +189,7 @@
43     "https://esm.sh/redux@4.2.1?pin=v122": "94f9684721d9f8f48f86778e03f237c00d771283a8533a1e63000e7539f3a303",
44     "https://esm.sh/reselect@4.1.8?pin=v122": "486407fec8db8f0c87ba540ff6457dbec3c8ec8fa93a4845383bc8cdb33c6008",
45     "https://esm.sh/robodux@15.0.1?pin=v122": "51ac2aa6f6fbaac2795f3d34117ba7e77c37e9e3e48bf667a994f6851399bf76",
46+    "https://esm.sh/robodux@15.0.2?pin=v122": "0311191f385c627ec97a15dc147cbad4367e09169eb1b591a6992b5d707f1446",
47     "https://esm.sh/stable/react@18.2.0/denonext/react.mjs": "3c4f23bcfc53b256fcfaf6f834fa9f584c3bb7be667b2682c6cb6ba8ef88f8e6",
48     "https://esm.sh/v122/@babel/runtime@7.22.5/denonext/helpers/esm/extends.js": "3955a0ef35db01cd4efff831a9027924f90fa7d55621cd2b6b8519283e573c21",
49     "https://esm.sh/v122/@babel/runtime@7.22.5/denonext/helpers/esm/objectSpread2.js": "39b25571151291cf2778cd3bb118c5336f7682f878f59fbcf79e2684ae55b194",
50@@ -170,6 +205,7 @@
51     "https://esm.sh/v122/redux@4.2.1/denonext/redux.mjs": "8269d22284abebf2be1bbbbbcc53d1842b7858102f1f81e7df1d0144b688f5a4",
52     "https://esm.sh/v122/reselect@4.1.8/denonext/reselect.mjs": "f8199f9e44453876a9ea6b5d1caedc0fe1ae789a73217543b1e6193e1edc0db7",
53     "https://esm.sh/v122/robodux@15.0.1/denonext/robodux.mjs": "31ba627f958ded9bdcaa7db1bd9bd57f610bb0cbefd871e1286e578f9a7c719a",
54+    "https://esm.sh/v122/robodux@15.0.2/denonext/robodux.mjs": "0f0f70b29b3058fb973f3273f89cc81cc6e050752f9fd0cc1c2b8cc13a40fe57",
55     "https://esm.sh/v122/scheduler@0.23.0/denonext/scheduler.mjs": "69005eb830c0a486d51875e52d1a85443dc8d32b0b6ad1e3f06baceb55ed4cba",
56     "https://esm.sh/v122/use-sync-external-store@1.2.0/denonext/cjs/use-sync-external-store-shim.production.min.js": "5be7011cae1c9c79ad30989c95370a6d97083e01bb98ba76a333347e03af85db",
57     "https://esm.sh/v122/use-sync-external-store@1.2.0/denonext/cjs/use-sync-external-store-shim/with-selector.production.min.js": "5fdb24919bfa6f0c749ce7dab27e1f3a9c4d246ec4727de5ebfbbd7640c1ee58",
M deps.ts
+4, -4
 1@@ -8,7 +8,7 @@ export type {
 2   Stream,
 3   Subscription,
 4   Task,
 5-} from "https://deno.land/x/effection@3.0.0-alpha.13/mod.ts";
 6+} from "https://deno.land/x/effection@3.0.0-alpha.14/mod.ts";
 7 export {
 8   action,
 9   createChannel,
10@@ -27,7 +27,7 @@ export {
11   spawn,
12   suspend,
13   useAbortSignal,
14-} from "https://deno.land/x/effection@3.0.0-alpha.13/mod.ts";
15+} from "https://deno.land/x/effection@3.0.0-alpha.14/mod.ts";
16 
17 import React from "https://esm.sh/react@18.2.0?pin=v122";
18 export { React };
19@@ -64,10 +64,10 @@ export {
20 export type {
21   MapEntity,
22   PatchEntity,
23-} from "https://esm.sh/robodux@15.0.1?pin=v122";
24+} from "https://esm.sh/robodux@15.0.2?pin=v122";
25 export {
26   createLoaderTable,
27   createReducerMap,
28   createTable,
29   mapReducers,
30-} from "https://esm.sh/robodux@15.0.1?pin=v122";
31+} from "https://esm.sh/robodux@15.0.2?pin=v122";
M npm.ts
+4, -4
 1@@ -30,9 +30,9 @@ async function main() {
 2       },
 3     ],
 4     mappings: {
 5-      "https://deno.land/x/effection@3.0.0-alpha.13/mod.ts": {
 6+      "https://deno.land/x/effection@3.0.0-alpha.14/mod.ts": {
 7         name: "effection",
 8-        version: "3.0.0-alpha.13",
 9+        version: "3.0.0-alpha.14",
10       },
11       "https://esm.sh/react@18.2.0?pin=v122": {
12         name: "react",
13@@ -51,9 +51,9 @@ async function main() {
14         name: "reselect",
15         version: "^4.1.8",
16       },
17-      "https://esm.sh/robodux@15.0.1?pin=v122": {
18+      "https://esm.sh/robodux@15.0.2?pin=v122": {
19         name: "robodux",
20-        version: "^15.0.1",
21+        version: "^15.0.2",
22       },
23       "https://esm.sh/redux@4.2.1?pin=v122": {
24         name: "redux",
M query/fetch.test.ts
+2, -1
 1@@ -7,7 +7,7 @@ import {
 2   takeEvery,
 3 } from "../store/mod.ts";
 4 
 5-import { fetcher, fetchRetry } from "./fetch.ts";
 6+import { fetcher, fetchRetry, headersMdw } from "./fetch.ts";
 7 import { createApi } from "./api.ts";
 8 import { requestMonitor } from "./middleware.ts";
 9 
10@@ -45,6 +45,7 @@ it(
11     api.use(requestMonitor());
12     api.use(storeMdw(schema.db));
13     api.use(api.routes());
14+    api.use(headersMdw);
15     api.use(fetcher({ baseUrl }));
16 
17     const actual: any[] = [];
M query/fetch.ts
+0, -1
1@@ -237,7 +237,6 @@ export function fetcher<CurCtx extends FetchJsonCtx = FetchJsonCtx>(
2   } = { baseUrl: "" },
3 ) {
4   return compose<CurCtx>([
5-    headersMdw,
6     apiUrlMdw(baseUrl),
7     payloadMdw,
8     fetchMdw,
M query/middleware.test.ts
+1, -2
 1@@ -298,14 +298,13 @@ it(tests, "overriding default loader behavior", () => {
 2     `/users`,
 3     { supervisor: takeEvery },
 4     function* (ctx: ApiCtx<unknown, { users: User[] }>, next) {
 5-      const id = ctx.name;
 6       yield* next();
 7 
 8       if (!ctx.json.ok) {
 9         return;
10       }
11       const { data } = ctx.json;
12-      ctx.loader = { id, message: "yes", meta: { wow: true } };
13+      ctx.loader = { message: "yes", meta: { wow: true } };
14       yield* updateStore((state) => {
15         data.users.forEach((u) => {
16           state.users[u.id] = u;
M query/react.ts
+6, -7
 1@@ -1,6 +1,6 @@
 2 import type { LoaderState, QueryState } from "../types.ts";
 3 import { React, useDispatch, useSelector } from "../deps.ts";
 4-const { useState, useEffect } = React;
 5+const { useEffect, useRef } = React;
 6 
 7 // TODO: remove store deps
 8 import { selectDataById, selectLoaderById } from "../redux/mod.ts";
 9@@ -201,15 +201,14 @@ export function useCache<D = any, A extends SagaAction = SagaAction>(
10  * ```
11  */
12 export function useLoaderSuccess(
13-  cur: Pick<LoaderState, "isLoading" | "isSuccess">,
14+  cur: Pick<LoaderState, "status">,
15   success: () => any,
16 ) {
17-  const [prev, setPrev] = useState(cur);
18+  const prev = useRef(cur);
19   useEffect(() => {
20-    const curSuccess = !cur.isLoading && cur.isSuccess;
21-    if (prev.isLoading && curSuccess) {
22+    if (prev.current.status !== "success" && cur.status === "success") {
23       success();
24     }
25-    setPrev(cur);
26-  }, [cur.isSuccess, cur.isLoading]);
27+    prev.current = cur;
28+  }, [cur.status]);
29 }
M query/types.ts
+1, -1
1@@ -56,7 +56,7 @@ export interface FetchJsonCtx<P = any, ApiSuccess = any, ApiError = any>
2 export interface ApiCtx<Payload = any, ApiSuccess = any, ApiError = any>
3   extends FetchJsonCtx<Payload, ApiSuccess, ApiError> {
4   actions: Action[];
5-  loader: LoaderPayload<any> | null;
6+  loader: Omit<LoaderPayload<any>, "id"> | null;
7   cache: boolean;
8   cacheData: any;
9 }