@xyo-network/react-schema 2.38.10 → 2.38.12

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 (66) hide show
  1. package/dist/cjs/contexts/StatsDiviner/useDivine.d.ts +1 -1
  2. package/dist/cjs/contexts/StatsDiviner/useDivine.d.ts.map +1 -1
  3. package/dist/cjs/contexts/StatsDiviner/useDivine.js +3 -3
  4. package/dist/cjs/contexts/StatsDiviner/useDivine.js.map +1 -1
  5. package/dist/cjs/hooks/index.d.ts +2 -0
  6. package/dist/cjs/hooks/index.d.ts.map +1 -0
  7. package/dist/cjs/{diviners → hooks}/index.js +1 -1
  8. package/dist/cjs/hooks/index.js.map +1 -0
  9. package/dist/cjs/hooks/useGetSchema.d.ts +25 -0
  10. package/dist/cjs/hooks/useGetSchema.d.ts.map +1 -0
  11. package/dist/cjs/hooks/useGetSchema.js +53 -0
  12. package/dist/cjs/hooks/useGetSchema.js.map +1 -0
  13. package/dist/cjs/index.d.ts +1 -1
  14. package/dist/cjs/index.d.ts.map +1 -1
  15. package/dist/cjs/index.js +1 -1
  16. package/dist/cjs/index.js.map +1 -1
  17. package/dist/docs.json +326 -586
  18. package/dist/esm/contexts/StatsDiviner/useDivine.d.ts +1 -1
  19. package/dist/esm/contexts/StatsDiviner/useDivine.d.ts.map +1 -1
  20. package/dist/esm/contexts/StatsDiviner/useDivine.js +3 -3
  21. package/dist/esm/contexts/StatsDiviner/useDivine.js.map +1 -1
  22. package/dist/esm/hooks/index.d.ts +2 -0
  23. package/dist/esm/hooks/index.d.ts.map +1 -0
  24. package/dist/esm/hooks/index.js +2 -0
  25. package/dist/esm/hooks/index.js.map +1 -0
  26. package/dist/esm/hooks/useGetSchema.d.ts +25 -0
  27. package/dist/esm/hooks/useGetSchema.d.ts.map +1 -0
  28. package/dist/esm/hooks/useGetSchema.js +49 -0
  29. package/dist/esm/hooks/useGetSchema.js.map +1 -0
  30. package/dist/esm/index.d.ts +1 -1
  31. package/dist/esm/index.d.ts.map +1 -1
  32. package/dist/esm/index.js +1 -1
  33. package/dist/esm/index.js.map +1 -1
  34. package/package.json +5 -6
  35. package/src/contexts/StatsDiviner/useDivine.tsx +3 -3
  36. package/src/hooks/index.ts +1 -0
  37. package/src/hooks/useGetSchema.stories.tsx +76 -0
  38. package/src/hooks/useGetSchema.tsx +55 -0
  39. package/src/index.ts +1 -1
  40. package/dist/cjs/diviners/SchemaListApiDiviner.d.ts +0 -20
  41. package/dist/cjs/diviners/SchemaListApiDiviner.d.ts.map +0 -1
  42. package/dist/cjs/diviners/SchemaListApiDiviner.js +0 -54
  43. package/dist/cjs/diviners/SchemaListApiDiviner.js.map +0 -1
  44. package/dist/cjs/diviners/SchemaListApiDivinerConfig.d.ts +0 -9
  45. package/dist/cjs/diviners/SchemaListApiDivinerConfig.d.ts.map +0 -1
  46. package/dist/cjs/diviners/SchemaListApiDivinerConfig.js +0 -5
  47. package/dist/cjs/diviners/SchemaListApiDivinerConfig.js.map +0 -1
  48. package/dist/cjs/diviners/index.d.ts +0 -2
  49. package/dist/cjs/diviners/index.d.ts.map +0 -1
  50. package/dist/cjs/diviners/index.js.map +0 -1
  51. package/dist/esm/diviners/SchemaListApiDiviner.d.ts +0 -20
  52. package/dist/esm/diviners/SchemaListApiDiviner.d.ts.map +0 -1
  53. package/dist/esm/diviners/SchemaListApiDiviner.js +0 -36
  54. package/dist/esm/diviners/SchemaListApiDiviner.js.map +0 -1
  55. package/dist/esm/diviners/SchemaListApiDivinerConfig.d.ts +0 -9
  56. package/dist/esm/diviners/SchemaListApiDivinerConfig.d.ts.map +0 -1
  57. package/dist/esm/diviners/SchemaListApiDivinerConfig.js +0 -2
  58. package/dist/esm/diviners/SchemaListApiDivinerConfig.js.map +0 -1
  59. package/dist/esm/diviners/index.d.ts +0 -2
  60. package/dist/esm/diviners/index.d.ts.map +0 -1
  61. package/dist/esm/diviners/index.js +0 -2
  62. package/dist/esm/diviners/index.js.map +0 -1
  63. package/src/diviners/SchemaListApiDiviner.spec.ts +0 -23
  64. package/src/diviners/SchemaListApiDiviner.ts +0 -51
  65. package/src/diviners/SchemaListApiDivinerConfig.ts +0 -13
  66. package/src/diviners/index.ts +0 -1
@@ -1,3 +1,3 @@
1
1
  import { SchemaStats } from '@xyo-network/api';
2
- export declare const useDivineSchemaStats: (address?: string) => [SchemaStats | undefined, Error | undefined, () => void];
2
+ export declare const useDivineSchemaStats: () => [SchemaStats | undefined, Error | undefined, () => void];
3
3
  //# sourceMappingURL=useDivine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDivine.d.ts","sourceRoot":"","sources":["../../../../src/contexts/StatsDiviner/useDivine.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAM9C,eAAO,MAAM,oBAAoB,aAAc,MAAM,KAAG,CAAC,WAAW,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,MAAM,IAAI,CA0B9G,CAAA"}
1
+ {"version":3,"file":"useDivine.d.ts","sourceRoot":"","sources":["../../../../src/contexts/StatsDiviner/useDivine.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAM9C,eAAO,MAAM,oBAAoB,QAAO,CAAC,WAAW,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,MAAM,IAAI,CA0B9F,CAAA"}
@@ -2,7 +2,7 @@ import { useAsyncEffect } from '@xylabs/react-shared';
2
2
  import { XyoDivinerWrapper } from '@xyo-network/diviner';
3
3
  import { useState } from 'react';
4
4
  import { useSchemaStatsApiDiviner } from './use';
5
- export const useDivineSchemaStats = (address) => {
5
+ export const useDivineSchemaStats = () => {
6
6
  const [stats, setStats] = useState();
7
7
  const [error, setError] = useState();
8
8
  const { diviner } = useSchemaStatsApiDiviner();
@@ -11,7 +11,7 @@ export const useDivineSchemaStats = (address) => {
11
11
  useAsyncEffect(
12
12
  // eslint-disable-next-line react-hooks/exhaustive-deps
13
13
  async (mounted) => {
14
- if (diviner && address) {
14
+ if (diviner) {
15
15
  try {
16
16
  const result = (await new XyoDivinerWrapper(diviner).divine());
17
17
  if (mounted()) {
@@ -22,7 +22,7 @@ export const useDivineSchemaStats = (address) => {
22
22
  setError(e);
23
23
  }
24
24
  }
25
- }, [address, diviner, refresh]);
25
+ }, [diviner, refresh]);
26
26
  return [stats, error, refreshStats];
27
27
  };
28
28
  //# sourceMappingURL=useDivine.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDivine.js","sourceRoot":"","sources":["../../../../src/contexts/StatsDiviner/useDivine.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAA;AAEhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAgB,EAA4D,EAAE;IACjH,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAe,CAAA;IACjD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAS,CAAA;IAC3C,MAAM,EAAE,OAAO,EAAE,GAAG,wBAAwB,EAAE,CAAA;IAC9C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IAEzC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAA;IAEjE,cAAc;IACZ,uDAAuD;IACvD,KAAK,EAAE,OAAO,EAAE,EAAE;QAChB,IAAI,OAAO,IAAI,OAAO,EAAE;YACtB,IAAI;gBACF,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAkB,CAAA;gBAC/E,IAAI,OAAO,EAAE,EAAE;oBACb,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;iBACpB;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,QAAQ,CAAC,CAAU,CAAC,CAAA;aACrB;SACF;IACH,CAAC,EACD,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAC5B,CAAA;IAED,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,CAAA;AACrC,CAAC,CAAA"}
1
+ {"version":3,"file":"useDivine.js","sourceRoot":"","sources":["../../../../src/contexts/StatsDiviner/useDivine.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAA;AAEhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAA6D,EAAE;IACjG,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAe,CAAA;IACjD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,EAAS,CAAA;IAC3C,MAAM,EAAE,OAAO,EAAE,GAAG,wBAAwB,EAAE,CAAA;IAC9C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IAEzC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAA;IAEjE,cAAc;IACZ,uDAAuD;IACvD,KAAK,EAAE,OAAO,EAAE,EAAE;QAChB,IAAI,OAAO,EAAE;YACX,IAAI;gBACF,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAkB,CAAA;gBAC/E,IAAI,OAAO,EAAE,EAAE;oBACb,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;iBACpB;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,QAAQ,CAAC,CAAU,CAAC,CAAA;aACrB;SACF;IACH,CAAC,EACD,CAAC,OAAO,EAAE,OAAO,CAAC,CACnB,CAAA;IAED,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,CAAA;AACrC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './useGetSchema';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './useGetSchema';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Gets a Huri and schema payload from a schema string
3
+ */
4
+ declare const useGetSchemaPayload: (schema?: string) => {
5
+ notFound: boolean;
6
+ schemaHuri: import("@xyo-network/payload").Huri<import("@xyo-network/payload").SchemaFields & import("@xyo-network/payload").PayloadFields & {
7
+ schema: string;
8
+ }> | undefined;
9
+ schemaPayload: (import("@xyo-network/payload").SchemaFields & import("@xyo-network/payload").PayloadFields & {
10
+ definition: {
11
+ [key: string]: unknown;
12
+ $id?: string | undefined;
13
+ };
14
+ extends?: string | undefined;
15
+ name?: string | undefined;
16
+ schema: "network.xyo.schema";
17
+ }) | null | undefined;
18
+ xyoError: (import("@xyo-network/payload").SchemaFields & import("@xyo-network/payload").PayloadFields & {
19
+ message?: string | undefined;
20
+ schema: "network.xyo.error";
21
+ sources: string[];
22
+ }) | undefined;
23
+ };
24
+ export { useGetSchemaPayload };
25
+ //# sourceMappingURL=useGetSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGetSchema.d.ts","sourceRoot":"","sources":["../../../src/hooks/useGetSchema.tsx"],"names":[],"mappings":"AAOA;;GAEG;AACH,QAAA,MAAM,mBAAmB,YAAa,MAAM;;;;;;;;;;;;;;;;;;;CA0C3C,CAAA;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
@@ -0,0 +1,49 @@
1
+ import { useAsyncEffect } from '@xylabs/react-shared';
2
+ import { XyoErrorSchema } from '@xyo-network/module';
3
+ import { XyoPayloadBuilder } from '@xyo-network/payload';
4
+ import { XyoSchemaCache } from '@xyo-network/utils';
5
+ import { useState } from 'react';
6
+ /**
7
+ * Gets a Huri and schema payload from a schema string
8
+ */
9
+ const useGetSchemaPayload = (schema) => {
10
+ const [notFound, setNotFound] = useState(false);
11
+ const [xyoError, setXyoError] = useState();
12
+ const [schemaCacheEntry, setSchemaCacheEntry] = useState();
13
+ const [schemaLocal, setSchemaLocal] = useState();
14
+ useAsyncEffect(
15
+ // eslint-disable-next-line react-hooks/exhaustive-deps
16
+ async (mounted) => {
17
+ const firstRequest = !notFound && !schemaCacheEntry && !xyoError;
18
+ const schemaChanged = schema !== schemaLocal;
19
+ if ((schema && firstRequest) || (schema && schemaChanged)) {
20
+ try {
21
+ const schemaCacheEntry = await XyoSchemaCache.instance.get(schema);
22
+ if (mounted()) {
23
+ setSchemaCacheEntry(schemaCacheEntry);
24
+ setNotFound(schemaCacheEntry === null || schemaCacheEntry === undefined);
25
+ }
26
+ }
27
+ catch (e) {
28
+ const error = e;
29
+ console.error(e);
30
+ if (mounted()) {
31
+ setXyoError({ message: error.message, schema: XyoErrorSchema, sources: [] });
32
+ }
33
+ }
34
+ }
35
+ if (schemaChanged) {
36
+ setSchemaLocal(schema);
37
+ }
38
+ }, [xyoError, notFound, schema, schemaLocal, schemaCacheEntry]);
39
+ return {
40
+ notFound,
41
+ schemaHuri: schemaCacheEntry?.huri,
42
+ schemaPayload: schemaCacheEntry
43
+ ? new XyoPayloadBuilder(schemaCacheEntry?.payload).fields(schemaCacheEntry.payload).build()
44
+ : schemaCacheEntry,
45
+ xyoError,
46
+ };
47
+ };
48
+ export { useGetSchemaPayload };
49
+ //# sourceMappingURL=useGetSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGetSchema.js","sourceRoot":"","sources":["../../../src/hooks/useGetSchema.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAY,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAExD,OAAO,EAAE,cAAc,EAAuB,MAAM,oBAAoB,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC;;GAEG;AACH,MAAM,mBAAmB,GAAG,CAAC,MAAe,EAAE,EAAE;IAC9C,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC/C,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,EAAY,CAAA;IACpD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,EAA0C,CAAA;IAClG,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,EAAU,CAAA;IAExD,cAAc;IACZ,uDAAuD;IACvD,KAAK,EAAE,OAAO,EAAE,EAAE;QAChB,MAAM,YAAY,GAAG,CAAC,QAAQ,IAAI,CAAC,gBAAgB,IAAI,CAAC,QAAQ,CAAA;QAChE,MAAM,aAAa,GAAG,MAAM,KAAK,WAAW,CAAA;QAE5C,IAAI,CAAC,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,IAAI,aAAa,CAAC,EAAE;YACzD,IAAI;gBACF,MAAM,gBAAgB,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;gBAClE,IAAI,OAAO,EAAE,EAAE;oBACb,mBAAmB,CAAC,gBAAgB,CAAC,CAAA;oBACrC,WAAW,CAAC,gBAAgB,KAAK,IAAI,IAAI,gBAAgB,KAAK,SAAS,CAAC,CAAA;iBACzE;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,MAAM,KAAK,GAAG,CAAU,CAAA;gBACxB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;gBAChB,IAAI,OAAO,EAAE,EAAE;oBACb,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAA;iBAC7E;aACF;SACF;QACD,IAAI,aAAa,EAAE;YACjB,cAAc,CAAC,MAAM,CAAC,CAAA;SACvB;IACH,CAAC,EACD,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,CAAC,CAC5D,CAAA;IAED,OAAO;QACL,QAAQ;QACR,UAAU,EAAE,gBAAgB,EAAE,IAAI;QAClC,aAAa,EAAE,gBAAgB;YAC7B,CAAC,CAAC,IAAI,iBAAiB,CAAmB,gBAAgB,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE;YAC7G,CAAC,CAAC,gBAAgB;QACpB,QAAQ;KACT,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
@@ -1,4 +1,4 @@
1
1
  export * from './components';
2
2
  export * from './contexts';
3
- export * from './diviners';
3
+ export * from './hooks';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './components';
2
2
  export * from './contexts';
3
- export * from './diviners';
3
+ export * from './hooks';
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
package/package.json CHANGED
@@ -13,10 +13,10 @@
13
13
  "@xylabs/react-common": "^2.15.1",
14
14
  "@xylabs/react-link": "^2.15.1",
15
15
  "@xylabs/react-shared": "^2.15.1",
16
- "@xyo-network/react-archive": "^2.38.10",
17
- "@xyo-network/react-archivist-api": "^2.38.10",
18
- "@xyo-network/react-property": "^2.38.10",
19
- "@xyo-network/react-shared": "^2.38.10",
16
+ "@xyo-network/react-archive": "^2.38.12",
17
+ "@xyo-network/react-archivist-api": "^2.38.12",
18
+ "@xyo-network/react-property": "^2.38.12",
19
+ "@xyo-network/react-shared": "^2.38.12",
20
20
  "tslib": "^2.4.0"
21
21
  },
22
22
  "peerDependencies": {
@@ -24,7 +24,6 @@
24
24
  "@mui/material": "^5.10.3",
25
25
  "@mui/styles": "^5.10.3",
26
26
  "@xylabs/sdk-js": "^2.6.9",
27
- "@xyo-network/api": "*",
28
27
  "@xyo-network/diviner": "*",
29
28
  "@xyo-network/module": "*",
30
29
  "@xyo-network/payload": "*",
@@ -80,5 +79,5 @@
80
79
  },
81
80
  "sideEffects": false,
82
81
  "types": "dist/esm/index.d.ts",
83
- "version": "2.38.10"
82
+ "version": "2.38.12"
84
83
  }
@@ -5,7 +5,7 @@ import { useState } from 'react'
5
5
 
6
6
  import { useSchemaStatsApiDiviner } from './use'
7
7
 
8
- export const useDivineSchemaStats = (address?: string): [SchemaStats | undefined, Error | undefined, () => void] => {
8
+ export const useDivineSchemaStats = (): [SchemaStats | undefined, Error | undefined, () => void] => {
9
9
  const [stats, setStats] = useState<SchemaStats>()
10
10
  const [error, setError] = useState<Error>()
11
11
  const { diviner } = useSchemaStatsApiDiviner()
@@ -16,7 +16,7 @@ export const useDivineSchemaStats = (address?: string): [SchemaStats | undefined
16
16
  useAsyncEffect(
17
17
  // eslint-disable-next-line react-hooks/exhaustive-deps
18
18
  async (mounted) => {
19
- if (diviner && address) {
19
+ if (diviner) {
20
20
  try {
21
21
  const result = (await new XyoDivinerWrapper(diviner).divine()) as SchemaStats[]
22
22
  if (mounted()) {
@@ -27,7 +27,7 @@ export const useDivineSchemaStats = (address?: string): [SchemaStats | undefined
27
27
  }
28
28
  }
29
29
  },
30
- [address, diviner, refresh],
30
+ [diviner, refresh],
31
31
  )
32
32
 
33
33
  return [stats, error, refreshStats]
@@ -0,0 +1 @@
1
+ export * from './useGetSchema'
@@ -0,0 +1,76 @@
1
+ import { FormControl, TextField, Typography } from '@mui/material'
2
+ import { ComponentStory, Meta } from '@storybook/react'
3
+ import { FlexCol, FlexRow } from '@xylabs/react-flexbox'
4
+ import { XyoSchemaCache } from '@xyo-network/utils'
5
+ import { lazy, Suspense, useEffect, useState } from 'react'
6
+
7
+ import { useGetSchemaPayload } from './useGetSchema'
8
+
9
+ const JsonView = lazy(() => import(/* webpackChunkName: "jsonView" */ 'react-json-view'))
10
+
11
+ XyoSchemaCache.instance.proxy = 'https://beta.api.archivist.xyo.network/domain'
12
+
13
+ const UseGetSchemaComponent: React.FC<{ schema: string }> = ({ schema }) => {
14
+ const exampleSchemas = ['network.xyo.domain', 'network.xyo.payload', 'network.xyo.schema']
15
+ const [schemaFieldValue, setSchemaFieldValue] = useState('')
16
+ const { schemaPayload } = useGetSchemaPayload(schemaFieldValue)
17
+
18
+ useEffect(() => {
19
+ if (schema) {
20
+ setSchemaFieldValue(schema)
21
+ }
22
+ }, [schema])
23
+
24
+ return (
25
+ <>
26
+ <Typography variant="body1" fontWeight="bold" mb={2}>
27
+ Example schemas to test:
28
+ {exampleSchemas.map((schema, index) => (
29
+ <Typography
30
+ component="span"
31
+ mx={1}
32
+ key={index}
33
+ onClick={() => setSchemaFieldValue(schema)}
34
+ sx={{ cursor: 'pointer', textDecoration: 'underline' }}
35
+ >
36
+ {schema}
37
+ </Typography>
38
+ ))}
39
+ </Typography>
40
+ <FormControl>
41
+ <TextField value={schemaFieldValue} label="Schema Name" onChange={(e) => setSchemaFieldValue(e.target.value)} />
42
+ </FormControl>
43
+ <FlexRow my={3} justifyContent="start">
44
+ <Suspense fallback={<FlexCol busy />}>
45
+ <JsonView src={schemaPayload || {}} />
46
+ </Suspense>
47
+ </FlexRow>
48
+ </>
49
+ )
50
+ }
51
+
52
+ const StorybookEntry: Meta = {
53
+ argTypes: {},
54
+ component: UseGetSchemaComponent,
55
+ parameters: {
56
+ docs: {
57
+ page: null,
58
+ },
59
+ },
60
+ title: 'payload/useGetSchema',
61
+ }
62
+
63
+ const Template: ComponentStory<typeof UseGetSchemaComponent> = ({ schema }) => {
64
+ return <UseGetSchemaComponent schema={schema} />
65
+ }
66
+
67
+ const Default = Template.bind({})
68
+ Default.args = { schema: 'network.xyo.schema' }
69
+
70
+ const Domain = Template.bind({})
71
+ Domain.args = { schema: 'network.xyo.domain' }
72
+
73
+ export { Default, Domain }
74
+
75
+ // eslint-disable-next-line import/no-default-export
76
+ export default StorybookEntry
@@ -0,0 +1,55 @@
1
+ import { useAsyncEffect } from '@xylabs/react-shared'
2
+ import { XyoError, XyoErrorSchema } from '@xyo-network/module'
3
+ import { XyoPayloadBuilder } from '@xyo-network/payload'
4
+ import { XyoSchemaPayload } from '@xyo-network/schema-payload-plugin'
5
+ import { XyoSchemaCache, XyoSchemaCacheEntry } from '@xyo-network/utils'
6
+ import { useState } from 'react'
7
+
8
+ /**
9
+ * Gets a Huri and schema payload from a schema string
10
+ */
11
+ const useGetSchemaPayload = (schema?: string) => {
12
+ const [notFound, setNotFound] = useState(false)
13
+ const [xyoError, setXyoError] = useState<XyoError>()
14
+ const [schemaCacheEntry, setSchemaCacheEntry] = useState<XyoSchemaCacheEntry | null | undefined>()
15
+ const [schemaLocal, setSchemaLocal] = useState<string>()
16
+
17
+ useAsyncEffect(
18
+ // eslint-disable-next-line react-hooks/exhaustive-deps
19
+ async (mounted) => {
20
+ const firstRequest = !notFound && !schemaCacheEntry && !xyoError
21
+ const schemaChanged = schema !== schemaLocal
22
+
23
+ if ((schema && firstRequest) || (schema && schemaChanged)) {
24
+ try {
25
+ const schemaCacheEntry = await XyoSchemaCache.instance.get(schema)
26
+ if (mounted()) {
27
+ setSchemaCacheEntry(schemaCacheEntry)
28
+ setNotFound(schemaCacheEntry === null || schemaCacheEntry === undefined)
29
+ }
30
+ } catch (e) {
31
+ const error = e as Error
32
+ console.error(e)
33
+ if (mounted()) {
34
+ setXyoError({ message: error.message, schema: XyoErrorSchema, sources: [] })
35
+ }
36
+ }
37
+ }
38
+ if (schemaChanged) {
39
+ setSchemaLocal(schema)
40
+ }
41
+ },
42
+ [xyoError, notFound, schema, schemaLocal, schemaCacheEntry],
43
+ )
44
+
45
+ return {
46
+ notFound,
47
+ schemaHuri: schemaCacheEntry?.huri,
48
+ schemaPayload: schemaCacheEntry
49
+ ? new XyoPayloadBuilder<XyoSchemaPayload>(schemaCacheEntry?.payload).fields(schemaCacheEntry.payload).build()
50
+ : schemaCacheEntry,
51
+ xyoError,
52
+ }
53
+ }
54
+
55
+ export { useGetSchemaPayload }
package/src/index.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from './components'
2
2
  export * from './contexts'
3
- export * from './diviners'
3
+ export * from './hooks'
@@ -1,20 +0,0 @@
1
- import { XyoArchivistApi } from '@xyo-network/api';
2
- import { XyoDiviner } from '@xyo-network/diviner';
3
- import { XyoModuleParams } from '@xyo-network/module';
4
- import { XyoPayload } from '@xyo-network/payload';
5
- import { XyoSchemaListApiDivinerConfig } from './SchemaListApiDivinerConfig';
6
- export declare type XyoSchemaListApiDivinerParams = XyoModuleParams<XyoSchemaListApiDivinerConfig> & {
7
- api: XyoArchivistApi;
8
- };
9
- export declare class SchemaListApiDiviner extends XyoDiviner<XyoSchemaListApiDivinerConfig> {
10
- protected readonly api: XyoArchivistApi;
11
- get archive(): string;
12
- static create(params: XyoSchemaListApiDivinerParams): Promise<SchemaListApiDiviner>;
13
- protected constructor(params: XyoSchemaListApiDivinerParams);
14
- queries(): string[];
15
- protected start(): Promise<this>;
16
- divine(): Promise<XyoPayload[]>;
17
- static configSchema: "network.xyo.diviner.schema.list.api.config";
18
- static targetSchema: "network.xyo.schema";
19
- }
20
- //# sourceMappingURL=SchemaListApiDiviner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaListApiDiviner.d.ts","sourceRoot":"","sources":["../../../src/diviners/SchemaListApiDiviner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,UAAU,EAA+B,MAAM,sBAAsB,CAAA;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAGjD,OAAO,EAAE,6BAA6B,EAAuC,MAAM,8BAA8B,CAAA;AAEjH,oBAAY,6BAA6B,GAAG,eAAe,CAAC,6BAA6B,CAAC,GAAG;IAAE,GAAG,EAAE,eAAe,CAAA;CAAE,CAAA;AAErH,qBAAa,oBAAqB,SAAQ,UAAU,CAAC,6BAA6B,CAAC;IACjF,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,eAAe,CAAA;IAEvC,IAAI,OAAO,WAEV;WAEqB,MAAM,CAAC,MAAM,EAAE,6BAA6B,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAIlG,SAAS,aAAa,MAAM,EAAE,6BAA6B;IAKlD,OAAO;cAIS,KAAK;IAKjB,MAAM,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAY5C,OAAgB,YAAY,+CAAsC;IAClE,OAAgB,YAAY,uBAAkB;CAC/C"}
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SchemaListApiDiviner = void 0;
4
- const tslib_1 = require("tslib");
5
- const sdk_js_1 = require("@xylabs/sdk-js");
6
- const diviner_1 = require("@xyo-network/diviner");
7
- const schema_payload_plugin_1 = require("@xyo-network/schema-payload-plugin");
8
- const SchemaListApiDivinerConfig_1 = require("./SchemaListApiDivinerConfig");
9
- class SchemaListApiDiviner extends diviner_1.XyoDiviner {
10
- constructor(params) {
11
- super(params);
12
- this.api = params.api;
13
- }
14
- get archive() {
15
- var _a;
16
- return (0, sdk_js_1.assertEx)((_a = this.config) === null || _a === void 0 ? void 0 : _a.archive, `config required [${this.config}]`);
17
- }
18
- static create(params) {
19
- const _super = Object.create(null, {
20
- create: { get: () => super.create }
21
- });
22
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
- return (yield _super.create.call(this, params));
24
- });
25
- }
26
- queries() {
27
- return [diviner_1.XyoDivinerDivineQuerySchema, ...super.queries()];
28
- }
29
- start() {
30
- const _super = Object.create(null, {
31
- start: { get: () => super.start }
32
- });
33
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
34
- yield _super.start.call(this);
35
- return this;
36
- });
37
- }
38
- divine() {
39
- var _a, _b, _c;
40
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
41
- const apiResult = (_b = (yield ((_a = this.api.archive(this.archive)) === null || _a === void 0 ? void 0 : _a.payload.schema.get()))) !== null && _b !== void 0 ? _b : [];
42
- return ((_c = apiResult.map((schema) => {
43
- return {
44
- name: schema,
45
- schema: schema_payload_plugin_1.XyoSchemaSchema,
46
- };
47
- })) !== null && _c !== void 0 ? _c : []);
48
- });
49
- }
50
- }
51
- exports.SchemaListApiDiviner = SchemaListApiDiviner;
52
- SchemaListApiDiviner.configSchema = SchemaListApiDivinerConfig_1.XyoSchemaListApiDivinerConfigSchema;
53
- SchemaListApiDiviner.targetSchema = schema_payload_plugin_1.XyoSchemaSchema;
54
- //# sourceMappingURL=SchemaListApiDiviner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaListApiDiviner.js","sourceRoot":"","sources":["../../../src/diviners/SchemaListApiDiviner.ts"],"names":[],"mappings":";;;;AAAA,2CAAyC;AAEzC,kDAA8E;AAG9E,8EAAoE;AAEpE,6EAAiH;AAIjH,MAAa,oBAAqB,SAAQ,oBAAyC;IAWjF,YAAsB,MAAqC;QACzD,KAAK,CAAC,MAAM,CAAC,CAAA;QACb,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAA;IACvB,CAAC;IAXD,IAAI,OAAO;;QACT,OAAO,IAAA,iBAAQ,EAAC,MAAA,IAAI,CAAC,MAAM,0CAAE,OAAO,EAAE,oBAAoB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAA;IAC3E,CAAC;IAED,MAAM,CAAgB,MAAM,CAAC,MAAqC;;;;;YAChE,OAAO,CAAC,MAAM,OAAM,MAAM,YAAC,MAAM,CAAC,CAAyB,CAAA;QAC7D,CAAC;KAAA;IAOQ,OAAO;QACd,OAAO,CAAC,qCAA2B,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;IAC1D,CAAC;IAEwB,KAAK;;;;;YAC5B,MAAM,OAAM,KAAK,WAAE,CAAA;YACnB,OAAO,IAAI,CAAA;QACb,CAAC;KAAA;IAEY,MAAM;;;YACjB,MAAM,SAAS,GAAG,MAAA,CAAC,MAAM,CAAA,MAAA,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,0CAAE,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA,CAAC,mCAAI,EAAE,CAAA;YACpF,OAAO,CACL,MAAA,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;gBACvB,OAAO;oBACL,IAAI,EAAE,MAAM;oBACZ,MAAM,EAAE,uCAAe;iBACxB,CAAA;YACH,CAAC,CAAC,mCAAI,EAAE,CACT,CAAA;;KACF;;AAnCH,oDAuCC;AAFiB,iCAAY,GAAG,gEAAmC,CAAA;AAClD,iCAAY,GAAG,uCAAe,CAAA"}
@@ -1,9 +0,0 @@
1
- import { XyoDivinerConfig } from '@xyo-network/diviner';
2
- import { XyoPayload } from '@xyo-network/payload';
3
- export declare type XyoSchemaListApiDivinerConfigSchema = 'network.xyo.diviner.schema.list.api.config';
4
- export declare const XyoSchemaListApiDivinerConfigSchema: XyoSchemaListApiDivinerConfigSchema;
5
- export declare type XyoSchemaListApiDivinerConfig<T extends XyoPayload = XyoPayload> = XyoDivinerConfig<XyoPayload, T & {
6
- schema: XyoSchemaListApiDivinerConfigSchema;
7
- archive: string;
8
- }>;
9
- //# sourceMappingURL=SchemaListApiDivinerConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaListApiDivinerConfig.d.ts","sourceRoot":"","sources":["../../../src/diviners/SchemaListApiDivinerConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,oBAAY,mCAAmC,GAAG,4CAA4C,CAAA;AAC9F,eAAO,MAAM,mCAAmC,EAAE,mCAAkF,CAAA;AAEpI,oBAAY,6BAA6B,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,IAAI,gBAAgB,CAC7F,UAAU,EACV,CAAC,GAAG;IACF,MAAM,EAAE,mCAAmC,CAAA;IAC3C,OAAO,EAAE,MAAM,CAAA;CAChB,CACF,CAAA"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.XyoSchemaListApiDivinerConfigSchema = void 0;
4
- exports.XyoSchemaListApiDivinerConfigSchema = 'network.xyo.diviner.schema.list.api.config';
5
- //# sourceMappingURL=SchemaListApiDivinerConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaListApiDivinerConfig.js","sourceRoot":"","sources":["../../../src/diviners/SchemaListApiDivinerConfig.ts"],"names":[],"mappings":";;;AAIa,QAAA,mCAAmC,GAAwC,4CAA4C,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './SchemaListApiDiviner';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/diviners/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/diviners/index.ts"],"names":[],"mappings":";;;AAAA,iEAAsC"}
@@ -1,20 +0,0 @@
1
- import { XyoArchivistApi } from '@xyo-network/api';
2
- import { XyoDiviner } from '@xyo-network/diviner';
3
- import { XyoModuleParams } from '@xyo-network/module';
4
- import { XyoPayload } from '@xyo-network/payload';
5
- import { XyoSchemaListApiDivinerConfig } from './SchemaListApiDivinerConfig';
6
- export declare type XyoSchemaListApiDivinerParams = XyoModuleParams<XyoSchemaListApiDivinerConfig> & {
7
- api: XyoArchivistApi;
8
- };
9
- export declare class SchemaListApiDiviner extends XyoDiviner<XyoSchemaListApiDivinerConfig> {
10
- protected readonly api: XyoArchivistApi;
11
- get archive(): string;
12
- static create(params: XyoSchemaListApiDivinerParams): Promise<SchemaListApiDiviner>;
13
- protected constructor(params: XyoSchemaListApiDivinerParams);
14
- queries(): string[];
15
- protected start(): Promise<this>;
16
- divine(): Promise<XyoPayload[]>;
17
- static configSchema: "network.xyo.diviner.schema.list.api.config";
18
- static targetSchema: "network.xyo.schema";
19
- }
20
- //# sourceMappingURL=SchemaListApiDiviner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaListApiDiviner.d.ts","sourceRoot":"","sources":["../../../src/diviners/SchemaListApiDiviner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,UAAU,EAA+B,MAAM,sBAAsB,CAAA;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAGjD,OAAO,EAAE,6BAA6B,EAAuC,MAAM,8BAA8B,CAAA;AAEjH,oBAAY,6BAA6B,GAAG,eAAe,CAAC,6BAA6B,CAAC,GAAG;IAAE,GAAG,EAAE,eAAe,CAAA;CAAE,CAAA;AAErH,qBAAa,oBAAqB,SAAQ,UAAU,CAAC,6BAA6B,CAAC;IACjF,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,eAAe,CAAA;IAEvC,IAAI,OAAO,WAEV;WAEqB,MAAM,CAAC,MAAM,EAAE,6BAA6B,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAIlG,SAAS,aAAa,MAAM,EAAE,6BAA6B;IAKlD,OAAO;cAIS,KAAK;IAKjB,MAAM,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAY5C,OAAgB,YAAY,+CAAsC;IAClE,OAAgB,YAAY,uBAAkB;CAC/C"}
@@ -1,36 +0,0 @@
1
- import { assertEx } from '@xylabs/sdk-js';
2
- import { XyoDiviner, XyoDivinerDivineQuerySchema } from '@xyo-network/diviner';
3
- import { XyoSchemaSchema } from '@xyo-network/schema-payload-plugin';
4
- import { XyoSchemaListApiDivinerConfigSchema } from './SchemaListApiDivinerConfig';
5
- export class SchemaListApiDiviner extends XyoDiviner {
6
- api;
7
- get archive() {
8
- return assertEx(this.config?.archive, `config required [${this.config}]`);
9
- }
10
- static async create(params) {
11
- return (await super.create(params));
12
- }
13
- constructor(params) {
14
- super(params);
15
- this.api = params.api;
16
- }
17
- queries() {
18
- return [XyoDivinerDivineQuerySchema, ...super.queries()];
19
- }
20
- async start() {
21
- await super.start();
22
- return this;
23
- }
24
- async divine() {
25
- const apiResult = (await this.api.archive(this.archive)?.payload.schema.get()) ?? [];
26
- return (apiResult.map((schema) => {
27
- return {
28
- name: schema,
29
- schema: XyoSchemaSchema,
30
- };
31
- }) ?? []);
32
- }
33
- static configSchema = XyoSchemaListApiDivinerConfigSchema;
34
- static targetSchema = XyoSchemaSchema;
35
- }
36
- //# sourceMappingURL=SchemaListApiDiviner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaListApiDiviner.js","sourceRoot":"","sources":["../../../src/diviners/SchemaListApiDiviner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,EAAE,UAAU,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAA;AAG9E,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAEpE,OAAO,EAAiC,mCAAmC,EAAE,MAAM,8BAA8B,CAAA;AAIjH,MAAM,OAAO,oBAAqB,SAAQ,UAAyC;IAC9D,GAAG,CAAiB;IAEvC,IAAI,OAAO;QACT,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,oBAAoB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAA;IAC3E,CAAC;IAED,MAAM,CAAU,KAAK,CAAC,MAAM,CAAC,MAAqC;QAChE,OAAO,CAAC,MAAM,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAyB,CAAA;IAC7D,CAAC;IAED,YAAsB,MAAqC;QACzD,KAAK,CAAC,MAAM,CAAC,CAAA;QACb,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAA;IACvB,CAAC;IAEQ,OAAO;QACd,OAAO,CAAC,2BAA2B,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;IAC1D,CAAC;IAEkB,KAAK,CAAC,KAAK;QAC5B,MAAM,KAAK,CAAC,KAAK,EAAE,CAAA;QACnB,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,KAAK,CAAC,MAAM;QACjB,MAAM,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAA;QACpF,OAAO,CACL,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACvB,OAAO;gBACL,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,eAAe;aACxB,CAAA;QACH,CAAC,CAAC,IAAI,EAAE,CACT,CAAA;IACH,CAAC;IAED,MAAM,CAAU,YAAY,GAAG,mCAAmC,CAAA;IAClE,MAAM,CAAU,YAAY,GAAG,eAAe,CAAA"}
@@ -1,9 +0,0 @@
1
- import { XyoDivinerConfig } from '@xyo-network/diviner';
2
- import { XyoPayload } from '@xyo-network/payload';
3
- export declare type XyoSchemaListApiDivinerConfigSchema = 'network.xyo.diviner.schema.list.api.config';
4
- export declare const XyoSchemaListApiDivinerConfigSchema: XyoSchemaListApiDivinerConfigSchema;
5
- export declare type XyoSchemaListApiDivinerConfig<T extends XyoPayload = XyoPayload> = XyoDivinerConfig<XyoPayload, T & {
6
- schema: XyoSchemaListApiDivinerConfigSchema;
7
- archive: string;
8
- }>;
9
- //# sourceMappingURL=SchemaListApiDivinerConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaListApiDivinerConfig.d.ts","sourceRoot":"","sources":["../../../src/diviners/SchemaListApiDivinerConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,oBAAY,mCAAmC,GAAG,4CAA4C,CAAA;AAC9F,eAAO,MAAM,mCAAmC,EAAE,mCAAkF,CAAA;AAEpI,oBAAY,6BAA6B,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,IAAI,gBAAgB,CAC7F,UAAU,EACV,CAAC,GAAG;IACF,MAAM,EAAE,mCAAmC,CAAA;IAC3C,OAAO,EAAE,MAAM,CAAA;CAChB,CACF,CAAA"}
@@ -1,2 +0,0 @@
1
- export const XyoSchemaListApiDivinerConfigSchema = 'network.xyo.diviner.schema.list.api.config';
2
- //# sourceMappingURL=SchemaListApiDivinerConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaListApiDivinerConfig.js","sourceRoot":"","sources":["../../../src/diviners/SchemaListApiDivinerConfig.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,mCAAmC,GAAwC,4CAA4C,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './SchemaListApiDiviner';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/diviners/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './SchemaListApiDiviner';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/diviners/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
@@ -1,23 +0,0 @@
1
- import { XyoApiConfig, XyoArchivistApi } from '@xyo-network/api'
2
-
3
- import { SchemaListApiDiviner } from './SchemaListApiDiviner'
4
- import { XyoSchemaListApiDivinerConfigSchema } from './SchemaListApiDivinerConfig'
5
-
6
- const configData: XyoApiConfig = {
7
- apiDomain: process.env.API_DOMAIN || 'https://beta.api.archivist.xyo.network',
8
- }
9
-
10
- test('SchemaListApiDiviner', async () => {
11
- const api = new XyoArchivistApi(configData)
12
- const diviner = await SchemaListApiDiviner.create({
13
- api,
14
- config: { archive: 'temp', schema: XyoSchemaListApiDivinerConfigSchema },
15
- logger: console,
16
- })
17
-
18
- expect(diviner).toBeDefined()
19
-
20
- const result = await diviner.divine()
21
-
22
- expect(result.length).toBeGreaterThan(0)
23
- })