@xyo-network/react-schema 2.77.0 → 2.77.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/contexts/Schema/State.d.cts +0 -4
- package/dist/browser/contexts/Schema/State.d.cts.map +1 -1
- package/dist/browser/contexts/Schema/State.d.mts +0 -4
- package/dist/browser/contexts/Schema/State.d.mts.map +1 -1
- package/dist/browser/contexts/Schema/State.d.ts +0 -4
- package/dist/browser/contexts/Schema/State.d.ts.map +1 -1
- package/dist/browser/hooks/useGetSchema.d.cts +0 -3
- package/dist/browser/hooks/useGetSchema.d.cts.map +1 -1
- package/dist/browser/hooks/useGetSchema.d.mts +0 -3
- package/dist/browser/hooks/useGetSchema.d.mts.map +1 -1
- package/dist/browser/hooks/useGetSchema.d.ts +0 -3
- package/dist/browser/hooks/useGetSchema.d.ts.map +1 -1
- package/dist/browser/index.cjs +1 -356
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +1 -336
- package/dist/browser/index.js.map +1 -1
- package/dist/neutral/contexts/Schema/State.d.cts +0 -4
- package/dist/neutral/contexts/Schema/State.d.cts.map +1 -1
- package/dist/neutral/contexts/Schema/State.d.mts +0 -4
- package/dist/neutral/contexts/Schema/State.d.mts.map +1 -1
- package/dist/neutral/contexts/Schema/State.d.ts +0 -4
- package/dist/neutral/contexts/Schema/State.d.ts.map +1 -1
- package/dist/neutral/hooks/useGetSchema.d.cts +0 -3
- package/dist/neutral/hooks/useGetSchema.d.cts.map +1 -1
- package/dist/neutral/hooks/useGetSchema.d.mts +0 -3
- package/dist/neutral/hooks/useGetSchema.d.mts.map +1 -1
- package/dist/neutral/hooks/useGetSchema.d.ts +0 -3
- package/dist/neutral/hooks/useGetSchema.d.ts.map +1 -1
- package/dist/neutral/index.cjs +1 -356
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.js +1 -336
- package/dist/neutral/index.js.map +1 -1
- package/dist/node/contexts/Schema/State.d.cts +0 -4
- package/dist/node/contexts/Schema/State.d.cts.map +1 -1
- package/dist/node/contexts/Schema/State.d.mts +0 -4
- package/dist/node/contexts/Schema/State.d.mts.map +1 -1
- package/dist/node/contexts/Schema/State.d.ts +0 -4
- package/dist/node/contexts/Schema/State.d.ts.map +1 -1
- package/dist/node/hooks/useGetSchema.d.cts +0 -3
- package/dist/node/hooks/useGetSchema.d.cts.map +1 -1
- package/dist/node/hooks/useGetSchema.d.mts +0 -3
- package/dist/node/hooks/useGetSchema.d.mts.map +1 -1
- package/dist/node/hooks/useGetSchema.d.ts +0 -3
- package/dist/node/hooks/useGetSchema.d.ts.map +1 -1
- package/dist/node/index.cjs +1 -373
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +1 -340
- package/dist/node/index.js.map +1 -1
- package/package.json +11 -11
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { ContextExState } from '@xyo-network/react-shared';
|
|
2
2
|
import { Dispatch } from 'react';
|
|
3
3
|
export interface SchemaContextState extends ContextExState {
|
|
4
|
-
/** @field The currently selected XYO Schema */
|
|
5
4
|
schema?: string;
|
|
6
|
-
/** @field The list of known available schema */
|
|
7
5
|
schemaList?: string[];
|
|
8
|
-
/** @field Function to set the selected Schema */
|
|
9
6
|
setSchema?: Dispatch<string>;
|
|
10
|
-
/** @field Function to set the list of known available schema */
|
|
11
7
|
setSchemaList?: Dispatch<string[]>;
|
|
12
8
|
}
|
|
13
9
|
//# sourceMappingURL=State.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../../src/contexts/Schema/State.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,MAAM,WAAW,kBAAmB,SAAQ,cAAc;
|
|
1
|
+
{"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../../src/contexts/Schema/State.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IAExD,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IAErB,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IAE5B,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;CACnC"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { ContextExState } from '@xyo-network/react-shared';
|
|
2
2
|
import { Dispatch } from 'react';
|
|
3
3
|
export interface SchemaContextState extends ContextExState {
|
|
4
|
-
/** @field The currently selected XYO Schema */
|
|
5
4
|
schema?: string;
|
|
6
|
-
/** @field The list of known available schema */
|
|
7
5
|
schemaList?: string[];
|
|
8
|
-
/** @field Function to set the selected Schema */
|
|
9
6
|
setSchema?: Dispatch<string>;
|
|
10
|
-
/** @field Function to set the list of known available schema */
|
|
11
7
|
setSchemaList?: Dispatch<string[]>;
|
|
12
8
|
}
|
|
13
9
|
//# sourceMappingURL=State.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../../src/contexts/Schema/State.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,MAAM,WAAW,kBAAmB,SAAQ,cAAc;
|
|
1
|
+
{"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../../src/contexts/Schema/State.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IAExD,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IAErB,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IAE5B,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;CACnC"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { ContextExState } from '@xyo-network/react-shared';
|
|
2
2
|
import { Dispatch } from 'react';
|
|
3
3
|
export interface SchemaContextState extends ContextExState {
|
|
4
|
-
/** @field The currently selected XYO Schema */
|
|
5
4
|
schema?: string;
|
|
6
|
-
/** @field The list of known available schema */
|
|
7
5
|
schemaList?: string[];
|
|
8
|
-
/** @field Function to set the selected Schema */
|
|
9
6
|
setSchema?: Dispatch<string>;
|
|
10
|
-
/** @field Function to set the list of known available schema */
|
|
11
7
|
setSchemaList?: Dispatch<string[]>;
|
|
12
8
|
}
|
|
13
9
|
//# sourceMappingURL=State.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../../src/contexts/Schema/State.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,MAAM,WAAW,kBAAmB,SAAQ,cAAc;
|
|
1
|
+
{"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../../src/contexts/Schema/State.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IAExD,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IAErB,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IAE5B,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;CACnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetSchema.d.ts","sourceRoot":"","sources":["../../../src/hooks/useGetSchema.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGetSchema.d.ts","sourceRoot":"","sources":["../../../src/hooks/useGetSchema.tsx"],"names":[],"mappings":"AAUA,QAAA,MAAM,mBAAmB,YAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;CAyC3C,CAAA;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetSchema.d.ts","sourceRoot":"","sources":["../../../src/hooks/useGetSchema.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGetSchema.d.ts","sourceRoot":"","sources":["../../../src/hooks/useGetSchema.tsx"],"names":[],"mappings":"AAUA,QAAA,MAAM,mBAAmB,YAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;CAyC3C,CAAA;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetSchema.d.ts","sourceRoot":"","sources":["../../../src/hooks/useGetSchema.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGetSchema.d.ts","sourceRoot":"","sources":["../../../src/hooks/useGetSchema.tsx"],"names":[],"mappings":"AAUA,QAAA,MAAM,mBAAmB,YAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;CAyC3C,CAAA;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|
package/dist/browser/index.cjs
CHANGED
|
@@ -1,357 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
23
|
-
SchemaContext: () => SchemaContext,
|
|
24
|
-
SchemaMemoryProvider: () => SchemaMemoryProvider,
|
|
25
|
-
SchemaProperty: () => SchemaProperty,
|
|
26
|
-
SchemaRouteProvider: () => SchemaRouteProvider,
|
|
27
|
-
SchemaSelectEx: () => SchemaSelectEx,
|
|
28
|
-
useGetSchemaPayload: () => useGetSchemaPayload,
|
|
29
|
-
useSchema: () => useSchema,
|
|
30
|
-
useSchemaDefinitions: () => useSchemaDefinitions,
|
|
31
|
-
useSchemaList: () => useSchemaList,
|
|
32
|
-
useSchemaStats: () => useSchemaStats
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(src_exports);
|
|
35
|
-
|
|
36
|
-
// src/components/Property/SchemaProperty.tsx
|
|
37
|
-
var import_icons_material = require("@mui/icons-material");
|
|
38
|
-
var import_material = require("@mui/material");
|
|
39
|
-
var import_react_async_effect = require("@xylabs/react-async-effect");
|
|
40
|
-
var import_react_link = require("@xylabs/react-link");
|
|
41
|
-
var import_react_event = require("@xyo-network/react-event");
|
|
42
|
-
var import_react_property = require("@xyo-network/react-property");
|
|
43
|
-
var import_schema_cache = require("@xyo-network/schema-cache");
|
|
44
|
-
var import_react = require("react");
|
|
45
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
46
|
-
var useResolveSchema = (schema) => {
|
|
47
|
-
const [entry, setEntry] = (0, import_react.useState)();
|
|
48
|
-
(0, import_react_async_effect.useAsyncEffect)(
|
|
49
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
|
-
async (mounted) => {
|
|
51
|
-
if (schema) {
|
|
52
|
-
const entry2 = await import_schema_cache.SchemaCache.instance.get(schema);
|
|
53
|
-
if (mounted()) {
|
|
54
|
-
setEntry(entry2);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
[schema]
|
|
59
|
-
);
|
|
60
|
-
return entry;
|
|
61
|
-
};
|
|
62
|
-
var SchemaProperty = (0, import_react.forwardRef)(
|
|
63
|
-
({ showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props }, forwardedRef) => {
|
|
64
|
-
const resolvedSchema = useResolveSchema(value);
|
|
65
|
-
const [buttonRef, buttonDispatch] = (0, import_react_event.useEvent)();
|
|
66
|
-
const [divRef, divDispatch] = (0, import_react_event.useEvent)();
|
|
67
|
-
const onClick = (dispatch, openNewWindow = false) => {
|
|
68
|
-
dispatch?.(
|
|
69
|
-
"schema",
|
|
70
|
-
"click",
|
|
71
|
-
JSON.stringify({
|
|
72
|
-
openNewWindow,
|
|
73
|
-
schema: value
|
|
74
|
-
})
|
|
75
|
-
);
|
|
76
|
-
};
|
|
77
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_property.Property, { ref: forwardedRef, title: "Schema", value, tip: "Schema sent with the payload", titleProps, ...props, children: [
|
|
78
|
-
value && showStatusIcon ? resolvedSchema === null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.NewReleases, { color: "warning", fontSize: "inherit" }) }) : resolvedSchema === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.NewReleases, { color: "disabled", fontSize: "inherit" }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.IconButton, { rel: "noopener noreferrer", size: "small", target: "_blank", href: resolvedSchema?.huri?.href ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Verified, { color: "success", fontSize: "inherit" }) }) : null,
|
|
79
|
-
value ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
80
|
-
showLinkNames ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_link.LinkEx, { display: "block", width: "100%", sx: { cursor: "pointer" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_property.PropertyValue, { ref: divRef, value, title: "view schema", onClick: () => onClick(divDispatch) }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_property.PropertyValue, { ref: divRef, value, title: "view schema", onClick: () => onClick(divDispatch) }),
|
|
81
|
-
showOpenNewWindowLink ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch, true), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.OpenInNew, { fontSize: "inherit" }) }) : null
|
|
82
|
-
] }) : null
|
|
83
|
-
] });
|
|
84
|
-
}
|
|
85
|
-
);
|
|
86
|
-
SchemaProperty.displayName = "SchemaProperty";
|
|
87
|
-
|
|
88
|
-
// src/components/SelectEx/SchemaSelectEx.tsx
|
|
89
|
-
var import_material2 = require("@mui/material");
|
|
90
|
-
var import_react_select = require("@xylabs/react-select");
|
|
91
|
-
|
|
92
|
-
// src/contexts/Schema/Context.ts
|
|
93
|
-
var import_react_shared = require("@xyo-network/react-shared");
|
|
94
|
-
var SchemaContext = (0, import_react_shared.createContextEx)();
|
|
95
|
-
|
|
96
|
-
// src/contexts/Schema/Provider/Memory.tsx
|
|
97
|
-
var import_lodash = require("@xylabs/lodash");
|
|
98
|
-
var import_react6 = require("react");
|
|
99
|
-
|
|
100
|
-
// src/hooks/useGetSchema.tsx
|
|
101
|
-
var import_react_async_effect2 = require("@xylabs/react-async-effect");
|
|
102
|
-
var import_payload_builder = require("@xyo-network/payload-builder");
|
|
103
|
-
var import_payload_model = require("@xyo-network/payload-model");
|
|
104
|
-
var import_schema_cache2 = require("@xyo-network/schema-cache");
|
|
105
|
-
var import_react2 = require("react");
|
|
106
|
-
var useGetSchemaPayload = (schema) => {
|
|
107
|
-
const [notFound, setNotFound] = (0, import_react2.useState)(false);
|
|
108
|
-
const [xyoError, setError] = (0, import_react2.useState)();
|
|
109
|
-
const [schemaCacheEntry, setSchemaCacheEntry] = (0, import_react2.useState)();
|
|
110
|
-
const [schemaLocal, setSchemaLocal] = (0, import_react2.useState)();
|
|
111
|
-
(0, import_react_async_effect2.useAsyncEffect)(
|
|
112
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
113
|
-
async (mounted) => {
|
|
114
|
-
const firstRequest = !notFound && !schemaCacheEntry && !xyoError;
|
|
115
|
-
const schemaChanged = schema !== schemaLocal;
|
|
116
|
-
if (schema && firstRequest || schema && schemaChanged) {
|
|
117
|
-
try {
|
|
118
|
-
const schemaCacheEntry2 = await import_schema_cache2.SchemaCache.instance.get(schema);
|
|
119
|
-
if (mounted()) {
|
|
120
|
-
setSchemaCacheEntry(schemaCacheEntry2);
|
|
121
|
-
setNotFound(schemaCacheEntry2 === null || schemaCacheEntry2 === void 0);
|
|
122
|
-
}
|
|
123
|
-
} catch (e) {
|
|
124
|
-
const error = e;
|
|
125
|
-
console.error(e);
|
|
126
|
-
if (mounted()) {
|
|
127
|
-
setError({ message: error.message, schema: import_payload_model.ModuleErrorSchema, sources: [] });
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
if (schemaChanged) {
|
|
132
|
-
setSchemaLocal(schema);
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
[xyoError, notFound, schema, schemaLocal, schemaCacheEntry]
|
|
136
|
-
);
|
|
137
|
-
return {
|
|
138
|
-
notFound,
|
|
139
|
-
schemaHuri: schemaCacheEntry?.huri,
|
|
140
|
-
schemaPayload: schemaCacheEntry ? new import_payload_builder.PayloadBuilder(schemaCacheEntry?.payload).fields(schemaCacheEntry.payload).build() : schemaCacheEntry,
|
|
141
|
-
xyoError
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
// src/hooks/useSchemaDefinitions.tsx
|
|
146
|
-
var import_react_async_effect3 = require("@xylabs/react-async-effect");
|
|
147
|
-
var import_schema_cache3 = require("@xyo-network/schema-cache");
|
|
148
|
-
var import_react3 = require("react");
|
|
149
|
-
var useSchemaDefinitions = (schemaList) => {
|
|
150
|
-
const [schemaPayloads, setSchemaPayloads] = (0, import_react3.useState)();
|
|
151
|
-
(0, import_react_async_effect3.useAsyncEffect)(
|
|
152
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
153
|
-
async (mounted) => {
|
|
154
|
-
if (schemaList) {
|
|
155
|
-
const promiseResults = await Promise.allSettled(schemaList?.map(({ name }) => import_schema_cache3.SchemaCache.instance.get(name)));
|
|
156
|
-
if (mounted()) {
|
|
157
|
-
setSchemaPayloads(
|
|
158
|
-
promiseResults.map((result) => result.status === "fulfilled" ? result.value?.payload : void 0).filter((item) => item !== void 0 && item !== null)
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
[schemaList]
|
|
164
|
-
);
|
|
165
|
-
return schemaPayloads;
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
// src/hooks/useSchemaList.tsx
|
|
169
|
-
var import_react_async_effect4 = require("@xylabs/react-async-effect");
|
|
170
|
-
var import_diviner_schema_list_model = require("@xyo-network/diviner-schema-list-model");
|
|
171
|
-
var import_react_diviner = require("@xyo-network/react-diviner");
|
|
172
|
-
var import_react4 = require("react");
|
|
173
|
-
var useSchemaList = (address, nameOrAddress = "SchemaListDiviner") => {
|
|
174
|
-
const [schemaList, setSchemaList] = (0, import_react4.useState)();
|
|
175
|
-
const [error, setError] = (0, import_react4.useState)();
|
|
176
|
-
const [diviner, divinerError] = (0, import_react_diviner.useWeakDivinerFromNode)(nameOrAddress);
|
|
177
|
-
const query = (0, import_react4.useMemo)(
|
|
178
|
-
() => address ? [
|
|
179
|
-
{
|
|
180
|
-
address,
|
|
181
|
-
schema: import_diviner_schema_list_model.SchemaListQuerySchema
|
|
182
|
-
}
|
|
183
|
-
] : void 0,
|
|
184
|
-
[address]
|
|
185
|
-
);
|
|
186
|
-
(0, import_react4.useEffect)(() => {
|
|
187
|
-
if (diviner === null) {
|
|
188
|
-
setSchemaList(null);
|
|
189
|
-
setError(void 0);
|
|
190
|
-
}
|
|
191
|
-
}, [diviner]);
|
|
192
|
-
(0, import_react_async_effect4.useAsyncEffect)(
|
|
193
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps, require-await
|
|
194
|
-
async (mounted) => {
|
|
195
|
-
const divinerInstance = diviner?.deref();
|
|
196
|
-
if (divinerInstance) {
|
|
197
|
-
try {
|
|
198
|
-
const response = await divinerInstance.divine(query);
|
|
199
|
-
if (mounted()) {
|
|
200
|
-
setSchemaList(response?.[0]);
|
|
201
|
-
setError(void 0);
|
|
202
|
-
}
|
|
203
|
-
} catch (e) {
|
|
204
|
-
setError(e);
|
|
205
|
-
setSchemaList(void 0);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
[diviner, divinerError, query]
|
|
210
|
-
);
|
|
211
|
-
return [schemaList, error];
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
// src/hooks/useSchemaStats.tsx
|
|
215
|
-
var import_react_async_effect5 = require("@xylabs/react-async-effect");
|
|
216
|
-
var import_diviner_schema_stats_model = require("@xyo-network/diviner-schema-stats-model");
|
|
217
|
-
var import_node_core_types = require("@xyo-network/node-core-types");
|
|
218
|
-
var import_payload_model2 = require("@xyo-network/payload-model");
|
|
219
|
-
var import_react_diviner2 = require("@xyo-network/react-diviner");
|
|
220
|
-
var import_react5 = require("react");
|
|
221
|
-
var useSchemaStats = (statsAddress, nameOrAddress = import_node_core_types.TYPES.SchemaStatsDiviner) => {
|
|
222
|
-
const [refresh, setRefresh] = (0, import_react5.useState)(1);
|
|
223
|
-
const [diviner, divinerError] = (0, import_react_diviner2.useWeakDivinerFromNode)(nameOrAddress);
|
|
224
|
-
const [error, setError] = (0, import_react5.useState)();
|
|
225
|
-
const refreshHistory = () => setRefresh((previous) => previous + 1);
|
|
226
|
-
const [schemaList, setSchemaList] = (0, import_react5.useState)();
|
|
227
|
-
const query = (0, import_react5.useMemo)(
|
|
228
|
-
() => ({
|
|
229
|
-
address: statsAddress,
|
|
230
|
-
schema: import_diviner_schema_stats_model.SchemaStatsQuerySchema
|
|
231
|
-
}),
|
|
232
|
-
[statsAddress]
|
|
233
|
-
);
|
|
234
|
-
(0, import_react_async_effect5.useAsyncEffect)(
|
|
235
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
236
|
-
async (mounted) => {
|
|
237
|
-
const instance = diviner?.deref();
|
|
238
|
-
if (instance) {
|
|
239
|
-
if (divinerError) {
|
|
240
|
-
if (mounted()) {
|
|
241
|
-
setError(divinerError);
|
|
242
|
-
setSchemaList(void 0);
|
|
243
|
-
}
|
|
244
|
-
} else {
|
|
245
|
-
try {
|
|
246
|
-
const schemas = (await instance.divine([query])).filter((0, import_payload_model2.isPayloadOfSchemaTypeWithMeta)(import_diviner_schema_stats_model.SchemaStatsDivinerSchema));
|
|
247
|
-
if (mounted()) {
|
|
248
|
-
setSchemaList(schemas);
|
|
249
|
-
setError(void 0);
|
|
250
|
-
}
|
|
251
|
-
} catch (ex) {
|
|
252
|
-
setError(ex);
|
|
253
|
-
setSchemaList(void 0);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
[diviner, refresh, divinerError, query]
|
|
259
|
-
);
|
|
260
|
-
return [schemaList, error, refreshHistory];
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
// src/contexts/Schema/Provider/Memory.tsx
|
|
264
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
265
|
-
var SchemaMemoryProvider = ({ defaultSchema, knownSchemaList = [], ...props }) => {
|
|
266
|
-
const [schema, setSchema] = (0, import_react6.useState)(defaultSchema);
|
|
267
|
-
const [schemaList, setSchemaList] = (0, import_react6.useState)(knownSchemaList);
|
|
268
|
-
const [fetchedSchemaStats] = useSchemaStats();
|
|
269
|
-
(0, import_react6.useEffect)(() => {
|
|
270
|
-
if (fetchedSchemaStats) {
|
|
271
|
-
const schemaList2 = (0, import_lodash.compact)(fetchedSchemaStats.map(({ name }) => name));
|
|
272
|
-
setSchemaList(schemaList2);
|
|
273
|
-
}
|
|
274
|
-
}, [fetchedSchemaStats]);
|
|
275
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SchemaContext.Provider, { value: { provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }, ...props });
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
// src/contexts/Schema/Provider/Route.tsx
|
|
279
|
-
var import_react7 = require("react");
|
|
280
|
-
var import_react_router_dom = require("react-router-dom");
|
|
281
|
-
|
|
282
|
-
// src/contexts/Schema/use.ts
|
|
283
|
-
var import_react_shared2 = require("@xyo-network/react-shared");
|
|
284
|
-
var useSchema = (required = false) => {
|
|
285
|
-
return (0, import_react_shared2.useContextEx)(SchemaContext, "Schema", required);
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
// src/contexts/Schema/Provider/Route.tsx
|
|
289
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
290
|
-
var SchemaRouteProviderInner = ({ children }) => {
|
|
291
|
-
const { schema, setSchema, schemaList } = useSchema();
|
|
292
|
-
const [params, setParams] = (0, import_react_router_dom.useSearchParams)();
|
|
293
|
-
const routeSchema = params.get("schema");
|
|
294
|
-
const setSchemaParam = (0, import_react7.useCallback)(
|
|
295
|
-
(schema2) => {
|
|
296
|
-
if (schema2) {
|
|
297
|
-
params.set("schema", schema2);
|
|
298
|
-
setParams(params, { replace: true });
|
|
299
|
-
setSchema?.(schema2);
|
|
300
|
-
} else {
|
|
301
|
-
params.delete("network");
|
|
302
|
-
}
|
|
303
|
-
},
|
|
304
|
-
[params, setParams, setSchema]
|
|
305
|
-
);
|
|
306
|
-
const setSchemaLocal = (0, import_react7.useCallback)(
|
|
307
|
-
(schema2) => {
|
|
308
|
-
setSchemaParam(schema2);
|
|
309
|
-
setSchema?.(schema2);
|
|
310
|
-
},
|
|
311
|
-
[setSchemaParam, setSchema]
|
|
312
|
-
);
|
|
313
|
-
(0, import_react7.useEffect)(() => {
|
|
314
|
-
if (routeSchema !== schema) {
|
|
315
|
-
if (routeSchema === void 0 && schema !== void 0) {
|
|
316
|
-
setSchemaLocal(schema);
|
|
317
|
-
} else if (routeSchema) {
|
|
318
|
-
setSchema?.(routeSchema);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal]);
|
|
322
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SchemaContext.Provider, { value: { provided: true, schema, schemaList, setSchema: setSchemaLocal }, children });
|
|
323
|
-
};
|
|
324
|
-
var SchemaRouteProvider = ({ knownSchemaList, defaultSchema, ...props }) => {
|
|
325
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SchemaMemoryProvider, { knownSchemaList, defaultSchema, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SchemaRouteProviderInner, { ...props }) });
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
// src/components/SelectEx/SchemaSelectEx.tsx
|
|
329
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
330
|
-
var SchemaSelectEx = ({ onChange, variant = "outlined", ...props }) => {
|
|
331
|
-
const { schema, setSchema, schemaList } = useSchema(false);
|
|
332
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
333
|
-
import_react_select.SelectEx,
|
|
334
|
-
{
|
|
335
|
-
variant,
|
|
336
|
-
size: "small",
|
|
337
|
-
value: schema ?? "none",
|
|
338
|
-
onChange: (event, child) => {
|
|
339
|
-
if (event.target.value !== schema) {
|
|
340
|
-
onChange?.(event, child);
|
|
341
|
-
setSchema?.(event.target.value);
|
|
342
|
-
}
|
|
343
|
-
},
|
|
344
|
-
renderValue: (value) => {
|
|
345
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material2.Typography, { children: value === "none" ? "- None -" : value });
|
|
346
|
-
},
|
|
347
|
-
...props,
|
|
348
|
-
children: [
|
|
349
|
-
schemaList?.map((schema2, index) => {
|
|
350
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material2.MenuItem, { value: schema2, children: schema2 }, index);
|
|
351
|
-
}),
|
|
352
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material2.MenuItem, { value: "none", children: "- None -" }, "none")
|
|
353
|
-
]
|
|
354
|
-
}
|
|
355
|
-
);
|
|
356
|
-
};
|
|
1
|
+
"use strict";var R=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var ce=(e,t)=>{for(var a in t)R(e,a,{get:t[a],enumerable:!0})},me=(e,t,a,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of se(t))!ie.call(e,r)&&r!==a&&R(e,r,{get:()=>t[r],enumerable:!(s=ne(t,r))||s.enumerable});return e};var he=e=>me(R({},"__esModule",{value:!0}),e);var Pe={};ce(Pe,{SchemaContext:()=>u,SchemaMemoryProvider:()=>A,SchemaProperty:()=>T,SchemaRouteProvider:()=>pe,SchemaSelectEx:()=>ye,useGetSchemaPayload:()=>le,useSchema:()=>w,useSchemaDefinitions:()=>Se,useSchemaList:()=>de,useSchemaStats:()=>b});module.exports=he(Pe);var d=require("@mui/icons-material"),C=require("@mui/material"),z=require("@xylabs/react-async-effect"),F=require("@xylabs/react-link"),D=require("@xyo-network/react-event"),x=require("@xyo-network/react-property"),B=require("@xyo-network/schema-cache"),W=require("react"),h=require("react/jsx-runtime"),fe=e=>{let[t,a]=(0,W.useState)();return(0,z.useAsyncEffect)(async s=>{if(e){let r=await B.SchemaCache.instance.get(e);s()&&a(r)}},[e]),t},T=(0,W.forwardRef)(({showLinkNames:e=!0,showOpenNewWindowLink:t=!0,showStatusIcon:a=!0,titleProps:s,value:r,...o},n)=>{let i=fe(r),[f,c]=(0,D.useEvent)(),[S,l]=(0,D.useEvent)(),m=(y,v=!1)=>{y?.("schema","click",JSON.stringify({openNewWindow:v,schema:r}))};return(0,h.jsxs)(x.Property,{ref:n,title:"Schema",value:r,tip:"Schema sent with the payload",titleProps:s,...o,children:[r&&a?i===null?(0,h.jsx)(C.IconButton,{ref:f,size:"small",onClick:()=>m(c),children:(0,h.jsx)(d.NewReleases,{color:"warning",fontSize:"inherit"})}):i===void 0?(0,h.jsx)(C.IconButton,{ref:f,size:"small",onClick:()=>m(c),children:(0,h.jsx)(d.NewReleases,{color:"disabled",fontSize:"inherit"})}):(0,h.jsx)(C.IconButton,{rel:"noopener noreferrer",size:"small",target:"_blank",href:i?.huri?.href??"",children:(0,h.jsx)(d.Verified,{color:"success",fontSize:"inherit"})}):null,r?(0,h.jsxs)(h.Fragment,{children:[e?(0,h.jsx)(F.LinkEx,{display:"block",width:"100%",sx:{cursor:"pointer"},children:(0,h.jsx)(x.PropertyValue,{ref:S,value:r,title:"view schema",onClick:()=>m(l)})}):(0,h.jsx)(x.PropertyValue,{ref:S,value:r,title:"view schema",onClick:()=>m(l)}),t?(0,h.jsx)(C.IconButton,{ref:f,size:"small",onClick:()=>m(c,!0),children:(0,h.jsx)(d.OpenInNew,{fontSize:"inherit"})}):null]}):null]})});T.displayName="SchemaProperty";var M=require("@mui/material"),ae=require("@xylabs/react-select");var Q=require("@xyo-network/react-shared"),u=(0,Q.createContextEx)();var ee=require("@xylabs/lodash"),g=require("react");var H=require("@xylabs/react-async-effect"),O=require("@xyo-network/payload-builder"),V=require("@xyo-network/payload-model"),q=require("@xyo-network/schema-cache"),L=require("react"),le=e=>{let[t,a]=(0,L.useState)(!1),[s,r]=(0,L.useState)(),[o,n]=(0,L.useState)(),[i,f]=(0,L.useState)();return(0,H.useAsyncEffect)(async c=>{let S=!t&&!o&&!s,l=e!==i;if(e&&S||e&&l)try{let m=await q.SchemaCache.instance.get(e);c()&&(n(m),a(m==null))}catch(m){let y=m;console.error(m),c()&&r({message:y.message,schema:V.ModuleErrorSchema,sources:[]})}l&&f(e)},[s,t,e,i,o]),{notFound:t,schemaHuri:o?.huri,schemaPayload:o&&new O.PayloadBuilder(o?.payload).fields(o.payload).build(),xyoError:s}};var G=require("@xylabs/react-async-effect"),J=require("@xyo-network/schema-cache"),Y=require("react"),Se=e=>{let[t,a]=(0,Y.useState)();return(0,G.useAsyncEffect)(async s=>{if(e){let r=await Promise.allSettled(e?.map(({name:o})=>J.SchemaCache.instance.get(o)));s()&&a(r.map(o=>o.status==="fulfilled"?o.value?.payload:void 0).filter(o=>o!=null))}},[e]),t};var _=require("@xylabs/react-async-effect"),K=require("@xyo-network/diviner-schema-list-model"),U=require("@xyo-network/react-diviner"),p=require("react"),de=(e,t="SchemaListDiviner")=>{let[a,s]=(0,p.useState)(),[r,o]=(0,p.useState)(),[n,i]=(0,U.useWeakDivinerFromNode)(t),f=(0,p.useMemo)(()=>e?[{address:e,schema:K.SchemaListQuerySchema}]:void 0,[e]);return(0,p.useEffect)(()=>{n===null&&(s(null),o(void 0))},[n]),(0,_.useAsyncEffect)(async c=>{let S=n?.deref();if(S)try{let l=await S.divine(f);c()&&(s(l?.[0]),o(void 0))}catch(l){o(l),s(void 0)}},[n,i,f]),[a,r]};var X=require("@xylabs/react-async-effect"),I=require("@xyo-network/diviner-schema-stats-model"),Z=require("@xyo-network/node-core-types"),$=require("@xyo-network/payload-model"),j=require("@xyo-network/react-diviner"),P=require("react"),b=(e,t=Z.TYPES.SchemaStatsDiviner)=>{let[a,s]=(0,P.useState)(1),[r,o]=(0,j.useWeakDivinerFromNode)(t),[n,i]=(0,P.useState)(),f=()=>s(m=>m+1),[c,S]=(0,P.useState)(),l=(0,P.useMemo)(()=>({address:e,schema:I.SchemaStatsQuerySchema}),[e]);return(0,X.useAsyncEffect)(async m=>{let y=r?.deref();if(y)if(o)m()&&(i(o),S(void 0));else try{let v=(await y.divine([l])).filter((0,$.isPayloadOfSchemaTypeWithMeta)(I.SchemaStatsDivinerSchema));m()&&(S(v),i(void 0))}catch(v){i(v),S(void 0)}},[r,a,o,l]),[c,n,f]};var te=require("react/jsx-runtime"),A=({defaultSchema:e,knownSchemaList:t=[],...a})=>{let[s,r]=(0,g.useState)(e),[o,n]=(0,g.useState)(t),[i]=b();return(0,g.useEffect)(()=>{if(i){let f=(0,ee.compact)(i.map(({name:c})=>c));n(f)}},[i]),(0,te.jsx)(u.Provider,{value:{provided:!0,schema:s,schemaList:t??o,setSchema:r,setSchemaList:n},...a})};var k=require("react"),oe=require("react-router-dom");var re=require("@xyo-network/react-shared");var w=(e=!1)=>(0,re.useContextEx)(u,"Schema",e);var N=require("react/jsx-runtime"),ue=({children:e})=>{let{schema:t,setSchema:a,schemaList:s}=w(),[r,o]=(0,oe.useSearchParams)(),n=r.get("schema"),i=(0,k.useCallback)(c=>{c?(r.set("schema",c),o(r,{replace:!0}),a?.(c)):r.delete("network")},[r,o,a]),f=(0,k.useCallback)(c=>{i(c),a?.(c)},[i,a]);return(0,k.useEffect)(()=>{n!==t&&(n===void 0&&t!==void 0?f(t):n&&a?.(n))},[n,t,i,a,f]),(0,N.jsx)(u.Provider,{value:{provided:!0,schema:t,schemaList:s,setSchema:f},children:e})},pe=({knownSchemaList:e,defaultSchema:t,...a})=>(0,N.jsx)(A,{knownSchemaList:e,defaultSchema:t,children:(0,N.jsx)(ue,{...a})});var E=require("react/jsx-runtime"),ye=({onChange:e,variant:t="outlined",...a})=>{let{schema:s,setSchema:r,schemaList:o}=w(!1);return(0,E.jsxs)(ae.SelectEx,{variant:t,size:"small",value:s??"none",onChange:(n,i)=>{n.target.value!==s&&(e?.(n,i),r?.(n.target.value))},renderValue:n=>(0,E.jsx)(M.Typography,{children:n==="none"?"- None -":n}),...a,children:[o?.map((n,i)=>(0,E.jsx)(M.MenuItem,{value:n,children:n},i)),(0,E.jsx)(M.MenuItem,{value:"none",children:"- None -"},"none")]})};
|
|
357
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../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":["export * from './components'\nexport * from './contexts'\nexport * from './hooks'\n","import { NewReleases as NewReleasesIcon, OpenInNew as OpenInNewIcon, Verified as VerifiedIcon } from '@mui/icons-material'\nimport { IconButton } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { LinkEx } from '@xylabs/react-link'\nimport { EventDispatch, EventNoun, useEvent } from '@xyo-network/react-event'\nimport { Property, PropertyProps, PropertyValue } from '@xyo-network/react-property'\nimport { SchemaCache, SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { forwardRef, 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 // eslint-disable-next-line react-hooks/exhaustive-deps\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 = forwardRef<HTMLDivElement, SchemaPropertyProps>(\n ({ showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props }, forwardedRef) => {\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 ref={forwardedRef} title=\"Schema\" value={value} tip=\"Schema sent with the payload\" titleProps={titleProps} {...props}>\n {value && showStatusIcon ?\n resolvedSchema === null ?\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch)}>\n <NewReleasesIcon color=\"warning\" fontSize=\"inherit\" />\n </IconButton>\n : resolvedSchema === undefined ?\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch)}>\n <NewReleasesIcon color=\"disabled\" fontSize=\"inherit\" />\n </IconButton>\n : <IconButton rel=\"noopener noreferrer\" size=\"small\" target=\"_blank\" href={resolvedSchema?.huri?.href ?? ''}>\n <VerifiedIcon color=\"success\" fontSize=\"inherit\" />\n </IconButton>\n\n : null}\n {value ?\n <>\n {showLinkNames ?\n <LinkEx display=\"block\" width=\"100%\" sx={{ cursor: 'pointer' }}>\n <PropertyValue ref={divRef} value={value} title=\"view schema\" onClick={() => onClick(divDispatch)} />\n </LinkEx>\n : <PropertyValue ref={divRef} value={value} title=\"view schema\" onClick={() => onClick(divDispatch)} />}\n {showOpenNewWindowLink ?\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch, true)}>\n <OpenInNewIcon fontSize=\"inherit\" />\n </IconButton>\n : null}\n </>\n : null}\n </Property>\n )\n },\n)\n\nSchemaProperty.displayName = 'SchemaProperty'\n","import { MenuItem, Typography } from '@mui/material'\nimport { SelectEx, SelectExProps } from '@xylabs/react-select'\n\nimport { useSchema } from '../../contexts'\n\nexport type SchemaSelectExProps = SelectExProps<string>\n\nexport const SchemaSelectEx: React.FC<SchemaSelectExProps> = ({ onChange, variant = 'outlined', ...props }) => {\n const { schema, setSchema, schemaList } = 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 '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { ModuleError, ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { SchemaCache, SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { 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<ModuleError>()\n const [schemaCacheEntry, setSchemaCacheEntry] = useState<SchemaCacheEntry | null | undefined>()\n const [schemaLocal, setSchemaLocal] = useState<string>()\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\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({ message: error.message, schema: ModuleErrorSchema, sources: [] })\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 { 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 // eslint-disable-next-line react-hooks/exhaustive-deps\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 { Address } from '@xylabs/hex'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { SchemaListPayload, SchemaListQueryPayload, SchemaListQuerySchema } from '@xyo-network/diviner-schema-list-model'\nimport { WithMeta } from '@xyo-network/payload-model'\nimport { useWeakDivinerFromNode } from '@xyo-network/react-diviner'\nimport { useEffect, useMemo, useState } from 'react'\n\nexport const useSchemaList = (address?: Address, nameOrAddress = 'SchemaListDiviner'): [SchemaListPayload | null | undefined, Error | undefined] => {\n const [schemaList, setSchemaList] = useState<SchemaListPayload | null>()\n const [error, setError] = useState<Error>()\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 useEffect(() => {\n if (diviner === null) {\n setSchemaList(null)\n setError(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps, require-await\n async (mounted) => {\n const divinerInstance = diviner?.deref()\n if (divinerInstance) {\n try {\n const response = (await divinerInstance.divine(query)) as WithMeta<SchemaListPayload>[]\n if (mounted()) {\n setSchemaList(response?.[0])\n setError(undefined)\n }\n } catch (e) {\n setError(e as Error)\n setSchemaList(undefined)\n }\n }\n },\n [diviner, divinerError, query],\n )\n return [schemaList, error]\n}\n","import { Address } from '@xylabs/hex'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport {\n SchemaStatsDivinerSchema,\n SchemaStatsPayload,\n SchemaStatsQueryPayload,\n SchemaStatsQuerySchema,\n} from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { isPayloadOfSchemaTypeWithMeta, WithMeta, WithSources } from '@xyo-network/payload-model'\nimport { useWeakDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, 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<WithMeta<SchemaStatsPayload>>[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\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(isPayloadOfSchemaTypeWithMeta(SchemaStatsDivinerSchema)) as WithSources<\n WithMeta<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 { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = 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 return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,4BAAqG;AACrG,sBAA2B;AAC3B,gCAA+B;AAC/B,wBAAuB;AACvB,yBAAmD;AACnD,4BAAuD;AACvD,0BAA8C;AAC9C,mBAAqC;AAgDvB;AAvCd,IAAM,mBAAmB,CAAC,WAAoB;AAC5C,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAkC;AAC5D;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,QAAQ;AACV,cAAMA,SAAQ,MAAM,gCAAY,SAAS,IAAI,MAAM;AACnD,YAAI,QAAQ,GAAG;AACb,mBAASA,MAAK;AAAA,QAChB;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,MAAM;AAAA,EACT;AACA,SAAO;AACT;AAEO,IAAM,qBAAiB;AAAA,EAC5B,CAAC,EAAE,gBAAgB,MAAM,wBAAwB,MAAM,iBAAiB,MAAM,YAAY,OAAO,GAAG,MAAM,GAAG,iBAAiB;AAC5H,UAAM,iBAAiB,iBAAiB,KAAK;AAC7C,UAAM,CAAC,WAAW,cAAc,QAAI,6BAA4B;AAChE,UAAM,CAAC,QAAQ,WAAW,QAAI,6BAAyB;AAEvD,UAAM,UAAU,CAAC,UAAsD,gBAAgB,UAAU;AAC/F;AAAA,QACE;AAAA,QACA;AAAA,QACA,KAAK,UAAU;AAAA,UACb;AAAA,UACA,QAAQ;AAAA,QACV,CAAC;AAAA,MACH;AAAA,IACF;AAEA,WACE,6CAAC,kCAAS,KAAK,cAAc,OAAM,UAAS,OAAc,KAAI,gCAA+B,YAAyB,GAAG,OACtH;AAAA,eAAS,iBACR,mBAAmB,OACjB,4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con","VerifiedIcon","OpenInNewIcon","import_material","import_react","import_react_async_effect","import_schema_cache","import_react","schemaCacheEntry","import_react_async_effect","import_schema_cache","import_react","import_react_async_effect","import_react","import_react_async_effect","import_payload_model","import_react_diviner","import_react","import_jsx_runtime","schemaList","import_react","import_react_shared","import_jsx_runtime","schema","import_jsx_runtime","schema"]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../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":["export * from './components'\nexport * from './contexts'\nexport * from './hooks'\n","import { NewReleases as NewReleasesIcon, OpenInNew as OpenInNewIcon, Verified as VerifiedIcon } from '@mui/icons-material'\nimport { IconButton } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { LinkEx } from '@xylabs/react-link'\nimport { EventDispatch, EventNoun, useEvent } from '@xyo-network/react-event'\nimport { Property, PropertyProps, PropertyValue } from '@xyo-network/react-property'\nimport { SchemaCache, SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { forwardRef, 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 // eslint-disable-next-line react-hooks/exhaustive-deps\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 = forwardRef<HTMLDivElement, SchemaPropertyProps>(\n ({ showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props }, forwardedRef) => {\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 ref={forwardedRef} title=\"Schema\" value={value} tip=\"Schema sent with the payload\" titleProps={titleProps} {...props}>\n {value && showStatusIcon ?\n resolvedSchema === null ?\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch)}>\n <NewReleasesIcon color=\"warning\" fontSize=\"inherit\" />\n </IconButton>\n : resolvedSchema === undefined ?\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch)}>\n <NewReleasesIcon color=\"disabled\" fontSize=\"inherit\" />\n </IconButton>\n : <IconButton rel=\"noopener noreferrer\" size=\"small\" target=\"_blank\" href={resolvedSchema?.huri?.href ?? ''}>\n <VerifiedIcon color=\"success\" fontSize=\"inherit\" />\n </IconButton>\n\n : null}\n {value ?\n <>\n {showLinkNames ?\n <LinkEx display=\"block\" width=\"100%\" sx={{ cursor: 'pointer' }}>\n <PropertyValue ref={divRef} value={value} title=\"view schema\" onClick={() => onClick(divDispatch)} />\n </LinkEx>\n : <PropertyValue ref={divRef} value={value} title=\"view schema\" onClick={() => onClick(divDispatch)} />}\n {showOpenNewWindowLink ?\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch, true)}>\n <OpenInNewIcon fontSize=\"inherit\" />\n </IconButton>\n : null}\n </>\n : null}\n </Property>\n )\n },\n)\n\nSchemaProperty.displayName = 'SchemaProperty'\n","import { MenuItem, Typography } from '@mui/material'\nimport { SelectEx, SelectExProps } from '@xylabs/react-select'\n\nimport { useSchema } from '../../contexts'\n\nexport type SchemaSelectExProps = SelectExProps<string>\n\nexport const SchemaSelectEx: React.FC<SchemaSelectExProps> = ({ onChange, variant = 'outlined', ...props }) => {\n const { schema, setSchema, schemaList } = 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 '@xyo-network/react-shared'\n\nimport { SchemaContextState } from './State'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { compact } from '@xylabs/lodash'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEffect, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks'\nimport { SchemaContext } from '../Context'\nimport { SchemaProviderProps } from './Props'\n\nexport const SchemaMemoryProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ defaultSchema, knownSchemaList = [], ...props }) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useEffect(() => {\n if (fetchedSchemaStats) {\n const schemaList = compact(fetchedSchemaStats.map(({ name }) => name))\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n return <SchemaContext.Provider value={{ provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport { ModuleError, ModuleErrorSchema } from '@xyo-network/payload-model'\nimport { SchemaCache, SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { 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<ModuleError>()\n const [schemaCacheEntry, setSchemaCacheEntry] = useState<SchemaCacheEntry | null | undefined>()\n const [schemaLocal, setSchemaLocal] = useState<string>()\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\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({ message: error.message, schema: ModuleErrorSchema, sources: [] })\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 { 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 // eslint-disable-next-line react-hooks/exhaustive-deps\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 { Address } from '@xylabs/hex'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { SchemaListPayload, SchemaListQueryPayload, SchemaListQuerySchema } from '@xyo-network/diviner-schema-list-model'\nimport { WithMeta } from '@xyo-network/payload-model'\nimport { useWeakDivinerFromNode } from '@xyo-network/react-diviner'\nimport { useEffect, useMemo, useState } from 'react'\n\nexport const useSchemaList = (address?: Address, nameOrAddress = 'SchemaListDiviner'): [SchemaListPayload | null | undefined, Error | undefined] => {\n const [schemaList, setSchemaList] = useState<SchemaListPayload | null>()\n const [error, setError] = useState<Error>()\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 useEffect(() => {\n if (diviner === null) {\n setSchemaList(null)\n setError(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps, require-await\n async (mounted) => {\n const divinerInstance = diviner?.deref()\n if (divinerInstance) {\n try {\n const response = (await divinerInstance.divine(query)) as WithMeta<SchemaListPayload>[]\n if (mounted()) {\n setSchemaList(response?.[0])\n setError(undefined)\n }\n } catch (e) {\n setError(e as Error)\n setSchemaList(undefined)\n }\n }\n },\n [diviner, divinerError, query],\n )\n return [schemaList, error]\n}\n","import { Address } from '@xylabs/hex'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport {\n SchemaStatsDivinerSchema,\n SchemaStatsPayload,\n SchemaStatsQueryPayload,\n SchemaStatsQuerySchema,\n} from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { isPayloadOfSchemaTypeWithMeta, WithMeta, WithSources } from '@xyo-network/payload-model'\nimport { useWeakDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, 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<WithMeta<SchemaStatsPayload>>[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\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(isPayloadOfSchemaTypeWithMeta(SchemaStatsDivinerSchema)) as WithSources<\n WithMeta<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 { WithChildren } from '@xylabs/react-shared'\nimport { useCallback, useEffect } from 'react'\nimport { useSearchParams } from 'react-router-dom'\n\nimport { SchemaContext } from '../Context'\nimport { useSchema } from '../use'\nimport { SchemaMemoryProvider } from './Memory'\nimport { SchemaProviderProps } from './Props'\n\nconst SchemaRouteProviderInner: React.FC<WithChildren> = ({ children }) => {\n const { schema, setSchema, schemaList } = 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 return <SchemaContext.Provider value={{ provided: true, schema, schemaList, setSchema: setSchemaLocal }}>{children}</SchemaContext.Provider>\n}\n\nexport const SchemaRouteProvider: React.FC<WithChildren<SchemaProviderProps>> = ({ knownSchemaList, defaultSchema, ...props }) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SchemaContext } from './Context'\nimport { SchemaContextState } from './State'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n"],"mappings":"mbAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,mBAAAE,EAAA,yBAAAC,EAAA,mBAAAC,EAAA,wBAAAC,GAAA,mBAAAC,GAAA,wBAAAC,GAAA,cAAAC,EAAA,yBAAAC,GAAA,kBAAAC,GAAA,mBAAAC,IAAA,eAAAC,GAAAZ,ICAA,IAAAa,EAAqG,+BACrGC,EAA2B,yBAC3BC,EAA+B,sCAC/BC,EAAuB,8BACvBC,EAAmD,oCACnDC,EAAuD,uCAC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,EAAgBN,CAAS,CAC5B,EAGA,sBAAU,IAAM,CACVK,IAAgBN,IACdM,IAAgB,QAAaN,IAAW,OAE1CQ,EAAeR,CAAM,EACZM,GAETL,IAAYK,CAAW,EAG7B,EAAG,CAACA,EAAaN,EAAQO,EAAgBN,EAAWO,CAAc,CAAC,KAE5D,OAACC,EAAc,SAAd,CAAuB,MAAO,CAAE,SAAU,GAAM,OAAAT,EAAQ,WAAAE,EAAY,UAAWM,CAAe,EAAI,SAAAT,EAAS,CACrH,EAEaW,GAAmE,CAAC,CAAE,gBAAAC,EAAiB,cAAAC,EAAe,GAAGC,CAAM,OAExH,OAACC,EAAA,CAAqB,gBAAiBH,EAAiB,cAAeC,EACrE,mBAACd,GAAA,CAA0B,GAAGe,EAAO,EACvC,EPhDA,IAAAE,EAAA,6BAJSC,GAAgD,CAAC,CAAE,SAAAC,EAAU,QAAAC,EAAU,WAAY,GAAGC,CAAM,IAAM,CAC7G,GAAM,CAAE,OAAAC,EAAQ,UAAAC,EAAW,WAAAC,CAAW,EAAIC,EAAU,EAAK,EAEzD,SACE,QAAC,aACC,QAASL,EACT,KAAK,QACL,MAAOE,GAAU,OACjB,SAAU,CAACI,EAAOC,IAAU,CACtBD,EAAM,OAAO,QAAUJ,IACzBH,IAAWO,EAAOC,CAAK,EACvBJ,IAAYG,EAAM,OAAO,KAAK,EAElC,EACA,YAAcE,MACL,OAAC,cAAY,SAAAA,IAAU,OAAS,WAAaA,EAAM,EAE3D,GAAGP,EAEH,UAAAG,GAAY,IAAI,CAACF,EAAQO,OAEtB,OAAC,YAAqB,MAAOP,EAC1B,SAAAA,GADYO,CAEf,CAEH,KACD,OAAC,YAAoB,MAAM,OAAO,qBAApB,MAEd,GACF,CAEJ","names":["src_exports","__export","SchemaContext","SchemaMemoryProvider","SchemaProperty","SchemaRouteProvider","SchemaSelectEx","useGetSchemaPayload","useSchema","useSchemaDefinitions","useSchemaList","useSchemaStats","__toCommonJS","import_icons_material","import_material","import_react_async_effect","import_react_link","import_react_event","import_react_property","import_schema_cache","import_react","import_jsx_runtime","useResolveSchema","schema","entry","setEntry","mounted","SchemaProperty","showLinkNames","showOpenNewWindowLink","showStatusIcon","titleProps","value","props","forwardedRef","resolvedSchema","buttonRef","buttonDispatch","divRef","divDispatch","onClick","dispatch","openNewWindow","NewReleasesIcon","VerifiedIcon","OpenInNewIcon","import_material","import_react_select","import_react_shared","SchemaContext","import_lodash","import_react","import_react_async_effect","import_payload_builder","import_payload_model","import_schema_cache","import_react","useGetSchemaPayload","schema","notFound","setNotFound","xyoError","setError","schemaCacheEntry","setSchemaCacheEntry","schemaLocal","setSchemaLocal","mounted","firstRequest","schemaChanged","e","error","import_react_async_effect","import_schema_cache","import_react","useSchemaDefinitions","schemaList","schemaPayloads","setSchemaPayloads","mounted","promiseResults","name","result","item","import_react_async_effect","import_diviner_schema_list_model","import_react_diviner","import_react","useSchemaList","address","nameOrAddress","schemaList","setSchemaList","error","setError","diviner","divinerError","query","mounted","divinerInstance","response","e","import_react_async_effect","import_diviner_schema_stats_model","import_node_core_types","import_payload_model","import_react_diviner","import_react","useSchemaStats","statsAddress","nameOrAddress","refresh","setRefresh","diviner","divinerError","error","setError","refreshHistory","previous","schemaList","setSchemaList","query","mounted","instance","schemas","ex","import_jsx_runtime","SchemaMemoryProvider","defaultSchema","knownSchemaList","props","schema","setSchema","schemaList","setSchemaList","fetchedSchemaStats","useSchemaStats","name","SchemaContext","import_react","import_react_router_dom","import_react_shared","useSchema","required","SchemaContext","import_jsx_runtime","SchemaRouteProviderInner","children","schema","setSchema","schemaList","useSchema","params","setParams","routeSchema","setSchemaParam","setSchemaLocal","SchemaContext","SchemaRouteProvider","knownSchemaList","defaultSchema","props","SchemaMemoryProvider","import_jsx_runtime","SchemaSelectEx","onChange","variant","props","schema","setSchema","schemaList","useSchema","event","child","value","index"]}
|