@xyo-network/react-sentinel 3.0.2 → 3.0.4

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.
Files changed (47) hide show
  1. package/dist/browser/components/Card/Card.d.ts +10 -0
  2. package/dist/browser/components/Card/Card.d.ts.map +1 -0
  3. package/dist/browser/components/Card/CardActions.d.ts +9 -0
  4. package/dist/browser/components/Card/CardActions.d.ts.map +1 -0
  5. package/dist/browser/components/Card/CardContent.d.ts +10 -0
  6. package/dist/browser/components/Card/CardContent.d.ts.map +1 -0
  7. package/dist/browser/components/Card/CardHeader.d.ts +6 -0
  8. package/dist/browser/components/Card/CardHeader.d.ts.map +1 -0
  9. package/dist/browser/components/Card/index.d.ts +4 -0
  10. package/dist/browser/components/Card/index.d.ts.map +1 -0
  11. package/dist/browser/components/index.d.ts +2 -0
  12. package/dist/browser/components/index.d.ts.map +1 -0
  13. package/dist/browser/contexts/Context.d.ts +3 -0
  14. package/dist/browser/contexts/Context.d.ts.map +1 -0
  15. package/dist/browser/contexts/Provider.d.ts +16 -0
  16. package/dist/browser/contexts/Provider.d.ts.map +1 -0
  17. package/dist/browser/contexts/State.d.ts +31 -0
  18. package/dist/browser/contexts/State.d.ts.map +1 -0
  19. package/dist/browser/contexts/index.d.ts +5 -0
  20. package/dist/browser/contexts/index.d.ts.map +1 -0
  21. package/dist/browser/contexts/use.d.ts +40 -0
  22. package/dist/browser/contexts/use.d.ts.map +1 -0
  23. package/dist/browser/hooks/index.d.ts +2 -0
  24. package/dist/browser/hooks/index.d.ts.map +1 -0
  25. package/dist/browser/hooks/node/index.d.ts +5 -0
  26. package/dist/browser/hooks/node/index.d.ts.map +1 -0
  27. package/dist/browser/hooks/node/useSentinelFromNode.d.ts +4 -0
  28. package/dist/browser/hooks/node/useSentinelFromNode.d.ts.map +1 -0
  29. package/dist/browser/hooks/node/useSentinelsFromNode.d.ts +5 -0
  30. package/dist/browser/hooks/node/useSentinelsFromNode.d.ts.map +1 -0
  31. package/dist/browser/hooks/node/useWeakSentinelFromNode.d.ts +4 -0
  32. package/dist/browser/hooks/node/useWeakSentinelFromNode.d.ts.map +1 -0
  33. package/dist/browser/hooks/node/useWeakSentinelsFromNode.d.ts +5 -0
  34. package/dist/browser/hooks/node/useWeakSentinelsFromNode.d.ts.map +1 -0
  35. package/dist/browser/index.d.ts +4 -122
  36. package/dist/browser/index.d.ts.map +1 -0
  37. package/dist/browser/index.mjs +16 -9
  38. package/dist/browser/index.mjs.map +1 -1
  39. package/package.json +66 -58
  40. package/src/components/Card/Card.stories.tsx +7 -15
  41. package/src/components/Card/Card.tsx +3 -1
  42. package/src/components/Card/CardActions.tsx +3 -1
  43. package/src/components/Card/CardContent.tsx +3 -1
  44. package/src/components/Card/CardHeader.tsx +3 -1
  45. package/src/contexts/Provider.tsx +17 -4
  46. package/src/contexts/use.ts +6 -2
  47. package/xy.config.ts +1 -3
@@ -0,0 +1,10 @@
1
+ import type { CardProps } from '@mui/material';
2
+ import type { Payload } from '@xyo-network/payload-model';
3
+ import type { ModuleRenderProps } from '@xyo-network/react-module';
4
+ import type { SentinelInstance } from '@xyo-network/sentinel-model';
5
+ import React from 'react';
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,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAG9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,KAAmB,MAAM,OAAO,CAAA;AAMvC,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,CAiBpD,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { CardActionsProps } from '@mui/material';
2
+ import type { ModuleRenderProps } from '@xyo-network/react-module';
3
+ import type { SentinelInstance } from '@xyo-network/sentinel-model';
4
+ import React from 'react';
5
+ export type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> & CardActionsProps & {
6
+ onReport?: (mod?: 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,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAElE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,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,CAUlE,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { CardContentProps } from '@mui/material';
2
+ import type { Payload } from '@xyo-network/payload-model';
3
+ import type { ModuleRenderProps } from '@xyo-network/react-module';
4
+ import type { 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,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAGlE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,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,CAalE,CAAA"}
@@ -0,0 +1,6 @@
1
+ import type { CardHeaderProps } from '@mui/material';
2
+ import type { ModuleRenderProps } from '@xyo-network/react-module';
3
+ import type { SentinelInstance } from '@xyo-network/sentinel-model';
4
+ import React from 'react';
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,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAElE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,GAAG,eAAe,CAI9F,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './Card.tsx';
2
+ export * from './CardContent.tsx';
3
+ export * from './CardHeader.tsx';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './Card/index.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { SentinelContextState } from './State.ts';
2
+ export declare const SentinelContext: import("react").Context<SentinelContextState & import("@xyo-network/react-shared").ContextExState>;
3
+ //# sourceMappingURL=Context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/contexts/Context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEtD,eAAO,MAAM,eAAe,oGAA0C,CAAA"}
@@ -0,0 +1,16 @@
1
+ import type { WithChildren } from '@xylabs/react-shared';
2
+ import type { AccountInstance } from '@xyo-network/account-model';
3
+ import type { ModuleFilter } from '@xyo-network/module-model';
4
+ import type { WitnessInstance } from '@xyo-network/witness-model';
5
+ import React from 'react';
6
+ export interface SentinelProviderProps {
7
+ account: AccountInstance;
8
+ archive?: string;
9
+ archivist?: string;
10
+ filter?: ModuleFilter;
11
+ name?: string;
12
+ required?: boolean;
13
+ witnesses?: WitnessInstance[];
14
+ }
15
+ export declare const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>>;
16
+ //# sourceMappingURL=Provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/contexts/Provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAEjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAK7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAEjE,OAAO,KAEN,MAAM,OAAO,CAAA;AAMd,MAAM,WAAW,qBAAqB;IAEpC,OAAO,EAAE,eAAe,CAAA;IAExB,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,CA4G1E,CAAA"}
@@ -0,0 +1,31 @@
1
+ import type { ArchivistModule } from '@xyo-network/archivist-model';
2
+ import type { BoundWitness } from '@xyo-network/boundwitness-model';
3
+ import type { SentinelModule } from '@xyo-network/sentinel-model';
4
+ import type { WitnessModule } from '@xyo-network/witness-model';
5
+ export declare enum SentinelReportStatus {
6
+ Idle = "idle",
7
+ Queued = "queued",
8
+ Started = "started",
9
+ Succeeded = "succeeded",
10
+ Failed = "failed"
11
+ }
12
+ export interface SentinelWitnessReportProgress {
13
+ status: SentinelReportStatus;
14
+ witness: WitnessModule;
15
+ }
16
+ export interface SentinelArchivistApiReportProgress {
17
+ archivist: ArchivistModule;
18
+ status: SentinelReportStatus;
19
+ }
20
+ export interface SentinelReportProgress {
21
+ archivists?: Record<string, SentinelArchivistApiReportProgress>;
22
+ witnesses?: Record<string, SentinelWitnessReportProgress>;
23
+ }
24
+ export interface SentinelContextState {
25
+ history?: BoundWitness[];
26
+ progress?: SentinelReportProgress;
27
+ reportingErrors?: Error[];
28
+ sentinel?: SentinelModule;
29
+ status?: SentinelReportStatus;
30
+ }
31
+ //# sourceMappingURL=State.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../src/contexts/State.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE/D,oBAAY,oBAAoB;IAC9B,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,oBAAoB,CAAA;IAC5B,OAAO,EAAE,aAAa,CAAA;CACvB;AAED,MAAM,WAAW,kCAAkC;IACjD,SAAS,EAAE,eAAe,CAAA;IAC1B,MAAM,EAAE,oBAAoB,CAAA;CAC7B;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kCAAkC,CAAC,CAAA;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAA;CAC1D;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB,QAAQ,CAAC,EAAE,sBAAsB,CAAA;IACjC,eAAe,CAAC,EAAE,KAAK,EAAE,CAAA;IACzB,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,MAAM,CAAC,EAAE,oBAAoB,CAAA;CAC9B"}
@@ -0,0 +1,5 @@
1
+ export * from './Context.ts';
2
+ export * from './Provider.tsx';
3
+ export * from './State.ts';
4
+ export * from './use.ts';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA"}
@@ -0,0 +1,40 @@
1
+ export declare const useSentinelContext: () => {
2
+ history: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & import("@xyo-network/boundwitness-model").BoundWitnessFields & {
3
+ schema: "network.xyo.boundwitness";
4
+ })[] | undefined;
5
+ progress: import("./State.ts").SentinelReportProgress | undefined;
6
+ reportingErrors: Error[] | undefined;
7
+ sentinel: import("@xyo-network/sentinel-model").SentinelModule<import("@xylabs/object").BaseParamsFields & {
8
+ account?: import("@xyo-network/account-model").AccountInstance | "random";
9
+ addToResolvers?: boolean;
10
+ additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
11
+ allowNameResolution?: boolean;
12
+ config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
13
+ automations?: import("@xyo-network/sentinel-model").SentinelAutomationPayload[];
14
+ schema: "network.xyo.sentinel.config";
15
+ synchronous?: boolean;
16
+ tasks: import("@xyo-network/sentinel-model").Task[];
17
+ throwErrors?: boolean;
18
+ }, "schema"> & {
19
+ schema: "network.xyo.sentinel.config";
20
+ }, "schema"> & {
21
+ schema: string;
22
+ };
23
+ ephemeralQueryAccountEnabled?: boolean;
24
+ moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
25
+ }, import("@xyo-network/sentinel-model").SentinelModuleEventData<import("@xyo-network/module-model").Module<import("@xylabs/object").BaseParamsFields & {
26
+ account?: import("@xyo-network/account-model").AccountInstance | "random";
27
+ addToResolvers?: boolean;
28
+ additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
29
+ allowNameResolution?: boolean;
30
+ config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
31
+ schema: "network.xyo.module.config";
32
+ }, "schema"> & {
33
+ schema: string;
34
+ };
35
+ ephemeralQueryAccountEnabled?: boolean;
36
+ moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
37
+ }, import("@xyo-network/module-model").ModuleEventData<object>>>> | undefined;
38
+ status: import("./State.ts").SentinelReportStatus | undefined;
39
+ };
40
+ //# sourceMappingURL=use.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAO9B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './node/index.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,5 @@
1
+ export * from './useSentinelFromNode.tsx';
2
+ export * from './useSentinelsFromNode.tsx';
3
+ export * from './useWeakSentinelFromNode.tsx';
4
+ export * from './useWeakSentinelsFromNode.tsx';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,gCAAgC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { ModuleFromNodeConfig } from '@xyo-network/react-node';
2
+ import type { SentinelInstance } from '@xyo-network/sentinel-model';
3
+ export declare const useSentinelFromNode: (nameOrAddressOrInstance?: string | SentinelInstance, config?: ModuleFromNodeConfig) => [SentinelInstance | undefined, Error | undefined];
4
+ //# sourceMappingURL=useSentinelFromNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSentinelFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAEnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAGnE,eAAO,MAAM,mBAAmB,6BACJ,MAAM,GAAG,gBAAgB,WAC1C,oBAAoB,KAC5B,CAAC,gBAAgB,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CASlD,CAAA"}
@@ -0,0 +1,5 @@
1
+ import type { ModuleFilter } from '@xyo-network/module-model';
2
+ import type { ModuleFromNodeConfig } from '@xyo-network/react-node';
3
+ import type { SentinelInstance } from '@xyo-network/sentinel-model';
4
+ export declare const useSentinelsFromNode: (filter?: ModuleFilter, config?: ModuleFromNodeConfig) => [SentinelInstance[] | null | undefined, Error | undefined];
5
+ //# sourceMappingURL=useSentinelsFromNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSentinelsFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useSentinelsFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAEnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAGnE,eAAO,MAAM,oBAAoB,YACtB,YAAY,WACZ,oBAAoB,KAC5B,CAAC,gBAAgB,EAAE,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAiB3D,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { WeakModuleFromNodeConfig } from '@xyo-network/react-node';
2
+ import type { SentinelInstance } from '@xyo-network/sentinel-model';
3
+ export declare const useWeakSentinelFromNode: (nameOrAddressOrInstance?: string | SentinelInstance, config?: WeakModuleFromNodeConfig) => [WeakRef<SentinelInstance> | undefined, Error | undefined];
4
+ //# sourceMappingURL=useWeakSentinelFromNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWeakSentinelFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useWeakSentinelFromNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAEvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAGnE,eAAO,MAAM,uBAAuB,6BACR,MAAM,GAAG,gBAAgB,WAC1C,wBAAwB,KAChC,CAAC,OAAO,CAAC,gBAAgB,CAAC,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAE3D,CAAA"}
@@ -0,0 +1,5 @@
1
+ import type { ModuleFilter } from '@xyo-network/module-model';
2
+ import type { ModuleFromNodeConfig } from '@xyo-network/react-node';
3
+ import type { SentinelInstance } from '@xyo-network/sentinel-model';
4
+ export declare const useWeakSentinelsFromNode: (filter?: ModuleFilter, config?: ModuleFromNodeConfig) => [WeakRef<SentinelInstance>[] | null | undefined, Error | undefined];
5
+ //# sourceMappingURL=useWeakSentinelsFromNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWeakSentinelsFromNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/node/useWeakSentinelsFromNode.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAEnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAGnE,eAAO,MAAM,wBAAwB,YAC1B,YAAY,WACZ,oBAAoB,KAC5B,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CAgBpE,CAAA"}
@@ -1,122 +1,4 @@
1
- import { CardProps, CardContentProps, CardHeaderProps } from '@mui/material';
2
- import * as _xyo_network_payload_model from '@xyo-network/payload-model';
3
- import { Payload } from '@xyo-network/payload-model';
4
- import { ModuleRenderProps } from '@xyo-network/react-module';
5
- import * as _xyo_network_sentinel_model from '@xyo-network/sentinel-model';
6
- import { SentinelInstance, SentinelModule } from '@xyo-network/sentinel-model';
7
- import * as React from 'react';
8
- import React__default from 'react';
9
- import * as _xyo_network_react_shared from '@xyo-network/react-shared';
10
- import { ArchivistModule } from '@xyo-network/archivist-model';
11
- import * as _xyo_network_boundwitness_model from '@xyo-network/boundwitness-model';
12
- import { BoundWitness } from '@xyo-network/boundwitness-model';
13
- import { WitnessModule, WitnessInstance } from '@xyo-network/witness-model';
14
- import { WithChildren } from '@xylabs/react-shared';
15
- import * as _xyo_network_account_model from '@xyo-network/account-model';
16
- import { AccountInstance } from '@xyo-network/account-model';
17
- import * as _xyo_network_module_model from '@xyo-network/module-model';
18
- import { ModuleFilter } from '@xyo-network/module-model';
19
- import * as _xylabs_object from '@xylabs/object';
20
- import { ModuleFromNodeConfig, WeakModuleFromNodeConfig } from '@xyo-network/react-node';
21
-
22
- type SentinelCardProps = CardProps & ModuleRenderProps<SentinelInstance> & {
23
- inPayloads?: Payload[];
24
- };
25
- declare const SentinelCard: React__default.FC<SentinelCardProps>;
26
-
27
- type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> & CardContentProps & {
28
- report?: Payload[];
29
- };
30
- declare const SentinelCardContent: React__default.FC<SentinelCardContentProps>;
31
-
32
- declare const SentinelCardHeader: React__default.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps>;
33
-
34
- declare enum SentinelReportStatus {
35
- Idle = "idle",
36
- Queued = "queued",
37
- Started = "started",
38
- Succeeded = "succeeded",
39
- Failed = "failed"
40
- }
41
- interface SentinelWitnessReportProgress {
42
- status: SentinelReportStatus;
43
- witness: WitnessModule;
44
- }
45
- interface SentinelArchivistApiReportProgress {
46
- archivist: ArchivistModule;
47
- status: SentinelReportStatus;
48
- }
49
- interface SentinelReportProgress {
50
- archivists?: Record<string, SentinelArchivistApiReportProgress>;
51
- witnesses?: Record<string, SentinelWitnessReportProgress>;
52
- }
53
- interface SentinelContextState {
54
- history?: BoundWitness[];
55
- progress?: SentinelReportProgress;
56
- reportingErrors?: Error[];
57
- sentinel?: SentinelModule;
58
- status?: SentinelReportStatus;
59
- }
60
-
61
- declare const SentinelContext: React.Context<SentinelContextState & _xyo_network_react_shared.ContextExState>;
62
-
63
- interface SentinelProviderProps {
64
- account: AccountInstance;
65
- archive?: string;
66
- archivist?: string;
67
- filter?: ModuleFilter;
68
- name?: string;
69
- required?: boolean;
70
- witnesses?: WitnessInstance[];
71
- }
72
- declare const SentinelProvider: React__default.FC<WithChildren<SentinelProviderProps>>;
73
-
74
- declare const useSentinelContext: () => {
75
- history: (_xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & _xyo_network_boundwitness_model.BoundWitnessFields & {
76
- schema: "network.xyo.boundwitness";
77
- })[] | undefined;
78
- progress: SentinelReportProgress | undefined;
79
- reportingErrors: Error[] | undefined;
80
- sentinel: _xyo_network_sentinel_model.SentinelModule<_xylabs_object.BaseParamsFields & {
81
- account?: _xyo_network_account_model.AccountInstance | "random";
82
- addToResolvers?: boolean;
83
- additionalSigners?: _xyo_network_account_model.AccountInstance[];
84
- allowNameResolution?: boolean;
85
- config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<_xyo_network_module_model.ArchivingModuleConfig & _xyo_network_module_model.ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<_xyo_network_module_model.ArchivingModuleConfig & _xyo_network_module_model.ModuleConfigFields & {
86
- automations?: _xyo_network_sentinel_model.SentinelAutomationPayload[];
87
- schema: "network.xyo.sentinel.config";
88
- synchronous?: boolean;
89
- tasks: _xyo_network_sentinel_model.Task[];
90
- throwErrors?: boolean;
91
- }, "schema"> & {
92
- schema: "network.xyo.sentinel.config";
93
- }, "schema"> & {
94
- schema: string;
95
- };
96
- ephemeralQueryAccountEnabled?: boolean;
97
- moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
98
- }, _xyo_network_sentinel_model.SentinelModuleEventData<_xyo_network_module_model.Module<_xylabs_object.BaseParamsFields & {
99
- account?: _xyo_network_account_model.AccountInstance | "random";
100
- addToResolvers?: boolean;
101
- additionalSigners?: _xyo_network_account_model.AccountInstance[];
102
- allowNameResolution?: boolean;
103
- config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<_xyo_network_module_model.ArchivingModuleConfig & _xyo_network_module_model.ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & {
104
- schema: "network.xyo.module.config";
105
- }, "schema"> & {
106
- schema: string;
107
- };
108
- ephemeralQueryAccountEnabled?: boolean;
109
- moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
110
- }, _xyo_network_module_model.ModuleEventData<object>>>> | undefined;
111
- status: SentinelReportStatus | undefined;
112
- };
113
-
114
- declare const useSentinelFromNode: (nameOrAddressOrInstance?: string | SentinelInstance, config?: ModuleFromNodeConfig) => [SentinelInstance | undefined, Error | undefined];
115
-
116
- declare const useSentinelsFromNode: (filter?: ModuleFilter, config?: ModuleFromNodeConfig) => [SentinelInstance[] | null | undefined, Error | undefined];
117
-
118
- declare const useWeakSentinelFromNode: (nameOrAddressOrInstance?: string | SentinelInstance, config?: WeakModuleFromNodeConfig) => [WeakRef<SentinelInstance> | undefined, Error | undefined];
119
-
120
- declare const useWeakSentinelsFromNode: (filter?: ModuleFilter, config?: ModuleFromNodeConfig) => [WeakRef<SentinelInstance>[] | null | undefined, Error | undefined];
121
-
122
- export { type SentinelArchivistApiReportProgress, SentinelCard, SentinelCardContent, type SentinelCardContentProps, SentinelCardHeader, type SentinelCardProps, SentinelContext, type SentinelContextState, SentinelProvider, type SentinelProviderProps, type SentinelReportProgress, SentinelReportStatus, type SentinelWitnessReportProgress, useSentinelContext, useSentinelFromNode, useSentinelsFromNode, useWeakSentinelFromNode, useWeakSentinelsFromNode };
1
+ export * from './components/index.ts';
2
+ export * from './contexts/index.ts';
3
+ export * from './hooks/index.ts';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
@@ -83,7 +83,7 @@ import { useWitnessesFromNode } from "@xyo-network/react-witness";
83
83
  import { MemorySentinel } from "@xyo-network/sentinel-memory";
84
84
  import { SentinelConfigSchema } from "@xyo-network/sentinel-model";
85
85
  import { asWitnessInstance } from "@xyo-network/witness-model";
86
- import React5, { useEffect, useState as useState2 } from "react";
86
+ import React5, { useEffect, useMemo, useState as useState2 } from "react";
87
87
 
88
88
  // src/contexts/State.ts
89
89
  var SentinelReportStatus;
@@ -184,15 +184,22 @@ var SentinelProvider = /* @__PURE__ */ __name(({ account, archivist, children, f
184
184
  }, [
185
185
  sentinel
186
186
  ]);
187
+ const value = useMemo(() => ({
188
+ history,
189
+ progress,
190
+ provided: true,
191
+ reportingErrors,
192
+ sentinel,
193
+ status
194
+ }), [
195
+ history,
196
+ progress,
197
+ reportingErrors,
198
+ sentinel,
199
+ status
200
+ ]);
187
201
  return !required || sentinel ? /* @__PURE__ */ React5.createElement(SentinelContext.Provider, {
188
- value: {
189
- history,
190
- progress,
191
- provided: true,
192
- reportingErrors,
193
- sentinel,
194
- status
195
- }
202
+ value
196
203
  }, children) : null;
197
204
  }, "SentinelProvider");
198
205
 
@@ -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 type { CardProps } from '@mui/material'\nimport { Card } from '@mui/material'\nimport { usePromise } from '@xylabs/react-promise'\nimport type { Payload } from '@xyo-network/payload-model'\nimport type { ModuleRenderProps } from '@xyo-network/react-module'\nimport type { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React, { useState } from 'react'\n\nimport { SentinelCardActions } from './CardActions.tsx'\nimport { SentinelCardContent } from './CardContent.tsx'\nimport { SentinelCardHeader } from './CardHeader.tsx'\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 type { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport type { ModuleRenderProps } from '@xyo-network/react-module'\nimport { ModuleCardActions } from '@xyo-network/react-module'\nimport type { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\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 type { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport type { Payload } from '@xyo-network/payload-model'\nimport type { ModuleRenderProps } from '@xyo-network/react-module'\nimport { ModuleCardContent } from '@xyo-network/react-module'\nimport { JsonViewerEx } from '@xyo-network/react-payload-raw-info'\nimport type { 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 type { CardHeaderProps } from '@mui/material'\nimport type { ModuleRenderProps } from '@xyo-network/react-module'\nimport { ModuleCardHeader } from '@xyo-network/react-module'\nimport type { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\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 type { SentinelContextState } from './State.ts'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport type { WithChildren } from '@xylabs/react-shared'\nimport type { AccountInstance } from '@xyo-network/account-model'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport type { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel } from '@xyo-network/sentinel-memory'\nimport type { SentinelConfig } from '@xyo-network/sentinel-model'\nimport { SentinelConfigSchema } from '@xyo-network/sentinel-model'\nimport type { WitnessInstance } from '@xyo-network/witness-model'\nimport { asWitnessInstance } from '@xyo-network/witness-model'\nimport React, { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context.ts'\nimport type { SentinelReportProgress } from './State.ts'\nimport { SentinelReportStatus } from './State.ts'\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\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\n tasks: witnesses?.map(mod => ({ mod: mod.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ 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', ({ 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', ({ 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\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel\n // eslint-disable-next-line @eslint-react/no-unstable-context-value\n ? <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n : null\n}\n","import type { ArchivistModule } from '@xyo-network/archivist-model'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport type { SentinelModule } from '@xyo-network/sentinel-model'\nimport type { 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.ts'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","import type { ModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useModuleFromNode } from '@xyo-network/react-node'\nimport type { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { asSentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\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 type { ModuleFilter } from '@xyo-network/module-model'\nimport type { ModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useModulesFromNode } from '@xyo-network/react-node'\nimport type { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { isSentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules\n ? [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, mod) => {\n if (isSentinelInstance(mod)) {\n prev.push(mod)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import type { WeakModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useWeakModuleFromNode } from '@xyo-network/react-node'\nimport type { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { isSentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: WeakModuleFromNodeConfig,\n): [WeakRef<SentinelInstance> | undefined, Error | undefined] => {\n return useWeakModuleFromNode<SentinelInstance>(nameOrAddressOrInstance, { identity: isSentinelInstance, ...config })\n}\n","import { exists } from '@xylabs/exists'\nimport type { ModuleFilter } from '@xyo-network/module-model'\nimport type { ModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useWeakModulesFromNode } from '@xyo-network/react-node'\nimport type { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { asSentinelInstance } 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":";;;;AACA,SAASA,YAAY;AACrB,SAASC,kBAAkB;AAI3B,OAAOC,UAASC,gBAAgB;;;ACLhC,SAASC,gBAAgB;AAEzB,SAASC,yBAAyB;AAElC,OAAOC,WAAW;AAOX,IAAMC,sBAA0D,wBAAC,EAAEC,UAAUC,KAAK,GAAGC,MAAAA,MAAO;AACjG,SACE,sBAAA,cAACC,mBAAAA;IAAkBF;IAAW,GAAGC;KAC/B,sBAAA,cAACE,UAAAA;IAASC,SAAS,6BAAML,WAAWC,GAAAA,GAAjB;IAAuBK,MAAK;IAAQC,SAAQ;KAAW,QAAA,CAAA;AAKhF,GARuE;;;ACXvE,SAASC,mBAAmB;AAG5B,SAASC,yBAAyB;AAClC,SAASC,oBAAoB;AAE7B,OAAOC,YAAW;AAOX,IAAMC,sBAA0D,wBAAC,EAAEC,UAAUC,QAAQC,KAAK,GAAGC,MAAAA,MAAO;AACzG,SACE,gBAAAC,OAAA,cAACC,mBAAAA;IAAkBH;IAAW,GAAGC;KAC/B,gBAAAC,OAAA,cAACE,aAAAA;IAAYC,UAAS;IAAOC,gBAAe;IAAQC,KAAK;KACtDR,SACG,gBAAAG,OAAA,cAACM,cAAAA;IAAaC,OAAOV;OACrB,MACHD,QAAAA,CAAAA;AAIT,GAXuE;;;ACZvE,SAASY,wBAAwB;AAEjC,OAAOC,YAAW;AAEX,IAAMC,qBAAsF,wBAAC,EAAEC,OAAOC,KAAK,GAAGC,MAAAA,MAAO;AAC1H,SAAO,gBAAAC,OAAA,cAACC,kBAAAA;IAAiBH;IAAUD,OAAOA,SAASC,KAAKI,OAAOC,QAAQ;IAAa,GAAGJ;;AACzF,GAFmG;;;AHW5F,IAAMK,eAA4C,wBAAC,EAAEC,UAAUC,YAAYC,KAAK,GAAGC,MAAAA,MAAO;AAC/F,QAAM,CAACC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AQP,IAAIQ,OAAO,GAAG;AAC9HC,YAAQR,MAAMA,OAAMS,OAAO;AAC3B,WAAO;MAACC;MAAWV;;EACrB;AACA,SAAO;IAACE;IAAUF;;AACpB,GAZmC;;;ACHnC,SAASW,0BAA0B;AAEnC,SAASC,0BAA0B;AAE5B,IAAMC,uBAAuB,wBAClCC,QACAC,WAAAA;AAEA,QAAM,CAACC,SAASC,KAAAA,IAASC,mBAAmBJ,QAAQC,MAAAA;AACpD,MAAIE,OAAO;AACT,WAAO;MAAC;MAAMA;;EAChB;AACA,SAAOD,UACH;;IAEEA,QAAQG,OAA2B,CAACC,MAAMC,QAAAA;AACxC,UAAIC,mBAAmBD,GAAAA,GAAM;AAC3BD,aAAKG,KAAKF,GAAAA;MACZ;AACA,aAAOD;IACT,GAAG,CAAA,CAAE;IACLI;MAEF;IAACR;IAASC;;AAChB,GApBoC;;;ACLpC,SAASQ,6BAA6B;AAEtC,SAASC,sBAAAA,2BAA0B;AAE5B,IAAMC,0BAA0B,wBACrCC,yBACAC,WAAAA;AAEA,SAAOC,sBAAwCF,yBAAyB;IAAEG,UAAUC;IAAoB,GAAGH;EAAO,CAAA;AACpH,GALuC;;;ACLvC,SAASI,cAAc;AAGvB,SAASC,8BAA8B;AAEvC,SAASC,sBAAAA,2BAA0B;AAE5B,IAAMC,2BAA2B,wBACtCC,QACAC,WAAAA;AAEA,QAAM,CAACC,SAASC,KAAAA,IAASC,uBAAuBJ,QAAQC,MAAAA;AACxD,MAAIE,OAAO;AACT,WAAO;MAAC;MAAMA;;EAChB;AACA,SAAO;IACLD,SACIG,IAAI,CAACC,QAAAA;AACL,YAAMC,WAAWC,oBAAmBF,KAAKG,MAAAA,CAAAA;AACzC,UAAIF,UAAU;AACZ,eAAO,IAAIG,QAAQH,QAAAA;MACrB;IACF,CAAA,EACCP,OAAOW,MAAAA,KAAW,CAAA;IACrBC;;AAEJ,GAnBwC;","names":["Card","usePromise","React","useState","ButtonEx","ModuleCardActions","React","SentinelCardActions","onReport","mod","props","ModuleCardActions","ButtonEx","onClick","size","variant","FlexGrowRow","ModuleCardContent","JsonViewerEx","React","SentinelCardContent","children","report","mod","props","React","ModuleCardContent","FlexGrowRow","flexWrap","justifyContent","gap","JsonViewerEx","value","ModuleCardHeader","React","SentinelCardHeader","title","mod","props","React","ModuleCardHeader","config","name","SentinelCard","children","inPayloads","mod","props","retry","setRetry","useState","report","usePromise","React","Card","SentinelCardHeader","SentinelCardContent","SentinelCardActions","onReport","createContextEx","SentinelContext","useAsyncEffect","useWitnessesFromNode","MemorySentinel","SentinelConfigSchema","asWitnessInstance","React","useEffect","useState","SentinelReportStatus","SentinelProvider","account","archivist","children","filter","name","required","sentinel","setSentinel","useState","history","setHistory","progress","setProgress","status","setStatus","SentinelReportStatus","Idle","reportingErrors","setReportingErrors","witnesses","useWitnessesFromNode","useAsyncEffect","mounted","MemorySentinel","create","config","archivists","undefined","schema","SentinelConfigSchema","synchronous","tasks","map","mod","address","offCallbacks","push","on","outPayloads","length","Succeeded","Failed","Error","Started","witness","asWitnessInstance","id","callback","useEffect","React","SentinelContext","Provider","value","provided","useContextEx","useSentinelContext","sentinel","history","progress","reportingErrors","status","useContextEx","SentinelContext","useModuleFromNode","asSentinelInstance","useSentinelFromNode","nameOrAddressOrInstance","config","mod","error","useModuleFromNode","instance","asSentinelInstance","Error","schema","name","address","console","message","undefined","useModulesFromNode","isSentinelInstance","useSentinelsFromNode","filter","config","modules","error","useModulesFromNode","reduce","prev","mod","isSentinelInstance","push","undefined","useWeakModuleFromNode","isSentinelInstance","useWeakSentinelFromNode","nameOrAddressOrInstance","config","useWeakModuleFromNode","identity","isSentinelInstance","exists","useWeakModulesFromNode","asSentinelInstance","useWeakSentinelsFromNode","filter","config","modules","error","useWeakModulesFromNode","map","mod","instance","asSentinelInstance","deref","WeakRef","exists","undefined"]}
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 type { CardProps } from '@mui/material'\nimport { Card } from '@mui/material'\nimport { usePromise } from '@xylabs/react-promise'\nimport type { Payload } from '@xyo-network/payload-model'\nimport type { ModuleRenderProps } from '@xyo-network/react-module'\nimport type { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React, { useState } from 'react'\n\nimport { SentinelCardActions } from './CardActions.tsx'\nimport { SentinelCardContent } from './CardContent.tsx'\nimport { SentinelCardHeader } from './CardHeader.tsx'\n\nexport type SentinelCardProps = CardProps &\n ModuleRenderProps<SentinelInstance> & {\n inPayloads?: Payload[]\n }\n\nexport const SentinelCard: React.FC<SentinelCardProps> = ({\n children, inPayloads, mod, ...props\n}) => {\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 type { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport type { ModuleRenderProps } from '@xyo-network/react-module'\nimport { ModuleCardActions } from '@xyo-network/react-module'\nimport type { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\n\nexport type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &\n CardActionsProps & {\n onReport?: (mod?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({\n onReport, mod, ...props\n}) => {\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 type { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport type { Payload } from '@xyo-network/payload-model'\nimport type { ModuleRenderProps } from '@xyo-network/react-module'\nimport { ModuleCardContent } from '@xyo-network/react-module'\nimport { JsonViewerEx } from '@xyo-network/react-payload-raw-info'\nimport type { 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> = ({\n children, report, mod, ...props\n}) => {\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 type { CardHeaderProps } from '@mui/material'\nimport type { ModuleRenderProps } from '@xyo-network/react-module'\nimport { ModuleCardHeader } from '@xyo-network/react-module'\nimport type { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\n\nexport const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({\n title, mod, ...props\n}) => {\n return <ModuleCardHeader mod={mod} title={title ?? mod?.config.name ?? 'Sentinel'} {...props} />\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport type { SentinelContextState } from './State.ts'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport type { WithChildren } from '@xylabs/react-shared'\nimport type { AccountInstance } from '@xyo-network/account-model'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport type { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel } from '@xyo-network/sentinel-memory'\nimport type { SentinelConfig } from '@xyo-network/sentinel-model'\nimport { SentinelConfigSchema } from '@xyo-network/sentinel-model'\nimport type { WitnessInstance } from '@xyo-network/witness-model'\nimport { asWitnessInstance } from '@xyo-network/witness-model'\nimport React, {\n useEffect, useMemo, useState,\n} from 'react'\n\nimport { SentinelContext } from './Context.ts'\nimport type { SentinelReportProgress } from './State.ts'\nimport { SentinelReportStatus } from './State.ts'\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>> = ({\n account, archivist, children, filter, name, required = false,\n}) => {\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\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\n tasks: witnesses?.map(mod => ({ mod: mod.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ 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', ({ 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', ({ 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\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n const value = useMemo(() => ({\n history, progress, provided: true, reportingErrors, sentinel, status,\n }), [history, progress, reportingErrors, sentinel, status])\n\n return !required || sentinel\n\n ? (\n <SentinelContext.Provider value={value}>\n {children}\n </SentinelContext.Provider>\n )\n : null\n}\n","import type { ArchivistModule } from '@xyo-network/archivist-model'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport type { SentinelModule } from '@xyo-network/sentinel-model'\nimport type { 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.ts'\n\nexport const useSentinelContext = () => {\n const {\n sentinel, history, progress, reportingErrors, status,\n } = useContextEx(SentinelContext, 'Sentinel')\n return {\n history, progress, reportingErrors, sentinel, status,\n }\n}\n","import type { ModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useModuleFromNode } from '@xyo-network/react-node'\nimport type { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { asSentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\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 type { ModuleFilter } from '@xyo-network/module-model'\nimport type { ModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useModulesFromNode } from '@xyo-network/react-node'\nimport type { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { isSentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules\n ? [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, mod) => {\n if (isSentinelInstance(mod)) {\n prev.push(mod)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import type { WeakModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useWeakModuleFromNode } from '@xyo-network/react-node'\nimport type { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { isSentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const useWeakSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: WeakModuleFromNodeConfig,\n): [WeakRef<SentinelInstance> | undefined, Error | undefined] => {\n return useWeakModuleFromNode<SentinelInstance>(nameOrAddressOrInstance, { identity: isSentinelInstance, ...config })\n}\n","import { exists } from '@xylabs/exists'\nimport type { ModuleFilter } from '@xyo-network/module-model'\nimport type { ModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useWeakModulesFromNode } from '@xyo-network/react-node'\nimport type { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { asSentinelInstance } 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":";;;;AACA,SAASA,YAAY;AACrB,SAASC,kBAAkB;AAI3B,OAAOC,UAASC,gBAAgB;;;ACLhC,SAASC,gBAAgB;AAEzB,SAASC,yBAAyB;AAElC,OAAOC,WAAW;AAOX,IAAMC,sBAA0D,wBAAC,EACtEC,UAAUC,KAAK,GAAGC,MAAAA,MACnB;AACC,SACE,sBAAA,cAACC,mBAAAA;IAAkBF;IAAW,GAAGC;KAC/B,sBAAA,cAACE,UAAAA;IAASC,SAAS,6BAAML,WAAWC,GAAAA,GAAjB;IAAuBK,MAAK;IAA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,QAAAA;AACxC,UAAIC,mBAAmBD,GAAAA,GAAM;AAC3BD,aAAKG,KAAKF,GAAAA;MACZ;AACA,aAAOD;IACT,GAAG,CAAA,CAAE;IACLI;MAEF;IAACR;IAASC;;AAChB,GApBoC;;;ACLpC,SAASQ,6BAA6B;AAEtC,SAASC,sBAAAA,2BAA0B;AAE5B,IAAMC,0BAA0B,wBACrCC,yBACAC,WAAAA;AAEA,SAAOC,sBAAwCF,yBAAyB;IAAEG,UAAUC;IAAoB,GAAGH;EAAO,CAAA;AACpH,GALuC;;;ACLvC,SAASI,cAAc;AAGvB,SAASC,8BAA8B;AAEvC,SAASC,sBAAAA,2BAA0B;AAE5B,IAAMC,2BAA2B,wBACtCC,QACAC,WAAAA;AAEA,QAAM,CAACC,SAASC,KAAAA,IAASC,uBAAuBJ,QAAQC,MAAAA;AACxD,MAAIE,OAAO;AACT,WAAO;MAAC;MAAMA;;EAChB;AACA,SAAO;IACLD,SACIG,IAAI,CAACC,QAAAA;AACL,YAAMC,WAAWC,oBAAmBF,KAAKG,MAAAA,CAAAA;AACzC,UAAIF,UAAU;AACZ,eAAO,IAAIG,QAAQH,QAAAA;MACrB;IACF,CAAA,EACCP,OAAOW,MAAAA,KAAW,CAAA;IACrBC;;AAEJ,GAnBwC;","names":["Card","usePromise","React","useState","ButtonEx","ModuleCardActions","React","SentinelCardActions","onReport","mod","props","ModuleCardActions","ButtonEx","onClick","size","variant","FlexGrowRow","ModuleCardContent","JsonViewerEx","React","SentinelCardContent","children","report","mod","props","React","ModuleCardContent","FlexGrowRow","flexWrap","justifyContent","gap","JsonViewerEx","value","ModuleCardHeader","React","SentinelCardHeader","title","mod","props","React","ModuleCardHeader","config","name","SentinelCard","children","inPayloads","mod","props","retry","setRetry","useState","report","usePromise","React","Card","SentinelCardHeader","SentinelCardContent","SentinelCardActions","onReport","createContextEx","SentinelContext","useAsyncEffect","useWitnessesFromNode","MemorySentinel","SentinelConfigSchema","asWitnessInstance","React","useEffect","useMemo","useState","SentinelReportStatus","SentinelProvider","account","archivist","children","filter","name","required","sentinel","setSentinel","useState","history","setHistory","progress","setProgress","status","setStatus","SentinelReportStatus","Idle","reportingErrors","setReportingErrors","witnesses","useWitnessesFromNode","useAsyncEffect","mounted","MemorySentinel","create","config","archivists","undefined","schema","SentinelConfigSchema","synchronous","tasks","map","mod","address","offCallbacks","push","on","outPayloads","length","Succeeded","Failed","Error","Started","witness","asWitnessInstance","id","callback","useEffect","value","useMemo","provided","React","SentinelContext","Provider","useContextEx","useSentinelContext","sentinel","history","progress","reportingErrors","status","useContextEx","SentinelContext","useModuleFromNode","asSentinelInstance","useSentinelFromNode","nameOrAddressOrInstance","config","mod","error","useModuleFromNode","instance","asSentinelInstance","Error","schema","name","address","console","message","undefined","useModulesFromNode","isSentinelInstance","useSentinelsFromNode","filter","config","modules","error","useModulesFromNode","reduce","prev","mod","isSentinelInstance","push","undefined","useWeakModuleFromNode","isSentinelInstance","useWeakSentinelFromNode","nameOrAddressOrInstance","config","useWeakModuleFromNode","identity","isSentinelInstance","exists","useWeakModulesFromNode","asSentinelInstance","useWeakSentinelsFromNode","filter","config","modules","error","useWeakModulesFromNode","map","mod","instance","asSentinelInstance","deref","WeakRef","exists","undefined"]}
package/package.json CHANGED
@@ -1,44 +1,85 @@
1
1
  {
2
2
  "name": "@xyo-network/react-sentinel",
3
+ "version": "3.0.4",
4
+ "description": "Common React library for all XYO projects that use React",
5
+ "keywords": [
6
+ "xyo",
7
+ "utility",
8
+ "typescript",
9
+ "react"
10
+ ],
11
+ "homepage": "https://xyo.network",
12
+ "bugs": {
13
+ "url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues",
14
+ "email": "support@xyo.network"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
19
+ },
20
+ "license": "LGPL-3.0-only",
3
21
  "author": {
4
- "email": "support@xyo.network",
5
22
  "name": "XYO Development Team",
23
+ "email": "support@xyo.network",
6
24
  "url": "https://xyo.network"
7
25
  },
8
- "bugs": {
9
- "email": "support@xyo.network",
10
- "url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
26
+ "sideEffects": false,
27
+ "type": "module",
28
+ "exports": {
29
+ ".": {
30
+ "import": {
31
+ "types": "./dist/browser/index.d.ts",
32
+ "default": "./dist/browser/index.mjs"
33
+ },
34
+ "types": "./dist/browser/index.d.ts",
35
+ "default": "./dist/browser/index.mjs"
36
+ },
37
+ "./package.json": "./package.json"
38
+ },
39
+ "module": "dist/browser/index.mjs",
40
+ "types": "dist/browser/index.d.ts",
41
+ "scripts": {
42
+ "license": "yarn license-checker --exclude \"MIT, ISC, Apache-2.0, BSD, BSD-2-Clause, CC-BY-4.0, Unlicense, CC-BY-3.0, CC0-1.0\"",
43
+ "lint-pkg": "npmPkgJsonLint ."
11
44
  },
12
45
  "dependencies": {
13
- "@xylabs/exists": "^4.0.2",
46
+ "@xylabs/exists": "^4.0.5",
14
47
  "@xylabs/react-async-effect": "^4.0.3",
15
48
  "@xylabs/react-button": "^4.0.3",
16
49
  "@xylabs/react-flexbox": "^4.0.3",
17
50
  "@xylabs/react-promise": "^4.0.3",
18
51
  "@xylabs/react-shared": "^4.0.3",
19
- "@xyo-network/account-model": "^3.0.3",
20
- "@xyo-network/archivist-model": "^3.0.3",
21
- "@xyo-network/boundwitness-model": "^3.0.3",
22
- "@xyo-network/module-model": "^3.0.3",
23
- "@xyo-network/payload-model": "^3.0.3",
24
- "@xyo-network/react-module": "^3.0.2",
25
- "@xyo-network/react-node": "^3.0.2",
26
- "@xyo-network/react-payload-raw-info": "^3.0.2",
27
- "@xyo-network/react-shared": "^3.0.2",
28
- "@xyo-network/react-witness": "^3.0.2",
29
- "@xyo-network/sentinel-memory": "^3.0.3",
30
- "@xyo-network/sentinel-model": "^3.0.3",
31
- "@xyo-network/witness-model": "^3.0.3"
52
+ "@xyo-network/account-model": "^3.0.15",
53
+ "@xyo-network/archivist-model": "^3.0.15",
54
+ "@xyo-network/boundwitness-model": "^3.0.15",
55
+ "@xyo-network/module-model": "^3.0.15",
56
+ "@xyo-network/payload-model": "^3.0.15",
57
+ "@xyo-network/react-module": "^3.0.4",
58
+ "@xyo-network/react-node": "^3.0.4",
59
+ "@xyo-network/react-payload-raw-info": "^3.0.4",
60
+ "@xyo-network/react-shared": "^3.0.4",
61
+ "@xyo-network/react-witness": "^3.0.4",
62
+ "@xyo-network/sentinel-memory": "^3.0.15",
63
+ "@xyo-network/sentinel-model": "^3.0.15",
64
+ "@xyo-network/witness-model": "^3.0.15"
32
65
  },
33
66
  "devDependencies": {
67
+ "@emotion/react": "^11.13.3",
68
+ "@emotion/styled": "^11.13.0",
69
+ "@mui/icons-material": "^5.16.7",
70
+ "@mui/material": "^5.16.7",
71
+ "@mui/styles": "^5.16.7",
34
72
  "@storybook/react": "^8.2.9",
35
- "@xylabs/ts-scripts-yarn3": "^4.0.0-rc.20",
36
- "@xylabs/tsconfig-react": "^4.0.0-rc.20",
37
- "@xyo-network/account": "^3.0.3",
38
- "@xyo-network/evm-call-witness": "^3.0.3",
39
- "@xyo-network/manifest": "^3.0.3",
40
- "@xyo-network/module-factory-locator": "^3.0.3",
73
+ "@xylabs/ts-scripts-yarn3": "^4.0.7",
74
+ "@xylabs/tsconfig-react": "^4.0.7",
75
+ "@xyo-network/account": "^3.0.15",
76
+ "@xyo-network/evm-call-witness": "^3.0.7",
77
+ "@xyo-network/manifest": "^3.0.15",
78
+ "@xyo-network/module-factory-locator": "^3.0.15",
41
79
  "ethers": "^6.13.2",
80
+ "react": "^18.3.1",
81
+ "react-dom": "^18.3.1",
82
+ "storybook": "^8.2.9",
42
83
  "typescript": "^5.5.4"
43
84
  },
44
85
  "peerDependencies": {
@@ -56,41 +97,8 @@
56
97
  "optional": true
57
98
  }
58
99
  },
59
- "description": "Common React library for all XYO projects that use React",
60
- "docs": "dist/docs.json",
61
- "exports": {
62
- ".": {
63
- "import": {
64
- "types": "./dist/browser/index.d.ts",
65
- "default": "./dist/browser/index.mjs"
66
- },
67
- "types": "./dist/browser/index.d.ts",
68
- "default": "./dist/browser/index.mjs"
69
- },
70
- "./package.json": "./package.json"
71
- },
72
- "module": "dist/browser/index.mjs",
73
- "homepage": "https://xyo.network",
74
- "keywords": [
75
- "xyo",
76
- "utility",
77
- "typescript",
78
- "react"
79
- ],
80
- "license": "LGPL-3.0-only",
81
100
  "publishConfig": {
82
101
  "access": "public"
83
102
  },
84
- "repository": {
85
- "type": "git",
86
- "url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
87
- },
88
- "scripts": {
89
- "lint-pkg": "npmPkgJsonLint .",
90
- "license": "yarn license-checker --exclude \"MIT, ISC, Apache-2.0, BSD, BSD-2-Clause, CC-BY-4.0, Unlicense, CC-BY-3.0, CC0-1.0\""
91
- },
92
- "sideEffects": false,
93
- "types": "dist/browser/index.d.ts",
94
- "version": "3.0.2",
95
- "type": "module"
103
+ "docs": "dist/docs.json"
96
104
  }
@@ -2,7 +2,9 @@ import type { Meta, StoryFn } from '@storybook/react'
2
2
  import { FlexCol } from '@xylabs/react-flexbox'
3
3
  import { usePromise } from '@xylabs/react-promise'
4
4
  import { HDWallet } from '@xyo-network/account'
5
- import { EvmCallDiviner, EvmCallWitness, EvmCallWitnessConfigSchema } from '@xyo-network/evm-call-witness'
5
+ import {
6
+ EvmCallDiviner, EvmCallWitness, EvmCallWitnessConfigSchema,
7
+ } from '@xyo-network/evm-call-witness'
6
8
  import type { PackageManifestPayload } from '@xyo-network/manifest'
7
9
  import { ManifestWrapper } from '@xyo-network/manifest'
8
10
  import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
@@ -24,23 +26,17 @@ const loadFromManifest = async () => {
24
26
  locator.register(EvmCallDiviner)
25
27
 
26
28
  locator.register(
27
- new ModuleFactory(EvmCallWitness, {
28
- providers: () => [provider],
29
- }),
29
+ new ModuleFactory(EvmCallWitness, { providers: () => [provider] }),
30
30
  { 'network.xyo.evm.interface': 'Erc721' },
31
31
  )
32
32
 
33
33
  locator.register(
34
- new ModuleFactory(EvmCallWitness, {
35
- providers: () => [provider],
36
- }),
34
+ new ModuleFactory(EvmCallWitness, { providers: () => [provider] }),
37
35
  { 'network.xyo.evm.interface': 'Erc721Enumerable' },
38
36
  )
39
37
 
40
38
  locator.register(
41
- new ModuleFactory(EvmCallWitness, {
42
- providers: () => [provider],
43
- }),
39
+ new ModuleFactory(EvmCallWitness, { providers: () => [provider] }),
44
40
  { 'network.xyo.evm.interface': 'Erc1155' },
45
41
  )
46
42
 
@@ -52,11 +48,7 @@ const loadFromManifest = async () => {
52
48
 
53
49
  const StorybookEntry = {
54
50
  component: SentinelCard,
55
- parameters: {
56
- docs: {
57
- page: null,
58
- },
59
- },
51
+ parameters: { docs: { page: null } },
60
52
  title: 'modules/sentinel/SentinelCard',
61
53
  } as Meta<typeof SentinelCard>
62
54
 
@@ -15,7 +15,9 @@ export type SentinelCardProps = CardProps &
15
15
  inPayloads?: Payload[]
16
16
  }
17
17
 
18
- export const SentinelCard: React.FC<SentinelCardProps> = ({ children, inPayloads, mod, ...props }) => {
18
+ export const SentinelCard: React.FC<SentinelCardProps> = ({
19
+ children, inPayloads, mod, ...props
20
+ }) => {
19
21
  const [retry, setRetry] = useState(-1)
20
22
  const [report] = usePromise(async () => {
21
23
  if (retry >= 0) {
@@ -10,7 +10,9 @@ export type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &
10
10
  onReport?: (mod?: SentinelInstance) => void
11
11
  }
12
12
 
13
- export const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, mod, ...props }) => {
13
+ export const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({
14
+ onReport, mod, ...props
15
+ }) => {
14
16
  return (
15
17
  <ModuleCardActions mod={mod} {...props}>
16
18
  <ButtonEx onClick={() => onReport?.(mod)} size="small" variant="outlined">
@@ -12,7 +12,9 @@ export type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &
12
12
  report?: Payload[]
13
13
  }
14
14
 
15
- export const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ children, report, mod, ...props }) => {
15
+ export const SentinelCardContent: React.FC<SentinelCardContentProps> = ({
16
+ children, report, mod, ...props
17
+ }) => {
16
18
  return (
17
19
  <ModuleCardContent mod={mod} {...props}>
18
20
  <FlexGrowRow flexWrap="wrap" justifyContent="start" gap={2}>
@@ -4,6 +4,8 @@ import { ModuleCardHeader } from '@xyo-network/react-module'
4
4
  import type { SentinelInstance } from '@xyo-network/sentinel-model'
5
5
  import React from 'react'
6
6
 
7
- export const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({ title, mod, ...props }) => {
7
+ export const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({
8
+ title, mod, ...props
9
+ }) => {
8
10
  return <ModuleCardHeader mod={mod} title={title ?? mod?.config.name ?? 'Sentinel'} {...props} />
9
11
  }
@@ -10,7 +10,9 @@ import type { SentinelConfig } from '@xyo-network/sentinel-model'
10
10
  import { SentinelConfigSchema } from '@xyo-network/sentinel-model'
11
11
  import type { WitnessInstance } from '@xyo-network/witness-model'
12
12
  import { asWitnessInstance } from '@xyo-network/witness-model'
13
- import React, { useEffect, useState } from 'react'
13
+ import React, {
14
+ useEffect, useMemo, useState,
15
+ } from 'react'
14
16
 
15
17
  import { SentinelContext } from './Context.ts'
16
18
  import type { SentinelReportProgress } from './State.ts'
@@ -28,7 +30,9 @@ export interface SentinelProviderProps {
28
30
  witnesses?: WitnessInstance[]
29
31
  }
30
32
 
31
- export const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {
33
+ export const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({
34
+ account, archivist, children, filter, name, required = false,
35
+ }) => {
32
36
  const [sentinel, setSentinel] = useState<MemorySentinel>()
33
37
  const [history, setHistory] = useState<BoundWitness[]>()
34
38
  const [progress, setProgress] = useState<SentinelReportProgress>({})
@@ -118,11 +122,20 @@ export const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = (
118
122
  )
119
123
 
120
124
  useEffect(() => {
125
+ // eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect
121
126
  setHistory(sentinel?.history as BoundWitness[])
122
127
  }, [sentinel])
123
128
 
129
+ const value = useMemo(() => ({
130
+ history, progress, provided: true, reportingErrors, sentinel, status,
131
+ }), [history, progress, reportingErrors, sentinel, status])
132
+
124
133
  return !required || sentinel
125
- // eslint-disable-next-line @eslint-react/no-unstable-context-value
126
- ? <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>
134
+
135
+ ? (
136
+ <SentinelContext.Provider value={value}>
137
+ {children}
138
+ </SentinelContext.Provider>
139
+ )
127
140
  : null
128
141
  }
@@ -3,6 +3,10 @@ import { useContextEx } from '@xyo-network/react-shared'
3
3
  import { SentinelContext } from './Context.ts'
4
4
 
5
5
  export const useSentinelContext = () => {
6
- const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')
7
- return { history, progress, reportingErrors, sentinel, status }
6
+ const {
7
+ sentinel, history, progress, reportingErrors, status,
8
+ } = useContextEx(SentinelContext, 'Sentinel')
9
+ return {
10
+ history, progress, reportingErrors, sentinel, status,
11
+ }
8
12
  }
package/xy.config.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
2
  const config: XyTsupConfig = {
3
3
  compile: {
4
- browser: {
5
- src: true,
6
- },
4
+ browser: { src: true },
7
5
  node: {},
8
6
  neutral: {},
9
7
  },