@xyo-network/react-payload-diviner 2.64.0 → 2.64.1
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/browser/contexts/DivinedPayload/Context.js +2 -1
- package/dist/browser/contexts/DivinedPayload/Context.js.map +1 -1
- package/dist/browser/contexts/DivinedPayload/Provider.js +59 -7
- package/dist/browser/contexts/DivinedPayload/Provider.js.map +1 -1
- package/dist/browser/contexts/DivinedPayload/index.js +91 -4
- package/dist/browser/contexts/DivinedPayload/index.js.map +1 -1
- package/dist/browser/contexts/DivinedPayload/use.js +8 -2
- package/dist/browser/contexts/DivinedPayload/use.js.map +1 -1
- package/dist/browser/contexts/PayloadDiviner/Context.js +2 -1
- package/dist/browser/contexts/PayloadDiviner/Context.js.map +1 -1
- package/dist/browser/contexts/PayloadDiviner/Provider.js +9 -3
- package/dist/browser/contexts/PayloadDiviner/Provider.js.map +1 -1
- package/dist/browser/contexts/PayloadDiviner/index.js +112 -4
- package/dist/browser/contexts/PayloadDiviner/index.js.map +1 -1
- package/dist/browser/contexts/PayloadDiviner/use.js +10 -4
- package/dist/browser/contexts/PayloadDiviner/use.js.map +1 -1
- package/dist/browser/contexts/index.js +158 -2
- package/dist/browser/contexts/index.js.map +1 -1
- package/dist/browser/index.js +158 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/docs.json +26 -26
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/contexts/DivinedPayload/Context.tsx"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { DivinedPayloadState } from './State'\n\nexport const DivinedPayloadContext = createContextEx<DivinedPayloadState>()\n"],"mappings":"AAAA,SAAS,uBAAuB;AAIzB,
|
|
1
|
+
{"version":3,"sources":["../../../../src/contexts/DivinedPayload/Context.tsx"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { DivinedPayloadState } from './State'\n\nexport const DivinedPayloadContext = createContextEx<DivinedPayloadState>()\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,wBAAwB,gBAAqC;","names":[]}
|
|
@@ -1,12 +1,64 @@
|
|
|
1
|
-
|
|
1
|
+
// src/contexts/DivinedPayload/Provider.tsx
|
|
2
2
|
import { ModuleErrorSchema } from "@xyo-network/payload-model";
|
|
3
3
|
import { ErrorRender } from "@xyo-network/react-error";
|
|
4
4
|
import { useBuildHuri } from "@xyo-network/react-payload-huri";
|
|
5
5
|
import { useParams, useSearchParams } from "react-router-dom";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
|
|
6
|
+
|
|
7
|
+
// src/contexts/PayloadDiviner/Context.ts
|
|
8
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
|
9
|
+
var PayloadDivinerContext = createContextEx();
|
|
10
|
+
|
|
11
|
+
// src/contexts/PayloadDiviner/use.ts
|
|
12
|
+
import { compact } from "@xylabs/lodash";
|
|
13
|
+
import { useAsyncEffect } from "@xylabs/react-async-effect";
|
|
14
|
+
import { HuriSchema } from "@xyo-network/diviner";
|
|
15
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
|
16
|
+
import { useEffect, useState } from "react";
|
|
17
|
+
var usePayloadDiviner = (required = false) => {
|
|
18
|
+
return useContextEx(PayloadDivinerContext, "PayloadDiviner", required);
|
|
19
|
+
};
|
|
20
|
+
var useDivinePayload = (huri) => {
|
|
21
|
+
const { diviner } = usePayloadDiviner();
|
|
22
|
+
const [payload, setPayload] = useState();
|
|
23
|
+
const [error, setError] = useState();
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (diviner) {
|
|
26
|
+
setPayload(void 0);
|
|
27
|
+
}
|
|
28
|
+
}, [diviner]);
|
|
29
|
+
useAsyncEffect(
|
|
30
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
|
+
async (mounted) => {
|
|
32
|
+
if (huri && diviner && payload === void 0) {
|
|
33
|
+
try {
|
|
34
|
+
const huriPayload = { huri: [huri], schema: HuriSchema };
|
|
35
|
+
const [payload2] = await diviner?.divine([huriPayload]) ?? [];
|
|
36
|
+
if (mounted()) {
|
|
37
|
+
setPayload(payload2 ? payload2 : null);
|
|
38
|
+
}
|
|
39
|
+
} catch (ex) {
|
|
40
|
+
if (mounted()) {
|
|
41
|
+
setError(ex);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
[diviner, huri, payload]
|
|
47
|
+
);
|
|
48
|
+
return [payload, setPayload, error];
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// src/contexts/DivinedPayload/Context.tsx
|
|
52
|
+
import { createContextEx as createContextEx2 } from "@xyo-network/react-shared";
|
|
53
|
+
var DivinedPayloadContext = createContextEx2();
|
|
54
|
+
|
|
55
|
+
// src/contexts/DivinedPayload/use.ts
|
|
56
|
+
import { useContextEx as useContextEx2 } from "@xyo-network/react-shared";
|
|
57
|
+
var useDivinedPayload = () => useContextEx2(DivinedPayloadContext, "DivinedPayload", true);
|
|
58
|
+
|
|
59
|
+
// src/contexts/DivinedPayload/Provider.tsx
|
|
60
|
+
import { jsx } from "react/jsx-runtime";
|
|
61
|
+
var DivinedPayloadProvider = ({ children, hash }) => {
|
|
10
62
|
const { hash: hashParam } = useParams();
|
|
11
63
|
const huriFromHashParam = useBuildHuri(hashParam);
|
|
12
64
|
const [params] = useSearchParams();
|
|
@@ -16,7 +68,7 @@ const DivinedPayloadProvider = ({ children, hash }) => {
|
|
|
16
68
|
const [payload, setPayload, payloadError] = useDivinePayload(huriUri);
|
|
17
69
|
return /* @__PURE__ */ jsx(DivinedPayloadContext.Provider, { value: { payload, payloadError, provided: true, setPayload }, children });
|
|
18
70
|
};
|
|
19
|
-
|
|
71
|
+
var DivinedPayloadWithHandleInner = ({ children }) => {
|
|
20
72
|
const { payloadError } = useDivinedPayload();
|
|
21
73
|
return /* @__PURE__ */ jsx(
|
|
22
74
|
ErrorRender,
|
|
@@ -27,7 +79,7 @@ const DivinedPayloadWithHandleInner = ({ children }) => {
|
|
|
27
79
|
}
|
|
28
80
|
);
|
|
29
81
|
};
|
|
30
|
-
|
|
82
|
+
var DivinedPayloadWithHandleProvider = ({ children, ...props }) => {
|
|
31
83
|
return /* @__PURE__ */ jsx(DivinedPayloadProvider, { ...props, children: /* @__PURE__ */ jsx(DivinedPayloadWithHandleInner, { children }) });
|
|
32
84
|
};
|
|
33
85
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/contexts/DivinedPayload/Provider.tsx"],"sourcesContent":["import type { WithChildren } from '@xylabs/react-shared'\nimport { ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { ErrorRender } from '@xyo-network/react-error'\nimport { useBuildHuri } from '@xyo-network/react-payload-huri'\nimport { useParams, useSearchParams } from 'react-router-dom'\n\nimport { useDivinePayload } from '../PayloadDiviner'\nimport { DivinedPayloadContext } from './Context'\nimport { useDivinedPayload } from './use'\n\nexport interface DivinedPayloadProviderProps extends WithChildren {\n hash?: string\n}\n\nexport const DivinedPayloadProvider: React.FC<DivinedPayloadProviderProps> = ({ children, hash }) => {\n const { hash: hashParam } = useParams()\n\n const huriFromHashParam = useBuildHuri(hashParam)\n\n const [params] = useSearchParams()\n const huriSearchParameter = params.get('huri')\n const decodedHuriParam = decodeURIComponent(huriSearchParameter ?? '')\n const huriUri = hash ?? (decodedHuriParam ? decodedHuriParam : huriFromHashParam)\n\n const [payload, setPayload, payloadError] = useDivinePayload(huriUri)\n\n return <DivinedPayloadContext.Provider value={{ payload, payloadError, provided: true, setPayload }}>{children}</DivinedPayloadContext.Provider>\n}\n\nexport const DivinedPayloadWithHandleInner: React.FC<WithChildren> = ({ children }) => {\n const { payloadError } = useDivinedPayload()\n\n return (\n <ErrorRender\n error={payloadError ? { message: payloadError.message, schema: ModuleErrorSchema, sources: [] } : undefined}\n errorContext=\"Divined Payload Provider\"\n >\n {children}\n </ErrorRender>\n )\n}\n\nexport const DivinedPayloadWithHandleProvider: React.FC<DivinedPayloadProviderProps> = ({ children, ...props }) => {\n return (\n <DivinedPayloadProvider {...props}>\n <DivinedPayloadWithHandleInner>{children}</DivinedPayloadWithHandleInner>\n </DivinedPayloadProvider>\n )\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/contexts/DivinedPayload/Provider.tsx","../../../../src/contexts/PayloadDiviner/Context.ts","../../../../src/contexts/PayloadDiviner/use.ts","../../../../src/contexts/DivinedPayload/Context.tsx","../../../../src/contexts/DivinedPayload/use.ts"],"sourcesContent":["import type { WithChildren } from '@xylabs/react-shared'\nimport { ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { ErrorRender } from '@xyo-network/react-error'\nimport { useBuildHuri } from '@xyo-network/react-payload-huri'\nimport { useParams, useSearchParams } from 'react-router-dom'\n\nimport { useDivinePayload } from '../PayloadDiviner'\nimport { DivinedPayloadContext } from './Context'\nimport { useDivinedPayload } from './use'\n\nexport interface DivinedPayloadProviderProps extends WithChildren {\n hash?: string\n}\n\nexport const DivinedPayloadProvider: React.FC<DivinedPayloadProviderProps> = ({ children, hash }) => {\n const { hash: hashParam } = useParams()\n\n const huriFromHashParam = useBuildHuri(hashParam)\n\n const [params] = useSearchParams()\n const huriSearchParameter = params.get('huri')\n const decodedHuriParam = decodeURIComponent(huriSearchParameter ?? '')\n const huriUri = hash ?? (decodedHuriParam ? decodedHuriParam : huriFromHashParam)\n\n const [payload, setPayload, payloadError] = useDivinePayload(huriUri)\n\n return <DivinedPayloadContext.Provider value={{ payload, payloadError, provided: true, setPayload }}>{children}</DivinedPayloadContext.Provider>\n}\n\nexport const DivinedPayloadWithHandleInner: React.FC<WithChildren> = ({ children }) => {\n const { payloadError } = useDivinedPayload()\n\n return (\n <ErrorRender\n error={payloadError ? { message: payloadError.message, schema: ModuleErrorSchema, sources: [] } : undefined}\n errorContext=\"Divined Payload Provider\"\n >\n {children}\n </ErrorRender>\n )\n}\n\nexport const DivinedPayloadWithHandleProvider: React.FC<DivinedPayloadProviderProps> = ({ children, ...props }) => {\n return (\n <DivinedPayloadProvider {...props}>\n <DivinedPayloadWithHandleInner>{children}</DivinedPayloadWithHandleInner>\n </DivinedPayloadProvider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { PayloadDivinerState } from './State'\n\nconst PayloadDivinerContext = createContextEx<PayloadDivinerState>()\n\nexport { PayloadDivinerContext }\n","import { compact } from '@xylabs/lodash'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { HuriPayload, HuriSchema } from '@xyo-network/diviner'\nimport { Payload } from '@xyo-network/payload-model'\nimport { useContextEx } from '@xyo-network/react-shared'\nimport { Dispatch, useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context'\n\nexport const usePayloadDiviner = (required = false) => {\n return useContextEx(PayloadDivinerContext, 'PayloadDiviner', required)\n}\n\nexport const useDivinePayload = <T extends Payload = Payload>(\n huri?: string,\n): [T | undefined | null, Dispatch<T | null | undefined>, Error | undefined] => {\n const { diviner } = usePayloadDiviner()\n const [payload, setPayload] = useState<T | null>()\n const [error, setError] = useState<Error>()\n\n useEffect(() => {\n if (diviner) {\n setPayload(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (huri && diviner && payload === undefined) {\n try {\n const huriPayload: HuriPayload = { huri: [huri], schema: HuriSchema }\n const [payload] = (await diviner?.divine([huriPayload])) ?? []\n if (mounted()) {\n setPayload(payload ? (payload as T) : null)\n }\n } catch (ex) {\n if (mounted()) {\n setError(ex as Error)\n }\n }\n }\n },\n [diviner, huri, payload],\n )\n\n return [payload, setPayload, error]\n}\n\nexport const useDivinePayloads = <T extends Payload = Payload>(\n huriList: string[],\n): [(T | null)[] | undefined, Dispatch<(T | null)[] | undefined>, Error[] | undefined] => {\n const { diviner } = usePayloadDiviner()\n const [payloads, setPayloads] = useState<(T | null)[]>()\n const [errors, setErrors] = useState<Error[]>()\n\n useEffect(() => {\n if (diviner) {\n setPayloads(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n console.log(`huriList: ${JSON.stringify(huriList, null, 2)}`)\n const payloads = await Promise.allSettled(\n huriList.map(async (huri) => {\n const huriPayload: HuriPayload = { huri: [huri], schema: HuriSchema }\n const [payload] = (await diviner?.divine([huriPayload])) ?? []\n return payload\n }),\n )\n if (mounted()) {\n setPayloads([...payloads.values()].map((value) => (value.status === 'rejected' ? null : value.value)) as (T | null)[])\n setErrors(\n compact([...payloads.values()].map((value) => (value.status === 'rejected' ? Error('divine failed', { cause: value.reason }) : undefined))),\n )\n if (mounted()) {\n setPayloads([...payloads.values()].map((value) => (value.status === 'rejected' ? null : value.value)) as (T | null)[])\n setErrors(\n compact(\n [...payloads.values()].map((value) => (value.status === 'rejected' ? Error('divine failed', { cause: value.reason }) : undefined)),\n ),\n )\n }\n }\n },\n [diviner, huriList, payloads],\n )\n\n return [payloads, setPayloads, errors]\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { DivinedPayloadState } from './State'\n\nexport const DivinedPayloadContext = createContextEx<DivinedPayloadState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { DivinedPayloadContext } from './Context'\n\nexport const useDivinedPayload = () => useContextEx(DivinedPayloadContext, 'DivinedPayload', true)\n"],"mappings":";AACA,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,WAAW,uBAAuB;;;ACJ3C,SAAS,uBAAuB;AAIhC,IAAM,wBAAwB,gBAAqC;;;ACJnE,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAC/B,SAAsB,kBAAkB;AAExC,SAAS,oBAAoB;AAC7B,SAAmB,WAAW,gBAAgB;AAIvC,IAAM,oBAAoB,CAAC,WAAW,UAAU;AACrD,SAAO,aAAa,uBAAuB,kBAAkB,QAAQ;AACvE;AAE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AAC,SAAS,YAAY,YAAY,IAAI,iBAAiB,OAAO;AAEpE,SAAO,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,SAAS,cAAc,UAAU,MAAM,WAAW,GAAI,UAAS;AACjH;AAEO,IAAM,gCAAwD,CAAC,EAAE,SAAS,MAAM;AACrF,QAAM,EAAE,aAAa,IAAI,kBAAkB;AAE3C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,eAAe,EAAE,SAAS,aAAa,SAAS,QAAQ,mBAAmB,SAAS,CAAC,EAAE,IAAI;AAAA,MAClG,cAAa;AAAA,MAEZ;AAAA;AAAA,EACH;AAEJ;AAEO,IAAM,mCAA0E,CAAC,EAAE,UAAU,GAAG,MAAM,MAAM;AACjH,SACE,oBAAC,0BAAwB,GAAG,OAC1B,8BAAC,iCAA+B,UAAS,GAC3C;AAEJ;","names":["payload","createContextEx","useContextEx","useContextEx"]}
|
|
@@ -1,5 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// src/contexts/DivinedPayload/Context.tsx
|
|
2
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
|
3
|
+
var DivinedPayloadContext = createContextEx();
|
|
4
|
+
|
|
5
|
+
// src/contexts/DivinedPayload/Provider.tsx
|
|
6
|
+
import { ModuleErrorSchema } from "@xyo-network/payload-model";
|
|
7
|
+
import { ErrorRender } from "@xyo-network/react-error";
|
|
8
|
+
import { useBuildHuri } from "@xyo-network/react-payload-huri";
|
|
9
|
+
import { useParams, useSearchParams } from "react-router-dom";
|
|
10
|
+
|
|
11
|
+
// src/contexts/PayloadDiviner/Context.ts
|
|
12
|
+
import { createContextEx as createContextEx2 } from "@xyo-network/react-shared";
|
|
13
|
+
var PayloadDivinerContext = createContextEx2();
|
|
14
|
+
|
|
15
|
+
// src/contexts/PayloadDiviner/use.ts
|
|
16
|
+
import { compact } from "@xylabs/lodash";
|
|
17
|
+
import { useAsyncEffect } from "@xylabs/react-async-effect";
|
|
18
|
+
import { HuriSchema } from "@xyo-network/diviner";
|
|
19
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
|
20
|
+
import { useEffect, useState } from "react";
|
|
21
|
+
var usePayloadDiviner = (required = false) => {
|
|
22
|
+
return useContextEx(PayloadDivinerContext, "PayloadDiviner", required);
|
|
23
|
+
};
|
|
24
|
+
var useDivinePayload = (huri) => {
|
|
25
|
+
const { diviner } = usePayloadDiviner();
|
|
26
|
+
const [payload, setPayload] = useState();
|
|
27
|
+
const [error, setError] = useState();
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (diviner) {
|
|
30
|
+
setPayload(void 0);
|
|
31
|
+
}
|
|
32
|
+
}, [diviner]);
|
|
33
|
+
useAsyncEffect(
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
async (mounted) => {
|
|
36
|
+
if (huri && diviner && payload === void 0) {
|
|
37
|
+
try {
|
|
38
|
+
const huriPayload = { huri: [huri], schema: HuriSchema };
|
|
39
|
+
const [payload2] = await diviner?.divine([huriPayload]) ?? [];
|
|
40
|
+
if (mounted()) {
|
|
41
|
+
setPayload(payload2 ? payload2 : null);
|
|
42
|
+
}
|
|
43
|
+
} catch (ex) {
|
|
44
|
+
if (mounted()) {
|
|
45
|
+
setError(ex);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
[diviner, huri, payload]
|
|
51
|
+
);
|
|
52
|
+
return [payload, setPayload, error];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// src/contexts/DivinedPayload/use.ts
|
|
56
|
+
import { useContextEx as useContextEx2 } from "@xyo-network/react-shared";
|
|
57
|
+
var useDivinedPayload = () => useContextEx2(DivinedPayloadContext, "DivinedPayload", true);
|
|
58
|
+
|
|
59
|
+
// src/contexts/DivinedPayload/Provider.tsx
|
|
60
|
+
import { jsx } from "react/jsx-runtime";
|
|
61
|
+
var DivinedPayloadProvider = ({ children, hash }) => {
|
|
62
|
+
const { hash: hashParam } = useParams();
|
|
63
|
+
const huriFromHashParam = useBuildHuri(hashParam);
|
|
64
|
+
const [params] = useSearchParams();
|
|
65
|
+
const huriSearchParameter = params.get("huri");
|
|
66
|
+
const decodedHuriParam = decodeURIComponent(huriSearchParameter ?? "");
|
|
67
|
+
const huriUri = hash ?? (decodedHuriParam ? decodedHuriParam : huriFromHashParam);
|
|
68
|
+
const [payload, setPayload, payloadError] = useDivinePayload(huriUri);
|
|
69
|
+
return /* @__PURE__ */ jsx(DivinedPayloadContext.Provider, { value: { payload, payloadError, provided: true, setPayload }, children });
|
|
70
|
+
};
|
|
71
|
+
var DivinedPayloadWithHandleInner = ({ children }) => {
|
|
72
|
+
const { payloadError } = useDivinedPayload();
|
|
73
|
+
return /* @__PURE__ */ jsx(
|
|
74
|
+
ErrorRender,
|
|
75
|
+
{
|
|
76
|
+
error: payloadError ? { message: payloadError.message, schema: ModuleErrorSchema, sources: [] } : void 0,
|
|
77
|
+
errorContext: "Divined Payload Provider",
|
|
78
|
+
children
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
var DivinedPayloadWithHandleProvider = ({ children, ...props }) => {
|
|
83
|
+
return /* @__PURE__ */ jsx(DivinedPayloadProvider, { ...props, children: /* @__PURE__ */ jsx(DivinedPayloadWithHandleInner, { children }) });
|
|
84
|
+
};
|
|
85
|
+
export {
|
|
86
|
+
DivinedPayloadContext,
|
|
87
|
+
DivinedPayloadProvider,
|
|
88
|
+
DivinedPayloadWithHandleInner,
|
|
89
|
+
DivinedPayloadWithHandleProvider,
|
|
90
|
+
useDivinedPayload
|
|
91
|
+
};
|
|
5
92
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/contexts/DivinedPayload/
|
|
1
|
+
{"version":3,"sources":["../../../../src/contexts/DivinedPayload/Context.tsx","../../../../src/contexts/DivinedPayload/Provider.tsx","../../../../src/contexts/PayloadDiviner/Context.ts","../../../../src/contexts/PayloadDiviner/use.ts","../../../../src/contexts/DivinedPayload/use.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { DivinedPayloadState } from './State'\n\nexport const DivinedPayloadContext = createContextEx<DivinedPayloadState>()\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { ErrorRender } from '@xyo-network/react-error'\nimport { useBuildHuri } from '@xyo-network/react-payload-huri'\nimport { useParams, useSearchParams } from 'react-router-dom'\n\nimport { useDivinePayload } from '../PayloadDiviner'\nimport { DivinedPayloadContext } from './Context'\nimport { useDivinedPayload } from './use'\n\nexport interface DivinedPayloadProviderProps extends WithChildren {\n hash?: string\n}\n\nexport const DivinedPayloadProvider: React.FC<DivinedPayloadProviderProps> = ({ children, hash }) => {\n const { hash: hashParam } = useParams()\n\n const huriFromHashParam = useBuildHuri(hashParam)\n\n const [params] = useSearchParams()\n const huriSearchParameter = params.get('huri')\n const decodedHuriParam = decodeURIComponent(huriSearchParameter ?? '')\n const huriUri = hash ?? (decodedHuriParam ? decodedHuriParam : huriFromHashParam)\n\n const [payload, setPayload, payloadError] = useDivinePayload(huriUri)\n\n return <DivinedPayloadContext.Provider value={{ payload, payloadError, provided: true, setPayload }}>{children}</DivinedPayloadContext.Provider>\n}\n\nexport const DivinedPayloadWithHandleInner: React.FC<WithChildren> = ({ children }) => {\n const { payloadError } = useDivinedPayload()\n\n return (\n <ErrorRender\n error={payloadError ? { message: payloadError.message, schema: ModuleErrorSchema, sources: [] } : undefined}\n errorContext=\"Divined Payload Provider\"\n >\n {children}\n </ErrorRender>\n )\n}\n\nexport const DivinedPayloadWithHandleProvider: React.FC<DivinedPayloadProviderProps> = ({ children, ...props }) => {\n return (\n <DivinedPayloadProvider {...props}>\n <DivinedPayloadWithHandleInner>{children}</DivinedPayloadWithHandleInner>\n </DivinedPayloadProvider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { PayloadDivinerState } from './State'\n\nconst PayloadDivinerContext = createContextEx<PayloadDivinerState>()\n\nexport { PayloadDivinerContext }\n","import { compact } from '@xylabs/lodash'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { HuriPayload, HuriSchema } from '@xyo-network/diviner'\nimport { Payload } from '@xyo-network/payload-model'\nimport { useContextEx } from '@xyo-network/react-shared'\nimport { Dispatch, useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context'\n\nexport const usePayloadDiviner = (required = false) => {\n return useContextEx(PayloadDivinerContext, 'PayloadDiviner', required)\n}\n\nexport const useDivinePayload = <T extends Payload = Payload>(\n huri?: string,\n): [T | undefined | null, Dispatch<T | null | undefined>, Error | undefined] => {\n const { diviner } = usePayloadDiviner()\n const [payload, setPayload] = useState<T | null>()\n const [error, setError] = useState<Error>()\n\n useEffect(() => {\n if (diviner) {\n setPayload(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (huri && diviner && payload === undefined) {\n try {\n const huriPayload: HuriPayload = { huri: [huri], schema: HuriSchema }\n const [payload] = (await diviner?.divine([huriPayload])) ?? []\n if (mounted()) {\n setPayload(payload ? (payload as T) : null)\n }\n } catch (ex) {\n if (mounted()) {\n setError(ex as Error)\n }\n }\n }\n },\n [diviner, huri, payload],\n )\n\n return [payload, setPayload, error]\n}\n\nexport const useDivinePayloads = <T extends Payload = Payload>(\n huriList: string[],\n): [(T | null)[] | undefined, Dispatch<(T | null)[] | undefined>, Error[] | undefined] => {\n const { diviner } = usePayloadDiviner()\n const [payloads, setPayloads] = useState<(T | null)[]>()\n const [errors, setErrors] = useState<Error[]>()\n\n useEffect(() => {\n if (diviner) {\n setPayloads(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n console.log(`huriList: ${JSON.stringify(huriList, null, 2)}`)\n const payloads = await Promise.allSettled(\n huriList.map(async (huri) => {\n const huriPayload: HuriPayload = { huri: [huri], schema: HuriSchema }\n const [payload] = (await diviner?.divine([huriPayload])) ?? []\n return payload\n }),\n )\n if (mounted()) {\n setPayloads([...payloads.values()].map((value) => (value.status === 'rejected' ? null : value.value)) as (T | null)[])\n setErrors(\n compact([...payloads.values()].map((value) => (value.status === 'rejected' ? Error('divine failed', { cause: value.reason }) : undefined))),\n )\n if (mounted()) {\n setPayloads([...payloads.values()].map((value) => (value.status === 'rejected' ? null : value.value)) as (T | null)[])\n setErrors(\n compact(\n [...payloads.values()].map((value) => (value.status === 'rejected' ? Error('divine failed', { cause: value.reason }) : undefined)),\n ),\n )\n }\n }\n },\n [diviner, huriList, payloads],\n )\n\n return [payloads, setPayloads, errors]\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { DivinedPayloadContext } from './Context'\n\nexport const useDivinedPayload = () => useContextEx(DivinedPayloadContext, 'DivinedPayload', true)\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,wBAAwB,gBAAqC;;;ACH1E,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,WAAW,uBAAuB;;;ACJ3C,SAAS,mBAAAA,wBAAuB;AAIhC,IAAM,wBAAwBA,iBAAqC;;;ACJnE,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAC/B,SAAsB,kBAAkB;AAExC,SAAS,oBAAoB;AAC7B,SAAmB,WAAW,gBAAgB;AAIvC,IAAM,oBAAoB,CAAC,WAAW,UAAU;AACrD,SAAO,aAAa,uBAAuB,kBAAkB,QAAQ;AACvE;AAEO,IAAM,mBAAmB,CAC9B,SAC8E;AAC9E,QAAM,EAAE,QAAQ,IAAI,kBAAkB;AACtC,QAAM,CAAC,SAAS,UAAU,IAAI,SAAmB;AACjD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAgB;AAE1C,YAAU,MAAM;AACd,QAAI,SAAS;AACX,iBAAW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AAO,eAAe,EAAE,SAAS,aAAa,SAAS,QAAQ,mBAAmB,SAAS,CAAC,EAAE,IAAI;AAAA,MAClG,cAAa;AAAA,MAEZ;AAAA;AAAA,EACH;AAEJ;AAEO,IAAM,mCAA0E,CAAC,EAAE,UAAU,GAAG,MAAM,MAAM;AACjH,SACE,oBAAC,0BAAwB,GAAG,OAC1B,8BAAC,iCAA+B,UAAS,GAC3C;AAEJ;","names":["createContextEx","payload","useContextEx","useContextEx"]}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
// src/contexts/DivinedPayload/use.ts
|
|
1
2
|
import { useContextEx } from "@xyo-network/react-shared";
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
// src/contexts/DivinedPayload/Context.tsx
|
|
5
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
|
6
|
+
var DivinedPayloadContext = createContextEx();
|
|
7
|
+
|
|
8
|
+
// src/contexts/DivinedPayload/use.ts
|
|
9
|
+
var useDivinedPayload = () => useContextEx(DivinedPayloadContext, "DivinedPayload", true);
|
|
4
10
|
export {
|
|
5
11
|
useDivinedPayload
|
|
6
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/contexts/DivinedPayload/use.ts"],"sourcesContent":["import { useContextEx } from '@xyo-network/react-shared'\n\nimport { DivinedPayloadContext } from './Context'\n\nexport const useDivinedPayload = () => useContextEx(DivinedPayloadContext, 'DivinedPayload', true)\n"],"mappings":"AAAA,SAAS,oBAAoB
|
|
1
|
+
{"version":3,"sources":["../../../../src/contexts/DivinedPayload/use.ts","../../../../src/contexts/DivinedPayload/Context.tsx"],"sourcesContent":["import { useContextEx } from '@xyo-network/react-shared'\n\nimport { DivinedPayloadContext } from './Context'\n\nexport const useDivinedPayload = () => useContextEx(DivinedPayloadContext, 'DivinedPayload', true)\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { DivinedPayloadState } from './State'\n\nexport const DivinedPayloadContext = createContextEx<DivinedPayloadState>()\n"],"mappings":";AAAA,SAAS,oBAAoB;;;ACA7B,SAAS,uBAAuB;AAIzB,IAAM,wBAAwB,gBAAqC;;;ADAnE,IAAM,oBAAoB,MAAM,aAAa,uBAAuB,kBAAkB,IAAI;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/contexts/PayloadDiviner/Context.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { PayloadDivinerState } from './State'\n\nconst PayloadDivinerContext = createContextEx<PayloadDivinerState>()\n\nexport { PayloadDivinerContext }\n"],"mappings":"AAAA,SAAS,uBAAuB;AAIhC,
|
|
1
|
+
{"version":3,"sources":["../../../../src/contexts/PayloadDiviner/Context.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { PayloadDivinerState } from './State'\n\nconst PayloadDivinerContext = createContextEx<PayloadDivinerState>()\n\nexport { PayloadDivinerContext }\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIhC,IAAM,wBAAwB,gBAAqC;","names":[]}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
// src/contexts/PayloadDiviner/Provider.tsx
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
|
|
4
|
+
// src/contexts/PayloadDiviner/Context.ts
|
|
5
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
|
6
|
+
var PayloadDivinerContext = createContextEx();
|
|
7
|
+
|
|
8
|
+
// src/contexts/PayloadDiviner/Provider.tsx
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
var PayloadDivinerProvider = ({ diviner: divinerProp, required = false, children }) => {
|
|
5
11
|
const [diviner, setDiviner] = useState(divinerProp);
|
|
6
12
|
useEffect(() => {
|
|
7
13
|
if (divinerProp) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/contexts/PayloadDiviner/Provider.tsx"],"sourcesContent":["import { AbstractPayloadDiviner } from '@xyo-network/diviner'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context'\n\nexport type PayloadDivinerProviderProps = ContextExProviderProps<{\n /** Required */\n diviner?: AbstractPayloadDiviner\n}>\n\nexport const PayloadDivinerProvider: React.FC<PayloadDivinerProviderProps> = ({ diviner: divinerProp, required = false, children }) => {\n const [diviner, setDiviner] = useState<AbstractPayloadDiviner | undefined>(divinerProp)\n\n useEffect(() => {\n if (divinerProp) {\n setDiviner(divinerProp)\n }\n }, [divinerProp])\n\n return (\n <PayloadDivinerContext.Provider\n value={{\n diviner: diviner === divinerProp ? diviner : undefined,\n provided: true,\n setDiviner,\n }}\n >\n {diviner ? children : required ? null : children}\n </PayloadDivinerContext.Provider>\n )\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/contexts/PayloadDiviner/Provider.tsx","../../../../src/contexts/PayloadDiviner/Context.ts"],"sourcesContent":["import { AbstractPayloadDiviner } from '@xyo-network/diviner'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context'\n\nexport type PayloadDivinerProviderProps = ContextExProviderProps<{\n /** Required */\n diviner?: AbstractPayloadDiviner\n}>\n\nexport const PayloadDivinerProvider: React.FC<PayloadDivinerProviderProps> = ({ diviner: divinerProp, required = false, children }) => {\n const [diviner, setDiviner] = useState<AbstractPayloadDiviner | undefined>(divinerProp)\n\n useEffect(() => {\n if (divinerProp) {\n setDiviner(divinerProp)\n }\n }, [divinerProp])\n\n return (\n <PayloadDivinerContext.Provider\n value={{\n diviner: diviner === divinerProp ? diviner : undefined,\n provided: true,\n setDiviner,\n }}\n >\n {diviner ? children : required ? null : children}\n </PayloadDivinerContext.Provider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { PayloadDivinerState } from './State'\n\nconst PayloadDivinerContext = createContextEx<PayloadDivinerState>()\n\nexport { PayloadDivinerContext }\n"],"mappings":";AAEA,SAAS,WAAW,gBAAgB;;;ACFpC,SAAS,uBAAuB;AAIhC,IAAM,wBAAwB,gBAAqC;;;ADiB/D;AAVG,IAAM,yBAAgE,CAAC,EAAE,SAAS,aAAa,WAAW,OAAO,SAAS,MAAM;AACrI,QAAM,CAAC,SAAS,UAAU,IAAI,SAA6C,WAAW;AAEtF,YAAU,MAAM;AACd,QAAI,aAAa;AACf,iBAAW,WAAW;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,WAAW,CAAC;AAEhB,SACE;AAAA,IAAC,sBAAsB;AAAA,IAAtB;AAAA,MACC,OAAO;AAAA,QACL,SAAS,YAAY,cAAc,UAAU;AAAA,QAC7C,UAAU;AAAA,QACV;AAAA,MACF;AAAA,MAEC,oBAAU,WAAW,WAAW,OAAO;AAAA;AAAA,EAC1C;AAEJ;","names":[]}
|
|
@@ -1,5 +1,113 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// src/contexts/PayloadDiviner/Context.ts
|
|
2
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
|
3
|
+
var PayloadDivinerContext = createContextEx();
|
|
4
|
+
|
|
5
|
+
// src/contexts/PayloadDiviner/Provider.tsx
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var PayloadDivinerProvider = ({ diviner: divinerProp, required = false, children }) => {
|
|
9
|
+
const [diviner, setDiviner] = useState(divinerProp);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (divinerProp) {
|
|
12
|
+
setDiviner(divinerProp);
|
|
13
|
+
}
|
|
14
|
+
}, [divinerProp]);
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
PayloadDivinerContext.Provider,
|
|
17
|
+
{
|
|
18
|
+
value: {
|
|
19
|
+
diviner: diviner === divinerProp ? diviner : void 0,
|
|
20
|
+
provided: true,
|
|
21
|
+
setDiviner
|
|
22
|
+
},
|
|
23
|
+
children: diviner ? children : required ? null : children
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// src/contexts/PayloadDiviner/use.ts
|
|
29
|
+
import { compact } from "@xylabs/lodash";
|
|
30
|
+
import { useAsyncEffect } from "@xylabs/react-async-effect";
|
|
31
|
+
import { HuriSchema } from "@xyo-network/diviner";
|
|
32
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
|
33
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
34
|
+
var usePayloadDiviner = (required = false) => {
|
|
35
|
+
return useContextEx(PayloadDivinerContext, "PayloadDiviner", required);
|
|
36
|
+
};
|
|
37
|
+
var useDivinePayload = (huri) => {
|
|
38
|
+
const { diviner } = usePayloadDiviner();
|
|
39
|
+
const [payload, setPayload] = useState2();
|
|
40
|
+
const [error, setError] = useState2();
|
|
41
|
+
useEffect2(() => {
|
|
42
|
+
if (diviner) {
|
|
43
|
+
setPayload(void 0);
|
|
44
|
+
}
|
|
45
|
+
}, [diviner]);
|
|
46
|
+
useAsyncEffect(
|
|
47
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
|
+
async (mounted) => {
|
|
49
|
+
if (huri && diviner && payload === void 0) {
|
|
50
|
+
try {
|
|
51
|
+
const huriPayload = { huri: [huri], schema: HuriSchema };
|
|
52
|
+
const [payload2] = await diviner?.divine([huriPayload]) ?? [];
|
|
53
|
+
if (mounted()) {
|
|
54
|
+
setPayload(payload2 ? payload2 : null);
|
|
55
|
+
}
|
|
56
|
+
} catch (ex) {
|
|
57
|
+
if (mounted()) {
|
|
58
|
+
setError(ex);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
[diviner, huri, payload]
|
|
64
|
+
);
|
|
65
|
+
return [payload, setPayload, error];
|
|
66
|
+
};
|
|
67
|
+
var useDivinePayloads = (huriList) => {
|
|
68
|
+
const { diviner } = usePayloadDiviner();
|
|
69
|
+
const [payloads, setPayloads] = useState2();
|
|
70
|
+
const [errors, setErrors] = useState2();
|
|
71
|
+
useEffect2(() => {
|
|
72
|
+
if (diviner) {
|
|
73
|
+
setPayloads(void 0);
|
|
74
|
+
}
|
|
75
|
+
}, [diviner]);
|
|
76
|
+
useAsyncEffect(
|
|
77
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
78
|
+
async (mounted) => {
|
|
79
|
+
console.log(`huriList: ${JSON.stringify(huriList, null, 2)}`);
|
|
80
|
+
const payloads2 = await Promise.allSettled(
|
|
81
|
+
huriList.map(async (huri) => {
|
|
82
|
+
const huriPayload = { huri: [huri], schema: HuriSchema };
|
|
83
|
+
const [payload] = await diviner?.divine([huriPayload]) ?? [];
|
|
84
|
+
return payload;
|
|
85
|
+
})
|
|
86
|
+
);
|
|
87
|
+
if (mounted()) {
|
|
88
|
+
setPayloads([...payloads2.values()].map((value) => value.status === "rejected" ? null : value.value));
|
|
89
|
+
setErrors(
|
|
90
|
+
compact([...payloads2.values()].map((value) => value.status === "rejected" ? Error("divine failed", { cause: value.reason }) : void 0))
|
|
91
|
+
);
|
|
92
|
+
if (mounted()) {
|
|
93
|
+
setPayloads([...payloads2.values()].map((value) => value.status === "rejected" ? null : value.value));
|
|
94
|
+
setErrors(
|
|
95
|
+
compact(
|
|
96
|
+
[...payloads2.values()].map((value) => value.status === "rejected" ? Error("divine failed", { cause: value.reason }) : void 0)
|
|
97
|
+
)
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
[diviner, huriList, payloads]
|
|
103
|
+
);
|
|
104
|
+
return [payloads, setPayloads, errors];
|
|
105
|
+
};
|
|
106
|
+
export {
|
|
107
|
+
PayloadDivinerContext,
|
|
108
|
+
PayloadDivinerProvider,
|
|
109
|
+
useDivinePayload,
|
|
110
|
+
useDivinePayloads,
|
|
111
|
+
usePayloadDiviner
|
|
112
|
+
};
|
|
5
113
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/contexts/PayloadDiviner/
|
|
1
|
+
{"version":3,"sources":["../../../../src/contexts/PayloadDiviner/Context.ts","../../../../src/contexts/PayloadDiviner/Provider.tsx","../../../../src/contexts/PayloadDiviner/use.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { PayloadDivinerState } from './State'\n\nconst PayloadDivinerContext = createContextEx<PayloadDivinerState>()\n\nexport { PayloadDivinerContext }\n","import { AbstractPayloadDiviner } from '@xyo-network/diviner'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context'\n\nexport type PayloadDivinerProviderProps = ContextExProviderProps<{\n /** Required */\n diviner?: AbstractPayloadDiviner\n}>\n\nexport const PayloadDivinerProvider: React.FC<PayloadDivinerProviderProps> = ({ diviner: divinerProp, required = false, children }) => {\n const [diviner, setDiviner] = useState<AbstractPayloadDiviner | undefined>(divinerProp)\n\n useEffect(() => {\n if (divinerProp) {\n setDiviner(divinerProp)\n }\n }, [divinerProp])\n\n return (\n <PayloadDivinerContext.Provider\n value={{\n diviner: diviner === divinerProp ? diviner : undefined,\n provided: true,\n setDiviner,\n }}\n >\n {diviner ? children : required ? null : children}\n </PayloadDivinerContext.Provider>\n )\n}\n","import { compact } from '@xylabs/lodash'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { HuriPayload, HuriSchema } from '@xyo-network/diviner'\nimport { Payload } from '@xyo-network/payload-model'\nimport { useContextEx } from '@xyo-network/react-shared'\nimport { Dispatch, useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context'\n\nexport const usePayloadDiviner = (required = false) => {\n return useContextEx(PayloadDivinerContext, 'PayloadDiviner', required)\n}\n\nexport const useDivinePayload = <T extends Payload = Payload>(\n huri?: string,\n): [T | undefined | null, Dispatch<T | null | undefined>, Error | undefined] => {\n const { diviner } = usePayloadDiviner()\n const [payload, setPayload] = useState<T | null>()\n const [error, setError] = useState<Error>()\n\n useEffect(() => {\n if (diviner) {\n setPayload(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (huri && diviner && payload === undefined) {\n try {\n const huriPayload: HuriPayload = { huri: [huri], schema: HuriSchema }\n const [payload] = (await diviner?.divine([huriPayload])) ?? []\n if (mounted()) {\n setPayload(payload ? (payload as T) : null)\n }\n } catch (ex) {\n if (mounted()) {\n setError(ex as Error)\n }\n }\n }\n },\n [diviner, huri, payload],\n )\n\n return [payload, setPayload, error]\n}\n\nexport const useDivinePayloads = <T extends Payload = Payload>(\n huriList: string[],\n): [(T | null)[] | undefined, Dispatch<(T | null)[] | undefined>, Error[] | undefined] => {\n const { diviner } = usePayloadDiviner()\n const [payloads, setPayloads] = useState<(T | null)[]>()\n const [errors, setErrors] = useState<Error[]>()\n\n useEffect(() => {\n if (diviner) {\n setPayloads(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n console.log(`huriList: ${JSON.stringify(huriList, null, 2)}`)\n const payloads = await Promise.allSettled(\n huriList.map(async (huri) => {\n const huriPayload: HuriPayload = { huri: [huri], schema: HuriSchema }\n const [payload] = (await diviner?.divine([huriPayload])) ?? []\n return payload\n }),\n )\n if (mounted()) {\n setPayloads([...payloads.values()].map((value) => (value.status === 'rejected' ? null : value.value)) as (T | null)[])\n setErrors(\n compact([...payloads.values()].map((value) => (value.status === 'rejected' ? Error('divine failed', { cause: value.reason }) : undefined))),\n )\n if (mounted()) {\n setPayloads([...payloads.values()].map((value) => (value.status === 'rejected' ? null : value.value)) as (T | null)[])\n setErrors(\n compact(\n [...payloads.values()].map((value) => (value.status === 'rejected' ? Error('divine failed', { cause: value.reason }) : undefined)),\n ),\n )\n }\n }\n },\n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CAAC,IAAI,MAAU,CAAC;AAAA,QAC5I;AACA,YAAI,QAAQ,GAAG;AACb,sBAAY,CAAC,GAAGA,UAAS,OAAO,CAAC,EAAE,IAAI,CAAC,UAAW,MAAM,WAAW,aAAa,OAAO,MAAM,KAAM,CAAiB;AACrH;AAAA,YACE;AAAA,cACE,CAAC,GAAGA,UAAS,OAAO,CAAC,EAAE,IAAI,CAAC,UAAW,MAAM,WAAW,aAAa,MAAM,iBAAiB,EAAE,OAAO,MAAM,OAAO,CAAC,IAAI,MAAU;AAAA,YACnI;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,SAAS,UAAU,QAAQ;AAAA,EAC9B;AAEA,SAAO,CAAC,UAAU,aAAa,MAAM;AACvC;","names":["useEffect","useState","useState","useEffect","payload","payloads"]}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
// src/contexts/PayloadDiviner/use.ts
|
|
1
2
|
import { compact } from "@xylabs/lodash";
|
|
2
3
|
import { useAsyncEffect } from "@xylabs/react-async-effect";
|
|
3
4
|
import { HuriSchema } from "@xyo-network/diviner";
|
|
4
5
|
import { useContextEx } from "@xyo-network/react-shared";
|
|
5
6
|
import { useEffect, useState } from "react";
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
// src/contexts/PayloadDiviner/Context.ts
|
|
9
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
|
10
|
+
var PayloadDivinerContext = createContextEx();
|
|
11
|
+
|
|
12
|
+
// src/contexts/PayloadDiviner/use.ts
|
|
13
|
+
var usePayloadDiviner = (required = false) => {
|
|
8
14
|
return useContextEx(PayloadDivinerContext, "PayloadDiviner", required);
|
|
9
15
|
};
|
|
10
|
-
|
|
16
|
+
var useDivinePayload = (huri) => {
|
|
11
17
|
const { diviner } = usePayloadDiviner();
|
|
12
18
|
const [payload, setPayload] = useState();
|
|
13
19
|
const [error, setError] = useState();
|
|
@@ -37,7 +43,7 @@ const useDivinePayload = (huri) => {
|
|
|
37
43
|
);
|
|
38
44
|
return [payload, setPayload, error];
|
|
39
45
|
};
|
|
40
|
-
|
|
46
|
+
var useDivinePayloads = (huriList) => {
|
|
41
47
|
const { diviner } = usePayloadDiviner();
|
|
42
48
|
const [payloads, setPayloads] = useState();
|
|
43
49
|
const [errors, setErrors] = useState();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/contexts/PayloadDiviner/use.ts"],"sourcesContent":["import { compact } from '@xylabs/lodash'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { HuriPayload, HuriSchema } from '@xyo-network/diviner'\nimport { Payload } from '@xyo-network/payload-model'\nimport { useContextEx } from '@xyo-network/react-shared'\nimport { Dispatch, useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context'\n\nexport const usePayloadDiviner = (required = false) => {\n return useContextEx(PayloadDivinerContext, 'PayloadDiviner', required)\n}\n\nexport const useDivinePayload = <T extends Payload = Payload>(\n huri?: string,\n): [T | undefined | null, Dispatch<T | null | undefined>, Error | undefined] => {\n const { diviner } = usePayloadDiviner()\n const [payload, setPayload] = useState<T | null>()\n const [error, setError] = useState<Error>()\n\n useEffect(() => {\n if (diviner) {\n setPayload(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (huri && diviner && payload === undefined) {\n try {\n const huriPayload: HuriPayload = { huri: [huri], schema: HuriSchema }\n const [payload] = (await diviner?.divine([huriPayload])) ?? []\n if (mounted()) {\n setPayload(payload ? (payload as T) : null)\n }\n } catch (ex) {\n if (mounted()) {\n setError(ex as Error)\n }\n }\n }\n },\n [diviner, huri, payload],\n )\n\n return [payload, setPayload, error]\n}\n\nexport const useDivinePayloads = <T extends Payload = Payload>(\n huriList: string[],\n): [(T | null)[] | undefined, Dispatch<(T | null)[] | undefined>, Error[] | undefined] => {\n const { diviner } = usePayloadDiviner()\n const [payloads, setPayloads] = useState<(T | null)[]>()\n const [errors, setErrors] = useState<Error[]>()\n\n useEffect(() => {\n if (diviner) {\n setPayloads(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n console.log(`huriList: ${JSON.stringify(huriList, null, 2)}`)\n const payloads = await Promise.allSettled(\n huriList.map(async (huri) => {\n const huriPayload: HuriPayload = { huri: [huri], schema: HuriSchema }\n const [payload] = (await diviner?.divine([huriPayload])) ?? []\n return payload\n }),\n )\n if (mounted()) {\n setPayloads([...payloads.values()].map((value) => (value.status === 'rejected' ? null : value.value)) as (T | null)[])\n setErrors(\n compact([...payloads.values()].map((value) => (value.status === 'rejected' ? Error('divine failed', { cause: value.reason }) : undefined))),\n )\n if (mounted()) {\n setPayloads([...payloads.values()].map((value) => (value.status === 'rejected' ? null : value.value)) as (T | null)[])\n setErrors(\n compact(\n [...payloads.values()].map((value) => (value.status === 'rejected' ? Error('divine failed', { cause: value.reason }) : undefined)),\n ),\n )\n }\n }\n },\n [diviner, huriList, payloads],\n )\n\n return [payloads, setPayloads, errors]\n}\n"],"mappings":"AAAA,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAC/B,SAAsB,kBAAkB;AAExC,SAAS,oBAAoB;AAC7B,SAAmB,WAAW,gBAAgB
|
|
1
|
+
{"version":3,"sources":["../../../../src/contexts/PayloadDiviner/use.ts","../../../../src/contexts/PayloadDiviner/Context.ts"],"sourcesContent":["import { compact } from '@xylabs/lodash'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { HuriPayload, HuriSchema } from '@xyo-network/diviner'\nimport { Payload } from '@xyo-network/payload-model'\nimport { useContextEx } from '@xyo-network/react-shared'\nimport { Dispatch, useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context'\n\nexport const usePayloadDiviner = (required = false) => {\n return useContextEx(PayloadDivinerContext, 'PayloadDiviner', required)\n}\n\nexport const useDivinePayload = <T extends Payload = Payload>(\n huri?: string,\n): [T | undefined | null, Dispatch<T | null | undefined>, Error | undefined] => {\n const { diviner } = usePayloadDiviner()\n const [payload, setPayload] = useState<T | null>()\n const [error, setError] = useState<Error>()\n\n useEffect(() => {\n if (diviner) {\n setPayload(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (huri && diviner && payload === undefined) {\n try {\n const huriPayload: HuriPayload = { huri: [huri], schema: HuriSchema }\n const [payload] = (await diviner?.divine([huriPayload])) ?? []\n if (mounted()) {\n setPayload(payload ? (payload as T) : null)\n }\n } catch (ex) {\n if (mounted()) {\n setError(ex as Error)\n }\n }\n }\n },\n [diviner, huri, payload],\n )\n\n return [payload, setPayload, error]\n}\n\nexport const useDivinePayloads = <T extends Payload = Payload>(\n huriList: string[],\n): [(T | null)[] | undefined, Dispatch<(T | null)[] | undefined>, Error[] | undefined] => {\n const { diviner } = usePayloadDiviner()\n const [payloads, setPayloads] = useState<(T | null)[]>()\n const [errors, setErrors] = useState<Error[]>()\n\n useEffect(() => {\n if (diviner) {\n setPayloads(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n console.log(`huriList: ${JSON.stringify(huriList, null, 2)}`)\n const payloads = await Promise.allSettled(\n huriList.map(async (huri) => {\n const huriPayload: HuriPayload = { huri: [huri], schema: HuriSchema }\n const [payload] = (await diviner?.divine([huriPayload])) ?? []\n return payload\n }),\n )\n if (mounted()) {\n setPayloads([...payloads.values()].map((value) => (value.status === 'rejected' ? null : value.value)) as (T | null)[])\n setErrors(\n compact([...payloads.values()].map((value) => (value.status === 'rejected' ? Error('divine failed', { cause: value.reason }) : undefined))),\n )\n if (mounted()) {\n setPayloads([...payloads.values()].map((value) => (value.status === 'rejected' ? null : value.value)) as (T | null)[])\n setErrors(\n compact(\n [...payloads.values()].map((value) => (value.status === 'rejected' ? Error('divine failed', { cause: value.reason }) : undefined)),\n ),\n )\n }\n }\n },\n [diviner, huriList, payloads],\n )\n\n return [payloads, setPayloads, errors]\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { PayloadDivinerState } from './State'\n\nconst PayloadDivinerContext = createContextEx<PayloadDivinerState>()\n\nexport { PayloadDivinerContext }\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAC/B,SAAsB,kBAAkB;AAExC,SAAS,oBAAoB;AAC7B,SAAmB,WAAW,gBAAgB;;;ACL9C,SAAS,uBAAuB;AAIhC,IAAM,wBAAwB,gBAAqC;;;ADK5D,IAAM,oBAAoB,CAAC,WAAW,UAAU;AACrD,SAAO,aAAa,uBAAuB,kBAAkB,QAAQ;AACvE;AAEO,IAAM,mBAAmB,CAC9B,SAC8E;AAC9E,QAAM,EAAE,QAAQ,IAAI,kBAAkB;AACtC,QAAM,CAAC,SAAS,UAAU,IAAI,SAAmB;AACjD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAgB;AAE1C,YAAU,MAAM;AACd,QAAI,SAAS;AACX,iBAAW,MAAS;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAEZ;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,QAAQ,WAAW,YAAY,QAAW;AAC5C,YAAI;AACF,gBAAM,cAA2B,EAAE,MAAM,CAAC,IAAI,GAAG,QAAQ,WAAW;AACpE,gBAAM,CAACA,QAAO,IAAK,MAAM,SAAS,OAAO,CAAC,WAAW,CAAC,KAAM,CAAC;AAC7D,cAAI,QAAQ,GAAG;AACb,uBAAWA,WAAWA,WAAgB,IAAI;AAAA,UAC5C;AAAA,QACF,SAAS,IAAI;AACX,cAAI,QAAQ,GAAG;AACb,qBAAS,EAAW;AAAA,UACtB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,SAAS,MAAM,OAAO;AAAA,EACzB;AAEA,SAAO,CAAC,SAAS,YAAY,KAAK;AACpC;AAEO,IAAM,oBAAoB,CAC/B,a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AA,MACF;AAAA,IACF;AAAA,IACA,CAAC,SAAS,UAAU,QAAQ;AAAA,EAC9B;AAEA,SAAO,CAAC,UAAU,aAAa,MAAM;AACvC;","names":["payload","payloads"]}
|
|
@@ -1,3 +1,159 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// src/contexts/DivinedPayload/Context.tsx
|
|
2
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
|
3
|
+
var DivinedPayloadContext = createContextEx();
|
|
4
|
+
|
|
5
|
+
// src/contexts/DivinedPayload/Provider.tsx
|
|
6
|
+
import { ModuleErrorSchema } from "@xyo-network/payload-model";
|
|
7
|
+
import { ErrorRender } from "@xyo-network/react-error";
|
|
8
|
+
import { useBuildHuri } from "@xyo-network/react-payload-huri";
|
|
9
|
+
import { useParams, useSearchParams } from "react-router-dom";
|
|
10
|
+
|
|
11
|
+
// src/contexts/PayloadDiviner/Context.ts
|
|
12
|
+
import { createContextEx as createContextEx2 } from "@xyo-network/react-shared";
|
|
13
|
+
var PayloadDivinerContext = createContextEx2();
|
|
14
|
+
|
|
15
|
+
// src/contexts/PayloadDiviner/Provider.tsx
|
|
16
|
+
import { useEffect, useState } from "react";
|
|
17
|
+
import { jsx } from "react/jsx-runtime";
|
|
18
|
+
var PayloadDivinerProvider = ({ diviner: divinerProp, required = false, children }) => {
|
|
19
|
+
const [diviner, setDiviner] = useState(divinerProp);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (divinerProp) {
|
|
22
|
+
setDiviner(divinerProp);
|
|
23
|
+
}
|
|
24
|
+
}, [divinerProp]);
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
PayloadDivinerContext.Provider,
|
|
27
|
+
{
|
|
28
|
+
value: {
|
|
29
|
+
diviner: diviner === divinerProp ? diviner : void 0,
|
|
30
|
+
provided: true,
|
|
31
|
+
setDiviner
|
|
32
|
+
},
|
|
33
|
+
children: diviner ? children : required ? null : children
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/contexts/PayloadDiviner/use.ts
|
|
39
|
+
import { compact } from "@xylabs/lodash";
|
|
40
|
+
import { useAsyncEffect } from "@xylabs/react-async-effect";
|
|
41
|
+
import { HuriSchema } from "@xyo-network/diviner";
|
|
42
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
|
43
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
44
|
+
var usePayloadDiviner = (required = false) => {
|
|
45
|
+
return useContextEx(PayloadDivinerContext, "PayloadDiviner", required);
|
|
46
|
+
};
|
|
47
|
+
var useDivinePayload = (huri) => {
|
|
48
|
+
const { diviner } = usePayloadDiviner();
|
|
49
|
+
const [payload, setPayload] = useState2();
|
|
50
|
+
const [error, setError] = useState2();
|
|
51
|
+
useEffect2(() => {
|
|
52
|
+
if (diviner) {
|
|
53
|
+
setPayload(void 0);
|
|
54
|
+
}
|
|
55
|
+
}, [diviner]);
|
|
56
|
+
useAsyncEffect(
|
|
57
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
+
async (mounted) => {
|
|
59
|
+
if (huri && diviner && payload === void 0) {
|
|
60
|
+
try {
|
|
61
|
+
const huriPayload = { huri: [huri], schema: HuriSchema };
|
|
62
|
+
const [payload2] = await diviner?.divine([huriPayload]) ?? [];
|
|
63
|
+
if (mounted()) {
|
|
64
|
+
setPayload(payload2 ? payload2 : null);
|
|
65
|
+
}
|
|
66
|
+
} catch (ex) {
|
|
67
|
+
if (mounted()) {
|
|
68
|
+
setError(ex);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
[diviner, huri, payload]
|
|
74
|
+
);
|
|
75
|
+
return [payload, setPayload, error];
|
|
76
|
+
};
|
|
77
|
+
var useDivinePayloads = (huriList) => {
|
|
78
|
+
const { diviner } = usePayloadDiviner();
|
|
79
|
+
const [payloads, setPayloads] = useState2();
|
|
80
|
+
const [errors, setErrors] = useState2();
|
|
81
|
+
useEffect2(() => {
|
|
82
|
+
if (diviner) {
|
|
83
|
+
setPayloads(void 0);
|
|
84
|
+
}
|
|
85
|
+
}, [diviner]);
|
|
86
|
+
useAsyncEffect(
|
|
87
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
88
|
+
async (mounted) => {
|
|
89
|
+
console.log(`huriList: ${JSON.stringify(huriList, null, 2)}`);
|
|
90
|
+
const payloads2 = await Promise.allSettled(
|
|
91
|
+
huriList.map(async (huri) => {
|
|
92
|
+
const huriPayload = { huri: [huri], schema: HuriSchema };
|
|
93
|
+
const [payload] = await diviner?.divine([huriPayload]) ?? [];
|
|
94
|
+
return payload;
|
|
95
|
+
})
|
|
96
|
+
);
|
|
97
|
+
if (mounted()) {
|
|
98
|
+
setPayloads([...payloads2.values()].map((value) => value.status === "rejected" ? null : value.value));
|
|
99
|
+
setErrors(
|
|
100
|
+
compact([...payloads2.values()].map((value) => value.status === "rejected" ? Error("divine failed", { cause: value.reason }) : void 0))
|
|
101
|
+
);
|
|
102
|
+
if (mounted()) {
|
|
103
|
+
setPayloads([...payloads2.values()].map((value) => value.status === "rejected" ? null : value.value));
|
|
104
|
+
setErrors(
|
|
105
|
+
compact(
|
|
106
|
+
[...payloads2.values()].map((value) => value.status === "rejected" ? Error("divine failed", { cause: value.reason }) : void 0)
|
|
107
|
+
)
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
[diviner, huriList, payloads]
|
|
113
|
+
);
|
|
114
|
+
return [payloads, setPayloads, errors];
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// src/contexts/DivinedPayload/use.ts
|
|
118
|
+
import { useContextEx as useContextEx2 } from "@xyo-network/react-shared";
|
|
119
|
+
var useDivinedPayload = () => useContextEx2(DivinedPayloadContext, "DivinedPayload", true);
|
|
120
|
+
|
|
121
|
+
// src/contexts/DivinedPayload/Provider.tsx
|
|
122
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
123
|
+
var DivinedPayloadProvider = ({ children, hash }) => {
|
|
124
|
+
const { hash: hashParam } = useParams();
|
|
125
|
+
const huriFromHashParam = useBuildHuri(hashParam);
|
|
126
|
+
const [params] = useSearchParams();
|
|
127
|
+
const huriSearchParameter = params.get("huri");
|
|
128
|
+
const decodedHuriParam = decodeURIComponent(huriSearchParameter ?? "");
|
|
129
|
+
const huriUri = hash ?? (decodedHuriParam ? decodedHuriParam : huriFromHashParam);
|
|
130
|
+
const [payload, setPayload, payloadError] = useDivinePayload(huriUri);
|
|
131
|
+
return /* @__PURE__ */ jsx2(DivinedPayloadContext.Provider, { value: { payload, payloadError, provided: true, setPayload }, children });
|
|
132
|
+
};
|
|
133
|
+
var DivinedPayloadWithHandleInner = ({ children }) => {
|
|
134
|
+
const { payloadError } = useDivinedPayload();
|
|
135
|
+
return /* @__PURE__ */ jsx2(
|
|
136
|
+
ErrorRender,
|
|
137
|
+
{
|
|
138
|
+
error: payloadError ? { message: payloadError.message, schema: ModuleErrorSchema, sources: [] } : void 0,
|
|
139
|
+
errorContext: "Divined Payload Provider",
|
|
140
|
+
children
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
var DivinedPayloadWithHandleProvider = ({ children, ...props }) => {
|
|
145
|
+
return /* @__PURE__ */ jsx2(DivinedPayloadProvider, { ...props, children: /* @__PURE__ */ jsx2(DivinedPayloadWithHandleInner, { children }) });
|
|
146
|
+
};
|
|
147
|
+
export {
|
|
148
|
+
DivinedPayloadContext,
|
|
149
|
+
DivinedPayloadProvider,
|
|
150
|
+
DivinedPayloadWithHandleInner,
|
|
151
|
+
DivinedPayloadWithHandleProvider,
|
|
152
|
+
PayloadDivinerContext,
|
|
153
|
+
PayloadDivinerProvider,
|
|
154
|
+
useDivinePayload,
|
|
155
|
+
useDivinePayloads,
|
|
156
|
+
useDivinedPayload,
|
|
157
|
+
usePayloadDiviner
|
|
158
|
+
};
|
|
3
159
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/contexts/index.ts"],"sourcesContent":["export * from './DivinedPayload'\nexport * from './PayloadDiviner'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/contexts/DivinedPayload/Context.tsx","../../../src/contexts/DivinedPayload/Provider.tsx","../../../src/contexts/PayloadDiviner/Context.ts","../../../src/contexts/PayloadDiviner/Provider.tsx","../../../src/contexts/PayloadDiviner/use.ts","../../../src/contexts/DivinedPayload/use.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { DivinedPayloadState } from './State'\n\nexport const DivinedPayloadContext = createContextEx<DivinedPayloadState>()\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { ErrorRender } from '@xyo-network/react-error'\nimport { useBuildHuri } from '@xyo-network/react-payload-huri'\nimport { useParams, useSearchParams } from 'react-router-dom'\n\nimport { useDivinePayload } from '../PayloadDiviner'\nimport { DivinedPayloadContext } from './Context'\nimport { useDivinedPayload } from './use'\n\nexport interface DivinedPayloadProviderProps extends WithChildren {\n hash?: string\n}\n\nexport const DivinedPayloadProvider: React.FC<DivinedPayloadProviderProps> = ({ children, hash }) => {\n const { hash: hashParam } = useParams()\n\n const huriFromHashParam = useBuildHuri(hashParam)\n\n const [params] = useSearchParams()\n const huriSearchParameter = params.get('huri')\n const decodedHuriParam = decodeURIComponent(huriSearchParameter ?? '')\n const huriUri = hash ?? (decodedHuriParam ? decodedHuriParam : huriFromHashParam)\n\n const [payload, setPayload, payloadError] = useDivinePayload(huriUri)\n\n return <DivinedPayloadContext.Provider value={{ payload, payloadError, provided: true, setPayload }}>{children}</DivinedPayloadContext.Provider>\n}\n\nexport const DivinedPayloadWithHandleInner: React.FC<WithChildren> = ({ children }) => {\n const { payloadError } = useDivinedPayload()\n\n return (\n <ErrorRender\n error={payloadError ? { message: payloadError.message, schema: ModuleErrorSchema, sources: [] } : undefined}\n errorContext=\"Divined Payload Provider\"\n >\n {children}\n </ErrorRender>\n )\n}\n\nexport const DivinedPayloadWithHandleProvider: React.FC<DivinedPayloadProviderProps> = ({ children, ...props }) => {\n return (\n <DivinedPayloadProvider {...props}>\n <DivinedPayloadWithHandleInner>{children}</DivinedPayloadWithHandleInner>\n </DivinedPayloadProvider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { PayloadDivinerState } from './State'\n\nconst PayloadDivinerContext = createContextEx<PayloadDivinerState>()\n\nexport { PayloadDivinerContext }\n","import { AbstractPayloadDiviner } from '@xyo-network/diviner'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context'\n\nexport type PayloadDivinerProviderProps = ContextExProviderProps<{\n /** Required */\n diviner?: AbstractPayloadDiviner\n}>\n\nexport const PayloadDivinerProvider: React.FC<PayloadDivinerProviderProps> = ({ diviner: divinerProp, required = false, children }) => {\n const [diviner, setDiviner] = useState<AbstractPayloadDiviner | undefined>(divinerProp)\n\n useEffect(() => {\n if (divinerProp) {\n setDiviner(divinerProp)\n }\n }, [divinerProp])\n\n return (\n <PayloadDivinerContext.Provider\n value={{\n diviner: diviner === divinerProp ? diviner : undefined,\n provided: true,\n setDiviner,\n }}\n >\n {diviner ? children : required ? null : children}\n </PayloadDivinerContext.Provider>\n )\n}\n","import { compact } from '@xylabs/lodash'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { HuriPayload, HuriSchema } from '@xyo-network/diviner'\nimport { Payload } from '@xyo-network/payload-model'\nimport { useContextEx } from '@xyo-network/react-shared'\nimport { Dispatch, useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context'\n\nexport const usePayloadDiviner = (required = false) => {\n return useContextEx(PayloadDivinerContext, 'PayloadDiviner', required)\n}\n\nexport const useDivinePayload = <T extends Payload = Payload>(\n huri?: string,\n): [T | undefined | null, Dispatch<T | null | undefined>, Error | undefined] => {\n const { diviner } = usePayloadDiviner()\n const [payload, setPayload] = useState<T | null>()\n const [error, setError] = useState<Error>()\n\n useEffect(() => {\n if (diviner) {\n setPayload(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (huri && diviner && payload === undefined) {\n try {\n const huriPayload: HuriPayload = { huri: [huri], schema: HuriSchema }\n const [payload] = (await diviner?.divine([huriPayload])) ?? []\n if (mounted()) {\n setPayload(payload ? (payload as T) : null)\n }\n } catch (ex) {\n if (mounted()) {\n setError(ex as Error)\n }\n }\n }\n },\n [diviner, huri, payload],\n )\n\n return [payload, setPayload, error]\n}\n\nexport const useDivinePayloads = <T extends Payload = Payload>(\n huriList: string[],\n): [(T | null)[] | undefined, Dispatch<(T | null)[] | undefined>, Error[] | undefined] => {\n const { diviner } = usePayloadDiviner()\n const [payloads, setPayloads] = useState<(T | null)[]>()\n const [errors, setErrors] = useState<Error[]>()\n\n useEffect(() => {\n if (diviner) {\n setPayloads(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n console.log(`huriList: ${JSON.stringify(huriList, null, 2)}`)\n const payloads = await Promise.allSettled(\n huriList.map(async (huri) => {\n const huriPayload: HuriPayload = { huri: [huri], schema: HuriSchema }\n const [payload] = (await diviner?.divine([huriPayload])) ?? []\n return payload\n }),\n )\n if (mounted()) {\n setPayloads([...payloads.values()].map((value) => (value.status === 'rejected' ? null : value.value)) as (T | null)[])\n setErrors(\n compact([...payloads.values()].map((value) => (value.status === 'rejected' ? Error('divine failed', { cause: value.reason }) : undefined))),\n )\n if (mounted()) {\n setPayloads([...payloads.values()].map((value) => (value.status === 'rejected' ? null : value.value)) as (T | null)[])\n setErrors(\n compact(\n [...payloads.values()].map((value) => (value.status === 'rejected' ? Error('divine failed', { cause: value.reason }) : undefined)),\n ),\n )\n }\n }\n },\n [diviner, huriList, payloads],\n )\n\n return [payloads, setPayloads, errors]\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { DivinedPayloadContext } from './Context'\n\nexport const useDivinedPayload = () => useContextEx(DivinedPayloadContext, 'DivinedPayload', true)\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,wBAAwB,gBAAqC;;;ACH1E,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,WAAW,uBAAuB;;;ACJ3C,SAAS,mBAAAA,wBAAuB;AAIhC,IAAM,wBAAwBA,iBAAqC;;;ACFnE,SAAS,WAAW,gBAAgB;AAmBhC;AAVG,IAAM,yBAAgE,CAAC,EAAE,SAAS,aAAa,WAAW,OAAO,SAAS,MAAM;AACrI,QAAM,CAAC,SAAS,UAAU,IAAI,SAA6C,WAAW;AAEtF,YAAU,MAAM;AACd,QAAI,aAAa;AACf,iBAAW,WAAW;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,WAAW,CAAC;AAEhB,SACE;AAAA,IAAC,sBAAsB;AAAA,IAAtB;AAAA,MACC,OAAO;AAAA,QACL,SAAS,YAAY,cAAc,UAAU;AAAA,QAC7C,UAAU;AAAA,QACV;AAAA,MACF;AAAA,MAEC,oBAAU,WAAW,WAAW,OAAO;AAAA;AAAA,EAC1C;AAEJ;;;AC/BA,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAC/B,SAAsB,kBAAkB;AAExC,SAAS,oBAAoB;AAC7B,SAAmB,aAAAC,YAAW,YAAAC,iBAAgB;AAIvC,IAAM,oBAAoB,CAAC,WAAW,UAAU;AACrD,SAAO,aAAa,uBAAuB,kBAAkB,QAAQ;AACvE;AAEO,IAAM,mBAAmB,CAC9B,SAC8E;AAC9E,QAAM,EAAE,QAAQ,IAAI,kBAAkB;AACtC,QAAM,CAAC,SAAS,UAAU,IAAIC,UAAmB;AACjD,QAAM,CAAC,OAAO,QAAQ,IAAIA,UAAgB;AAE1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AAA,KAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,SAAS,cAAc,UAAU,MAAM,WAAW,GAAI,UAAS;AACjH;AAEO,IAAM,gCAAwD,CAAC,EAAE,SAAS,MAAM;AACrF,QAAM,EAAE,aAAa,IAAI,kBAAkB;AAE3C,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,eAAe,EAAE,SAAS,aAAa,SAAS,QAAQ,mBAAmB,SAAS,CAAC,EAAE,IAAI;AAAA,MAClG,cAAa;AAAA,MAEZ;AAAA;AAAA,EACH;AAEJ;AAEO,IAAM,mCAA0E,CAAC,EAAE,UAAU,GAAG,MAAM,MAAM;AACjH,SACE,gBAAAA,KAAC,0BAAwB,GAAG,OAC1B,0BAAAA,KAAC,iCAA+B,UAAS,GAC3C;AAEJ;","names":["createContextEx","useEffect","useState","useState","useEffect","payload","payloads","useContextEx","useContextEx","jsx"]}
|
package/dist/browser/index.js
CHANGED
|
@@ -1,2 +1,159 @@
|
|
|
1
|
-
|
|
1
|
+
// src/contexts/DivinedPayload/Context.tsx
|
|
2
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
|
3
|
+
var DivinedPayloadContext = createContextEx();
|
|
4
|
+
|
|
5
|
+
// src/contexts/DivinedPayload/Provider.tsx
|
|
6
|
+
import { ModuleErrorSchema } from "@xyo-network/payload-model";
|
|
7
|
+
import { ErrorRender } from "@xyo-network/react-error";
|
|
8
|
+
import { useBuildHuri } from "@xyo-network/react-payload-huri";
|
|
9
|
+
import { useParams, useSearchParams } from "react-router-dom";
|
|
10
|
+
|
|
11
|
+
// src/contexts/PayloadDiviner/Context.ts
|
|
12
|
+
import { createContextEx as createContextEx2 } from "@xyo-network/react-shared";
|
|
13
|
+
var PayloadDivinerContext = createContextEx2();
|
|
14
|
+
|
|
15
|
+
// src/contexts/PayloadDiviner/Provider.tsx
|
|
16
|
+
import { useEffect, useState } from "react";
|
|
17
|
+
import { jsx } from "react/jsx-runtime";
|
|
18
|
+
var PayloadDivinerProvider = ({ diviner: divinerProp, required = false, children }) => {
|
|
19
|
+
const [diviner, setDiviner] = useState(divinerProp);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (divinerProp) {
|
|
22
|
+
setDiviner(divinerProp);
|
|
23
|
+
}
|
|
24
|
+
}, [divinerProp]);
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
PayloadDivinerContext.Provider,
|
|
27
|
+
{
|
|
28
|
+
value: {
|
|
29
|
+
diviner: diviner === divinerProp ? diviner : void 0,
|
|
30
|
+
provided: true,
|
|
31
|
+
setDiviner
|
|
32
|
+
},
|
|
33
|
+
children: diviner ? children : required ? null : children
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/contexts/PayloadDiviner/use.ts
|
|
39
|
+
import { compact } from "@xylabs/lodash";
|
|
40
|
+
import { useAsyncEffect } from "@xylabs/react-async-effect";
|
|
41
|
+
import { HuriSchema } from "@xyo-network/diviner";
|
|
42
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
|
43
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
44
|
+
var usePayloadDiviner = (required = false) => {
|
|
45
|
+
return useContextEx(PayloadDivinerContext, "PayloadDiviner", required);
|
|
46
|
+
};
|
|
47
|
+
var useDivinePayload = (huri) => {
|
|
48
|
+
const { diviner } = usePayloadDiviner();
|
|
49
|
+
const [payload, setPayload] = useState2();
|
|
50
|
+
const [error, setError] = useState2();
|
|
51
|
+
useEffect2(() => {
|
|
52
|
+
if (diviner) {
|
|
53
|
+
setPayload(void 0);
|
|
54
|
+
}
|
|
55
|
+
}, [diviner]);
|
|
56
|
+
useAsyncEffect(
|
|
57
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
+
async (mounted) => {
|
|
59
|
+
if (huri && diviner && payload === void 0) {
|
|
60
|
+
try {
|
|
61
|
+
const huriPayload = { huri: [huri], schema: HuriSchema };
|
|
62
|
+
const [payload2] = await diviner?.divine([huriPayload]) ?? [];
|
|
63
|
+
if (mounted()) {
|
|
64
|
+
setPayload(payload2 ? payload2 : null);
|
|
65
|
+
}
|
|
66
|
+
} catch (ex) {
|
|
67
|
+
if (mounted()) {
|
|
68
|
+
setError(ex);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
[diviner, huri, payload]
|
|
74
|
+
);
|
|
75
|
+
return [payload, setPayload, error];
|
|
76
|
+
};
|
|
77
|
+
var useDivinePayloads = (huriList) => {
|
|
78
|
+
const { diviner } = usePayloadDiviner();
|
|
79
|
+
const [payloads, setPayloads] = useState2();
|
|
80
|
+
const [errors, setErrors] = useState2();
|
|
81
|
+
useEffect2(() => {
|
|
82
|
+
if (diviner) {
|
|
83
|
+
setPayloads(void 0);
|
|
84
|
+
}
|
|
85
|
+
}, [diviner]);
|
|
86
|
+
useAsyncEffect(
|
|
87
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
88
|
+
async (mounted) => {
|
|
89
|
+
console.log(`huriList: ${JSON.stringify(huriList, null, 2)}`);
|
|
90
|
+
const payloads2 = await Promise.allSettled(
|
|
91
|
+
huriList.map(async (huri) => {
|
|
92
|
+
const huriPayload = { huri: [huri], schema: HuriSchema };
|
|
93
|
+
const [payload] = await diviner?.divine([huriPayload]) ?? [];
|
|
94
|
+
return payload;
|
|
95
|
+
})
|
|
96
|
+
);
|
|
97
|
+
if (mounted()) {
|
|
98
|
+
setPayloads([...payloads2.values()].map((value) => value.status === "rejected" ? null : value.value));
|
|
99
|
+
setErrors(
|
|
100
|
+
compact([...payloads2.values()].map((value) => value.status === "rejected" ? Error("divine failed", { cause: value.reason }) : void 0))
|
|
101
|
+
);
|
|
102
|
+
if (mounted()) {
|
|
103
|
+
setPayloads([...payloads2.values()].map((value) => value.status === "rejected" ? null : value.value));
|
|
104
|
+
setErrors(
|
|
105
|
+
compact(
|
|
106
|
+
[...payloads2.values()].map((value) => value.status === "rejected" ? Error("divine failed", { cause: value.reason }) : void 0)
|
|
107
|
+
)
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
[diviner, huriList, payloads]
|
|
113
|
+
);
|
|
114
|
+
return [payloads, setPayloads, errors];
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// src/contexts/DivinedPayload/use.ts
|
|
118
|
+
import { useContextEx as useContextEx2 } from "@xyo-network/react-shared";
|
|
119
|
+
var useDivinedPayload = () => useContextEx2(DivinedPayloadContext, "DivinedPayload", true);
|
|
120
|
+
|
|
121
|
+
// src/contexts/DivinedPayload/Provider.tsx
|
|
122
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
123
|
+
var DivinedPayloadProvider = ({ children, hash }) => {
|
|
124
|
+
const { hash: hashParam } = useParams();
|
|
125
|
+
const huriFromHashParam = useBuildHuri(hashParam);
|
|
126
|
+
const [params] = useSearchParams();
|
|
127
|
+
const huriSearchParameter = params.get("huri");
|
|
128
|
+
const decodedHuriParam = decodeURIComponent(huriSearchParameter ?? "");
|
|
129
|
+
const huriUri = hash ?? (decodedHuriParam ? decodedHuriParam : huriFromHashParam);
|
|
130
|
+
const [payload, setPayload, payloadError] = useDivinePayload(huriUri);
|
|
131
|
+
return /* @__PURE__ */ jsx2(DivinedPayloadContext.Provider, { value: { payload, payloadError, provided: true, setPayload }, children });
|
|
132
|
+
};
|
|
133
|
+
var DivinedPayloadWithHandleInner = ({ children }) => {
|
|
134
|
+
const { payloadError } = useDivinedPayload();
|
|
135
|
+
return /* @__PURE__ */ jsx2(
|
|
136
|
+
ErrorRender,
|
|
137
|
+
{
|
|
138
|
+
error: payloadError ? { message: payloadError.message, schema: ModuleErrorSchema, sources: [] } : void 0,
|
|
139
|
+
errorContext: "Divined Payload Provider",
|
|
140
|
+
children
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
var DivinedPayloadWithHandleProvider = ({ children, ...props }) => {
|
|
145
|
+
return /* @__PURE__ */ jsx2(DivinedPayloadProvider, { ...props, children: /* @__PURE__ */ jsx2(DivinedPayloadWithHandleInner, { children }) });
|
|
146
|
+
};
|
|
147
|
+
export {
|
|
148
|
+
DivinedPayloadContext,
|
|
149
|
+
DivinedPayloadProvider,
|
|
150
|
+
DivinedPayloadWithHandleInner,
|
|
151
|
+
DivinedPayloadWithHandleProvider,
|
|
152
|
+
PayloadDivinerContext,
|
|
153
|
+
PayloadDivinerProvider,
|
|
154
|
+
useDivinePayload,
|
|
155
|
+
useDivinePayloads,
|
|
156
|
+
useDivinedPayload,
|
|
157
|
+
usePayloadDiviner
|
|
158
|
+
};
|
|
2
159
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './contexts'\n"],"mappings":"AAAA,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/contexts/DivinedPayload/Context.tsx","../../src/contexts/DivinedPayload/Provider.tsx","../../src/contexts/PayloadDiviner/Context.ts","../../src/contexts/PayloadDiviner/Provider.tsx","../../src/contexts/PayloadDiviner/use.ts","../../src/contexts/DivinedPayload/use.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport { DivinedPayloadState } from './State'\n\nexport const DivinedPayloadContext = createContextEx<DivinedPayloadState>()\n","import type { WithChildren } from '@xylabs/react-shared'\nimport { ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { ErrorRender } from '@xyo-network/react-error'\nimport { useBuildHuri } from '@xyo-network/react-payload-huri'\nimport { useParams, useSearchParams } from 'react-router-dom'\n\nimport { useDivinePayload } from '../PayloadDiviner'\nimport { DivinedPayloadContext } from './Context'\nimport { useDivinedPayload } from './use'\n\nexport interface DivinedPayloadProviderProps extends WithChildren {\n hash?: string\n}\n\nexport const DivinedPayloadProvider: React.FC<DivinedPayloadProviderProps> = ({ children, hash }) => {\n const { hash: hashParam } = useParams()\n\n const huriFromHashParam = useBuildHuri(hashParam)\n\n const [params] = useSearchParams()\n const huriSearchParameter = params.get('huri')\n const decodedHuriParam = decodeURIComponent(huriSearchParameter ?? '')\n const huriUri = hash ?? (decodedHuriParam ? decodedHuriParam : huriFromHashParam)\n\n const [payload, setPayload, payloadError] = useDivinePayload(huriUri)\n\n return <DivinedPayloadContext.Provider value={{ payload, payloadError, provided: true, setPayload }}>{children}</DivinedPayloadContext.Provider>\n}\n\nexport const DivinedPayloadWithHandleInner: React.FC<WithChildren> = ({ children }) => {\n const { payloadError } = useDivinedPayload()\n\n return (\n <ErrorRender\n error={payloadError ? { message: payloadError.message, schema: ModuleErrorSchema, sources: [] } : undefined}\n errorContext=\"Divined Payload Provider\"\n >\n {children}\n </ErrorRender>\n )\n}\n\nexport const DivinedPayloadWithHandleProvider: React.FC<DivinedPayloadProviderProps> = ({ children, ...props }) => {\n return (\n <DivinedPayloadProvider {...props}>\n <DivinedPayloadWithHandleInner>{children}</DivinedPayloadWithHandleInner>\n </DivinedPayloadProvider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { PayloadDivinerState } from './State'\n\nconst PayloadDivinerContext = createContextEx<PayloadDivinerState>()\n\nexport { PayloadDivinerContext }\n","import { AbstractPayloadDiviner } from '@xyo-network/diviner'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context'\n\nexport type PayloadDivinerProviderProps = ContextExProviderProps<{\n /** Required */\n diviner?: AbstractPayloadDiviner\n}>\n\nexport const PayloadDivinerProvider: React.FC<PayloadDivinerProviderProps> = ({ diviner: divinerProp, required = false, children }) => {\n const [diviner, setDiviner] = useState<AbstractPayloadDiviner | undefined>(divinerProp)\n\n useEffect(() => {\n if (divinerProp) {\n setDiviner(divinerProp)\n }\n }, [divinerProp])\n\n return (\n <PayloadDivinerContext.Provider\n value={{\n diviner: diviner === divinerProp ? diviner : undefined,\n provided: true,\n setDiviner,\n }}\n >\n {diviner ? children : required ? null : children}\n </PayloadDivinerContext.Provider>\n )\n}\n","import { compact } from '@xylabs/lodash'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { HuriPayload, HuriSchema } from '@xyo-network/diviner'\nimport { Payload } from '@xyo-network/payload-model'\nimport { useContextEx } from '@xyo-network/react-shared'\nimport { Dispatch, useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context'\n\nexport const usePayloadDiviner = (required = false) => {\n return useContextEx(PayloadDivinerContext, 'PayloadDiviner', required)\n}\n\nexport const useDivinePayload = <T extends Payload = Payload>(\n huri?: string,\n): [T | undefined | null, Dispatch<T | null | undefined>, Error | undefined] => {\n const { diviner } = usePayloadDiviner()\n const [payload, setPayload] = useState<T | null>()\n const [error, setError] = useState<Error>()\n\n useEffect(() => {\n if (diviner) {\n setPayload(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (huri && diviner && payload === undefined) {\n try {\n const huriPayload: HuriPayload = { huri: [huri], schema: HuriSchema }\n const [payload] = (await diviner?.divine([huriPayload])) ?? []\n if (mounted()) {\n setPayload(payload ? (payload as T) : null)\n }\n } catch (ex) {\n if (mounted()) {\n setError(ex as Error)\n }\n }\n }\n },\n [diviner, huri, payload],\n )\n\n return [payload, setPayload, error]\n}\n\nexport const useDivinePayloads = <T extends Payload = Payload>(\n huriList: string[],\n): [(T | null)[] | undefined, Dispatch<(T | null)[] | undefined>, Error[] | undefined] => {\n const { diviner } = usePayloadDiviner()\n const [payloads, setPayloads] = useState<(T | null)[]>()\n const [errors, setErrors] = useState<Error[]>()\n\n useEffect(() => {\n if (diviner) {\n setPayloads(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n console.log(`huriList: ${JSON.stringify(huriList, null, 2)}`)\n const payloads = await Promise.allSettled(\n huriList.map(async (huri) => {\n const huriPayload: HuriPayload = { huri: [huri], schema: HuriSchema }\n const [payload] = (await diviner?.divine([huriPayload])) ?? []\n return payload\n }),\n )\n if (mounted()) {\n setPayloads([...payloads.values()].map((value) => (value.status === 'rejected' ? null : value.value)) as (T | null)[])\n setErrors(\n compact([...payloads.values()].map((value) => (value.status === 'rejected' ? Error('divine failed', { cause: value.reason }) : undefined))),\n )\n if (mounted()) {\n setPayloads([...payloads.values()].map((value) => (value.status === 'rejected' ? null : value.value)) as (T | null)[])\n setErrors(\n compact(\n [...payloads.values()].map((value) => (value.status === 'rejected' ? Error('divine failed', { cause: value.reason }) : undefined)),\n ),\n )\n }\n }\n },\n [diviner, huriList, payloads],\n )\n\n return [payloads, setPayloads, errors]\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { DivinedPayloadContext } from './Context'\n\nexport const useDivinedPayload = () => useContextEx(DivinedPayloadContext, 'DivinedPayload', true)\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,wBAAwB,gBAAqC;;;ACH1E,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,WAAW,uBAAuB;;;ACJ3C,SAAS,mBAAAA,wBAAuB;AAIhC,IAAM,wBAAwBA,iBAAqC;;;ACFnE,SAAS,WAAW,gBAAgB;AAmBhC;AAVG,IAAM,yBAAgE,CAAC,EAAE,SAAS,aAAa,WAAW,OAAO,SAAS,MAAM;AACrI,QAAM,CAAC,SAAS,UAAU,IAAI,SAA6C,WAAW;AAEtF,YAAU,MAAM;AACd,QAAI,aAAa;AACf,iBAAW,WAAW;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,WAAW,CAAC;AAEhB,SACE;AAAA,IAAC,sBAAsB;AAAA,IAAtB;AAAA,MACC,OAAO;AAAA,QACL,SAAS,YAAY,cAAc,UAAU;AAAA,QAC7C,UAAU;AAAA,QACV;AAAA,MACF;AAAA,MAEC,oBAAU,WAAW,WAAW,OAAO;AAAA;AAAA,E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AkB,IAAI;;;AJsBxF,gBAAAC,YAAA;AAZF,IAAM,yBAAgE,CAAC,EAAE,UAAU,KAAK,MAAM;AACnG,QAAM,EAAE,MAAM,UAAU,IAAI,UAAU;AAEtC,QAAM,oBAAoB,aAAa,SAAS;AAEhD,QAAM,CAAC,MAAM,IAAI,gBAAgB;AACjC,QAAM,sBAAsB,OAAO,IAAI,MAAM;AAC7C,QAAM,mBAAmB,mBAAmB,uBAAuB,EAAE;AACrE,QAAM,UAAU,SAAS,mBAAmB,mBAAmB;AAE/D,QAAM,CAAC,SAAS,YAAY,YAAY,IAAI,iBAAiB,OAAO;AAEpE,SAAO,gBAAAA,KAAC,sBAAsB,UAAtB,EAA+B,OAAO,EAAE,SAAS,cAAc,UAAU,MAAM,WAAW,GAAI,UAAS;AACjH;AAEO,IAAM,gCAAwD,CAAC,EAAE,SAAS,MAAM;AACrF,QAAM,EAAE,aAAa,IAAI,kBAAkB;AAE3C,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,eAAe,EAAE,SAAS,aAAa,SAAS,QAAQ,mBAAmB,SAAS,CAAC,EAAE,IAAI;AAAA,MAClG,cAAa;AAAA,MAEZ;AAAA;AAAA,EACH;AAEJ;AAEO,IAAM,mCAA0E,CAAC,EAAE,UAAU,GAAG,MAAM,MAAM;AACjH,SACE,gBAAAA,KAAC,0BAAwB,GAAG,OAC1B,0BAAAA,KAAC,iCAA+B,UAAS,GAC3C;AAEJ;","names":["createContextEx","useEffect","useState","useState","useEffect","payload","payloads","useContextEx","useContextEx","jsx"]}
|
package/dist/docs.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/Provider.tsx",
|
|
26
26
|
"line": 12,
|
|
27
27
|
"character": 2,
|
|
28
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
28
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/Provider.tsx#L12"
|
|
29
29
|
}
|
|
30
30
|
],
|
|
31
31
|
"type": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/Provider.tsx",
|
|
48
48
|
"line": 11,
|
|
49
49
|
"character": 17,
|
|
50
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
50
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/Provider.tsx#L11"
|
|
51
51
|
}
|
|
52
52
|
],
|
|
53
53
|
"extendedTypes": [
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/State.ts",
|
|
83
83
|
"line": 6,
|
|
84
84
|
"character": 2,
|
|
85
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
85
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/State.ts#L6"
|
|
86
86
|
}
|
|
87
87
|
],
|
|
88
88
|
"type": {
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/State.ts",
|
|
140
140
|
"line": 7,
|
|
141
141
|
"character": 2,
|
|
142
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
142
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/State.ts#L7"
|
|
143
143
|
}
|
|
144
144
|
],
|
|
145
145
|
"type": {
|
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/State.ts",
|
|
189
189
|
"line": 8,
|
|
190
190
|
"character": 2,
|
|
191
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
191
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/State.ts#L8"
|
|
192
192
|
}
|
|
193
193
|
],
|
|
194
194
|
"type": {
|
|
@@ -265,7 +265,7 @@
|
|
|
265
265
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/State.ts",
|
|
266
266
|
"line": 5,
|
|
267
267
|
"character": 17,
|
|
268
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
268
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/State.ts#L5"
|
|
269
269
|
}
|
|
270
270
|
],
|
|
271
271
|
"extendedTypes": [
|
|
@@ -300,7 +300,7 @@
|
|
|
300
300
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/State.ts",
|
|
301
301
|
"line": 5,
|
|
302
302
|
"character": 2,
|
|
303
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
303
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/State.ts#L5"
|
|
304
304
|
}
|
|
305
305
|
],
|
|
306
306
|
"type": {
|
|
@@ -359,7 +359,7 @@
|
|
|
359
359
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/State.ts",
|
|
360
360
|
"line": 6,
|
|
361
361
|
"character": 2,
|
|
362
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
362
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/State.ts#L6"
|
|
363
363
|
}
|
|
364
364
|
],
|
|
365
365
|
"type": {
|
|
@@ -432,7 +432,7 @@
|
|
|
432
432
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/State.ts",
|
|
433
433
|
"line": 4,
|
|
434
434
|
"character": 17,
|
|
435
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
435
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/State.ts#L4"
|
|
436
436
|
}
|
|
437
437
|
]
|
|
438
438
|
},
|
|
@@ -447,7 +447,7 @@
|
|
|
447
447
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/Provider.tsx",
|
|
448
448
|
"line": 7,
|
|
449
449
|
"character": 12,
|
|
450
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
450
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/Provider.tsx#L7"
|
|
451
451
|
}
|
|
452
452
|
],
|
|
453
453
|
"type": {
|
|
@@ -487,7 +487,7 @@
|
|
|
487
487
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/Provider.tsx",
|
|
488
488
|
"line": 9,
|
|
489
489
|
"character": 2,
|
|
490
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
490
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/Provider.tsx#L9"
|
|
491
491
|
}
|
|
492
492
|
],
|
|
493
493
|
"type": {
|
|
@@ -514,7 +514,7 @@
|
|
|
514
514
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/Provider.tsx",
|
|
515
515
|
"line": 7,
|
|
516
516
|
"character": 65,
|
|
517
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
517
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/Provider.tsx#L7"
|
|
518
518
|
}
|
|
519
519
|
]
|
|
520
520
|
}
|
|
@@ -537,7 +537,7 @@
|
|
|
537
537
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/Context.tsx",
|
|
538
538
|
"line": 5,
|
|
539
539
|
"character": 13,
|
|
540
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
540
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/Context.tsx#L5"
|
|
541
541
|
}
|
|
542
542
|
],
|
|
543
543
|
"type": {
|
|
@@ -587,7 +587,7 @@
|
|
|
587
587
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/Context.ts",
|
|
588
588
|
"line": 5,
|
|
589
589
|
"character": 6,
|
|
590
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
590
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/Context.ts#L5"
|
|
591
591
|
}
|
|
592
592
|
],
|
|
593
593
|
"type": {
|
|
@@ -635,7 +635,7 @@
|
|
|
635
635
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/Provider.tsx",
|
|
636
636
|
"line": 15,
|
|
637
637
|
"character": 13,
|
|
638
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
638
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/Provider.tsx#L15"
|
|
639
639
|
}
|
|
640
640
|
],
|
|
641
641
|
"signatures": [
|
|
@@ -723,7 +723,7 @@
|
|
|
723
723
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/Provider.tsx",
|
|
724
724
|
"line": 30,
|
|
725
725
|
"character": 13,
|
|
726
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
726
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/Provider.tsx#L30"
|
|
727
727
|
}
|
|
728
728
|
],
|
|
729
729
|
"signatures": [
|
|
@@ -820,7 +820,7 @@
|
|
|
820
820
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/Provider.tsx",
|
|
821
821
|
"line": 43,
|
|
822
822
|
"character": 13,
|
|
823
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
823
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/Provider.tsx#L43"
|
|
824
824
|
}
|
|
825
825
|
],
|
|
826
826
|
"signatures": [
|
|
@@ -908,7 +908,7 @@
|
|
|
908
908
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/Provider.tsx",
|
|
909
909
|
"line": 12,
|
|
910
910
|
"character": 13,
|
|
911
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
911
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/Provider.tsx#L12"
|
|
912
912
|
}
|
|
913
913
|
],
|
|
914
914
|
"signatures": [
|
|
@@ -996,7 +996,7 @@
|
|
|
996
996
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/use.ts",
|
|
997
997
|
"line": 14,
|
|
998
998
|
"character": 13,
|
|
999
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
999
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/use.ts#L14"
|
|
1000
1000
|
}
|
|
1001
1001
|
],
|
|
1002
1002
|
"signatures": [
|
|
@@ -1011,7 +1011,7 @@
|
|
|
1011
1011
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/use.ts",
|
|
1012
1012
|
"line": 14,
|
|
1013
1013
|
"character": 32,
|
|
1014
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
1014
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/use.ts#L14"
|
|
1015
1015
|
}
|
|
1016
1016
|
],
|
|
1017
1017
|
"typeParameter": [
|
|
@@ -1187,7 +1187,7 @@
|
|
|
1187
1187
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/use.ts",
|
|
1188
1188
|
"line": 50,
|
|
1189
1189
|
"character": 13,
|
|
1190
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
1190
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/use.ts#L50"
|
|
1191
1191
|
}
|
|
1192
1192
|
],
|
|
1193
1193
|
"signatures": [
|
|
@@ -1202,7 +1202,7 @@
|
|
|
1202
1202
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/use.ts",
|
|
1203
1203
|
"line": 50,
|
|
1204
1204
|
"character": 33,
|
|
1205
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
1205
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/use.ts#L50"
|
|
1206
1206
|
}
|
|
1207
1207
|
],
|
|
1208
1208
|
"typeParameter": [
|
|
@@ -1398,7 +1398,7 @@
|
|
|
1398
1398
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/use.ts",
|
|
1399
1399
|
"line": 5,
|
|
1400
1400
|
"character": 13,
|
|
1401
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
1401
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/use.ts#L5"
|
|
1402
1402
|
}
|
|
1403
1403
|
],
|
|
1404
1404
|
"signatures": [
|
|
@@ -1413,7 +1413,7 @@
|
|
|
1413
1413
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/use.ts",
|
|
1414
1414
|
"line": 5,
|
|
1415
1415
|
"character": 33,
|
|
1416
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
1416
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/DivinedPayload/use.ts#L5"
|
|
1417
1417
|
}
|
|
1418
1418
|
],
|
|
1419
1419
|
"type": {
|
|
@@ -1465,7 +1465,7 @@
|
|
|
1465
1465
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/use.ts",
|
|
1466
1466
|
"line": 10,
|
|
1467
1467
|
"character": 13,
|
|
1468
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
1468
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/use.ts#L10"
|
|
1469
1469
|
}
|
|
1470
1470
|
],
|
|
1471
1471
|
"signatures": [
|
|
@@ -1480,7 +1480,7 @@
|
|
|
1480
1480
|
"fileName": "packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/use.ts",
|
|
1481
1481
|
"line": 10,
|
|
1482
1482
|
"character": 33,
|
|
1483
|
-
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/
|
|
1483
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/blob/ace39d815/packages/sdk/packages/payload/packages/diviner/src/contexts/PayloadDiviner/use.ts#L10"
|
|
1484
1484
|
}
|
|
1485
1485
|
],
|
|
1486
1486
|
"parameters": [
|
package/package.json
CHANGED
|
@@ -10,17 +10,17 @@
|
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xylabs/lodash": "^2.12.
|
|
14
|
-
"@xylabs/react-async-effect": "^3.0.
|
|
15
|
-
"@xylabs/react-shared": "^3.0.
|
|
16
|
-
"@xyo-network/diviner": "^2.75.
|
|
17
|
-
"@xyo-network/payload-model": "^2.75.
|
|
18
|
-
"@xyo-network/react-error": "~2.64.
|
|
19
|
-
"@xyo-network/react-payload-huri": "~2.64.
|
|
20
|
-
"@xyo-network/react-shared": "~2.64.
|
|
13
|
+
"@xylabs/lodash": "^2.12.14",
|
|
14
|
+
"@xylabs/react-async-effect": "^3.0.6",
|
|
15
|
+
"@xylabs/react-shared": "^3.0.6",
|
|
16
|
+
"@xyo-network/diviner": "^2.75.4",
|
|
17
|
+
"@xyo-network/payload-model": "^2.75.4",
|
|
18
|
+
"@xyo-network/react-error": "~2.64.1",
|
|
19
|
+
"@xyo-network/react-payload-huri": "~2.64.1",
|
|
20
|
+
"@xyo-network/react-shared": "~2.64.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@xylabs/ts-scripts-yarn3": "^3.0.
|
|
23
|
+
"@xylabs/ts-scripts-yarn3": "^3.0.79",
|
|
24
24
|
"typescript": "^5.2.2"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
@@ -83,6 +83,6 @@
|
|
|
83
83
|
},
|
|
84
84
|
"sideEffects": false,
|
|
85
85
|
"types": "dist/browser/index.d.ts",
|
|
86
|
-
"version": "2.64.
|
|
86
|
+
"version": "2.64.1",
|
|
87
87
|
"type": "module"
|
|
88
88
|
}
|