@xyo-network/react-schema 7.0.0 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/components/Property/SchemaProperty.stories.d.ts +4 -4
- package/dist/browser/components/Property/SchemaProperty.stories.d.ts.map +1 -1
- package/dist/browser/hooks/stories/TestSchemaHooks.stories.d.ts +1 -1
- package/dist/browser/hooks/stories/TestSchemaHooks.stories.d.ts.map +1 -1
- package/dist/browser/hooks/useGetSchema.d.ts +1 -1
- package/dist/browser/hooks/useGetSchema.stories.d.ts +2 -2
- package/dist/browser/index.mjs +305 -297
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +46 -43
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Meta } from '@storybook/react-vite';
|
|
2
2
|
declare const StorybookEntry: Meta;
|
|
3
|
-
declare const Default: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("@storybook/react-vite").Args>;
|
|
4
|
-
declare const WithVerifiedValue: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("@storybook/react-vite").Args>;
|
|
5
|
-
declare const WithVerifiedValuePaper: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("@storybook/react-vite").Args>;
|
|
6
|
-
declare const WithUnverifiedValue: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("@storybook/react-vite").Args>;
|
|
3
|
+
declare const Default: import(".store/storybook-virtual-fa39dd25b7/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("@storybook/react-vite").Args>;
|
|
4
|
+
declare const WithVerifiedValue: import(".store/storybook-virtual-fa39dd25b7/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("@storybook/react-vite").Args>;
|
|
5
|
+
declare const WithVerifiedValuePaper: import(".store/storybook-virtual-fa39dd25b7/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("@storybook/react-vite").Args>;
|
|
6
|
+
declare const WithUnverifiedValue: import(".store/storybook-virtual-fa39dd25b7/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("@storybook/react-vite").Args>;
|
|
7
7
|
export { Default, WithUnverifiedValue, WithVerifiedValue, WithVerifiedValuePaper, };
|
|
8
8
|
export default StorybookEntry;
|
|
9
9
|
//# sourceMappingURL=SchemaProperty.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaProperty.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Property/SchemaProperty.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAA;AAO1D,QAAA,MAAM,cAAc,EAAE,IAIrB,CAAA;AAaD,QAAA,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"SchemaProperty.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Property/SchemaProperty.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAA;AAO1D,QAAA,MAAM,cAAc,EAAE,IAIrB,CAAA;AAaD,QAAA,MAAM,OAAO,0KAAoB,CAAA;AAGjC,QAAA,MAAM,iBAAiB,0KAAoB,CAAA;AAG3C,QAAA,MAAM,sBAAsB,0KAAoB,CAAA;AAGhD,QAAA,MAAM,mBAAmB,0KAAoB,CAAA;AAG7C,OAAO,EACL,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,sBAAsB,GACxE,CAAA;AAED,eAAe,cAAc,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Meta } from '@storybook/react-vite';
|
|
2
2
|
declare const _default: Meta;
|
|
3
3
|
export default _default;
|
|
4
|
-
declare const Default: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, {}>;
|
|
4
|
+
declare const Default: import(".store/storybook-virtual-fa39dd25b7/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, {}>;
|
|
5
5
|
export { Default };
|
|
6
6
|
//# sourceMappingURL=TestSchemaHooks.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestSchemaHooks.stories.d.ts","sourceRoot":"","sources":["../../../../src/hooks/stories/TestSchemaHooks.stories.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACC,IAAI,EAChB,MAAM,uBAAuB,CAAA;wBAoDzB,IAAI;AAHT,wBAGS;AAyCT,QAAA,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"TestSchemaHooks.stories.d.ts","sourceRoot":"","sources":["../../../../src/hooks/stories/TestSchemaHooks.stories.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACC,IAAI,EAChB,MAAM,uBAAuB,CAAA;wBAoDzB,IAAI;AAHT,wBAGS;AAyCT,QAAA,MAAM,OAAO,wIAAoB,CAAA;AAEjC,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
|
@@ -5,7 +5,7 @@ import type { SchemaPayload } from '@xyo-network/schema-payload-plugin';
|
|
|
5
5
|
*/
|
|
6
6
|
declare const useGetSchemaPayload: (schema?: string) => {
|
|
7
7
|
notFound: boolean;
|
|
8
|
-
schemaHuri: import("
|
|
8
|
+
schemaHuri: import(".store/@xyo-network-huri-npm-5.0.7-7f6a4a0ee4/package").Huri<import("@xyo-network/payload-model").Payload> | undefined;
|
|
9
9
|
schemaPayload: SchemaPayload | null | undefined;
|
|
10
10
|
xyoError: WithSources<ModuleError> | undefined;
|
|
11
11
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Meta } from '@storybook/react-vite';
|
|
2
2
|
declare const StorybookEntry: Meta;
|
|
3
|
-
declare const Default: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, {
|
|
3
|
+
declare const Default: import(".store/storybook-virtual-fa39dd25b7/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, {
|
|
4
4
|
schema: string;
|
|
5
5
|
}>;
|
|
6
|
-
declare const Domain: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, {
|
|
6
|
+
declare const Domain: import(".store/storybook-virtual-fa39dd25b7/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, {
|
|
7
7
|
schema: string;
|
|
8
8
|
}>;
|
|
9
9
|
export { Default, Domain };
|
package/dist/browser/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/components/Property/SchemaProperty.tsx
|
|
5
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
NewReleases as NewReleasesIcon,
|
|
4
|
+
OpenInNew as OpenInNewIcon,
|
|
5
|
+
Verified as VerifiedIcon
|
|
6
|
+
} from "@mui/icons-material";
|
|
6
7
|
import { IconButton } from "@mui/material";
|
|
7
8
|
import { useAsyncEffect } from "@xylabs/react-async-effect";
|
|
8
9
|
import { FlexGrowRow } from "@xylabs/react-flexbox";
|
|
@@ -10,115 +11,128 @@ import { LinkEx } from "@xylabs/react-link";
|
|
|
10
11
|
import { useEvent } from "@xyo-network/react-event";
|
|
11
12
|
import { Property, PropertyValue } from "@xyo-network/react-property";
|
|
12
13
|
import { SchemaCache } from "@xyo-network/schema-cache";
|
|
13
|
-
import
|
|
14
|
-
|
|
14
|
+
import { useState } from "react";
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
var useResolveSchema = (schema) => {
|
|
15
17
|
const [entry, setEntry] = useState();
|
|
16
|
-
useAsyncEffect(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
useAsyncEffect(
|
|
19
|
+
async (mounted) => {
|
|
20
|
+
if (schema) {
|
|
21
|
+
const entry2 = await SchemaCache.instance.get(schema);
|
|
22
|
+
if (mounted()) {
|
|
23
|
+
setEntry(entry2);
|
|
24
|
+
}
|
|
21
25
|
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
]);
|
|
26
|
+
},
|
|
27
|
+
[schema]
|
|
28
|
+
);
|
|
26
29
|
return entry;
|
|
27
|
-
}
|
|
28
|
-
var SchemaProperty =
|
|
30
|
+
};
|
|
31
|
+
var SchemaProperty = ({
|
|
32
|
+
showLinkNames = true,
|
|
33
|
+
showOpenNewWindowLink = true,
|
|
34
|
+
showStatusIcon = true,
|
|
35
|
+
titleProps,
|
|
36
|
+
value,
|
|
37
|
+
...props
|
|
38
|
+
}) => {
|
|
29
39
|
const resolvedSchema = useResolveSchema(value);
|
|
30
40
|
const [buttonRef, buttonDispatch] = useEvent();
|
|
31
41
|
const [divRef, divDispatch] = useEvent();
|
|
32
|
-
const onClick =
|
|
33
|
-
dispatch?.(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
fontSize: "inherit"
|
|
56
|
-
})) : resolvedSchema === void 0 ? /* @__PURE__ */ React.createElement(IconButton, {
|
|
57
|
-
ref: buttonRef,
|
|
58
|
-
size: "small",
|
|
59
|
-
onClick: /* @__PURE__ */ __name(() => {
|
|
60
|
-
if (!buttonRef.current) {
|
|
61
|
-
console.warn("buttonRef.current is null");
|
|
62
|
-
}
|
|
63
|
-
onClick(buttonDispatch);
|
|
64
|
-
}, "onClick")
|
|
65
|
-
}, /* @__PURE__ */ React.createElement(NewReleasesIcon, {
|
|
66
|
-
color: "disabled",
|
|
67
|
-
fontSize: "inherit"
|
|
68
|
-
})) : /* @__PURE__ */ React.createElement(IconButton, {
|
|
69
|
-
rel: "noopener noreferrer",
|
|
70
|
-
size: "small",
|
|
71
|
-
target: "_blank",
|
|
72
|
-
href: resolvedSchema?.huri?.href ?? ""
|
|
73
|
-
}, /* @__PURE__ */ React.createElement(VerifiedIcon, {
|
|
74
|
-
color: "success",
|
|
75
|
-
fontSize: "inherit"
|
|
76
|
-
})) : null, value ? /* @__PURE__ */ React.createElement(FlexGrowRow, {
|
|
77
|
-
ref: divRef,
|
|
78
|
-
justifyContent: "space-between"
|
|
79
|
-
}, showLinkNames ? /* @__PURE__ */ React.createElement(LinkEx, {
|
|
80
|
-
display: "block",
|
|
81
|
-
width: "100%",
|
|
82
|
-
sx: {
|
|
83
|
-
cursor: "pointer"
|
|
84
|
-
}
|
|
85
|
-
}, /* @__PURE__ */ React.createElement(PropertyValue, {
|
|
86
|
-
value,
|
|
87
|
-
title: "view schema",
|
|
88
|
-
onClick: /* @__PURE__ */ __name(() => {
|
|
89
|
-
if (!divRef.current) {
|
|
90
|
-
console.warn("divRef.current is null");
|
|
91
|
-
}
|
|
92
|
-
onClick(divDispatch);
|
|
93
|
-
}, "onClick")
|
|
94
|
-
})) : /* @__PURE__ */ React.createElement(PropertyValue, {
|
|
95
|
-
value,
|
|
96
|
-
title: "view schema",
|
|
97
|
-
onClick: /* @__PURE__ */ __name(() => {
|
|
98
|
-
if (!divRef.current) {
|
|
99
|
-
console.warn("divRef.current is null");
|
|
42
|
+
const onClick = (dispatch, openNewWindow = false) => {
|
|
43
|
+
dispatch?.(
|
|
44
|
+
"schema",
|
|
45
|
+
"click",
|
|
46
|
+
JSON.stringify({
|
|
47
|
+
openNewWindow,
|
|
48
|
+
schema: value
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
return /* @__PURE__ */ jsxs(Property, { title: "Schema", value, tip: "Schema sent with the payload", titleProps, ...props, children: [
|
|
53
|
+
value && showStatusIcon ? resolvedSchema === null ? /* @__PURE__ */ jsx(
|
|
54
|
+
IconButton,
|
|
55
|
+
{
|
|
56
|
+
ref: buttonRef,
|
|
57
|
+
size: "small",
|
|
58
|
+
onClick: () => {
|
|
59
|
+
if (!buttonRef.current) {
|
|
60
|
+
console.warn("buttonRef.current is null");
|
|
61
|
+
}
|
|
62
|
+
onClick(buttonDispatch);
|
|
63
|
+
},
|
|
64
|
+
children: /* @__PURE__ */ jsx(NewReleasesIcon, { color: "warning", fontSize: "inherit" })
|
|
100
65
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
66
|
+
) : resolvedSchema === void 0 ? /* @__PURE__ */ jsx(
|
|
67
|
+
IconButton,
|
|
68
|
+
{
|
|
69
|
+
ref: buttonRef,
|
|
70
|
+
size: "small",
|
|
71
|
+
onClick: () => {
|
|
72
|
+
if (!buttonRef.current) {
|
|
73
|
+
console.warn("buttonRef.current is null");
|
|
74
|
+
}
|
|
75
|
+
onClick(buttonDispatch);
|
|
76
|
+
},
|
|
77
|
+
children: /* @__PURE__ */ jsx(NewReleasesIcon, { color: "disabled", fontSize: "inherit" })
|
|
109
78
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
79
|
+
) : /* @__PURE__ */ jsx(IconButton, { rel: "noopener noreferrer", size: "small", target: "_blank", href: resolvedSchema?.huri?.href ?? "", children: /* @__PURE__ */ jsx(VerifiedIcon, { color: "success", fontSize: "inherit" }) }) : null,
|
|
80
|
+
value ? /* @__PURE__ */ jsxs(FlexGrowRow, { ref: divRef, justifyContent: "space-between", children: [
|
|
81
|
+
showLinkNames ? /* @__PURE__ */ jsx(
|
|
82
|
+
LinkEx,
|
|
83
|
+
{
|
|
84
|
+
display: "block",
|
|
85
|
+
width: "100%",
|
|
86
|
+
sx: { cursor: "pointer" },
|
|
87
|
+
children: /* @__PURE__ */ jsx(
|
|
88
|
+
PropertyValue,
|
|
89
|
+
{
|
|
90
|
+
value,
|
|
91
|
+
title: "view schema",
|
|
92
|
+
onClick: () => {
|
|
93
|
+
if (!divRef.current) {
|
|
94
|
+
console.warn("divRef.current is null");
|
|
95
|
+
}
|
|
96
|
+
onClick(divDispatch);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
) : /* @__PURE__ */ jsx(
|
|
102
|
+
PropertyValue,
|
|
103
|
+
{
|
|
104
|
+
value,
|
|
105
|
+
title: "view schema",
|
|
106
|
+
onClick: () => {
|
|
107
|
+
if (!divRef.current) {
|
|
108
|
+
console.warn("divRef.current is null");
|
|
109
|
+
}
|
|
110
|
+
onClick(divDispatch);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
showOpenNewWindowLink ? /* @__PURE__ */ jsx(
|
|
115
|
+
IconButton,
|
|
116
|
+
{
|
|
117
|
+
ref: buttonRef,
|
|
118
|
+
size: "small",
|
|
119
|
+
onClick: () => {
|
|
120
|
+
if (!buttonRef.current) {
|
|
121
|
+
console.warn("buttonRef.current is null");
|
|
122
|
+
}
|
|
123
|
+
onClick(buttonDispatch, true);
|
|
124
|
+
},
|
|
125
|
+
children: /* @__PURE__ */ jsx(OpenInNewIcon, { fontSize: "inherit" })
|
|
126
|
+
}
|
|
127
|
+
) : null
|
|
128
|
+
] }) : null
|
|
129
|
+
] });
|
|
130
|
+
};
|
|
116
131
|
SchemaProperty.displayName = "SchemaProperty";
|
|
117
132
|
|
|
118
133
|
// src/components/SelectEx/SchemaSelectEx.tsx
|
|
119
134
|
import { MenuItem, Typography } from "@mui/material";
|
|
120
135
|
import { SelectEx } from "@xylabs/react-select";
|
|
121
|
-
import React4 from "react";
|
|
122
136
|
|
|
123
137
|
// src/contexts/Schema/Context.ts
|
|
124
138
|
import { createContextEx } from "@xylabs/react-shared";
|
|
@@ -126,7 +140,7 @@ var SchemaContext = createContextEx();
|
|
|
126
140
|
|
|
127
141
|
// src/contexts/Schema/Provider/Memory.tsx
|
|
128
142
|
import { exists } from "@xylabs/exists";
|
|
129
|
-
import
|
|
143
|
+
import { useMemo as useMemo3, useState as useState5 } from "react";
|
|
130
144
|
|
|
131
145
|
// src/hooks/useGetSchema.tsx
|
|
132
146
|
import { useAsyncEffect as useAsyncEffect2 } from "@xylabs/react-async-effect";
|
|
@@ -134,159 +148,157 @@ import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
|
134
148
|
import { ModuleErrorSchema } from "@xyo-network/payload-model";
|
|
135
149
|
import { SchemaCache as SchemaCache2 } from "@xyo-network/schema-cache";
|
|
136
150
|
import { useState as useState2 } from "react";
|
|
137
|
-
var useGetSchemaPayload =
|
|
151
|
+
var useGetSchemaPayload = (schema) => {
|
|
138
152
|
const [notFound, setNotFound] = useState2(false);
|
|
139
153
|
const [xyoError, setError] = useState2();
|
|
140
154
|
const [schemaCacheEntry, setSchemaCacheEntry] = useState2();
|
|
141
155
|
const [schemaLocal, setSchemaLocal] = useState2();
|
|
142
|
-
useAsyncEffect2(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
useAsyncEffect2(
|
|
157
|
+
async (mounted) => {
|
|
158
|
+
const firstRequest = !notFound && !schemaCacheEntry && !xyoError;
|
|
159
|
+
const schemaChanged = schema !== schemaLocal;
|
|
160
|
+
if (schema && firstRequest || schema && schemaChanged) {
|
|
161
|
+
try {
|
|
162
|
+
const schemaCacheEntry2 = await SchemaCache2.instance.get(schema);
|
|
163
|
+
if (mounted()) {
|
|
164
|
+
setSchemaCacheEntry(schemaCacheEntry2);
|
|
165
|
+
setNotFound(schemaCacheEntry2 === null || schemaCacheEntry2 === void 0);
|
|
166
|
+
}
|
|
167
|
+
} catch (e) {
|
|
168
|
+
const error = e;
|
|
169
|
+
console.error(e);
|
|
170
|
+
if (mounted()) {
|
|
171
|
+
setError({
|
|
172
|
+
message: error.message,
|
|
173
|
+
schema: ModuleErrorSchema,
|
|
174
|
+
$sources: []
|
|
175
|
+
});
|
|
176
|
+
}
|
|
161
177
|
}
|
|
162
178
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
notFound,
|
|
170
|
-
schema,
|
|
171
|
-
schemaLocal,
|
|
172
|
-
schemaCacheEntry
|
|
173
|
-
]);
|
|
179
|
+
if (schemaChanged) {
|
|
180
|
+
setSchemaLocal(schema);
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
[xyoError, notFound, schema, schemaLocal, schemaCacheEntry]
|
|
184
|
+
);
|
|
174
185
|
return {
|
|
175
186
|
notFound,
|
|
176
187
|
schemaHuri: schemaCacheEntry?.huri,
|
|
177
188
|
schemaPayload: schemaCacheEntry ? new PayloadBuilder(schemaCacheEntry?.payload).fields(schemaCacheEntry.payload).build() : schemaCacheEntry,
|
|
178
189
|
xyoError
|
|
179
190
|
};
|
|
180
|
-
}
|
|
191
|
+
};
|
|
181
192
|
|
|
182
193
|
// src/hooks/useSchemaDefinitions.tsx
|
|
183
194
|
import { useAsyncEffect as useAsyncEffect3 } from "@xylabs/react-async-effect";
|
|
184
195
|
import { SchemaCache as SchemaCache3 } from "@xyo-network/schema-cache";
|
|
185
196
|
import { useState as useState3 } from "react";
|
|
186
|
-
var useSchemaDefinitions =
|
|
197
|
+
var useSchemaDefinitions = (schemaList) => {
|
|
187
198
|
const [schemaPayloads, setSchemaPayloads] = useState3();
|
|
188
|
-
useAsyncEffect3(
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
199
|
+
useAsyncEffect3(
|
|
200
|
+
async (mounted) => {
|
|
201
|
+
if (schemaList) {
|
|
202
|
+
const promiseResults = await Promise.allSettled(schemaList?.map(({ name }) => SchemaCache3.instance.get(name)));
|
|
203
|
+
if (mounted()) {
|
|
204
|
+
setSchemaPayloads(
|
|
205
|
+
promiseResults.map((result) => result.status === "fulfilled" ? result.value?.payload : void 0).filter((item) => item !== void 0 && item !== null)
|
|
206
|
+
);
|
|
207
|
+
}
|
|
193
208
|
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
]);
|
|
209
|
+
},
|
|
210
|
+
[schemaList]
|
|
211
|
+
);
|
|
198
212
|
return schemaPayloads;
|
|
199
|
-
}
|
|
213
|
+
};
|
|
200
214
|
|
|
201
215
|
// src/hooks/useSchemaList.tsx
|
|
202
216
|
import { usePromise } from "@xylabs/react-promise";
|
|
203
217
|
import { SchemaListQuerySchema } from "@xyo-network/diviner-schema-list-model";
|
|
204
218
|
import { useWeakDivinerFromNode } from "@xyo-network/react-diviner";
|
|
205
219
|
import { useMemo } from "react";
|
|
206
|
-
var useSchemaList =
|
|
220
|
+
var useSchemaList = (address, nameOrAddress = "SchemaListDiviner") => {
|
|
207
221
|
const [diviner, divinerError] = useWeakDivinerFromNode(nameOrAddress);
|
|
208
|
-
const query = useMemo(
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
query
|
|
226
|
-
|
|
227
|
-
return [
|
|
228
|
-
|
|
229
|
-
error
|
|
230
|
-
];
|
|
231
|
-
}, "useSchemaList");
|
|
222
|
+
const query = useMemo(
|
|
223
|
+
() => address ? [
|
|
224
|
+
{
|
|
225
|
+
address,
|
|
226
|
+
schema: SchemaListQuerySchema
|
|
227
|
+
}
|
|
228
|
+
] : void 0,
|
|
229
|
+
[address]
|
|
230
|
+
);
|
|
231
|
+
const [schemaList, error] = usePromise(
|
|
232
|
+
async () => {
|
|
233
|
+
const divinerInstance = diviner?.deref();
|
|
234
|
+
if (divinerInstance) {
|
|
235
|
+
const response = await divinerInstance.divine(query);
|
|
236
|
+
return response.at(0);
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
[diviner, divinerError, query]
|
|
240
|
+
);
|
|
241
|
+
return [schemaList, error];
|
|
242
|
+
};
|
|
232
243
|
|
|
233
244
|
// src/hooks/useSchemaStats.tsx
|
|
234
245
|
import { useAsyncEffect as useAsyncEffect4 } from "@xylabs/react-async-effect";
|
|
235
|
-
import {
|
|
246
|
+
import {
|
|
247
|
+
SchemaStatsDivinerSchema,
|
|
248
|
+
SchemaStatsQuerySchema
|
|
249
|
+
} from "@xyo-network/diviner-schema-stats-model";
|
|
236
250
|
import { TYPES } from "@xyo-network/node-core-types";
|
|
237
251
|
import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
|
|
238
252
|
import { useWeakDivinerFromNode as useWeakDivinerFromNode2 } from "@xyo-network/react-diviner";
|
|
239
253
|
import { useMemo as useMemo2, useState as useState4 } from "react";
|
|
240
|
-
var useSchemaStats =
|
|
254
|
+
var useSchemaStats = (statsAddress, nameOrAddress = TYPES.SchemaStatsDiviner) => {
|
|
241
255
|
const [refresh, setRefresh] = useState4(1);
|
|
242
256
|
const [diviner, divinerError] = useWeakDivinerFromNode2(nameOrAddress);
|
|
243
257
|
const [error, setError] = useState4();
|
|
244
|
-
const refreshHistory =
|
|
258
|
+
const refreshHistory = () => setRefresh((previous) => previous + 1);
|
|
245
259
|
const [schemaList, setSchemaList] = useState4();
|
|
246
|
-
const query = useMemo2(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
setSchemaList(void 0);
|
|
259
|
-
}
|
|
260
|
-
} else {
|
|
261
|
-
try {
|
|
262
|
-
const schemas = (await instance.divine([
|
|
263
|
-
query
|
|
264
|
-
])).filter(isPayloadOfSchemaType(SchemaStatsDivinerSchema));
|
|
260
|
+
const query = useMemo2(
|
|
261
|
+
() => ({
|
|
262
|
+
address: statsAddress,
|
|
263
|
+
schema: SchemaStatsQuerySchema
|
|
264
|
+
}),
|
|
265
|
+
[statsAddress]
|
|
266
|
+
);
|
|
267
|
+
useAsyncEffect4(
|
|
268
|
+
async (mounted) => {
|
|
269
|
+
const instance = diviner?.deref();
|
|
270
|
+
if (instance) {
|
|
271
|
+
if (divinerError) {
|
|
265
272
|
if (mounted()) {
|
|
266
|
-
|
|
267
|
-
|
|
273
|
+
setError(divinerError);
|
|
274
|
+
setSchemaList(void 0);
|
|
275
|
+
}
|
|
276
|
+
} else {
|
|
277
|
+
try {
|
|
278
|
+
const schemas = (await instance.divine([query])).filter(isPayloadOfSchemaType(SchemaStatsDivinerSchema));
|
|
279
|
+
if (mounted()) {
|
|
280
|
+
setSchemaList(schemas);
|
|
281
|
+
setError(void 0);
|
|
282
|
+
}
|
|
283
|
+
} catch (ex) {
|
|
284
|
+
setError(ex);
|
|
285
|
+
setSchemaList(void 0);
|
|
268
286
|
}
|
|
269
|
-
} catch (ex) {
|
|
270
|
-
setError(ex);
|
|
271
|
-
setSchemaList(void 0);
|
|
272
287
|
}
|
|
273
288
|
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
query
|
|
280
|
-
]);
|
|
281
|
-
return [
|
|
282
|
-
schemaList,
|
|
283
|
-
error,
|
|
284
|
-
refreshHistory
|
|
285
|
-
];
|
|
286
|
-
}, "useSchemaStats");
|
|
289
|
+
},
|
|
290
|
+
[diviner, refresh, divinerError, query]
|
|
291
|
+
);
|
|
292
|
+
return [schemaList, error, refreshHistory];
|
|
293
|
+
};
|
|
287
294
|
|
|
288
295
|
// src/contexts/Schema/Provider/Memory.tsx
|
|
289
|
-
|
|
296
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
297
|
+
var SchemaMemoryProvider = ({
|
|
298
|
+
defaultSchema,
|
|
299
|
+
knownSchemaList,
|
|
300
|
+
...props
|
|
301
|
+
}) => {
|
|
290
302
|
const [schema, setSchema] = useState5(defaultSchema);
|
|
291
303
|
const [schemaList, setSchemaList] = useState5(knownSchemaList);
|
|
292
304
|
const [fetchedSchemaStats] = useSchemaStats();
|
|
@@ -295,63 +307,60 @@ var SchemaMemoryProvider = /* @__PURE__ */ __name(({ defaultSchema, knownSchemaL
|
|
|
295
307
|
const schemaList2 = fetchedSchemaStats.map(({ name }) => name).filter(exists);
|
|
296
308
|
setSchemaList(schemaList2);
|
|
297
309
|
}
|
|
298
|
-
}, [
|
|
299
|
-
fetchedSchemaStats
|
|
300
|
-
]);
|
|
310
|
+
}, [fetchedSchemaStats]);
|
|
301
311
|
const value = useMemo3(() => ({
|
|
302
312
|
provided: true,
|
|
303
313
|
schema,
|
|
304
314
|
schemaList: knownSchemaList ?? schemaList,
|
|
305
315
|
setSchema,
|
|
306
316
|
setSchemaList
|
|
307
|
-
}), [
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
knownSchemaList
|
|
311
|
-
]);
|
|
312
|
-
return /* @__PURE__ */ React2.createElement(SchemaContext, {
|
|
313
|
-
value,
|
|
314
|
-
...props
|
|
315
|
-
});
|
|
316
|
-
}, "SchemaMemoryProvider");
|
|
317
|
+
}), [schema, schemaList, knownSchemaList]);
|
|
318
|
+
return /* @__PURE__ */ jsx2(SchemaContext, { value, ...props });
|
|
319
|
+
};
|
|
317
320
|
|
|
318
321
|
// src/contexts/Schema/Provider/Route.tsx
|
|
319
|
-
import
|
|
322
|
+
import {
|
|
323
|
+
useCallback,
|
|
324
|
+
useEffect,
|
|
325
|
+
useMemo as useMemo4
|
|
326
|
+
} from "react";
|
|
320
327
|
import { useSearchParams } from "react-router-dom";
|
|
321
328
|
|
|
322
329
|
// src/contexts/Schema/use.ts
|
|
323
330
|
import { useContextEx } from "@xylabs/react-shared";
|
|
324
|
-
var useSchema =
|
|
331
|
+
var useSchema = (required = false) => {
|
|
325
332
|
return useContextEx(SchemaContext, "Schema", required);
|
|
326
|
-
}
|
|
333
|
+
};
|
|
327
334
|
|
|
328
335
|
// src/contexts/Schema/Provider/Route.tsx
|
|
329
|
-
|
|
330
|
-
|
|
336
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
337
|
+
var SchemaRouteProviderInner = ({ children }) => {
|
|
338
|
+
const {
|
|
339
|
+
schema,
|
|
340
|
+
setSchema,
|
|
341
|
+
schemaList
|
|
342
|
+
} = useSchema();
|
|
331
343
|
const [params, setParams] = useSearchParams();
|
|
332
344
|
const routeSchema = params.get("schema");
|
|
333
|
-
const setSchemaParam = useCallback(
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
replace: true
|
|
338
|
-
|
|
345
|
+
const setSchemaParam = useCallback(
|
|
346
|
+
(schema2) => {
|
|
347
|
+
if (schema2) {
|
|
348
|
+
params.set("schema", schema2);
|
|
349
|
+
setParams(params, { replace: true });
|
|
350
|
+
setSchema?.(schema2);
|
|
351
|
+
} else {
|
|
352
|
+
params.delete("network");
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
[params, setParams, setSchema]
|
|
356
|
+
);
|
|
357
|
+
const setSchemaLocal = useCallback(
|
|
358
|
+
(schema2) => {
|
|
359
|
+
setSchemaParam(schema2);
|
|
339
360
|
setSchema?.(schema2);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
}, [
|
|
344
|
-
params,
|
|
345
|
-
setParams,
|
|
346
|
-
setSchema
|
|
347
|
-
]);
|
|
348
|
-
const setSchemaLocal = useCallback((schema2) => {
|
|
349
|
-
setSchemaParam(schema2);
|
|
350
|
-
setSchema?.(schema2);
|
|
351
|
-
}, [
|
|
352
|
-
setSchemaParam,
|
|
353
|
-
setSchema
|
|
354
|
-
]);
|
|
361
|
+
},
|
|
362
|
+
[setSchemaParam, setSchema]
|
|
363
|
+
);
|
|
355
364
|
useEffect(() => {
|
|
356
365
|
if (routeSchema !== schema) {
|
|
357
366
|
if (routeSchema === void 0 && schema !== void 0) {
|
|
@@ -360,61 +369,60 @@ var SchemaRouteProviderInner = /* @__PURE__ */ __name(({ children }) => {
|
|
|
360
369
|
setSchema?.(routeSchema);
|
|
361
370
|
}
|
|
362
371
|
}
|
|
363
|
-
}, [
|
|
364
|
-
routeSchema,
|
|
365
|
-
schema,
|
|
366
|
-
setSchemaParam,
|
|
367
|
-
setSchema,
|
|
368
|
-
setSchemaLocal
|
|
369
|
-
]);
|
|
372
|
+
}, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal]);
|
|
370
373
|
const value = useMemo4(() => ({
|
|
371
374
|
provided: true,
|
|
372
375
|
schema,
|
|
373
376
|
schemaList,
|
|
374
377
|
setSchema: setSchemaLocal
|
|
375
|
-
}), [
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
return /* @__PURE__ */ React3.createElement(SchemaMemoryProvider, {
|
|
386
|
-
knownSchemaList,
|
|
387
|
-
defaultSchema
|
|
388
|
-
}, /* @__PURE__ */ React3.createElement(SchemaRouteProviderInner, props));
|
|
389
|
-
}, "SchemaRouteProvider");
|
|
378
|
+
}), [schema, schemaList, setSchemaLocal]);
|
|
379
|
+
return /* @__PURE__ */ jsx3(SchemaContext, { value, children });
|
|
380
|
+
};
|
|
381
|
+
var SchemaRouteProvider = ({
|
|
382
|
+
knownSchemaList,
|
|
383
|
+
defaultSchema,
|
|
384
|
+
...props
|
|
385
|
+
}) => {
|
|
386
|
+
return /* @__PURE__ */ jsx3(SchemaMemoryProvider, { knownSchemaList, defaultSchema, children: /* @__PURE__ */ jsx3(SchemaRouteProviderInner, { ...props }) });
|
|
387
|
+
};
|
|
390
388
|
|
|
391
389
|
// src/components/SelectEx/SchemaSelectEx.tsx
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
},
|
|
390
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
391
|
+
var SchemaSelectEx = ({
|
|
392
|
+
onChange,
|
|
393
|
+
variant = "outlined",
|
|
394
|
+
...props
|
|
395
|
+
}) => {
|
|
396
|
+
const {
|
|
397
|
+
schema,
|
|
398
|
+
setSchema,
|
|
399
|
+
schemaList
|
|
400
|
+
} = useSchema(false);
|
|
401
|
+
return /* @__PURE__ */ jsxs2(
|
|
402
|
+
SelectEx,
|
|
403
|
+
{
|
|
404
|
+
variant,
|
|
405
|
+
size: "small",
|
|
406
|
+
value: schema ?? "none",
|
|
407
|
+
onChange: (event, child) => {
|
|
408
|
+
if (event.target.value !== schema) {
|
|
409
|
+
onChange?.(event, child);
|
|
410
|
+
setSchema?.(event.target.value);
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
renderValue: (value) => {
|
|
414
|
+
return /* @__PURE__ */ jsx4(Typography, { children: value === "none" ? "- None -" : value });
|
|
415
|
+
},
|
|
416
|
+
...props,
|
|
417
|
+
children: [
|
|
418
|
+
schemaList?.map((schema2, index) => {
|
|
419
|
+
return /* @__PURE__ */ jsx4(MenuItem, { value: schema2, children: schema2 }, index);
|
|
420
|
+
}),
|
|
421
|
+
/* @__PURE__ */ jsx4(MenuItem, { value: "none", children: "- None -" }, "none")
|
|
422
|
+
]
|
|
423
|
+
}
|
|
424
|
+
);
|
|
425
|
+
};
|
|
418
426
|
export {
|
|
419
427
|
SchemaContext,
|
|
420
428
|
SchemaMemoryProvider,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Property/SchemaProperty.tsx","../../src/components/SelectEx/SchemaSelectEx.tsx","../../src/contexts/Schema/Context.ts","../../src/contexts/Schema/Provider/Memory.tsx","../../src/hooks/useGetSchema.tsx","../../src/hooks/useSchemaDefinitions.tsx","../../src/hooks/useSchemaList.tsx","../../src/hooks/useSchemaStats.tsx","../../src/contexts/Schema/Provider/Route.tsx","../../src/contexts/Schema/use.ts"],"sourcesContent":["import {\n NewReleases as NewReleasesIcon, OpenInNew as OpenInNewIcon, Verified as VerifiedIcon,\n} from '@mui/icons-material'\nimport { IconButton } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport type { EventDispatch, EventNoun } from '@xyo-network/react-event'\nimport { useEvent } from '@xyo-network/react-event'\nimport type { PropertyProps } from '@xyo-network/react-property'\nimport { Property, PropertyValue } from '@xyo-network/react-property'\nimport type { SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { SchemaCache } from '@xyo-network/schema-cache'\nimport React, { useState } from 'react'\n\nexport type SchemaPropertyProps = PropertyProps & {\n showLinkNames?: boolean\n showOpenNewWindowLink?: boolean\n showStatusIcon?: boolean\n value?: string\n}\n\nconst useResolveSchema = (schema?: string) => {\n const [entry, setEntry] = useState<SchemaCacheEntry | null>()\n useAsyncEffect(\n async (mounted) => {\n if (schema) {\n const entry = await SchemaCache.instance.get(schema)\n if (mounted()) {\n setEntry(entry)\n }\n }\n },\n [schema],\n )\n return entry\n}\n\nexport const SchemaProperty: React.FC<SchemaPropertyProps> = ({\n showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props\n}) => {\n const resolvedSchema = useResolveSchema(value)\n const [buttonRef, buttonDispatch] = useEvent<HTMLButtonElement>()\n const [divRef, divDispatch] = useEvent<HTMLDivElement>()\n\n const onClick = (dispatch?: EventDispatch<EventNoun, 'click', string>, openNewWindow = false) => {\n dispatch?.(\n 'schema',\n 'click',\n JSON.stringify({\n openNewWindow,\n schema: value,\n }),\n )\n }\n\n return (\n <Property title=\"Schema\" value={value} tip=\"Schema sent with the payload\" titleProps={titleProps} {...props}>\n {value && showStatusIcon\n ? resolvedSchema === null\n ? (\n <IconButton\n ref={buttonRef}\n size=\"small\"\n onClick={() => {\n if (!buttonRef.current) {\n console.warn('buttonRef.current is null')\n }\n onClick(buttonDispatch)\n }}\n >\n <NewReleasesIcon color=\"warning\" fontSize=\"inherit\" />\n </IconButton>\n )\n : resolvedSchema === undefined\n ? (\n <IconButton\n ref={buttonRef}\n size=\"small\"\n onClick={() => {\n if (!buttonRef.current) {\n console.warn('buttonRef.current is null')\n }\n onClick(buttonDispatch)\n }}\n >\n <NewReleasesIcon color=\"disabled\" fontSize=\"inherit\" />\n </IconButton>\n )\n : (\n <IconButton rel=\"noopener noreferrer\" size=\"small\" target=\"_blank\" href={resolvedSchema?.huri?.href ?? ''}>\n <VerifiedIcon color=\"success\" fontSize=\"inherit\" />\n </IconButton>\n )\n\n : null}\n {value\n ? (\n <FlexGrowRow ref={divRef} justifyContent=\"space-between\">\n {showLinkNames\n ? (\n <LinkEx\n display=\"block\"\n width=\"100%\"\n sx={{ cursor: 'pointer' }}\n >\n <PropertyValue\n value={value}\n title=\"view schema\"\n onClick={() => {\n if (!divRef.current) {\n console.warn('divRef.current is null')\n }\n onClick(divDispatch)\n }}\n />\n </LinkEx>\n )\n : (\n <PropertyValue\n value={value}\n title=\"view schema\"\n onClick={() => {\n if (!divRef.current) {\n console.warn('divRef.current is null')\n }\n onClick(divDispatch)\n }}\n />\n )}\n {showOpenNewWindowLink\n ? (\n <IconButton\n ref={buttonRef}\n size=\"small\"\n onClick={() => {\n if (!buttonRef.current) {\n console.warn('buttonRef.current is null')\n }\n onClick(buttonDispatch, true)\n }}\n >\n <OpenInNewIcon fontSize=\"inherit\" />\n </IconButton>\n )\n : null}\n </FlexGrowRow>\n )\n : null}\n </Property>\n )\n}\n\nSchemaProperty.displayName = 'SchemaProperty'\n","import { MenuItem, Typography } from '@mui/material'\nimport type { SelectExProps } from '@xylabs/react-select'\nimport { SelectEx } from '@xylabs/react-select'\nimport React from 'react'\n\nimport { useSchema } from '../../contexts/index.ts'\n\nexport type SchemaSelectExProps = SelectExProps<string>\n\nexport const SchemaSelectEx: React.FC<SchemaSelectExProps> = ({\n onChange, variant = 'outlined', ...props\n}) => {\n const {\n schema, setSchema, schemaList,\n } = useSchema(false)\n\n return (\n <SelectEx\n variant={variant}\n size=\"small\"\n value={schema ?? 'none'}\n onChange={(event, child) => {\n if (event.target.value !== schema) {\n onChange?.(event, child)\n setSchema?.(event.target.value)\n }\n }}\n renderValue={(value) => {\n return <Typography>{value === 'none' ? '- None -' : value}</Typography>\n }}\n {...props}\n >\n {schemaList?.map((schema, index) => {\n return (\n <MenuItem key={index} value={schema}>\n {schema}\n </MenuItem>\n )\n })}\n <MenuItem key=\"none\" value=\"none\">\n - None -\n </MenuItem>\n </SelectEx>\n )\n}\n","import { createContextEx } from '@xylabs/react-shared'\n\nimport type { SchemaContextState } from './State.ts'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { exists } from '@xylabs/exists'\nimport type { PropsWithChildren } from 'react'\nimport React, { useMemo, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks/index.ts'\nimport { SchemaContext } from '../Context.ts'\nimport type { SchemaContextState } from '../State.ts'\nimport type { SchemaProviderProps } from './Props.ts'\n\nexport const SchemaMemoryProvider: React.FC<PropsWithChildren<SchemaProviderProps>> = ({\n defaultSchema, knownSchemaList, ...props\n}) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useMemo(() => {\n if (fetchedSchemaStats) {\n const schemaList = (fetchedSchemaStats.map(({ name }) => name)).filter(exists)\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n const value: SchemaContextState = useMemo(() => ({\n provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList,\n }), [schema, schemaList, knownSchemaList])\n\n return <SchemaContext value={value} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { ModuleError, WithSources } from '@xyo-network/payload-model'\nimport { ModuleErrorSchema } from '@xyo-network/payload-model'\nimport type { SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { SchemaCache } from '@xyo-network/schema-cache'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { useState } from 'react'\n\n/**\n * Gets a Huri and schema payload from a schema string\n */\nconst useGetSchemaPayload = (schema?: string) => {\n const [notFound, setNotFound] = useState(false)\n const [xyoError, setError] = useState<WithSources<ModuleError>>()\n const [schemaCacheEntry, setSchemaCacheEntry] = useState<SchemaCacheEntry | null | undefined>()\n const [schemaLocal, setSchemaLocal] = useState<string>()\n\n useAsyncEffect(\n async (mounted) => {\n const firstRequest = !notFound && !schemaCacheEntry && !xyoError\n const schemaChanged = schema !== schemaLocal\n\n if ((schema && firstRequest) || (schema && schemaChanged)) {\n try {\n const schemaCacheEntry = await SchemaCache.instance.get(schema)\n if (mounted()) {\n setSchemaCacheEntry(schemaCacheEntry)\n setNotFound(schemaCacheEntry === null || schemaCacheEntry === undefined)\n }\n } catch (e) {\n const error = e as Error\n console.error(e)\n if (mounted()) {\n setError({\n message: error.message, schema: ModuleErrorSchema, $sources: [],\n })\n }\n }\n }\n if (schemaChanged) {\n setSchemaLocal(schema)\n }\n },\n [xyoError, notFound, schema, schemaLocal, schemaCacheEntry],\n )\n\n return {\n notFound,\n schemaHuri: schemaCacheEntry?.huri,\n schemaPayload:\n schemaCacheEntry ? new PayloadBuilder<SchemaPayload>(schemaCacheEntry?.payload).fields(schemaCacheEntry.payload).build() : schemaCacheEntry,\n xyoError,\n }\n}\n\nexport { useGetSchemaPayload }\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { SchemaCache } from '@xyo-network/schema-cache'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { useState } from 'react'\n\nexport type SchemaList = { name: string }\n\nexport const useSchemaDefinitions = (schemaList?: SchemaList[]): SchemaPayload[] | undefined => {\n const [schemaPayloads, setSchemaPayloads] = useState<SchemaPayload[]>()\n useAsyncEffect(\n async (mounted) => {\n if (schemaList) {\n const promiseResults = await Promise.allSettled(schemaList?.map(({ name }) => SchemaCache.instance.get(name)))\n if (mounted()) {\n setSchemaPayloads(\n promiseResults\n .map(result => (result.status === 'fulfilled' ? result.value?.payload : undefined))\n .filter(item => item !== undefined && item !== null) as SchemaPayload[],\n )\n }\n }\n },\n [schemaList],\n )\n return schemaPayloads\n}\n","import type { Address } from '@xylabs/hex'\nimport { usePromise } from '@xylabs/react-promise'\nimport type { SchemaListPayload, SchemaListQueryPayload } from '@xyo-network/diviner-schema-list-model'\nimport { SchemaListQuerySchema } from '@xyo-network/diviner-schema-list-model'\nimport { useWeakDivinerFromNode } from '@xyo-network/react-diviner'\nimport { useMemo } from 'react'\n\nexport const useSchemaList = (address?: Address, nameOrAddress = 'SchemaListDiviner'): [SchemaListPayload | null | undefined, Error | undefined] => {\n const [diviner, divinerError] = useWeakDivinerFromNode(nameOrAddress)\n\n const query: SchemaListQueryPayload[] | undefined = useMemo(\n () =>\n address\n ? [\n {\n address,\n schema: SchemaListQuerySchema,\n },\n ]\n : undefined,\n [address],\n )\n\n const [schemaList, error] = usePromise(\n async () => {\n const divinerInstance = diviner?.deref()\n if (divinerInstance) {\n const response = (await divinerInstance.divine(query)) as SchemaListPayload[]\n return response.at(0)\n }\n },\n [diviner, divinerError, query],\n )\n return [schemaList, error]\n}\n","import type { Address } from '@xylabs/hex'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport type {\n SchemaStatsPayload,\n SchemaStatsQueryPayload,\n} from '@xyo-network/diviner-schema-stats-model'\nimport {\n SchemaStatsDivinerSchema,\n SchemaStatsQuerySchema,\n} from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport type { WithSources } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport { useWeakDivinerFromNode } from '@xyo-network/react-diviner'\nimport type { Dispatch, SetStateAction } from 'react'\nimport { useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: Address,\n nameOrAddress = TYPES.SchemaStatsDiviner,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useWeakDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh(previous => previous + 1)\n\n const [schemaList, setSchemaList] = useState<WithSources<SchemaStatsPayload>[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n async (mounted) => {\n const instance = diviner?.deref()\n if (instance) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await instance.divine([query])).filter(isPayloadOfSchemaType(SchemaStatsDivinerSchema)) as WithSources<\n SchemaStatsPayload\n >[]\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import type { PropsWithChildren } from 'react'\nimport React, {\n useCallback, useEffect, useMemo,\n} from 'react'\nimport { useSearchParams } from 'react-router-dom'\n\nimport { SchemaContext } from '../Context.ts'\nimport type { SchemaContextState } from '../State.ts'\nimport { useSchema } from '../use.ts'\nimport { SchemaMemoryProvider } from './Memory.tsx'\nimport type { SchemaProviderProps } from './Props.ts'\n\nconst SchemaRouteProviderInner: React.FC<PropsWithChildren> = ({ children }) => {\n const {\n schema, setSchema, schemaList,\n } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n // update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n // if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n // sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n // if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n // if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n const value: SchemaContextState = useMemo(() => ({\n provided: true, schema, schemaList, setSchema: setSchemaLocal,\n }), [schema, schemaList, setSchemaLocal])\n\n return <SchemaContext value={value}>{children}</SchemaContext>\n}\n\nexport const SchemaRouteProvider: React.FC<PropsWithChildren<SchemaProviderProps>> = ({\n knownSchemaList, defaultSchema, ...props\n}) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { SchemaContext } from './Context.ts'\nimport type { SchemaContextState } from './State.ts'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(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AA,MAAYL,UAAU,SAAS,aAAaA,KAAAA;IACtD,GAFa;IAGZ,GAAGR;KAEHG,YAAYW,IAAI,CAACb,SAAQc,UAAAA;AACxB,WACE,gBAAAV,OAAA,cAACW,UAAAA;MAASC,KAAKF;MAAOP,OAAOP;OAC1BA,OAAAA;EAGP,CAAA,GACA,gBAAAI,OAAA,cAACW,UAAAA;IAASC,KAAI;IAAOT,OAAM;KAAO,UAAA,CAAA;AAKxC,GAnC6D;","names":["NewReleases","NewReleasesIcon","OpenInNew","OpenInNewIcon","Verified","VerifiedIcon","IconButton","useAsyncEffect","FlexGrowRow","LinkEx","useEvent","Property","PropertyValue","SchemaCache","React","useState","useResolveSchema","schema","entry","setEntry","useState","useAsyncEffect","mounted","SchemaCache","instance","get","SchemaProperty","showLinkNames","showOpenNewWindowLink","showStatusIcon","titleProps","value","props","resolvedSchema","buttonRef","buttonDispatch","useEvent","divRef","divDispatch","onClick","dispatch","openNewWindow","JSON","stringify","Property","title","tip","IconButton","ref","size","current","console","warn","NewReleasesIcon","color","fontSize","undefined","rel","target","href","huri","VerifiedIcon","FlexGrowRow","justifyContent","LinkEx","display","width","sx","cursor","PropertyValue","OpenInNewIcon","displayName","MenuItem","Typography","SelectEx","React","createContextEx","SchemaContext","exists","React","useMemo","useState","useAsyncEffect","PayloadBuilder","ModuleErrorSchema","SchemaCache","useState","useGetSchemaPayload","schema","notFound","setNotFound","useState","xyoError","setError","schemaCacheEntry","setSchemaCacheEntry","schemaLocal","setSchemaLocal","useAsyncEffect","mounted","firstRequest","schemaChanged","SchemaCache","instance","get","undefined","e","error","console","message","ModuleErrorSchema","$sources","schemaHuri","huri","schemaPayload","PayloadBuilder","payload","fields","build","useAsyncEffect","SchemaCache","useState","useSchemaDefinitions","schemaList","schemaPayloads","setSchemaPayloads","useState","useAsyncEffect","mounted","promiseResults","Promise","allSettled","map","name","SchemaCache","instance","get","result","status","value","payload","undefined","filter","item","usePromise","SchemaListQuerySchema","useWeakDivinerFromNode","useMemo","useSchemaList","address","nameOrAddress","diviner","divinerError","useWeakDivinerFromNode","query","useMemo","schema","SchemaListQuerySchema","undefined","schemaList","error","usePromise","divinerInstance","deref","response","divine","at","useAsyncEffect","SchemaStatsDivinerSchema","SchemaStatsQuerySchema","TYPES","isPayloadOfSchemaType","useWeakDivinerFromNode","useMemo","useState","useSchemaStats","statsAddress","nameOrAddress","TYPES","SchemaStatsDiviner","refresh","setRefresh","useState","diviner","divinerError","useWeakDivinerFromNode","error","setError","refreshHistory","previous","schemaList","setSchemaList","query","useMemo","address","schema","SchemaStatsQuerySchema","useAsyncEffect","mounted","instance","deref","undefined","schemas","divine","filter","isPayloadOfSchemaType","SchemaStatsDivinerSchema","ex","SchemaMemoryProvider","defaultSchema","knownSchemaList","props","schema","setSchema","useState","schemaList","setSchemaList","fetchedSchemaStats","useSchemaStats","useMemo","map","name","filter","exists","value","provided","React","SchemaContext","React","useCallback","useEffect","useMemo","useSearchParams","useContextEx","useSchema","required","useContextEx","SchemaContext","SchemaRouteProviderInner","children","schema","setSchema","schemaList","useSchema","params","setParams","useSearchParams","routeSchema","get","setSchemaParam","useCallback","set","replace","delete","setSchemaLocal","useEffect","undefined","value","useMemo","provided","React","SchemaContext","SchemaRouteProvider","knownSchemaList","defaultSchema","props","SchemaMemoryProvider","SchemaSelectEx","onChange","variant","props","schema","setSchema","schemaList","useSchema","React","SelectEx","size","value","event","child","target","renderValue","Typography","map","index","MenuItem","key"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/Property/SchemaProperty.tsx","../../src/components/SelectEx/SchemaSelectEx.tsx","../../src/contexts/Schema/Context.ts","../../src/contexts/Schema/Provider/Memory.tsx","../../src/hooks/useGetSchema.tsx","../../src/hooks/useSchemaDefinitions.tsx","../../src/hooks/useSchemaList.tsx","../../src/hooks/useSchemaStats.tsx","../../src/contexts/Schema/Provider/Route.tsx","../../src/contexts/Schema/use.ts"],"sourcesContent":["import {\n NewReleases as NewReleasesIcon, OpenInNew as OpenInNewIcon, Verified as VerifiedIcon,\n} from '@mui/icons-material'\nimport { IconButton } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport type { EventDispatch, EventNoun } from '@xyo-network/react-event'\nimport { useEvent } from '@xyo-network/react-event'\nimport type { PropertyProps } from '@xyo-network/react-property'\nimport { Property, PropertyValue } from '@xyo-network/react-property'\nimport type { SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { SchemaCache } from '@xyo-network/schema-cache'\nimport React, { useState } from 'react'\n\nexport type SchemaPropertyProps = PropertyProps & {\n showLinkNames?: boolean\n showOpenNewWindowLink?: boolean\n showStatusIcon?: boolean\n value?: string\n}\n\nconst useResolveSchema = (schema?: string) => {\n const [entry, setEntry] = useState<SchemaCacheEntry | null>()\n useAsyncEffect(\n async (mounted) => {\n if (schema) {\n const entry = await SchemaCache.instance.get(schema)\n if (mounted()) {\n setEntry(entry)\n }\n }\n },\n [schema],\n )\n return entry\n}\n\nexport const SchemaProperty: React.FC<SchemaPropertyProps> = ({\n showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props\n}) => {\n const resolvedSchema = useResolveSchema(value)\n const [buttonRef, buttonDispatch] = useEvent<HTMLButtonElement>()\n const [divRef, divDispatch] = useEvent<HTMLDivElement>()\n\n const onClick = (dispatch?: EventDispatch<EventNoun, 'click', string>, openNewWindow = false) => {\n dispatch?.(\n 'schema',\n 'click',\n JSON.stringify({\n openNewWindow,\n schema: value,\n }),\n )\n }\n\n return (\n <Property title=\"Schema\" value={value} tip=\"Schema sent with the payload\" titleProps={titleProps} {...props}>\n {value && showStatusIcon\n ? resolvedSchema === null\n ? (\n <IconButton\n ref={buttonRef}\n size=\"small\"\n onClick={() => {\n if (!buttonRef.current) {\n console.warn('buttonRef.current is null')\n }\n onClick(buttonDispatch)\n }}\n >\n <NewReleasesIcon color=\"warning\" fontSize=\"inherit\" />\n </IconButton>\n )\n : resolvedSchema === undefined\n ? (\n <IconButton\n ref={buttonRef}\n size=\"small\"\n onClick={() => {\n if (!buttonRef.current) {\n console.warn('buttonRef.current is null')\n }\n onClick(buttonDispatch)\n }}\n >\n <NewReleasesIcon color=\"disabled\" fontSize=\"inherit\" />\n </IconButton>\n )\n : (\n <IconButton rel=\"noopener noreferrer\" size=\"small\" target=\"_blank\" href={resolvedSchema?.huri?.href ?? ''}>\n <VerifiedIcon color=\"success\" fontSize=\"inherit\" />\n </IconButton>\n )\n\n : null}\n {value\n ? (\n <FlexGrowRow ref={divRef} justifyContent=\"space-between\">\n {showLinkNames\n ? (\n <LinkEx\n display=\"block\"\n width=\"100%\"\n sx={{ cursor: 'pointer' }}\n >\n <PropertyValue\n value={value}\n title=\"view schema\"\n onClick={() => {\n if (!divRef.current) {\n console.warn('divRef.current is null')\n }\n onClick(divDispatch)\n }}\n />\n </LinkEx>\n )\n : (\n <PropertyValue\n value={value}\n title=\"view schema\"\n onClick={() => {\n if (!divRef.current) {\n console.warn('divRef.current is null')\n }\n onClick(divDispatch)\n }}\n />\n )}\n {showOpenNewWindowLink\n ? (\n <IconButton\n ref={buttonRef}\n size=\"small\"\n onClick={() => {\n if (!buttonRef.current) {\n console.warn('buttonRef.current is null')\n }\n onClick(buttonDispatch, true)\n }}\n >\n <OpenInNewIcon fontSize=\"inherit\" />\n </IconButton>\n )\n : null}\n </FlexGrowRow>\n )\n : null}\n </Property>\n )\n}\n\nSchemaProperty.displayName = 'SchemaProperty'\n","import { MenuItem, Typography } from '@mui/material'\nimport type { SelectExProps } from '@xylabs/react-select'\nimport { SelectEx } from '@xylabs/react-select'\nimport React from 'react'\n\nimport { useSchema } from '../../contexts/index.ts'\n\nexport type SchemaSelectExProps = SelectExProps<string>\n\nexport const SchemaSelectEx: React.FC<SchemaSelectExProps> = ({\n onChange, variant = 'outlined', ...props\n}) => {\n const {\n schema, setSchema, schemaList,\n } = useSchema(false)\n\n return (\n <SelectEx\n variant={variant}\n size=\"small\"\n value={schema ?? 'none'}\n onChange={(event, child) => {\n if (event.target.value !== schema) {\n onChange?.(event, child)\n setSchema?.(event.target.value)\n }\n }}\n renderValue={(value) => {\n return <Typography>{value === 'none' ? '- None -' : value}</Typography>\n }}\n {...props}\n >\n {schemaList?.map((schema, index) => {\n return (\n <MenuItem key={index} value={schema}>\n {schema}\n </MenuItem>\n )\n })}\n <MenuItem key=\"none\" value=\"none\">\n - None -\n </MenuItem>\n </SelectEx>\n )\n}\n","import { createContextEx } from '@xylabs/react-shared'\n\nimport type { SchemaContextState } from './State.ts'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { exists } from '@xylabs/exists'\nimport type { PropsWithChildren } from 'react'\nimport React, { useMemo, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks/index.ts'\nimport { SchemaContext } from '../Context.ts'\nimport type { SchemaContextState } from '../State.ts'\nimport type { SchemaProviderProps } from './Props.ts'\n\nexport const SchemaMemoryProvider: React.FC<PropsWithChildren<SchemaProviderProps>> = ({\n defaultSchema, knownSchemaList, ...props\n}) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useMemo(() => {\n if (fetchedSchemaStats) {\n const schemaList = (fetchedSchemaStats.map(({ name }) => name)).filter(exists)\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n const value: SchemaContextState = useMemo(() => ({\n provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList,\n }), [schema, schemaList, knownSchemaList])\n\n return <SchemaContext value={value} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { ModuleError, WithSources } from '@xyo-network/payload-model'\nimport { ModuleErrorSchema } from '@xyo-network/payload-model'\nimport type { SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { SchemaCache } from '@xyo-network/schema-cache'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { useState } from 'react'\n\n/**\n * Gets a Huri and schema payload from a schema string\n */\nconst useGetSchemaPayload = (schema?: string) => {\n const [notFound, setNotFound] = useState(false)\n const [xyoError, setError] = useState<WithSources<ModuleError>>()\n const [schemaCacheEntry, setSchemaCacheEntry] = useState<SchemaCacheEntry | null | undefined>()\n const [schemaLocal, setSchemaLocal] = useState<string>()\n\n useAsyncEffect(\n async (mounted) => {\n const firstRequest = !notFound && !schemaCacheEntry && !xyoError\n const schemaChanged = schema !== schemaLocal\n\n if ((schema && firstRequest) || (schema && schemaChanged)) {\n try {\n const schemaCacheEntry = await SchemaCache.instance.get(schema)\n if (mounted()) {\n setSchemaCacheEntry(schemaCacheEntry)\n setNotFound(schemaCacheEntry === null || schemaCacheEntry === undefined)\n }\n } catch (e) {\n const error = e as Error\n console.error(e)\n if (mounted()) {\n setError({\n message: error.message, schema: ModuleErrorSchema, $sources: [],\n })\n }\n }\n }\n if (schemaChanged) {\n setSchemaLocal(schema)\n }\n },\n [xyoError, notFound, schema, schemaLocal, schemaCacheEntry],\n )\n\n return {\n notFound,\n schemaHuri: schemaCacheEntry?.huri,\n schemaPayload:\n schemaCacheEntry ? new PayloadBuilder<SchemaPayload>(schemaCacheEntry?.payload).fields(schemaCacheEntry.payload).build() : schemaCacheEntry,\n xyoError,\n }\n}\n\nexport { useGetSchemaPayload }\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { SchemaCache } from '@xyo-network/schema-cache'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { useState } from 'react'\n\nexport type SchemaList = { name: string }\n\nexport const useSchemaDefinitions = (schemaList?: SchemaList[]): SchemaPayload[] | undefined => {\n const [schemaPayloads, setSchemaPayloads] = useState<SchemaPayload[]>()\n useAsyncEffect(\n async (mounted) => {\n if (schemaList) {\n const promiseResults = await Promise.allSettled(schemaList?.map(({ name }) => SchemaCache.instance.get(name)))\n if (mounted()) {\n setSchemaPayloads(\n promiseResults\n .map(result => (result.status === 'fulfilled' ? result.value?.payload : undefined))\n .filter(item => item !== undefined && item !== null) as SchemaPayload[],\n )\n }\n }\n },\n [schemaList],\n )\n return schemaPayloads\n}\n","import type { Address } from '@xylabs/hex'\nimport { usePromise } from '@xylabs/react-promise'\nimport type { SchemaListPayload, SchemaListQueryPayload } from '@xyo-network/diviner-schema-list-model'\nimport { SchemaListQuerySchema } from '@xyo-network/diviner-schema-list-model'\nimport { useWeakDivinerFromNode } from '@xyo-network/react-diviner'\nimport { useMemo } from 'react'\n\nexport const useSchemaList = (address?: Address, nameOrAddress = 'SchemaListDiviner'): [SchemaListPayload | null | undefined, Error | undefined] => {\n const [diviner, divinerError] = useWeakDivinerFromNode(nameOrAddress)\n\n const query: SchemaListQueryPayload[] | undefined = useMemo(\n () =>\n address\n ? [\n {\n address,\n schema: SchemaListQuerySchema,\n },\n ]\n : undefined,\n [address],\n )\n\n const [schemaList, error] = usePromise(\n async () => {\n const divinerInstance = diviner?.deref()\n if (divinerInstance) {\n const response = (await divinerInstance.divine(query)) as SchemaListPayload[]\n return response.at(0)\n }\n },\n [diviner, divinerError, query],\n )\n return [schemaList, error]\n}\n","import type { Address } from '@xylabs/hex'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport type {\n SchemaStatsPayload,\n SchemaStatsQueryPayload,\n} from '@xyo-network/diviner-schema-stats-model'\nimport {\n SchemaStatsDivinerSchema,\n SchemaStatsQuerySchema,\n} from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport type { WithSources } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport { useWeakDivinerFromNode } from '@xyo-network/react-diviner'\nimport type { Dispatch, SetStateAction } from 'react'\nimport { useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: Address,\n nameOrAddress = TYPES.SchemaStatsDiviner,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useWeakDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh(previous => previous + 1)\n\n const [schemaList, setSchemaList] = useState<WithSources<SchemaStatsPayload>[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n async (mounted) => {\n const instance = diviner?.deref()\n if (instance) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await instance.divine([query])).filter(isPayloadOfSchemaType(SchemaStatsDivinerSchema)) as WithSources<\n SchemaStatsPayload\n >[]\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import type { PropsWithChildren } from 'react'\nimport React, {\n useCallback, useEffect, useMemo,\n} from 'react'\nimport { useSearchParams } from 'react-router-dom'\n\nimport { SchemaContext } from '../Context.ts'\nimport type { SchemaContextState } from '../State.ts'\nimport { useSchema } from '../use.ts'\nimport { SchemaMemoryProvider } from './Memory.tsx'\nimport type { SchemaProviderProps } from './Props.ts'\n\nconst SchemaRouteProviderInner: React.FC<PropsWithChildren> = ({ children }) => {\n const {\n schema, setSchema, schemaList,\n } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n // update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n // if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n // sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n // if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n // if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n const value: SchemaContextState = useMemo(() => ({\n provided: true, schema, schemaList, setSchema: setSchemaLocal,\n }), [schema, schemaList, setSchemaLocal])\n\n return <SchemaContext value={value}>{children}</SchemaContext>\n}\n\nexport const SchemaRouteProvider: React.FC<PropsWithChildren<SchemaProviderProps>> = ({\n knownSchemaList, defaultSchema, ...props\n}) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { SchemaContext } from './Context.ts'\nimport type { SchemaContextState } from './State.ts'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n"],"mappings":";AAAA;AAAA,EACE,eAAe;AAAA,EAAiB,aAAa;AAAA,EAAe,YAAY;AAAA,OACnE;AACP,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AAEvB,SAAS,gBAAgB;AAEzB,SAAS,UAAU,qBAAqB;AAExC,SAAS,mBAAmB;AAC5B,SAAgB,gBAAgB;AA0DhB,cA2BJ,YA3BI;AAjDhB,IAAM,mBAAmB,CAAC,WAAoB;AAC5C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAkC;AAC5D;AAAA,IACE,OAAO,YAAY;AACjB,UAAI,QAAQ;AACV,cAAMA,SAAQ,MAAM,YAAY,SAAS,IAAI,MAAM;AACnD,YAAI,QAAQ,GAAG;AACb,mBAAS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AAAA,MAEH;AAAA,oBAAY,IAAI,CAACE,SAAQ,UAAU;AAClC,iBACE,gBAAAF,KAAC,YAAqB,OAAOE,SAC1B,UAAAA,WADY,KAEf;AAAA,QAEJ,CAAC;AAAA,QACD,gBAAAF,KAAC,YAAoB,OAAM,QAAO,wBAApB,MAEd;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["entry","useMemo","useState","useAsyncEffect","SchemaCache","useState","schemaCacheEntry","useAsyncEffect","SchemaCache","useState","useAsyncEffect","useWeakDivinerFromNode","useMemo","useState","jsx","useState","useMemo","schemaList","useMemo","jsx","schema","useMemo","jsx","jsxs","schema"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-schema",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -43,54 +43,57 @@
|
|
|
43
43
|
"src"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@xylabs/exists": "
|
|
47
|
-
"@xylabs/hex": "
|
|
48
|
-
"@xylabs/react-async-effect": "
|
|
49
|
-
"@xylabs/react-flexbox": "
|
|
50
|
-
"@xylabs/react-link": "
|
|
51
|
-
"@xylabs/react-promise": "
|
|
52
|
-
"@xylabs/react-select": "
|
|
53
|
-
"@xylabs/react-shared": "
|
|
54
|
-
"@xyo-network/diviner-schema-list-model": "
|
|
55
|
-
"@xyo-network/diviner-schema-stats-model": "
|
|
56
|
-
"@xyo-network/node-core-types": "
|
|
57
|
-
"@xyo-network/payload-builder": "
|
|
58
|
-
"@xyo-network/payload-model": "
|
|
59
|
-
"@xyo-network/react-diviner": "^7.0.
|
|
60
|
-
"@xyo-network/react-event": "^7.0.
|
|
61
|
-
"@xyo-network/react-property": "^7.0.
|
|
62
|
-
"@xyo-network/schema-cache": "
|
|
63
|
-
"@xyo-network/schema-payload-plugin": "
|
|
64
|
-
"react-router-dom": "
|
|
46
|
+
"@xylabs/exists": "~5.0.11",
|
|
47
|
+
"@xylabs/hex": "~5.0.11",
|
|
48
|
+
"@xylabs/react-async-effect": "~7.0.4",
|
|
49
|
+
"@xylabs/react-flexbox": "~7.0.4",
|
|
50
|
+
"@xylabs/react-link": "~7.0.4",
|
|
51
|
+
"@xylabs/react-promise": "~7.0.4",
|
|
52
|
+
"@xylabs/react-select": "~7.0.4",
|
|
53
|
+
"@xylabs/react-shared": "~7.0.4",
|
|
54
|
+
"@xyo-network/diviner-schema-list-model": "~5.0.7",
|
|
55
|
+
"@xyo-network/diviner-schema-stats-model": "~5.0.7",
|
|
56
|
+
"@xyo-network/node-core-types": "~4.0.1",
|
|
57
|
+
"@xyo-network/payload-builder": "~5.0.7",
|
|
58
|
+
"@xyo-network/payload-model": "~5.0.7",
|
|
59
|
+
"@xyo-network/react-diviner": "^7.0.2",
|
|
60
|
+
"@xyo-network/react-event": "^7.0.2",
|
|
61
|
+
"@xyo-network/react-property": "^7.0.2",
|
|
62
|
+
"@xyo-network/schema-cache": "~5.0.7",
|
|
63
|
+
"@xyo-network/schema-payload-plugin": "~5.0.7",
|
|
64
|
+
"react-router-dom": "~7.8.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@emotion/react": "
|
|
68
|
-
"@emotion/styled": "
|
|
69
|
-
"@mui/icons-material": "
|
|
70
|
-
"@mui/material": "
|
|
71
|
-
"@storybook/react-vite": "
|
|
72
|
-
"@types/react": "
|
|
73
|
-
"@xylabs/react-flexbox": "
|
|
74
|
-
"@xylabs/react-hooks": "
|
|
75
|
-
"@xylabs/ts-scripts-yarn3": "
|
|
76
|
-
"@xylabs/tsconfig
|
|
77
|
-
"@
|
|
78
|
-
"@
|
|
79
|
-
"@xyo-network/
|
|
80
|
-
"@xyo-network/
|
|
81
|
-
"@xyo-network/
|
|
82
|
-
"@xyo-network/react-
|
|
83
|
-
"@xyo-network/react-
|
|
84
|
-
"react": "^
|
|
85
|
-
"react-
|
|
86
|
-
"
|
|
87
|
-
"
|
|
67
|
+
"@emotion/react": "~11.14.0",
|
|
68
|
+
"@emotion/styled": "~11.14.1",
|
|
69
|
+
"@mui/icons-material": "~7.3.1",
|
|
70
|
+
"@mui/material": "~7.3.1",
|
|
71
|
+
"@storybook/react-vite": "~9.1.3",
|
|
72
|
+
"@types/react": "~19.1.11",
|
|
73
|
+
"@xylabs/react-flexbox": "~7.0.4",
|
|
74
|
+
"@xylabs/react-hooks": "~7.0.4",
|
|
75
|
+
"@xylabs/ts-scripts-yarn3": "~7.1.7",
|
|
76
|
+
"@xylabs/tsconfig": "~7.1.7",
|
|
77
|
+
"@xylabs/tsconfig-dom": "~7.1.7",
|
|
78
|
+
"@xylabs/tsconfig-react": "~7.1.7",
|
|
79
|
+
"@xyo-network/bridge-http": "~5.0.7",
|
|
80
|
+
"@xyo-network/node-memory": "~5.0.7",
|
|
81
|
+
"@xyo-network/node-model": "~5.0.7",
|
|
82
|
+
"@xyo-network/react-node": "^7.0.2",
|
|
83
|
+
"@xyo-network/react-payload-raw-info": "^7.0.2",
|
|
84
|
+
"@xyo-network/react-storybook": "^7.0.2",
|
|
85
|
+
"@xyo-network/react-wallet": "^7.0.2",
|
|
86
|
+
"react": "~19.1.1",
|
|
87
|
+
"react-dom": "~19.1.1",
|
|
88
|
+
"storybook": "~9.1.3",
|
|
89
|
+
"typescript": "~5.9.2",
|
|
90
|
+
"vite": "~7.1.3"
|
|
88
91
|
},
|
|
89
92
|
"peerDependencies": {
|
|
90
93
|
"@mui/icons-material": ">=6 <8",
|
|
91
94
|
"@mui/material": ">=6 <8",
|
|
92
|
-
"react": "
|
|
93
|
-
"react-dom": "
|
|
95
|
+
"react": "~19",
|
|
96
|
+
"react-dom": "~19"
|
|
94
97
|
},
|
|
95
98
|
"publishConfig": {
|
|
96
99
|
"access": "public"
|