@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.
Files changed (49) hide show
  1. package/dist/browser/contexts/Schema/State.d.cts +0 -4
  2. package/dist/browser/contexts/Schema/State.d.cts.map +1 -1
  3. package/dist/browser/contexts/Schema/State.d.mts +0 -4
  4. package/dist/browser/contexts/Schema/State.d.mts.map +1 -1
  5. package/dist/browser/contexts/Schema/State.d.ts +0 -4
  6. package/dist/browser/contexts/Schema/State.d.ts.map +1 -1
  7. package/dist/browser/hooks/useGetSchema.d.cts +0 -3
  8. package/dist/browser/hooks/useGetSchema.d.cts.map +1 -1
  9. package/dist/browser/hooks/useGetSchema.d.mts +0 -3
  10. package/dist/browser/hooks/useGetSchema.d.mts.map +1 -1
  11. package/dist/browser/hooks/useGetSchema.d.ts +0 -3
  12. package/dist/browser/hooks/useGetSchema.d.ts.map +1 -1
  13. package/dist/browser/index.cjs +1 -356
  14. package/dist/browser/index.cjs.map +1 -1
  15. package/dist/browser/index.js +1 -336
  16. package/dist/browser/index.js.map +1 -1
  17. package/dist/neutral/contexts/Schema/State.d.cts +0 -4
  18. package/dist/neutral/contexts/Schema/State.d.cts.map +1 -1
  19. package/dist/neutral/contexts/Schema/State.d.mts +0 -4
  20. package/dist/neutral/contexts/Schema/State.d.mts.map +1 -1
  21. package/dist/neutral/contexts/Schema/State.d.ts +0 -4
  22. package/dist/neutral/contexts/Schema/State.d.ts.map +1 -1
  23. package/dist/neutral/hooks/useGetSchema.d.cts +0 -3
  24. package/dist/neutral/hooks/useGetSchema.d.cts.map +1 -1
  25. package/dist/neutral/hooks/useGetSchema.d.mts +0 -3
  26. package/dist/neutral/hooks/useGetSchema.d.mts.map +1 -1
  27. package/dist/neutral/hooks/useGetSchema.d.ts +0 -3
  28. package/dist/neutral/hooks/useGetSchema.d.ts.map +1 -1
  29. package/dist/neutral/index.cjs +1 -356
  30. package/dist/neutral/index.cjs.map +1 -1
  31. package/dist/neutral/index.js +1 -336
  32. package/dist/neutral/index.js.map +1 -1
  33. package/dist/node/contexts/Schema/State.d.cts +0 -4
  34. package/dist/node/contexts/Schema/State.d.cts.map +1 -1
  35. package/dist/node/contexts/Schema/State.d.mts +0 -4
  36. package/dist/node/contexts/Schema/State.d.mts.map +1 -1
  37. package/dist/node/contexts/Schema/State.d.ts +0 -4
  38. package/dist/node/contexts/Schema/State.d.ts.map +1 -1
  39. package/dist/node/hooks/useGetSchema.d.cts +0 -3
  40. package/dist/node/hooks/useGetSchema.d.cts.map +1 -1
  41. package/dist/node/hooks/useGetSchema.d.mts +0 -3
  42. package/dist/node/hooks/useGetSchema.d.mts.map +1 -1
  43. package/dist/node/hooks/useGetSchema.d.ts +0 -3
  44. package/dist/node/hooks/useGetSchema.d.ts.map +1 -1
  45. package/dist/node/index.cjs +1 -373
  46. package/dist/node/index.cjs.map +1 -1
  47. package/dist/node/index.js +1 -340
  48. package/dist/node/index.js.map +1 -1
  49. package/package.json +11 -11
@@ -1,374 +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
- var _a;
65
- const resolvedSchema = useResolveSchema(value);
66
- const [buttonRef, buttonDispatch] = (0, import_react_event.useEvent)();
67
- const [divRef, divDispatch] = (0, import_react_event.useEvent)();
68
- const onClick = (dispatch, openNewWindow = false) => {
69
- dispatch == null ? void 0 : dispatch(
70
- "schema",
71
- "click",
72
- JSON.stringify({
73
- openNewWindow,
74
- schema: value
75
- })
76
- );
77
- };
78
- 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: [
79
- 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: ((_a = resolvedSchema == null ? void 0 : resolvedSchema.huri) == null ? void 0 : _a.href) ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Verified, { color: "success", fontSize: "inherit" }) }) : null,
80
- value ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
81
- 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) }),
82
- 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
83
- ] }) : null
84
- ] });
85
- }
86
- );
87
- SchemaProperty.displayName = "SchemaProperty";
88
-
89
- // src/components/SelectEx/SchemaSelectEx.tsx
90
- var import_material2 = require("@mui/material");
91
- var import_react_select = require("@xylabs/react-select");
92
-
93
- // src/contexts/Schema/Context.ts
94
- var import_react_shared = require("@xyo-network/react-shared");
95
- var SchemaContext = (0, import_react_shared.createContextEx)();
96
-
97
- // src/contexts/Schema/Provider/Memory.tsx
98
- var import_lodash = require("@xylabs/lodash");
99
- var import_react6 = require("react");
100
-
101
- // src/hooks/useGetSchema.tsx
102
- var import_react_async_effect2 = require("@xylabs/react-async-effect");
103
- var import_payload_builder = require("@xyo-network/payload-builder");
104
- var import_payload_model = require("@xyo-network/payload-model");
105
- var import_schema_cache2 = require("@xyo-network/schema-cache");
106
- var import_react2 = require("react");
107
- var useGetSchemaPayload = (schema) => {
108
- const [notFound, setNotFound] = (0, import_react2.useState)(false);
109
- const [xyoError, setError] = (0, import_react2.useState)();
110
- const [schemaCacheEntry, setSchemaCacheEntry] = (0, import_react2.useState)();
111
- const [schemaLocal, setSchemaLocal] = (0, import_react2.useState)();
112
- (0, import_react_async_effect2.useAsyncEffect)(
113
- // eslint-disable-next-line react-hooks/exhaustive-deps
114
- async (mounted) => {
115
- const firstRequest = !notFound && !schemaCacheEntry && !xyoError;
116
- const schemaChanged = schema !== schemaLocal;
117
- if (schema && firstRequest || schema && schemaChanged) {
118
- try {
119
- const schemaCacheEntry2 = await import_schema_cache2.SchemaCache.instance.get(schema);
120
- if (mounted()) {
121
- setSchemaCacheEntry(schemaCacheEntry2);
122
- setNotFound(schemaCacheEntry2 === null || schemaCacheEntry2 === void 0);
123
- }
124
- } catch (e) {
125
- const error = e;
126
- console.error(e);
127
- if (mounted()) {
128
- setError({ message: error.message, schema: import_payload_model.ModuleErrorSchema, sources: [] });
129
- }
130
- }
131
- }
132
- if (schemaChanged) {
133
- setSchemaLocal(schema);
134
- }
135
- },
136
- [xyoError, notFound, schema, schemaLocal, schemaCacheEntry]
137
- );
138
- return {
139
- notFound,
140
- schemaHuri: schemaCacheEntry == null ? void 0 : schemaCacheEntry.huri,
141
- schemaPayload: schemaCacheEntry ? new import_payload_builder.PayloadBuilder(schemaCacheEntry == null ? void 0 : schemaCacheEntry.payload).fields(schemaCacheEntry.payload).build() : schemaCacheEntry,
142
- xyoError
143
- };
144
- };
145
-
146
- // src/hooks/useSchemaDefinitions.tsx
147
- var import_react_async_effect3 = require("@xylabs/react-async-effect");
148
- var import_schema_cache3 = require("@xyo-network/schema-cache");
149
- var import_react3 = require("react");
150
- var useSchemaDefinitions = (schemaList) => {
151
- const [schemaPayloads, setSchemaPayloads] = (0, import_react3.useState)();
152
- (0, import_react_async_effect3.useAsyncEffect)(
153
- // eslint-disable-next-line react-hooks/exhaustive-deps
154
- async (mounted) => {
155
- if (schemaList) {
156
- const promiseResults = await Promise.allSettled(schemaList == null ? void 0 : schemaList.map(({ name }) => import_schema_cache3.SchemaCache.instance.get(name)));
157
- if (mounted()) {
158
- setSchemaPayloads(
159
- promiseResults.map((result) => {
160
- var _a;
161
- return result.status === "fulfilled" ? (_a = result.value) == null ? void 0 : _a.payload : void 0;
162
- }).filter((item) => item !== void 0 && item !== null)
163
- );
164
- }
165
- }
166
- },
167
- [schemaList]
168
- );
169
- return schemaPayloads;
170
- };
171
-
172
- // src/hooks/useSchemaList.tsx
173
- var import_react_async_effect4 = require("@xylabs/react-async-effect");
174
- var import_diviner_schema_list_model = require("@xyo-network/diviner-schema-list-model");
175
- var import_react_diviner = require("@xyo-network/react-diviner");
176
- var import_react4 = require("react");
177
- var useSchemaList = (address, nameOrAddress = "SchemaListDiviner") => {
178
- const [schemaList, setSchemaList] = (0, import_react4.useState)();
179
- const [error, setError] = (0, import_react4.useState)();
180
- const [diviner, divinerError] = (0, import_react_diviner.useWeakDivinerFromNode)(nameOrAddress);
181
- const query = (0, import_react4.useMemo)(
182
- () => address ? [
183
- {
184
- address,
185
- schema: import_diviner_schema_list_model.SchemaListQuerySchema
186
- }
187
- ] : void 0,
188
- [address]
189
- );
190
- (0, import_react4.useEffect)(() => {
191
- if (diviner === null) {
192
- setSchemaList(null);
193
- setError(void 0);
194
- }
195
- }, [diviner]);
196
- (0, import_react_async_effect4.useAsyncEffect)(
197
- // eslint-disable-next-line react-hooks/exhaustive-deps, require-await
198
- async (mounted) => {
199
- const divinerInstance = diviner == null ? void 0 : diviner.deref();
200
- if (divinerInstance) {
201
- try {
202
- const response = await divinerInstance.divine(query);
203
- if (mounted()) {
204
- setSchemaList(response == null ? void 0 : response[0]);
205
- setError(void 0);
206
- }
207
- } catch (e) {
208
- setError(e);
209
- setSchemaList(void 0);
210
- }
211
- }
212
- },
213
- [diviner, divinerError, query]
214
- );
215
- return [schemaList, error];
216
- };
217
-
218
- // src/hooks/useSchemaStats.tsx
219
- var import_react_async_effect5 = require("@xylabs/react-async-effect");
220
- var import_diviner_schema_stats_model = require("@xyo-network/diviner-schema-stats-model");
221
- var import_node_core_types = require("@xyo-network/node-core-types");
222
- var import_payload_model2 = require("@xyo-network/payload-model");
223
- var import_react_diviner2 = require("@xyo-network/react-diviner");
224
- var import_react5 = require("react");
225
- var useSchemaStats = (statsAddress, nameOrAddress = import_node_core_types.TYPES.SchemaStatsDiviner) => {
226
- const [refresh, setRefresh] = (0, import_react5.useState)(1);
227
- const [diviner, divinerError] = (0, import_react_diviner2.useWeakDivinerFromNode)(nameOrAddress);
228
- const [error, setError] = (0, import_react5.useState)();
229
- const refreshHistory = () => setRefresh((previous) => previous + 1);
230
- const [schemaList, setSchemaList] = (0, import_react5.useState)();
231
- const query = (0, import_react5.useMemo)(
232
- () => ({
233
- address: statsAddress,
234
- schema: import_diviner_schema_stats_model.SchemaStatsQuerySchema
235
- }),
236
- [statsAddress]
237
- );
238
- (0, import_react_async_effect5.useAsyncEffect)(
239
- // eslint-disable-next-line react-hooks/exhaustive-deps
240
- async (mounted) => {
241
- const instance = diviner == null ? void 0 : diviner.deref();
242
- if (instance) {
243
- if (divinerError) {
244
- if (mounted()) {
245
- setError(divinerError);
246
- setSchemaList(void 0);
247
- }
248
- } else {
249
- try {
250
- const schemas = (await instance.divine([query])).filter((0, import_payload_model2.isPayloadOfSchemaTypeWithMeta)(import_diviner_schema_stats_model.SchemaStatsDivinerSchema));
251
- if (mounted()) {
252
- setSchemaList(schemas);
253
- setError(void 0);
254
- }
255
- } catch (ex) {
256
- setError(ex);
257
- setSchemaList(void 0);
258
- }
259
- }
260
- }
261
- },
262
- [diviner, refresh, divinerError, query]
263
- );
264
- return [schemaList, error, refreshHistory];
265
- };
266
-
267
- // src/contexts/Schema/Provider/Memory.tsx
268
- var import_jsx_runtime2 = require("react/jsx-runtime");
269
- var SchemaMemoryProvider = ({ defaultSchema, knownSchemaList = [], ...props }) => {
270
- const [schema, setSchema] = (0, import_react6.useState)(defaultSchema);
271
- const [schemaList, setSchemaList] = (0, import_react6.useState)(knownSchemaList);
272
- const [fetchedSchemaStats] = useSchemaStats();
273
- (0, import_react6.useEffect)(() => {
274
- if (fetchedSchemaStats) {
275
- const schemaList2 = (0, import_lodash.compact)(fetchedSchemaStats.map(({ name }) => name));
276
- setSchemaList(schemaList2);
277
- }
278
- }, [fetchedSchemaStats]);
279
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SchemaContext.Provider, { value: { provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }, ...props });
280
- };
281
-
282
- // src/contexts/Schema/Provider/Route.tsx
283
- var import_react7 = require("react");
284
- var import_react_router_dom = require("react-router-dom");
285
-
286
- // src/contexts/Schema/use.ts
287
- var import_react_shared2 = require("@xyo-network/react-shared");
288
- var useSchema = (required = false) => {
289
- return (0, import_react_shared2.useContextEx)(SchemaContext, "Schema", required);
290
- };
291
-
292
- // src/contexts/Schema/Provider/Route.tsx
293
- var import_jsx_runtime3 = require("react/jsx-runtime");
294
- var SchemaRouteProviderInner = ({ children }) => {
295
- const { schema, setSchema, schemaList } = useSchema();
296
- const [params, setParams] = (0, import_react_router_dom.useSearchParams)();
297
- const routeSchema = params.get("schema");
298
- const setSchemaParam = (0, import_react7.useCallback)(
299
- (schema2) => {
300
- if (schema2) {
301
- params.set("schema", schema2);
302
- setParams(params, { replace: true });
303
- setSchema == null ? void 0 : setSchema(schema2);
304
- } else {
305
- params.delete("network");
306
- }
307
- },
308
- [params, setParams, setSchema]
309
- );
310
- const setSchemaLocal = (0, import_react7.useCallback)(
311
- (schema2) => {
312
- setSchemaParam(schema2);
313
- setSchema == null ? void 0 : setSchema(schema2);
314
- },
315
- [setSchemaParam, setSchema]
316
- );
317
- (0, import_react7.useEffect)(() => {
318
- if (routeSchema !== schema) {
319
- if (routeSchema === void 0 && schema !== void 0) {
320
- setSchemaLocal(schema);
321
- } else if (routeSchema) {
322
- setSchema == null ? void 0 : setSchema(routeSchema);
323
- }
324
- }
325
- }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal]);
326
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SchemaContext.Provider, { value: { provided: true, schema, schemaList, setSchema: setSchemaLocal }, children });
327
- };
328
- var SchemaRouteProvider = ({ knownSchemaList, defaultSchema, ...props }) => {
329
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SchemaMemoryProvider, { knownSchemaList, defaultSchema, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SchemaRouteProviderInner, { ...props }) });
330
- };
331
-
332
- // src/components/SelectEx/SchemaSelectEx.tsx
333
- var import_jsx_runtime4 = require("react/jsx-runtime");
334
- var SchemaSelectEx = ({ onChange, variant = "outlined", ...props }) => {
335
- const { schema, setSchema, schemaList } = useSchema(false);
336
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
337
- import_react_select.SelectEx,
338
- {
339
- variant,
340
- size: "small",
341
- value: schema ?? "none",
342
- onChange: (event, child) => {
343
- if (event.target.value !== schema) {
344
- onChange == null ? void 0 : onChange(event, child);
345
- setSchema == null ? void 0 : setSchema(event.target.value);
346
- }
347
- },
348
- renderValue: (value) => {
349
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material2.Typography, { children: value === "none" ? "- None -" : value });
350
- },
351
- ...props,
352
- children: [
353
- schemaList == null ? void 0 : schemaList.map((schema2, index) => {
354
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material2.MenuItem, { value: schema2, children: schema2 }, index);
355
- }),
356
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material2.MenuItem, { value: "none", children: "- None -" }, "none")
357
- ]
358
- }
359
- );
360
- };
361
- // Annotate the CommonJS export names for ESM import in node:
362
- 0 && (module.exports = {
363
- SchemaContext,
364
- SchemaMemoryProvider,
365
- SchemaProperty,
366
- SchemaRouteProvider,
367
- SchemaSelectEx,
368
- useGetSchemaPayload,
369
- useSchema,
370
- useSchemaDefinitions,
371
- useSchemaList,
372
- useSchemaStats
373
- });
1
+ "use strict";var R=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ce=Object.prototype.hasOwnProperty;var me=(e,o)=>{for(var a in o)R(e,a,{get:o[a],enumerable:!0})},fe=(e,o,a,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of se(o))!ce.call(e,t)&&t!==a&&R(e,t,{get:()=>o[t],enumerable:!(s=ie(o,t))||s.enumerable});return e};var le=e=>fe(R({},"__esModule",{value:!0}),e);var Ee={};me(Ee,{SchemaContext:()=>y,SchemaMemoryProvider:()=>A,SchemaProperty:()=>T,SchemaRouteProvider:()=>ye,SchemaSelectEx:()=>Pe,useGetSchemaPayload:()=>ue,useSchema:()=>g,useSchemaDefinitions:()=>Se,useSchemaList:()=>de,useSchemaStats:()=>b});module.exports=le(Ee);var p=require("@mui/icons-material"),v=require("@mui/material"),z=require("@xylabs/react-async-effect"),F=require("@xylabs/react-link"),D=require("@xyo-network/react-event"),C=require("@xyo-network/react-property"),B=require("@xyo-network/schema-cache"),W=require("react"),f=require("react/jsx-runtime"),he=e=>{let[o,a]=(0,W.useState)();return(0,z.useAsyncEffect)(async s=>{if(e){let t=await B.SchemaCache.instance.get(e);s()&&a(t)}},[e]),o},T=(0,W.forwardRef)(({showLinkNames:e=!0,showOpenNewWindowLink:o=!0,showStatusIcon:a=!0,titleProps:s,value:t,...r},n)=>{var S;let i=he(t),[l,c]=(0,D.useEvent)(),[u,h]=(0,D.useEvent)(),m=(d,ne=!1)=>{d==null||d("schema","click",JSON.stringify({openNewWindow:ne,schema:t}))};return(0,f.jsxs)(C.Property,{ref:n,title:"Schema",value:t,tip:"Schema sent with the payload",titleProps:s,...r,children:[t&&a?i===null?(0,f.jsx)(v.IconButton,{ref:l,size:"small",onClick:()=>m(c),children:(0,f.jsx)(p.NewReleases,{color:"warning",fontSize:"inherit"})}):i===void 0?(0,f.jsx)(v.IconButton,{ref:l,size:"small",onClick:()=>m(c),children:(0,f.jsx)(p.NewReleases,{color:"disabled",fontSize:"inherit"})}):(0,f.jsx)(v.IconButton,{rel:"noopener noreferrer",size:"small",target:"_blank",href:((S=i==null?void 0:i.huri)==null?void 0:S.href)??"",children:(0,f.jsx)(p.Verified,{color:"success",fontSize:"inherit"})}):null,t?(0,f.jsxs)(f.Fragment,{children:[e?(0,f.jsx)(F.LinkEx,{display:"block",width:"100%",sx:{cursor:"pointer"},children:(0,f.jsx)(C.PropertyValue,{ref:u,value:t,title:"view schema",onClick:()=>m(h)})}):(0,f.jsx)(C.PropertyValue,{ref:u,value:t,title:"view schema",onClick:()=>m(h)}),o?(0,f.jsx)(v.IconButton,{ref:l,size:"small",onClick:()=>m(c,!0),children:(0,f.jsx)(p.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"),y=(0,Q.createContextEx)();var ee=require("@xylabs/lodash"),w=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"),ue=e=>{let[o,a]=(0,L.useState)(!1),[s,t]=(0,L.useState)(),[r,n]=(0,L.useState)(),[i,l]=(0,L.useState)();return(0,H.useAsyncEffect)(async c=>{let u=!o&&!r&&!s,h=e!==i;if(e&&u||e&&h)try{let m=await q.SchemaCache.instance.get(e);c()&&(n(m),a(m==null))}catch(m){let S=m;console.error(m),c()&&t({message:S.message,schema:V.ModuleErrorSchema,sources:[]})}h&&l(e)},[s,o,e,i,r]),{notFound:o,schemaHuri:r==null?void 0:r.huri,schemaPayload:r&&new O.PayloadBuilder(r==null?void 0:r.payload).fields(r.payload).build(),xyoError:s}};var G=require("@xylabs/react-async-effect"),J=require("@xyo-network/schema-cache"),Y=require("react"),Se=e=>{let[o,a]=(0,Y.useState)();return(0,G.useAsyncEffect)(async s=>{if(e){let t=await Promise.allSettled(e==null?void 0:e.map(({name:r})=>J.SchemaCache.instance.get(r)));s()&&a(t.map(r=>{var n;return r.status==="fulfilled"?(n=r.value)==null?void 0:n.payload:void 0}).filter(r=>r!=null))}},[e]),o};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,o="SchemaListDiviner")=>{let[a,s]=(0,P.useState)(),[t,r]=(0,P.useState)(),[n,i]=(0,U.useWeakDivinerFromNode)(o),l=(0,P.useMemo)(()=>e?[{address:e,schema:K.SchemaListQuerySchema}]:void 0,[e]);return(0,P.useEffect)(()=>{n===null&&(s(null),r(void 0))},[n]),(0,_.useAsyncEffect)(async c=>{let u=n==null?void 0:n.deref();if(u)try{let h=await u.divine(l);c()&&(s(h==null?void 0:h[0]),r(void 0))}catch(h){r(h),s(void 0)}},[n,i,l]),[a,t]};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"),E=require("react"),b=(e,o=Z.TYPES.SchemaStatsDiviner)=>{let[a,s]=(0,E.useState)(1),[t,r]=(0,j.useWeakDivinerFromNode)(o),[n,i]=(0,E.useState)(),l=()=>s(m=>m+1),[c,u]=(0,E.useState)(),h=(0,E.useMemo)(()=>({address:e,schema:I.SchemaStatsQuerySchema}),[e]);return(0,X.useAsyncEffect)(async m=>{let S=t==null?void 0:t.deref();if(S)if(r)m()&&(i(r),u(void 0));else try{let d=(await S.divine([h])).filter((0,$.isPayloadOfSchemaTypeWithMeta)(I.SchemaStatsDivinerSchema));m()&&(u(d),i(void 0))}catch(d){i(d),u(void 0)}},[t,a,r,h]),[c,n,l]};var te=require("react/jsx-runtime"),A=({defaultSchema:e,knownSchemaList:o=[],...a})=>{let[s,t]=(0,w.useState)(e),[r,n]=(0,w.useState)(o),[i]=b();return(0,w.useEffect)(()=>{if(i){let l=(0,ee.compact)(i.map(({name:c})=>c));n(l)}},[i]),(0,te.jsx)(y.Provider,{value:{provided:!0,schema:s,schemaList:o??r,setSchema:t,setSchemaList:n},...a})};var k=require("react"),oe=require("react-router-dom");var re=require("@xyo-network/react-shared");var g=(e=!1)=>(0,re.useContextEx)(y,"Schema",e);var N=require("react/jsx-runtime"),pe=({children:e})=>{let{schema:o,setSchema:a,schemaList:s}=g(),[t,r]=(0,oe.useSearchParams)(),n=t.get("schema"),i=(0,k.useCallback)(c=>{c?(t.set("schema",c),r(t,{replace:!0}),a==null||a(c)):t.delete("network")},[t,r,a]),l=(0,k.useCallback)(c=>{i(c),a==null||a(c)},[i,a]);return(0,k.useEffect)(()=>{n!==o&&(n===void 0&&o!==void 0?l(o):n&&(a==null||a(n)))},[n,o,i,a,l]),(0,N.jsx)(y.Provider,{value:{provided:!0,schema:o,schemaList:s,setSchema:l},children:e})},ye=({knownSchemaList:e,defaultSchema:o,...a})=>(0,N.jsx)(A,{knownSchemaList:e,defaultSchema:o,children:(0,N.jsx)(pe,{...a})});var x=require("react/jsx-runtime"),Pe=({onChange:e,variant:o="outlined",...a})=>{let{schema:s,setSchema:t,schemaList:r}=g(!1);return(0,x.jsxs)(ae.SelectEx,{variant:o,size:"small",value:s??"none",onChange:(n,i)=>{n.target.value!==s&&(e==null||e(n,i),t==null||t(n.target.value))},renderValue:n=>(0,x.jsx)(M.Typography,{children:n==="none"?"- None -":n}),...a,children:[r==null?void 0:r.map((n,i)=>(0,x.jsx)(M.MenuItem,{value:n,children:n},i)),(0,x.jsx)(M.MenuItem,{value:"none",children:"- None -"},"none")]})};0&&(module.exports={SchemaContext,SchemaMemoryProvider,SchemaProperty,SchemaRouteProvider,SchemaSelectEx,useGetSchemaPayload,useSchema,useSchemaDefinitions,useSchemaList,useSchemaStats});
374
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,gCA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Ac,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,IAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,6CAAC,wBAAqB,iBAAkC,eACtD,uDAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;;;APlDI,IAAAC,sBAAA;AAJG,IAAM,iBAAgD,CAAC,EAAE,UAAU,UAAU,YAAY,GAAG,MAAM,MAAM;AAC7G,QAAM,EAAE,QAAQ,WAAW,WAAW,IAAI,UAAU,KAAK;AAEzD,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,OAAO,UAAU;AAAA,MACjB,UAAU,CAAC,OAAO,UAAU;AAC1B,YAAI,MAAM,OAAO,UAAU,QAAQ;AACjC,+CAAW,OAAO;AAClB,iDAAY,MAAM,OAAO;AAAA,QAC3B;AAAA,MACF;AAAA,MACA,aAAa,CAAC,UAAU;AACtB,eAAO,6CAAC,+BAAY,oBAAU,SAAS,aAAa,OAAM;AAAA,MAC5D;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,iDAAY,IAAI,CAACC,SAAQ,UAAU;AAClC,iBACE,6CAAC,6BAAqB,OAAOA,SAC1B,UAAAA,WADY,KAEf;AAAA,QAEJ;AAAA,QACA,6CAAC,6BAAoB,OAAM,QAAO,wBAApB,MAEd;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["entry","NewReleasesIcon","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,uCACvDC,EAA8C,qCAC9CC,EAAqC,iBAgDvBC,EAAA,6BAvCRC,GAAoBC,GAAoB,CAC5C,GAAM,CAACC,EAAOC,CAAQ,KAAI,YAAkC,EAC5D,2BAEE,MAAOC,GAAY,CACjB,GAAIH,EAAQ,CACV,IAAMC,EAAQ,MAAM,cAAY,SAAS,IAAID,CAAM,EAC/CG,EAAQ,GACVD,EAASD,CAAK,CAElB,CACF,EACA,CAACD,CAAM,CACT,EACOC,CACT,EAEaG,KAA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AA,MAAAA,EAAYK,IAGlB,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,GAAA,MAAAA,EAAWO,EAAOC,GAClBJ,GAAA,MAAAA,EAAYG,EAAM,OAAO,OAE7B,EACA,YAAcE,MACL,OAAC,cAAY,SAAAA,IAAU,OAAS,WAAaA,EAAM,EAE3D,GAAGP,EAEH,UAAAG,GAAA,YAAAA,EAAY,IAAI,CAACF,EAAQO,OAEtB,OAAC,YAAqB,MAAOP,EAC1B,SAAAA,GADYO,CAEf,MAGJ,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","_a","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","_a","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"]}