@xyo-network/react-sentinel 5.3.15 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/{types → browser}/components/Card/Card.d.ts.map +1 -1
  2. package/dist/browser/components/Card/Card.stories.d.ts +17 -0
  3. package/dist/browser/components/Card/Card.stories.d.ts.map +1 -0
  4. package/dist/{types → browser}/components/Card/CardActions.d.ts.map +1 -1
  5. package/dist/{types → browser}/components/Card/CardContent.d.ts.map +1 -1
  6. package/dist/browser/contexts/use.d.ts +8 -0
  7. package/dist/{types → browser}/contexts/use.d.ts.map +1 -1
  8. package/dist/browser/index.d.ts +116 -0
  9. package/dist/browser/index.mjs.map +1 -1
  10. package/package.json +36 -35
  11. package/src/components/Card/Card.stories.tsx +5 -4
  12. package/src/components/Card/Card.tsx +2 -2
  13. package/src/components/Card/CardActions.tsx +2 -2
  14. package/src/components/Card/CardContent.tsx +2 -2
  15. package/dist/types/contexts/use.d.ts +0 -26
  16. package/dist/types/index.d.ts +0 -4
  17. /package/dist/{types → browser}/components/Card/Card.d.ts +0 -0
  18. /package/dist/{types → browser}/components/Card/CardActions.d.ts +0 -0
  19. /package/dist/{types → browser}/components/Card/CardContent.d.ts +0 -0
  20. /package/dist/{types → browser}/components/Card/CardHeader.d.ts +0 -0
  21. /package/dist/{types → browser}/components/Card/CardHeader.d.ts.map +0 -0
  22. /package/dist/{types → browser}/components/Card/index.d.ts +0 -0
  23. /package/dist/{types → browser}/components/Card/index.d.ts.map +0 -0
  24. /package/dist/{types → browser}/components/Card/manifest.d.ts +0 -0
  25. /package/dist/{types → browser}/components/Card/manifest.d.ts.map +0 -0
  26. /package/dist/{types → browser}/components/index.d.ts +0 -0
  27. /package/dist/{types → browser}/components/index.d.ts.map +0 -0
  28. /package/dist/{types → browser}/contexts/Context.d.ts +0 -0
  29. /package/dist/{types → browser}/contexts/Context.d.ts.map +0 -0
  30. /package/dist/{types → browser}/contexts/Provider.d.ts +0 -0
  31. /package/dist/{types → browser}/contexts/Provider.d.ts.map +0 -0
  32. /package/dist/{types → browser}/contexts/State.d.ts +0 -0
  33. /package/dist/{types → browser}/contexts/State.d.ts.map +0 -0
  34. /package/dist/{types → browser}/contexts/index.d.ts +0 -0
  35. /package/dist/{types → browser}/contexts/index.d.ts.map +0 -0
  36. /package/dist/{types → browser}/hooks/index.d.ts +0 -0
  37. /package/dist/{types → browser}/hooks/index.d.ts.map +0 -0
  38. /package/dist/{types → browser}/hooks/node/index.d.ts +0 -0
  39. /package/dist/{types → browser}/hooks/node/index.d.ts.map +0 -0
  40. /package/dist/{types → browser}/hooks/node/useSentinelFromNode.d.ts +0 -0
  41. /package/dist/{types → browser}/hooks/node/useSentinelFromNode.d.ts.map +0 -0
  42. /package/dist/{types → browser}/hooks/node/useSentinelsFromNode.d.ts +0 -0
  43. /package/dist/{types → browser}/hooks/node/useSentinelsFromNode.d.ts.map +0 -0
  44. /package/dist/{types → browser}/hooks/node/useWeakSentinelFromNode.d.ts +0 -0
  45. /package/dist/{types → browser}/hooks/node/useWeakSentinelFromNode.d.ts.map +0 -0
  46. /package/dist/{types → browser}/hooks/node/useWeakSentinelsFromNode.d.ts +0 -0
  47. /package/dist/{types → browser}/hooks/node/useWeakSentinelsFromNode.d.ts.map +0 -0
  48. /package/dist/{types → browser}/index.d.ts.map +0 -0
@@ -1 +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"}
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,GACrC,iBAAiB,CAAC,gBAAgB,CAAC,GAAG;IACtC,UAAU,CAAC,EAAE,OAAO,EAAE,CAAA;CACvB,CAAA;AAEH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAiBpD,CAAA"}
@@ -0,0 +1,17 @@
1
+ import type { Meta } from '@storybook/react-vite';
2
+ import React from 'react';
3
+ import { SentinelCard } from './Card.tsx';
4
+ declare const StorybookEntry: Meta<typeof SentinelCard>;
5
+ declare const NftSentinelCard: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("@mui/material").CardOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "classes" | "className" | "style" | "children" | "sx" | "variant" | "elevation" | "square" | "raised"> & {
6
+ component?: React.ElementType;
7
+ } & import("@xyo-network/react-module").ModuleRenderProps<import("@xyo-network/sentinel-model").SentinelInstance<import("@xyo-network/sentinel-model").SentinelParams<import("@xyo-network/module-model").AnyConfigSchema<import("@xyo-network/sentinel-model").SentinelConfig<void, void>>>, import("@xyo-network/sentinel-model").SentinelModuleEventData<import("@xyo-network/module-model").Module<import("@xyo-network/module-model").ModuleParams<import("@xyo-network/module-model").AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig<object, void>>>, import("@xyo-network/module-model").ModuleEventData<object>>>>> & {
8
+ inPayloads?: import("@xyo-network/payload-model").Payload[];
9
+ }>;
10
+ declare const NftTokensSentinelCard: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("@mui/material").CardOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "classes" | "className" | "style" | "children" | "sx" | "variant" | "elevation" | "square" | "raised"> & {
11
+ component?: React.ElementType;
12
+ } & import("@xyo-network/react-module").ModuleRenderProps<import("@xyo-network/sentinel-model").SentinelInstance<import("@xyo-network/sentinel-model").SentinelParams<import("@xyo-network/module-model").AnyConfigSchema<import("@xyo-network/sentinel-model").SentinelConfig<void, void>>>, import("@xyo-network/sentinel-model").SentinelModuleEventData<import("@xyo-network/module-model").Module<import("@xyo-network/module-model").ModuleParams<import("@xyo-network/module-model").AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig<object, void>>>, import("@xyo-network/module-model").ModuleEventData<object>>>>> & {
13
+ inPayloads?: import("@xyo-network/payload-model").Payload[];
14
+ }>;
15
+ export { NftSentinelCard, NftTokensSentinelCard };
16
+ export default StorybookEntry;
17
+ //# sourceMappingURL=Card.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/Card.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAA;AAe1D,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAgCzC,QAAA,MAAM,cAAc,EAIf,IAAI,CAAC,OAAO,YAAY,CAAC,CAAA;AA8B9B,QAAA,MAAM,eAAe;;;;EAA+B,CAAA;AAmDpD,QAAA,MAAM,qBAAqB;;;;EAAqC,CAAA;AAEhE,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,CAAA;AAEjD,eAAe,cAAc,CAAA"}
@@ -1 +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"}
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,GACtE,gBAAgB,GAAG;IACnB,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"}
@@ -1 +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"}
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,GACtE,gBAAgB,GAAG;IACnB,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;CACnB,CAAA;AAEH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAalE,CAAA"}
@@ -0,0 +1,8 @@
1
+ export declare const useSentinelContext: () => {
2
+ history: import("@xyo-network/boundwitness-model").BoundWitness[] | undefined;
3
+ progress: import("./State.ts").SentinelReportProgress | undefined;
4
+ reportingErrors: Error[] | undefined;
5
+ sentinel: import("@xyo-network/sentinel-model").SentinelModule<import("@xyo-network/sentinel-model").SentinelParams<import("@xyo-network/module-model").AnyConfigSchema<import("@xyo-network/sentinel-model").SentinelConfig<void, void>>>, import("@xyo-network/sentinel-model").SentinelModuleEventData<import("@xyo-network/module-model").Module<import("@xyo-network/module-model").ModuleParams<import("@xyo-network/module-model").AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig<object, void>>>, import("@xyo-network/module-model").ModuleEventData<object>>>> | undefined;
6
+ status: import("./State.ts").SentinelReportStatus | undefined;
7
+ };
8
+ //# sourceMappingURL=use.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;CAO9B,CAAA"}
1
+ {"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;;CAO9B,CAAA"}
@@ -0,0 +1,116 @@
1
+ import { CardProps, CardContentProps, CardHeaderProps } from '@mui/material';
2
+ import { Payload } from '@xyo-network/payload-model';
3
+ import { ModuleRenderProps } from '@xyo-network/react-module';
4
+ import * as _xyo_network_sentinel_model from '@xyo-network/sentinel-model';
5
+ import { SentinelInstance, SentinelModule } from '@xyo-network/sentinel-model';
6
+ import * as React from 'react';
7
+ import React__default, { PropsWithChildren } from 'react';
8
+ import * as _xylabs_react_shared from '@xylabs/react-shared';
9
+ import { ContextExState } from '@xylabs/react-shared';
10
+ import { Enum, EnumValue } from '@xylabs/enum';
11
+ import { ArchivistModuleInstance } from '@xyo-network/archivist-model';
12
+ import * as _xyo_network_boundwitness_model from '@xyo-network/boundwitness-model';
13
+ import { BoundWitness } from '@xyo-network/boundwitness-model';
14
+ import { WitnessModule, WitnessInstance } from '@xyo-network/witness-model';
15
+ import { AccountInstance } from '@xyo-network/account-model';
16
+ import * as _xyo_network_module_model from '@xyo-network/module-model';
17
+ import { ModuleIdentifier } from '@xyo-network/module-model';
18
+ import { ModuleFromNodeConfig, WeakModuleFromNodeConfig } from '@xyo-network/react-node';
19
+
20
+ type SentinelCardProps = CardProps & ModuleRenderProps<SentinelInstance> & {
21
+ inPayloads?: Payload[];
22
+ };
23
+ declare const SentinelCard: React__default.FC<SentinelCardProps>;
24
+
25
+ type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> & CardContentProps & {
26
+ report?: Payload[];
27
+ };
28
+ declare const SentinelCardContent: React__default.FC<SentinelCardContentProps>;
29
+
30
+ declare const SentinelCardHeader: React__default.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps>;
31
+
32
+ declare const SentinelReportStatus: Enum<{
33
+ Idle: "idle";
34
+ Queued: "queued";
35
+ Started: "started";
36
+ Succeeded: "succeeded";
37
+ Failed: "failed";
38
+ }>;
39
+ type SentinelReportStatus = EnumValue<typeof SentinelReportStatus>;
40
+ interface SentinelWitnessReportProgress {
41
+ status: SentinelReportStatus;
42
+ witness: WitnessModule;
43
+ }
44
+ interface SentinelArchivistApiReportProgress {
45
+ archivist: ArchivistModuleInstance;
46
+ status: SentinelReportStatus;
47
+ }
48
+ interface SentinelReportProgress {
49
+ archivists?: Record<string, SentinelArchivistApiReportProgress>;
50
+ witnesses?: Record<string, SentinelWitnessReportProgress>;
51
+ }
52
+ type SentinelContextState = ContextExState<{
53
+ history?: BoundWitness[];
54
+ progress?: SentinelReportProgress;
55
+ reportingErrors?: Error[];
56
+ sentinel?: SentinelModule;
57
+ status?: SentinelReportStatus;
58
+ }>;
59
+
60
+ declare const SentinelContext: React.Context<({
61
+ history?: _xyo_network_boundwitness_model.BoundWitness[];
62
+ progress?: SentinelReportProgress;
63
+ reportingErrors?: Error[];
64
+ sentinel?: _xyo_network_sentinel_model.SentinelModule;
65
+ status?: SentinelReportStatus;
66
+ } & {
67
+ provided: true;
68
+ }) | (_xylabs_react_shared.FixedValues<_xylabs_react_shared.ProvidedContextExState<{
69
+ history?: _xyo_network_boundwitness_model.BoundWitness[];
70
+ progress?: SentinelReportProgress;
71
+ reportingErrors?: Error[];
72
+ sentinel?: _xyo_network_sentinel_model.SentinelModule;
73
+ status?: SentinelReportStatus;
74
+ }>, never> & {
75
+ provided: false;
76
+ }) | (_xylabs_react_shared.FixedValues<_xylabs_react_shared.NotProvidedContextExState<{
77
+ history?: _xyo_network_boundwitness_model.BoundWitness[];
78
+ progress?: SentinelReportProgress;
79
+ reportingErrors?: Error[];
80
+ sentinel?: _xyo_network_sentinel_model.SentinelModule;
81
+ status?: SentinelReportStatus;
82
+ }>, never> & {
83
+ provided: false;
84
+ })>;
85
+
86
+ interface SentinelProviderProps {
87
+ /** Account used by the sentinel for signing */
88
+ account: AccountInstance;
89
+ /** @deprecated - sentinel no longer uses archive but relies on an archivist */
90
+ archive?: string;
91
+ archivist?: string;
92
+ ids?: ModuleIdentifier[];
93
+ name?: string;
94
+ required?: boolean;
95
+ witnesses?: WitnessInstance[];
96
+ }
97
+ declare const SentinelProvider: React__default.FC<PropsWithChildren<SentinelProviderProps>>;
98
+
99
+ declare const useSentinelContext: () => {
100
+ history: _xyo_network_boundwitness_model.BoundWitness[] | undefined;
101
+ progress: SentinelReportProgress | undefined;
102
+ reportingErrors: Error[] | undefined;
103
+ sentinel: _xyo_network_sentinel_model.SentinelModule<_xyo_network_sentinel_model.SentinelParams<_xyo_network_module_model.AnyConfigSchema<_xyo_network_sentinel_model.SentinelConfig<void, void>>>, _xyo_network_sentinel_model.SentinelModuleEventData<_xyo_network_module_model.Module<_xyo_network_module_model.ModuleParams<_xyo_network_module_model.AnyConfigSchema<_xyo_network_module_model.ModuleConfig<object, void>>>, _xyo_network_module_model.ModuleEventData<object>>>> | undefined;
104
+ status: SentinelReportStatus | undefined;
105
+ };
106
+
107
+ declare const useSentinelFromNode: (nameOrAddressOrInstance?: string | SentinelInstance, config?: ModuleFromNodeConfig) => [SentinelInstance | undefined, Error | undefined];
108
+
109
+ declare const useSentinelsFromNode: (ids?: ModuleIdentifier[], config?: ModuleFromNodeConfig) => [SentinelInstance[] | null | undefined, Error | undefined];
110
+
111
+ declare const useWeakSentinelFromNode: (nameOrAddressOrInstance?: string | SentinelInstance, config?: WeakModuleFromNodeConfig) => [WeakRef<SentinelInstance> | undefined, Error | undefined];
112
+
113
+ declare const useWeakSentinelsFromNode: (ids?: ModuleIdentifier[], config?: ModuleFromNodeConfig) => [WeakRef<SentinelInstance>[] | null | undefined, Error | undefined];
114
+
115
+ export { SentinelCard, SentinelCardContent, SentinelCardHeader, SentinelContext, SentinelProvider, SentinelReportStatus, useSentinelContext, useSentinelFromNode, useSentinelsFromNode, useWeakSentinelFromNode, useWeakSentinelsFromNode };
116
+ export type { SentinelArchivistApiReportProgress, SentinelCardContentProps, SentinelCardProps, SentinelContextState, SentinelProviderProps, SentinelReportProgress, SentinelWitnessReportProgress };
@@ -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> = ({\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 '@xylabs/react-shared'\n\nimport type { SentinelContextState } from './State.ts'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport type { AccountInstance } from '@xyo-network/account-model'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport type { ModuleIdentifier } 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 type { PropsWithChildren } from 'react'\nimport React, {\n useEffect, useMemo, useState,\n} from 'react'\n\nimport { SentinelContext } from './Context.ts'\nimport type { SentinelContextState, 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 ids?: ModuleIdentifier[]\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<PropsWithChildren<SentinelProviderProps>> = ({\n account, archivist, children, ids, 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>(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(ids)\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 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}]`, { required: true }),\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\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}]`, { required: true }),\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: SentinelContextState = useMemo(() => ({\n history, progress, provided: true, reportingErrors, sentinel, status,\n }), [history, progress, reportingErrors, sentinel, status])\n\n return !required || sentinel\n\n ? (\n <SentinelContext value={value}>\n {children}\n </SentinelContext>\n )\n : null\n}\n","import type { EnumValue } from '@xylabs/enum'\nimport { Enum } from '@xylabs/enum'\nimport type { ContextExState } from '@xylabs/react-shared'\nimport type { ArchivistModuleInstance } 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 const SentinelReportStatus = Enum({\n Idle: 'idle',\n Queued: 'queued',\n Started: 'started',\n Succeeded: 'succeeded',\n Failed: 'failed',\n})\n\nexport type SentinelReportStatus = EnumValue<typeof SentinelReportStatus>\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModuleInstance\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport type SentinelContextState = ContextExState<{\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}>\n","import { useContextEx } from '@xylabs/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 { ModuleIdentifier } 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 ids?: ModuleIdentifier[],\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(ids, 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 { ModuleIdentifier } 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 ids?: ModuleIdentifier[],\n config?: ModuleFromNodeConfig,\n): [WeakRef<SentinelInstance>[] | null | undefined, Error | undefined] => {\n const [modules, error] = useWeakModulesFromNode(ids, 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;IAAQC,SAAQ;KAAW,QAAA,CAAA;AAKhF,GAVuE;;;ACXvE,SAASC,mBAAmB;AAG5B,SAASC,yBAAyB;AAClC,SAASC,oBAAoB;AAE7B,OAAOC,YAAW;AAOX,IAAMC,sBAA0D,wBAAC,EACtEC,UAAUC,QAAQC,KAAK,GAAGC,MAAAA,MAC3B;AACC,SACE,gBAAAC,OAAA,cAACC,mBAAAA;IAA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ASC,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,KACAC,WAAAA;AAEA,QAAM,CAACC,SAASC,KAAAA,IAASC,uBAAuBJ,KAAKC,MAAAA;AACrD,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,EACCI,OAAOC,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","Enum","SentinelReportStatus","Idle","Queued","Started","Succeeded","Failed","SentinelProvider","account","archivist","children","ids","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","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","ids","config","modules","error","useModulesFromNode","reduce","prev","mod","isSentinelInstance","push","undefined","useWeakModuleFromNode","isSentinelInstance","useWeakSentinelFromNode","nameOrAddressOrInstance","config","useWeakModuleFromNode","identity","isSentinelInstance","exists","useWeakModulesFromNode","asSentinelInstance","useWeakSentinelsFromNode","ids","config","modules","error","useWeakModulesFromNode","map","mod","instance","asSentinelInstance","deref","WeakRef","filter","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 '@xylabs/react-shared'\n\nimport type { SentinelContextState } from './State.ts'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport type { AccountInstance } from '@xyo-network/account-model'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport type { ModuleIdentifier } 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 type { PropsWithChildren } from 'react'\nimport React, {\n useEffect, useMemo, useState,\n} from 'react'\n\nimport { SentinelContext } from './Context.ts'\nimport type { SentinelContextState, 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 ids?: ModuleIdentifier[]\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<PropsWithChildren<SentinelProviderProps>> = ({\n account, archivist, children, ids, 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>(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(ids)\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 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}]`, { required: true }),\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\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}]`, { required: true }),\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: SentinelContextState = useMemo(() => ({\n history, progress, provided: true, reportingErrors, sentinel, status,\n }), [history, progress, reportingErrors, sentinel, status])\n\n return !required || sentinel\n\n ? (\n <SentinelContext value={value}>\n {children}\n </SentinelContext>\n )\n : null\n}\n","import type { EnumValue } from '@xylabs/enum'\nimport { Enum } from '@xylabs/enum'\nimport type { ContextExState } from '@xylabs/react-shared'\nimport type { ArchivistModuleInstance } 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 const SentinelReportStatus = Enum({\n Idle: 'idle',\n Queued: 'queued',\n Started: 'started',\n Succeeded: 'succeeded',\n Failed: 'failed',\n})\n\nexport type SentinelReportStatus = EnumValue<typeof SentinelReportStatus>\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModuleInstance\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport type SentinelContextState = ContextExState<{\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}>\n","import { useContextEx } from '@xylabs/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 { ModuleIdentifier } 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 ids?: ModuleIdentifier[],\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(ids, 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 { ModuleIdentifier } 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 ids?: ModuleIdentifier[],\n config?: ModuleFromNodeConfig,\n): [WeakRef<SentinelInstance>[] | null | undefined, Error | undefined] => {\n const [modules, error] = useWeakModulesFromNode(ids, 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;IAAQC,SAAQ;KAAW,QAAA,CAAA;AAKhF,GAVuE;;;ACXvE,SAASC,mBAAmB;AAG5B,SAASC,yBAAyB;AAClC,SAASC,oBAAoB;AAE7B,OAAOC,YAAW;AAOX,IAAMC,sBAA0D,wBAAC,EACtEC,UAAUC,QAAQC,KAAK,GAAGC,MAAAA,MAC3B;AACC,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;OAC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;;ACLvC,SAASI,cAAc;AAGvB,SAASC,8BAA8B;AAEvC,SAASC,sBAAAA,2BAA0B;AAE5B,IAAMC,2BAA2B,wBACtCC,KACAC,WAAAA;AAEA,QAAM,CAACC,SAASC,KAAAA,IAASC,uBAAuBJ,KAAKC,MAAAA;AACrD,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,EACCI,OAAOC,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","Enum","SentinelReportStatus","Idle","Queued","Started","Succeeded","Failed","SentinelProvider","account","archivist","children","ids","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","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","ids","config","modules","error","useModulesFromNode","reduce","prev","mod","isSentinelInstance","push","undefined","useWeakModuleFromNode","isSentinelInstance","useWeakSentinelFromNode","nameOrAddressOrInstance","config","useWeakModuleFromNode","identity","isSentinelInstance","exists","useWeakModulesFromNode","asSentinelInstance","useWeakSentinelsFromNode","ids","config","modules","error","useWeakModulesFromNode","map","mod","instance","asSentinelInstance","deref","WeakRef","filter","exists","undefined"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/react-sentinel",
3
- "version": "5.3.15",
3
+ "version": "6.1.0",
4
4
  "description": "Common React library for all XYO projects that use React",
5
5
  "keywords": [
6
6
  "xyo",
@@ -28,54 +28,55 @@
28
28
  "exports": {
29
29
  ".": {
30
30
  "browser": {
31
- "types": "./dist/types/index.d.ts",
31
+ "types": "./dist/browser/index.d.ts",
32
32
  "default": "./dist/browser/index.mjs"
33
33
  },
34
- "types": "./dist/types/index.d.ts",
34
+ "types": "./dist/browser/index.d.ts",
35
35
  "default": "./dist/browser/index.mjs"
36
36
  },
37
37
  "./package.json": "./package.json"
38
38
  },
39
39
  "module": "dist/browser/index.mjs",
40
- "types": "dist/types/index.d.ts",
40
+ "types": "dist/browser/index.d.ts",
41
41
  "dependencies": {
42
- "@xylabs/enum": "^4.12.1",
43
- "@xylabs/exists": "^4.12.1",
44
- "@xylabs/react-async-effect": "^6.3.7",
45
- "@xylabs/react-button": "^6.3.7",
46
- "@xylabs/react-flexbox": "^6.3.7",
47
- "@xylabs/react-promise": "^6.3.7",
48
- "@xylabs/react-shared": "^6.3.7",
49
- "@xyo-network/account-model": "^3.18.10",
50
- "@xyo-network/archivist-model": "^3.18.10",
51
- "@xyo-network/boundwitness-model": "^3.18.10",
52
- "@xyo-network/module-model": "^3.18.10",
53
- "@xyo-network/payload-model": "^3.18.10",
54
- "@xyo-network/react-module": "^5.3.15",
55
- "@xyo-network/react-node": "^5.3.15",
56
- "@xyo-network/react-payload-raw-info": "^5.3.15",
57
- "@xyo-network/react-witness": "^5.3.15",
58
- "@xyo-network/sentinel-memory": "^3.18.10",
59
- "@xyo-network/sentinel-model": "^3.18.10",
60
- "@xyo-network/witness-model": "^3.18.10"
42
+ "@xylabs/enum": "^4.13.15",
43
+ "@xylabs/exists": "^4.13.15",
44
+ "@xylabs/react-async-effect": "^6.3.10",
45
+ "@xylabs/react-button": "^6.3.10",
46
+ "@xylabs/react-flexbox": "^6.3.10",
47
+ "@xylabs/react-promise": "^6.3.10",
48
+ "@xylabs/react-shared": "^6.3.10",
49
+ "@xyo-network/account-model": "^4.1.1",
50
+ "@xyo-network/archivist-model": "^4.1.1",
51
+ "@xyo-network/boundwitness-model": "^4.1.1",
52
+ "@xyo-network/module-model": "^4.1.1",
53
+ "@xyo-network/payload-model": "^4.1.1",
54
+ "@xyo-network/react-module": "^6.1.0",
55
+ "@xyo-network/react-node": "^6.1.0",
56
+ "@xyo-network/react-payload-raw-info": "^6.1.0",
57
+ "@xyo-network/react-witness": "^6.1.0",
58
+ "@xyo-network/sentinel-memory": "^4.1.1",
59
+ "@xyo-network/sentinel-model": "^4.1.1",
60
+ "@xyo-network/witness-model": "^4.1.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@emotion/react": "^11.14.0",
64
- "@emotion/styled": "^11.14.0",
65
- "@mui/icons-material": "^7.1.1",
66
- "@mui/material": "^7.1.1",
64
+ "@emotion/styled": "^11.14.1",
65
+ "@mui/icons-material": "^7.2.0",
66
+ "@mui/material": "^7.2.0",
67
+ "@storybook/react-vite": "^9.0.16",
67
68
  "@types/react": "^19.1.8",
68
- "@xylabs/ts-scripts-yarn3": "^6.5.8",
69
- "@xylabs/tsconfig-react": "^6.5.8",
70
- "@xyo-network/account": "^3.18.10",
71
- "@xyo-network/evm-call-witness": "^3.6.1",
72
- "@xyo-network/manifest": "^3.18.10",
73
- "@xyo-network/module-factory-locator": "^3.18.10",
74
- "@xyo-network/wallet": "^3.18.10",
75
- "ethers": "^6.14.4",
69
+ "@xylabs/ts-scripts-yarn3": "next",
70
+ "@xylabs/tsconfig-react": "next",
71
+ "@xyo-network/account": "^4.1.1",
72
+ "@xyo-network/evm-call-witness": "^4.0.0",
73
+ "@xyo-network/manifest": "^4.1.1",
74
+ "@xyo-network/module-factory-locator": "^4.1.1",
75
+ "@xyo-network/wallet": "^4.1.1",
76
+ "ethers": "^6.15.0",
76
77
  "react": "^19.1.0",
77
78
  "react-dom": "^19.1.0",
78
- "storybook": "^9.0.12",
79
+ "storybook": "^9.0.16",
79
80
  "typescript": "^5.8.3"
80
81
  },
81
82
  "peerDependencies": {
@@ -1,6 +1,7 @@
1
1
  import type { Meta, StoryFn } from '@storybook/react-vite'
2
2
  import { FlexCol } from '@xylabs/react-flexbox'
3
3
  import { usePromise } from '@xylabs/react-promise'
4
+ import type { EvmCallWitnessParams } from '@xyo-network/evm-call-witness'
4
5
  import {
5
6
  EvmCallDiviner, EvmCallWitness, EvmCallWitnessConfigSchema,
6
7
  } from '@xyo-network/evm-call-witness'
@@ -23,20 +24,20 @@ const loadFromManifest = async () => {
23
24
  const provider = new InfuraProvider('homestead', process.env.STORYBOOK_INFURA_PROJECT_ID)
24
25
 
25
26
  const locator = new ModuleFactoryLocator()
26
- locator.register(EvmCallDiviner)
27
+ locator.register(EvmCallDiviner.factory())
27
28
 
28
29
  locator.register(
29
- new ModuleFactory(EvmCallWitness, { providers: () => [provider] }),
30
+ new ModuleFactory(EvmCallWitness, { providers: () => [provider] } as Partial<EvmCallWitnessParams>),
30
31
  { 'network.xyo.evm.interface': 'Erc721' },
31
32
  )
32
33
 
33
34
  locator.register(
34
- new ModuleFactory(EvmCallWitness, { providers: () => [provider] }),
35
+ new ModuleFactory(EvmCallWitness, { providers: () => [provider] } as Partial<EvmCallWitnessParams>),
35
36
  { 'network.xyo.evm.interface': 'Erc721Enumerable' },
36
37
  )
37
38
 
38
39
  locator.register(
39
- new ModuleFactory(EvmCallWitness, { providers: () => [provider] }),
40
+ new ModuleFactory(EvmCallWitness, { providers: () => [provider] } as Partial<EvmCallWitnessParams>),
40
41
  { 'network.xyo.evm.interface': 'Erc1155' },
41
42
  )
42
43
 
@@ -10,8 +10,8 @@ import { SentinelCardActions } from './CardActions.tsx'
10
10
  import { SentinelCardContent } from './CardContent.tsx'
11
11
  import { SentinelCardHeader } from './CardHeader.tsx'
12
12
 
13
- export type SentinelCardProps = CardProps &
14
- ModuleRenderProps<SentinelInstance> & {
13
+ export type SentinelCardProps = CardProps
14
+ & ModuleRenderProps<SentinelInstance> & {
15
15
  inPayloads?: Payload[]
16
16
  }
17
17
 
@@ -5,8 +5,8 @@ import { ModuleCardActions } from '@xyo-network/react-module'
5
5
  import type { SentinelInstance } from '@xyo-network/sentinel-model'
6
6
  import React from 'react'
7
7
 
8
- export type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &
9
- CardActionsProps & {
8
+ export type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance>
9
+ & CardActionsProps & {
10
10
  onReport?: (mod?: SentinelInstance) => void
11
11
  }
12
12
 
@@ -7,8 +7,8 @@ import { JsonViewerEx } from '@xyo-network/react-payload-raw-info'
7
7
  import type { SentinelInstance } from '@xyo-network/sentinel-model'
8
8
  import React from 'react'
9
9
 
10
- export type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &
11
- CardContentProps & {
10
+ export type SentinelCardContentProps = ModuleRenderProps<SentinelInstance>
11
+ & CardContentProps & {
12
12
  report?: Payload[]
13
13
  }
14
14
 
@@ -1,26 +0,0 @@
1
- export declare const useSentinelContext: () => {
2
- history: import("@xyo-network/boundwitness-model").BoundWitness[] | undefined;
3
- progress: import("./State.ts").SentinelReportProgress | undefined;
4
- reportingErrors: Error[] | undefined;
5
- sentinel: import("@xyo-network/sentinel-model").SentinelModule<import("@xylabs/base").BaseParamsFields & {
6
- account?: import("@xyo-network/account-model").AccountInstance | "random";
7
- addToResolvers?: boolean;
8
- additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
9
- allowNameResolution?: boolean;
10
- config: import("@xyo-network/module-model").AnyConfigSchema<import("@xyo-network/sentinel-model").SentinelConfig>;
11
- ephemeralQueryAccountEnabled?: boolean;
12
- moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
13
- statusReporter?: import("@xyo-network/module-model").ModuleStatusReporter;
14
- } & import("@xyo-network/module-model").ModuleChildrenParams, import("@xyo-network/sentinel-model").SentinelModuleEventData<import("@xyo-network/module-model").Module<import("@xylabs/base").BaseParamsFields & {
15
- account?: import("@xyo-network/account-model").AccountInstance | "random";
16
- addToResolvers?: boolean;
17
- additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
18
- allowNameResolution?: boolean;
19
- config: import("@xyo-network/module-model").AnyConfigSchema<import("@xyo-network/module-model").ModuleConfig>;
20
- ephemeralQueryAccountEnabled?: boolean;
21
- moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
22
- statusReporter?: import("@xyo-network/module-model").ModuleStatusReporter;
23
- } & import("@xyo-network/module-model").ModuleChildrenParams, import("@xyo-network/module-model").ModuleEventData<object>>>> | undefined;
24
- status: import("./State.ts").SentinelReportStatus | undefined;
25
- };
26
- //# sourceMappingURL=use.d.ts.map
@@ -1,4 +0,0 @@
1
- export * from './components/index.ts';
2
- export * from './contexts/index.ts';
3
- export * from './hooks/index.ts';
4
- //# sourceMappingURL=index.d.ts.map
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes