@xyo-network/react-sentinel 2.64.9 → 2.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/contexts/use.d.cts +5 -28
- package/dist/browser/contexts/use.d.cts.map +1 -1
- package/dist/browser/contexts/use.d.mts +5 -28
- package/dist/browser/contexts/use.d.mts.map +1 -1
- package/dist/browser/contexts/use.d.ts +5 -28
- package/dist/browser/contexts/use.d.ts.map +1 -1
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/node/contexts/use.d.cts +5 -28
- package/dist/node/contexts/use.d.cts.map +1 -1
- package/dist/node/contexts/use.d.mts +5 -28
- package/dist/node/contexts/use.d.mts.map +1 -1
- package/dist/node/contexts/use.d.ts +5 -28
- package/dist/node/contexts/use.d.ts.map +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/package.json +15 -15
- package/src/contexts/Provider.tsx +1 -1
- package/dist/browser/contexts/Context.cjs +0 -28
- package/dist/browser/contexts/Context.cjs.map +0 -1
- package/dist/browser/contexts/Context.js +0 -7
- package/dist/browser/contexts/Context.js.map +0 -1
- package/dist/browser/contexts/Provider.cjs +0 -124
- package/dist/browser/contexts/Provider.cjs.map +0 -1
- package/dist/browser/contexts/Provider.js +0 -103
- package/dist/browser/contexts/Provider.js.map +0 -1
- package/dist/browser/contexts/State.cjs +0 -34
- package/dist/browser/contexts/State.cjs.map +0 -1
- package/dist/browser/contexts/State.js +0 -13
- package/dist/browser/contexts/State.js.map +0 -1
- package/dist/browser/contexts/index.cjs +0 -146
- package/dist/browser/contexts/index.cjs.map +0 -1
- package/dist/browser/contexts/index.js +0 -123
- package/dist/browser/contexts/index.js.map +0 -1
- package/dist/browser/contexts/use.cjs +0 -37
- package/dist/browser/contexts/use.cjs.map +0 -1
- package/dist/browser/contexts/use.js +0 -16
- package/dist/browser/contexts/use.js.map +0 -1
- package/dist/browser/hooks/index.cjs +0 -64
- package/dist/browser/hooks/index.cjs.map +0 -1
- package/dist/browser/hooks/index.js +0 -41
- package/dist/browser/hooks/index.js.map +0 -1
- package/dist/browser/hooks/node/index.cjs +0 -64
- package/dist/browser/hooks/node/index.cjs.map +0 -1
- package/dist/browser/hooks/node/index.js +0 -41
- package/dist/browser/hooks/node/index.js.map +0 -1
- package/dist/browser/hooks/node/useSentinelFromNode.cjs +0 -38
- package/dist/browser/hooks/node/useSentinelFromNode.cjs.map +0 -1
- package/dist/browser/hooks/node/useSentinelFromNode.js +0 -17
- package/dist/browser/hooks/node/useSentinelFromNode.js.map +0 -1
- package/dist/browser/hooks/node/useSentinelsFromNode.cjs +0 -47
- package/dist/browser/hooks/node/useSentinelsFromNode.cjs.map +0 -1
- package/dist/browser/hooks/node/useSentinelsFromNode.js +0 -26
- package/dist/browser/hooks/node/useSentinelsFromNode.js.map +0 -1
- package/dist/docs.json +0 -2133
- package/dist/node/contexts/Context.cjs +0 -32
- package/dist/node/contexts/Context.cjs.map +0 -1
- package/dist/node/contexts/Context.js +0 -7
- package/dist/node/contexts/Context.js.map +0 -1
- package/dist/node/contexts/Provider.cjs +0 -129
- package/dist/node/contexts/Provider.cjs.map +0 -1
- package/dist/node/contexts/Provider.js +0 -104
- package/dist/node/contexts/Provider.js.map +0 -1
- package/dist/node/contexts/State.cjs +0 -38
- package/dist/node/contexts/State.cjs.map +0 -1
- package/dist/node/contexts/State.js +0 -13
- package/dist/node/contexts/State.js.map +0 -1
- package/dist/node/contexts/index.cjs +0 -154
- package/dist/node/contexts/index.cjs.map +0 -1
- package/dist/node/contexts/index.js +0 -124
- package/dist/node/contexts/index.js.map +0 -1
- package/dist/node/contexts/use.cjs +0 -41
- package/dist/node/contexts/use.cjs.map +0 -1
- package/dist/node/contexts/use.js +0 -16
- package/dist/node/contexts/use.js.map +0 -1
- package/dist/node/hooks/index.cjs +0 -70
- package/dist/node/hooks/index.cjs.map +0 -1
- package/dist/node/hooks/index.js +0 -42
- package/dist/node/hooks/index.js.map +0 -1
- package/dist/node/hooks/node/index.cjs +0 -70
- package/dist/node/hooks/node/index.cjs.map +0 -1
- package/dist/node/hooks/node/index.js +0 -42
- package/dist/node/hooks/node/index.js.map +0 -1
- package/dist/node/hooks/node/useSentinelFromNode.cjs +0 -43
- package/dist/node/hooks/node/useSentinelFromNode.cjs.map +0 -1
- package/dist/node/hooks/node/useSentinelFromNode.js +0 -18
- package/dist/node/hooks/node/useSentinelFromNode.js.map +0 -1
- package/dist/node/hooks/node/useSentinelsFromNode.cjs +0 -51
- package/dist/node/hooks/node/useSentinelsFromNode.cjs.map +0 -1
- package/dist/node/hooks/node/useSentinelsFromNode.js +0 -26
- package/dist/node/hooks/node/useSentinelsFromNode.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare const useSentinelContext: () => {
|
|
2
|
-
history: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/
|
|
2
|
+
history: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/boundwitness-model").BoundWitnessFields & {
|
|
3
3
|
schema: "network.xyo.boundwitness";
|
|
4
4
|
})[] | undefined;
|
|
5
5
|
progress: import("./State").SentinelReportProgress | undefined;
|
|
6
6
|
reportingErrors: Error[] | undefined;
|
|
7
7
|
sentinel: import("@xyo-network/sentinel-model").SentinelModule<import("@xyo-network/core").BaseParamsFields & {
|
|
8
8
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
9
|
-
config: import("@xyo-network/payload-model").SchemaFields &
|
|
9
|
+
config: import("@xyo-network/payload-model").SchemaFields & Omit<{
|
|
10
10
|
accountDerivationPath?: string | undefined;
|
|
11
11
|
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
12
12
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
@@ -22,23 +22,7 @@ export declare const useSentinelContext: () => {
|
|
|
22
22
|
readonly sign?: boolean | undefined;
|
|
23
23
|
readonly storeQueries?: boolean | undefined;
|
|
24
24
|
readonly timestamp?: boolean | undefined;
|
|
25
|
-
} &
|
|
26
|
-
accountDerivationPath?: string | undefined;
|
|
27
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | 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 security?: {
|
|
34
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
35
|
-
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
36
|
-
readonly disallowed?: Record<string, string[]> | undefined;
|
|
37
|
-
} | undefined;
|
|
38
|
-
readonly sign?: boolean | undefined;
|
|
39
|
-
readonly storeQueries?: boolean | undefined;
|
|
40
|
-
readonly timestamp?: boolean | undefined;
|
|
41
|
-
} & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
|
|
25
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & Omit<import("@xyo-network/payload-model").SchemaFields & {
|
|
42
26
|
accountDerivationPath?: string | undefined;
|
|
43
27
|
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
44
28
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
@@ -54,16 +38,9 @@ export declare const useSentinelContext: () => {
|
|
|
54
38
|
readonly sign?: boolean | undefined;
|
|
55
39
|
readonly storeQueries?: boolean | undefined;
|
|
56
40
|
readonly timestamp?: boolean | undefined;
|
|
41
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & {
|
|
42
|
+
tasks: import("@xyo-network/sentinel-model").SentinelTask[];
|
|
57
43
|
} & {
|
|
58
|
-
archivists?: string[] | undefined;
|
|
59
|
-
schema: string;
|
|
60
|
-
} & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
61
|
-
schema: "network.xyo.module.config";
|
|
62
|
-
}, "schema"> & {
|
|
63
|
-
schema: "network.xyo.module.config";
|
|
64
|
-
} & {
|
|
65
|
-
witnesses?: string[] | undefined;
|
|
66
|
-
}, "schema"> & {
|
|
67
44
|
schema: "network.xyo.sentinel.config";
|
|
68
45
|
}, "schema"> & {
|
|
69
46
|
schema: string;
|
|
@@ -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"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare const useSentinelContext: () => {
|
|
2
|
-
history: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/
|
|
2
|
+
history: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/boundwitness-model").BoundWitnessFields & {
|
|
3
3
|
schema: "network.xyo.boundwitness";
|
|
4
4
|
})[] | undefined;
|
|
5
5
|
progress: import("./State").SentinelReportProgress | undefined;
|
|
6
6
|
reportingErrors: Error[] | undefined;
|
|
7
7
|
sentinel: import("@xyo-network/sentinel-model").SentinelModule<import("@xyo-network/core").BaseParamsFields & {
|
|
8
8
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
9
|
-
config: import("@xyo-network/payload-model").SchemaFields &
|
|
9
|
+
config: import("@xyo-network/payload-model").SchemaFields & Omit<{
|
|
10
10
|
accountDerivationPath?: string | undefined;
|
|
11
11
|
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
12
12
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
@@ -22,23 +22,7 @@ export declare const useSentinelContext: () => {
|
|
|
22
22
|
readonly sign?: boolean | undefined;
|
|
23
23
|
readonly storeQueries?: boolean | undefined;
|
|
24
24
|
readonly timestamp?: boolean | undefined;
|
|
25
|
-
} &
|
|
26
|
-
accountDerivationPath?: string | undefined;
|
|
27
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | 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 security?: {
|
|
34
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
35
|
-
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
36
|
-
readonly disallowed?: Record<string, string[]> | undefined;
|
|
37
|
-
} | undefined;
|
|
38
|
-
readonly sign?: boolean | undefined;
|
|
39
|
-
readonly storeQueries?: boolean | undefined;
|
|
40
|
-
readonly timestamp?: boolean | undefined;
|
|
41
|
-
} & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
|
|
25
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & Omit<import("@xyo-network/payload-model").SchemaFields & {
|
|
42
26
|
accountDerivationPath?: string | undefined;
|
|
43
27
|
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
44
28
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
@@ -54,16 +38,9 @@ export declare const useSentinelContext: () => {
|
|
|
54
38
|
readonly sign?: boolean | undefined;
|
|
55
39
|
readonly storeQueries?: boolean | undefined;
|
|
56
40
|
readonly timestamp?: boolean | undefined;
|
|
41
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & {
|
|
42
|
+
tasks: import("@xyo-network/sentinel-model").SentinelTask[];
|
|
57
43
|
} & {
|
|
58
|
-
archivists?: string[] | undefined;
|
|
59
|
-
schema: string;
|
|
60
|
-
} & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
61
|
-
schema: "network.xyo.module.config";
|
|
62
|
-
}, "schema"> & {
|
|
63
|
-
schema: "network.xyo.module.config";
|
|
64
|
-
} & {
|
|
65
|
-
witnesses?: string[] | undefined;
|
|
66
|
-
}, "schema"> & {
|
|
67
44
|
schema: "network.xyo.sentinel.config";
|
|
68
45
|
}, "schema"> & {
|
|
69
46
|
schema: string;
|
|
@@ -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"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare const useSentinelContext: () => {
|
|
2
|
-
history: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/
|
|
2
|
+
history: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/boundwitness-model").BoundWitnessFields & {
|
|
3
3
|
schema: "network.xyo.boundwitness";
|
|
4
4
|
})[] | undefined;
|
|
5
5
|
progress: import("./State").SentinelReportProgress | undefined;
|
|
6
6
|
reportingErrors: Error[] | undefined;
|
|
7
7
|
sentinel: import("@xyo-network/sentinel-model").SentinelModule<import("@xyo-network/core").BaseParamsFields & {
|
|
8
8
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
9
|
-
config: import("@xyo-network/payload-model").SchemaFields &
|
|
9
|
+
config: import("@xyo-network/payload-model").SchemaFields & Omit<{
|
|
10
10
|
accountDerivationPath?: string | undefined;
|
|
11
11
|
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
12
12
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
@@ -22,23 +22,7 @@ export declare const useSentinelContext: () => {
|
|
|
22
22
|
readonly sign?: boolean | undefined;
|
|
23
23
|
readonly storeQueries?: boolean | undefined;
|
|
24
24
|
readonly timestamp?: boolean | undefined;
|
|
25
|
-
} &
|
|
26
|
-
accountDerivationPath?: string | undefined;
|
|
27
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | 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 security?: {
|
|
34
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
35
|
-
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
36
|
-
readonly disallowed?: Record<string, string[]> | undefined;
|
|
37
|
-
} | undefined;
|
|
38
|
-
readonly sign?: boolean | undefined;
|
|
39
|
-
readonly storeQueries?: boolean | undefined;
|
|
40
|
-
readonly timestamp?: boolean | undefined;
|
|
41
|
-
} & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
|
|
25
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & Omit<import("@xyo-network/payload-model").SchemaFields & {
|
|
42
26
|
accountDerivationPath?: string | undefined;
|
|
43
27
|
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
44
28
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
@@ -54,16 +38,9 @@ export declare const useSentinelContext: () => {
|
|
|
54
38
|
readonly sign?: boolean | undefined;
|
|
55
39
|
readonly storeQueries?: boolean | undefined;
|
|
56
40
|
readonly timestamp?: boolean | undefined;
|
|
41
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & {
|
|
42
|
+
tasks: import("@xyo-network/sentinel-model").SentinelTask[];
|
|
57
43
|
} & {
|
|
58
|
-
archivists?: string[] | undefined;
|
|
59
|
-
schema: string;
|
|
60
|
-
} & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
61
|
-
schema: "network.xyo.module.config";
|
|
62
|
-
}, "schema"> & {
|
|
63
|
-
schema: "network.xyo.module.config";
|
|
64
|
-
} & {
|
|
65
|
-
witnesses?: string[] | undefined;
|
|
66
|
-
}, "schema"> & {
|
|
67
44
|
schema: "network.xyo.sentinel.config";
|
|
68
45
|
}, "schema"> & {
|
|
69
46
|
schema: string;
|
|
@@ -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
|
@@ -67,7 +67,7 @@ var SentinelProvider = ({ account, archivist, children, filter, name, required =
|
|
|
67
67
|
archivists: archivist ? [archivist] : void 0,
|
|
68
68
|
name,
|
|
69
69
|
schema: import_sentinel.SentinelConfigSchema,
|
|
70
|
-
|
|
70
|
+
tasks: witnesses?.map((module2) => ({ module: module2.address }))
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
const offCallbacks = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/State.ts","../../src/contexts/use.ts","../../src/hooks/node/useSentinelFromNode.tsx","../../src/hooks/node/useSentinelsFromNode.tsx"],"sourcesContent":["export * from './contexts'\nexport * from './hooks'\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n witnesses: witnesses?.map((module) => module.address),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([Error(`Witness failed [${module?.config?.name ?? module.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n witnesses?.forEach((witness) => {\n offCallbacks.push(\n witness.on('observeEnd', ({ module, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n })\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n offCallbacks.forEach((callback) => {\n callback()\n })\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ? (\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n ) : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","import { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n if (modules) {\n return [\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n } else {\n return [modules, error]\n }\n}\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,MACT,GAAG,CAAC,CAAC;AAAA,MACL;AAAA,IACF;AAAA,EACF,OAAO;AACL,WAAO,CAAC,SAAS,KAAK;AAAA,EACxB;AACF;","names":["SentinelReportStatus","sentinel","module","witnesses","import_react_shared","import_sentinel","module","error","import_react_node","import_sentinel","module"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/State.ts","../../src/contexts/use.ts","../../src/hooks/node/useSentinelFromNode.tsx","../../src/hooks/node/useSentinelsFromNode.tsx"],"sourcesContent":["export * from './contexts'\nexport * from './hooks'\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([Error(`Witness failed [${module?.config?.name ?? module.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n witnesses?.forEach((witness) => {\n offCallbacks.push(\n witness.on('observeEnd', ({ module, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n })\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n offCallbacks.forEach((callback) => {\n callback()\n })\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ? (\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n ) : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","import { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n if (modules) {\n return [\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n } else {\n return [modules, error]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,0BAAgC;AAIzB,IAAM,sBAAkB,qCAAsC;;;ACJrE,gCAA+B;AAK/B,2BAAqC;AACrC,sBAAqE;AAErE,mBAAoC;;;ACH7B,IAAK,uBAAL,kBAAKA,0BAAL;AACL,EAAAA,sBAAA,UAAO;AACP,EAAAA,sBAAA,YAAS;AACT,EAAAA,sBAAA,aAAU;AACV,EAAAA,sBAAA,eAAY;AACZ,EAAAA,sBAAA,YAAS;AALC,SAAAA;AAAA,GAAA;;;AD+GR;AA3FG,IAAM,mBAAkE,CAAC,EAAE,SAAS,WAAW,UAAU,QAAQ,MAAM,WAAW,MAAM,MAAM;AACnJ,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAyB;AACzD,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAyB;AACvD,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAiC,CAAC,CAAC;AACnE,QAAM,CAAC,QAAQ,SAAS,QAAI,wCAAkC;AAC9D,QAAM,CAAC,iBAAiB,kBAAkB,QAAI,uBAAkB;AAChE,QAAM,CAAC,SAAS,QAAI,2CAAqB,MAAM;AAE/C;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,YAAMC,YAAW,MAAM,+BAAe,OAAO;AAAA,QAC3C;AAAA,QACA,QAAQ;AAAA,UACN,YAAY,YAAY,CAAC,SAAS,IAAI;AAAA,UACtC;AAAA,UAE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,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,MAAI,SAAS;AACX,WAAO;AAAA,MACL,QAAQ,OAA2B,CAAC,MAAMC,YAAW;AACnD,gBAAI,qCAAmBA,OAAM,GAAG;AAC9B,eAAK,KAAKA,OAAM;AAAA,QAClB;AACA,eAAO;AAAA,MACT,GAAG,CAAC,CAAC;AAAA,MACL;AAAA,IACF;AAAA,EACF,OAAO;AACL,WAAO,CAAC,SAAS,KAAK;AAAA,EACxB;AACF;","names":["SentinelReportStatus","sentinel","module","witnesses","import_react_shared","import_sentinel","module","error","import_react_node","import_sentinel","module"]}
|
package/dist/browser/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var SentinelProvider = ({ account, archivist, children, filter, name, required =
|
|
|
36
36
|
archivists: archivist ? [archivist] : void 0,
|
|
37
37
|
name,
|
|
38
38
|
schema: SentinelConfigSchema,
|
|
39
|
-
|
|
39
|
+
tasks: witnesses?.map((module) => ({ module: module.address }))
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
const offCallbacks = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../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 { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n witnesses: witnesses?.map((module) => module.address),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([Error(`Witness failed [${module?.config?.name ?? module.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n witnesses?.forEach((witness) => {\n offCallbacks.push(\n witness.on('observeEnd', ({ module, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n })\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n offCallbacks.forEach((callback) => {\n callback()\n })\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ? (\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n ) : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","import { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n if (modules) {\n return [\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n } else {\n return [modules, error]\n }\n}\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,kBAAkB,gBAAsC;;;ACJrE,SAAS,sBAAsB;AAK/B,SAAS,4BAA4B;AACrC,SAAS,gBAAgC,4BAA4B;AAErE,SAAS,WAAW,gBAAgB;;;ACH7B,IAAK,uBAAL,kBAAKA,0BAAL;AACL,EAAAA,sBAAA,UAAO;AACP,EAAAA,sBAAA,YAAS;AACT,EAAAA,sBAAA,aAAU;AACV,EAAAA,sBAAA,eAAY;AACZ,EAAAA,sBAAA,YAAS;AALC,SAAAA;AAAA,GAAA;;;AD+GR;AA3FG,IAAM,mBAAkE,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BAAyB;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,UAAME,SAAQ,MAAM,8CAA8C,OAAO,QAAQ,MAAM,IAAI,OAAO,QAAQ,IAAI,IAAI,OAAO,OAAO,GAAG;AACnI,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,MAAI,SAAS;AACX,WAAO;AAAA,MACL,QAAQ,OAA2B,CAAC,MAAM,WAAW;AACnD,YAAI,mBAAmB,MAAM,GAAG;AAC9B,eAAK,KAAK,MAAM;AAAA,QAClB;AACA,eAAO;AAAA,MACT,GAAG,CAAC,CAAC;AAAA,MACL;AAAA,IACF;AAAA,EACF,OAAO;AACL,WAAO,CAAC,SAAS,KAAK;AAAA,EACxB;AACF;","names":["SentinelReportStatus","sentinel","witnesses","error"]}
|
|
1
|
+
{"version":3,"sources":["../../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 { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([Error(`Witness failed [${module?.config?.name ?? module.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n witnesses?.forEach((witness) => {\n offCallbacks.push(\n witness.on('observeEnd', ({ module, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n })\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n offCallbacks.forEach((callback) => {\n callback()\n })\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ? (\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n ) : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","import { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n if (modules) {\n return [\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n } else {\n return [modules, error]\n }\n}\n"],"mappings":";AAAA,SAAS,uBAAuB;AAIzB,IAAM,kBAAkB,gBAAsC;;;ACJrE,SAAS,sBAAsB;AAK/B,SAAS,4BAA4B;AACrC,SAAS,gBAAgC,4BAA4B;AAErE,SAAS,WAAW,gBAAgB;;;ACH7B,IAAK,uBAAL,kBAAKA,0BAAL;AACL,EAAAA,sBAAA,UAAO;AACP,EAAAA,sBAAA,YAAS;AAC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AACtC,QAAM,EAAE,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,UAAME,SAAQ,MAAM,8CAA8C,OAAO,QAAQ,MAAM,IAAI,OAAO,QAAQ,IAAI,IAAI,OAAO,OAAO,GAAG;AACnI,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,MAAI,SAAS;AACX,WAAO;AAAA,MACL,QAAQ,OAA2B,CAAC,MAAM,WAAW;AACnD,YAAI,mBAAmB,MAAM,GAAG;AAC9B,eAAK,KAAK,MAAM;AAAA,QAClB;AACA,eAAO;AAAA,MACT,GAAG,CAAC,CAAC;AAAA,MACL;AAAA,IACF;AAAA,EACF,OAAO;AACL,WAAO,CAAC,SAAS,KAAK;AAAA,EACxB;AACF;","names":["SentinelReportStatus","sentinel","witnesses","error"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare const useSentinelContext: () => {
|
|
2
|
-
history: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/
|
|
2
|
+
history: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/boundwitness-model").BoundWitnessFields & {
|
|
3
3
|
schema: "network.xyo.boundwitness";
|
|
4
4
|
})[] | undefined;
|
|
5
5
|
progress: import("./State").SentinelReportProgress | undefined;
|
|
6
6
|
reportingErrors: Error[] | undefined;
|
|
7
7
|
sentinel: import("@xyo-network/sentinel-model").SentinelModule<import("@xyo-network/core").BaseParamsFields & {
|
|
8
8
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
9
|
-
config: import("@xyo-network/payload-model").SchemaFields &
|
|
9
|
+
config: import("@xyo-network/payload-model").SchemaFields & Omit<{
|
|
10
10
|
accountDerivationPath?: string | undefined;
|
|
11
11
|
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
12
12
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
@@ -22,23 +22,7 @@ export declare const useSentinelContext: () => {
|
|
|
22
22
|
readonly sign?: boolean | undefined;
|
|
23
23
|
readonly storeQueries?: boolean | undefined;
|
|
24
24
|
readonly timestamp?: boolean | undefined;
|
|
25
|
-
} &
|
|
26
|
-
accountDerivationPath?: string | undefined;
|
|
27
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | 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 security?: {
|
|
34
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
35
|
-
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
36
|
-
readonly disallowed?: Record<string, string[]> | undefined;
|
|
37
|
-
} | undefined;
|
|
38
|
-
readonly sign?: boolean | undefined;
|
|
39
|
-
readonly storeQueries?: boolean | undefined;
|
|
40
|
-
readonly timestamp?: boolean | undefined;
|
|
41
|
-
} & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
|
|
25
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & Omit<import("@xyo-network/payload-model").SchemaFields & {
|
|
42
26
|
accountDerivationPath?: string | undefined;
|
|
43
27
|
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
44
28
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
@@ -54,16 +38,9 @@ export declare const useSentinelContext: () => {
|
|
|
54
38
|
readonly sign?: boolean | undefined;
|
|
55
39
|
readonly storeQueries?: boolean | undefined;
|
|
56
40
|
readonly timestamp?: boolean | undefined;
|
|
41
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & {
|
|
42
|
+
tasks: import("@xyo-network/sentinel-model").SentinelTask[];
|
|
57
43
|
} & {
|
|
58
|
-
archivists?: string[] | undefined;
|
|
59
|
-
schema: string;
|
|
60
|
-
} & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
61
|
-
schema: "network.xyo.module.config";
|
|
62
|
-
}, "schema"> & {
|
|
63
|
-
schema: "network.xyo.module.config";
|
|
64
|
-
} & {
|
|
65
|
-
witnesses?: string[] | undefined;
|
|
66
|
-
}, "schema"> & {
|
|
67
44
|
schema: "network.xyo.sentinel.config";
|
|
68
45
|
}, "schema"> & {
|
|
69
46
|
schema: string;
|
|
@@ -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"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare const useSentinelContext: () => {
|
|
2
|
-
history: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/
|
|
2
|
+
history: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/boundwitness-model").BoundWitnessFields & {
|
|
3
3
|
schema: "network.xyo.boundwitness";
|
|
4
4
|
})[] | undefined;
|
|
5
5
|
progress: import("./State").SentinelReportProgress | undefined;
|
|
6
6
|
reportingErrors: Error[] | undefined;
|
|
7
7
|
sentinel: import("@xyo-network/sentinel-model").SentinelModule<import("@xyo-network/core").BaseParamsFields & {
|
|
8
8
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
9
|
-
config: import("@xyo-network/payload-model").SchemaFields &
|
|
9
|
+
config: import("@xyo-network/payload-model").SchemaFields & Omit<{
|
|
10
10
|
accountDerivationPath?: string | undefined;
|
|
11
11
|
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
12
12
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
@@ -22,23 +22,7 @@ export declare const useSentinelContext: () => {
|
|
|
22
22
|
readonly sign?: boolean | undefined;
|
|
23
23
|
readonly storeQueries?: boolean | undefined;
|
|
24
24
|
readonly timestamp?: boolean | undefined;
|
|
25
|
-
} &
|
|
26
|
-
accountDerivationPath?: string | undefined;
|
|
27
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | 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 security?: {
|
|
34
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
35
|
-
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
36
|
-
readonly disallowed?: Record<string, string[]> | undefined;
|
|
37
|
-
} | undefined;
|
|
38
|
-
readonly sign?: boolean | undefined;
|
|
39
|
-
readonly storeQueries?: boolean | undefined;
|
|
40
|
-
readonly timestamp?: boolean | undefined;
|
|
41
|
-
} & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
|
|
25
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & Omit<import("@xyo-network/payload-model").SchemaFields & {
|
|
42
26
|
accountDerivationPath?: string | undefined;
|
|
43
27
|
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
44
28
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
@@ -54,16 +38,9 @@ export declare const useSentinelContext: () => {
|
|
|
54
38
|
readonly sign?: boolean | undefined;
|
|
55
39
|
readonly storeQueries?: boolean | undefined;
|
|
56
40
|
readonly timestamp?: boolean | undefined;
|
|
41
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & {
|
|
42
|
+
tasks: import("@xyo-network/sentinel-model").SentinelTask[];
|
|
57
43
|
} & {
|
|
58
|
-
archivists?: string[] | undefined;
|
|
59
|
-
schema: string;
|
|
60
|
-
} & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
61
|
-
schema: "network.xyo.module.config";
|
|
62
|
-
}, "schema"> & {
|
|
63
|
-
schema: "network.xyo.module.config";
|
|
64
|
-
} & {
|
|
65
|
-
witnesses?: string[] | undefined;
|
|
66
|
-
}, "schema"> & {
|
|
67
44
|
schema: "network.xyo.sentinel.config";
|
|
68
45
|
}, "schema"> & {
|
|
69
46
|
schema: string;
|
|
@@ -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"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare const useSentinelContext: () => {
|
|
2
|
-
history: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/
|
|
2
|
+
history: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/boundwitness-model").BoundWitnessFields & {
|
|
3
3
|
schema: "network.xyo.boundwitness";
|
|
4
4
|
})[] | undefined;
|
|
5
5
|
progress: import("./State").SentinelReportProgress | undefined;
|
|
6
6
|
reportingErrors: Error[] | undefined;
|
|
7
7
|
sentinel: import("@xyo-network/sentinel-model").SentinelModule<import("@xyo-network/core").BaseParamsFields & {
|
|
8
8
|
account?: import("@xyo-network/account-model").AccountInstance | "random" | undefined;
|
|
9
|
-
config: import("@xyo-network/payload-model").SchemaFields &
|
|
9
|
+
config: import("@xyo-network/payload-model").SchemaFields & Omit<{
|
|
10
10
|
accountDerivationPath?: string | undefined;
|
|
11
11
|
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
12
12
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
@@ -22,23 +22,7 @@ export declare const useSentinelContext: () => {
|
|
|
22
22
|
readonly sign?: boolean | undefined;
|
|
23
23
|
readonly storeQueries?: boolean | undefined;
|
|
24
24
|
readonly timestamp?: boolean | undefined;
|
|
25
|
-
} &
|
|
26
|
-
accountDerivationPath?: string | undefined;
|
|
27
|
-
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | 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 security?: {
|
|
34
|
-
readonly allowAnonymous?: boolean | undefined;
|
|
35
|
-
readonly allowed?: Record<string, (string | import("@xyo-network/module-model").CosigningAddressSet)[]> | undefined;
|
|
36
|
-
readonly disallowed?: Record<string, string[]> | undefined;
|
|
37
|
-
} | undefined;
|
|
38
|
-
readonly sign?: boolean | undefined;
|
|
39
|
-
readonly storeQueries?: boolean | undefined;
|
|
40
|
-
readonly timestamp?: boolean | undefined;
|
|
41
|
-
} & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<{
|
|
25
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & Omit<import("@xyo-network/payload-model").SchemaFields & {
|
|
42
26
|
accountDerivationPath?: string | undefined;
|
|
43
27
|
readonly archivist?: import("@xyo-network/module-model").ArchivistModuleConfig | undefined;
|
|
44
28
|
readonly labels?: import("@xyo-network/module-model").Labels | undefined;
|
|
@@ -54,16 +38,9 @@ export declare const useSentinelContext: () => {
|
|
|
54
38
|
readonly sign?: boolean | undefined;
|
|
55
39
|
readonly storeQueries?: boolean | undefined;
|
|
56
40
|
readonly timestamp?: boolean | undefined;
|
|
41
|
+
} & import("@xyo-network/module-model").ArchivingModuleConfig & {
|
|
42
|
+
tasks: import("@xyo-network/sentinel-model").SentinelTask[];
|
|
57
43
|
} & {
|
|
58
|
-
archivists?: string[] | undefined;
|
|
59
|
-
schema: string;
|
|
60
|
-
} & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & {
|
|
61
|
-
schema: "network.xyo.module.config";
|
|
62
|
-
}, "schema"> & {
|
|
63
|
-
schema: "network.xyo.module.config";
|
|
64
|
-
} & {
|
|
65
|
-
witnesses?: string[] | undefined;
|
|
66
|
-
}, "schema"> & {
|
|
67
44
|
schema: "network.xyo.sentinel.config";
|
|
68
45
|
}, "schema"> & {
|
|
69
46
|
schema: string;
|
|
@@ -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
|
@@ -67,7 +67,7 @@ var SentinelProvider = ({ account, archivist, children, filter, name, required =
|
|
|
67
67
|
archivists: archivist ? [archivist] : void 0,
|
|
68
68
|
name,
|
|
69
69
|
schema: import_sentinel.SentinelConfigSchema,
|
|
70
|
-
|
|
70
|
+
tasks: witnesses == null ? void 0 : witnesses.map((module2) => ({ module: module2.address }))
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
const offCallbacks = [];
|
package/dist/node/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/State.ts","../../src/contexts/use.ts","../../src/hooks/node/useSentinelFromNode.tsx","../../src/hooks/node/useSentinelsFromNode.tsx"],"sourcesContent":["export * from './contexts'\nexport * from './hooks'\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n witnesses: witnesses?.map((module) => module.address),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([Error(`Witness failed [${module?.config?.name ?? module.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n witnesses?.forEach((witness) => {\n offCallbacks.push(\n witness.on('observeEnd', ({ module, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n })\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n offCallbacks.forEach((callback) => {\n callback()\n })\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ? (\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n ) : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","import { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n if (modules) {\n return [\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n } else {\n return [modules, error]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,0BAAgC;AAIzB,IAAM,sBAAkB,qCAAsC;;;ACJrE,gCAA+B;AAK/B,2BAAqC;AACrC,sBAAqE;AAErE,mBAAoC;;;ACH7B,IAAK,uBAAL,kBAAKA,0BAAL;AACL,EAAAA,sBAAA,UAAO;AACP,EAAAA,sBAAA,YAAS;AACT,EAAAA,sBAAA,aAAU;AACV,EAAAA,sBAAA,eAAY;AACZ,EAAAA,sBAAA,YAAS;AALC,SAAAA;AAAA,GAAA;;;AD+GR;AA3FG,IAAM,mBAAkE,CAAC,EAAE,SAAS,WAAW,UAAU,QAAQ,MAAM,WAAW,MAAM,MAAM;AACnJ,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAyB;AACzD,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAyB;AACvD,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAiC,CAAC,CAAC;AACnE,QAAM,CAAC,QAAQ,SAAS,QAAI,wCAAkC;AAC9D,Q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B,UAAMC,SAAQ,MAAM,+CAA8C,KAAAD,QAAO,WAAP,mBAAe,MAAM,KAAI,KAAAA,QAAO,WAAP,mBAAe,IAAI,IAAIA,QAAO,OAAO,GAAG;AACnI,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,MAAI,SAAS;AACX,WAAO;AAAA,MACL,QAAQ,OAA2B,CAAC,MAAMC,YAAW;AACnD,gBAAI,qCAAmBA,OAAM,GAAG;AAC9B,eAAK,KAAKA,OAAM;AAAA,QAClB;AACA,eAAO;AAAA,MACT,GAAG,CAAC,CAAC;AAAA,MACL;AAAA,IACF;AAAA,EACF,OAAO;AACL,WAAO,CAAC,SAAS,KAAK;AAAA,EACxB;AACF;","names":["SentinelReportStatus","sentinel","module","witnesses","import_react_shared","import_sentinel","module","error","import_react_node","import_sentinel","module"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/State.ts","../../src/contexts/use.ts","../../src/hooks/node/useSentinelFromNode.tsx","../../src/hooks/node/useSentinelsFromNode.tsx"],"sourcesContent":["export * from './contexts'\nexport * from './hooks'\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContextState } from './State'\n\nexport const SentinelContext = createContextEx<SentinelContextState>()\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { AccountInstance } from '@xyo-network/account-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { ModuleFilter } from '@xyo-network/module'\nimport { useWitnessesFromNode } from '@xyo-network/react-witness'\nimport { MemorySentinel, SentinelConfig, SentinelConfigSchema } from '@xyo-network/sentinel'\nimport { WitnessInstance } from '@xyo-network/witness'\nimport { useEffect, useState } from 'react'\n\nimport { SentinelContext } from './Context'\nimport { SentinelReportProgress, SentinelReportStatus } from './State'\n\nexport interface SentinelProviderProps {\n /** Account used by the sentinel for signing */\n account: AccountInstance\n /** @deprecated - sentinel no longer uses archive but relies on an archivist */\n archive?: string\n archivist?: string\n filter?: ModuleFilter\n name?: string\n required?: boolean\n witnesses?: WitnessInstance[]\n}\n\nexport const SentinelProvider: React.FC<WithChildren<SentinelProviderProps>> = ({ account, archivist, children, filter, name, required = false }) => {\n const [sentinel, setSentinel] = useState<MemorySentinel>()\n const [history, setHistory] = useState<BoundWitness[]>()\n const [progress, setProgress] = useState<SentinelReportProgress>({})\n const [status, setStatus] = useState(SentinelReportStatus.Idle)\n const [reportingErrors, setReportingErrors] = useState<Error[]>()\n const [witnesses] = useWitnessesFromNode(filter)\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n const sentinel = await MemorySentinel.create({\n account,\n config: {\n archivists: archivist ? [archivist] : undefined,\n name,\n\n schema: SentinelConfigSchema,\n tasks: witnesses?.map((module) => ({ module: module.address })),\n } as SentinelConfig,\n })\n const offCallbacks: (() => void)[] = []\n offCallbacks.push(\n sentinel.on('reportEnd', ({ module, outPayloads }) => {\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses: progress.witnesses,\n })\n setStatus(outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed)\n setReportingErrors([Error(`Witness failed [${module?.config?.name ?? module.address}]`)])\n }\n }),\n )\n offCallbacks.push(\n sentinel.on('reportStart', () => {\n if (mounted()) {\n setProgress({ archivists: {}, witnesses: {} })\n setStatus(SentinelReportStatus.Started)\n }\n }),\n )\n witnesses?.forEach((witness) => {\n offCallbacks.push(\n witness.on('observeEnd', ({ module, outPayloads }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: outPayloads?.length ? SentinelReportStatus.Succeeded : SentinelReportStatus.Failed,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n offCallbacks.push(\n witness.on('observeStart', ({ module }) => {\n const witnesses = progress.witnesses ?? {}\n witnesses[witness.address] = {\n status: SentinelReportStatus.Started,\n witness: module,\n }\n if (mounted()) {\n setProgress({\n archivists: progress.archivists,\n witnesses,\n })\n }\n }),\n )\n })\n setSentinel(sentinel as MemorySentinel)\n return () => {\n //unsubscribe from events\n offCallbacks.forEach((callback) => {\n callback()\n })\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [account, archivist, witnesses],\n )\n\n useEffect(() => {\n setHistory(sentinel?.history as BoundWitness[])\n }, [sentinel])\n\n return !required || sentinel ? (\n <SentinelContext.Provider value={{ history, progress, provided: true, reportingErrors, sentinel, status }}>{children}</SentinelContext.Provider>\n ) : null\n}\n","import { ArchivistModule } from '@xyo-network/archivist'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { SentinelModule } from '@xyo-network/sentinel'\nimport { WitnessModule } from '@xyo-network/witness'\n\nexport enum SentinelReportStatus {\n Idle = 'idle',\n Queued = 'queued',\n Started = 'started',\n Succeeded = 'succeeded',\n Failed = 'failed',\n}\n\nexport interface SentinelWitnessReportProgress {\n status: SentinelReportStatus\n witness: WitnessModule\n}\n\nexport interface SentinelArchivistApiReportProgress {\n archivist: ArchivistModule\n status: SentinelReportStatus\n}\n\nexport interface SentinelReportProgress {\n archivists?: Record<string, SentinelArchivistApiReportProgress>\n witnesses?: Record<string, SentinelWitnessReportProgress>\n}\n\nexport interface SentinelContextState {\n history?: BoundWitness[]\n progress?: SentinelReportProgress\n reportingErrors?: Error[]\n sentinel?: SentinelModule\n status?: SentinelReportStatus\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SentinelContext } from './Context'\n\nexport const useSentinelContext = () => {\n const { sentinel, history, progress, reportingErrors, status } = useContextEx(SentinelContext, 'Sentinel')\n return { history, progress, reportingErrors, sentinel, status }\n}\n","import { ModuleFromNodeConfig, useModuleFromNode } from '@xyo-network/react-node'\nimport { asSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelFromNode = (\n nameOrAddressOrInstance?: string | SentinelInstance,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance | undefined, Error | undefined] => {\n const [module, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asSentinelInstance(module)\n if (module && !instance) {\n const error = Error(`Resolved module is not a SentinelInstance [${module.config?.schema}:${module.config?.name}:${module.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import { ModuleFilter } from '@xyo-network/module-model'\nimport { ModuleFromNodeConfig, useModulesFromNode } from '@xyo-network/react-node'\nimport { isSentinelInstance, SentinelInstance } from '@xyo-network/sentinel'\n\nexport const useSentinelsFromNode = (\n filter?: ModuleFilter,\n config?: ModuleFromNodeConfig,\n): [SentinelInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(filter, config)\n if (error) {\n return [null, error]\n }\n if (modules) {\n return [\n modules.reduce<SentinelInstance[]>((prev, module) => {\n if (isSentinelInstance(module)) {\n prev.push(module)\n }\n return prev\n }, []),\n undefined,\n ]\n } else {\n return [modules, error]\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,0BAAgC;AAIzB,IAAM,sBAAkB,qCAAsC;;;ACJrE,gCAA+B;AAK/B,2BAAqC;AACrC,sBAAqE;AAErE,mBAAoC;;;ACH7B,IAAK,uBAAL,kBAAKA,0BAAL;AACL,EAAAA,sBAAA,UAAO;AACP,EAAAA,sBAAA,YAAS;AACT,EAAAA,sBAAA,aAAU;AACV,EAAAA,sBAAA,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IAAM,qBAAqB,MAAM;AACtC,QAAM,EAAE,UAAU,SAAS,UAAU,iBAAiB,OAAO,QAAI,mCAAa,iBAAiB,UAAU;AACzG,SAAO,EAAE,SAAS,UAAU,iBAAiB,UAAU,OAAO;AAChE;;;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,MAAM,+CAA8C,KAAAD,QAAO,WAAP,mBAAe,MAAM,KAAI,KAAAA,QAAO,WAAP,mBAAe,IAAI,IAAIA,QAAO,OAAO,GAAG;AACnI,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,MAAI,SAAS;AACX,WAAO;AAAA,MACL,QAAQ,OAA2B,CAAC,MAAMC,YAAW;AACnD,gBAAI,qCAAmBA,OAAM,GAAG;AAC9B,eAAK,KAAKA,OAAM;AAAA,QAClB;AACA,eAAO;AAAA,MACT,GAAG,CAAC,CAAC;AAAA,MACL;AAAA,IACF;AAAA,EACF,OAAO;AACL,WAAO,CAAC,SAAS,KAAK;AAAA,EACxB;AACF;","names":["SentinelReportStatus","sentinel","module","witnesses","import_react_shared","import_sentinel","module","error","import_react_node","import_sentinel","module"]}
|
package/dist/node/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var SentinelProvider = ({ account, archivist, children, filter, name, required =
|
|
|
36
36
|
archivists: archivist ? [archivist] : void 0,
|
|
37
37
|
name,
|
|
38
38
|
schema: SentinelConfigSchema,
|
|
39
|
-
|
|
39
|
+
tasks: witnesses == null ? void 0 : witnesses.map((module) => ({ module: module.address }))
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
const offCallbacks = [];
|