@xyo-network/react-sentinel 2.70.5 → 2.70.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/components/Card/CardContent.d.cts.map +1 -1
- package/dist/browser/components/Card/CardContent.d.mts.map +1 -1
- package/dist/browser/components/Card/CardContent.d.ts.map +1 -1
- package/dist/browser/contexts/use.d.cts +4 -68
- package/dist/browser/contexts/use.d.cts.map +1 -1
- package/dist/browser/contexts/use.d.mts +4 -68
- package/dist/browser/contexts/use.d.mts.map +1 -1
- package/dist/browser/contexts/use.d.ts +4 -68
- package/dist/browser/contexts/use.d.ts.map +1 -1
- package/dist/browser/index.cjs +2 -12
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +2 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/node/components/Card/CardContent.d.cts.map +1 -1
- package/dist/node/components/Card/CardContent.d.mts.map +1 -1
- package/dist/node/components/Card/CardContent.d.ts.map +1 -1
- package/dist/node/contexts/use.d.cts +4 -68
- package/dist/node/contexts/use.d.cts.map +1 -1
- package/dist/node/contexts/use.d.mts +4 -68
- package/dist/node/contexts/use.d.mts.map +1 -1
- package/dist/node/contexts/use.d.ts +4 -68
- package/dist/node/contexts/use.d.ts.map +1 -1
- package/dist/node/index.cjs +2 -12
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +2 -2
- package/dist/node/index.js.map +1 -1
- package/package.json +25 -23
- package/src/components/Card/Card.stories.tsx +1 -1
- package/src/components/Card/CardContent.tsx +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,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,CAWlE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,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,CAWlE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,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,CAWlE,CAAA"}
|
|
@@ -6,86 +6,22 @@ export declare const useSentinelContext: () => {
|
|
|
6
6
|
reportingErrors: Error[] | undefined;
|
|
7
7
|
sentinel: import("@xyo-network/sentinel-model").SentinelModule<import("@xylabs/object").BaseParamsFields & {
|
|
8
8
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
9
|
-
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
10
|
-
readonly archivist?: string | undefined;
|
|
11
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
12
|
-
readonly name?: string | undefined;
|
|
13
|
-
readonly paging?: Record<string, {
|
|
14
|
-
size?: number | undefined;
|
|
15
|
-
}> | undefined;
|
|
16
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
17
|
-
schema: "network.xyo.sentinel.config";
|
|
18
|
-
readonly security?: {
|
|
19
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
20
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
21
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
22
|
-
} | undefined;
|
|
23
|
-
readonly sign?: boolean | undefined;
|
|
24
|
-
readonly storeQueries?: boolean | undefined;
|
|
25
|
-
readonly timestamp?: boolean | undefined;
|
|
26
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
27
|
-
readonly archivist?: string | undefined;
|
|
28
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
29
|
-
readonly name?: string | undefined;
|
|
30
|
-
readonly paging?: Record<string, {
|
|
31
|
-
size?: number | undefined;
|
|
32
|
-
}> | undefined;
|
|
33
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
34
|
-
schema: "network.xyo.sentinel.config";
|
|
35
|
-
readonly security?: {
|
|
36
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
37
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
38
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
39
|
-
} | undefined;
|
|
40
|
-
readonly sign?: boolean | undefined;
|
|
41
|
-
readonly storeQueries?: boolean | undefined;
|
|
42
|
-
readonly timestamp?: boolean | undefined;
|
|
43
|
-
} & {
|
|
9
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
44
10
|
automations?: import("@xyo-network/sentinel-model").SentinelAutomationPayload[] | undefined;
|
|
45
11
|
schema: "network.xyo.sentinel.config";
|
|
46
12
|
synchronous?: boolean | undefined;
|
|
47
13
|
tasks: import("@xyo-network/sentinel-model").Task[];
|
|
48
14
|
throwErrors?: boolean | undefined;
|
|
15
|
+
}, "schema"> & {
|
|
16
|
+
schema: "network.xyo.sentinel.config";
|
|
49
17
|
}, "schema"> & {
|
|
50
18
|
schema: string;
|
|
51
19
|
};
|
|
52
20
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
53
21
|
}, import("@xyo-network/sentinel-model").SentinelModuleEventData<import("@xyo-network/module-model").Module<import("@xylabs/object").BaseParamsFields & {
|
|
54
22
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
55
|
-
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
56
|
-
readonly archivist?: string | undefined;
|
|
57
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
58
|
-
readonly name?: string | undefined;
|
|
59
|
-
readonly paging?: Record<string, {
|
|
60
|
-
size?: number | undefined;
|
|
61
|
-
}> | undefined;
|
|
62
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
63
|
-
schema: "network.xyo.module.config";
|
|
64
|
-
readonly security?: {
|
|
65
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
66
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
67
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
68
|
-
} | undefined;
|
|
69
|
-
readonly sign?: boolean | undefined;
|
|
70
|
-
readonly storeQueries?: boolean | undefined;
|
|
71
|
-
readonly timestamp?: boolean | undefined;
|
|
72
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
73
|
-
readonly archivist?: string | undefined;
|
|
74
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
75
|
-
readonly name?: string | undefined;
|
|
76
|
-
readonly paging?: Record<string, {
|
|
77
|
-
size?: number | undefined;
|
|
78
|
-
}> | undefined;
|
|
79
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
23
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
80
24
|
schema: "network.xyo.module.config";
|
|
81
|
-
readonly security?: {
|
|
82
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
83
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
84
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
85
|
-
} | undefined;
|
|
86
|
-
readonly sign?: boolean | undefined;
|
|
87
|
-
readonly storeQueries?: boolean | undefined;
|
|
88
|
-
readonly timestamp?: boolean | undefined;
|
|
89
25
|
}, "schema"> & {
|
|
90
26
|
schema: string;
|
|
91
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG9B,CAAA"}
|
|
@@ -6,86 +6,22 @@ export declare const useSentinelContext: () => {
|
|
|
6
6
|
reportingErrors: Error[] | undefined;
|
|
7
7
|
sentinel: import("@xyo-network/sentinel-model").SentinelModule<import("@xylabs/object").BaseParamsFields & {
|
|
8
8
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
9
|
-
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
10
|
-
readonly archivist?: string | undefined;
|
|
11
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
12
|
-
readonly name?: string | undefined;
|
|
13
|
-
readonly paging?: Record<string, {
|
|
14
|
-
size?: number | undefined;
|
|
15
|
-
}> | undefined;
|
|
16
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
17
|
-
schema: "network.xyo.sentinel.config";
|
|
18
|
-
readonly security?: {
|
|
19
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
20
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
21
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
22
|
-
} | undefined;
|
|
23
|
-
readonly sign?: boolean | undefined;
|
|
24
|
-
readonly storeQueries?: boolean | undefined;
|
|
25
|
-
readonly timestamp?: boolean | undefined;
|
|
26
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
27
|
-
readonly archivist?: string | undefined;
|
|
28
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
29
|
-
readonly name?: string | undefined;
|
|
30
|
-
readonly paging?: Record<string, {
|
|
31
|
-
size?: number | undefined;
|
|
32
|
-
}> | undefined;
|
|
33
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
34
|
-
schema: "network.xyo.sentinel.config";
|
|
35
|
-
readonly security?: {
|
|
36
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
37
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
38
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
39
|
-
} | undefined;
|
|
40
|
-
readonly sign?: boolean | undefined;
|
|
41
|
-
readonly storeQueries?: boolean | undefined;
|
|
42
|
-
readonly timestamp?: boolean | undefined;
|
|
43
|
-
} & {
|
|
9
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
44
10
|
automations?: import("@xyo-network/sentinel-model").SentinelAutomationPayload[] | undefined;
|
|
45
11
|
schema: "network.xyo.sentinel.config";
|
|
46
12
|
synchronous?: boolean | undefined;
|
|
47
13
|
tasks: import("@xyo-network/sentinel-model").Task[];
|
|
48
14
|
throwErrors?: boolean | undefined;
|
|
15
|
+
}, "schema"> & {
|
|
16
|
+
schema: "network.xyo.sentinel.config";
|
|
49
17
|
}, "schema"> & {
|
|
50
18
|
schema: string;
|
|
51
19
|
};
|
|
52
20
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
53
21
|
}, import("@xyo-network/sentinel-model").SentinelModuleEventData<import("@xyo-network/module-model").Module<import("@xylabs/object").BaseParamsFields & {
|
|
54
22
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
55
|
-
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
56
|
-
readonly archivist?: string | undefined;
|
|
57
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
58
|
-
readonly name?: string | undefined;
|
|
59
|
-
readonly paging?: Record<string, {
|
|
60
|
-
size?: number | undefined;
|
|
61
|
-
}> | undefined;
|
|
62
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
63
|
-
schema: "network.xyo.module.config";
|
|
64
|
-
readonly security?: {
|
|
65
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
66
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
67
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
68
|
-
} | undefined;
|
|
69
|
-
readonly sign?: boolean | undefined;
|
|
70
|
-
readonly storeQueries?: boolean | undefined;
|
|
71
|
-
readonly timestamp?: boolean | undefined;
|
|
72
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
73
|
-
readonly archivist?: string | undefined;
|
|
74
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
75
|
-
readonly name?: string | undefined;
|
|
76
|
-
readonly paging?: Record<string, {
|
|
77
|
-
size?: number | undefined;
|
|
78
|
-
}> | undefined;
|
|
79
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
23
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
80
24
|
schema: "network.xyo.module.config";
|
|
81
|
-
readonly security?: {
|
|
82
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
83
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
84
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
85
|
-
} | undefined;
|
|
86
|
-
readonly sign?: boolean | undefined;
|
|
87
|
-
readonly storeQueries?: boolean | undefined;
|
|
88
|
-
readonly timestamp?: boolean | undefined;
|
|
89
25
|
}, "schema"> & {
|
|
90
26
|
schema: string;
|
|
91
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG9B,CAAA"}
|
|
@@ -6,86 +6,22 @@ export declare const useSentinelContext: () => {
|
|
|
6
6
|
reportingErrors: Error[] | undefined;
|
|
7
7
|
sentinel: import("@xyo-network/sentinel-model").SentinelModule<import("@xylabs/object").BaseParamsFields & {
|
|
8
8
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
9
|
-
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
10
|
-
readonly archivist?: string | undefined;
|
|
11
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
12
|
-
readonly name?: string | undefined;
|
|
13
|
-
readonly paging?: Record<string, {
|
|
14
|
-
size?: number | undefined;
|
|
15
|
-
}> | undefined;
|
|
16
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
17
|
-
schema: "network.xyo.sentinel.config";
|
|
18
|
-
readonly security?: {
|
|
19
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
20
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
21
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
22
|
-
} | undefined;
|
|
23
|
-
readonly sign?: boolean | undefined;
|
|
24
|
-
readonly storeQueries?: boolean | undefined;
|
|
25
|
-
readonly timestamp?: boolean | undefined;
|
|
26
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
27
|
-
readonly archivist?: string | undefined;
|
|
28
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
29
|
-
readonly name?: string | undefined;
|
|
30
|
-
readonly paging?: Record<string, {
|
|
31
|
-
size?: number | undefined;
|
|
32
|
-
}> | undefined;
|
|
33
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
34
|
-
schema: "network.xyo.sentinel.config";
|
|
35
|
-
readonly security?: {
|
|
36
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
37
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
38
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
39
|
-
} | undefined;
|
|
40
|
-
readonly sign?: boolean | undefined;
|
|
41
|
-
readonly storeQueries?: boolean | undefined;
|
|
42
|
-
readonly timestamp?: boolean | undefined;
|
|
43
|
-
} & {
|
|
9
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
44
10
|
automations?: import("@xyo-network/sentinel-model").SentinelAutomationPayload[] | undefined;
|
|
45
11
|
schema: "network.xyo.sentinel.config";
|
|
46
12
|
synchronous?: boolean | undefined;
|
|
47
13
|
tasks: import("@xyo-network/sentinel-model").Task[];
|
|
48
14
|
throwErrors?: boolean | undefined;
|
|
15
|
+
}, "schema"> & {
|
|
16
|
+
schema: "network.xyo.sentinel.config";
|
|
49
17
|
}, "schema"> & {
|
|
50
18
|
schema: string;
|
|
51
19
|
};
|
|
52
20
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
53
21
|
}, import("@xyo-network/sentinel-model").SentinelModuleEventData<import("@xyo-network/module-model").Module<import("@xylabs/object").BaseParamsFields & {
|
|
54
22
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
55
|
-
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
56
|
-
readonly archivist?: string | undefined;
|
|
57
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
58
|
-
readonly name?: string | undefined;
|
|
59
|
-
readonly paging?: Record<string, {
|
|
60
|
-
size?: number | undefined;
|
|
61
|
-
}> | undefined;
|
|
62
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
63
|
-
schema: "network.xyo.module.config";
|
|
64
|
-
readonly security?: {
|
|
65
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
66
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
67
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
68
|
-
} | undefined;
|
|
69
|
-
readonly sign?: boolean | undefined;
|
|
70
|
-
readonly storeQueries?: boolean | undefined;
|
|
71
|
-
readonly timestamp?: boolean | undefined;
|
|
72
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
73
|
-
readonly archivist?: string | undefined;
|
|
74
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
75
|
-
readonly name?: string | undefined;
|
|
76
|
-
readonly paging?: Record<string, {
|
|
77
|
-
size?: number | undefined;
|
|
78
|
-
}> | undefined;
|
|
79
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
23
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
80
24
|
schema: "network.xyo.module.config";
|
|
81
|
-
readonly security?: {
|
|
82
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
83
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
84
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
85
|
-
} | undefined;
|
|
86
|
-
readonly sign?: boolean | undefined;
|
|
87
|
-
readonly storeQueries?: boolean | undefined;
|
|
88
|
-
readonly timestamp?: boolean | undefined;
|
|
89
25
|
}, "schema"> & {
|
|
90
26
|
schema: string;
|
|
91
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG9B,CAAA"}
|
package/dist/browser/index.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/index.ts
|
|
@@ -58,11 +48,11 @@ var SentinelCardActions = ({ onReport, module: module2, ...props }) => {
|
|
|
58
48
|
// src/components/Card/CardContent.tsx
|
|
59
49
|
var import_react_flexbox = require("@xylabs/react-flexbox");
|
|
60
50
|
var import_react_module2 = require("@xyo-network/react-module");
|
|
61
|
-
var
|
|
51
|
+
var import_react_payload_raw_info = require("@xyo-network/react-payload-raw-info");
|
|
62
52
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
63
53
|
var SentinelCardContent = ({ children, report, module: module2, ...props }) => {
|
|
64
54
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_module2.ModuleCardContent, { module: module2, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_flexbox.FlexGrowRow, { flexWrap: "wrap", justifyContent: "start", gap: 2, children: [
|
|
65
|
-
report ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
55
|
+
report ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_payload_raw_info.JsonViewerEx, { value: report }) : null,
|
|
66
56
|
children
|
|
67
57
|
] }) });
|
|
68
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/components/Card/Card.tsx","../../src/components/Card/CardActions.tsx","../../src/components/Card/CardContent.tsx","../../src/components/Card/CardHeader.tsx","../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/State.ts","../../src/contexts/use.ts","../../src/hooks/node/useSentinelFromNode.tsx","../../src/hooks/node/useSentinelsFromNode.tsx"],"sourcesContent":["export * from './components'\nexport * from './contexts'\nexport * from './hooks'\n","import { Card, CardProps } from '@mui/material'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { useState } from 'react'\n\nimport { SentinelCardActions } from './CardActions'\nimport { SentinelCardContent } from './CardContent'\nimport { SentinelCardHeader } from './CardHeader'\n\nexport type SentinelCardProps = CardProps &\n ModuleRenderProps<SentinelInstance> & {\n inPayloads?: Payload[]\n }\n\nexport const SentinelCard: React.FC<SentinelCardProps> = ({ children, inPayloads, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} onReport={() => setRetry(retry + 1)} />\n </Card>\n )\n}\n","import { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleCardActions, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel'\n\nexport type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &\n CardActionsProps & {\n onReport?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} size={'small'} variant={'outlined'}>\n Report\n </ButtonEx>\n </ModuleCardActions>\n )\n}\n","import { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleCardContent, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\nimport JsonView from 'react-json-view'\n\nexport type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &\n CardContentProps & {\n report?: Payload[]\n }\n\nexport const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ children, report, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...props}>\n <FlexGrowRow flexWrap=\"wrap\" justifyContent=\"start\" gap={2}>\n {report ?\n <JsonView src={report} />\n : null}\n {children}\n </FlexGrowRow>\n </ModuleCardContent>\n )\n}\n","import { CardHeaderProps } from '@mui/material'\nimport { ModuleCardHeader, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({ title, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.config.name ?? 'Sentinel'} {...props} />\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness-model'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n synchronous: true,\n tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([new Error(`Witness failed [${module?.config?.name ?? module.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n if (witnesses)\n for (const witness of witnesses) {\n offCallbacks.push(\n witness.on('observeEnd', ({ module, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n }\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n for (const callback of offCallbacks) {\n callback()\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ?\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness-model'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","import { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules ?\n [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAAgC;AAChC,2BAA2B;AAI3B,mBAAyB;;;ACJzB,0BAAyB;AACzB,0BAAqD;AAW/C;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAAA,SAAQ,GAAG,MAAM,MAAM;AACzG,SACE,4CAAC,yCAAkB,QAAQA,SAAS,GAAG,OACrC,sDAAC,gCAAS,SAAS,MAAM,WAAWA,OAAM,GAAG,MAAM,SAAS,SAAS,YAAY,oBAEjF,GACF;AAEJ;;;ACjBA,2BAA4B;AAE5B,IAAAC,uBAAqD;AAGrD,6BAAqB;AAUf,IAAAC,sBAAA;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,QAAAC,SAAQ,GAAG,MAAM,MAAM;AACjH,SACE,6CAAC,0CAAkB,QAAQA,SAAS,GAAG,OACrC,wDAAC,oCAAY,UAAS,QAAO,gBAAe,SAAQ,KAAK,GACtD;AAAA,aACC,6CAAC,uBAAAC,SAAA,EAAS,KAAK,QAAQ,IACvB;AAAA,IACD;AAAA,KACH,GACF;AAEJ;;;ACvBA,IAAAC,uBAAoD;AAI3C,IAAAC,sBAAA;AADF,IAAM,qBAAsF,CAAC,EAAE,OAAO,QAAAC,SAAQ,GAAG,MAAM,MAAM;AAClI,SAAO,6CAAC,yCAAiB,QAAQA,SAAQ,OAAO,SAASA,SAAQ,OAAO,QAAQ,YAAa,GAAG,OAA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A,QAAO,QAAQ,IAAI,IAAIA,QAAO,OAAO,GAAG;AACvI,YAAQ,MAAMC,OAAM,OAAO;AAC3B,WAAO,CAAC,QAAWA,MAAK;AAAA,EAC1B;AACA,SAAO,CAAC,UAAU,KAAK;AACzB;;;ACdA,IAAAC,qBAAyD;AACzD,IAAAC,mBAAqD;AAE9C,IAAM,uBAAuB,CAClC,QACA,WAC+D;AAC/D,QAAM,CAAC,SAAS,KAAK,QAAI,uCAAmB,QAAQ,MAAM;AAC1D,MAAI,OAAO;AACT,WAAO,CAAC,MAAM,KAAK;AAAA,EACrB;AACA,SAAO,UACH;AAAA;AAAA,IAEE,QAAQ,OAA2B,CAAC,MAAMC,YAAW;AACnD,cAAI,qCAAmBA,OAAM,GAAG;AAC9B,aAAK,KAAKA,OAAM;AAAA,MAClB;AACA,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,IACL;AAAA,EACF,IACA,CAAC,SAAS,KAAK;AACrB;","names":["module","import_react_module","import_jsx_runtime","module","JsonView","import_react_module","import_jsx_runtime","module","import_jsx_runtime","module","import_react","SentinelReportStatus","import_jsx_runtime","sentinel","module","witnesses","import_react_shared","import_sentinel","module","error","import_react_node","import_sentinel","module"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/components/Card/Card.tsx","../../src/components/Card/CardActions.tsx","../../src/components/Card/CardContent.tsx","../../src/components/Card/CardHeader.tsx","../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/State.ts","../../src/contexts/use.ts","../../src/hooks/node/useSentinelFromNode.tsx","../../src/hooks/node/useSentinelsFromNode.tsx"],"sourcesContent":["export * from './components'\nexport * from './contexts'\nexport * from './hooks'\n","import { Card, CardProps } from '@mui/material'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { useState } from 'react'\n\nimport { SentinelCardActions } from './CardActions'\nimport { SentinelCardContent } from './CardContent'\nimport { SentinelCardHeader } from './CardHeader'\n\nexport type SentinelCardProps = CardProps &\n ModuleRenderProps<SentinelInstance> & {\n inPayloads?: Payload[]\n }\n\nexport const SentinelCard: React.FC<SentinelCardProps> = ({ children, inPayloads, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} onReport={() => setRetry(retry + 1)} />\n </Card>\n )\n}\n","import { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleCardActions, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel'\n\nexport type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &\n CardActionsProps & {\n onReport?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} size={'small'} variant={'outlined'}>\n Report\n </ButtonEx>\n </ModuleCardActions>\n )\n}\n","import { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleCardContent, ModuleRenderProps } from '@xyo-network/react-module'\nimport { JsonViewerEx } from '@xyo-network/react-payload-raw-info'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\n\nexport type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &\n CardContentProps & {\n report?: Payload[]\n }\n\nexport const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ children, report, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...props}>\n <FlexGrowRow flexWrap=\"wrap\" justifyContent=\"start\" gap={2}>\n {report ?\n <JsonViewerEx value={report} />\n : null}\n {children}\n </FlexGrowRow>\n </ModuleCardContent>\n )\n}\n","import { CardHeaderProps } from '@mui/material'\nimport { ModuleCardHeader, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({ title, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.config.name ?? 'Sentinel'} {...props} />\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness-model'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n synchronous: true,\n tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([new Error(`Witness failed [${module?.config?.name ?? module.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n if (witnesses)\n for (const witness of witnesses) {\n offCallbacks.push(\n witness.on('observeEnd', ({ module, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n }\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n for (const callback of offCallbacks) {\n callback()\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ?\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness-model'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","import { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules ?\n [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAAgC;AAChC,2BAA2B;AAI3B,mBAAyB;;;ACJzB,0BAAyB;AACzB,0BAAqD;AAW/C;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAAA,SAAQ,GAAG,MAAM,MAAM;AACzG,SACE,4CAAC,yCAAkB,QAAQA,SAAS,GAAG,OACrC,sDAAC,gCAAS,SAAS,MAAM,WAAWA,OAAM,GAAG,MAAM,SAAS,SAAS,YAAY,oBAEjF,GACF;AAEJ;;;ACjBA,2BAA4B;AAE5B,IAAAC,uBAAqD;AACrD,oCAA6B;AAYvB,IAAAC,sBAAA;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,QAAAC,SAAQ,GAAG,MAAM,MAAM;AACjH,SACE,6CAAC,0CAAkB,QAAQA,SAAS,GAAG,OACrC,wDAAC,oCAAY,UAAS,QAAO,gBAAe,SAAQ,KAAK,GACtD;AAAA,aACC,6CAAC,8CAAa,OAAO,QAAQ,IAC7B;AAAA,IACD;AAAA,KACH,GACF;AAEJ;;;ACvBA,IAAAC,uBAAoD;AAI3C,IAAAC,sBAAA;AADF,IAAM,qBAAsF,CAAC,EAAE,OAAO,QAAAC,SAAQ,GAAG,MAAM,MAAM;AAClI,SAAO,6CAAC,yCAAiB,QAAQA,SAAQ,OAAO,SAASA,SAAQ,OAAO,Q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AO,QAAQ,MAAM,IAAIA,QAAO,QAAQ,IAAI,IAAIA,QAAO,OAAO,GAAG;AACvI,YAAQ,MAAMC,OAAM,OAAO;AAC3B,WAAO,CAAC,QAAWA,MAAK;AAAA,EAC1B;AACA,SAAO,CAAC,UAAU,KAAK;AACzB;;;ACdA,IAAAC,qBAAyD;AACzD,IAAAC,mBAAqD;AAE9C,IAAM,uBAAuB,CAClC,QACA,WAC+D;AAC/D,QAAM,CAAC,SAAS,KAAK,QAAI,uCAAmB,QAAQ,MAAM;AAC1D,MAAI,OAAO;AACT,WAAO,CAAC,MAAM,KAAK;AAAA,EACrB;AACA,SAAO,UACH;AAAA;AAAA,IAEE,QAAQ,OAA2B,CAAC,MAAMC,YAAW;AACnD,cAAI,qCAAmBA,OAAM,GAAG;AAC9B,aAAK,KAAKA,OAAM;AAAA,MAClB;AACA,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,IACL;AAAA,EACF,IACA,CAAC,SAAS,KAAK;AACrB;","names":["module","import_react_module","import_jsx_runtime","module","import_react_module","import_jsx_runtime","module","import_jsx_runtime","module","import_react","SentinelReportStatus","import_jsx_runtime","sentinel","module","witnesses","import_react_shared","import_sentinel","module","error","import_react_node","import_sentinel","module"]}
|
package/dist/browser/index.js
CHANGED
|
@@ -14,11 +14,11 @@ var SentinelCardActions = ({ onReport, module, ...props }) => {
|
|
|
14
14
|
// src/components/Card/CardContent.tsx
|
|
15
15
|
import { FlexGrowRow } from "@xylabs/react-flexbox";
|
|
16
16
|
import { ModuleCardContent } from "@xyo-network/react-module";
|
|
17
|
-
import
|
|
17
|
+
import { JsonViewerEx } from "@xyo-network/react-payload-raw-info";
|
|
18
18
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
19
19
|
var SentinelCardContent = ({ children, report, module, ...props }) => {
|
|
20
20
|
return /* @__PURE__ */ jsx2(ModuleCardContent, { module, ...props, children: /* @__PURE__ */ jsxs(FlexGrowRow, { flexWrap: "wrap", justifyContent: "start", gap: 2, children: [
|
|
21
|
-
report ? /* @__PURE__ */ jsx2(
|
|
21
|
+
report ? /* @__PURE__ */ jsx2(JsonViewerEx, { value: report }) : null,
|
|
22
22
|
children
|
|
23
23
|
] }) });
|
|
24
24
|
};
|
|
@@ -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"],"sourcesContent":["import { Card, CardProps } from '@mui/material'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { useState } from 'react'\n\nimport { SentinelCardActions } from './CardActions'\nimport { SentinelCardContent } from './CardContent'\nimport { SentinelCardHeader } from './CardHeader'\n\nexport type SentinelCardProps = CardProps &\n ModuleRenderProps<SentinelInstance> & {\n inPayloads?: Payload[]\n }\n\nexport const SentinelCard: React.FC<SentinelCardProps> = ({ children, inPayloads, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} onReport={() => setRetry(retry + 1)} />\n </Card>\n )\n}\n","import { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleCardActions, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel'\n\nexport type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &\n CardActionsProps & {\n onReport?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} size={'small'} variant={'outlined'}>\n Report\n </ButtonEx>\n </ModuleCardActions>\n )\n}\n","import { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleCardContent, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\nimport JsonView from 'react-json-view'\n\nexport type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &\n CardContentProps & {\n report?: Payload[]\n }\n\nexport const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ children, report, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...props}>\n <FlexGrowRow flexWrap=\"wrap\" justifyContent=\"start\" gap={2}>\n {report ?\n <JsonView src={report} />\n : null}\n {children}\n </FlexGrowRow>\n </ModuleCardContent>\n )\n}\n","import { CardHeaderProps } from '@mui/material'\nimport { ModuleCardHeader, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({ title, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.config.name ?? 'Sentinel'} {...props} />\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness-model'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n synchronous: true,\n tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([new Error(`Witness failed [${module?.config?.name ?? module.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n if (witnesses)\n for (const witness of witnesses) {\n offCallbacks.push(\n witness.on('observeEnd', ({ module, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n }\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n for (const callback of offCallbacks) {\n callback()\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ?\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness-model'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","import { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules ?\n [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n"],"mappings":";AAAA,SAAS,YAAuB;AAChC,SAAS,kBAAkB;AAI3B,SAAS,gBAAgB;;;ACJzB,SAAS,gBAAgB;AACzB,SAAS,yBAA4C;AAW/C;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,GAAG,MAAM,MAAM;AACzG,SACE,oBAAC,qBAAkB,QAAiB,GAAG,OACrC,8BAAC,YAAS,SAAS,MAAM,WAAW,MAAM,GAAG,MAAM,SAAS,SAAS,YAAY,oBAEjF,GACF;AAEJ;;;ACjBA,SAAS,mBAAmB;AAE5B,S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ources":["../../src/components/Card/Card.tsx","../../src/components/Card/CardActions.tsx","../../src/components/Card/CardContent.tsx","../../src/components/Card/CardHeader.tsx","../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/State.ts","../../src/contexts/use.ts","../../src/hooks/node/useSentinelFromNode.tsx","../../src/hooks/node/useSentinelsFromNode.tsx"],"sourcesContent":["import { Card, CardProps } from '@mui/material'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { useState } from 'react'\n\nimport { SentinelCardActions } from './CardActions'\nimport { SentinelCardContent } from './CardContent'\nimport { SentinelCardHeader } from './CardHeader'\n\nexport type SentinelCardProps = CardProps &\n ModuleRenderProps<SentinelInstance> & {\n inPayloads?: Payload[]\n }\n\nexport const SentinelCard: React.FC<SentinelCardProps> = ({ children, inPayloads, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} onReport={() => setRetry(retry + 1)} />\n </Card>\n )\n}\n","import { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleCardActions, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel'\n\nexport type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &\n CardActionsProps & {\n onReport?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} size={'small'} variant={'outlined'}>\n Report\n </ButtonEx>\n </ModuleCardActions>\n )\n}\n","import { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleCardContent, ModuleRenderProps } from '@xyo-network/react-module'\nimport { JsonViewerEx } from '@xyo-network/react-payload-raw-info'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\n\nexport type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &\n CardContentProps & {\n report?: Payload[]\n }\n\nexport const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ children, report, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...props}>\n <FlexGrowRow flexWrap=\"wrap\" justifyContent=\"start\" gap={2}>\n {report ?\n <JsonViewerEx value={report} />\n : null}\n {children}\n </FlexGrowRow>\n </ModuleCardContent>\n )\n}\n","import { CardHeaderProps } from '@mui/material'\nimport { ModuleCardHeader, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({ title, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.config.name ?? 'Sentinel'} {...props} />\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness-model'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n synchronous: true,\n tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([new Error(`Witness failed [${module?.config?.name ?? module.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n if (witnesses)\n for (const witness of witnesses) {\n offCallbacks.push(\n witness.on('observeEnd', ({ module, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n }\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n for (const callback of offCallbacks) {\n callback()\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ?\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness-model'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","import { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules ?\n [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n"],"mappings":";AAAA,SAAS,YAAuB;AAChC,SAAS,kBAAkB;AAI3B,SAAS,gBAAgB;;;ACJzB,SAAS,gBAAgB;AACzB,SAAS,yBAA4C;AAW/C;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,GAAG,MAAM,MAAM;AACzG,SACE,oBAAC,qBAAkB,QAAiB,GAAG,OACrC,8BAAC,YAAS,SAAS,MAAM,WAAW,MAAM,GAAG,MAAM,SAAS,SAAS,YAAY,oBAEjF,GACF;AAEJ;;;ACjBA,SAAS,mBAAmB;AAE5B,SAAS,yBAA4C;AACrD,SAAS,oBAAoB;AAYvB,SAEI,OAAAA,MAFJ;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,QAAQ,GAAG,MAAM,MAAM;AACjH,SACE,gBAAAA,KAAC,qBAAkB,QAAiB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UAAU,SAAS,UAAU,iBAAiB,OAAO,IAAI,aAAa,iBAAiB,UAAU;AACzG,SAAO,EAAE,SAAS,UAAU,iBAAiB,UAAU,OAAO;AAChE;;;ACPA,SAA+B,yBAAyB;AACxD,SAAS,0BAA4C;AAE9C,IAAM,sBAAsB,CACjC,yBACA,WACsD;AACtD,QAAM,CAAC,QAAQ,KAAK,IAAI,kBAAkB,yBAAyB,MAAM;AACzE,QAAM,WAAW,mBAAmB,MAAM;AAC1C,MAAI,UAAU,CAAC,UAAU;AACvB,UAAMI,SAAQ,IAAI,MAAM,8CAA8C,OAAO,QAAQ,MAAM,IAAI,OAAO,QAAQ,IAAI,IAAI,OAAO,OAAO,GAAG;AACvI,YAAQ,MAAMA,OAAM,OAAO;AAC3B,WAAO,CAAC,QAAWA,MAAK;AAAA,EAC1B;AACA,SAAO,CAAC,UAAU,KAAK;AACzB;;;ACdA,SAA+B,0BAA0B;AACzD,SAAS,0BAA4C;AAE9C,IAAM,uBAAuB,CAClC,QACA,WAC+D;AAC/D,QAAM,CAAC,SAAS,KAAK,IAAI,mBAAmB,QAAQ,MAAM;AAC1D,MAAI,OAAO;AACT,WAAO,CAAC,MAAM,KAAK;AAAA,EACrB;AACA,SAAO,UACH;AAAA;AAAA,IAEE,QAAQ,OAA2B,CAAC,MAAM,WAAW;AACnD,UAAI,mBAAmB,MAAM,GAAG;AAC9B,aAAK,KAAK,MAAM;AAAA,MAClB;AACA,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,IACL;AAAA,EACF,IACA,CAAC,SAAS,KAAK;AACrB;","names":["jsx","jsx","jsx","jsxs","useState","SentinelReportStatus","jsx","useState","sentinel","witnesses","error"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,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,CAWlE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,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,CAWlE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"CardContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/CardContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,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,CAWlE,CAAA"}
|
|
@@ -6,86 +6,22 @@ export declare const useSentinelContext: () => {
|
|
|
6
6
|
reportingErrors: Error[] | undefined;
|
|
7
7
|
sentinel: import("@xyo-network/sentinel-model").SentinelModule<import("@xylabs/object").BaseParamsFields & {
|
|
8
8
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
9
|
-
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
10
|
-
readonly archivist?: string | undefined;
|
|
11
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
12
|
-
readonly name?: string | undefined;
|
|
13
|
-
readonly paging?: Record<string, {
|
|
14
|
-
size?: number | undefined;
|
|
15
|
-
}> | undefined;
|
|
16
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
17
|
-
schema: "network.xyo.sentinel.config";
|
|
18
|
-
readonly security?: {
|
|
19
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
20
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
21
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
22
|
-
} | undefined;
|
|
23
|
-
readonly sign?: boolean | undefined;
|
|
24
|
-
readonly storeQueries?: boolean | undefined;
|
|
25
|
-
readonly timestamp?: boolean | undefined;
|
|
26
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
27
|
-
readonly archivist?: string | undefined;
|
|
28
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
29
|
-
readonly name?: string | undefined;
|
|
30
|
-
readonly paging?: Record<string, {
|
|
31
|
-
size?: number | undefined;
|
|
32
|
-
}> | undefined;
|
|
33
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
34
|
-
schema: "network.xyo.sentinel.config";
|
|
35
|
-
readonly security?: {
|
|
36
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
37
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
38
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
39
|
-
} | undefined;
|
|
40
|
-
readonly sign?: boolean | undefined;
|
|
41
|
-
readonly storeQueries?: boolean | undefined;
|
|
42
|
-
readonly timestamp?: boolean | undefined;
|
|
43
|
-
} & {
|
|
9
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
44
10
|
automations?: import("@xyo-network/sentinel-model").SentinelAutomationPayload[] | undefined;
|
|
45
11
|
schema: "network.xyo.sentinel.config";
|
|
46
12
|
synchronous?: boolean | undefined;
|
|
47
13
|
tasks: import("@xyo-network/sentinel-model").Task[];
|
|
48
14
|
throwErrors?: boolean | undefined;
|
|
15
|
+
}, "schema"> & {
|
|
16
|
+
schema: "network.xyo.sentinel.config";
|
|
49
17
|
}, "schema"> & {
|
|
50
18
|
schema: string;
|
|
51
19
|
};
|
|
52
20
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
53
21
|
}, import("@xyo-network/sentinel-model").SentinelModuleEventData<import("@xyo-network/module-model").Module<import("@xylabs/object").BaseParamsFields & {
|
|
54
22
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
55
|
-
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
56
|
-
readonly archivist?: string | undefined;
|
|
57
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
58
|
-
readonly name?: string | undefined;
|
|
59
|
-
readonly paging?: Record<string, {
|
|
60
|
-
size?: number | undefined;
|
|
61
|
-
}> | undefined;
|
|
62
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
63
|
-
schema: "network.xyo.module.config";
|
|
64
|
-
readonly security?: {
|
|
65
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
66
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
67
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
68
|
-
} | undefined;
|
|
69
|
-
readonly sign?: boolean | undefined;
|
|
70
|
-
readonly storeQueries?: boolean | undefined;
|
|
71
|
-
readonly timestamp?: boolean | undefined;
|
|
72
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
73
|
-
readonly archivist?: string | undefined;
|
|
74
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
75
|
-
readonly name?: string | undefined;
|
|
76
|
-
readonly paging?: Record<string, {
|
|
77
|
-
size?: number | undefined;
|
|
78
|
-
}> | undefined;
|
|
79
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
23
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
80
24
|
schema: "network.xyo.module.config";
|
|
81
|
-
readonly security?: {
|
|
82
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
83
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
84
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
85
|
-
} | undefined;
|
|
86
|
-
readonly sign?: boolean | undefined;
|
|
87
|
-
readonly storeQueries?: boolean | undefined;
|
|
88
|
-
readonly timestamp?: boolean | undefined;
|
|
89
25
|
}, "schema"> & {
|
|
90
26
|
schema: string;
|
|
91
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG9B,CAAA"}
|
|
@@ -6,86 +6,22 @@ export declare const useSentinelContext: () => {
|
|
|
6
6
|
reportingErrors: Error[] | undefined;
|
|
7
7
|
sentinel: import("@xyo-network/sentinel-model").SentinelModule<import("@xylabs/object").BaseParamsFields & {
|
|
8
8
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
9
|
-
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
10
|
-
readonly archivist?: string | undefined;
|
|
11
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
12
|
-
readonly name?: string | undefined;
|
|
13
|
-
readonly paging?: Record<string, {
|
|
14
|
-
size?: number | undefined;
|
|
15
|
-
}> | undefined;
|
|
16
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
17
|
-
schema: "network.xyo.sentinel.config";
|
|
18
|
-
readonly security?: {
|
|
19
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
20
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
21
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
22
|
-
} | undefined;
|
|
23
|
-
readonly sign?: boolean | undefined;
|
|
24
|
-
readonly storeQueries?: boolean | undefined;
|
|
25
|
-
readonly timestamp?: boolean | undefined;
|
|
26
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
27
|
-
readonly archivist?: string | undefined;
|
|
28
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
29
|
-
readonly name?: string | undefined;
|
|
30
|
-
readonly paging?: Record<string, {
|
|
31
|
-
size?: number | undefined;
|
|
32
|
-
}> | undefined;
|
|
33
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
34
|
-
schema: "network.xyo.sentinel.config";
|
|
35
|
-
readonly security?: {
|
|
36
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
37
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
38
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
39
|
-
} | undefined;
|
|
40
|
-
readonly sign?: boolean | undefined;
|
|
41
|
-
readonly storeQueries?: boolean | undefined;
|
|
42
|
-
readonly timestamp?: boolean | undefined;
|
|
43
|
-
} & {
|
|
9
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
44
10
|
automations?: import("@xyo-network/sentinel-model").SentinelAutomationPayload[] | undefined;
|
|
45
11
|
schema: "network.xyo.sentinel.config";
|
|
46
12
|
synchronous?: boolean | undefined;
|
|
47
13
|
tasks: import("@xyo-network/sentinel-model").Task[];
|
|
48
14
|
throwErrors?: boolean | undefined;
|
|
15
|
+
}, "schema"> & {
|
|
16
|
+
schema: "network.xyo.sentinel.config";
|
|
49
17
|
}, "schema"> & {
|
|
50
18
|
schema: string;
|
|
51
19
|
};
|
|
52
20
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
53
21
|
}, import("@xyo-network/sentinel-model").SentinelModuleEventData<import("@xyo-network/module-model").Module<import("@xylabs/object").BaseParamsFields & {
|
|
54
22
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
55
|
-
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
56
|
-
readonly archivist?: string | undefined;
|
|
57
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
58
|
-
readonly name?: string | undefined;
|
|
59
|
-
readonly paging?: Record<string, {
|
|
60
|
-
size?: number | undefined;
|
|
61
|
-
}> | undefined;
|
|
62
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
63
|
-
schema: "network.xyo.module.config";
|
|
64
|
-
readonly security?: {
|
|
65
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
66
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
67
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
68
|
-
} | undefined;
|
|
69
|
-
readonly sign?: boolean | undefined;
|
|
70
|
-
readonly storeQueries?: boolean | undefined;
|
|
71
|
-
readonly timestamp?: boolean | undefined;
|
|
72
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
73
|
-
readonly archivist?: string | undefined;
|
|
74
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
75
|
-
readonly name?: string | undefined;
|
|
76
|
-
readonly paging?: Record<string, {
|
|
77
|
-
size?: number | undefined;
|
|
78
|
-
}> | undefined;
|
|
79
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
23
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
80
24
|
schema: "network.xyo.module.config";
|
|
81
|
-
readonly security?: {
|
|
82
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
83
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
84
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
85
|
-
} | undefined;
|
|
86
|
-
readonly sign?: boolean | undefined;
|
|
87
|
-
readonly storeQueries?: boolean | undefined;
|
|
88
|
-
readonly timestamp?: boolean | undefined;
|
|
89
25
|
}, "schema"> & {
|
|
90
26
|
schema: string;
|
|
91
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG9B,CAAA"}
|
|
@@ -6,86 +6,22 @@ export declare const useSentinelContext: () => {
|
|
|
6
6
|
reportingErrors: Error[] | undefined;
|
|
7
7
|
sentinel: import("@xyo-network/sentinel-model").SentinelModule<import("@xylabs/object").BaseParamsFields & {
|
|
8
8
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
9
|
-
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
10
|
-
readonly archivist?: string | undefined;
|
|
11
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
12
|
-
readonly name?: string | undefined;
|
|
13
|
-
readonly paging?: Record<string, {
|
|
14
|
-
size?: number | undefined;
|
|
15
|
-
}> | undefined;
|
|
16
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
17
|
-
schema: "network.xyo.sentinel.config";
|
|
18
|
-
readonly security?: {
|
|
19
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
20
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
21
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
22
|
-
} | undefined;
|
|
23
|
-
readonly sign?: boolean | undefined;
|
|
24
|
-
readonly storeQueries?: boolean | undefined;
|
|
25
|
-
readonly timestamp?: boolean | undefined;
|
|
26
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
27
|
-
readonly archivist?: string | undefined;
|
|
28
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
29
|
-
readonly name?: string | undefined;
|
|
30
|
-
readonly paging?: Record<string, {
|
|
31
|
-
size?: number | undefined;
|
|
32
|
-
}> | undefined;
|
|
33
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
34
|
-
schema: "network.xyo.sentinel.config";
|
|
35
|
-
readonly security?: {
|
|
36
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
37
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
38
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
39
|
-
} | undefined;
|
|
40
|
-
readonly sign?: boolean | undefined;
|
|
41
|
-
readonly storeQueries?: boolean | undefined;
|
|
42
|
-
readonly timestamp?: boolean | undefined;
|
|
43
|
-
} & {
|
|
9
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
|
|
44
10
|
automations?: import("@xyo-network/sentinel-model").SentinelAutomationPayload[] | undefined;
|
|
45
11
|
schema: "network.xyo.sentinel.config";
|
|
46
12
|
synchronous?: boolean | undefined;
|
|
47
13
|
tasks: import("@xyo-network/sentinel-model").Task[];
|
|
48
14
|
throwErrors?: boolean | undefined;
|
|
15
|
+
}, "schema"> & {
|
|
16
|
+
schema: "network.xyo.sentinel.config";
|
|
49
17
|
}, "schema"> & {
|
|
50
18
|
schema: string;
|
|
51
19
|
};
|
|
52
20
|
ephemeralQueryAccountEnabled?: boolean | undefined;
|
|
53
21
|
}, import("@xyo-network/sentinel-model").SentinelModuleEventData<import("@xyo-network/module-model").Module<import("@xylabs/object").BaseParamsFields & {
|
|
54
22
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
55
|
-
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<{
|
|
56
|
-
readonly archivist?: string | undefined;
|
|
57
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
58
|
-
readonly name?: string | undefined;
|
|
59
|
-
readonly paging?: Record<string, {
|
|
60
|
-
size?: number | undefined;
|
|
61
|
-
}> | undefined;
|
|
62
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
63
|
-
schema: "network.xyo.module.config";
|
|
64
|
-
readonly security?: {
|
|
65
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
66
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
67
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
68
|
-
} | undefined;
|
|
69
|
-
readonly sign?: boolean | undefined;
|
|
70
|
-
readonly storeQueries?: boolean | undefined;
|
|
71
|
-
readonly timestamp?: boolean | undefined;
|
|
72
|
-
} & import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
73
|
-
readonly archivist?: string | undefined;
|
|
74
|
-
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
75
|
-
readonly name?: string | undefined;
|
|
76
|
-
readonly paging?: Record<string, {
|
|
77
|
-
size?: number | undefined;
|
|
78
|
-
}> | undefined;
|
|
79
|
-
readonly retry?: import("@xylabs/retry").RetryConfig | undefined;
|
|
23
|
+
config: import("@xyo-network/payload-model").SchemaFields & object & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & object & {
|
|
80
24
|
schema: "network.xyo.module.config";
|
|
81
|
-
readonly security?: {
|
|
82
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
83
|
-
readonly allowed?: Record<string, (Lowercase<string> | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
84
|
-
readonly disallowed?: Record<string, Lowercase<string>[]> | undefined;
|
|
85
|
-
} | undefined;
|
|
86
|
-
readonly sign?: boolean | undefined;
|
|
87
|
-
readonly storeQueries?: boolean | undefined;
|
|
88
|
-
readonly timestamp?: boolean | undefined;
|
|
89
25
|
}, "schema"> & {
|
|
90
26
|
schema: string;
|
|
91
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../../../src/contexts/use.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAG9B,CAAA"}
|
package/dist/node/index.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/index.ts
|
|
@@ -58,11 +48,11 @@ var SentinelCardActions = ({ onReport, module: module2, ...props }) => {
|
|
|
58
48
|
// src/components/Card/CardContent.tsx
|
|
59
49
|
var import_react_flexbox = require("@xylabs/react-flexbox");
|
|
60
50
|
var import_react_module2 = require("@xyo-network/react-module");
|
|
61
|
-
var
|
|
51
|
+
var import_react_payload_raw_info = require("@xyo-network/react-payload-raw-info");
|
|
62
52
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
63
53
|
var SentinelCardContent = ({ children, report, module: module2, ...props }) => {
|
|
64
54
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_module2.ModuleCardContent, { module: module2, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_flexbox.FlexGrowRow, { flexWrap: "wrap", justifyContent: "start", gap: 2, children: [
|
|
65
|
-
report ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
55
|
+
report ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_payload_raw_info.JsonViewerEx, { value: report }) : null,
|
|
66
56
|
children
|
|
67
57
|
] }) });
|
|
68
58
|
};
|
package/dist/node/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/components/Card/Card.tsx","../../src/components/Card/CardActions.tsx","../../src/components/Card/CardContent.tsx","../../src/components/Card/CardHeader.tsx","../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/State.ts","../../src/contexts/use.ts","../../src/hooks/node/useSentinelFromNode.tsx","../../src/hooks/node/useSentinelsFromNode.tsx"],"sourcesContent":["export * from './components'\nexport * from './contexts'\nexport * from './hooks'\n","import { Card, CardProps } from '@mui/material'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { useState } from 'react'\n\nimport { SentinelCardActions } from './CardActions'\nimport { SentinelCardContent } from './CardContent'\nimport { SentinelCardHeader } from './CardHeader'\n\nexport type SentinelCardProps = CardProps &\n ModuleRenderProps<SentinelInstance> & {\n inPayloads?: Payload[]\n }\n\nexport const SentinelCard: React.FC<SentinelCardProps> = ({ children, inPayloads, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} onReport={() => setRetry(retry + 1)} />\n </Card>\n )\n}\n","import { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleCardActions, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel'\n\nexport type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &\n CardActionsProps & {\n onReport?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} size={'small'} variant={'outlined'}>\n Report\n </ButtonEx>\n </ModuleCardActions>\n )\n}\n","import { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleCardContent, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\nimport JsonView from 'react-json-view'\n\nexport type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &\n CardContentProps & {\n report?: Payload[]\n }\n\nexport const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ children, report, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...props}>\n <FlexGrowRow flexWrap=\"wrap\" justifyContent=\"start\" gap={2}>\n {report ?\n <JsonView src={report} />\n : null}\n {children}\n </FlexGrowRow>\n </ModuleCardContent>\n )\n}\n","import { CardHeaderProps } from '@mui/material'\nimport { ModuleCardHeader, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({ title, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.config.name ?? 'Sentinel'} {...props} />\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness-model'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n synchronous: true,\n tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([new Error(`Witness failed [${module?.config?.name ?? module.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n if (witnesses)\n for (const witness of witnesses) {\n offCallbacks.push(\n witness.on('observeEnd', ({ module, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n }\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n for (const callback of offCallbacks) {\n callback()\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ?\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness-model'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","import { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules ?\n [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAAgC;AAChC,2BAA2B;AAI3B,mBAAyB;;;ACJzB,0BAAyB;AACzB,0BAAqD;AAW/C;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAAA,SAAQ,GAAG,MAAM,MAAM;AACzG,SACE,4CAAC,yCAAkB,QAAQA,SAAS,GAAG,OACrC,sDAAC,gCAAS,SAAS,MAAM,qCAAWA,UAAS,MAAM,SAAS,SAAS,YAAY,oBAEjF,GACF;AAEJ;;;ACjBA,2BAA4B;AAE5B,IAAAC,uBAAqD;AAGrD,6BAAqB;AAUf,IAAAC,sBAAA;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,QAAAC,SAAQ,GAAG,MAAM,MAAM;AACjH,SACE,6CAAC,0CAAkB,QAAQA,SAAS,GAAG,OACrC,wDAAC,oCAAY,UAAS,QAAO,gBAAe,SAAQ,KAAK,GACtD;AAAA,aACC,6CAAC,uBAAAC,SAAA,EAAS,KAAK,QAAQ,IACvB;AAAA,IACD;AAAA,KACH,GACF;AAEJ;;;ACvBA,IAAAC,uBAAoD;AAI3C,IAAAC,sBAAA;AADF,IAAM,qBAAsF,CAAC,EAAE,OAAO,QAAAC,SAAQ,GAAG,MAA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AAK,QAAI,qCAAkB,yBAAyB,MAAM;AACzE,QAAM,eAAW,qCAAmBA,OAAM;AAC1C,MAAIA,WAAU,CAAC,UAAU;AACvB,UAAMC,SAAQ,IAAI,MAAM,+CAA8C,KAAAD,QAAO,WAAP,mBAAe,MAAM,KAAI,KAAAA,QAAO,WAAP,mBAAe,IAAI,IAAIA,QAAO,OAAO,GAAG;AACvI,YAAQ,MAAMC,OAAM,OAAO;AAC3B,WAAO,CAAC,QAAWA,MAAK;AAAA,EAC1B;AACA,SAAO,CAAC,UAAU,KAAK;AACzB;;;ACdA,IAAAC,qBAAyD;AACzD,IAAAC,mBAAqD;AAE9C,IAAM,uBAAuB,CAClC,QACA,WAC+D;AAC/D,QAAM,CAAC,SAAS,KAAK,QAAI,uCAAmB,QAAQ,MAAM;AAC1D,MAAI,OAAO;AACT,WAAO,CAAC,MAAM,KAAK;AAAA,EACrB;AACA,SAAO,UACH;AAAA;AAAA,IAEE,QAAQ,OAA2B,CAAC,MAAMC,YAAW;AACnD,cAAI,qCAAmBA,OAAM,GAAG;AAC9B,aAAK,KAAKA,OAAM;AAAA,MAClB;AACA,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,IACL;AAAA,EACF,IACA,CAAC,SAAS,KAAK;AACrB;","names":["module","import_react_module","import_jsx_runtime","module","JsonView","import_react_module","import_jsx_runtime","module","import_jsx_runtime","module","import_react","SentinelReportStatus","import_jsx_runtime","sentinel","module","witnesses","import_react_shared","import_sentinel","module","error","import_react_node","import_sentinel","module"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/components/Card/Card.tsx","../../src/components/Card/CardActions.tsx","../../src/components/Card/CardContent.tsx","../../src/components/Card/CardHeader.tsx","../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/State.ts","../../src/contexts/use.ts","../../src/hooks/node/useSentinelFromNode.tsx","../../src/hooks/node/useSentinelsFromNode.tsx"],"sourcesContent":["export * from './components'\nexport * from './contexts'\nexport * from './hooks'\n","import { Card, CardProps } from '@mui/material'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { useState } from 'react'\n\nimport { SentinelCardActions } from './CardActions'\nimport { SentinelCardContent } from './CardContent'\nimport { SentinelCardHeader } from './CardHeader'\n\nexport type SentinelCardProps = CardProps &\n ModuleRenderProps<SentinelInstance> & {\n inPayloads?: Payload[]\n }\n\nexport const SentinelCard: React.FC<SentinelCardProps> = ({ children, inPayloads, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} onReport={() => setRetry(retry + 1)} />\n </Card>\n )\n}\n","import { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleCardActions, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel'\n\nexport type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &\n CardActionsProps & {\n onReport?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} size={'small'} variant={'outlined'}>\n Report\n </ButtonEx>\n </ModuleCardActions>\n )\n}\n","import { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleCardContent, ModuleRenderProps } from '@xyo-network/react-module'\nimport { JsonViewerEx } from '@xyo-network/react-payload-raw-info'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\n\nexport type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &\n CardContentProps & {\n report?: Payload[]\n }\n\nexport const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ children, report, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...props}>\n <FlexGrowRow flexWrap=\"wrap\" justifyContent=\"start\" gap={2}>\n {report ?\n <JsonViewerEx value={report} />\n : null}\n {children}\n </FlexGrowRow>\n </ModuleCardContent>\n )\n}\n","import { CardHeaderProps } from '@mui/material'\nimport { ModuleCardHeader, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({ title, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.config.name ?? 'Sentinel'} {...props} />\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness-model'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n synchronous: true,\n tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([new Error(`Witness failed [${module?.config?.name ?? module.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n if (witnesses)\n for (const witness of witnesses) {\n offCallbacks.push(\n witness.on('observeEnd', ({ module, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n }\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n for (const callback of offCallbacks) {\n callback()\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ?\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness-model'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","import { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules ?\n [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAAgC;AAChC,2BAA2B;AAI3B,mBAAyB;;;ACJzB,0BAAyB;AACzB,0BAAqD;AAW/C;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAAA,SAAQ,GAAG,MAAM,MAAM;AACzG,SACE,4CAAC,yCAAkB,QAAQA,SAAS,GAAG,OACrC,sDAAC,gCAAS,SAAS,MAAM,qCAAWA,UAAS,MAAM,SAAS,SAAS,YAAY,oBAEjF,GACF;AAEJ;;;ACjBA,2BAA4B;AAE5B,IAAAC,uBAAqD;AACrD,oCAA6B;AAYvB,IAAAC,sBAAA;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,QAAAC,SAAQ,GAAG,MAAM,MAAM;AACjH,SACE,6CAAC,0CAAkB,QAAQA,SAAS,GAAG,OACrC,wDAAC,oCAAY,UAAS,QAAO,gBAAe,SAAQ,KAAK,GACtD;AAAA,aACC,6CAAC,8CAAa,OAAO,QAAQ,IAC7B;AAAA,IACD;AAAA,KACH,GACF;AAEJ;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ACPA,wBAAwD;AACxD,IAAAC,mBAAqD;AAE9C,IAAM,sBAAsB,CACjC,yBACA,WACsD;AANxD;AAOE,QAAM,CAACC,SAAQ,KAAK,QAAI,qCAAkB,yBAAyB,MAAM;AACzE,QAAM,eAAW,qCAAmBA,OAAM;AAC1C,MAAIA,WAAU,CAAC,UAAU;AACvB,UAAMC,SAAQ,IAAI,MAAM,+CAA8C,KAAAD,QAAO,WAAP,mBAAe,MAAM,KAAI,KAAAA,QAAO,WAAP,mBAAe,IAAI,IAAIA,QAAO,OAAO,GAAG;AACvI,YAAQ,MAAMC,OAAM,OAAO;AAC3B,WAAO,CAAC,QAAWA,MAAK;AAAA,EAC1B;AACA,SAAO,CAAC,UAAU,KAAK;AACzB;;;ACdA,IAAAC,qBAAyD;AACzD,IAAAC,mBAAqD;AAE9C,IAAM,uBAAuB,CAClC,QACA,WAC+D;AAC/D,QAAM,CAAC,SAAS,KAAK,QAAI,uCAAmB,QAAQ,MAAM;AAC1D,MAAI,OAAO;AACT,WAAO,CAAC,MAAM,KAAK;AAAA,EACrB;AACA,SAAO,UACH;AAAA;AAAA,IAEE,QAAQ,OAA2B,CAAC,MAAMC,YAAW;AACnD,cAAI,qCAAmBA,OAAM,GAAG;AAC9B,aAAK,KAAKA,OAAM;AAAA,MAClB;AACA,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,IACL;AAAA,EACF,IACA,CAAC,SAAS,KAAK;AACrB;","names":["module","import_react_module","import_jsx_runtime","module","import_react_module","import_jsx_runtime","module","import_jsx_runtime","module","import_react","SentinelReportStatus","import_jsx_runtime","sentinel","module","witnesses","import_react_shared","import_sentinel","module","error","import_react_node","import_sentinel","module"]}
|
package/dist/node/index.js
CHANGED
|
@@ -14,11 +14,11 @@ var SentinelCardActions = ({ onReport, module, ...props }) => {
|
|
|
14
14
|
// src/components/Card/CardContent.tsx
|
|
15
15
|
import { FlexGrowRow } from "@xylabs/react-flexbox";
|
|
16
16
|
import { ModuleCardContent } from "@xyo-network/react-module";
|
|
17
|
-
import
|
|
17
|
+
import { JsonViewerEx } from "@xyo-network/react-payload-raw-info";
|
|
18
18
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
19
19
|
var SentinelCardContent = ({ children, report, module, ...props }) => {
|
|
20
20
|
return /* @__PURE__ */ jsx2(ModuleCardContent, { module, ...props, children: /* @__PURE__ */ jsxs(FlexGrowRow, { flexWrap: "wrap", justifyContent: "start", gap: 2, children: [
|
|
21
|
-
report ? /* @__PURE__ */ jsx2(
|
|
21
|
+
report ? /* @__PURE__ */ jsx2(JsonViewerEx, { value: report }) : null,
|
|
22
22
|
children
|
|
23
23
|
] }) });
|
|
24
24
|
};
|
package/dist/node/index.js.map
CHANGED
|
@@ -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"],"sourcesContent":["import { Card, CardProps } from '@mui/material'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { useState } from 'react'\n\nimport { SentinelCardActions } from './CardActions'\nimport { SentinelCardContent } from './CardContent'\nimport { SentinelCardHeader } from './CardHeader'\n\nexport type SentinelCardProps = CardProps &\n ModuleRenderProps<SentinelInstance> & {\n inPayloads?: Payload[]\n }\n\nexport const SentinelCard: React.FC<SentinelCardProps> = ({ children, inPayloads, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} onReport={() => setRetry(retry + 1)} />\n </Card>\n )\n}\n","import { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleCardActions, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel'\n\nexport type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &\n CardActionsProps & {\n onReport?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} size={'small'} variant={'outlined'}>\n Report\n </ButtonEx>\n </ModuleCardActions>\n )\n}\n","import { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleCardContent, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\nimport JsonView from 'react-json-view'\n\nexport type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &\n CardContentProps & {\n report?: Payload[]\n }\n\nexport const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ children, report, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...props}>\n <FlexGrowRow flexWrap=\"wrap\" justifyContent=\"start\" gap={2}>\n {report ?\n <JsonView src={report} />\n : null}\n {children}\n </FlexGrowRow>\n </ModuleCardContent>\n )\n}\n","import { CardHeaderProps } from '@mui/material'\nimport { ModuleCardHeader, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({ title, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.config.name ?? 'Sentinel'} {...props} />\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness-model'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n synchronous: true,\n tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([new Error(`Witness failed [${module?.config?.name ?? module.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n if (witnesses)\n for (const witness of witnesses) {\n offCallbacks.push(\n witness.on('observeEnd', ({ module, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n }\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n for (const callback of offCallbacks) {\n callback()\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ?\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness-model'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","import { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules ?\n [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n"],"mappings":";AAAA,SAAS,YAAuB;AAChC,SAAS,kBAAkB;AAI3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AAAA,EACrB;AACA,SAAO,UACH;AAAA;AAAA,IAEE,QAAQ,OAA2B,CAAC,MAAM,WAAW;AACnD,UAAI,mBAAmB,MAAM,GAAG;AAC9B,aAAK,KAAK,MAAM;AAAA,MAClB;AACA,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,IACL;AAAA,EACF,IACA,CAAC,SAAS,KAAK;AACrB;","names":["jsx","jsx","jsx","jsxs","useState","SentinelReportStatus","jsx","useState","sentinel","witnesses","error"]}
|
|
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"],"sourcesContent":["import { Card, CardProps } from '@mui/material'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport { useState } from 'react'\n\nimport { SentinelCardActions } from './CardActions'\nimport { SentinelCardContent } from './CardContent'\nimport { SentinelCardHeader } from './CardHeader'\n\nexport type SentinelCardProps = CardProps &\n ModuleRenderProps<SentinelInstance> & {\n inPayloads?: Payload[]\n }\n\nexport const SentinelCard: React.FC<SentinelCardProps> = ({ children, inPayloads, module, ...props }) => {\n const [retry, setRetry] = useState(-1)\n const [report] = usePromise(async () => {\n if (retry >= 0) {\n return await module?.report(inPayloads)\n }\n }, [module, retry, inPayloads])\n return (\n <Card {...props}>\n <SentinelCardHeader module={module} />\n <SentinelCardContent module={module} report={report} />\n {children}\n <SentinelCardActions module={module} onReport={() => setRetry(retry + 1)} />\n </Card>\n )\n}\n","import { CardActionsProps } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ModuleCardActions, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel'\n\nexport type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance> &\n CardActionsProps & {\n onReport?: (module?: SentinelInstance) => void\n }\n\nexport const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({ onReport, module, ...props }) => {\n return (\n <ModuleCardActions module={module} {...props}>\n <ButtonEx onClick={() => onReport?.(module)} size={'small'} variant={'outlined'}>\n Report\n </ButtonEx>\n </ModuleCardActions>\n )\n}\n","import { CardContentProps } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { ModuleCardContent, ModuleRenderProps } from '@xyo-network/react-module'\nimport { JsonViewerEx } from '@xyo-network/react-payload-raw-info'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\nimport React from 'react'\n\nexport type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &\n CardContentProps & {\n report?: Payload[]\n }\n\nexport const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ children, report, module, ...props }) => {\n return (\n <ModuleCardContent module={module} {...props}>\n <FlexGrowRow flexWrap=\"wrap\" justifyContent=\"start\" gap={2}>\n {report ?\n <JsonViewerEx value={report} />\n : null}\n {children}\n </FlexGrowRow>\n </ModuleCardContent>\n )\n}\n","import { CardHeaderProps } from '@mui/material'\nimport { ModuleCardHeader, ModuleRenderProps } from '@xyo-network/react-module'\nimport { SentinelInstance } from '@xyo-network/sentinel-model'\n\nexport const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({ title, module, ...props }) => {\n return <ModuleCardHeader module={module} title={title ?? module?.config.name ?? 'Sentinel'} {...props} />\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","/* eslint-disable unicorn/no-array-push-push */\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module-model'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness-model'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n synchronous: true,\n tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([new Error(`Witness failed [${module?.config?.name ?? module.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n if (witnesses)\n for (const witness of witnesses) {\n offCallbacks.push(\n witness.on('observeEnd', ({ module, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n }\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n for (const callback of offCallbacks) {\n callback()\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ?\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness-model'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","import { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = new Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n return modules ?\n [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n"],"mappings":";AAAA,SAAS,YAAuB;AAChC,SAAS,kBAAkB;AAI3B,SAAS,gBAAgB;;;ACJzB,SAAS,gBAAgB;AACzB,SAAS,yBAA4C;AAW/C;AAHC,IAAM,sBAA0D,CAAC,EAAE,UAAU,QAAQ,GAAG,MAAM,MAAM;AACzG,SACE,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AA,MAClB;AACA,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,IACL;AAAA,EACF,IACA,CAAC,SAAS,KAAK;AACrB;","names":["jsx","jsx","jsx","jsxs","useState","SentinelReportStatus","jsx","useState","sentinel","witnesses","error"]}
|
package/package.json
CHANGED
|
@@ -10,36 +10,38 @@
|
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xylabs/react-async-effect": "^3.1.
|
|
14
|
-
"@xylabs/react-button": "^3.1.
|
|
15
|
-
"@xylabs/react-flexbox": "^3.1.
|
|
16
|
-
"@xylabs/react-promise": "^3.1.
|
|
17
|
-
"@xylabs/react-shared": "^3.1.
|
|
18
|
-
"@xyo-network/account-model": "^2.92.
|
|
19
|
-
"@xyo-network/archivist": "^2.92.
|
|
20
|
-
"@xyo-network/boundwitness-model": "^2.92.
|
|
21
|
-
"@xyo-network/module-model": "^2.92.
|
|
22
|
-
"@xyo-network/payload-model": "^2.92.
|
|
23
|
-
"@xyo-network/react-module": "
|
|
24
|
-
"@xyo-network/react-node": "~2.70.
|
|
25
|
-
"@xyo-network/react-
|
|
26
|
-
"@xyo-network/react-
|
|
27
|
-
"@xyo-network/
|
|
28
|
-
"@xyo-network/sentinel
|
|
29
|
-
"@xyo-network/
|
|
30
|
-
"
|
|
13
|
+
"@xylabs/react-async-effect": "^3.1.5",
|
|
14
|
+
"@xylabs/react-button": "^3.1.5",
|
|
15
|
+
"@xylabs/react-flexbox": "^3.1.5",
|
|
16
|
+
"@xylabs/react-promise": "^3.1.5",
|
|
17
|
+
"@xylabs/react-shared": "^3.1.5",
|
|
18
|
+
"@xyo-network/account-model": "^2.92.3",
|
|
19
|
+
"@xyo-network/archivist": "^2.92.3",
|
|
20
|
+
"@xyo-network/boundwitness-model": "^2.92.3",
|
|
21
|
+
"@xyo-network/module-model": "^2.92.3",
|
|
22
|
+
"@xyo-network/payload-model": "^2.92.3",
|
|
23
|
+
"@xyo-network/react-module": "~2.70.7",
|
|
24
|
+
"@xyo-network/react-node": "~2.70.7",
|
|
25
|
+
"@xyo-network/react-payload-raw-info": "~2.70.6",
|
|
26
|
+
"@xyo-network/react-shared": "~2.70.7",
|
|
27
|
+
"@xyo-network/react-witness": "~2.70.7",
|
|
28
|
+
"@xyo-network/sentinel": "^2.92.3",
|
|
29
|
+
"@xyo-network/sentinel-model": "^2.92.3",
|
|
30
|
+
"@xyo-network/witness-model": "^2.92.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@storybook/react": "^7.6.17",
|
|
34
|
-
"@xylabs/ts-scripts-yarn3": "^3.
|
|
35
|
-
"@xylabs/tsconfig-react": "^3.
|
|
36
|
-
"@xyo-network/account": "^2.92.
|
|
34
|
+
"@xylabs/ts-scripts-yarn3": "^3.5.2",
|
|
35
|
+
"@xylabs/tsconfig-react": "^3.5.2",
|
|
36
|
+
"@xyo-network/account": "^2.92.3",
|
|
37
37
|
"@xyo-network/evm-call-witness": "^2.89.0",
|
|
38
|
-
"@xyo-network/manifest": "^2.92.
|
|
38
|
+
"@xyo-network/manifest": "^2.92.3",
|
|
39
39
|
"ethers": "^6.11.1",
|
|
40
40
|
"typescript": "^5.4.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
+
"@emotion/react": "^11",
|
|
44
|
+
"@emotion/styled": "^11",
|
|
43
45
|
"@mui/icons-material": "^5",
|
|
44
46
|
"@mui/material": "^5",
|
|
45
47
|
"@mui/styles": "^5",
|
|
@@ -97,6 +99,6 @@
|
|
|
97
99
|
},
|
|
98
100
|
"sideEffects": false,
|
|
99
101
|
"types": "dist/browser/index.d.ts",
|
|
100
|
-
"version": "2.70.
|
|
102
|
+
"version": "2.70.7",
|
|
101
103
|
"type": "module"
|
|
102
104
|
}
|
|
@@ -130,7 +130,7 @@ const NftTokensSentinelTemplate: StoryFn<typeof SentinelCard> = () => {
|
|
|
130
130
|
return (
|
|
131
131
|
<FlexCol gap={2}>
|
|
132
132
|
<SentinelCard module={contractSentinel} inPayloads={inPayloads} />
|
|
133
|
-
{/*tokens ? <
|
|
133
|
+
{/*tokens ? <JsonViewerEx value={tokens} /> : null*/}
|
|
134
134
|
</FlexCol>
|
|
135
135
|
)
|
|
136
136
|
}
|
|
@@ -2,9 +2,9 @@ import { CardContentProps } from '@mui/material'
|
|
|
2
2
|
import { FlexGrowRow } from '@xylabs/react-flexbox'
|
|
3
3
|
import { Payload } from '@xyo-network/payload-model'
|
|
4
4
|
import { ModuleCardContent, ModuleRenderProps } from '@xyo-network/react-module'
|
|
5
|
+
import { JsonViewerEx } from '@xyo-network/react-payload-raw-info'
|
|
5
6
|
import { SentinelInstance } from '@xyo-network/sentinel-model'
|
|
6
7
|
import React from 'react'
|
|
7
|
-
import JsonView from 'react-json-view'
|
|
8
8
|
|
|
9
9
|
export type SentinelCardContentProps = ModuleRenderProps<SentinelInstance> &
|
|
10
10
|
CardContentProps & {
|
|
@@ -16,7 +16,7 @@ export const SentinelCardContent: React.FC<SentinelCardContentProps> = ({ childr
|
|
|
16
16
|
<ModuleCardContent module={module} {...props}>
|
|
17
17
|
<FlexGrowRow flexWrap="wrap" justifyContent="start" gap={2}>
|
|
18
18
|
{report ?
|
|
19
|
-
<
|
|
19
|
+
<JsonViewerEx value={report} />
|
|
20
20
|
: null}
|
|
21
21
|
{children}
|
|
22
22
|
</FlexGrowRow>
|