@xyo-network/react-sentinel 2.65.3 → 2.65.5
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/Card.d.cts +10 -0
- package/dist/browser/components/Card/Card.d.cts.map +1 -0
- package/dist/browser/components/Card/Card.d.mts +10 -0
- package/dist/browser/components/Card/Card.d.mts.map +1 -0
- package/dist/browser/components/Card/Card.d.ts +10 -0
- package/dist/browser/components/Card/Card.d.ts.map +1 -0
- package/dist/browser/components/Card/CardActions.d.cts +9 -0
- package/dist/browser/components/Card/CardActions.d.cts.map +1 -0
- package/dist/browser/components/Card/CardActions.d.mts +9 -0
- package/dist/browser/components/Card/CardActions.d.mts.map +1 -0
- package/dist/browser/components/Card/CardActions.d.ts +9 -0
- package/dist/browser/components/Card/CardActions.d.ts.map +1 -0
- package/dist/browser/components/Card/CardContent.d.cts +10 -0
- package/dist/browser/components/Card/CardContent.d.cts.map +1 -0
- package/dist/browser/components/Card/CardContent.d.mts +10 -0
- package/dist/browser/components/Card/CardContent.d.mts.map +1 -0
- package/dist/browser/components/Card/CardContent.d.ts +10 -0
- package/dist/browser/components/Card/CardContent.d.ts.map +1 -0
- package/dist/browser/components/Card/CardHeader.d.cts +6 -0
- package/dist/browser/components/Card/CardHeader.d.cts.map +1 -0
- package/dist/browser/components/Card/CardHeader.d.mts +6 -0
- package/dist/browser/components/Card/CardHeader.d.mts.map +1 -0
- package/dist/browser/components/Card/CardHeader.d.ts +6 -0
- package/dist/browser/components/Card/CardHeader.d.ts.map +1 -0
- package/dist/browser/components/Card/index.d.cts +4 -0
- package/dist/browser/components/Card/index.d.cts.map +1 -0
- package/dist/browser/components/Card/index.d.mts +4 -0
- package/dist/browser/components/Card/index.d.mts.map +1 -0
- package/dist/browser/components/Card/index.d.ts +4 -0
- package/dist/browser/components/Card/index.d.ts.map +1 -0
- package/dist/browser/components/index.d.cts +2 -0
- package/dist/browser/components/index.d.cts.map +1 -0
- package/dist/browser/components/index.d.mts +2 -0
- package/dist/browser/components/index.d.mts.map +1 -0
- package/dist/browser/components/index.d.ts +2 -0
- package/dist/browser/components/index.d.ts.map +1 -0
- package/dist/browser/index.cjs +71 -9
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.d.cts +1 -0
- package/dist/browser/index.d.cts.map +1 -1
- package/dist/browser/index.d.mts +1 -0
- package/dist/browser/index.d.mts.map +1 -1
- package/dist/browser/index.d.ts +1 -0
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +60 -8
- package/dist/browser/index.js.map +1 -1
- package/dist/node/components/Card/Card.d.cts +10 -0
- package/dist/node/components/Card/Card.d.cts.map +1 -0
- package/dist/node/components/Card/Card.d.mts +10 -0
- package/dist/node/components/Card/Card.d.mts.map +1 -0
- package/dist/node/components/Card/Card.d.ts +10 -0
- package/dist/node/components/Card/Card.d.ts.map +1 -0
- package/dist/node/components/Card/CardActions.d.cts +9 -0
- package/dist/node/components/Card/CardActions.d.cts.map +1 -0
- package/dist/node/components/Card/CardActions.d.mts +9 -0
- package/dist/node/components/Card/CardActions.d.mts.map +1 -0
- package/dist/node/components/Card/CardActions.d.ts +9 -0
- package/dist/node/components/Card/CardActions.d.ts.map +1 -0
- package/dist/node/components/Card/CardContent.d.cts +10 -0
- package/dist/node/components/Card/CardContent.d.cts.map +1 -0
- package/dist/node/components/Card/CardContent.d.mts +10 -0
- package/dist/node/components/Card/CardContent.d.mts.map +1 -0
- package/dist/node/components/Card/CardContent.d.ts +10 -0
- package/dist/node/components/Card/CardContent.d.ts.map +1 -0
- package/dist/node/components/Card/CardHeader.d.cts +6 -0
- package/dist/node/components/Card/CardHeader.d.cts.map +1 -0
- package/dist/node/components/Card/CardHeader.d.mts +6 -0
- package/dist/node/components/Card/CardHeader.d.mts.map +1 -0
- package/dist/node/components/Card/CardHeader.d.ts +6 -0
- package/dist/node/components/Card/CardHeader.d.ts.map +1 -0
- package/dist/node/components/Card/index.d.cts +4 -0
- package/dist/node/components/Card/index.d.cts.map +1 -0
- package/dist/node/components/Card/index.d.mts +4 -0
- package/dist/node/components/Card/index.d.mts.map +1 -0
- package/dist/node/components/Card/index.d.ts +4 -0
- package/dist/node/components/Card/index.d.ts.map +1 -0
- package/dist/node/components/index.d.cts +2 -0
- package/dist/node/components/index.d.cts.map +1 -0
- package/dist/node/components/index.d.mts +2 -0
- package/dist/node/components/index.d.mts.map +1 -0
- package/dist/node/components/index.d.ts +2 -0
- package/dist/node/components/index.d.ts.map +1 -0
- package/dist/node/index.cjs +74 -9
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.cts +1 -0
- package/dist/node/index.d.cts.map +1 -1
- package/dist/node/index.d.mts +1 -0
- package/dist/node/index.d.mts.map +1 -1
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +60 -8
- package/dist/node/index.js.map +1 -1
- package/package.json +14 -11
- package/src/components/Card/Card.stories.tsx +152 -0
- package/src/components/Card/Card.tsx +32 -0
- package/src/components/Card/CardActions.tsx +19 -0
- package/src/components/Card/CardContent.tsx +23 -0
- package/src/components/Card/CardHeader.tsx +7 -0
- package/src/components/Card/NftSentinel.json +214 -0
- package/src/components/Card/index.ts +3 -0
- package/src/components/index.ts +1 -0
- package/src/index.ts +1 -0
|
@@ -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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CardActionsProps } from '@mui/material';
|
|
3
|
+
import { ModuleRenderProps } from '@xyo-network/react-module';
|
|
4
|
+
import { SentinelInstance } from '@xyo-network/sentinel';
|
|
5
|
+
export type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> & CardActionsProps & {
|
|
6
|
+
onReport?: (module?: SentinelInstance) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const SentinelCardActions: React.FC<SentinelCardActionsProps>;
|
|
9
|
+
//# sourceMappingURL=CardActions.d.ts.map
|
|
@@ -0,0 +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,uBAAuB,CAAA;AAExD,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GACxE,gBAAgB,GAAG;IACjB,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAA;CAC/C,CAAA;AAEH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAQlE,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CardActionsProps } from '@mui/material';
|
|
3
|
+
import { ModuleRenderProps } from '@xyo-network/react-module';
|
|
4
|
+
import { SentinelInstance } from '@xyo-network/sentinel';
|
|
5
|
+
export type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> & CardActionsProps & {
|
|
6
|
+
onReport?: (module?: SentinelInstance) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const SentinelCardActions: React.FC<SentinelCardActionsProps>;
|
|
9
|
+
//# sourceMappingURL=CardActions.d.ts.map
|
|
@@ -0,0 +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,uBAAuB,CAAA;AAExD,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GACxE,gBAAgB,GAAG;IACjB,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAA;CAC/C,CAAA;AAEH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAQlE,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CardActionsProps } from '@mui/material';
|
|
3
|
+
import { ModuleRenderProps } from '@xyo-network/react-module';
|
|
4
|
+
import { SentinelInstance } from '@xyo-network/sentinel';
|
|
5
|
+
export type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> & CardActionsProps & {
|
|
6
|
+
onReport?: (module?: SentinelInstance) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const SentinelCardActions: React.FC<SentinelCardActionsProps>;
|
|
9
|
+
//# sourceMappingURL=CardActions.d.ts.map
|
|
@@ -0,0 +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,uBAAuB,CAAA;AAExD,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GACxE,gBAAgB,GAAG;IACjB,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAA;CAC/C,CAAA;AAEH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAQlE,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CardContentProps } from '@mui/material';
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
3
|
+
import { ModuleRenderProps } from '@xyo-network/react-module';
|
|
4
|
+
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
export type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> & CardContentProps & {
|
|
7
|
+
report?: Payload[];
|
|
8
|
+
};
|
|
9
|
+
export declare const SentinelCardContent: React.FC<SentinelCardContentProps>;
|
|
10
|
+
//# sourceMappingURL=CardContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GACxE,gBAAgB,GAAG;IACjB,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;CACnB,CAAA;AAEH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CASlE,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CardContentProps } from '@mui/material';
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
3
|
+
import { ModuleRenderProps } from '@xyo-network/react-module';
|
|
4
|
+
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
export type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> & CardContentProps & {
|
|
7
|
+
report?: Payload[];
|
|
8
|
+
};
|
|
9
|
+
export declare const SentinelCardContent: React.FC<SentinelCardContentProps>;
|
|
10
|
+
//# sourceMappingURL=CardContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GACxE,gBAAgB,GAAG;IACjB,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;CACnB,CAAA;AAEH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CASlE,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CardContentProps } from '@mui/material';
|
|
2
|
+
import { Payload } from '@xyo-network/payload-model';
|
|
3
|
+
import { ModuleRenderProps } from '@xyo-network/react-module';
|
|
4
|
+
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
export type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> & CardContentProps & {
|
|
7
|
+
report?: Payload[];
|
|
8
|
+
};
|
|
9
|
+
export declare const SentinelCardContent: React.FC<SentinelCardContentProps>;
|
|
10
|
+
//# sourceMappingURL=CardContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,GACxE,gBAAgB,GAAG;IACjB,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;CACnB,CAAA;AAEH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CASlE,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CardHeaderProps } from '@mui/material';
|
|
3
|
+
import { ModuleRenderProps } from '@xyo-network/react-module';
|
|
4
|
+
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
5
|
+
export declare const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps>;
|
|
6
|
+
//# sourceMappingURL=CardHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAoB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,GAAG,eAAe,CAE9F,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CardHeaderProps } from '@mui/material';
|
|
3
|
+
import { ModuleRenderProps } from '@xyo-network/react-module';
|
|
4
|
+
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
5
|
+
export declare const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps>;
|
|
6
|
+
//# sourceMappingURL=CardHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAoB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,GAAG,eAAe,CAE9F,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CardHeaderProps } from '@mui/material';
|
|
3
|
+
import { ModuleRenderProps } from '@xyo-network/react-module';
|
|
4
|
+
import { SentinelInstance } from '@xyo-network/sentinel-model';
|
|
5
|
+
export declare const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps>;
|
|
6
|
+
//# sourceMappingURL=CardHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAoB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,GAAG,eAAe,CAE9F,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA"}
|
package/dist/browser/index.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,11 +17,22 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
21
31
|
var src_exports = {};
|
|
22
32
|
__export(src_exports, {
|
|
33
|
+
SentinelCard: () => SentinelCard,
|
|
34
|
+
SentinelCardContent: () => SentinelCardContent,
|
|
35
|
+
SentinelCardHeader: () => SentinelCardHeader,
|
|
23
36
|
SentinelContext: () => SentinelContext,
|
|
24
37
|
SentinelProvider: () => SentinelProvider,
|
|
25
38
|
SentinelReportStatus: () => SentinelReportStatus,
|
|
@@ -29,6 +42,55 @@ __export(src_exports, {
|
|
|
29
42
|
});
|
|
30
43
|
module.exports = __toCommonJS(src_exports);
|
|
31
44
|
|
|
45
|
+
// src/components/Card/Card.tsx
|
|
46
|
+
var import_material = require("@mui/material");
|
|
47
|
+
var import_react_promise = require("@xylabs/react-promise");
|
|
48
|
+
var import_react = require("react");
|
|
49
|
+
|
|
50
|
+
// src/components/Card/CardActions.tsx
|
|
51
|
+
var import_react_button = require("@xylabs/react-button");
|
|
52
|
+
var import_react_module = require("@xyo-network/react-module");
|
|
53
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
54
|
+
var SentinelCardActions = ({ onReport, module: module2, ...props }) => {
|
|
55
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_module.ModuleCardActions, { module: module2, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_button.ButtonEx, { onClick: () => onReport?.(module2), size: "small", variant: "outlined", children: "Report" }) });
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// src/components/Card/CardContent.tsx
|
|
59
|
+
var import_react_flexbox = require("@xylabs/react-flexbox");
|
|
60
|
+
var import_react_module2 = require("@xyo-network/react-module");
|
|
61
|
+
var import_react_json_view = __toESM(require("react-json-view"), 1);
|
|
62
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
63
|
+
var SentinelCardContent = ({ children, report, module: module2, ...props }) => {
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_module2.ModuleCardContent, { module: module2, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_flexbox.FlexGrowRow, { flexWrap: "wrap", justifyContent: "start", gap: 2, children: [
|
|
65
|
+
report ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_json_view.default, { src: report }) : null,
|
|
66
|
+
children
|
|
67
|
+
] }) });
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// src/components/Card/CardHeader.tsx
|
|
71
|
+
var import_react_module3 = require("@xyo-network/react-module");
|
|
72
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
73
|
+
var SentinelCardHeader = ({ title, module: module2, ...props }) => {
|
|
74
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_module3.ModuleCardHeader, { module: module2, title: title ?? module2?.config.name ?? "Sentinel", ...props });
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// src/components/Card/Card.tsx
|
|
78
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
79
|
+
var SentinelCard = ({ children, inPayloads, module: module2, ...props }) => {
|
|
80
|
+
const [retry, setRetry] = (0, import_react.useState)(-1);
|
|
81
|
+
const [report] = (0, import_react_promise.usePromise)(async () => {
|
|
82
|
+
if (retry >= 0) {
|
|
83
|
+
return await module2?.report(inPayloads);
|
|
84
|
+
}
|
|
85
|
+
}, [module2, retry, inPayloads]);
|
|
86
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_material.Card, { ...props, children: [
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SentinelCardHeader, { module: module2 }),
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SentinelCardContent, { module: module2, report }),
|
|
89
|
+
children,
|
|
90
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SentinelCardActions, { module: module2, onReport: () => setRetry(retry + 1) })
|
|
91
|
+
] });
|
|
92
|
+
};
|
|
93
|
+
|
|
32
94
|
// src/contexts/Context.ts
|
|
33
95
|
var import_react_shared = require("@xyo-network/react-shared");
|
|
34
96
|
var SentinelContext = (0, import_react_shared.createContextEx)();
|
|
@@ -37,7 +99,7 @@ var SentinelContext = (0, import_react_shared.createContextEx)();
|
|
|
37
99
|
var import_react_async_effect = require("@xylabs/react-async-effect");
|
|
38
100
|
var import_react_witness = require("@xyo-network/react-witness");
|
|
39
101
|
var import_sentinel = require("@xyo-network/sentinel");
|
|
40
|
-
var
|
|
102
|
+
var import_react2 = require("react");
|
|
41
103
|
|
|
42
104
|
// src/contexts/State.ts
|
|
43
105
|
var SentinelReportStatus = /* @__PURE__ */ ((SentinelReportStatus2) => {
|
|
@@ -50,13 +112,13 @@ var SentinelReportStatus = /* @__PURE__ */ ((SentinelReportStatus2) => {
|
|
|
50
112
|
})(SentinelReportStatus || {});
|
|
51
113
|
|
|
52
114
|
// src/contexts/Provider.tsx
|
|
53
|
-
var
|
|
115
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
54
116
|
var SentinelProvider = ({ account, archivist, children, filter, name, required = false }) => {
|
|
55
|
-
const [sentinel, setSentinel] = (0,
|
|
56
|
-
const [history, setHistory] = (0,
|
|
57
|
-
const [progress, setProgress] = (0,
|
|
58
|
-
const [status, setStatus] = (0,
|
|
59
|
-
const [reportingErrors, setReportingErrors] = (0,
|
|
117
|
+
const [sentinel, setSentinel] = (0, import_react2.useState)();
|
|
118
|
+
const [history, setHistory] = (0, import_react2.useState)();
|
|
119
|
+
const [progress, setProgress] = (0, import_react2.useState)({});
|
|
120
|
+
const [status, setStatus] = (0, import_react2.useState)("idle" /* Idle */);
|
|
121
|
+
const [reportingErrors, setReportingErrors] = (0, import_react2.useState)();
|
|
60
122
|
const [witnesses] = (0, import_react_witness.useWitnessesFromNode)(filter);
|
|
61
123
|
(0, import_react_async_effect.useAsyncEffect)(
|
|
62
124
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -134,10 +196,10 @@ var SentinelProvider = ({ account, archivist, children, filter, name, required =
|
|
|
134
196
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
135
197
|
[account, archivist, witnesses]
|
|
136
198
|
);
|
|
137
|
-
(0,
|
|
199
|
+
(0, import_react2.useEffect)(() => {
|
|
138
200
|
setHistory(sentinel?.history);
|
|
139
201
|
}, [sentinel]);
|
|
140
|
-
return !required || sentinel ? /* @__PURE__ */ (0,
|
|
202
|
+
return !required || sentinel ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SentinelContext.Provider, { value: { history, progress, provided: true, reportingErrors, sentinel, status }, children }) : null;
|
|
141
203
|
};
|
|
142
204
|
|
|
143
205
|
// src/contexts/use.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../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"],"sourcesContent":["export * from './contexts'\nexport * from './hooks'\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","import { 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'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness'\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([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 witnesses?.forEach((witness) => {\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: module,\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: module,\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 offCallbacks.forEach((callback) => {\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'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness'\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'\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 = 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'\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 if (modules) {\n return [\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\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GAAG;AAC9B,eAAK,KAAKA,OAAM;AAAA,QAClB;AACA,eAAO;AAAA,MACT,GAAG,CAAC,CAAC;AAAA,MACL;AAAA,IACF;AAAA,EACF,OAAO;AACL,WAAO,CAAC,SAAS,KAAK;AAAA,EACxB;AACF;","names":["SentinelReportStatus","sentinel","module","witnesses","import_react_shared","import_sentinel","module","error","import_react_node","import_sentinel","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"],"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'\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 { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\nimport JsonView from 'react-json-view'\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 ? <JsonView src={report} /> : 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","import { 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'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness'\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([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 witnesses?.forEach((witness) => {\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: module,\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: module,\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 offCallbacks.forEach((callback) => {\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'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness'\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'\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 = 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'\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 if (modules) {\n return [\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n } else {\n return [modules, error]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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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AAA,MACL;AAAA,IACF;AAAA,EACF,OAAO;AACL,WAAO,CAAC,SAAS,KAAK;AAAA,EACxB;AACF;","names":["module","import_react_module","import_jsx_runtime","module","JsonView","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","module","error","import_react_node","import_sentinel","module"]}
|
package/dist/browser/index.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|
package/dist/browser/index.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|
package/dist/browser/index.js
CHANGED
|
@@ -1,3 +1,52 @@
|
|
|
1
|
+
// src/components/Card/Card.tsx
|
|
2
|
+
import { Card } from "@mui/material";
|
|
3
|
+
import { usePromise } from "@xylabs/react-promise";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
|
|
6
|
+
// src/components/Card/CardActions.tsx
|
|
7
|
+
import { ButtonEx } from "@xylabs/react-button";
|
|
8
|
+
import { ModuleCardActions } from "@xyo-network/react-module";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
var SentinelCardActions = ({ onReport, module, ...props }) => {
|
|
11
|
+
return /* @__PURE__ */ jsx(ModuleCardActions, { module, ...props, children: /* @__PURE__ */ jsx(ButtonEx, { onClick: () => onReport?.(module), size: "small", variant: "outlined", children: "Report" }) });
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/components/Card/CardContent.tsx
|
|
15
|
+
import { FlexGrowRow } from "@xylabs/react-flexbox";
|
|
16
|
+
import { ModuleCardContent } from "@xyo-network/react-module";
|
|
17
|
+
import JsonView from "react-json-view";
|
|
18
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
19
|
+
var SentinelCardContent = ({ children, report, module, ...props }) => {
|
|
20
|
+
return /* @__PURE__ */ jsx2(ModuleCardContent, { module, ...props, children: /* @__PURE__ */ jsxs(FlexGrowRow, { flexWrap: "wrap", justifyContent: "start", gap: 2, children: [
|
|
21
|
+
report ? /* @__PURE__ */ jsx2(JsonView, { src: report }) : null,
|
|
22
|
+
children
|
|
23
|
+
] }) });
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// src/components/Card/CardHeader.tsx
|
|
27
|
+
import { ModuleCardHeader } from "@xyo-network/react-module";
|
|
28
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
29
|
+
var SentinelCardHeader = ({ title, module, ...props }) => {
|
|
30
|
+
return /* @__PURE__ */ jsx3(ModuleCardHeader, { module, title: title ?? module?.config.name ?? "Sentinel", ...props });
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// src/components/Card/Card.tsx
|
|
34
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
35
|
+
var SentinelCard = ({ children, inPayloads, module, ...props }) => {
|
|
36
|
+
const [retry, setRetry] = useState(-1);
|
|
37
|
+
const [report] = usePromise(async () => {
|
|
38
|
+
if (retry >= 0) {
|
|
39
|
+
return await module?.report(inPayloads);
|
|
40
|
+
}
|
|
41
|
+
}, [module, retry, inPayloads]);
|
|
42
|
+
return /* @__PURE__ */ jsxs2(Card, { ...props, children: [
|
|
43
|
+
/* @__PURE__ */ jsx4(SentinelCardHeader, { module }),
|
|
44
|
+
/* @__PURE__ */ jsx4(SentinelCardContent, { module, report }),
|
|
45
|
+
children,
|
|
46
|
+
/* @__PURE__ */ jsx4(SentinelCardActions, { module, onReport: () => setRetry(retry + 1) })
|
|
47
|
+
] });
|
|
48
|
+
};
|
|
49
|
+
|
|
1
50
|
// src/contexts/Context.ts
|
|
2
51
|
import { createContextEx } from "@xyo-network/react-shared";
|
|
3
52
|
var SentinelContext = createContextEx();
|
|
@@ -6,7 +55,7 @@ var SentinelContext = createContextEx();
|
|
|
6
55
|
import { useAsyncEffect } from "@xylabs/react-async-effect";
|
|
7
56
|
import { useWitnessesFromNode } from "@xyo-network/react-witness";
|
|
8
57
|
import { MemorySentinel, SentinelConfigSchema } from "@xyo-network/sentinel";
|
|
9
|
-
import { useEffect, useState } from "react";
|
|
58
|
+
import { useEffect, useState as useState2 } from "react";
|
|
10
59
|
|
|
11
60
|
// src/contexts/State.ts
|
|
12
61
|
var SentinelReportStatus = /* @__PURE__ */ ((SentinelReportStatus2) => {
|
|
@@ -19,13 +68,13 @@ var SentinelReportStatus = /* @__PURE__ */ ((SentinelReportStatus2) => {
|
|
|
19
68
|
})(SentinelReportStatus || {});
|
|
20
69
|
|
|
21
70
|
// src/contexts/Provider.tsx
|
|
22
|
-
import { jsx } from "react/jsx-runtime";
|
|
71
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
23
72
|
var SentinelProvider = ({ account, archivist, children, filter, name, required = false }) => {
|
|
24
|
-
const [sentinel, setSentinel] =
|
|
25
|
-
const [history, setHistory] =
|
|
26
|
-
const [progress, setProgress] =
|
|
27
|
-
const [status, setStatus] =
|
|
28
|
-
const [reportingErrors, setReportingErrors] =
|
|
73
|
+
const [sentinel, setSentinel] = useState2();
|
|
74
|
+
const [history, setHistory] = useState2();
|
|
75
|
+
const [progress, setProgress] = useState2({});
|
|
76
|
+
const [status, setStatus] = useState2("idle" /* Idle */);
|
|
77
|
+
const [reportingErrors, setReportingErrors] = useState2();
|
|
29
78
|
const [witnesses] = useWitnessesFromNode(filter);
|
|
30
79
|
useAsyncEffect(
|
|
31
80
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -106,7 +155,7 @@ var SentinelProvider = ({ account, archivist, children, filter, name, required =
|
|
|
106
155
|
useEffect(() => {
|
|
107
156
|
setHistory(sentinel?.history);
|
|
108
157
|
}, [sentinel]);
|
|
109
|
-
return !required || sentinel ? /* @__PURE__ */
|
|
158
|
+
return !required || sentinel ? /* @__PURE__ */ jsx5(SentinelContext.Provider, { value: { history, progress, provided: true, reportingErrors, sentinel, status }, children }) : null;
|
|
110
159
|
};
|
|
111
160
|
|
|
112
161
|
// src/contexts/use.ts
|
|
@@ -153,6 +202,9 @@ var useSentinelsFromNode = (filter, config) => {
|
|
|
153
202
|
}
|
|
154
203
|
};
|
|
155
204
|
export {
|
|
205
|
+
SentinelCard,
|
|
206
|
+
SentinelCardContent,
|
|
207
|
+
SentinelCardHeader,
|
|
156
208
|
SentinelContext,
|
|
157
209
|
SentinelProvider,
|
|
158
210
|
SentinelReportStatus,
|