@xyo-network/react-payload-diviner 2.81.10 → 2.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/contexts/DivinedPayload/Context.d.cts +1 -1
- package/dist/browser/contexts/DivinedPayload/Context.d.cts.map +1 -1
- package/dist/browser/contexts/DivinedPayload/Context.d.mts +1 -1
- package/dist/browser/contexts/DivinedPayload/Context.d.mts.map +1 -1
- package/dist/browser/contexts/DivinedPayload/Context.d.ts +1 -1
- package/dist/browser/contexts/DivinedPayload/Context.d.ts.map +1 -1
- package/dist/browser/contexts/DivinedPayload/Provider.d.cts +1 -0
- package/dist/browser/contexts/DivinedPayload/Provider.d.cts.map +1 -1
- package/dist/browser/contexts/DivinedPayload/Provider.d.mts +1 -0
- package/dist/browser/contexts/DivinedPayload/Provider.d.mts.map +1 -1
- package/dist/browser/contexts/DivinedPayload/Provider.d.ts +1 -0
- package/dist/browser/contexts/DivinedPayload/Provider.d.ts.map +1 -1
- package/dist/browser/contexts/DivinedPayload/index.d.cts +4 -4
- package/dist/browser/contexts/DivinedPayload/index.d.cts.map +1 -1
- package/dist/browser/contexts/DivinedPayload/index.d.mts +4 -4
- package/dist/browser/contexts/DivinedPayload/index.d.mts.map +1 -1
- package/dist/browser/contexts/DivinedPayload/index.d.ts +4 -4
- package/dist/browser/contexts/DivinedPayload/index.d.ts.map +1 -1
- package/dist/browser/contexts/DivinedPayload/use.d.cts +1 -1
- package/dist/browser/contexts/DivinedPayload/use.d.mts +1 -1
- package/dist/browser/contexts/DivinedPayload/use.d.ts +1 -1
- package/dist/browser/contexts/PayloadDiviner/Context.d.cts +1 -1
- package/dist/browser/contexts/PayloadDiviner/Context.d.mts +1 -1
- package/dist/browser/contexts/PayloadDiviner/Context.d.ts +1 -1
- package/dist/browser/contexts/PayloadDiviner/Provider.d.cts +1 -0
- package/dist/browser/contexts/PayloadDiviner/Provider.d.cts.map +1 -1
- package/dist/browser/contexts/PayloadDiviner/Provider.d.mts +1 -0
- package/dist/browser/contexts/PayloadDiviner/Provider.d.mts.map +1 -1
- package/dist/browser/contexts/PayloadDiviner/Provider.d.ts +1 -0
- package/dist/browser/contexts/PayloadDiviner/Provider.d.ts.map +1 -1
- package/dist/browser/contexts/PayloadDiviner/index.d.cts +4 -4
- package/dist/browser/contexts/PayloadDiviner/index.d.cts.map +1 -1
- package/dist/browser/contexts/PayloadDiviner/index.d.mts +4 -4
- package/dist/browser/contexts/PayloadDiviner/index.d.mts.map +1 -1
- package/dist/browser/contexts/PayloadDiviner/index.d.ts +4 -4
- package/dist/browser/contexts/PayloadDiviner/index.d.ts.map +1 -1
- package/dist/browser/contexts/PayloadDiviner/use.d.cts +1 -1
- package/dist/browser/contexts/PayloadDiviner/use.d.cts.map +1 -1
- package/dist/browser/contexts/PayloadDiviner/use.d.mts +1 -1
- package/dist/browser/contexts/PayloadDiviner/use.d.mts.map +1 -1
- package/dist/browser/contexts/PayloadDiviner/use.d.ts +1 -1
- package/dist/browser/contexts/PayloadDiviner/use.d.ts.map +1 -1
- package/dist/browser/contexts/index.d.cts +2 -2
- package/dist/browser/contexts/index.d.mts +2 -2
- package/dist/browser/contexts/index.d.ts +2 -2
- package/dist/browser/index.cjs +138 -90
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.d.cts +1 -1
- package/dist/browser/index.d.mts +1 -1
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/index.mjs +201 -0
- package/dist/browser/index.mjs.map +1 -0
- package/dist/neutral/contexts/DivinedPayload/Context.d.cts +1 -1
- package/dist/neutral/contexts/DivinedPayload/Context.d.cts.map +1 -1
- package/dist/neutral/contexts/DivinedPayload/Context.d.mts +1 -1
- package/dist/neutral/contexts/DivinedPayload/Context.d.mts.map +1 -1
- package/dist/neutral/contexts/DivinedPayload/Context.d.ts +1 -1
- package/dist/neutral/contexts/DivinedPayload/Context.d.ts.map +1 -1
- package/dist/neutral/contexts/DivinedPayload/Provider.d.cts +1 -0
- package/dist/neutral/contexts/DivinedPayload/Provider.d.cts.map +1 -1
- package/dist/neutral/contexts/DivinedPayload/Provider.d.mts +1 -0
- package/dist/neutral/contexts/DivinedPayload/Provider.d.mts.map +1 -1
- package/dist/neutral/contexts/DivinedPayload/Provider.d.ts +1 -0
- package/dist/neutral/contexts/DivinedPayload/Provider.d.ts.map +1 -1
- package/dist/neutral/contexts/DivinedPayload/index.d.cts +4 -4
- package/dist/neutral/contexts/DivinedPayload/index.d.cts.map +1 -1
- package/dist/neutral/contexts/DivinedPayload/index.d.mts +4 -4
- package/dist/neutral/contexts/DivinedPayload/index.d.mts.map +1 -1
- package/dist/neutral/contexts/DivinedPayload/index.d.ts +4 -4
- package/dist/neutral/contexts/DivinedPayload/index.d.ts.map +1 -1
- package/dist/neutral/contexts/DivinedPayload/use.d.cts +1 -1
- package/dist/neutral/contexts/DivinedPayload/use.d.mts +1 -1
- package/dist/neutral/contexts/DivinedPayload/use.d.ts +1 -1
- package/dist/neutral/contexts/PayloadDiviner/Context.d.cts +1 -1
- package/dist/neutral/contexts/PayloadDiviner/Context.d.mts +1 -1
- package/dist/neutral/contexts/PayloadDiviner/Context.d.ts +1 -1
- package/dist/neutral/contexts/PayloadDiviner/Provider.d.cts +1 -0
- package/dist/neutral/contexts/PayloadDiviner/Provider.d.cts.map +1 -1
- package/dist/neutral/contexts/PayloadDiviner/Provider.d.mts +1 -0
- package/dist/neutral/contexts/PayloadDiviner/Provider.d.mts.map +1 -1
- package/dist/neutral/contexts/PayloadDiviner/Provider.d.ts +1 -0
- package/dist/neutral/contexts/PayloadDiviner/Provider.d.ts.map +1 -1
- package/dist/neutral/contexts/PayloadDiviner/index.d.cts +4 -4
- package/dist/neutral/contexts/PayloadDiviner/index.d.cts.map +1 -1
- package/dist/neutral/contexts/PayloadDiviner/index.d.mts +4 -4
- package/dist/neutral/contexts/PayloadDiviner/index.d.mts.map +1 -1
- package/dist/neutral/contexts/PayloadDiviner/index.d.ts +4 -4
- package/dist/neutral/contexts/PayloadDiviner/index.d.ts.map +1 -1
- package/dist/neutral/contexts/PayloadDiviner/use.d.cts +1 -1
- package/dist/neutral/contexts/PayloadDiviner/use.d.cts.map +1 -1
- package/dist/neutral/contexts/PayloadDiviner/use.d.mts +1 -1
- package/dist/neutral/contexts/PayloadDiviner/use.d.mts.map +1 -1
- package/dist/neutral/contexts/PayloadDiviner/use.d.ts +1 -1
- package/dist/neutral/contexts/PayloadDiviner/use.d.ts.map +1 -1
- package/dist/neutral/contexts/index.d.cts +2 -2
- package/dist/neutral/contexts/index.d.mts +2 -2
- package/dist/neutral/contexts/index.d.ts +2 -2
- package/dist/neutral/index.cjs +138 -90
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.d.cts +1 -1
- package/dist/neutral/index.d.mts +1 -1
- package/dist/neutral/index.d.ts +1 -1
- package/dist/neutral/index.mjs +201 -0
- package/dist/neutral/index.mjs.map +1 -0
- package/dist/node/contexts/DivinedPayload/Context.d.cts +1 -1
- package/dist/node/contexts/DivinedPayload/Context.d.cts.map +1 -1
- package/dist/node/contexts/DivinedPayload/Context.d.mts +1 -1
- package/dist/node/contexts/DivinedPayload/Context.d.mts.map +1 -1
- package/dist/node/contexts/DivinedPayload/Context.d.ts +1 -1
- package/dist/node/contexts/DivinedPayload/Context.d.ts.map +1 -1
- package/dist/node/contexts/DivinedPayload/Provider.d.cts +1 -0
- package/dist/node/contexts/DivinedPayload/Provider.d.cts.map +1 -1
- package/dist/node/contexts/DivinedPayload/Provider.d.mts +1 -0
- package/dist/node/contexts/DivinedPayload/Provider.d.mts.map +1 -1
- package/dist/node/contexts/DivinedPayload/Provider.d.ts +1 -0
- package/dist/node/contexts/DivinedPayload/Provider.d.ts.map +1 -1
- package/dist/node/contexts/DivinedPayload/index.d.cts +4 -4
- package/dist/node/contexts/DivinedPayload/index.d.cts.map +1 -1
- package/dist/node/contexts/DivinedPayload/index.d.mts +4 -4
- package/dist/node/contexts/DivinedPayload/index.d.mts.map +1 -1
- package/dist/node/contexts/DivinedPayload/index.d.ts +4 -4
- package/dist/node/contexts/DivinedPayload/index.d.ts.map +1 -1
- package/dist/node/contexts/DivinedPayload/use.d.cts +1 -1
- package/dist/node/contexts/DivinedPayload/use.d.mts +1 -1
- package/dist/node/contexts/DivinedPayload/use.d.ts +1 -1
- package/dist/node/contexts/PayloadDiviner/Context.d.cts +1 -1
- package/dist/node/contexts/PayloadDiviner/Context.d.mts +1 -1
- package/dist/node/contexts/PayloadDiviner/Context.d.ts +1 -1
- package/dist/node/contexts/PayloadDiviner/Provider.d.cts +1 -0
- package/dist/node/contexts/PayloadDiviner/Provider.d.cts.map +1 -1
- package/dist/node/contexts/PayloadDiviner/Provider.d.mts +1 -0
- package/dist/node/contexts/PayloadDiviner/Provider.d.mts.map +1 -1
- package/dist/node/contexts/PayloadDiviner/Provider.d.ts +1 -0
- package/dist/node/contexts/PayloadDiviner/Provider.d.ts.map +1 -1
- package/dist/node/contexts/PayloadDiviner/index.d.cts +4 -4
- package/dist/node/contexts/PayloadDiviner/index.d.cts.map +1 -1
- package/dist/node/contexts/PayloadDiviner/index.d.mts +4 -4
- package/dist/node/contexts/PayloadDiviner/index.d.mts.map +1 -1
- package/dist/node/contexts/PayloadDiviner/index.d.ts +4 -4
- package/dist/node/contexts/PayloadDiviner/index.d.ts.map +1 -1
- package/dist/node/contexts/PayloadDiviner/use.d.cts +1 -1
- package/dist/node/contexts/PayloadDiviner/use.d.cts.map +1 -1
- package/dist/node/contexts/PayloadDiviner/use.d.mts +1 -1
- package/dist/node/contexts/PayloadDiviner/use.d.mts.map +1 -1
- package/dist/node/contexts/PayloadDiviner/use.d.ts +1 -1
- package/dist/node/contexts/PayloadDiviner/use.d.ts.map +1 -1
- package/dist/node/contexts/index.d.cts +2 -2
- package/dist/node/contexts/index.d.mts +2 -2
- package/dist/node/contexts/index.d.ts +2 -2
- package/dist/node/index.cjs +138 -90
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +1 -1
- package/dist/node/index.d.mts +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.mjs +201 -0
- package/dist/node/index.mjs.map +1 -0
- package/package.json +16 -16
- package/src/contexts/DivinedPayload/{Context.tsx → Context.ts} +1 -1
- package/src/contexts/DivinedPayload/Provider.tsx +5 -3
- package/src/contexts/DivinedPayload/index.ts +4 -4
- package/src/contexts/DivinedPayload/use.ts +1 -1
- package/src/contexts/PayloadDiviner/Context.ts +1 -1
- package/src/contexts/PayloadDiviner/Provider.tsx +10 -12
- package/src/contexts/PayloadDiviner/index.ts +4 -4
- package/src/contexts/PayloadDiviner/use.ts +5 -7
- package/src/contexts/index.ts +2 -2
- package/src/index.ts +1 -1
- package/dist/browser/index.js +0 -161
- package/dist/browser/index.js.map +0 -1
- package/dist/neutral/index.js +0 -161
- package/dist/neutral/index.js.map +0 -1
- package/dist/node/index.js +0 -161
- package/dist/node/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../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":["export * from './contexts/index.js'\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { DivinedPayloadState } from './State.js'\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/index.js'\nimport { DivinedPayloadContext } from './Context.js'\nimport { useDivinedPayload } from './use.js'\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 ?? 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.js'\n\nconst PayloadDivinerContext = createContextEx<PayloadDivinerState>()\n\nexport { PayloadDivinerContext }\n","import { PayloadDiviner } from '@xyo-network/diviner-payload-abstract'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context.js'\n\nexport type PayloadDivinerProviderProps = ContextExProviderProps<{\n /** Required */\n diviner?: PayloadDiviner\n}>\n\nexport const PayloadDivinerProvider: React.FC<PayloadDivinerProviderProps> = ({ diviner: divinerProp, required = false, children }) => {\n const [diviner, setDiviner] = useState<PayloadDiviner | 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 ?\n children\n : required ?\n null\n : 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-huri'\nimport { Payload, WithMeta } from '@xyo-network/payload-model'\nimport { useContextEx } from '@xyo-network/react-shared'\nimport { Dispatch, useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context.js'\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 WithMeta<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(\n [...payloads.values()].map((value) => (value.status === 'rejected' ? new Error('divine failed', { cause: value.reason }) : undefined)),\n ),\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' ? new 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.js'\n\nexport const useDivinedPayload = () => useContextEx(DivinedPayloadContext, 'DivinedPayload', true)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,0BAAgC;AAIzB,IAAM,4BAAwB,qCAAqC;;;ACH1E,2BAAkC;AAClC,yBAA4B;AAC5B,gCAA6B;AAC7B,8BAA2C;;;ACJ3C,IAAAA,uBAAgC;AAIhC,IAAM,4BAAwB,sCAAqC;;;ACFnE,mBAAoC;AAmBhC;AAVG,IAAM,yBAAgE,CAAC,EAAE,SAAS,aAAa,WAAW,OAAO,SAAS,MAAM;AACrI,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAqC,WAAW;AAE9E,8BAAU,MAAM;AACd,QAAI,aAAa;AACf,iBAAW,WAAW;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,WAAW,CAAC;AAEhB,SACE;AAAA,IAAC,sBAAsB;AAAA,IAAt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,SAAO,CAAC,UAAU,aAAa,MAAM;AACvC;;;AC9FA,IAAAC,uBAA6B;AAItB,IAAM,oBAAoB,UAAM,mCAAa,uBAAuB,kBAAkB,IAAI;;;AJsBxF,IAAAC,sBAAA;AAZF,IAAM,yBAAgE,CAAC,EAAE,UAAU,KAAK,MAAM;AACnG,QAAM,EAAE,MAAM,UAAU,QAAI,mCAAU;AAEtC,QAAM,wBAAoB,wCAAa,SAAS;AAEhD,QAAM,CAAC,MAAM,QAAI,yCAAgB;AACjC,QAAM,sBAAsB,OAAO,IAAI,MAAM;AAC7C,QAAM,mBAAmB,mBAAmB,uBAAuB,EAAE;AACrE,QAAM,UAAU,QAAQ,oBAAoB;AAE5C,QAAM,CAAC,SAAS,YAAY,YAAY,IAAI,iBAAiB,OAAO;AAEpE,SAAO,6CAAC,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,wCAAmB,SAAS,CAAC,EAAE,IAAI;AAAA,MAClG,cAAa;AAAA,MAEZ;AAAA;AAAA,EACH;AAEJ;AAEO,IAAM,mCAA0E,CAAC,EAAE,UAAU,GAAG,MAAM,MAAM;AACjH,SACE,6CAAC,0BAAwB,GAAG,OAC1B,uDAAC,iCAA+B,UAAS,GAC3C;AAEJ;","names":["import_react_shared","import_react_shared","import_react","payload","payloads","import_react_shared","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/contexts/DivinedPayload/Context.ts","../../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":["export * from './contexts/index.ts'\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { DivinedPayloadState } from './State.ts'\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 React from 'react'\nimport { useParams, useSearchParams } from 'react-router-dom'\n\nimport { useDivinePayload } from '../PayloadDiviner/index.ts'\nimport { DivinedPayloadContext } from './Context.ts'\nimport { useDivinedPayload } from './use.ts'\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 ?? huriFromHashParam\n\n const [payload, setPayload, payloadError] = useDivinePayload(huriUri)\n\n // eslint-disable-next-line @eslint-react/no-unstable-context-value\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.ts'\n\nconst PayloadDivinerContext = createContextEx<PayloadDivinerState>()\n\nexport { PayloadDivinerContext }\n","import { PayloadDiviner } from '@xyo-network/diviner-payload-abstract'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport React, { useEffect, useMemo, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context.ts'\n\nexport type PayloadDivinerProviderProps = ContextExProviderProps<{\n /** Required */\n diviner?: PayloadDiviner\n}>\n\nexport const PayloadDivinerProvider: React.FC<PayloadDivinerProviderProps> = ({ diviner: divinerProp, required = false, children }) => {\n const [diviner, setDiviner] = useState<PayloadDiviner | undefined>(divinerProp)\n\n useEffect(() => {\n if (divinerProp) {\n setDiviner(divinerProp)\n }\n }, [divinerProp])\n\n const value = useMemo(() => ({ diviner: diviner === divinerProp ? diviner : undefined, provided: true, setDiviner }), [diviner, divinerProp, setDiviner])\n\n return (\n <PayloadDivinerContext.Provider\n value={value}\n >\n {diviner\n ? children\n : required\n ? null\n : 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-huri'\nimport { Payload, WithMeta } from '@xyo-network/payload-model'\nimport { useContextEx } from '@xyo-network/react-shared'\nimport { Dispatch, useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context.ts'\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 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 WithMeta<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 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(\n [...payloads.values()].map(value => (value.status === 'rejected' ? new Error('divine failed', { cause: value.reason }) : undefined)),\n ),\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' ? new 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.ts'\n\nexport const useDivinedPayload = () => useContextEx(DivinedPayloadContext, 'DivinedPayload', true)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;ACAA,0BAAgC;AAIzB,IAAM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IC;IAClGC,cAAa;KAEZ/B,QAAAA;AAGP,GAXqE;AAa9D,IAAMgC,mCAA0E,wBAAC,EAAEhC,UAAU,GAAGiC,MAAAA,MAAO;AAC5G,SACE,8BAAAhB,QAAA,cAAClB,wBAA2BkC,OAC1B,8BAAAhB,QAAA,cAACK,+BAAAA,MAA+BtB,QAAAA,CAAAA;AAGtC,GANuF;","names":["DivinedPayloadContext","createContextEx","import_react","import_react_shared","PayloadDivinerContext","createContextEx","PayloadDivinerProvider","diviner","divinerProp","required","children","setDiviner","useState","useEffect","value","useMemo","undefined","provided","React","PayloadDivinerContext","Provider","import_react_shared","import_react","usePayloadDiviner","required","useContextEx","PayloadDivinerContext","useDivinePayload","huri","diviner","payload","setPayload","useState","error","setError","useEffect","undefined","useAsyncEffect","mounted","huriPayload","schema","HuriSchema","divine","ex","useDivinePayloads","huriList","payloads","setPayloads","errors","setErrors","console","log","JSON","stringify","Promise","allSettled","map","values","value","status","compact","Error","cause","reason","import_react_shared","useDivinedPayload","useContextEx","DivinedPayloadContext","DivinedPayloadProvider","children","hash","hashParam","useParams","huriFromHashParam","useBuildHuri","params","useSearchParams","huriSearchParameter","get","decodedHuriParam","decodeURIComponent","huriUri","payload","setPayload","payloadError","useDivinePayload","React","DivinedPayloadContext","Provider","value","provided","DivinedPayloadWithHandleInner","useDivinedPayload","ErrorRender","error","message","schema","ModuleErrorSchema","sources","undefined","errorContext","DivinedPayloadWithHandleProvider","props"]}
|
package/dist/neutral/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './contexts/index.
|
|
1
|
+
export * from './contexts/index.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/neutral/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './contexts/index.
|
|
1
|
+
export * from './contexts/index.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './contexts/index.
|
|
1
|
+
export * from './contexts/index.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/contexts/DivinedPayload/Context.ts
|
|
5
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
|
6
|
+
var DivinedPayloadContext = createContextEx();
|
|
7
|
+
|
|
8
|
+
// src/contexts/DivinedPayload/Provider.tsx
|
|
9
|
+
import { ModuleErrorSchema } from "@xyo-network/payload-model";
|
|
10
|
+
import { ErrorRender } from "@xyo-network/react-error";
|
|
11
|
+
import { useBuildHuri } from "@xyo-network/react-payload-huri";
|
|
12
|
+
import React2 from "react";
|
|
13
|
+
import { useParams, useSearchParams } from "react-router-dom";
|
|
14
|
+
|
|
15
|
+
// src/contexts/PayloadDiviner/Context.ts
|
|
16
|
+
import { createContextEx as createContextEx2 } from "@xyo-network/react-shared";
|
|
17
|
+
var PayloadDivinerContext = createContextEx2();
|
|
18
|
+
|
|
19
|
+
// src/contexts/PayloadDiviner/Provider.tsx
|
|
20
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
21
|
+
var PayloadDivinerProvider = /* @__PURE__ */ __name(({ diviner: divinerProp, required = false, children }) => {
|
|
22
|
+
const [diviner, setDiviner] = useState(divinerProp);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (divinerProp) {
|
|
25
|
+
setDiviner(divinerProp);
|
|
26
|
+
}
|
|
27
|
+
}, [
|
|
28
|
+
divinerProp
|
|
29
|
+
]);
|
|
30
|
+
const value = useMemo(() => ({
|
|
31
|
+
diviner: diviner === divinerProp ? diviner : void 0,
|
|
32
|
+
provided: true,
|
|
33
|
+
setDiviner
|
|
34
|
+
}), [
|
|
35
|
+
diviner,
|
|
36
|
+
divinerProp,
|
|
37
|
+
setDiviner
|
|
38
|
+
]);
|
|
39
|
+
return /* @__PURE__ */ React.createElement(PayloadDivinerContext.Provider, {
|
|
40
|
+
value
|
|
41
|
+
}, diviner ? children : required ? null : children);
|
|
42
|
+
}, "PayloadDivinerProvider");
|
|
43
|
+
|
|
44
|
+
// src/contexts/PayloadDiviner/use.ts
|
|
45
|
+
import { compact } from "@xylabs/lodash";
|
|
46
|
+
import { useAsyncEffect } from "@xylabs/react-async-effect";
|
|
47
|
+
import { HuriSchema } from "@xyo-network/diviner-huri";
|
|
48
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
|
49
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
50
|
+
var usePayloadDiviner = /* @__PURE__ */ __name((required = false) => {
|
|
51
|
+
return useContextEx(PayloadDivinerContext, "PayloadDiviner", required);
|
|
52
|
+
}, "usePayloadDiviner");
|
|
53
|
+
var useDivinePayload = /* @__PURE__ */ __name((huri) => {
|
|
54
|
+
const { diviner } = usePayloadDiviner();
|
|
55
|
+
const [payload, setPayload] = useState2();
|
|
56
|
+
const [error, setError] = useState2();
|
|
57
|
+
useEffect2(() => {
|
|
58
|
+
if (diviner) {
|
|
59
|
+
setPayload(void 0);
|
|
60
|
+
}
|
|
61
|
+
}, [
|
|
62
|
+
diviner
|
|
63
|
+
]);
|
|
64
|
+
useAsyncEffect(async (mounted) => {
|
|
65
|
+
if (huri && diviner && payload === void 0) {
|
|
66
|
+
try {
|
|
67
|
+
const huriPayload = {
|
|
68
|
+
huri: [
|
|
69
|
+
huri
|
|
70
|
+
],
|
|
71
|
+
schema: HuriSchema
|
|
72
|
+
};
|
|
73
|
+
const [payload2] = await diviner?.divine([
|
|
74
|
+
huriPayload
|
|
75
|
+
]) ?? [];
|
|
76
|
+
if (mounted()) {
|
|
77
|
+
setPayload(payload2 ? payload2 : null);
|
|
78
|
+
}
|
|
79
|
+
} catch (ex) {
|
|
80
|
+
if (mounted()) {
|
|
81
|
+
setError(ex);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, [
|
|
86
|
+
diviner,
|
|
87
|
+
huri,
|
|
88
|
+
payload
|
|
89
|
+
]);
|
|
90
|
+
return [
|
|
91
|
+
payload,
|
|
92
|
+
setPayload,
|
|
93
|
+
error
|
|
94
|
+
];
|
|
95
|
+
}, "useDivinePayload");
|
|
96
|
+
var useDivinePayloads = /* @__PURE__ */ __name((huriList) => {
|
|
97
|
+
const { diviner } = usePayloadDiviner();
|
|
98
|
+
const [payloads, setPayloads] = useState2();
|
|
99
|
+
const [errors, setErrors] = useState2();
|
|
100
|
+
useEffect2(() => {
|
|
101
|
+
if (diviner) {
|
|
102
|
+
setPayloads(void 0);
|
|
103
|
+
}
|
|
104
|
+
}, [
|
|
105
|
+
diviner
|
|
106
|
+
]);
|
|
107
|
+
useAsyncEffect(async (mounted) => {
|
|
108
|
+
console.log(`huriList: ${JSON.stringify(huriList, null, 2)}`);
|
|
109
|
+
const payloads2 = await Promise.allSettled(huriList.map(async (huri) => {
|
|
110
|
+
const huriPayload = {
|
|
111
|
+
huri: [
|
|
112
|
+
huri
|
|
113
|
+
],
|
|
114
|
+
schema: HuriSchema
|
|
115
|
+
};
|
|
116
|
+
const [payload] = await diviner?.divine([
|
|
117
|
+
huriPayload
|
|
118
|
+
]) ?? [];
|
|
119
|
+
return payload;
|
|
120
|
+
}));
|
|
121
|
+
if (mounted()) {
|
|
122
|
+
setPayloads([
|
|
123
|
+
...payloads2.values()
|
|
124
|
+
].map((value) => value.status === "rejected" ? null : value.value));
|
|
125
|
+
setErrors(compact([
|
|
126
|
+
...payloads2.values()
|
|
127
|
+
].map((value) => value.status === "rejected" ? new Error("divine failed", {
|
|
128
|
+
cause: value.reason
|
|
129
|
+
}) : void 0)));
|
|
130
|
+
if (mounted()) {
|
|
131
|
+
setPayloads([
|
|
132
|
+
...payloads2.values()
|
|
133
|
+
].map((value) => value.status === "rejected" ? null : value.value));
|
|
134
|
+
setErrors(compact([
|
|
135
|
+
...payloads2.values()
|
|
136
|
+
].map((value) => value.status === "rejected" ? new Error("divine failed", {
|
|
137
|
+
cause: value.reason
|
|
138
|
+
}) : void 0)));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}, [
|
|
142
|
+
diviner,
|
|
143
|
+
huriList,
|
|
144
|
+
payloads
|
|
145
|
+
]);
|
|
146
|
+
return [
|
|
147
|
+
payloads,
|
|
148
|
+
setPayloads,
|
|
149
|
+
errors
|
|
150
|
+
];
|
|
151
|
+
}, "useDivinePayloads");
|
|
152
|
+
|
|
153
|
+
// src/contexts/DivinedPayload/use.ts
|
|
154
|
+
import { useContextEx as useContextEx2 } from "@xyo-network/react-shared";
|
|
155
|
+
var useDivinedPayload = /* @__PURE__ */ __name(() => useContextEx2(DivinedPayloadContext, "DivinedPayload", true), "useDivinedPayload");
|
|
156
|
+
|
|
157
|
+
// src/contexts/DivinedPayload/Provider.tsx
|
|
158
|
+
var DivinedPayloadProvider = /* @__PURE__ */ __name(({ children, hash }) => {
|
|
159
|
+
const { hash: hashParam } = useParams();
|
|
160
|
+
const huriFromHashParam = useBuildHuri(hashParam);
|
|
161
|
+
const [params] = useSearchParams();
|
|
162
|
+
const huriSearchParameter = params.get("huri");
|
|
163
|
+
const decodedHuriParam = decodeURIComponent(huriSearchParameter ?? "");
|
|
164
|
+
const huriUri = hash ?? decodedHuriParam ?? huriFromHashParam;
|
|
165
|
+
const [payload, setPayload, payloadError] = useDivinePayload(huriUri);
|
|
166
|
+
return /* @__PURE__ */ React2.createElement(DivinedPayloadContext.Provider, {
|
|
167
|
+
value: {
|
|
168
|
+
payload,
|
|
169
|
+
payloadError,
|
|
170
|
+
provided: true,
|
|
171
|
+
setPayload
|
|
172
|
+
}
|
|
173
|
+
}, children);
|
|
174
|
+
}, "DivinedPayloadProvider");
|
|
175
|
+
var DivinedPayloadWithHandleInner = /* @__PURE__ */ __name(({ children }) => {
|
|
176
|
+
const { payloadError } = useDivinedPayload();
|
|
177
|
+
return /* @__PURE__ */ React2.createElement(ErrorRender, {
|
|
178
|
+
error: payloadError ? {
|
|
179
|
+
message: payloadError.message,
|
|
180
|
+
schema: ModuleErrorSchema,
|
|
181
|
+
sources: []
|
|
182
|
+
} : void 0,
|
|
183
|
+
errorContext: "Divined Payload Provider"
|
|
184
|
+
}, children);
|
|
185
|
+
}, "DivinedPayloadWithHandleInner");
|
|
186
|
+
var DivinedPayloadWithHandleProvider = /* @__PURE__ */ __name(({ children, ...props }) => {
|
|
187
|
+
return /* @__PURE__ */ React2.createElement(DivinedPayloadProvider, props, /* @__PURE__ */ React2.createElement(DivinedPayloadWithHandleInner, null, children));
|
|
188
|
+
}, "DivinedPayloadWithHandleProvider");
|
|
189
|
+
export {
|
|
190
|
+
DivinedPayloadContext,
|
|
191
|
+
DivinedPayloadProvider,
|
|
192
|
+
DivinedPayloadWithHandleInner,
|
|
193
|
+
DivinedPayloadWithHandleProvider,
|
|
194
|
+
PayloadDivinerContext,
|
|
195
|
+
PayloadDivinerProvider,
|
|
196
|
+
useDivinePayload,
|
|
197
|
+
useDivinePayloads,
|
|
198
|
+
useDivinedPayload,
|
|
199
|
+
usePayloadDiviner
|
|
200
|
+
};
|
|
201
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/contexts/DivinedPayload/Context.ts","../../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.ts'\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 React from 'react'\nimport { useParams, useSearchParams } from 'react-router-dom'\n\nimport { useDivinePayload } from '../PayloadDiviner/index.ts'\nimport { DivinedPayloadContext } from './Context.ts'\nimport { useDivinedPayload } from './use.ts'\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 ?? huriFromHashParam\n\n const [payload, setPayload, payloadError] = useDivinePayload(huriUri)\n\n // eslint-disable-next-line @eslint-react/no-unstable-context-value\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.ts'\n\nconst PayloadDivinerContext = createContextEx<PayloadDivinerState>()\n\nexport { PayloadDivinerContext }\n","import { PayloadDiviner } from '@xyo-network/diviner-payload-abstract'\nimport { ContextExProviderProps } from '@xyo-network/react-shared'\nimport React, { useEffect, useMemo, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context.ts'\n\nexport type PayloadDivinerProviderProps = ContextExProviderProps<{\n /** Required */\n diviner?: PayloadDiviner\n}>\n\nexport const PayloadDivinerProvider: React.FC<PayloadDivinerProviderProps> = ({ diviner: divinerProp, required = false, children }) => {\n const [diviner, setDiviner] = useState<PayloadDiviner | undefined>(divinerProp)\n\n useEffect(() => {\n if (divinerProp) {\n setDiviner(divinerProp)\n }\n }, [divinerProp])\n\n const value = useMemo(() => ({ diviner: diviner === divinerProp ? diviner : undefined, provided: true, setDiviner }), [diviner, divinerProp, setDiviner])\n\n return (\n <PayloadDivinerContext.Provider\n value={value}\n >\n {diviner\n ? children\n : required\n ? null\n : 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-huri'\nimport { Payload, WithMeta } from '@xyo-network/payload-model'\nimport { useContextEx } from '@xyo-network/react-shared'\nimport { Dispatch, useEffect, useState } from 'react'\n\nimport { PayloadDivinerContext } from './Context.ts'\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 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 WithMeta<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 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(\n [...payloads.values()].map(value => (value.status === 'rejected' ? new Error('divine failed', { cause: value.reason }) : undefined)),\n ),\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' ? new 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.ts'\n\nexport const useDivinedPayload = () => useContextEx(DivinedPayloadContext, 'DivinedPayload', true)\n"],"mappings":";;;;AAAA,SAASA,uBAAuB;AAIzB,IAAMC,wBAAwBD,gBAAAA;;;ACHrC,SAASE,yBAAyB;AAClC,SAASC,mBAAmB;AAC5B,SAASC,oBAAoB;AAC7B,OAAOC,YAAW;AAClB,SAASC,WAAWC,uBAAuB;;;ACL3C,SAASC,mBAAAA,wBAAuB;AAIhC,IAAMC,wBAAwBD,iBAAAA;;;ACF9B,OAAOE,SAASC,WAAWC,SAASC,gBAAgB;AAS7C,IAAMC,yBAAgE,wBAAC,EAAEC,SAASC,aAAaC,WAAW,OAAOC,SAAQ,MAAE;AAChI,QAAM,C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":["createContextEx","DivinedPayloadContext","ModuleErrorSchema","ErrorRender","useBuildHuri","React","useParams","useSearchParams","createContextEx","PayloadDivinerContext","React","useEffect","useMemo","useState","PayloadDivinerProvider","diviner","divinerProp","required","children","setDiviner","useState","useEffect","value","useMemo","undefined","provided","PayloadDivinerContext","Provider","compact","useAsyncEffect","HuriSchema","useContextEx","useEffect","useState","usePayloadDiviner","required","useContextEx","PayloadDivinerContext","useDivinePayload","huri","diviner","payload","setPayload","useState","error","setError","useEffect","undefined","useAsyncEffect","mounted","huriPayload","schema","HuriSchema","divine","ex","useDivinePayloads","huriList","payloads","setPayloads","errors","setErrors","console","log","JSON","stringify","Promise","allSettled","map","values","value","status","compact","Error","cause","reason","useContextEx","useDivinedPayload","useContextEx","DivinedPayloadContext","DivinedPayloadProvider","children","hash","hashParam","useParams","huriFromHashParam","useBuildHuri","params","useSearchParams","huriSearchParameter","get","decodedHuriParam","decodeURIComponent","huriUri","payload","setPayload","payloadError","useDivinePayload","React","DivinedPayloadContext","Provider","value","provided","DivinedPayloadWithHandleInner","useDivinedPayload","ErrorRender","error","message","schema","ModuleErrorSchema","sources","undefined","errorContext","DivinedPayloadWithHandleProvider","props"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DivinedPayloadState } from './State.
|
|
1
|
+
import { DivinedPayloadState } from './State.ts';
|
|
2
2
|
export declare const DivinedPayloadContext: import("react").Context<DivinedPayloadState & import("@xyo-network/react-shared").ContextExState>;
|
|
3
3
|
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/Context.
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/Context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEhD,eAAO,MAAM,qBAAqB,mGAAyC,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DivinedPayloadState } from './State.
|
|
1
|
+
import { DivinedPayloadState } from './State.ts';
|
|
2
2
|
export declare const DivinedPayloadContext: import("react").Context<DivinedPayloadState & import("@xyo-network/react-shared").ContextExState>;
|
|
3
3
|
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/Context.
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/Context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEhD,eAAO,MAAM,qBAAqB,mGAAyC,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DivinedPayloadState } from './State.
|
|
1
|
+
import { DivinedPayloadState } from './State.ts';
|
|
2
2
|
export declare const DivinedPayloadContext: import("react").Context<DivinedPayloadState & import("@xyo-network/react-shared").ContextExState>;
|
|
3
3
|
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/Context.
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/Context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAEhD,eAAO,MAAM,qBAAqB,mGAAyC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAIxD,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,MAAM,WAAW,2BAA4B,SAAQ,YAAY;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAcxE,CAAA;AAED,eAAO,MAAM,6BAA6B,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAWhE,CAAA;AAED,eAAO,MAAM,gCAAgC,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAMlF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAIxD,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,MAAM,WAAW,2BAA4B,SAAQ,YAAY;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAcxE,CAAA;AAED,eAAO,MAAM,6BAA6B,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAWhE,CAAA;AAED,eAAO,MAAM,gCAAgC,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAMlF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAIxD,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,MAAM,WAAW,2BAA4B,SAAQ,YAAY;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAcxE,CAAA;AAED,eAAO,MAAM,6BAA6B,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAWhE,CAAA;AAED,eAAO,MAAM,gCAAgC,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAMlF,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './Context.
|
|
2
|
-
export * from './Provider.
|
|
3
|
-
export * from './State.
|
|
4
|
-
export * from './use.
|
|
1
|
+
export * from './Context.ts';
|
|
2
|
+
export * from './Provider.tsx';
|
|
3
|
+
export * from './State.ts';
|
|
4
|
+
export * from './use.ts';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './Context.
|
|
2
|
-
export * from './Provider.
|
|
3
|
-
export * from './State.
|
|
4
|
-
export * from './use.
|
|
1
|
+
export * from './Context.ts';
|
|
2
|
+
export * from './Provider.tsx';
|
|
3
|
+
export * from './State.ts';
|
|
4
|
+
export * from './use.ts';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './Context.
|
|
2
|
-
export * from './Provider.
|
|
3
|
-
export * from './State.
|
|
4
|
-
export * from './use.
|
|
1
|
+
export * from './Context.ts';
|
|
2
|
+
export * from './Provider.tsx';
|
|
3
|
+
export * from './State.ts';
|
|
4
|
+
export * from './use.ts';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/DivinedPayload/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const useDivinedPayload: () => Omit<import("./State.
|
|
1
|
+
export declare const useDivinedPayload: () => Omit<import("./State.ts").DivinedPayloadState & import("@xyo-network/react-shared").ContextExState, "provided">;
|
|
2
2
|
//# sourceMappingURL=use.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const useDivinedPayload: () => Omit<import("./State.
|
|
1
|
+
export declare const useDivinedPayload: () => Omit<import("./State.ts").DivinedPayloadState & import("@xyo-network/react-shared").ContextExState, "provided">;
|
|
2
2
|
//# sourceMappingURL=use.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const useDivinedPayload: () => Omit<import("./State.
|
|
1
|
+
export declare const useDivinedPayload: () => Omit<import("./State.ts").DivinedPayloadState & import("@xyo-network/react-shared").ContextExState, "provided">;
|
|
2
2
|
//# sourceMappingURL=use.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PayloadDivinerState } from './State.
|
|
1
|
+
import { PayloadDivinerState } from './State.ts';
|
|
2
2
|
declare const PayloadDivinerContext: import("react").Context<PayloadDivinerState & import("@xyo-network/react-shared").ContextExState>;
|
|
3
3
|
export { PayloadDivinerContext };
|
|
4
4
|
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PayloadDivinerState } from './State.
|
|
1
|
+
import { PayloadDivinerState } from './State.ts';
|
|
2
2
|
declare const PayloadDivinerContext: import("react").Context<PayloadDivinerState & import("@xyo-network/react-shared").ContextExState>;
|
|
3
3
|
export { PayloadDivinerContext };
|
|
4
4
|
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PayloadDivinerState } from './State.
|
|
1
|
+
import { PayloadDivinerState } from './State.ts';
|
|
2
2
|
declare const PayloadDivinerContext: import("react").Context<PayloadDivinerState & import("@xyo-network/react-shared").ContextExState>;
|
|
3
3
|
export { PayloadDivinerContext };
|
|
4
4
|
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PayloadDiviner } from '@xyo-network/diviner-payload-abstract';
|
|
2
2
|
import { ContextExProviderProps } from '@xyo-network/react-shared';
|
|
3
|
+
import React from 'react';
|
|
3
4
|
export type PayloadDivinerProviderProps = ContextExProviderProps<{
|
|
4
5
|
diviner?: PayloadDiviner;
|
|
5
6
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAClE,OAAO,KAAuC,MAAM,OAAO,CAAA;AAI3D,MAAM,MAAM,2BAA2B,GAAG,sBAAsB,CAAC;IAE/D,OAAO,CAAC,EAAE,cAAc,CAAA;CACzB,CAAC,CAAA;AAEF,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAsBxE,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PayloadDiviner } from '@xyo-network/diviner-payload-abstract';
|
|
2
2
|
import { ContextExProviderProps } from '@xyo-network/react-shared';
|
|
3
|
+
import React from 'react';
|
|
3
4
|
export type PayloadDivinerProviderProps = ContextExProviderProps<{
|
|
4
5
|
diviner?: PayloadDiviner;
|
|
5
6
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAClE,OAAO,KAAuC,MAAM,OAAO,CAAA;AAI3D,MAAM,MAAM,2BAA2B,GAAG,sBAAsB,CAAC;IAE/D,OAAO,CAAC,EAAE,cAAc,CAAA;CACzB,CAAC,CAAA;AAEF,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAsBxE,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PayloadDiviner } from '@xyo-network/diviner-payload-abstract';
|
|
2
2
|
import { ContextExProviderProps } from '@xyo-network/react-shared';
|
|
3
|
+
import React from 'react';
|
|
3
4
|
export type PayloadDivinerProviderProps = ContextExProviderProps<{
|
|
4
5
|
diviner?: PayloadDiviner;
|
|
5
6
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAClE,OAAO,KAAuC,MAAM,OAAO,CAAA;AAI3D,MAAM,MAAM,2BAA2B,GAAG,sBAAsB,CAAC;IAE/D,OAAO,CAAC,EAAE,cAAc,CAAA;CACzB,CAAC,CAAA;AAEF,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAsBxE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './Context.
|
|
2
|
-
export * from './Provider.
|
|
3
|
-
export * from './State.
|
|
4
|
-
export * from './use.
|
|
1
|
+
export * from './Context.ts';
|
|
2
|
+
export * from './Provider.tsx';
|
|
3
|
+
export * from './State.ts';
|
|
4
|
+
export * from './use.ts';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './Context.
|
|
2
|
-
export * from './Provider.
|
|
3
|
-
export * from './State.
|
|
4
|
-
export * from './use.
|
|
1
|
+
export * from './Context.ts';
|
|
2
|
+
export * from './Provider.tsx';
|
|
3
|
+
export * from './State.ts';
|
|
4
|
+
export * from './use.ts';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './Context.
|
|
2
|
-
export * from './Provider.
|
|
3
|
-
export * from './State.
|
|
4
|
-
export * from './use.
|
|
1
|
+
export * from './Context.ts';
|
|
2
|
+
export * from './Provider.tsx';
|
|
3
|
+
export * from './State.ts';
|
|
4
|
+
export * from './use.ts';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Payload } from '@xyo-network/payload-model';
|
|
2
2
|
import { Dispatch } from 'react';
|
|
3
|
-
export declare const usePayloadDiviner: (required?: boolean) => Omit<import("./State.
|
|
3
|
+
export declare const usePayloadDiviner: (required?: boolean) => Omit<import("./State.ts").PayloadDivinerState & import("@xyo-network/react-shared").ContextExState, "provided">;
|
|
4
4
|
export declare const useDivinePayload: <T extends Payload = {
|
|
5
5
|
schema: string;
|
|
6
6
|
} & import("@xyo-network/payload-model").PayloadFields>(huri?: string) => [T | undefined | null, Dispatch<T | null | undefined>, Error | undefined];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/use.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAY,MAAM,4BAA4B,CAAA;AAE9D,OAAO,EAAE,QAAQ,EAAuB,MAAM,OAAO,CAAA;AAIrD,eAAO,MAAM,iBAAiB,yIAE7B,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,OAAO;;+DACzC,MAAM,KACZ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,KAAK,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/use.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAY,MAAM,4BAA4B,CAAA;AAE9D,OAAO,EAAE,QAAQ,EAAuB,MAAM,OAAO,CAAA;AAIrD,eAAO,MAAM,iBAAiB,yIAE7B,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,OAAO;;+DACzC,MAAM,KACZ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,KAAK,GAAG,SAAS,CA+B1E,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,OAAO;;kEACvC,MAAM,EAAE,KACjB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,SAAS,CA0CpF,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Payload } from '@xyo-network/payload-model';
|
|
2
2
|
import { Dispatch } from 'react';
|
|
3
|
-
export declare const usePayloadDiviner: (required?: boolean) => Omit<import("./State.
|
|
3
|
+
export declare const usePayloadDiviner: (required?: boolean) => Omit<import("./State.ts").PayloadDivinerState & import("@xyo-network/react-shared").ContextExState, "provided">;
|
|
4
4
|
export declare const useDivinePayload: <T extends Payload = {
|
|
5
5
|
schema: string;
|
|
6
6
|
} & import("@xyo-network/payload-model").PayloadFields>(huri?: string) => [T | undefined | null, Dispatch<T | null | undefined>, Error | undefined];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/use.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAY,MAAM,4BAA4B,CAAA;AAE9D,OAAO,EAAE,QAAQ,EAAuB,MAAM,OAAO,CAAA;AAIrD,eAAO,MAAM,iBAAiB,yIAE7B,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,OAAO;;+DACzC,MAAM,KACZ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,KAAK,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../../src/contexts/PayloadDiviner/use.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAY,MAAM,4BAA4B,CAAA;AAE9D,OAAO,EAAE,QAAQ,EAAuB,MAAM,OAAO,CAAA;AAIrD,eAAO,MAAM,iBAAiB,yIAE7B,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,OAAO;;+DACzC,MAAM,KACZ,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,KAAK,GAAG,SAAS,CA+B1E,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,OAAO;;kEACvC,MAAM,EAAE,KACjB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,SAAS,CA0CpF,CAAA"}
|