@xyo-network/react-sentinel 2.75.7 → 2.76.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/components/Card/CardActions.d.cts +1 -1
- package/dist/browser/components/Card/CardActions.d.cts.map +1 -1
- package/dist/browser/components/Card/CardActions.d.mts +1 -1
- package/dist/browser/components/Card/CardActions.d.mts.map +1 -1
- package/dist/browser/components/Card/CardActions.d.ts +1 -1
- package/dist/browser/components/Card/CardActions.d.ts.map +1 -1
- package/dist/browser/contexts/Provider.d.cts.map +1 -1
- package/dist/browser/contexts/Provider.d.mts.map +1 -1
- package/dist/browser/contexts/Provider.d.ts.map +1 -1
- package/dist/browser/index.cjs +29 -28
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +29 -28
- package/dist/browser/index.js.map +1 -1
- package/dist/neutral/components/Card/Card.d.cts +10 -0
- package/dist/neutral/components/Card/Card.d.cts.map +1 -0
- package/dist/neutral/components/Card/Card.d.mts +10 -0
- package/dist/neutral/components/Card/Card.d.mts.map +1 -0
- package/dist/neutral/components/Card/Card.d.ts +10 -0
- package/dist/neutral/components/Card/Card.d.ts.map +1 -0
- package/dist/neutral/components/Card/CardActions.d.cts +9 -0
- package/dist/neutral/components/Card/CardActions.d.cts.map +1 -0
- package/dist/neutral/components/Card/CardActions.d.mts +9 -0
- package/dist/neutral/components/Card/CardActions.d.mts.map +1 -0
- package/dist/neutral/components/Card/CardActions.d.ts +9 -0
- package/dist/neutral/components/Card/CardActions.d.ts.map +1 -0
- package/dist/neutral/components/Card/CardContent.d.cts +10 -0
- package/dist/neutral/components/Card/CardContent.d.cts.map +1 -0
- package/dist/neutral/components/Card/CardContent.d.mts +10 -0
- package/dist/neutral/components/Card/CardContent.d.mts.map +1 -0
- package/dist/neutral/components/Card/CardContent.d.ts +10 -0
- package/dist/neutral/components/Card/CardContent.d.ts.map +1 -0
- package/dist/neutral/components/Card/CardHeader.d.cts +6 -0
- package/dist/neutral/components/Card/CardHeader.d.cts.map +1 -0
- package/dist/neutral/components/Card/CardHeader.d.mts +6 -0
- package/dist/neutral/components/Card/CardHeader.d.mts.map +1 -0
- package/dist/neutral/components/Card/CardHeader.d.ts +6 -0
- package/dist/neutral/components/Card/CardHeader.d.ts.map +1 -0
- package/dist/neutral/components/Card/index.d.cts +4 -0
- package/dist/neutral/components/Card/index.d.cts.map +1 -0
- package/dist/neutral/components/Card/index.d.mts +4 -0
- package/dist/neutral/components/Card/index.d.mts.map +1 -0
- package/dist/neutral/components/Card/index.d.ts +4 -0
- package/dist/neutral/components/Card/index.d.ts.map +1 -0
- package/dist/neutral/components/index.d.cts +2 -0
- package/dist/neutral/components/index.d.cts.map +1 -0
- package/dist/neutral/components/index.d.mts +2 -0
- package/dist/neutral/components/index.d.mts.map +1 -0
- package/dist/neutral/components/index.d.ts +2 -0
- package/dist/neutral/components/index.d.ts.map +1 -0
- package/dist/neutral/contexts/Context.d.cts +4 -0
- package/dist/neutral/contexts/Context.d.cts.map +1 -0
- package/dist/neutral/contexts/Context.d.mts +4 -0
- package/dist/neutral/contexts/Context.d.mts.map +1 -0
- package/dist/neutral/contexts/Context.d.ts +4 -0
- package/dist/neutral/contexts/Context.d.ts.map +1 -0
- package/dist/neutral/contexts/Provider.d.cts +18 -0
- package/dist/neutral/contexts/Provider.d.cts.map +1 -0
- package/dist/neutral/contexts/Provider.d.mts +18 -0
- package/dist/neutral/contexts/Provider.d.mts.map +1 -0
- package/dist/neutral/contexts/Provider.d.ts +18 -0
- package/dist/neutral/contexts/Provider.d.ts.map +1 -0
- package/dist/neutral/contexts/State.d.cts +31 -0
- package/dist/neutral/contexts/State.d.cts.map +1 -0
- package/dist/neutral/contexts/State.d.mts +31 -0
- package/dist/neutral/contexts/State.d.mts.map +1 -0
- package/dist/neutral/contexts/State.d.ts +31 -0
- package/dist/neutral/contexts/State.d.ts.map +1 -0
- package/dist/neutral/contexts/index.d.cts +5 -0
- package/dist/neutral/contexts/index.d.cts.map +1 -0
- package/dist/neutral/contexts/index.d.mts +5 -0
- package/dist/neutral/contexts/index.d.mts.map +1 -0
- package/dist/neutral/contexts/index.d.ts +5 -0
- package/dist/neutral/contexts/index.d.ts.map +1 -0
- package/dist/neutral/contexts/use.d.cts +38 -0
- package/dist/neutral/contexts/use.d.cts.map +1 -0
- package/dist/neutral/contexts/use.d.mts +38 -0
- package/dist/neutral/contexts/use.d.mts.map +1 -0
- package/dist/neutral/contexts/use.d.ts +38 -0
- package/dist/neutral/contexts/use.d.ts.map +1 -0
- package/dist/neutral/hooks/index.d.cts +2 -0
- package/dist/neutral/hooks/index.d.cts.map +1 -0
- package/dist/neutral/hooks/index.d.mts +2 -0
- package/dist/neutral/hooks/index.d.mts.map +1 -0
- package/dist/neutral/hooks/index.d.ts +2 -0
- package/dist/neutral/hooks/index.d.ts.map +1 -0
- package/dist/neutral/hooks/node/index.d.cts +5 -0
- package/dist/neutral/hooks/node/index.d.cts.map +1 -0
- package/dist/neutral/hooks/node/index.d.mts +5 -0
- package/dist/neutral/hooks/node/index.d.mts.map +1 -0
- package/dist/neutral/hooks/node/index.d.ts +5 -0
- package/dist/neutral/hooks/node/index.d.ts.map +1 -0
- package/dist/neutral/hooks/node/useSentinelFromNode.d.cts +4 -0
- package/dist/neutral/hooks/node/useSentinelFromNode.d.cts.map +1 -0
- package/dist/neutral/hooks/node/useSentinelFromNode.d.mts +4 -0
- package/dist/neutral/hooks/node/useSentinelFromNode.d.mts.map +1 -0
- package/dist/neutral/hooks/node/useSentinelFromNode.d.ts +4 -0
- package/dist/neutral/hooks/node/useSentinelFromNode.d.ts.map +1 -0
- package/dist/neutral/hooks/node/useSentinelsFromNode.d.cts +5 -0
- package/dist/neutral/hooks/node/useSentinelsFromNode.d.cts.map +1 -0
- package/dist/neutral/hooks/node/useSentinelsFromNode.d.mts +5 -0
- package/dist/neutral/hooks/node/useSentinelsFromNode.d.mts.map +1 -0
- package/dist/neutral/hooks/node/useSentinelsFromNode.d.ts +5 -0
- package/dist/neutral/hooks/node/useSentinelsFromNode.d.ts.map +1 -0
- package/dist/neutral/hooks/node/useWeakSentinelFromNode.d.cts +4 -0
- package/dist/neutral/hooks/node/useWeakSentinelFromNode.d.cts.map +1 -0
- package/dist/neutral/hooks/node/useWeakSentinelFromNode.d.mts +4 -0
- package/dist/neutral/hooks/node/useWeakSentinelFromNode.d.mts.map +1 -0
- package/dist/neutral/hooks/node/useWeakSentinelFromNode.d.ts +4 -0
- package/dist/neutral/hooks/node/useWeakSentinelFromNode.d.ts.map +1 -0
- package/dist/neutral/hooks/node/useWeakSentinelsFromNode.d.cts +5 -0
- package/dist/neutral/hooks/node/useWeakSentinelsFromNode.d.cts.map +1 -0
- package/dist/neutral/hooks/node/useWeakSentinelsFromNode.d.mts +5 -0
- package/dist/neutral/hooks/node/useWeakSentinelsFromNode.d.mts.map +1 -0
- package/dist/neutral/hooks/node/useWeakSentinelsFromNode.d.ts +5 -0
- package/dist/neutral/hooks/node/useWeakSentinelsFromNode.d.ts.map +1 -0
- package/dist/neutral/index.cjs +268 -0
- package/dist/neutral/index.cjs.map +1 -0
- package/dist/neutral/index.d.cts +4 -0
- package/dist/neutral/index.d.cts.map +1 -0
- package/dist/neutral/index.d.mts +4 -0
- package/dist/neutral/index.d.mts.map +1 -0
- package/dist/neutral/index.d.ts +4 -0
- package/dist/neutral/index.d.ts.map +1 -0
- package/dist/neutral/index.js +245 -0
- package/dist/neutral/index.js.map +1 -0
- package/dist/node/components/Card/CardActions.d.cts +1 -1
- package/dist/node/components/Card/CardActions.d.cts.map +1 -1
- package/dist/node/components/Card/CardActions.d.mts +1 -1
- package/dist/node/components/Card/CardActions.d.mts.map +1 -1
- package/dist/node/components/Card/CardActions.d.ts +1 -1
- package/dist/node/components/Card/CardActions.d.ts.map +1 -1
- package/dist/node/contexts/Provider.d.cts.map +1 -1
- package/dist/node/contexts/Provider.d.mts.map +1 -1
- package/dist/node/contexts/Provider.d.ts.map +1 -1
- package/dist/node/index.cjs +29 -28
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +29 -28
- package/dist/node/index.js.map +1 -1
- package/package.json +20 -20
- package/src/components/Card/Card.stories.tsx +2 -2
- package/src/components/Card/Card.tsx +6 -6
- package/src/components/Card/CardActions.tsx +4 -4
- package/src/components/Card/CardContent.tsx +2 -2
- package/src/components/Card/CardHeader.tsx +2 -2
- package/src/contexts/Provider.tsx +8 -7
- package/src/hooks/node/useSentinelFromNode.tsx +4 -4
- package/src/hooks/node/useSentinelsFromNode.tsx +3 -3
- package/src/hooks/node/useWeakSentinelsFromNode.tsx +2 -2
|
@@ -3,7 +3,7 @@ import { CardActionsProps } from '@mui/material';
|
|
|
3
3
|
import { ModuleRenderProps } from '@xyo-network/react-module';
|
|
4
4
|
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
5
5
|
export type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> & CardActionsProps & {
|
|
6
|
-
onReport?: (
|
|
6
|
+
onReport?: (mod?: SentinelInstance) => void;
|
|
7
7
|
};
|
|
8
8
|
export declare const SentinelCardActions: React.FC<SentinelCardActionsProps>;
|
|
9
9
|
//# sourceMappingURL=CardActions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardActions.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GACxE,gBAAgB,GAAG;IACjB,QAAQ,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"CardActions.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GACxE,gBAAgB,GAAG;IACjB,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAA;CAC5C,CAAA;AAEH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAQlE,CAAA"}
|
|
@@ -3,7 +3,7 @@ import { CardActionsProps } from '@mui/material';
|
|
|
3
3
|
import { ModuleRenderProps } from '@xyo-network/react-module';
|
|
4
4
|
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
5
5
|
export type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> & CardActionsProps & {
|
|
6
|
-
onReport?: (
|
|
6
|
+
onReport?: (mod?: SentinelInstance) => void;
|
|
7
7
|
};
|
|
8
8
|
export declare const SentinelCardActions: React.FC<SentinelCardActionsProps>;
|
|
9
9
|
//# sourceMappingURL=CardActions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardActions.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GACxE,gBAAgB,GAAG;IACjB,QAAQ,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"CardActions.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GACxE,gBAAgB,GAAG;IACjB,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAA;CAC5C,CAAA;AAEH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAQlE,CAAA"}
|
|
@@ -3,7 +3,7 @@ import { CardActionsProps } from '@mui/material';
|
|
|
3
3
|
import { ModuleRenderProps } from '@xyo-network/react-module';
|
|
4
4
|
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
5
5
|
export type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> & CardActionsProps & {
|
|
6
|
-
onReport?: (
|
|
6
|
+
onReport?: (mod?: SentinelInstance) => void;
|
|
7
7
|
};
|
|
8
8
|
export declare const SentinelCardActions: React.FC<SentinelCardActionsProps>;
|
|
9
9
|
//# sourceMappingURL=CardActions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardActions.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GACxE,gBAAgB,GAAG;IACjB,QAAQ,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"CardActions.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GACxE,gBAAgB,GAAG;IACjB,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAA;CAC5C,CAAA;AAEH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAQlE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/contexts/Provider.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAIxD,OAAO,EAAqB,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAM/E,MAAM,WAAW,qBAAqB;IACpC,+CAA+C;IAC/C,OAAO,EAAE,eAAe,CAAA;IACxB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,eAAe,EAAE,CAAA;CAC9B;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/contexts/Provider.tsx"],"names":[],"mappings":";A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e,EAAE,CAAA;CAC9B;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/contexts/Provider.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAIxD,OAAO,EAAqB,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAM/E,MAAM,WAAW,qBAAqB;IACpC,+CAA+C;IAC/C,OAAO,EAAE,eAAe,CAAA;IACxB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,eAAe,EAAE,CAAA;CAC9B;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAgG1E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/contexts/Provider.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAIxD,OAAO,EAAqB,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAM/E,MAAM,WAAW,qBAAqB;IACpC,+CAA+C;IAC/C,OAAO,EAAE,eAAe,CAAA;IACxB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,eAAe,EAAE,CAAA;CAC9B;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/contexts/Provider.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAIxD,OAAO,EAAqB,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAM/E,MAAM,WAAW,qBAAqB;IACpC,+CAA+C;IAC/C,OAAO,EAAE,eAAe,CAAA;IACxB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,eAAe,EAAE,CAAA;CAC9B;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAgG1E,CAAA"}
|
package/dist/browser/index.cjs
CHANGED
|
@@ -43,8 +43,8 @@ var import_react = require("react");
|
|
|
43
43
|
var import_react_button = require("@xylabs/react-button");
|
|
44
44
|
var import_react_module = require("@xyo-network/react-module");
|
|
45
45
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
46
|
-
var SentinelCardActions = ({ onReport,
|
|
47
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_module.ModuleCardActions, {
|
|
46
|
+
var SentinelCardActions = ({ onReport, mod, ...props }) => {
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_module.ModuleCardActions, { mod, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_button.ButtonEx, { onClick: () => onReport?.(mod), size: "small", variant: "outlined", children: "Report" }) });
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
// src/components/Card/CardContent.tsx
|
|
@@ -52,8 +52,8 @@ var import_react_flexbox = require("@xylabs/react-flexbox");
|
|
|
52
52
|
var import_react_module2 = require("@xyo-network/react-module");
|
|
53
53
|
var import_react_payload_raw_info = require("@xyo-network/react-payload-raw-info");
|
|
54
54
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
55
|
-
var SentinelCardContent = ({ children, report,
|
|
56
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_module2.ModuleCardContent, {
|
|
55
|
+
var SentinelCardContent = ({ children, report, mod, ...props }) => {
|
|
56
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_module2.ModuleCardContent, { mod, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_flexbox.FlexGrowRow, { flexWrap: "wrap", justifyContent: "start", gap: 2, children: [
|
|
57
57
|
report ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_payload_raw_info.JsonViewerEx, { value: report }) : null,
|
|
58
58
|
children
|
|
59
59
|
] }) });
|
|
@@ -62,24 +62,24 @@ var SentinelCardContent = ({ children, report, module: module2, ...props }) => {
|
|
|
62
62
|
// src/components/Card/CardHeader.tsx
|
|
63
63
|
var import_react_module3 = require("@xyo-network/react-module");
|
|
64
64
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
65
|
-
var SentinelCardHeader = ({ title,
|
|
66
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_module3.ModuleCardHeader, {
|
|
65
|
+
var SentinelCardHeader = ({ title, mod, ...props }) => {
|
|
66
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_module3.ModuleCardHeader, { mod, title: title ?? mod?.config.name ?? "Sentinel", ...props });
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
// src/components/Card/Card.tsx
|
|
70
70
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
71
|
-
var SentinelCard = ({ children, inPayloads,
|
|
71
|
+
var SentinelCard = ({ children, inPayloads, mod, ...props }) => {
|
|
72
72
|
const [retry, setRetry] = (0, import_react.useState)(-1);
|
|
73
73
|
const [report] = (0, import_react_promise.usePromise)(async () => {
|
|
74
74
|
if (retry >= 0) {
|
|
75
|
-
return await
|
|
75
|
+
return await mod?.report(inPayloads);
|
|
76
76
|
}
|
|
77
|
-
}, [
|
|
77
|
+
}, [mod, retry, inPayloads]);
|
|
78
78
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material.Card, { ...props, children: [
|
|
79
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SentinelCardHeader, {
|
|
80
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SentinelCardContent, {
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SentinelCardHeader, { mod }),
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SentinelCardContent, { mod, report }),
|
|
81
81
|
children,
|
|
82
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SentinelCardActions, {
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SentinelCardActions, { mod, onReport: () => setRetry(retry + 1) })
|
|
83
83
|
] });
|
|
84
84
|
};
|
|
85
85
|
|
|
@@ -124,19 +124,20 @@ var SentinelProvider = ({ account, archivist, children, filter, name, required =
|
|
|
124
124
|
name,
|
|
125
125
|
schema: import_sentinel_model.SentinelConfigSchema,
|
|
126
126
|
synchronous: true,
|
|
127
|
-
|
|
127
|
+
// eslint-disable-next-line id-denylist
|
|
128
|
+
tasks: witnesses?.map((mod) => ({ module: mod.address }))
|
|
128
129
|
}
|
|
129
130
|
});
|
|
130
131
|
const offCallbacks = [];
|
|
131
132
|
offCallbacks.push(
|
|
132
|
-
sentinel2.on("reportEnd", ({ module:
|
|
133
|
+
sentinel2.on("reportEnd", ({ module: mod, outPayloads }) => {
|
|
133
134
|
if (mounted()) {
|
|
134
135
|
setProgress({
|
|
135
136
|
archivists: progress.archivists,
|
|
136
137
|
witnesses: progress.witnesses
|
|
137
138
|
});
|
|
138
139
|
setStatus(outPayloads?.length ? "succeeded" /* Succeeded */ : "failed" /* Failed */);
|
|
139
|
-
setReportingErrors([new Error(`Witness failed [${
|
|
140
|
+
setReportingErrors([new Error(`Witness failed [${mod?.config?.name ?? mod.address}]`)]);
|
|
140
141
|
}
|
|
141
142
|
})
|
|
142
143
|
);
|
|
@@ -151,11 +152,11 @@ var SentinelProvider = ({ account, archivist, children, filter, name, required =
|
|
|
151
152
|
if (witnesses)
|
|
152
153
|
for (const witness of witnesses) {
|
|
153
154
|
offCallbacks.push(
|
|
154
|
-
witness.on("observeEnd", ({ module:
|
|
155
|
+
witness.on("observeEnd", ({ module: mod, outPayloads }) => {
|
|
155
156
|
const witnesses2 = progress.witnesses ?? {};
|
|
156
157
|
witnesses2[witness.address] = {
|
|
157
158
|
status: outPayloads?.length ? "succeeded" /* Succeeded */ : "failed" /* Failed */,
|
|
158
|
-
witness: (0, import_witness_model.asWitnessInstance)(
|
|
159
|
+
witness: (0, import_witness_model.asWitnessInstance)(mod, () => `Module is not a witness [${mod.id}]`)
|
|
159
160
|
};
|
|
160
161
|
if (mounted()) {
|
|
161
162
|
setProgress({
|
|
@@ -166,11 +167,11 @@ var SentinelProvider = ({ account, archivist, children, filter, name, required =
|
|
|
166
167
|
})
|
|
167
168
|
);
|
|
168
169
|
offCallbacks.push(
|
|
169
|
-
witness.on("observeStart", ({ module:
|
|
170
|
+
witness.on("observeStart", ({ module: mod }) => {
|
|
170
171
|
const witnesses2 = progress.witnesses ?? {};
|
|
171
172
|
witnesses2[witness.address] = {
|
|
172
173
|
status: "started" /* Started */,
|
|
173
|
-
witness: (0, import_witness_model.asWitnessInstance)(
|
|
174
|
+
witness: (0, import_witness_model.asWitnessInstance)(mod, () => `Module is not a witness [${mod.id}]`)
|
|
174
175
|
};
|
|
175
176
|
if (mounted()) {
|
|
176
177
|
setProgress({
|
|
@@ -208,10 +209,10 @@ var useSentinelContext = () => {
|
|
|
208
209
|
var import_react_node = require("@xyo-network/react-node");
|
|
209
210
|
var import_sentinel_model2 = require("@xyo-network/sentinel-model");
|
|
210
211
|
var useSentinelFromNode = (nameOrAddressOrInstance, config) => {
|
|
211
|
-
const [
|
|
212
|
-
const instance = (0, import_sentinel_model2.asSentinelInstance)(
|
|
213
|
-
if (
|
|
214
|
-
const error2 = new Error(`Resolved module is not a SentinelInstance [${
|
|
212
|
+
const [mod, error] = (0, import_react_node.useModuleFromNode)(nameOrAddressOrInstance, config);
|
|
213
|
+
const instance = (0, import_sentinel_model2.asSentinelInstance)(mod);
|
|
214
|
+
if (mod && !instance) {
|
|
215
|
+
const error2 = new Error(`Resolved module is not a SentinelInstance [${mod.config?.schema}:${mod.config?.name}:${mod.address}]`);
|
|
215
216
|
console.error(error2.message);
|
|
216
217
|
return [void 0, error2];
|
|
217
218
|
}
|
|
@@ -228,9 +229,9 @@ var useSentinelsFromNode = (filter, config) => {
|
|
|
228
229
|
}
|
|
229
230
|
return modules ? [
|
|
230
231
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
231
|
-
modules.reduce((prev,
|
|
232
|
-
if ((0, import_sentinel_model3.isSentinelInstance)(
|
|
233
|
-
prev.push(
|
|
232
|
+
modules.reduce((prev, mod) => {
|
|
233
|
+
if ((0, import_sentinel_model3.isSentinelInstance)(mod)) {
|
|
234
|
+
prev.push(mod);
|
|
234
235
|
}
|
|
235
236
|
return prev;
|
|
236
237
|
}, []),
|
|
@@ -255,8 +256,8 @@ var useWeakSentinelsFromNode = (filter, config) => {
|
|
|
255
256
|
return [null, error];
|
|
256
257
|
}
|
|
257
258
|
return [
|
|
258
|
-
modules?.map((
|
|
259
|
-
const instance = (0, import_sentinel_model5.asSentinelInstance)(
|
|
259
|
+
modules?.map((mod) => {
|
|
260
|
+
const instance = (0, import_sentinel_model5.asSentinelInstance)(mod?.deref());
|
|
260
261
|
if (instance) {
|
|
261
262
|
return new WeakRef(instance);
|
|
262
263
|
}
|
|
@@ -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","// 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,yC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;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,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
|
+
{"version":3,"sources":["../../src/index.ts","../../src/components/Card/Card.tsx","../../src/components/Card/CardActions.tsx","../../src/components/Card/CardContent.tsx","../../src/components/Card/CardHeader.tsx","../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/State.ts","../../src/contexts/use.ts","../../src/hooks/node/useSentinelFromNode.tsx","../../src/hooks/node/useSentinelsFromNode.tsx","../../src/hooks/node/useWeakSentinelFromNode.tsx","../../src/hooks/node/useWeakSentinelsFromNode.tsx"],"sourcesContent":["export * from './components'\nexport * from './contexts'\nexport * from './hooks'\n","import { Card, CardProps } from '@mui/material'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { useState } from 'react'\n\nimport { SentinelCardActions } from './CardActions'\nimport { SentinelCardContent } from './CardContent'\nimport { SentinelCardHeader } from './CardHeader'\n\nexport type SentinelCardProps = CardProps &\n ModuleRenderProps<SentinelInstance> & {\n inPayloads?: Payload[]\n }\n\nexport const SentinelCard: React.FC<SentinelCardProps> = ({ children, inPayloads, mod, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await mod?.report(inPayloads)\n }\n }, [mod, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader mod={mod} />\n <SentinelCardContent mod={mod} report={report} />\n {children}\n <SentinelCardActions mod={mod} onReport={() => setRetry(retry + 1)} />\n </Card>\n )\n}\n","import { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleCardActions, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &\n CardActionsProps & {\n onReport?: (mod?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, mod, ...props }) => {\n return (\n <ModuleCardActions mod={mod} {...props}>\n <ButtonEx onClick={() => onReport?.(mod)} size={'small'} variant={'outlined'}>\n Report\n </ButtonEx>\n </ModuleCardActions>\n )\n}\n","import { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleCardContent, ModuleRenderProps } from '@xyo-network/react-module'\nimport { JsonViewerEx } from '@xyo-network/react-payload-raw-info'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\n\nexport type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &\n CardContentProps & {\n report?: Payload[]\n }\n\nexport const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ children, report, mod, ...props }) => {\n return (\n <ModuleCardContent mod={mod} {...props}>\n <FlexGrowRow flexWrap=\"wrap\" justifyContent=\"start\" gap={2}>\n {report ?\n <JsonViewerEx value={report} />\n : null}\n {children}\n </FlexGrowRow>\n </ModuleCardContent>\n )\n}\n","import { CardHeaderProps } from '@mui/material'\nimport { ModuleCardHeader, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({ title, mod, ...props }) => {\n return <ModuleCardHeader mod={mod} title={title ?? mod?.config.name ?? 'Sentinel'} {...props} />\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel } from '@xyo-network/sentinel-memory'\nimport { SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel-model'\nimport { asWitnessInstance, WitnessInstance } from '@xyo-network/witness-model'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n synchronous: true,\n // eslint-disable-next-line id-denylist\n tasks: witnesses?.map((mod) => ({ module: mod.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module: mod, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([new Error(`Witness failed [${mod?.config?.name ?? mod.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n if (witnesses)\n for (const witness of witnesses) {\n offCallbacks.push(\n witness.on('observeEnd', ({ module: mod, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`),\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module: mod }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`),\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n }\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n for (const callback of offCallbacks) {\n callback()\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ?\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel-model'\nimport { WitnessModule } from '@xyo-network/witness-model'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","// eslint-disable-next-line import/no-deprecated\nimport { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n // eslint-disable-next-line deprecation/deprecation, import/no-deprecated\n const [mod, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(mod)\n if (mod && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${mod.config?.schema}:${mod.config?.name}:${mod.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\n// eslint-disable-next-line import/no-deprecated\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n // eslint-disable-next-line deprecation/deprecation, import/no-deprecated\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules ?\n [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, mod) => {\n if (isSentinelInstance(mod)) {\n prev.push(mod)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import { 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((mod) => {\n const instance = asSentinelInstance(mod?.deref())\n if (instance) {\n return new WeakRef(instance)\n }\n })\n .filter(exists) ?? [],\n undefined,\n ]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAAgC;AAChC,2BAA2B;AAI3B,mBAAyB;;;ACJzB,0BAAyB;AACzB,0BAAqD;AAW/C;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,KAAK,GAAG,MAAM,MAAM;AACtG,SACE,4CAAC,yCAAkB,KAAW,GAAG,OAC/B,sDAAC,gCAAS,SAAS,MAAM,WAAW,GAAG,GAAG,MAAM,SAAS,SAAS,YAAY,oBAE9E,GACF;AAEJ;;;ACjBA,2BAA4B;AAE5B,IAAAA,uBAAqD;AACrD,oCAA6B;AAYvB,IAAAC,sBAAA;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,KAAK,GAAG,MAAM,MAAM;AAC9G,SACE,6CAAC,0CAAkB,KAAW,GAAG,OAC/B,wDAAC,oCAAY,UAAS,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,KAAK,GAAG,MAAM,MAAM;AAC/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D,UAAI,UAAU;AACZ,eAAO,IAAI,QAAQ,QAAQ;AAAA,MAC7B;AAAA,IACF,CAAC,EACA,OAAO,oBAAM,KAAK,CAAC;AAAA,IACtB;AAAA,EACF;AACF;","names":["import_react_module","import_jsx_runtime","import_react_module","import_jsx_runtime","import_jsx_runtime","import_react","SentinelReportStatus","import_jsx_runtime","sentinel","witnesses","import_react_shared","import_sentinel_model","error","import_react_node","import_sentinel_model","import_react_node","import_sentinel_model","import_react_node","import_sentinel_model"]}
|
package/dist/browser/index.js
CHANGED
|
@@ -7,8 +7,8 @@ import { useState } from "react";
|
|
|
7
7
|
import { ButtonEx } from "@xylabs/react-button";
|
|
8
8
|
import { ModuleCardActions } from "@xyo-network/react-module";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
10
|
-
var SentinelCardActions = ({ onReport,
|
|
11
|
-
return /* @__PURE__ */ jsx(ModuleCardActions, {
|
|
10
|
+
var SentinelCardActions = ({ onReport, mod, ...props }) => {
|
|
11
|
+
return /* @__PURE__ */ jsx(ModuleCardActions, { mod, ...props, children: /* @__PURE__ */ jsx(ButtonEx, { onClick: () => onReport?.(mod), size: "small", variant: "outlined", children: "Report" }) });
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
// src/components/Card/CardContent.tsx
|
|
@@ -16,8 +16,8 @@ import { FlexGrowRow } from "@xylabs/react-flexbox";
|
|
|
16
16
|
import { ModuleCardContent } from "@xyo-network/react-module";
|
|
17
17
|
import { JsonViewerEx } from "@xyo-network/react-payload-raw-info";
|
|
18
18
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
19
|
-
var SentinelCardContent = ({ children, report,
|
|
20
|
-
return /* @__PURE__ */ jsx2(ModuleCardContent, {
|
|
19
|
+
var SentinelCardContent = ({ children, report, mod, ...props }) => {
|
|
20
|
+
return /* @__PURE__ */ jsx2(ModuleCardContent, { mod, ...props, children: /* @__PURE__ */ jsxs(FlexGrowRow, { flexWrap: "wrap", justifyContent: "start", gap: 2, children: [
|
|
21
21
|
report ? /* @__PURE__ */ jsx2(JsonViewerEx, { value: report }) : null,
|
|
22
22
|
children
|
|
23
23
|
] }) });
|
|
@@ -26,24 +26,24 @@ var SentinelCardContent = ({ children, report, module, ...props }) => {
|
|
|
26
26
|
// src/components/Card/CardHeader.tsx
|
|
27
27
|
import { ModuleCardHeader } from "@xyo-network/react-module";
|
|
28
28
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
29
|
-
var SentinelCardHeader = ({ title,
|
|
30
|
-
return /* @__PURE__ */ jsx3(ModuleCardHeader, {
|
|
29
|
+
var SentinelCardHeader = ({ title, mod, ...props }) => {
|
|
30
|
+
return /* @__PURE__ */ jsx3(ModuleCardHeader, { mod, title: title ?? mod?.config.name ?? "Sentinel", ...props });
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
// src/components/Card/Card.tsx
|
|
34
34
|
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
35
|
-
var SentinelCard = ({ children, inPayloads,
|
|
35
|
+
var SentinelCard = ({ children, inPayloads, mod, ...props }) => {
|
|
36
36
|
const [retry, setRetry] = useState(-1);
|
|
37
37
|
const [report] = usePromise(async () => {
|
|
38
38
|
if (retry >= 0) {
|
|
39
|
-
return await
|
|
39
|
+
return await mod?.report(inPayloads);
|
|
40
40
|
}
|
|
41
|
-
}, [
|
|
41
|
+
}, [mod, retry, inPayloads]);
|
|
42
42
|
return /* @__PURE__ */ jsxs2(Card, { ...props, children: [
|
|
43
|
-
/* @__PURE__ */ jsx4(SentinelCardHeader, {
|
|
44
|
-
/* @__PURE__ */ jsx4(SentinelCardContent, {
|
|
43
|
+
/* @__PURE__ */ jsx4(SentinelCardHeader, { mod }),
|
|
44
|
+
/* @__PURE__ */ jsx4(SentinelCardContent, { mod, report }),
|
|
45
45
|
children,
|
|
46
|
-
/* @__PURE__ */ jsx4(SentinelCardActions, {
|
|
46
|
+
/* @__PURE__ */ jsx4(SentinelCardActions, { mod, onReport: () => setRetry(retry + 1) })
|
|
47
47
|
] });
|
|
48
48
|
};
|
|
49
49
|
|
|
@@ -88,19 +88,20 @@ var SentinelProvider = ({ account, archivist, children, filter, name, required =
|
|
|
88
88
|
name,
|
|
89
89
|
schema: SentinelConfigSchema,
|
|
90
90
|
synchronous: true,
|
|
91
|
-
|
|
91
|
+
// eslint-disable-next-line id-denylist
|
|
92
|
+
tasks: witnesses?.map((mod) => ({ module: mod.address }))
|
|
92
93
|
}
|
|
93
94
|
});
|
|
94
95
|
const offCallbacks = [];
|
|
95
96
|
offCallbacks.push(
|
|
96
|
-
sentinel2.on("reportEnd", ({ module, outPayloads }) => {
|
|
97
|
+
sentinel2.on("reportEnd", ({ module: mod, outPayloads }) => {
|
|
97
98
|
if (mounted()) {
|
|
98
99
|
setProgress({
|
|
99
100
|
archivists: progress.archivists,
|
|
100
101
|
witnesses: progress.witnesses
|
|
101
102
|
});
|
|
102
103
|
setStatus(outPayloads?.length ? "succeeded" /* Succeeded */ : "failed" /* Failed */);
|
|
103
|
-
setReportingErrors([new Error(`Witness failed [${
|
|
104
|
+
setReportingErrors([new Error(`Witness failed [${mod?.config?.name ?? mod.address}]`)]);
|
|
104
105
|
}
|
|
105
106
|
})
|
|
106
107
|
);
|
|
@@ -115,11 +116,11 @@ var SentinelProvider = ({ account, archivist, children, filter, name, required =
|
|
|
115
116
|
if (witnesses)
|
|
116
117
|
for (const witness of witnesses) {
|
|
117
118
|
offCallbacks.push(
|
|
118
|
-
witness.on("observeEnd", ({ module, outPayloads }) => {
|
|
119
|
+
witness.on("observeEnd", ({ module: mod, outPayloads }) => {
|
|
119
120
|
const witnesses2 = progress.witnesses ?? {};
|
|
120
121
|
witnesses2[witness.address] = {
|
|
121
122
|
status: outPayloads?.length ? "succeeded" /* Succeeded */ : "failed" /* Failed */,
|
|
122
|
-
witness: asWitnessInstance(
|
|
123
|
+
witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`)
|
|
123
124
|
};
|
|
124
125
|
if (mounted()) {
|
|
125
126
|
setProgress({
|
|
@@ -130,11 +131,11 @@ var SentinelProvider = ({ account, archivist, children, filter, name, required =
|
|
|
130
131
|
})
|
|
131
132
|
);
|
|
132
133
|
offCallbacks.push(
|
|
133
|
-
witness.on("observeStart", ({ module }) => {
|
|
134
|
+
witness.on("observeStart", ({ module: mod }) => {
|
|
134
135
|
const witnesses2 = progress.witnesses ?? {};
|
|
135
136
|
witnesses2[witness.address] = {
|
|
136
137
|
status: "started" /* Started */,
|
|
137
|
-
witness: asWitnessInstance(
|
|
138
|
+
witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`)
|
|
138
139
|
};
|
|
139
140
|
if (mounted()) {
|
|
140
141
|
setProgress({
|
|
@@ -172,10 +173,10 @@ var useSentinelContext = () => {
|
|
|
172
173
|
import { useModuleFromNode } from "@xyo-network/react-node";
|
|
173
174
|
import { asSentinelInstance } from "@xyo-network/sentinel-model";
|
|
174
175
|
var useSentinelFromNode = (nameOrAddressOrInstance, config) => {
|
|
175
|
-
const [
|
|
176
|
-
const instance = asSentinelInstance(
|
|
177
|
-
if (
|
|
178
|
-
const error2 = new Error(`Resolved module is not a SentinelInstance [${
|
|
176
|
+
const [mod, error] = useModuleFromNode(nameOrAddressOrInstance, config);
|
|
177
|
+
const instance = asSentinelInstance(mod);
|
|
178
|
+
if (mod && !instance) {
|
|
179
|
+
const error2 = new Error(`Resolved module is not a SentinelInstance [${mod.config?.schema}:${mod.config?.name}:${mod.address}]`);
|
|
179
180
|
console.error(error2.message);
|
|
180
181
|
return [void 0, error2];
|
|
181
182
|
}
|
|
@@ -192,9 +193,9 @@ var useSentinelsFromNode = (filter, config) => {
|
|
|
192
193
|
}
|
|
193
194
|
return modules ? [
|
|
194
195
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
195
|
-
modules.reduce((prev,
|
|
196
|
-
if (isSentinelInstance(
|
|
197
|
-
prev.push(
|
|
196
|
+
modules.reduce((prev, mod) => {
|
|
197
|
+
if (isSentinelInstance(mod)) {
|
|
198
|
+
prev.push(mod);
|
|
198
199
|
}
|
|
199
200
|
return prev;
|
|
200
201
|
}, []),
|
|
@@ -219,8 +220,8 @@ var useWeakSentinelsFromNode = (filter, config) => {
|
|
|
219
220
|
return [null, error];
|
|
220
221
|
}
|
|
221
222
|
return [
|
|
222
|
-
modules?.map((
|
|
223
|
-
const instance = asSentinelInstance2(
|
|
223
|
+
modules?.map((mod) => {
|
|
224
|
+
const instance = asSentinelInstance2(mod?.deref());
|
|
224
225
|
if (instance) {
|
|
225
226
|
return new WeakRef(instance);
|
|
226
227
|
}
|
|
@@ -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","// 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;;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;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,IACL;AAAA,EACF,IACA,CAAC,SAAS,KAAK;AACrB;;;AC1BA,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, mod, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await mod?.report(inPayloads)\n }\n }, [mod, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader mod={mod} />\n <SentinelCardContent mod={mod} report={report} />\n {children}\n <SentinelCardActions mod={mod} onReport={() => setRetry(retry + 1)} />\n </Card>\n )\n}\n","import { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleCardActions, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &\n CardActionsProps & {\n onReport?: (mod?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, mod, ...props }) => {\n return (\n <ModuleCardActions mod={mod} {...props}>\n <ButtonEx onClick={() => onReport?.(mod)} size={'small'} variant={'outlined'}>\n Report\n </ButtonEx>\n </ModuleCardActions>\n )\n}\n","import { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleCardContent, ModuleRenderProps } from '@xyo-network/react-module'\nimport { JsonViewerEx } from '@xyo-network/react-payload-raw-info'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\n\nexport type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &\n CardContentProps & {\n report?: Payload[]\n }\n\nexport const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ children, report, mod, ...props }) => {\n return (\n <ModuleCardContent mod={mod} {...props}>\n <FlexGrowRow flexWrap=\"wrap\" justifyContent=\"start\" gap={2}>\n {report ?\n <JsonViewerEx value={report} />\n : null}\n {children}\n </FlexGrowRow>\n </ModuleCardContent>\n )\n}\n","import { CardHeaderProps } from '@mui/material'\nimport { ModuleCardHeader, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({ title, mod, ...props }) => {\n return <ModuleCardHeader mod={mod} title={title ?? mod?.config.name ?? 'Sentinel'} {...props} />\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel } from '@xyo-network/sentinel-memory'\nimport { SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel-model'\nimport { asWitnessInstance, WitnessInstance } from '@xyo-network/witness-model'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n synchronous: true,\n // eslint-disable-next-line id-denylist\n tasks: witnesses?.map((mod) => ({ module: mod.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module: mod, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([new Error(`Witness failed [${mod?.config?.name ?? mod.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n if (witnesses)\n for (const witness of witnesses) {\n offCallbacks.push(\n witness.on('observeEnd', ({ module: mod, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`),\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module: mod }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: asWitnessInstance(mod, () => `Module is not a witness [${mod.id}]`),\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n }\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n for (const callback of offCallbacks) {\n callback()\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ?\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel-model'\nimport { WitnessModule } from '@xyo-network/witness-model'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","// eslint-disable-next-line import/no-deprecated\nimport { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n // eslint-disable-next-line deprecation/deprecation, import/no-deprecated\n const [mod, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(mod)\n if (mod && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${mod.config?.schema}:${mod.config?.name}:${mod.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\n// eslint-disable-next-line import/no-deprecated\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n // eslint-disable-next-line deprecation/deprecation, import/no-deprecated\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules ?\n [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, mod) => {\n if (isSentinelInstance(mod)) {\n prev.push(mod)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import { 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((mod) => {\n const instance = asSentinelInstance(mod?.deref())\n if (instance) {\n return new WeakRef(instance)\n }\n })\n .filter(exists) ?? [],\n undefined,\n ]\n}\n"],"mappings":";AAAA,SAAS,YAAuB;AAChC,SAAS,kBAAkB;AAI3B,SAAS,gBAAgB;;;ACJzB,SAAS,gBAAgB;AACzB,SAAS,yBAA4C;AAW/C;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,KAAK,GAAG,MAAM,MAAM;AACtG,SACE,oBAAC,qBAAkB,KAAW,GAAG,OAC/B,8BAAC,YAAS,SAAS,MAAM,WAAW,GAAG,GAAG,MAAM,SAAS,SAAS,YAAY,oBAE9E,GACF;AAEJ;;;ACjBA,SAAS,mBAAmB;AAE5B,SAAS,yBAA4C;AACrD,SAAS,oBAAoB;AAYvB,SAEI,OAAAA,MAFJ;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,KAAK,GAAG,MAAM,MAAM;AAC9G,SACE,gBAAAA,KAAC,qBAAkB,KAAW,GAAG,OAC/B,+BAAC,eAAY,UAAS,QAAO,gBAAe,SAAQ,KAAK,GACtD;AAAA,aACC,gBAAAA,KAAC,gBAAa,OAAO,QAAQ,IAC7B;AAAA,IACD;AAAA,KACH,GACF;AAEJ;;;ACvBA,SAAS,wBAA2C;AAI3C,gBAAAC,YAAA;AADF,IAAM,qBAAsF,CAAC,EAAE,OAAO,KAAK,GAAG,MAAM,MAAM;AAC/H,SAAO,gBAAAA,KAAC,oBAAiB,KAAU,OAAO,SAAS,KAAK,OAAO,QAAQ,YAAa,GAAG,OAAO;AAChG;;;AHkBI,SACE,OAAAC,MADF,QAAAC,aAAA;AARG,IAAM,eAA4C,CAAC,EAAE,UAAU,YAAY,KAAK,GAAG,MAAM,MAAM;AACpG,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AACrC,QAAM,CAAC,MAAM,IAAI,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","jsxs","useState","SentinelReportStatus","jsx","useState","sentinel","witnesses","error","isSentinelInstance","asSentinelInstance"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CardProps } from '@mui/material';
|
|
3
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
4
|
+
import { ModuleRenderProps } from '@xyo-network/react-module';
|
|
5
|
+
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
6
|
+
export type SentinelCardProps = CardProps & ModuleRenderProps<SentinelInstance> & {
|
|
7
|
+
inPayloads?: Payload[];
|
|
8
|
+
};
|
|
9
|
+
export declare const SentinelCard: React.FC<SentinelCardProps>;
|
|
10
|
+
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/Card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAQ,SAAS,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAO9D,MAAM,MAAM,iBAAiB,GAAG,SAAS,GACvC,iBAAiB,CAAC,gBAAgB,CAAC,GAAG;IACpC,UAAU,CAAC,EAAE,OAAO,EAAE,CAAA;CACvB,CAAA;AAEH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAepD,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CardProps } from '@mui/material';
|
|
3
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
4
|
+
import { ModuleRenderProps } from '@xyo-network/react-module';
|
|
5
|
+
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
6
|
+
export type SentinelCardProps = CardProps & ModuleRenderProps<SentinelInstance> & {
|
|
7
|
+
inPayloads?: Payload[];
|
|
8
|
+
};
|
|
9
|
+
export declare const SentinelCard: React.FC<SentinelCardProps>;
|
|
10
|
+
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/Card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAQ,SAAS,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAO9D,MAAM,MAAM,iBAAiB,GAAG,SAAS,GACvC,iBAAiB,CAAC,gBAAgB,CAAC,GAAG;IACpC,UAAU,CAAC,EAAE,OAAO,EAAE,CAAA;CACvB,CAAA;AAEH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAepD,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CardProps } from '@mui/material';
|
|
3
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
4
|
+
import { ModuleRenderProps } from '@xyo-network/react-module';
|
|
5
|
+
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
6
|
+
export type SentinelCardProps = CardProps & ModuleRenderProps<SentinelInstance> & {
|
|
7
|
+
inPayloads?: Payload[];
|
|
8
|
+
};
|
|
9
|
+
export declare const SentinelCard: React.FC<SentinelCardProps>;
|
|
10
|
+
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/Card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAQ,SAAS,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAO9D,MAAM,MAAM,iBAAiB,GAAG,SAAS,GACvC,iBAAiB,CAAC,gBAAgB,CAAC,GAAG;IACpC,UAAU,CAAC,EAAE,OAAO,EAAE,CAAA;CACvB,CAAA;AAEH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAepD,CAAA"}
|