@xyo-network/react-archivist 7.5.8 → 7.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/browser/index.mjs +212 -300
  2. package/dist/browser/index.mjs.map +1 -1
  3. package/package.json +150 -45
  4. package/src/components/Card/Card.stories.tsx +0 -82
  5. package/src/components/Card/Card.tsx +0 -22
  6. package/src/components/Card/CardActions.tsx +0 -9
  7. package/src/components/Card/CardContent.tsx +0 -42
  8. package/src/components/Card/CardHeader.tsx +0 -27
  9. package/src/components/Card/components/ArchivistParent.tsx +0 -26
  10. package/src/components/Card/components/ArchivistParents.tsx +0 -53
  11. package/src/components/Card/components/Stats/ArchivistStats.stories.tsx +0 -36
  12. package/src/components/Card/components/Stats/ArchivistStats.tsx +0 -60
  13. package/src/components/Card/components/Stats/MemoryArchivistStats.stories.tsx +0 -60
  14. package/src/components/Card/components/Stats/MemoryArchivistStats.tsx +0 -83
  15. package/src/components/Card/components/Stats/index.ts +0 -2
  16. package/src/components/Card/components/index.ts +0 -3
  17. package/src/components/Card/index.ts +0 -3
  18. package/src/components/Details/Details.stories.tsx +0 -74
  19. package/src/components/Details/Details.tsx +0 -74
  20. package/src/components/Details/index.ts +0 -1
  21. package/src/components/index.ts +0 -2
  22. package/src/hooks/index.ts +0 -2
  23. package/src/hooks/node/index.ts +0 -4
  24. package/src/hooks/node/useArchivistFromNode.tsx +0 -19
  25. package/src/hooks/node/useArchivistsFromNode.tsx +0 -28
  26. package/src/hooks/node/useWeakArchivistFromNode.tsx +0 -11
  27. package/src/hooks/node/useWeakArchivistsFromNode.tsx +0 -27
  28. package/src/hooks/queries/index.ts +0 -4
  29. package/src/hooks/queries/useArchivistAll.tsx +0 -22
  30. package/src/hooks/queries/useArchivistGet.tsx +0 -21
  31. package/src/hooks/queries/useWeakArchivistAll.tsx +0 -22
  32. package/src/hooks/queries/useWeakArchivistGet.tsx +0 -22
  33. package/src/index.ts +0 -2
@@ -1,10 +1,6 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
1
  // src/components/Card/Card.tsx
5
2
  import { Card } from "@mui/material";
6
3
  import { ModuleCardActions } from "@xyo-network/react-module";
7
- import React7 from "react";
8
4
 
9
5
  // src/components/Card/CardContent.tsx
10
6
  import { useAsyncEffect as useAsyncEffect2 } from "@xylabs/react-async-effect";
@@ -12,113 +8,95 @@ import { FlexGrowRow } from "@xylabs/react-flexbox";
12
8
  import { ModuleWrapper } from "@xyo-network/module-wrapper";
13
9
  import { ModuleCardContent } from "@xyo-network/react-module";
14
10
  import { useWallet } from "@xyo-network/react-wallet";
15
- import React5, { useState as useState3 } from "react";
11
+ import { useState as useState3 } from "react";
16
12
 
17
13
  // src/components/Card/components/ArchivistParent.tsx
18
14
  import { ListItem, Typography } from "@mui/material";
19
- import React from "react";
20
- var ArchivistParent = /* @__PURE__ */ __name(({ archivistType, parentArchivists }) => /* @__PURE__ */ React.createElement(React.Fragment, null, parentArchivists?.map((address) => {
21
- return /* @__PURE__ */ React.createElement(ListItem, {
22
- key: address
23
- }, /* @__PURE__ */ React.createElement(Typography, {
24
- variant: "subtitle2"
25
- }, archivistType, ":", " ", /* @__PURE__ */ React.createElement(Typography, {
26
- variant: "caption",
27
- sx: {
28
- ml: 0.5
29
- }
30
- }, address)));
31
- })), "ArchivistParent");
15
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
+ var ArchivistParent = ({ archivistType, parentArchivists }) => /* @__PURE__ */ jsx(Fragment, { children: parentArchivists?.map((address) => {
17
+ return /* @__PURE__ */ jsx(ListItem, { children: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", children: [
18
+ archivistType,
19
+ ":",
20
+ " ",
21
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", sx: { ml: 0.5 }, children: address })
22
+ ] }) }, address);
23
+ }) });
32
24
 
33
25
  // src/components/Card/components/ArchivistParents.tsx
34
26
  import { ArrowRightRounded as ArrowRightRoundedIcon } from "@mui/icons-material";
35
- import { Collapse, IconButton, List, Paper, Typography as Typography2 } from "@mui/material";
27
+ import {
28
+ Collapse,
29
+ IconButton,
30
+ List,
31
+ Paper,
32
+ Typography as Typography2
33
+ } from "@mui/material";
36
34
  import { FlexCol } from "@xylabs/react-flexbox";
37
- import React2, { useState } from "react";
38
- var ArchivistParents = /* @__PURE__ */ __name(({ config, ...props }) => {
35
+ import { useState } from "react";
36
+ import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
37
+ var ArchivistParents = ({ config, ...props }) => {
39
38
  const [parentArchivistCollapse, setParentArchivistCollapse] = useState(false);
40
- const { commit, read, write } = config?.parents ?? {};
41
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, commit || read || write ? /* @__PURE__ */ React2.createElement(FlexCol, {
42
- alignItems: "start",
43
- ...props
44
- }, /* @__PURE__ */ React2.createElement("span", {
45
- onClick: /* @__PURE__ */ __name(() => setParentArchivistCollapse(!parentArchivistCollapse), "onClick")
46
- }, /* @__PURE__ */ React2.createElement(Typography2, {
47
- variant: "subtitle2",
48
- sx: {
49
- cursor: "pointer",
50
- display: "inline-block"
51
- }
52
- }, "Parents"), /* @__PURE__ */ React2.createElement(IconButton, {
53
- size: "small"
54
- }, /* @__PURE__ */ React2.createElement(ArrowRightRoundedIcon, {
55
- sx: {
56
- rotate: parentArchivistCollapse ? "90deg" : "0deg",
57
- transition: "all .25s"
58
- }
59
- }))), /* @__PURE__ */ React2.createElement(Collapse, {
60
- in: parentArchivistCollapse
61
- }, /* @__PURE__ */ React2.createElement(Paper, {
62
- elevation: 2
63
- }, /* @__PURE__ */ React2.createElement(List, null, /* @__PURE__ */ React2.createElement(ArchivistParent, {
64
- archivistType: "Commit",
65
- parentArchivists: commit
66
- }), /* @__PURE__ */ React2.createElement(ArchivistParent, {
67
- archivistType: "Read",
68
- parentArchivists: read
69
- }), /* @__PURE__ */ React2.createElement(ArchivistParent, {
70
- archivistType: "Write",
71
- parentArchivists: write
72
- }))))) : null);
73
- }, "ArchivistParents");
39
+ const {
40
+ commit,
41
+ read,
42
+ write
43
+ } = config?.parents ?? {};
44
+ return /* @__PURE__ */ jsx2(Fragment2, { children: commit || read || write ? /* @__PURE__ */ jsxs2(FlexCol, { alignItems: "start", ...props, children: [
45
+ /* @__PURE__ */ jsxs2("span", { onClick: () => setParentArchivistCollapse(!parentArchivistCollapse), children: [
46
+ /* @__PURE__ */ jsx2(
47
+ Typography2,
48
+ {
49
+ variant: "subtitle2",
50
+ sx: { cursor: "pointer", display: "inline-block" },
51
+ children: "Parents"
52
+ }
53
+ ),
54
+ /* @__PURE__ */ jsx2(IconButton, { size: "small", children: /* @__PURE__ */ jsx2(ArrowRightRoundedIcon, { sx: { rotate: parentArchivistCollapse ? "90deg" : "0deg", transition: "all .25s" } }) })
55
+ ] }),
56
+ /* @__PURE__ */ jsx2(Collapse, { in: parentArchivistCollapse, children: /* @__PURE__ */ jsx2(Paper, { elevation: 2, children: /* @__PURE__ */ jsxs2(List, { children: [
57
+ /* @__PURE__ */ jsx2(ArchivistParent, { archivistType: "Commit", parentArchivists: commit }),
58
+ /* @__PURE__ */ jsx2(ArchivistParent, { archivistType: "Read", parentArchivists: read }),
59
+ /* @__PURE__ */ jsx2(ArchivistParent, { archivistType: "Write", parentArchivists: write })
60
+ ] }) }) })
61
+ ] }) : null });
62
+ };
74
63
 
75
64
  // src/components/Card/components/Stats/ArchivistStats.tsx
76
65
  import { Badge, Tooltip } from "@mui/material";
77
66
  import { FlexRow } from "@xylabs/react-flexbox";
78
- import React3 from "react";
79
67
  import { BsFileEarmarkCode } from "react-icons/bs";
80
- import { VscOrganization, VscSymbolMethod, VscSymbolNamespace } from "react-icons/vsc";
81
- var ArchivistStats = /* @__PURE__ */ __name(({ addresses, boundWitnesses, payloads, schemas }) => {
82
- return /* @__PURE__ */ React3.createElement(FlexRow, {
83
- gap: 2,
84
- mr: 0.5
85
- }, payloads?.length ? /* @__PURE__ */ React3.createElement(Tooltip, {
86
- title: "Payloads"
87
- }, /* @__PURE__ */ React3.createElement(Badge, {
88
- badgeContent: payloads?.length,
89
- color: "primary"
90
- }, /* @__PURE__ */ React3.createElement(VscSymbolNamespace, {
91
- size: 20
92
- }))) : null, boundWitnesses?.length ? /* @__PURE__ */ React3.createElement(Tooltip, {
93
- title: "Blocks"
94
- }, /* @__PURE__ */ React3.createElement(Badge, {
95
- badgeContent: boundWitnesses?.length,
96
- color: "primary"
97
- }, /* @__PURE__ */ React3.createElement(VscSymbolMethod, {
98
- size: 20
99
- }))) : null, Object.entries(schemas ?? {}).length > 0 ? /* @__PURE__ */ React3.createElement(Tooltip, {
100
- title: "Schemas"
101
- }, /* @__PURE__ */ React3.createElement(Badge, {
102
- badgeContent: Object.entries(schemas ?? {}).length,
103
- color: "primary"
104
- }, /* @__PURE__ */ React3.createElement(BsFileEarmarkCode, {
105
- size: 20
106
- }))) : null, Object.entries(addresses ?? {}).length > 0 ? /* @__PURE__ */ React3.createElement(Tooltip, {
107
- title: "Addresses"
108
- }, /* @__PURE__ */ React3.createElement(Badge, {
109
- badgeContent: Object.entries(addresses ?? {}).length,
110
- color: "primary"
111
- }, /* @__PURE__ */ React3.createElement(VscOrganization, {
112
- size: 20
113
- }))) : null);
114
- }, "ArchivistStats");
68
+ import {
69
+ VscOrganization,
70
+ VscSymbolMethod,
71
+ VscSymbolNamespace
72
+ } from "react-icons/vsc";
73
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
74
+ var ArchivistStats = ({
75
+ addresses,
76
+ boundWitnesses,
77
+ payloads,
78
+ schemas
79
+ }) => {
80
+ return /* @__PURE__ */ jsxs3(FlexRow, { gap: 2, mr: 0.5, children: [
81
+ payloads?.length ? /* @__PURE__ */ jsx3(Tooltip, { title: "Payloads", children: /* @__PURE__ */ jsx3(Badge, { badgeContent: payloads?.length, color: "primary", children: /* @__PURE__ */ jsx3(VscSymbolNamespace, { size: 20 }) }) }) : null,
82
+ boundWitnesses?.length ? /* @__PURE__ */ jsx3(Tooltip, { title: "Blocks", children: /* @__PURE__ */ jsx3(Badge, { badgeContent: boundWitnesses?.length, color: "primary", children: /* @__PURE__ */ jsx3(VscSymbolMethod, { size: 20 }) }) }) : null,
83
+ Object.entries(schemas ?? {}).length > 0 ? /* @__PURE__ */ jsx3(Tooltip, { title: "Schemas", children: /* @__PURE__ */ jsx3(Badge, { badgeContent: Object.entries(schemas ?? {}).length, color: "primary", children: /* @__PURE__ */ jsx3(BsFileEarmarkCode, { size: 20 }) }) }) : null,
84
+ Object.entries(addresses ?? {}).length > 0 ? /* @__PURE__ */ jsx3(Tooltip, { title: "Addresses", children: /* @__PURE__ */ jsx3(Badge, { badgeContent: Object.entries(addresses ?? {}).length, color: "primary", children: /* @__PURE__ */ jsx3(VscOrganization, { size: 20 }) }) }) : null
85
+ ] });
86
+ };
115
87
 
116
88
  // src/components/Card/components/Stats/MemoryArchivistStats.tsx
117
89
  import { useAsyncEffect } from "@xylabs/react-async-effect";
118
90
  import { ArchivistAllQuerySchema } from "@xyo-network/archivist-model";
119
91
  import { asBoundWitness, BoundWitnessSchema } from "@xyo-network/boundwitness-model";
120
- import React4, { useCallback, useEffect, useMemo, useState as useState2 } from "react";
121
- var MemoryArchivistsStats = /* @__PURE__ */ __name(({ archivist }) => {
92
+ import {
93
+ useCallback,
94
+ useEffect,
95
+ useMemo,
96
+ useState as useState2
97
+ } from "react";
98
+ import { jsx as jsx4 } from "react/jsx-runtime";
99
+ var MemoryArchivistsStats = ({ archivist }) => {
122
100
  const [all, setAll] = useState2();
123
101
  const getAll = useCallback(async (archivist2) => {
124
102
  const all2 = await archivist2?.all?.();
@@ -139,26 +117,19 @@ var MemoryArchivistsStats = /* @__PURE__ */ __name(({ archivist }) => {
139
117
  return () => {
140
118
  for (const listener of listeners) listener?.();
141
119
  };
142
- }, [
143
- archivist,
144
- getAll
145
- ]);
146
- useAsyncEffect(async () => {
147
- if (archivist?.queries.includes(ArchivistAllQuerySchema)) {
148
- await getAll(archivist);
149
- } else {
150
- setAll(null);
151
- }
152
- }, [
153
- archivist,
154
- getAll
155
- ]);
156
- const payloads = useMemo(() => all === null ? [] : all?.filter((payload) => payload.schema !== BoundWitnessSchema), [
157
- all
158
- ]);
159
- const boundWitnesses = useMemo(() => all === null ? [] : all?.filter((payload) => payload.schema === BoundWitnessSchema), [
160
- all
161
- ]);
120
+ }, [archivist, getAll]);
121
+ useAsyncEffect(
122
+ async () => {
123
+ if (archivist?.queries.includes(ArchivistAllQuerySchema)) {
124
+ await getAll(archivist);
125
+ } else {
126
+ setAll(null);
127
+ }
128
+ },
129
+ [archivist, getAll]
130
+ );
131
+ const payloads = useMemo(() => all === null ? [] : all?.filter((payload) => payload.schema !== BoundWitnessSchema), [all]);
132
+ const boundWitnesses = useMemo(() => all === null ? [] : all?.filter((payload) => payload.schema === BoundWitnessSchema), [all]);
162
133
  const addresses = useMemo(() => {
163
134
  const addressCounts = {};
164
135
  if (all) {
@@ -172,9 +143,7 @@ var MemoryArchivistsStats = /* @__PURE__ */ __name(({ archivist }) => {
172
143
  }
173
144
  }
174
145
  return addressCounts;
175
- }, [
176
- all
177
- ]);
146
+ }, [all]);
178
147
  const schemas = useMemo(() => {
179
148
  const schemaCounts = {};
180
149
  if (all) {
@@ -183,86 +152,78 @@ var MemoryArchivistsStats = /* @__PURE__ */ __name(({ archivist }) => {
183
152
  }
184
153
  }
185
154
  return schemaCounts;
186
- }, [
187
- all
188
- ]);
189
- return /* @__PURE__ */ React4.createElement(ArchivistStats, {
190
- addresses,
191
- boundWitnesses,
192
- payloads,
193
- schemas
194
- });
195
- }, "MemoryArchivistsStats");
155
+ }, [all]);
156
+ return /* @__PURE__ */ jsx4(ArchivistStats, { addresses, boundWitnesses, payloads, schemas });
157
+ };
196
158
 
197
159
  // src/components/Card/CardContent.tsx
198
- var ArchivistCardContent = /* @__PURE__ */ __name(({ children, mod, ...props }) => {
160
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
161
+ var ArchivistCardContent = ({
162
+ children,
163
+ mod,
164
+ ...props
165
+ }) => {
199
166
  const [config, setConfig] = useState3();
200
167
  const [wallet] = useWallet();
201
- useAsyncEffect2(async (mounted) => {
202
- if (wallet && mod) {
203
- const wrapper = ModuleWrapper.wrap(mod, wallet);
204
- const payloads = await wrapper?.state();
205
- if (mounted()) {
206
- setConfig(payloads?.[0]);
168
+ useAsyncEffect2(
169
+ async (mounted) => {
170
+ if (wallet && mod) {
171
+ const wrapper = ModuleWrapper.wrap(mod, wallet);
172
+ const payloads = await wrapper?.state();
173
+ if (mounted()) {
174
+ setConfig(payloads?.[0]);
175
+ }
176
+ } else {
177
+ setConfig(void 0);
207
178
  }
208
- } else {
209
- setConfig(void 0);
210
- }
211
- }, [
212
- mod,
213
- wallet
214
- ]);
215
- return /* @__PURE__ */ React5.createElement(ModuleCardContent, {
216
- mod,
217
- ...props
218
- }, /* @__PURE__ */ React5.createElement(FlexGrowRow, {
219
- flexWrap: "wrap",
220
- justifyContent: "start",
221
- gap: 2
222
- }, children, /* @__PURE__ */ React5.createElement(ArchivistParents, {
223
- config
224
- })));
225
- }, "ArchivistCardContent");
179
+ },
180
+ [mod, wallet]
181
+ );
182
+ return /* @__PURE__ */ jsx5(ModuleCardContent, { mod, ...props, children: /* @__PURE__ */ jsxs4(FlexGrowRow, { flexWrap: "wrap", justifyContent: "start", gap: 2, children: [
183
+ children,
184
+ /* @__PURE__ */ jsx5(ArchivistParents, { config })
185
+ ] }) });
186
+ };
226
187
 
227
188
  // src/components/Card/CardHeader.tsx
228
189
  import { MemoryArchivistConfigSchema } from "@xyo-network/archivist-memory";
229
190
  import { ModuleCardHeader } from "@xyo-network/react-module";
230
- import React6, { useMemo as useMemo2 } from "react";
231
- var ArchivistStats2 = /* @__PURE__ */ __name((archivist) => {
191
+ import { useMemo as useMemo2 } from "react";
192
+ import { jsx as jsx6 } from "react/jsx-runtime";
193
+ var ArchivistStats2 = (archivist) => {
232
194
  const { config } = archivist ?? {};
233
195
  switch (config?.schema) {
234
196
  case MemoryArchivistConfigSchema: {
235
- return /* @__PURE__ */ React6.createElement(MemoryArchivistsStats, {
236
- archivist
237
- });
197
+ return /* @__PURE__ */ jsx6(MemoryArchivistsStats, { archivist });
238
198
  }
239
199
  default: {
240
200
  return;
241
201
  }
242
202
  }
243
- }, "ArchivistStats");
244
- var ArchivistCardHeader = /* @__PURE__ */ __name(({ title, mod, ...props }) => {
245
- const Stats = useMemo2(() => ArchivistStats2(mod), [
246
- mod
247
- ]);
248
- return /* @__PURE__ */ React6.createElement(ModuleCardHeader, {
249
- mod,
250
- title: title ?? mod?.config.name ?? "Archivist",
251
- action: Stats,
252
- ...props
253
- });
254
- }, "ArchivistCardHeader");
203
+ };
204
+ var ArchivistCardHeader = ({
205
+ title,
206
+ mod,
207
+ ...props
208
+ }) => {
209
+ const Stats = useMemo2(() => ArchivistStats2(mod), [mod]);
210
+ return /* @__PURE__ */ jsx6(ModuleCardHeader, { mod, title: title ?? mod?.config.name ?? "Archivist", action: Stats, ...props });
211
+ };
255
212
 
256
213
  // src/components/Card/Card.tsx
257
- var ArchivistCard = /* @__PURE__ */ __name(({ children, mod, ...props }) => {
258
- return /* @__PURE__ */ React7.createElement(Card, props, /* @__PURE__ */ React7.createElement(ArchivistCardHeader, {
259
- mod
260
- }), /* @__PURE__ */ React7.createElement(ArchivistCardContent, {
261
- mod
262
- }), children, /* @__PURE__ */ React7.createElement(ModuleCardActions, {
263
- mod
264
- }));
265
- }, "ArchivistCard");
214
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
215
+ var ArchivistCard = ({
216
+ children,
217
+ mod,
218
+ ...props
219
+ }) => {
220
+ return /* @__PURE__ */ jsxs5(Card, { ...props, children: [
221
+ /* @__PURE__ */ jsx7(ArchivistCardHeader, { mod }),
222
+ /* @__PURE__ */ jsx7(ArchivistCardContent, { mod }),
223
+ children,
224
+ /* @__PURE__ */ jsx7(ModuleCardActions, { mod })
225
+ ] });
226
+ };
266
227
 
267
228
  // src/components/Details/Details.tsx
268
229
  import { ButtonGroup, Typography as Typography3 } from "@mui/material";
@@ -271,38 +232,29 @@ import { ButtonEx } from "@xylabs/react-button";
271
232
  import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
272
233
  import { ArchivistClearQuerySchema, ArchivistCommitQuerySchema } from "@xyo-network/archivist-model";
273
234
  import { QueryBoundWitnessBuilder } from "@xyo-network/boundwitness-builder";
274
- import React8, { useState as useState6 } from "react";
235
+ import { useState as useState6 } from "react";
275
236
 
276
237
  // src/hooks/node/useArchivistFromNode.tsx
277
238
  import { asArchivistInstance } from "@xyo-network/archivist-model";
278
239
  import { useModuleFromNode } from "@xyo-network/react-node";
279
- var useArchivistFromNode = /* @__PURE__ */ __name((nameOrAddressOrInstance, config) => {
240
+ var useArchivistFromNode = (nameOrAddressOrInstance, config) => {
280
241
  const [mod, error] = useModuleFromNode(nameOrAddressOrInstance, config);
281
242
  const instance = asArchivistInstance(mod);
282
243
  if (mod && !instance) {
283
244
  const error2 = new Error(`Resolved module is not a ArchivistInstance [${mod.config?.schema}:${mod.config?.name}:${mod.address}]`);
284
245
  console.error(error2.message);
285
- return [
286
- void 0,
287
- error2
288
- ];
246
+ return [void 0, error2];
289
247
  }
290
- return [
291
- instance,
292
- error
293
- ];
294
- }, "useArchivistFromNode");
248
+ return [instance, error];
249
+ };
295
250
 
296
251
  // src/hooks/node/useArchivistsFromNode.tsx
297
252
  import { isArchivistInstance } from "@xyo-network/archivist-model";
298
253
  import { useModulesFromNode } from "@xyo-network/react-node";
299
- var useArchivistsFromNode = /* @__PURE__ */ __name((ids, config) => {
254
+ var useArchivistsFromNode = (ids, config) => {
300
255
  const [modules, error] = useModulesFromNode(ids, config);
301
256
  if (error) {
302
- return [
303
- null,
304
- error
305
- ];
257
+ return [null, error];
306
258
  }
307
259
  return modules ? [
308
260
  // eslint-disable-next-line unicorn/no-array-reduce
@@ -313,33 +265,24 @@ var useArchivistsFromNode = /* @__PURE__ */ __name((ids, config) => {
313
265
  return prev;
314
266
  }, []),
315
267
  void 0
316
- ] : [
317
- modules,
318
- error
319
- ];
320
- }, "useArchivistsFromNode");
268
+ ] : [modules, error];
269
+ };
321
270
 
322
271
  // src/hooks/node/useWeakArchivistFromNode.tsx
323
272
  import { isArchivistInstance as isArchivistInstance2 } from "@xyo-network/archivist-model";
324
273
  import { useWeakModuleFromNode } from "@xyo-network/react-node";
325
- var useWeakArchivistFromNode = /* @__PURE__ */ __name((nameOrAddressOrInstance, config) => {
326
- return useWeakModuleFromNode(nameOrAddressOrInstance, {
327
- identity: isArchivistInstance2,
328
- ...config
329
- });
330
- }, "useWeakArchivistFromNode");
274
+ var useWeakArchivistFromNode = (nameOrAddressOrInstance, config) => {
275
+ return useWeakModuleFromNode(nameOrAddressOrInstance, { identity: isArchivistInstance2, ...config });
276
+ };
331
277
 
332
278
  // src/hooks/node/useWeakArchivistsFromNode.tsx
333
279
  import { exists } from "@xylabs/sdk-js";
334
280
  import { asArchivistInstance as asArchivistInstance2 } from "@xyo-network/archivist-model";
335
281
  import { useWeakModulesFromNode } from "@xyo-network/react-node";
336
- var useWeakArchivistsFromNode = /* @__PURE__ */ __name((ids, config) => {
282
+ var useWeakArchivistsFromNode = (ids, config) => {
337
283
  const [modules, error] = useWeakModulesFromNode(ids, config);
338
284
  if (error) {
339
- return [
340
- null,
341
- error
342
- ];
285
+ return [null, error];
343
286
  }
344
287
  return [
345
288
  modules?.map((mod) => {
@@ -350,13 +293,13 @@ var useWeakArchivistsFromNode = /* @__PURE__ */ __name((ids, config) => {
350
293
  }).filter(exists) ?? [],
351
294
  void 0
352
295
  ];
353
- }, "useWeakArchivistsFromNode");
296
+ };
354
297
 
355
298
  // src/hooks/queries/useArchivistAll.tsx
356
299
  import { usePromise } from "@xylabs/react-promise";
357
300
  import { useRefresh } from "@xyo-network/react-module";
358
301
  import { useState as useState4 } from "react";
359
- var useArchivistAll = /* @__PURE__ */ __name((archivist) => {
302
+ var useArchivistAll = (archivist) => {
360
303
  const [error, setError] = useState4();
361
304
  const [enabled, refresh] = useRefresh();
362
305
  const payloads = usePromise(async () => {
@@ -368,43 +311,28 @@ var useArchivistAll = /* @__PURE__ */ __name((archivist) => {
368
311
  const error2 = ex;
369
312
  setError(error2);
370
313
  }
371
- }, [
372
- archivist,
373
- enabled
374
- ]);
375
- return [
376
- payloads,
377
- error,
378
- refresh
379
- ];
380
- }, "useArchivistAll");
314
+ }, [archivist, enabled]);
315
+ return [payloads, error, refresh];
316
+ };
381
317
 
382
318
  // src/hooks/queries/useArchivistGet.tsx
383
319
  import { usePromise as usePromise2 } from "@xylabs/react-promise";
384
320
  import { useRefresh as useRefresh2 } from "@xyo-network/react-module";
385
- var useArchivistGet = /* @__PURE__ */ __name((archivist, hashes) => {
321
+ var useArchivistGet = (archivist, hashes) => {
386
322
  const [enabled, refresh] = useRefresh2();
387
323
  const [payloads, error] = usePromise2(async () => {
388
324
  if (enabled && archivist && hashes) {
389
325
  return await archivist.get(hashes);
390
326
  }
391
- }, [
392
- archivist,
393
- hashes,
394
- enabled
395
- ]);
396
- return [
397
- payloads,
398
- error,
399
- refresh
400
- ];
401
- }, "useArchivistGet");
327
+ }, [archivist, hashes, enabled]);
328
+ return [payloads, error, refresh];
329
+ };
402
330
 
403
331
  // src/hooks/queries/useWeakArchivistAll.tsx
404
332
  import { usePromise as usePromise3 } from "@xylabs/react-promise";
405
333
  import { useRefresh as useRefresh3 } from "@xyo-network/react-module";
406
334
  import { useState as useState5 } from "react";
407
- var useWeakArchivistAll = /* @__PURE__ */ __name((archivist) => {
335
+ var useWeakArchivistAll = (archivist) => {
408
336
  const [error, setError] = useState5();
409
337
  const [enabled, refresh] = useRefresh3();
410
338
  const payloads = usePromise3(async () => {
@@ -416,91 +344,75 @@ var useWeakArchivistAll = /* @__PURE__ */ __name((archivist) => {
416
344
  const error2 = ex;
417
345
  setError(error2);
418
346
  }
419
- }, [
420
- archivist,
421
- enabled
422
- ]);
423
- return [
424
- payloads,
425
- error,
426
- refresh
427
- ];
428
- }, "useWeakArchivistAll");
347
+ }, [archivist, enabled]);
348
+ return [payloads, error, refresh];
349
+ };
429
350
 
430
351
  // src/hooks/queries/useWeakArchivistGet.tsx
431
352
  import { usePromise as usePromise4 } from "@xylabs/react-promise";
432
353
  import { useRefresh as useRefresh4 } from "@xyo-network/react-module";
433
- var useWeakArchivistGet = /* @__PURE__ */ __name((archivist, hashes) => {
354
+ var useWeakArchivistGet = (archivist, hashes) => {
434
355
  const [enabled, refresh] = useRefresh4();
435
356
  const [payloads, error] = usePromise4(async () => {
436
357
  const archivistInstance = archivist?.deref();
437
358
  if (enabled && archivistInstance && hashes) {
438
359
  return await archivistInstance.get(hashes);
439
360
  }
440
- }, [
441
- archivist,
442
- hashes,
443
- enabled
444
- ]);
445
- return [
446
- payloads,
447
- error,
448
- refresh
449
- ];
450
- }, "useWeakArchivistGet");
361
+ }, [archivist, hashes, enabled]);
362
+ return [payloads, error, refresh];
363
+ };
451
364
 
452
365
  // src/components/Details/Details.tsx
453
- var testQueryCommit = {
454
- schema: ArchivistCommitQuerySchema
455
- };
366
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
367
+ var testQueryCommit = { schema: ArchivistCommitQuerySchema };
456
368
  var testQueryCommitBoundWitnessBuilder = new QueryBoundWitnessBuilder().query(testQueryCommit);
457
- var testQueryClear = {
458
- schema: ArchivistClearQuerySchema
459
- };
369
+ var testQueryClear = { schema: ArchivistClearQuerySchema };
460
370
  var testQueryClearBoundWitnessBuilder = new QueryBoundWitnessBuilder().query(testQueryClear);
461
- var ArchivistDetails = /* @__PURE__ */ __name(({ address, ...props }) => {
371
+ var ArchivistDetails = ({ address, ...props }) => {
462
372
  const [archivist] = useWeakArchivistFromNode(address);
463
373
  const [payloads, setPayloads] = useState6();
464
374
  const [refresh, setRefresh] = useState6(0);
465
375
  const [queryableCommit, setQueryableCommit] = useState6(false);
466
376
  const [queryableClear, setQueryableClear] = useState6(false);
467
- useAsyncEffect3(async () => {
468
- const instance = archivist?.deref();
469
- if (instance) {
470
- const [commitBW] = await testQueryCommitBoundWitnessBuilder.build();
471
- const [clearBW] = await testQueryClearBoundWitnessBuilder.build();
472
- setQueryableCommit(await instance?.queryable(commitBW, [
473
- testQueryCommit
474
- ]));
475
- setQueryableClear(await instance?.queryable(clearBW, [
476
- testQueryClear
477
- ]));
478
- }
479
- }, [
480
- archivist
481
- ]);
482
- useAsyncEffect3(async (mounted) => {
483
- const payloads2 = await archivist?.deref()?.all?.();
484
- if (mounted()) {
485
- setPayloads(payloads2);
486
- }
487
- }, [
488
- archivist,
489
- refresh
490
- ]);
491
- return /* @__PURE__ */ React8.createElement(FlexCol2, props, /* @__PURE__ */ React8.createElement(Typography3, null, `Payloads: ${payloads ? payloads.length : "-"}`), /* @__PURE__ */ React8.createElement(ButtonGroup, null, /* @__PURE__ */ React8.createElement(ButtonEx, {
492
- disabled: payloads?.length === 0 || !archivist || !queryableCommit,
493
- onClick: /* @__PURE__ */ __name(() => archivist?.deref()?.commit?.(), "onClick")
494
- }, "Commit"), /* @__PURE__ */ React8.createElement(ButtonEx, {
495
- disabled: !archivist || !queryableClear,
496
- onClick: /* @__PURE__ */ __name(() => archivist?.deref()?.clear?.(), "onClick")
497
- }, "Clear"), /* @__PURE__ */ React8.createElement(ButtonEx, {
498
- disabled: !archivist,
499
- onClick: /* @__PURE__ */ __name(() => {
500
- setRefresh(refresh + 1);
501
- }, "onClick")
502
- }, "Refresh")));
503
- }, "ArchivistDetails");
377
+ useAsyncEffect3(
378
+ async () => {
379
+ const instance = archivist?.deref();
380
+ if (instance) {
381
+ const [commitBW] = await testQueryCommitBoundWitnessBuilder.build();
382
+ const [clearBW] = await testQueryClearBoundWitnessBuilder.build();
383
+ setQueryableCommit(await instance?.queryable(commitBW, [testQueryCommit]));
384
+ setQueryableClear(await instance?.queryable(clearBW, [testQueryClear]));
385
+ }
386
+ },
387
+ [archivist]
388
+ );
389
+ useAsyncEffect3(
390
+ async (mounted) => {
391
+ const payloads2 = await archivist?.deref()?.all?.();
392
+ if (mounted()) {
393
+ setPayloads(payloads2);
394
+ }
395
+ },
396
+ [archivist, refresh]
397
+ );
398
+ return /* @__PURE__ */ jsxs6(FlexCol2, { ...props, children: [
399
+ /* @__PURE__ */ jsx8(Typography3, { children: `Payloads: ${payloads ? payloads.length : "-"}` }),
400
+ /* @__PURE__ */ jsxs6(ButtonGroup, { children: [
401
+ /* @__PURE__ */ jsx8(ButtonEx, { disabled: payloads?.length === 0 || !archivist || !queryableCommit, onClick: () => archivist?.deref()?.commit?.(), children: "Commit" }),
402
+ /* @__PURE__ */ jsx8(ButtonEx, { disabled: !archivist || !queryableClear, onClick: () => archivist?.deref()?.clear?.(), children: "Clear" }),
403
+ /* @__PURE__ */ jsx8(
404
+ ButtonEx,
405
+ {
406
+ disabled: !archivist,
407
+ onClick: () => {
408
+ setRefresh(refresh + 1);
409
+ },
410
+ children: "Refresh"
411
+ }
412
+ )
413
+ ] })
414
+ ] });
415
+ };
504
416
  export {
505
417
  ArchivistCard,
506
418
  ArchivistCardContent,