@xyo-network/react-sentinel 2.75.2 → 2.75.3

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,"file":"useSentinelFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAqB,MAAM,yBAAyB,CAAA;AACjF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,mBAAmB,6BACJ,MAAM,GAAG,gBAAgB,WAC1C,oBAAoB,KAC5B,CAAC,gBAAgB,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CASlD,CAAA"}
1
+ {"version":3,"file":"useSentinelFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelFromNode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAqB,MAAM,yBAAyB,CAAA;AACjF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,mBAAmB,6BACJ,MAAM,GAAG,gBAAgB,WAC1C,oBAAoB,KAC5B,CAAC,gBAAgB,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAUlD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSentinelFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAqB,MAAM,yBAAyB,CAAA;AACjF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,mBAAmB,6BACJ,MAAM,GAAG,gBAAgB,WAC1C,oBAAoB,KAC5B,CAAC,gBAAgB,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CASlD,CAAA"}
1
+ {"version":3,"file":"useSentinelFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelFromNode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAqB,MAAM,yBAAyB,CAAA;AACjF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,mBAAmB,6BACJ,MAAM,GAAG,gBAAgB,WAC1C,oBAAoB,KAC5B,CAAC,gBAAgB,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAUlD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSentinelFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAqB,MAAM,yBAAyB,CAAA;AACjF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,mBAAmB,6BACJ,MAAM,GAAG,gBAAgB,WAC1C,oBAAoB,KAC5B,CAAC,gBAAgB,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CASlD,CAAA"}
1
+ {"version":3,"file":"useSentinelFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelFromNode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAqB,MAAM,yBAAyB,CAAA;AACjF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,mBAAmB,6BACJ,MAAM,GAAG,gBAAgB,WAC1C,oBAAoB,KAC5B,CAAC,gBAAgB,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAUlD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSentinelsFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelsFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAA;AAClF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,oBAAoB,YACtB,YAAY,WACZ,oBAAoB,KAC5B,CAAC,gBAAgB,EAAE,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAiB3D,CAAA"}
1
+ {"version":3,"file":"useSentinelsFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelsFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAA;AAClF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,oBAAoB,YACtB,YAAY,WACZ,oBAAoB,KAC5B,CAAC,gBAAgB,EAAE,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAkB3D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSentinelsFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelsFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAA;AAClF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,oBAAoB,YACtB,YAAY,WACZ,oBAAoB,KAC5B,CAAC,gBAAgB,EAAE,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAiB3D,CAAA"}
1
+ {"version":3,"file":"useSentinelsFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelsFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAA;AAClF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,oBAAoB,YACtB,YAAY,WACZ,oBAAoB,KAC5B,CAAC,gBAAgB,EAAE,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAkB3D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSentinelsFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelsFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAA;AAClF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,oBAAoB,YACtB,YAAY,WACZ,oBAAoB,KAC5B,CAAC,gBAAgB,EAAE,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAiB3D,CAAA"}
1
+ {"version":3,"file":"useSentinelsFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelsFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAA;AAClF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,oBAAoB,YACtB,YAAY,WACZ,oBAAoB,KAC5B,CAAC,gBAAgB,EAAE,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAkB3D,CAAA"}
@@ -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, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} 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?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} 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, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...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, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.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 tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, 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 [${module?.config?.name ?? module.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, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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 }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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","import { 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 const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\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 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, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import { ModuleFromNodeConfig, useWeakModuleFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\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((module) => {\n const instance = asSentinelInstance(module?.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,QAAAA,SAAQ,GAAG,MAAM,MAAM;AACzG,SACE,4CAAC,yCAAkB,QAAQA,SAAS,GAAG,OACrC,sDAAC,gCAAS,SAAS,MAAM,WAAWA,OAAM,GAAG,MAAM,SAAS,SAAS,YAAY,oBAEjF,GACF;AAEJ;;;ACjBA,2BAA4B;AAE5B,IAAAC,uBAAqD;AACrD,oCAA6B;AAYvB,IAAAC,sBAAA;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,QAAAC,SAAQ,GAAG,MAAM,MAAM;AACjH,SACE,6CAAC,0CAAkB,QAAQA,SAAS,GAAG,OACrC,wDAAC,oCAAY,UAAS,QAAO,gBAAe,SAAQ,KAAK,GACtD;AAAA,aACC,6CAAC,8CAAa,OAAO,QAAQ,IAC7B;AAAA,IACD;AAAA,KACH,GACF;AAEJ;;;ACvBA,IAAAC,uBAAoD;AAI3C,IAAAC,sBAAA;AADF,IAAM,qBAAsF,CAAC,EAAE,OAAO,QAAAC,SAAQ,GAAG,MAAM,MAAM;AAClI,SAAO,6CAAC,yCAAiB,QAAQA,SAAQ,OAAO,SAASA,SAAQ,OAAO,QAAQ,YAAa,GAAG,OAAO;AACzG;;;AHkBI,IAAAC,sBAAA;AARG,IAAM,eAA4C,C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A,OAAO,oBAAM,KAAK,CAAC;AAAA,IACtB;AAAA,EACF;AACF;","names":["module","import_react_module","import_jsx_runtime","module","import_react_module","import_jsx_runtime","module","import_jsx_runtime","module","import_react","SentinelReportStatus","import_jsx_runtime","sentinel","module","witnesses","import_react_shared","import_sentinel_model","module","error","import_react_node","import_sentinel_model","module","import_react_node","import_sentinel_model","import_react_node","import_sentinel_model","module"]}
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, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} 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?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} 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, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...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, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.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 tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, 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 [${module?.config?.name ?? module.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, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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 }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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 [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.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, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import { ModuleFromNodeConfig, useWeakModuleFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\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((module) => {\n const instance = asSentinelInstance(module?.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,QAAAA,SAAQ,GAAG,MAAM,MAAM;AACzG,SACE,4CAAC,yCAAkB,QAAQA,SAAS,GAAG,OACrC,sDAAC,gCAAS,SAAS,MAAM,WAAWA,OAAM,GAAG,MAAM,SAAS,SAAS,YAAY,oBAEjF,GACF;AAEJ;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L;AAAA,EACF,IACA,CAAC,SAAS,KAAK;AACrB;;;AC1BA,IAAAC,qBAA4D;AAC5D,IAAAC,yBAAqD;AAE9C,IAAM,0BAA0B,CACrC,yBACA,WAC+D;AAC/D,aAAO,0CAAwC,yBAAyB,EAAE,UAAU,2CAAoB,GAAG,OAAO,CAAC;AACrH;;;ACRA,oBAAuB;AAEvB,IAAAC,qBAA6D;AAC7D,IAAAC,yBAAqD;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,IACL,SACI,IAAI,CAACC,YAAW;AAChB,YAAM,eAAW,2CAAmBA,SAAQ,MAAM,CAAC;AACnD,UAAI,UAAU;AACZ,eAAO,IAAI,QAAQ,QAAQ;AAAA,MAC7B;AAAA,IACF,CAAC,EACA,OAAO,oBAAM,KAAK,CAAC;AAAA,IACtB;AAAA,EACF;AACF;","names":["module","import_react_module","import_jsx_runtime","module","import_react_module","import_jsx_runtime","module","import_jsx_runtime","module","import_react","SentinelReportStatus","import_jsx_runtime","sentinel","module","witnesses","import_react_shared","import_sentinel_model","module","error","import_react_node","import_sentinel_model","module","import_react_node","import_sentinel_model","import_react_node","import_sentinel_model","module"]}
@@ -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, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} 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?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} 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, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...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, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.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 tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, 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 [${module?.config?.name ?? module.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, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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 }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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","import { 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 const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\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 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, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import { ModuleFromNodeConfig, useWeakModuleFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\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((module) => {\n const instance = asSentinelInstance(module?.deref())\n if (instance) {\n return new WeakRef(instance)\n }\n })\n .filter(exists) ?? [],\n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B,0BAA0B;AACzD,SAAS,0BAA4C;AAE9C,IAAM,uBAAuB,CAClC,QACA,WAC+D;AAC/D,QAAM,CAAC,SAAS,KAAK,IAAI,mBAAmB,QAAQ,MAAM;AAC1D,MAAI,OAAO;AACT,WAAO,CAAC,MAAM,KAAK;AAAA,EACrB;AACA,SAAO,UACH;AAAA;AAAA,IAEE,QAAQ,OAA2B,CAAC,MAAM,WAAW;AACnD,UAAI,mBAAmB,MAAM,GAAG;AAC9B,aAAK,KAAK,MAAM;AAAA,MAClB;AACA,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,IACL;AAAA,EACF,IACA,CAAC,SAAS,KAAK;AACrB;;;ACxBA,SAA+B,6BAA6B;AAC5D,SAAS,sBAAAC,2BAA4C;AAE9C,IAAM,0BAA0B,CACrC,yBACA,WAC+D;AAC/D,SAAO,sBAAwC,yBAAyB,EAAE,UAAUA,qBAAoB,GAAG,OAAO,CAAC;AACrH;;;ACRA,SAAS,cAAc;AAEvB,SAA+B,8BAA8B;AAC7D,SAAS,sBAAAC,2BAA4C;AAE9C,IAAM,2BAA2B,CACtC,QACA,WACwE;AACxE,QAAM,CAAC,SAAS,KAAK,IAAI,uBAAuB,QAAQ,MAAM;AAC9D,MAAI,OAAO;AACT,WAAO,CAAC,MAAM,KAAK;AAAA,EACrB;AACA,SAAO;AAAA,IACL,SACI,IAAI,CAAC,WAAW;AAChB,YAAM,WAAWA,oBAAmB,QAAQ,MAAM,CAAC;AACnD,UAAI,UAAU;AACZ,eAAO,IAAI,QAAQ,QAAQ;AAAA,MAC7B;AAAA,IACF,CAAC,EACA,OAAO,MAAM,KAAK,CAAC;AAAA,IACtB;AAAA,EACF;AACF;","names":["jsx","jsx","jsx","jsxs","useState","SentinelReportStatus","jsx","useState","sentinel","witnesses","error","isSentinelInstance","asSentinelInstance"]}
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, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} 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?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} 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, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...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, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.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 tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, 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 [${module?.config?.name ?? module.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, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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 }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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 [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.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, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import { ModuleFromNodeConfig, useWeakModuleFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\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((module) => {\n const instance = asSentinelInstance(module?.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,QAAQ,GAAG,MAAM,MAAM;AACzG,SACE,oBAAC,qBAAkB,QAAiB,GAAG,OACrC,8BAAC,YAAS,SAAS,MAAM,WAAW,MAAM,GAAG,MAAM,SAAS,SAAS,YAAY,oBAEjF,GACF;AAEJ;;;ACjBA,SAAS,mBAAmB;AAE5B,SAAS,yBAA4C;AACrD,SAAS,oBAAoB;AAYvB,SAEI,OAAAA,MAFJ;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,QAAQ,GAAG,MAAM,MAAM;AACjH,SACE,gBAAAA,KAAC,qBAAkB,QAAiB,GAAG,OACrC,+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,QAAQ,GAAG,MAAM,MAAM;AAClI,SAAO,gBAAAA,KAAC,oBAAi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AA,IACL,SACI,IAAI,CAAC,WAAW;AAChB,YAAM,WAAWA,oBAAmB,QAAQ,MAAM,CAAC;AACnD,UAAI,UAAU;AACZ,eAAO,IAAI,QAAQ,QAAQ;AAAA,MAC7B;AAAA,IACF,CAAC,EACA,OAAO,MAAM,KAAK,CAAC;AAAA,IACtB;AAAA,EACF;AACF;","names":["jsx","jsx","jsx","jsxs","useState","SentinelReportStatus","jsx","useState","sentinel","witnesses","error","isSentinelInstance","asSentinelInstance"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useSentinelFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAqB,MAAM,yBAAyB,CAAA;AACjF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,mBAAmB,6BACJ,MAAM,GAAG,gBAAgB,WAC1C,oBAAoB,KAC5B,CAAC,gBAAgB,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CASlD,CAAA"}
1
+ {"version":3,"file":"useSentinelFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelFromNode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAqB,MAAM,yBAAyB,CAAA;AACjF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,mBAAmB,6BACJ,MAAM,GAAG,gBAAgB,WAC1C,oBAAoB,KAC5B,CAAC,gBAAgB,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAUlD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSentinelFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAqB,MAAM,yBAAyB,CAAA;AACjF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,mBAAmB,6BACJ,MAAM,GAAG,gBAAgB,WAC1C,oBAAoB,KAC5B,CAAC,gBAAgB,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CASlD,CAAA"}
1
+ {"version":3,"file":"useSentinelFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelFromNode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAqB,MAAM,yBAAyB,CAAA;AACjF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,mBAAmB,6BACJ,MAAM,GAAG,gBAAgB,WAC1C,oBAAoB,KAC5B,CAAC,gBAAgB,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAUlD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSentinelFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAqB,MAAM,yBAAyB,CAAA;AACjF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,mBAAmB,6BACJ,MAAM,GAAG,gBAAgB,WAC1C,oBAAoB,KAC5B,CAAC,gBAAgB,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CASlD,CAAA"}
1
+ {"version":3,"file":"useSentinelFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelFromNode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAqB,MAAM,yBAAyB,CAAA;AACjF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,mBAAmB,6BACJ,MAAM,GAAG,gBAAgB,WAC1C,oBAAoB,KAC5B,CAAC,gBAAgB,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAUlD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSentinelsFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelsFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAA;AAClF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,oBAAoB,YACtB,YAAY,WACZ,oBAAoB,KAC5B,CAAC,gBAAgB,EAAE,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAiB3D,CAAA"}
1
+ {"version":3,"file":"useSentinelsFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelsFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAA;AAClF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,oBAAoB,YACtB,YAAY,WACZ,oBAAoB,KAC5B,CAAC,gBAAgB,EAAE,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAkB3D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSentinelsFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelsFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAA;AAClF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,oBAAoB,YACtB,YAAY,WACZ,oBAAoB,KAC5B,CAAC,gBAAgB,EAAE,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAiB3D,CAAA"}
1
+ {"version":3,"file":"useSentinelsFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelsFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAA;AAClF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,oBAAoB,YACtB,YAAY,WACZ,oBAAoB,KAC5B,CAAC,gBAAgB,EAAE,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAkB3D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSentinelsFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelsFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAA;AAClF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,oBAAoB,YACtB,YAAY,WACZ,oBAAoB,KAC5B,CAAC,gBAAgB,EAAE,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAiB3D,CAAA"}
1
+ {"version":3,"file":"useSentinelsFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelsFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,EAAE,oBAAoB,EAAsB,MAAM,yBAAyB,CAAA;AAClF,OAAO,EAAsB,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAElF,eAAO,MAAM,oBAAoB,YACtB,YAAY,WACZ,oBAAoB,KAC5B,CAAC,gBAAgB,EAAE,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAkB3D,CAAA"}
@@ -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, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} 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?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} 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, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...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, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.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 tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, 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 [${module?.config?.name ?? module.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, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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 }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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","import { 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 const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\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 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, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import { ModuleFromNodeConfig, useWeakModuleFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\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((module) => {\n const instance = asSentinelInstance(module?.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,QAAAA,SAAQ,GAAG,MAAM,MAAM;AACzG,SACE,4CAAC,yCAAkB,QAAQA,SAAS,GAAG,OACrC,sDAAC,gCAAS,SAAS,MAAM,qCAAWA,UAAS,MAAM,SAAS,SAAS,YAAY,oBAEjF,GACF;AAEJ;;;ACjBA,2BAA4B;AAE5B,IAAAC,uBAAqD;AACrD,oCAA6B;AAYvB,IAAAC,sBAAA;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,QAAAC,SAAQ,GAAG,MAAM,MAAM;AACjH,SACE,6CAAC,0CAAkB,QAAQA,SAAS,GAAG,OACrC,wDAAC,oCAAY,UAAS,QAAO,gBAAe,SAAQ,KAAK,GACtD;AAAA,aACC,6CAAC,8CAAa,OAAO,QAAQ,IAC7B;AAAA,IACD;AAAA,KACH,GACF;AAEJ;;;ACvBA,IAAAC,uBAAoD;AAI3C,IAAAC,sBAAA;AADF,IAAM,qBAAsF,CAAC,EAA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SAAS,KAAK,QAAI,2CAAuB,QAAQ,MAAM;AAC9D,MAAI,OAAO;AACT,WAAO,CAAC,MAAM,KAAK;AAAA,EACrB;AACA,SAAO;AAAA,KACL,mCACI,IAAI,CAACC,YAAW;AAChB,YAAM,eAAW,2CAAmBA,WAAA,gBAAAA,QAAQ,OAAO;AACnD,UAAI,UAAU;AACZ,eAAO,IAAI,QAAQ,QAAQ;AAAA,MAC7B;AAAA,IACF,GACC,OAAO,0BAAW,CAAC;AAAA,IACtB;AAAA,EACF;AACF;","names":["module","import_react_module","import_jsx_runtime","module","import_react_module","import_jsx_runtime","module","import_jsx_runtime","module","import_react","SentinelReportStatus","import_jsx_runtime","sentinel","module","witnesses","import_react_shared","import_sentinel_model","module","error","import_react_node","import_sentinel_model","module","import_react_node","import_sentinel_model","import_react_node","import_sentinel_model","module"]}
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, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} 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?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} 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, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...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, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.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 tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, 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 [${module?.config?.name ?? module.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, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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 }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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 [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.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, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import { ModuleFromNodeConfig, useWeakModuleFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\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((module) => {\n const instance = asSentinelInstance(module?.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,2BAA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C,yBAAqD;AAE9C,IAAM,uBAAuB,CAClC,QACA,WAC+D;AAE/D,QAAM,CAAC,SAAS,KAAK,QAAI,uCAAmB,QAAQ,MAAM;AAC1D,MAAI,OAAO;AACT,WAAO,CAAC,MAAM,KAAK;AAAA,EACrB;AACA,SAAO,UACH;AAAA;AAAA,IAEE,QAAQ,OAA2B,CAAC,MAAMC,YAAW;AACnD,cAAI,2CAAmBA,OAAM,GAAG;AAC9B,aAAK,KAAKA,OAAM;AAAA,MAClB;AACA,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,IACL;AAAA,EACF,IACA,CAAC,SAAS,KAAK;AACrB;;;AC1BA,IAAAC,qBAA4D;AAC5D,IAAAC,yBAAqD;AAE9C,IAAM,0BAA0B,CACrC,yBACA,WAC+D;AAC/D,aAAO,0CAAwC,yBAAyB,EAAE,UAAU,2CAAoB,GAAG,OAAO,CAAC;AACrH;;;ACRA,oBAAuB;AAEvB,IAAAC,qBAA6D;AAC7D,IAAAC,yBAAqD;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,CAACC,YAAW;AAChB,YAAM,eAAW,2CAAmBA,WAAA,gBAAAA,QAAQ,OAAO;AACnD,UAAI,UAAU;AACZ,eAAO,IAAI,QAAQ,QAAQ;AAAA,MAC7B;AAAA,IACF,GACC,OAAO,0BAAW,CAAC;AAAA,IACtB;AAAA,EACF;AACF;","names":["module","import_react_module","import_jsx_runtime","module","import_react_module","import_jsx_runtime","module","import_jsx_runtime","module","import_react","SentinelReportStatus","import_jsx_runtime","sentinel","module","witnesses","import_react_shared","import_sentinel_model","module","error","import_react_node","import_sentinel_model","module","import_react_node","import_sentinel_model","import_react_node","import_sentinel_model","module"]}
@@ -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, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} 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?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} 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, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...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, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.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 tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, 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 [${module?.config?.name ?? module.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, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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 }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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","import { 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 const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\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 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, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import { ModuleFromNodeConfig, useWeakModuleFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\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((module) => {\n const instance = asSentinelInstance(module?.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,QAAQ,GAAG,MAAM,MAAM;AACzG,SACE,oBAAC,qBAAkB,QAAiB,GAAG,OACrC,8BAAC,YAAS,SAAS,MAAM,qCAAW,SAAS,MAAM,SAAS,SAAS,YAAY,oBAEjF,GACF;AAEJ;;;ACjBA,SAAS,mBAAmB;AAE5B,SAAS,yBAA4C;AACrD,SAAS,oBAAoB;AAYvB,SAEI,OAAAA,MAFJ;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,QAAQ,GAAG,MAAM,MAAM;AACjH,SACE,gBAAAA,KAAC,qBAAkB,QAAiB,GAAG,OACrC,+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,QAAQ,GAAG,MAAM,MAAM;AAClI,SAAO,gBAAAA,KAAC,oBAAiB,QAAgB,OAAO,UAAS,iCAAQ,OAAO,SAAQ,YAAa,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AI,CAAC,WAAW;AAChB,YAAM,WAAWA,oBAAmB,iCAAQ,OAAO;AACnD,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"]}
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, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} 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?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} 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, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...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, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.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 tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, 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 [${module?.config?.name ?? module.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, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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 }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: asWitnessInstance(module, () => `Module is not a witness [${module.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 [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.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, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import { ModuleFromNodeConfig, useWeakModuleFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\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((module) => {\n const instance = asSentinelInstance(module?.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,QAAQ,GAAG,MAAM,MAAM;AACzG,SACE,oBAAC,qBAAkB,QAAiB,GAAG,OACrC,8BAAC,YAAS,SAAS,MAAM,qCAAW,SAAS,MAAM,SAAS,SAAS,YAAY,oBAEjF,GACF;AAEJ;;;ACjBA,SAAS,mBAAmB;AAE5B,SAAS,yBAA4C;AACrD,SAAS,oBAAoB;AAYvB,SAEI,OAAAA,MAFJ;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,Q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AA6B;AAC5D,SAAS,sBAAAC,2BAA4C;AAE9C,IAAM,0BAA0B,CACrC,yBACA,WAC+D;AAC/D,SAAO,sBAAwC,yBAAyB,EAAE,UAAUA,qBAAoB,GAAG,OAAO,CAAC;AACrH;;;ACRA,SAAS,cAAc;AAEvB,SAA+B,8BAA8B;AAC7D,SAAS,sBAAAC,2BAA4C;AAE9C,IAAM,2BAA2B,CACtC,QACA,WACwE;AACxE,QAAM,CAAC,SAAS,KAAK,IAAI,uBAAuB,QAAQ,MAAM;AAC9D,MAAI,OAAO;AACT,WAAO,CAAC,MAAM,KAAK;AAAA,EACrB;AACA,SAAO;AAAA,KACL,mCACI,IAAI,CAAC,WAAW;AAChB,YAAM,WAAWA,oBAAmB,iCAAQ,OAAO;AACnD,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
@@ -21,11 +21,11 @@
21
21
  "@xyo-network/boundwitness-model": "^2.99.1",
22
22
  "@xyo-network/module-model": "^2.99.1",
23
23
  "@xyo-network/payload-model": "^2.99.1",
24
- "@xyo-network/react-module": "~2.75.2",
25
- "@xyo-network/react-node": "~2.75.2",
26
- "@xyo-network/react-payload-raw-info": "~2.75.2",
27
- "@xyo-network/react-shared": "~2.75.2",
28
- "@xyo-network/react-witness": "~2.75.2",
24
+ "@xyo-network/react-module": "~2.75.3",
25
+ "@xyo-network/react-node": "~2.75.3",
26
+ "@xyo-network/react-payload-raw-info": "~2.75.3",
27
+ "@xyo-network/react-shared": "~2.75.3",
28
+ "@xyo-network/react-witness": "~2.75.3",
29
29
  "@xyo-network/sentinel-memory": "^2.99.1",
30
30
  "@xyo-network/sentinel-model": "^2.99.1",
31
31
  "@xyo-network/witness-model": "^2.99.1"
@@ -101,6 +101,6 @@
101
101
  },
102
102
  "sideEffects": false,
103
103
  "types": "dist/browser/index.d.ts",
104
- "version": "2.75.2",
104
+ "version": "2.75.3",
105
105
  "type": "module"
106
106
  }
@@ -1,3 +1,4 @@
1
+ // eslint-disable-next-line import/no-deprecated
1
2
  import { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'
2
3
  import { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'
3
4
 
@@ -5,6 +6,7 @@ export const useSentinelFromNode = (
5
6
  nameOrAddressOrInstance?: string | SentinelInstance,
6
7
  config?: ModuleFromNodeConfig,
7
8
  ): [SentinelInstance | undefined, Error | undefined] => {
9
+ // eslint-disable-next-line deprecation/deprecation, import/no-deprecated
8
10
  const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)
9
11
  const instance = asSentinelInstance(module)
10
12
  if (module && !instance) {
@@ -1,4 +1,5 @@
1
1
  import { ModuleFilter } from '@xyo-network/module-model'
2
+ // eslint-disable-next-line import/no-deprecated
2
3
  import { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'
3
4
  import { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'
4
5
 
@@ -6,6 +7,7 @@ export const useSentinelsFromNode = (
6
7
  filter?: ModuleFilter,
7
8
  config?: ModuleFromNodeConfig,
8
9
  ): [SentinelInstance[] | null | undefined, Error | undefined] => {
10
+ // eslint-disable-next-line deprecation/deprecation, import/no-deprecated
9
11
  const [modules, error] = useModulesFromNode(filter, config)
10
12
  if (error) {
11
13
  return [null, error]