@xyo-network/react-sentinel 2.78.0 → 2.78.2

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/components/Card/Card.tsx","../../src/components/Card/CardActions.tsx","../../src/components/Card/CardContent.tsx","../../src/components/Card/CardHeader.tsx","../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/State.ts","../../src/contexts/use.ts","../../src/hooks/node/useSentinelFromNode.tsx","../../src/hooks/node/useSentinelsFromNode.tsx","../../src/hooks/node/useWeakSentinelFromNode.tsx","../../src/hooks/node/useWeakSentinelsFromNode.tsx"],"sourcesContent":["export * from './components'\nexport * from './contexts'\nexport * from './hooks'\n","import { Card, CardProps } from '@mui/material'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { useState } from 'react'\n\nimport { SentinelCardActions } from './CardActions'\nimport { SentinelCardContent } from './CardContent'\nimport { SentinelCardHeader } from './CardHeader'\n\nexport type SentinelCardProps = CardProps &\n ModuleRenderProps<SentinelInstance> & {\n inPayloads?: Payload[]\n }\n\nexport const SentinelCard: React.FC<SentinelCardProps> = ({ children, inPayloads, mod, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await mod?.report(inPayloads)\n }\n }, [mod, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader mod={mod} />\n <SentinelCardContent mod={mod} report={report} />\n {children}\n <SentinelCardActions mod={mod} onReport={() => setRetry(retry + 1)} />\n </Card>\n )\n}\n","import { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleCardActions, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &\n CardActionsProps & {\n onReport?: (mod?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, mod, ...props }) => {\n return (\n <ModuleCardActions mod={mod} {...props}>\n <ButtonEx onClick={() => onReport?.(mod)} size={'small'} variant={'outlined'}>\n Report\n </ButtonEx>\n </ModuleCardActions>\n )\n}\n","import { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleCardContent, ModuleRenderProps } from '@xyo-network/react-module'\nimport { JsonViewerEx } from '@xyo-network/react-payload-raw-info'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\n\nexport type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &\n CardContentProps & {\n report?: Payload[]\n }\n\nexport const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ children, report, mod, ...props }) => {\n return (\n <ModuleCardContent mod={mod} {...props}>\n <FlexGrowRow flexWrap=\"wrap\" justifyContent=\"start\" gap={2}>\n {report ?\n <JsonViewerEx value={report} />\n : null}\n {children}\n </FlexGrowRow>\n </ModuleCardContent>\n )\n}\n","import { CardHeaderProps } from '@mui/material'\nimport { ModuleCardHeader, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({ title, mod, ...props }) => {\n return <ModuleCardHeader mod={mod} title={title ?? mod?.config.name ?? 'Sentinel'} {...props} />\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel } from '@xyo-network/sentinel-memory'\nimport { SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel-model'\nimport { asWitnessInstance, WitnessInstance } from '@xyo-network/witness-model'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n synchronous: true,\n // eslint-disable-next-line id-denylist\n tasks: witnesses?.map((mod) => ({ module: mod.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module: mod, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([new Error(`Witness failed [${mod?.config?.name ?? mod.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n if (witnesses)\n for (const witness of witnesses) {\n offCallbacks.push(\n witness.on('observeEnd', ({ module: mod, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`),\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module: mod }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`),\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n }\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n for (const callback of offCallbacks) {\n callback()\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ?\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel-model'\nimport { WitnessModule } from '@xyo-network/witness-model'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","// eslint-disable-next-line import/no-deprecated\nimport { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n // eslint-disable-next-line deprecation/deprecation, import/no-deprecated\n const [mod, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(mod)\n if (mod && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${mod.config?.schema}:${mod.config?.name}:${mod.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\n// eslint-disable-next-line import/no-deprecated\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n // eslint-disable-next-line deprecation/deprecation, import/no-deprecated\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules ?\n [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, mod) => {\n if (isSentinelInstance(mod)) {\n prev.push(mod)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import { useWeakModuleFromNode, WeakModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: WeakModuleFromNodeConfig,\n): [WeakRef<SentinelInstance> | undefined, Error | undefined] => {\n return useWeakModuleFromNode<SentinelInstance>(nameOrAddressOrInstance, { identity: isSentinelInstance, ...config })\n}\n","import { exists } from '@xylabs/exists'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useWeakModulesFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [WeakRef<SentinelInstance>[] | null | undefined, Error | undefined] => {\n const [modules, error] = useWeakModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return [\n modules\n ?.map((mod) => {\n const instance = asSentinelInstance(mod?.deref())\n if (instance) {\n return new WeakRef(instance)\n }\n })\n .filter(exists) ?? [],\n undefined,\n ]\n}\n"],"mappings":"mbAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,kBAAAE,GAAA,wBAAAC,EAAA,uBAAAC,EAAA,oBAAAC,EAAA,qBAAAC,GAAA,yBAAAC,EAAA,uBAAAC,GAAA,wBAAAC,GAAA,yBAAAC,GAAA,4BAAAC,GAAA,6BAAAC,KAAA,eAAAC,GAAAb,ICAA,IAAAc,EAAgC,yBAChCC,EAA2B,iCAI3BC,EAAyB,iBCJzB,IAAAC,EAAyB,gCACzBC,EAAqD,qCAW/CC,EAAA,6BAHOC,EAA0D,CAAC,CAAE,SAAAC,EAAU,IAAAC,EAAK,GAAGC,CAAM,OAE9F,OAAC,qBAAkB,IAAKD,EAAM,GAAGC,EAC/B,mBAAC,YA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xE,GAAM,CAACC,EAASC,CAAK,KAAI,2BAAuBH,EAAQC,CAAM,EAC9D,OAAIE,EACK,CAAC,KAAMA,CAAK,EAEd,EACLD,GAAA,YAAAA,EACI,IAAKE,GAAQ,CACb,IAAMC,KAAW,uBAAmBD,GAAA,YAAAA,EAAK,OAAO,EAChD,GAAIC,EACF,OAAO,IAAI,QAAQA,CAAQ,CAE/B,GACC,OAAO,YAAW,CAAC,EACtB,MACF,CACF","names":["src_exports","__export","SentinelCard","SentinelCardContent","SentinelCardHeader","SentinelContext","SentinelProvider","SentinelReportStatus","useSentinelContext","useSentinelFromNode","useSentinelsFromNode","useWeakSentinelFromNode","useWeakSentinelsFromNode","__toCommonJS","import_material","import_react_promise","import_react","import_react_button","import_react_module","import_jsx_runtime","SentinelCardActions","onReport","mod","props","import_react_flexbox","import_react_module","import_react_payload_raw_info","import_jsx_runtime","SentinelCardContent","children","report","mod","props","import_react_module","import_jsx_runtime","SentinelCardHeader","title","mod","props","import_jsx_runtime","SentinelCard","children","inPayloads","mod","props","retry","setRetry","report","SentinelCardHeader","SentinelCardContent","SentinelCardActions","import_react_shared","SentinelContext","import_react_async_effect","import_react_witness","import_sentinel_memory","import_sentinel_model","import_witness_model","import_react","SentinelReportStatus","import_jsx_runtime","SentinelProvider","account","archivist","children","filter","name","required","sentinel","setSentinel","history","setHistory","progress","setProgress","status","setStatus","reportingErrors","setReportingErrors","witnesses","mounted","mod","offCallbacks","outPayloads","_a","witness","callback","SentinelContext","import_react_shared","useSentinelContext","sentinel","history","progress","reportingErrors","status","SentinelContext","import_react_node","import_sentinel_model","useSentinelFromNode","nameOrAddressOrInstance","config","_a","_b","mod","error","instance","import_react_node","import_sentinel_model","useSentinelsFromNode","filter","config","modules","error","prev","mod","import_react_node","import_sentinel_model","useWeakSentinelFromNode","nameOrAddressOrInstance","config","import_exists","import_react_node","import_sentinel_model","useWeakSentinelsFromNode","filter","config","modules","error","mod","instance"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/components/Card/Card.tsx","../../src/components/Card/CardActions.tsx","../../src/components/Card/CardContent.tsx","../../src/components/Card/CardHeader.tsx","../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/State.ts","../../src/contexts/use.ts","../../src/hooks/node/useSentinelFromNode.tsx","../../src/hooks/node/useSentinelsFromNode.tsx","../../src/hooks/node/useWeakSentinelFromNode.tsx","../../src/hooks/node/useWeakSentinelsFromNode.tsx"],"sourcesContent":["export * from './components'\nexport * from './contexts'\nexport * from './hooks'\n","import { Card, CardProps } from '@mui/material'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { useState } from 'react'\n\nimport { SentinelCardActions } from './CardActions'\nimport { SentinelCardContent } from './CardContent'\nimport { SentinelCardHeader } from './CardHeader'\n\nexport type SentinelCardProps = CardProps &\n ModuleRenderProps<SentinelInstance> & {\n inPayloads?: Payload[]\n }\n\nexport const SentinelCard: React.FC<SentinelCardProps> = ({ children, inPayloads, mod, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await mod?.report(inPayloads)\n }\n }, [mod, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader mod={mod} />\n <SentinelCardContent mod={mod} report={report} />\n {children}\n <SentinelCardActions mod={mod} onReport={() => setRetry(retry + 1)} />\n </Card>\n )\n}\n","import { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleCardActions, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &\n CardActionsProps & {\n onReport?: (mod?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, mod, ...props }) => {\n return (\n <ModuleCardActions mod={mod} {...props}>\n <ButtonEx onClick={() => onReport?.(mod)} size={'small'} variant={'outlined'}>\n Report\n </ButtonEx>\n </ModuleCardActions>\n )\n}\n","import { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleCardContent, ModuleRenderProps } from '@xyo-network/react-module'\nimport { JsonViewerEx } from '@xyo-network/react-payload-raw-info'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\n\nexport type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &\n CardContentProps & {\n report?: Payload[]\n }\n\nexport const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ children, report, mod, ...props }) => {\n return (\n <ModuleCardContent mod={mod} {...props}>\n <FlexGrowRow flexWrap=\"wrap\" justifyContent=\"start\" gap={2}>\n {report ?\n <JsonViewerEx value={report} />\n : null}\n {children}\n </FlexGrowRow>\n </ModuleCardContent>\n )\n}\n","import { CardHeaderProps } from '@mui/material'\nimport { ModuleCardHeader, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({ title, mod, ...props }) => {\n return <ModuleCardHeader mod={mod} title={title ?? mod?.config.name ?? 'Sentinel'} {...props} />\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel } from '@xyo-network/sentinel-memory'\nimport { SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel-model'\nimport { asWitnessInstance, WitnessInstance } from '@xyo-network/witness-model'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n synchronous: true,\n // eslint-disable-next-line id-denylist\n tasks: witnesses?.map((mod) => ({ module: mod.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module: mod, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([new Error(`Witness failed [${mod?.config?.name ?? mod.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n if (witnesses)\n for (const witness of witnesses) {\n offCallbacks.push(\n witness.on('observeEnd', ({ module: mod, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`),\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module: mod }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`),\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n }\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n for (const callback of offCallbacks) {\n callback()\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ?\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel-model'\nimport { WitnessModule } from '@xyo-network/witness-model'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","// eslint-disable-next-line import/no-deprecated\nimport { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n // eslint-disable-next-line deprecation/deprecation, import/no-deprecated\n const [mod, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(mod)\n if (mod && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${mod.config?.schema}:${mod.config?.name}:${mod.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\n// eslint-disable-next-line import/no-deprecated\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n // eslint-disable-next-line deprecation/deprecation, import/no-deprecated\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules ?\n [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, mod) => {\n if (isSentinelInstance(mod)) {\n prev.push(mod)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import { useWeakModuleFromNode, WeakModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: WeakModuleFromNodeConfig,\n): [WeakRef<SentinelInstance> | undefined, Error | undefined] => {\n return useWeakModuleFromNode<SentinelInstance>(nameOrAddressOrInstance, { identity: isSentinelInstance, ...config })\n}\n","import { exists } from '@xylabs/exists'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useWeakModulesFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [WeakRef<SentinelInstance>[] | null | undefined, Error | undefined] => {\n const [modules, error] = useWeakModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return [\n modules\n ?.map((mod) => {\n const instance = asSentinelInstance(mod?.deref())\n if (instance) {\n return new WeakRef(instance)\n }\n })\n .filter(exists) ?? [],\n undefined,\n ]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAAgC;AAChC,2BAA2B;AAI3B,mBAAyB;;;ACJzB,0BAAyB;AACzB,0BAAqD;AAW/C;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,KAAK,GAAG,MAAM,MAAM;AACtG,SACE,4CAAC,yCAAkB,KAAW,GAAG,OAC/B,sDAAC,gCAAS,SAAS,MAAM,qCAAW,MAAM,MAAM,SAAS,SAAS,YAAY,oBAE9E,GACF;AAEJ;;;ACjBA,2BAA4B;AAE5B,IAAAA,uBAAqD;AACrD,oCAA6B;AAYvB,IAAAC,sBAAA;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,KAAK,GAAG,MAAM,MAAM;AAC9G,SACE,6CAAC,0CAAkB,KAAW,GAAG,OAC/B,wDAAC,oCAAY,UAAS,QAA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;AAE9C,IAAM,2BAA2B,CACtC,QACA,WACwE;AACxE,QAAM,CAAC,SAAS,KAAK,QAAI,2CAAuB,QAAQ,MAAM;AAC9D,MAAI,OAAO;AACT,WAAO,CAAC,MAAM,KAAK;AAAA,EACrB;AACA,SAAO;AAAA,KACL,mCACI,IAAI,CAAC,QAAQ;AACb,YAAM,eAAW,2CAAmB,2BAAK,OAAO;AAChD,UAAI,UAAU;AACZ,eAAO,IAAI,QAAQ,QAAQ;AAAA,MAC7B;AAAA,IACF,GACC,OAAO,0BAAW,CAAC;AAAA,IACtB;AAAA,EACF;AACF;","names":["import_react_module","import_jsx_runtime","import_react_module","import_jsx_runtime","import_jsx_runtime","import_react","SentinelReportStatus","import_jsx_runtime","sentinel","witnesses","import_react_shared","import_sentinel_model","error","import_react_node","import_sentinel_model","import_react_node","import_sentinel_model","import_react_node","import_sentinel_model"]}
@@ -1,2 +1,247 @@
1
- import{Card as Q}from"@mui/material";import{usePromise as V}from"@xylabs/react-promise";import{useState as D}from"react";import{ButtonEx as B}from"@xylabs/react-button";import{ModuleCardActions as H}from"@xyo-network/react-module";import{jsx as F}from"react/jsx-runtime";var I=({onReport:r,mod:n,...e})=>F(H,{mod:n,...e,children:F(B,{onClick:()=>r==null?void 0:r(n),size:"small",variant:"outlined",children:"Report"})});import{FlexGrowRow as $}from"@xylabs/react-flexbox";import{ModuleCardContent as b}from"@xyo-network/react-module";import{JsonViewerEx as q}from"@xyo-network/react-payload-raw-info";import{jsx as R,jsxs as G}from"react/jsx-runtime";var v=({children:r,report:n,mod:e,...s})=>R(b,{mod:e,...s,children:G($,{flexWrap:"wrap",justifyContent:"start",gap:2,children:[n?R(q,{value:n}):null,r]})});import{ModuleCardHeader as z}from"@xyo-network/react-module";import{jsx as J}from"react/jsx-runtime";var W=({title:r,mod:n,...e})=>J(z,{mod:n,title:r??(n==null?void 0:n.config.name)??"Sentinel",...e});import{jsx as x,jsxs as K}from"react/jsx-runtime";var ye=({children:r,inPayloads:n,mod:e,...s})=>{let[o,t]=D(-1),[l]=V(async()=>{if(o>=0)return await(e==null?void 0:e.report(n))},[e,o,n]);return K(Q,{...s,children:[x(W,{mod:e}),x(v,{mod:e,report:l}),r,x(I,{mod:e,onReport:()=>t(o+1)})]})};import{createContextEx as L}from"@xyo-network/react-shared";var g=L();import{useAsyncEffect as T}from"@xylabs/react-async-effect";import{useWitnessesFromNode as U}from"@xyo-network/react-witness";import{MemorySentinel as X}from"@xyo-network/sentinel-memory";import{SentinelConfigSchema as Y}from"@xyo-network/sentinel-model";import{asWitnessInstance as w}from"@xyo-network/witness-model";import{useEffect as Z,useState as f}from"react";var O=(t=>(t.Idle="idle",t.Queued="queued",t.Started="started",t.Succeeded="succeeded",t.Failed="failed",t))(O||{});import{jsx as _}from"react/jsx-runtime";var Oe=({account:r,archivist:n,children:e,filter:s,name:o,required:t=!1})=>{let[l,u]=f(),[E,A]=f(),[p,S]=f({}),[N,P]=f("idle"),[y,k]=f(),[c]=U(s);return T(async C=>{let M=await X.create({account:r,config:{archivists:n?[n]:void 0,name:o,schema:Y,synchronous:!0,tasks:c==null?void 0:c.map(i=>({module:i.address}))}}),m=[];if(m.push(M.on("reportEnd",({module:i,outPayloads:d})=>{var a;C()&&(S({archivists:p.archivists,witnesses:p.witnesses}),P(d!=null&&d.length?"succeeded":"failed"),k([new Error(`Witness failed [${((a=i==null?void 0:i.config)==null?void 0:a.name)??i.address}]`)]))})),m.push(M.on("reportStart",()=>{C()&&(S({archivists:{},witnesses:{}}),P("started"))})),c)for(let i of c)m.push(i.on("observeEnd",({module:d,outPayloads:a})=>{let h=p.witnesses??{};h[i.address]={status:a!=null&&a.length?"succeeded":"failed",witness:w(d,()=>`Module is not a witness [${d.id}]`)},C()&&S({archivists:p.archivists,witnesses:h})})),m.push(i.on("observeStart",({module:d})=>{let a=p.witnesses??{};a[i.address]={status:"started",witness:w(d,()=>`Module is not a witness [${d.id}]`)},C()&&S({archivists:p.archivists,witnesses:a})}));return u(M),()=>{for(let i of m)i()}},[r,n,c]),Z(()=>{A(l==null?void 0:l.history)},[l]),!t||l?_(g.Provider,{value:{history:E,progress:p,provided:!0,reportingErrors:y,sentinel:l,status:N},children:e}):null};import{useContextEx as j}from"@xyo-network/react-shared";var Ze=()=>{let{sentinel:r,history:n,progress:e,reportingErrors:s,status:o}=j(g,"Sentinel");return{history:n,progress:e,reportingErrors:s,sentinel:r,status:o}};import{useModuleFromNode as ee}from"@xyo-network/react-node";import{asSentinelInstance as ne}from"@xyo-network/sentinel-model";var tn=(r,n)=>{var t,l;let[e,s]=ee(r,n),o=ne(e);if(e&&!o){let u=new Error(`Resolved module is not a SentinelInstance [${(t=e.config)==null?void 0:t.schema}:${(l=e.config)==null?void 0:l.name}:${e.address}]`);return console.error(u.message),[void 0,u]}return[o,s]};import{useModulesFromNode as re}from"@xyo-network/react-node";import{isSentinelInstance as te}from"@xyo-network/sentinel-model";var pn=(r,n)=>{let[e,s]=re(r,n);return s?[null,s]:e?[e.reduce((o,t)=>(te(t)&&o.push(t),o),[]),void 0]:[e,s]};import{useWeakModuleFromNode as oe}from"@xyo-network/react-node";import{isSentinelInstance as se}from"@xyo-network/sentinel-model";var Cn=(r,n)=>oe(r,{identity:se,...n});import{exists as ie}from"@xylabs/exists";import{useWeakModulesFromNode as le}from"@xyo-network/react-node";import{asSentinelInstance as de}from"@xyo-network/sentinel-model";var In=(r,n)=>{let[e,s]=le(r,n);return s?[null,s]:[(e==null?void 0:e.map(o=>{let t=de(o==null?void 0:o.deref());if(t)return new WeakRef(t)}).filter(ie))??[],void 0]};export{ye as SentinelCard,v as SentinelCardContent,W as SentinelCardHeader,g as SentinelContext,Oe as SentinelProvider,O as SentinelReportStatus,Ze as useSentinelContext,tn as useSentinelFromNode,pn as useSentinelsFromNode,Cn as useWeakSentinelFromNode,In as useWeakSentinelsFromNode};
1
+ // src/components/Card/Card.tsx
2
+ import { Card } from "@mui/material";
3
+ import { usePromise } from "@xylabs/react-promise";
4
+ import { useState } from "react";
5
+
6
+ // src/components/Card/CardActions.tsx
7
+ import { ButtonEx } from "@xylabs/react-button";
8
+ import { ModuleCardActions } from "@xyo-network/react-module";
9
+ import { jsx } from "react/jsx-runtime";
10
+ var SentinelCardActions = ({ onReport, mod, ...props }) => {
11
+ return /* @__PURE__ */ jsx(ModuleCardActions, { mod, ...props, children: /* @__PURE__ */ jsx(ButtonEx, { onClick: () => onReport == null ? void 0 : onReport(mod), size: "small", variant: "outlined", children: "Report" }) });
12
+ };
13
+
14
+ // src/components/Card/CardContent.tsx
15
+ import { FlexGrowRow } from "@xylabs/react-flexbox";
16
+ import { ModuleCardContent } from "@xyo-network/react-module";
17
+ import { JsonViewerEx } from "@xyo-network/react-payload-raw-info";
18
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
19
+ var SentinelCardContent = ({ children, report, mod, ...props }) => {
20
+ return /* @__PURE__ */ jsx2(ModuleCardContent, { mod, ...props, children: /* @__PURE__ */ jsxs(FlexGrowRow, { flexWrap: "wrap", justifyContent: "start", gap: 2, children: [
21
+ report ? /* @__PURE__ */ jsx2(JsonViewerEx, { value: report }) : null,
22
+ children
23
+ ] }) });
24
+ };
25
+
26
+ // src/components/Card/CardHeader.tsx
27
+ import { ModuleCardHeader } from "@xyo-network/react-module";
28
+ import { jsx as jsx3 } from "react/jsx-runtime";
29
+ var SentinelCardHeader = ({ title, mod, ...props }) => {
30
+ return /* @__PURE__ */ jsx3(ModuleCardHeader, { mod, title: title ?? (mod == null ? void 0 : mod.config.name) ?? "Sentinel", ...props });
31
+ };
32
+
33
+ // src/components/Card/Card.tsx
34
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
35
+ var SentinelCard = ({ children, inPayloads, mod, ...props }) => {
36
+ const [retry, setRetry] = useState(-1);
37
+ const [report] = usePromise(async () => {
38
+ if (retry >= 0) {
39
+ return await (mod == null ? void 0 : mod.report(inPayloads));
40
+ }
41
+ }, [mod, retry, inPayloads]);
42
+ return /* @__PURE__ */ jsxs2(Card, { ...props, children: [
43
+ /* @__PURE__ */ jsx4(SentinelCardHeader, { mod }),
44
+ /* @__PURE__ */ jsx4(SentinelCardContent, { mod, report }),
45
+ children,
46
+ /* @__PURE__ */ jsx4(SentinelCardActions, { mod, onReport: () => setRetry(retry + 1) })
47
+ ] });
48
+ };
49
+
50
+ // src/contexts/Context.ts
51
+ import { createContextEx } from "@xyo-network/react-shared";
52
+ var SentinelContext = createContextEx();
53
+
54
+ // src/contexts/Provider.tsx
55
+ import { useAsyncEffect } from "@xylabs/react-async-effect";
56
+ import { useWitnessesFromNode } from "@xyo-network/react-witness";
57
+ import { MemorySentinel } from "@xyo-network/sentinel-memory";
58
+ import { SentinelConfigSchema } from "@xyo-network/sentinel-model";
59
+ import { asWitnessInstance } from "@xyo-network/witness-model";
60
+ import { useEffect, useState as useState2 } from "react";
61
+
62
+ // src/contexts/State.ts
63
+ var SentinelReportStatus = /* @__PURE__ */ ((SentinelReportStatus2) => {
64
+ SentinelReportStatus2["Idle"] = "idle";
65
+ SentinelReportStatus2["Queued"] = "queued";
66
+ SentinelReportStatus2["Started"] = "started";
67
+ SentinelReportStatus2["Succeeded"] = "succeeded";
68
+ SentinelReportStatus2["Failed"] = "failed";
69
+ return SentinelReportStatus2;
70
+ })(SentinelReportStatus || {});
71
+
72
+ // src/contexts/Provider.tsx
73
+ import { jsx as jsx5 } from "react/jsx-runtime";
74
+ var SentinelProvider = ({ account, archivist, children, filter, name, required = false }) => {
75
+ const [sentinel, setSentinel] = useState2();
76
+ const [history, setHistory] = useState2();
77
+ const [progress, setProgress] = useState2({});
78
+ const [status, setStatus] = useState2("idle" /* Idle */);
79
+ const [reportingErrors, setReportingErrors] = useState2();
80
+ const [witnesses] = useWitnessesFromNode(filter);
81
+ useAsyncEffect(
82
+ // eslint-disable-next-line react-hooks/exhaustive-deps
83
+ async (mounted) => {
84
+ const sentinel2 = await MemorySentinel.create({
85
+ account,
86
+ config: {
87
+ archivists: archivist ? [archivist] : void 0,
88
+ name,
89
+ schema: SentinelConfigSchema,
90
+ synchronous: true,
91
+ // eslint-disable-next-line id-denylist
92
+ tasks: witnesses == null ? void 0 : witnesses.map((mod) => ({ module: mod.address }))
93
+ }
94
+ });
95
+ const offCallbacks = [];
96
+ offCallbacks.push(
97
+ sentinel2.on("reportEnd", ({ module: mod, outPayloads }) => {
98
+ var _a;
99
+ if (mounted()) {
100
+ setProgress({
101
+ archivists: progress.archivists,
102
+ witnesses: progress.witnesses
103
+ });
104
+ setStatus((outPayloads == null ? void 0 : outPayloads.length) ? "succeeded" /* Succeeded */ : "failed" /* Failed */);
105
+ setReportingErrors([new Error(`Witness failed [${((_a = mod == null ? void 0 : mod.config) == null ? void 0 : _a.name) ?? mod.address}]`)]);
106
+ }
107
+ })
108
+ );
109
+ offCallbacks.push(
110
+ sentinel2.on("reportStart", () => {
111
+ if (mounted()) {
112
+ setProgress({ archivists: {}, witnesses: {} });
113
+ setStatus("started" /* Started */);
114
+ }
115
+ })
116
+ );
117
+ if (witnesses)
118
+ for (const witness of witnesses) {
119
+ offCallbacks.push(
120
+ witness.on("observeEnd", ({ module: mod, outPayloads }) => {
121
+ const witnesses2 = progress.witnesses ?? {};
122
+ witnesses2[witness.address] = {
123
+ status: (outPayloads == null ? void 0 : outPayloads.length) ? "succeeded" /* Succeeded */ : "failed" /* Failed */,
124
+ witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`)
125
+ };
126
+ if (mounted()) {
127
+ setProgress({
128
+ archivists: progress.archivists,
129
+ witnesses: witnesses2
130
+ });
131
+ }
132
+ })
133
+ );
134
+ offCallbacks.push(
135
+ witness.on("observeStart", ({ module: mod }) => {
136
+ const witnesses2 = progress.witnesses ?? {};
137
+ witnesses2[witness.address] = {
138
+ status: "started" /* Started */,
139
+ witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`)
140
+ };
141
+ if (mounted()) {
142
+ setProgress({
143
+ archivists: progress.archivists,
144
+ witnesses: witnesses2
145
+ });
146
+ }
147
+ })
148
+ );
149
+ }
150
+ setSentinel(sentinel2);
151
+ return () => {
152
+ for (const callback of offCallbacks) {
153
+ callback();
154
+ }
155
+ };
156
+ },
157
+ // eslint-disable-next-line react-hooks/exhaustive-deps
158
+ [account, archivist, witnesses]
159
+ );
160
+ useEffect(() => {
161
+ setHistory(sentinel == null ? void 0 : sentinel.history);
162
+ }, [sentinel]);
163
+ return !required || sentinel ? /* @__PURE__ */ jsx5(SentinelContext.Provider, { value: { history, progress, provided: true, reportingErrors, sentinel, status }, children }) : null;
164
+ };
165
+
166
+ // src/contexts/use.ts
167
+ import { useContextEx } from "@xyo-network/react-shared";
168
+ var useSentinelContext = () => {
169
+ const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, "Sentinel");
170
+ return { history, progress, reportingErrors, sentinel, status };
171
+ };
172
+
173
+ // src/hooks/node/useSentinelFromNode.tsx
174
+ import { useModuleFromNode } from "@xyo-network/react-node";
175
+ import { asSentinelInstance } from "@xyo-network/sentinel-model";
176
+ var useSentinelFromNode = (nameOrAddressOrInstance, config) => {
177
+ var _a, _b;
178
+ const [mod, error] = useModuleFromNode(nameOrAddressOrInstance, config);
179
+ const instance = asSentinelInstance(mod);
180
+ if (mod && !instance) {
181
+ const error2 = new Error(`Resolved module is not a SentinelInstance [${(_a = mod.config) == null ? void 0 : _a.schema}:${(_b = mod.config) == null ? void 0 : _b.name}:${mod.address}]`);
182
+ console.error(error2.message);
183
+ return [void 0, error2];
184
+ }
185
+ return [instance, error];
186
+ };
187
+
188
+ // src/hooks/node/useSentinelsFromNode.tsx
189
+ import { useModulesFromNode } from "@xyo-network/react-node";
190
+ import { isSentinelInstance } from "@xyo-network/sentinel-model";
191
+ var useSentinelsFromNode = (filter, config) => {
192
+ const [modules, error] = useModulesFromNode(filter, config);
193
+ if (error) {
194
+ return [null, error];
195
+ }
196
+ return modules ? [
197
+ // eslint-disable-next-line unicorn/no-array-reduce
198
+ modules.reduce((prev, mod) => {
199
+ if (isSentinelInstance(mod)) {
200
+ prev.push(mod);
201
+ }
202
+ return prev;
203
+ }, []),
204
+ void 0
205
+ ] : [modules, error];
206
+ };
207
+
208
+ // src/hooks/node/useWeakSentinelFromNode.tsx
209
+ import { useWeakModuleFromNode } from "@xyo-network/react-node";
210
+ import { isSentinelInstance as isSentinelInstance2 } from "@xyo-network/sentinel-model";
211
+ var useWeakSentinelFromNode = (nameOrAddressOrInstance, config) => {
212
+ return useWeakModuleFromNode(nameOrAddressOrInstance, { identity: isSentinelInstance2, ...config });
213
+ };
214
+
215
+ // src/hooks/node/useWeakSentinelsFromNode.tsx
216
+ import { exists } from "@xylabs/exists";
217
+ import { useWeakModulesFromNode } from "@xyo-network/react-node";
218
+ import { asSentinelInstance as asSentinelInstance2 } from "@xyo-network/sentinel-model";
219
+ var useWeakSentinelsFromNode = (filter, config) => {
220
+ const [modules, error] = useWeakModulesFromNode(filter, config);
221
+ if (error) {
222
+ return [null, error];
223
+ }
224
+ return [
225
+ (modules == null ? void 0 : modules.map((mod) => {
226
+ const instance = asSentinelInstance2(mod == null ? void 0 : mod.deref());
227
+ if (instance) {
228
+ return new WeakRef(instance);
229
+ }
230
+ }).filter(exists)) ?? [],
231
+ void 0
232
+ ];
233
+ };
234
+ export {
235
+ SentinelCard,
236
+ SentinelCardContent,
237
+ SentinelCardHeader,
238
+ SentinelContext,
239
+ SentinelProvider,
240
+ SentinelReportStatus,
241
+ useSentinelContext,
242
+ useSentinelFromNode,
243
+ useSentinelsFromNode,
244
+ useWeakSentinelFromNode,
245
+ useWeakSentinelsFromNode
246
+ };
2
247
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/Card/Card.tsx","../../src/components/Card/CardActions.tsx","../../src/components/Card/CardContent.tsx","../../src/components/Card/CardHeader.tsx","../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/State.ts","../../src/contexts/use.ts","../../src/hooks/node/useSentinelFromNode.tsx","../../src/hooks/node/useSentinelsFromNode.tsx","../../src/hooks/node/useWeakSentinelFromNode.tsx","../../src/hooks/node/useWeakSentinelsFromNode.tsx"],"sourcesContent":["import { Card, CardProps } from '@mui/material'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { useState } from 'react'\n\nimport { SentinelCardActions } from './CardActions'\nimport { SentinelCardContent } from './CardContent'\nimport { SentinelCardHeader } from './CardHeader'\n\nexport type SentinelCardProps = CardProps &\n ModuleRenderProps<SentinelInstance> & {\n inPayloads?: Payload[]\n }\n\nexport const SentinelCard: React.FC<SentinelCardProps> = ({ children, inPayloads, mod, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await mod?.report(inPayloads)\n }\n }, [mod, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader mod={mod} />\n <SentinelCardContent mod={mod} report={report} />\n {children}\n <SentinelCardActions mod={mod} onReport={() => setRetry(retry + 1)} />\n </Card>\n )\n}\n","import { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleCardActions, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &\n CardActionsProps & {\n onReport?: (mod?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, mod, ...props }) => {\n return (\n <ModuleCardActions mod={mod} {...props}>\n <ButtonEx onClick={() => onReport?.(mod)} size={'small'} variant={'outlined'}>\n Report\n </ButtonEx>\n </ModuleCardActions>\n )\n}\n","import { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleCardContent, ModuleRenderProps } from '@xyo-network/react-module'\nimport { JsonViewerEx } from '@xyo-network/react-payload-raw-info'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\n\nexport type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &\n CardContentProps & {\n report?: Payload[]\n }\n\nexport const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ children, report, mod, ...props }) => {\n return (\n <ModuleCardContent mod={mod} {...props}>\n <FlexGrowRow flexWrap=\"wrap\" justifyContent=\"start\" gap={2}>\n {report ?\n <JsonViewerEx value={report} />\n : null}\n {children}\n </FlexGrowRow>\n </ModuleCardContent>\n )\n}\n","import { CardHeaderProps } from '@mui/material'\nimport { ModuleCardHeader, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({ title, mod, ...props }) => {\n return <ModuleCardHeader mod={mod} title={title ?? mod?.config.name ?? 'Sentinel'} {...props} />\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel } from '@xyo-network/sentinel-memory'\nimport { SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel-model'\nimport { asWitnessInstance, WitnessInstance } from '@xyo-network/witness-model'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n synchronous: true,\n // eslint-disable-next-line id-denylist\n tasks: witnesses?.map((mod) => ({ module: mod.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module: mod, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([new Error(`Witness failed [${mod?.config?.name ?? mod.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n if (witnesses)\n for (const witness of witnesses) {\n offCallbacks.push(\n witness.on('observeEnd', ({ module: mod, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`),\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module: mod }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`),\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n }\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n for (const callback of offCallbacks) {\n callback()\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ?\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel-model'\nimport { WitnessModule } from '@xyo-network/witness-model'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","// eslint-disable-next-line import/no-deprecated\nimport { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n // eslint-disable-next-line deprecation/deprecation, import/no-deprecated\n const [mod, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(mod)\n if (mod && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${mod.config?.schema}:${mod.config?.name}:${mod.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\n// eslint-disable-next-line import/no-deprecated\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n // eslint-disable-next-line deprecation/deprecation, import/no-deprecated\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules ?\n [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, mod) => {\n if (isSentinelInstance(mod)) {\n prev.push(mod)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import { useWeakModuleFromNode, WeakModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: WeakModuleFromNodeConfig,\n): [WeakRef<SentinelInstance> | undefined, Error | undefined] => {\n return useWeakModuleFromNode<SentinelInstance>(nameOrAddressOrInstance, { identity: isSentinelInstance, ...config })\n}\n","import { exists } from '@xylabs/exists'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useWeakModulesFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [WeakRef<SentinelInstance>[] | null | undefined, Error | undefined] => {\n const [modules, error] = useWeakModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return [\n modules\n ?.map((mod) => {\n const instance = asSentinelInstance(mod?.deref())\n if (instance) {\n return new WeakRef(instance)\n }\n })\n .filter(exists) ?? [],\n undefined,\n ]\n}\n"],"mappings":"AAAA,OAAS,QAAAA,MAAuB,gBAChC,OAAS,cAAAC,MAAkB,wBAI3B,OAAS,YAAAC,MAAgB,QCJzB,OAAS,YAAAC,MAAgB,uBACzB,OAAS,qBAAAC,MAA4C,4BAW/C,cAAAC,MAAA,oBAHC,IAAMC,EAA0D,CAAC,CAAE,SAAAC,EAAU,IAAAC,EAAK,GAAGC,CAAM,IAE9FJ,EAACD,EAAA,CAAkB,IAAKI,EAAM,GAAGC,EAC/B,SAAAJ,EAACF,EAAA,CAAS,QAAS,IAAMI,GAAA,YAAAA,EAAWC,GAAM,KAAM,QAAS,QAAS,WAAY,kBAE9E,EACF,ECfJ,OAAS,eAAAE,MAAmB,wBAE5B,OAAS,qBAAAC,MAA4C,4BACrD,OAAS,gBAAAC,MAAoB,sCAYvB,OAEI,OAAAC,EAFJ,QAAAC,MAAA,oBAHC,IAAMC,EAA0D,CAAC,CAAE,SAAAC,EAAU,OAAAC,EAAQ,IAAAC,EAAK,GAAGC,CAAM,IAEtGN,EAACF,EAAA,CAAkB,IAAKO,EAAM,GAAGC,EAC/B,SAAAL,EAACJ,EAAA,CAAY,SAAS,OAAO,eAAe,QAAQ,IAAK,EACtD,UAAAO,EACCJ,EAACD,EAAA,CAAa,MAAOK,EAAQ,EAC7B,KACDD,GACH,EACF,ECrBJ,OAAS,oBAAAI,MAA2C,4BAI3C,cAAAC,MAAA,oBADF,IAAMC,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GAAQ,CACb,IAAMC,EAAWP,GAAmBM,GAAA,YAAAA,EAAK,OAAO,EAChD,GAAIC,EACF,OAAO,IAAI,QAAQA,CAAQ,CAE/B,GACC,OAAOT,MAAW,CAAC,EACtB,MACF,CACF","names":["Card","usePromise","useState","ButtonEx","ModuleCardActions","jsx","SentinelCardActions","onReport","mod","props","FlexGrowRow","ModuleCardContent","JsonViewerEx","jsx","jsxs","SentinelCardContent","children","report","mod","props","ModuleCardHeader","jsx","SentinelCardHeader","title","mod","props","jsx","jsxs","SentinelCard","children","inPayloads","mod","props","retry","setRetry","useState","report","usePromise","Card","SentinelCardHeader","SentinelCardContent","SentinelCardActions","createContextEx","SentinelContext","useAsyncEffect","useWitnessesFromNode","MemorySentinel","SentinelConfigSchema","asWitnessInstance","useEffect","useState","SentinelReportStatus","jsx","SentinelProvider","account","archivist","children","filter","name","required","sentinel","setSentinel","useState","history","setHistory","progress","setProgress","status","setStatus","reportingErrors","setReportingErrors","witnesses","useWitnessesFromNode","useAsyncEffect","mounted","MemorySentinel","SentinelConfigSchema","mod","offCallbacks","outPayloads","_a","witness","asWitnessInstance","callback","useEffect","SentinelContext","useContextEx","useSentinelContext","sentinel","history","progress","reportingErrors","status","useContextEx","SentinelContext","useModuleFromNode","asSentinelInstance","useSentinelFromNode","nameOrAddressOrInstance","config","_a","_b","mod","error","instance","useModulesFromNode","isSentinelInstance","useSentinelsFromNode","filter","config","modules","error","prev","mod","useWeakModuleFromNode","isSentinelInstance","useWeakSentinelFromNode","nameOrAddressOrInstance","config","exists","useWeakModulesFromNode","asSentinelInstance","useWeakSentinelsFromNode","filter","config","modules","error","mod","instance"]}
1
+ {"version":3,"sources":["../../src/components/Card/Card.tsx","../../src/components/Card/CardActions.tsx","../../src/components/Card/CardContent.tsx","../../src/components/Card/CardHeader.tsx","../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/State.ts","../../src/contexts/use.ts","../../src/hooks/node/useSentinelFromNode.tsx","../../src/hooks/node/useSentinelsFromNode.tsx","../../src/hooks/node/useWeakSentinelFromNode.tsx","../../src/hooks/node/useWeakSentinelsFromNode.tsx"],"sourcesContent":["import { Card, CardProps } from '@mui/material'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { useState } from 'react'\n\nimport { SentinelCardActions } from './CardActions'\nimport { SentinelCardContent } from './CardContent'\nimport { SentinelCardHeader } from './CardHeader'\n\nexport type SentinelCardProps = CardProps &\n ModuleRenderProps<SentinelInstance> & {\n inPayloads?: Payload[]\n }\n\nexport const SentinelCard: React.FC<SentinelCardProps> = ({ children, inPayloads, mod, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await mod?.report(inPayloads)\n }\n }, [mod, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader mod={mod} />\n <SentinelCardContent mod={mod} report={report} />\n {children}\n <SentinelCardActions mod={mod} onReport={() => setRetry(retry + 1)} />\n </Card>\n )\n}\n","import { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleCardActions, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &\n CardActionsProps & {\n onReport?: (mod?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, mod, ...props }) => {\n return (\n <ModuleCardActions mod={mod} {...props}>\n <ButtonEx onClick={() => onReport?.(mod)} size={'small'} variant={'outlined'}>\n Report\n </ButtonEx>\n </ModuleCardActions>\n )\n}\n","import { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleCardContent, ModuleRenderProps } from '@xyo-network/react-module'\nimport { JsonViewerEx } from '@xyo-network/react-payload-raw-info'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\n\nexport type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &\n CardContentProps & {\n report?: Payload[]\n }\n\nexport const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ children, report, mod, ...props }) => {\n return (\n <ModuleCardContent mod={mod} {...props}>\n <FlexGrowRow flexWrap=\"wrap\" justifyContent=\"start\" gap={2}>\n {report ?\n <JsonViewerEx value={report} />\n : null}\n {children}\n </FlexGrowRow>\n </ModuleCardContent>\n )\n}\n","import { CardHeaderProps } from '@mui/material'\nimport { ModuleCardHeader, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({ title, mod, ...props }) => {\n return <ModuleCardHeader mod={mod} title={title ?? mod?.config.name ?? 'Sentinel'} {...props} />\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel } from '@xyo-network/sentinel-memory'\nimport { SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel-model'\nimport { asWitnessInstance, WitnessInstance } from '@xyo-network/witness-model'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n synchronous: true,\n // eslint-disable-next-line id-denylist\n tasks: witnesses?.map((mod) => ({ module: mod.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module: mod, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([new Error(`Witness failed [${mod?.config?.name ?? mod.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n if (witnesses)\n for (const witness of witnesses) {\n offCallbacks.push(\n witness.on('observeEnd', ({ module: mod, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`),\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module: mod }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`),\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n }\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n for (const callback of offCallbacks) {\n callback()\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ?\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel-model'\nimport { WitnessModule } from '@xyo-network/witness-model'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","// eslint-disable-next-line import/no-deprecated\nimport { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n // eslint-disable-next-line deprecation/deprecation, import/no-deprecated\n const [mod, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(mod)\n if (mod && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${mod.config?.schema}:${mod.config?.name}:${mod.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\n// eslint-disable-next-line import/no-deprecated\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n // eslint-disable-next-line deprecation/deprecation, import/no-deprecated\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules ?\n [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, mod) => {\n if (isSentinelInstance(mod)) {\n prev.push(mod)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import { useWeakModuleFromNode, WeakModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: WeakModuleFromNodeConfig,\n): [WeakRef<SentinelInstance> | undefined, Error | undefined] => {\n return useWeakModuleFromNode<SentinelInstance>(nameOrAddressOrInstance, { identity: isSentinelInstance, ...config })\n}\n","import { exists } from '@xylabs/exists'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useWeakModulesFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [WeakRef<SentinelInstance>[] | null | undefined, Error | undefined] => {\n const [modules, error] = useWeakModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return [\n modules\n ?.map((mod) => {\n const instance = asSentinelInstance(mod?.deref())\n if (instance) {\n return new WeakRef(instance)\n }\n })\n .filter(exists) ?? [],\n undefined,\n ]\n}\n"],"mappings":";AAAA,SAAS,YAAuB;AAChC,SAAS,kBAAkB;AAI3B,SAAS,gBAAgB;;;ACJzB,SAAS,gBAAgB;AACzB,SAAS,yBAA4C;AAW/C;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,KAAK,GAAG,MAAM,MAAM;AACtG,SACE,oBAAC,qBAAkB,KAAW,GAAG,OAC/B,8BAAC,YAAS,SAAS,MAAM,qCAAW,MAAM,MAAM,SAAS,SAAS,YAAY,oBAE9E,GACF;AAEJ;;;ACjBA,SAAS,mBAAmB;AAE5B,SAAS,yBAA4C;AACrD,SAAS,oBAAoB;AAYvB,SAEI,OAAAA,MAFJ;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,KAAK,GAAG,MAAM,MAAM;AAC9G,SACE,gBAAAA,KAAC,qBAAkB,KAAW,GAAG,OAC/B,+BAAC,eAAY,UAAS,QAAO,gBAAe,SAAQ,KAAK,GACtD;AAAA,aACC,gBAAAA,KAAC,gBAAa,OAAO,QAAQ,IAC7B;AAAA,IACD;AAAA,KACH,GACF;AAEJ;;;ACvBA,SAAS,wBAA2C;AAI3C,gBAAAC,YAAA;AADF,IAAM,qBAAsF,CAAC,EAAE,OAAO,KAAK,GAAG,MAAM,MAAM;AAC/H,SAAO,gBAAAA,KAAC,oBAAiB,KAAU,OAAO,UAAS,2BAAK,OAAO,SAAQ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AO;AAAA,KACL,mCACI,IAAI,CAAC,QAAQ;AACb,YAAM,WAAWA,oBAAmB,2BAAK,OAAO;AAChD,UAAI,UAAU;AACZ,eAAO,IAAI,QAAQ,QAAQ;AAAA,MAC7B;AAAA,IACF,GACC,OAAO,YAAW,CAAC;AAAA,IACtB;AAAA,EACF;AACF;","names":["jsx","jsx","jsx","jsxs","useState","SentinelReportStatus","jsx","useState","sentinel","witnesses","error","isSentinelInstance","asSentinelInstance"]}
package/package.json CHANGED
@@ -10,34 +10,34 @@
10
10
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/exists": "^3.5.1",
13
+ "@xylabs/exists": "^3.5.2",
14
14
  "@xylabs/react-async-effect": "^3.1.7",
15
15
  "@xylabs/react-button": "^3.1.7",
16
16
  "@xylabs/react-flexbox": "^3.1.7",
17
17
  "@xylabs/react-promise": "^3.1.7",
18
18
  "@xylabs/react-shared": "^3.1.7",
19
- "@xyo-network/account-model": "^2.107.0",
20
- "@xyo-network/archivist-model": "^2.107.0",
21
- "@xyo-network/boundwitness-model": "^2.107.0",
22
- "@xyo-network/module-model": "^2.107.0",
23
- "@xyo-network/payload-model": "^2.107.0",
24
- "@xyo-network/react-module": "~2.78.0",
25
- "@xyo-network/react-node": "~2.78.0",
26
- "@xyo-network/react-payload-raw-info": "~2.78.0",
27
- "@xyo-network/react-shared": "~2.78.0",
28
- "@xyo-network/react-witness": "~2.78.0",
29
- "@xyo-network/sentinel-memory": "^2.107.0",
30
- "@xyo-network/sentinel-model": "^2.107.0",
31
- "@xyo-network/witness-model": "^2.107.0"
19
+ "@xyo-network/account-model": "^2.107.6",
20
+ "@xyo-network/archivist-model": "^2.107.6",
21
+ "@xyo-network/boundwitness-model": "^2.107.6",
22
+ "@xyo-network/module-model": "^2.107.6",
23
+ "@xyo-network/payload-model": "^2.107.6",
24
+ "@xyo-network/react-module": "^2.78.2",
25
+ "@xyo-network/react-node": "^2.78.2",
26
+ "@xyo-network/react-payload-raw-info": "^2.78.2",
27
+ "@xyo-network/react-shared": "^2.78.2",
28
+ "@xyo-network/react-witness": "^2.78.2",
29
+ "@xyo-network/sentinel-memory": "^2.107.6",
30
+ "@xyo-network/sentinel-model": "^2.107.6",
31
+ "@xyo-network/witness-model": "^2.107.6"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@storybook/react": "^7.6.20",
35
- "@xylabs/ts-scripts-yarn3": "^3.11.8",
36
- "@xylabs/tsconfig-react": "^3.11.8",
37
- "@xyo-network/account": "^2.107.0",
38
- "@xyo-network/evm-call-witness": "^2.97.0",
39
- "@xyo-network/manifest": "^2.107.0",
40
- "@xyo-network/module-factory-locator": "^2.107.0",
35
+ "@xylabs/ts-scripts-yarn3": "^3.11.12",
36
+ "@xylabs/tsconfig-react": "^3.11.12",
37
+ "@xyo-network/account": "^2.107.6",
38
+ "@xyo-network/evm-call-witness": "^2.97.1",
39
+ "@xyo-network/manifest": "^2.107.6",
40
+ "@xyo-network/module-factory-locator": "^2.107.6",
41
41
  "ethers": "^6.13.1",
42
42
  "typescript": "^5.5.2"
43
43
  },
@@ -107,6 +107,6 @@
107
107
  },
108
108
  "sideEffects": false,
109
109
  "types": "dist/browser/index.d.ts",
110
- "version": "2.78.0",
110
+ "version": "2.78.2",
111
111
  "type": "module"
112
112
  }