@xyo-network/react-schema 2.64.0-rc.7 → 2.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/components/Property/SchemaProperty.cjs +76 -0
- package/dist/{node/components/Property/SchemaProperty.mjs.map → browser/components/Property/SchemaProperty.cjs.map} +1 -1
- package/dist/browser/components/Property/SchemaProperty.d.cts +40 -0
- package/dist/browser/components/Property/SchemaProperty.d.cts.map +1 -0
- package/dist/browser/components/Property/index.cjs +78 -0
- package/dist/browser/components/Property/index.cjs.map +1 -0
- package/dist/browser/components/Property/index.d.cts +2 -0
- package/dist/browser/components/Property/index.d.cts.map +1 -0
- package/dist/browser/components/SelectEx/SchemaSelectEx.cjs +68 -0
- package/dist/browser/components/SelectEx/SchemaSelectEx.cjs.map +1 -0
- package/dist/browser/components/SelectEx/SchemaSelectEx.d.cts +5 -0
- package/dist/browser/components/SelectEx/SchemaSelectEx.d.cts.map +1 -0
- package/dist/browser/components/SelectEx/index.cjs +70 -0
- package/dist/browser/components/SelectEx/index.cjs.map +1 -0
- package/dist/browser/components/SelectEx/index.d.cts +2 -0
- package/dist/browser/components/SelectEx/index.d.cts.map +1 -0
- package/dist/browser/components/index.cjs +123 -0
- package/dist/browser/components/index.cjs.map +1 -0
- package/dist/browser/components/index.d.cts +3 -0
- package/dist/browser/components/index.d.cts.map +1 -0
- package/dist/browser/contexts/Schema/Context.cjs +28 -0
- package/dist/{node/contexts/Schema/Context.mjs.map → browser/contexts/Schema/Context.cjs.map} +1 -1
- package/dist/browser/contexts/Schema/Context.d.cts +4 -0
- package/dist/browser/contexts/Schema/Context.d.cts.map +1 -0
- package/dist/browser/contexts/Schema/Provider/Memory.cjs +94 -0
- package/dist/browser/contexts/Schema/Provider/Memory.cjs.map +1 -0
- package/dist/browser/contexts/Schema/Provider/Memory.d.cts +5 -0
- package/dist/browser/contexts/Schema/Provider/Memory.d.cts.map +1 -0
- package/dist/browser/contexts/Schema/Provider/Props.cjs +19 -0
- package/dist/browser/contexts/Schema/Provider/Props.cjs.map +1 -0
- package/dist/browser/contexts/Schema/Provider/Props.d.cts +5 -0
- package/dist/browser/contexts/Schema/Provider/Props.d.cts.map +1 -0
- package/dist/browser/contexts/Schema/Provider/Route.cjs +144 -0
- package/dist/browser/contexts/Schema/Provider/Route.cjs.map +1 -0
- package/dist/browser/contexts/Schema/Provider/Route.d.cts +5 -0
- package/dist/browser/contexts/Schema/Provider/Route.d.cts.map +1 -0
- package/dist/browser/contexts/Schema/Provider/index.cjs +147 -0
- package/dist/browser/contexts/Schema/Provider/index.cjs.map +1 -0
- package/dist/browser/contexts/Schema/Provider/index.d.cts +4 -0
- package/dist/browser/contexts/Schema/Provider/index.d.cts.map +1 -0
- package/dist/browser/contexts/Schema/State.cjs +19 -0
- package/dist/browser/contexts/Schema/State.cjs.map +1 -0
- package/dist/browser/contexts/Schema/State.d.cts +13 -0
- package/dist/browser/contexts/Schema/State.d.cts.map +1 -0
- package/dist/browser/contexts/Schema/index.cjs +149 -0
- package/dist/browser/contexts/Schema/index.cjs.map +1 -0
- package/dist/browser/contexts/Schema/index.d.cts +5 -0
- package/dist/browser/contexts/Schema/index.d.cts.map +1 -0
- package/dist/browser/contexts/Schema/use.cjs +36 -0
- package/dist/browser/contexts/Schema/use.cjs.map +1 -0
- package/dist/browser/contexts/Schema/use.d.cts +3 -0
- package/dist/browser/contexts/Schema/use.d.cts.map +1 -0
- package/dist/browser/contexts/index.cjs +149 -0
- package/dist/browser/contexts/index.cjs.map +1 -0
- package/dist/browser/contexts/index.d.cts +2 -0
- package/dist/browser/contexts/index.d.cts.map +1 -0
- package/dist/browser/hooks/index.cjs +189 -0
- package/dist/browser/hooks/index.cjs.map +1 -0
- package/dist/browser/hooks/index.d.cts +5 -0
- package/dist/browser/hooks/index.d.cts.map +1 -0
- package/dist/browser/hooks/useGetSchema.cjs +69 -0
- package/dist/{node/hooks/useGetSchema.mjs.map → browser/hooks/useGetSchema.cjs.map} +1 -1
- package/dist/browser/hooks/useGetSchema.d.cts +27 -0
- package/dist/browser/hooks/useGetSchema.d.cts.map +1 -0
- package/dist/browser/hooks/useSchemaDefinitions.cjs +47 -0
- package/dist/{node/hooks/useSchemaDefinitions.mjs.map → browser/hooks/useSchemaDefinitions.cjs.map} +1 -1
- package/dist/browser/hooks/useSchemaDefinitions.d.cts +6 -0
- package/dist/browser/hooks/useSchemaDefinitions.d.cts.map +1 -0
- package/dist/browser/hooks/useSchemaList.cjs +69 -0
- package/dist/browser/hooks/useSchemaList.cjs.map +1 -0
- package/dist/browser/hooks/useSchemaList.d.cts +3 -0
- package/dist/browser/hooks/useSchemaList.d.cts.map +1 -0
- package/dist/browser/hooks/useSchemaStats.cjs +71 -0
- package/dist/{node/hooks/useSchemaStats.mjs.map → browser/hooks/useSchemaStats.cjs.map} +1 -1
- package/dist/browser/hooks/useSchemaStats.d.cts +4 -0
- package/dist/browser/hooks/useSchemaStats.d.cts.map +1 -0
- package/dist/browser/index.cjs +354 -0
- package/dist/browser/index.cjs.map +1 -0
- package/dist/browser/index.d.cts +4 -0
- package/dist/browser/index.d.cts.map +1 -0
- package/dist/docs.json +2071 -0
- package/dist/node/components/Property/SchemaProperty.cjs +81 -0
- package/dist/node/components/Property/SchemaProperty.cjs.map +1 -0
- package/dist/node/components/Property/SchemaProperty.d.cts +40 -0
- package/dist/node/components/Property/SchemaProperty.d.cts.map +1 -0
- package/dist/node/components/Property/SchemaProperty.js +26 -48
- package/dist/node/components/Property/SchemaProperty.js.map +1 -1
- package/dist/node/components/Property/index.cjs +83 -0
- package/dist/node/components/Property/index.cjs.map +1 -0
- package/dist/node/components/Property/index.d.cts +2 -0
- package/dist/node/components/Property/index.d.cts.map +1 -0
- package/dist/node/components/Property/index.js +53 -20
- package/dist/node/components/Property/index.js.map +1 -1
- package/dist/node/components/SelectEx/SchemaSelectEx.cjs +72 -0
- package/dist/node/components/SelectEx/SchemaSelectEx.cjs.map +1 -0
- package/dist/node/components/SelectEx/SchemaSelectEx.d.cts +5 -0
- package/dist/node/components/SelectEx/SchemaSelectEx.d.cts.map +1 -0
- package/dist/node/components/SelectEx/SchemaSelectEx.js +27 -39
- package/dist/node/components/SelectEx/SchemaSelectEx.js.map +1 -1
- package/dist/node/components/SelectEx/index.cjs +74 -0
- package/dist/node/components/SelectEx/index.cjs.map +1 -0
- package/dist/node/components/SelectEx/index.d.cts +2 -0
- package/dist/node/components/SelectEx/index.d.cts.map +1 -0
- package/dist/node/components/SelectEx/index.js +45 -21
- package/dist/node/components/SelectEx/index.js.map +1 -1
- package/dist/node/components/index.cjs +129 -0
- package/dist/node/components/index.cjs.map +1 -0
- package/dist/node/components/index.d.cts +3 -0
- package/dist/node/components/index.d.cts.map +1 -0
- package/dist/node/components/index.js +98 -22
- package/dist/node/components/index.js.map +1 -1
- package/dist/node/contexts/Schema/Context.cjs +32 -0
- package/dist/node/contexts/Schema/Context.cjs.map +1 -0
- package/dist/node/contexts/Schema/Context.d.cts +4 -0
- package/dist/node/contexts/Schema/Context.d.cts.map +1 -0
- package/dist/node/contexts/Schema/Context.js +5 -28
- package/dist/node/contexts/Schema/Context.js.map +1 -1
- package/dist/node/contexts/Schema/Provider/Memory.cjs +98 -0
- package/dist/node/contexts/Schema/Provider/Memory.cjs.map +1 -0
- package/dist/node/contexts/Schema/Provider/Memory.d.cts +5 -0
- package/dist/node/contexts/Schema/Provider/Memory.d.cts.map +1 -0
- package/dist/node/contexts/Schema/Provider/Memory.js +65 -37
- package/dist/node/contexts/Schema/Provider/Memory.js.map +1 -1
- package/dist/node/contexts/Schema/Provider/Props.cjs +19 -0
- package/dist/node/contexts/Schema/Provider/Props.cjs.map +1 -0
- package/dist/node/contexts/Schema/Provider/Props.d.cts +5 -0
- package/dist/node/contexts/Schema/Provider/Props.d.cts.map +1 -0
- package/dist/node/contexts/Schema/Provider/Props.js +0 -16
- package/dist/node/contexts/Schema/Provider/Props.js.map +1 -1
- package/dist/node/contexts/Schema/Provider/Route.cjs +148 -0
- package/dist/node/contexts/Schema/Provider/Route.cjs.map +1 -0
- package/dist/node/contexts/Schema/Provider/Route.d.cts +5 -0
- package/dist/node/contexts/Schema/Provider/Route.d.cts.map +1 -0
- package/dist/node/contexts/Schema/Provider/Route.js +94 -42
- package/dist/node/contexts/Schema/Provider/Route.js.map +1 -1
- package/dist/node/contexts/Schema/Provider/index.cjs +152 -0
- package/dist/node/contexts/Schema/Provider/index.cjs.map +1 -0
- package/dist/node/contexts/Schema/Provider/index.d.cts +4 -0
- package/dist/node/contexts/Schema/Provider/index.d.cts.map +1 -0
- package/dist/node/contexts/Schema/Provider/index.js +122 -25
- package/dist/node/contexts/Schema/Provider/index.js.map +1 -1
- package/dist/node/contexts/Schema/State.cjs +19 -0
- package/dist/node/contexts/Schema/State.cjs.map +1 -0
- package/dist/node/contexts/Schema/State.d.cts +13 -0
- package/dist/node/contexts/Schema/State.d.cts.map +1 -0
- package/dist/node/contexts/Schema/State.js +0 -16
- package/dist/node/contexts/Schema/State.js.map +1 -1
- package/dist/node/contexts/Schema/index.cjs +156 -0
- package/dist/node/contexts/Schema/index.cjs.map +1 -0
- package/dist/node/contexts/Schema/index.d.cts +5 -0
- package/dist/node/contexts/Schema/index.d.cts.map +1 -0
- package/dist/node/contexts/Schema/index.js +124 -27
- package/dist/node/contexts/Schema/index.js.map +1 -1
- package/dist/node/contexts/Schema/use.cjs +40 -0
- package/dist/node/contexts/Schema/use.cjs.map +1 -0
- package/dist/node/contexts/Schema/use.d.cts +3 -0
- package/dist/node/contexts/Schema/use.d.cts.map +1 -0
- package/dist/node/contexts/Schema/use.js +12 -30
- package/dist/node/contexts/Schema/use.js.map +1 -1
- package/dist/node/contexts/index.cjs +156 -0
- package/dist/node/contexts/index.cjs.map +1 -0
- package/dist/node/contexts/index.d.cts +2 -0
- package/dist/node/contexts/index.d.cts.map +1 -0
- package/dist/node/contexts/index.js +124 -21
- package/dist/node/contexts/index.js.map +1 -1
- package/dist/node/hooks/index.cjs +199 -0
- package/dist/node/hooks/index.cjs.map +1 -0
- package/dist/node/hooks/index.d.cts +5 -0
- package/dist/node/hooks/index.d.cts.map +1 -0
- package/dist/node/hooks/index.js +167 -27
- package/dist/node/hooks/index.js.map +1 -1
- package/dist/node/hooks/useGetSchema.cjs +73 -0
- package/dist/node/hooks/useGetSchema.cjs.map +1 -0
- package/dist/node/hooks/useGetSchema.d.cts +27 -0
- package/dist/node/hooks/useGetSchema.d.cts.map +1 -0
- package/dist/node/hooks/useGetSchema.js +18 -41
- package/dist/node/hooks/useGetSchema.js.map +1 -1
- package/dist/node/hooks/useSchemaDefinitions.cjs +54 -0
- package/dist/node/hooks/useSchemaDefinitions.cjs.map +1 -0
- package/dist/node/hooks/useSchemaDefinitions.d.cts +6 -0
- package/dist/node/hooks/useSchemaDefinitions.d.cts.map +1 -0
- package/dist/node/hooks/useSchemaDefinitions.js +14 -34
- package/dist/node/hooks/useSchemaDefinitions.js.map +1 -1
- package/dist/node/hooks/useSchemaList.cjs +73 -0
- package/dist/node/hooks/{useSchemaList.mjs.map → useSchemaList.cjs.map} +1 -1
- package/dist/node/hooks/useSchemaList.d.cts +3 -0
- package/dist/node/hooks/useSchemaList.d.cts.map +1 -0
- package/dist/node/hooks/useSchemaList.js +16 -39
- package/dist/node/hooks/useSchemaList.js.map +1 -1
- package/dist/node/hooks/useSchemaStats.cjs +75 -0
- package/dist/node/hooks/useSchemaStats.cjs.map +1 -0
- package/dist/node/hooks/useSchemaStats.d.cts +4 -0
- package/dist/node/hooks/useSchemaStats.d.cts.map +1 -0
- package/dist/node/hooks/useSchemaStats.js +17 -40
- package/dist/node/hooks/useSchemaStats.js.map +1 -1
- package/dist/node/index.cjs +371 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +4 -0
- package/dist/node/index.d.cts.map +1 -0
- package/dist/node/index.js +333 -25
- package/dist/node/index.js.map +1 -1
- package/package.json +36 -36
- package/dist/browser/components/Property/SchemaProperty.stories.js +0 -37
- package/dist/browser/components/Property/SchemaProperty.stories.js.map +0 -1
- package/dist/browser/hooks/stories/TestSchemaHooks.stories.js +0 -65
- package/dist/browser/hooks/stories/TestSchemaHooks.stories.js.map +0 -1
- package/dist/browser/hooks/useGetSchema.stories.js +0 -63
- package/dist/browser/hooks/useGetSchema.stories.js.map +0 -1
- package/dist/node/components/Property/SchemaProperty.mjs +0 -54
- package/dist/node/components/Property/SchemaProperty.stories.js +0 -64
- package/dist/node/components/Property/SchemaProperty.stories.js.map +0 -1
- package/dist/node/components/Property/SchemaProperty.stories.mjs +0 -37
- package/dist/node/components/Property/SchemaProperty.stories.mjs.map +0 -1
- package/dist/node/components/Property/index.mjs +0 -2
- package/dist/node/components/Property/index.mjs.map +0 -1
- package/dist/node/components/SelectEx/SchemaSelectEx.mjs +0 -35
- package/dist/node/components/SelectEx/SchemaSelectEx.mjs.map +0 -1
- package/dist/node/components/SelectEx/index.mjs +0 -2
- package/dist/node/components/SelectEx/index.mjs.map +0 -1
- package/dist/node/components/index.mjs +0 -3
- package/dist/node/components/index.mjs.map +0 -1
- package/dist/node/contexts/Schema/Context.mjs +0 -6
- package/dist/node/contexts/Schema/Provider/Memory.mjs +0 -21
- package/dist/node/contexts/Schema/Provider/Memory.mjs.map +0 -1
- package/dist/node/contexts/Schema/Provider/Props.mjs +0 -1
- package/dist/node/contexts/Schema/Provider/Props.mjs.map +0 -1
- package/dist/node/contexts/Schema/Provider/Route.mjs +0 -47
- package/dist/node/contexts/Schema/Provider/Route.mjs.map +0 -1
- package/dist/node/contexts/Schema/Provider/index.mjs +0 -4
- package/dist/node/contexts/Schema/Provider/index.mjs.map +0 -1
- package/dist/node/contexts/Schema/State.mjs +0 -1
- package/dist/node/contexts/Schema/State.mjs.map +0 -1
- package/dist/node/contexts/Schema/index.mjs +0 -5
- package/dist/node/contexts/Schema/index.mjs.map +0 -1
- package/dist/node/contexts/Schema/use.mjs +0 -9
- package/dist/node/contexts/Schema/use.mjs.map +0 -1
- package/dist/node/contexts/index.mjs +0 -2
- package/dist/node/contexts/index.mjs.map +0 -1
- package/dist/node/hooks/index.mjs +0 -5
- package/dist/node/hooks/index.mjs.map +0 -1
- package/dist/node/hooks/stories/TestSchemaHooks.stories.js +0 -89
- package/dist/node/hooks/stories/TestSchemaHooks.stories.js.map +0 -1
- package/dist/node/hooks/stories/TestSchemaHooks.stories.mjs +0 -65
- package/dist/node/hooks/stories/TestSchemaHooks.stories.mjs.map +0 -1
- package/dist/node/hooks/useGetSchema.mjs +0 -47
- package/dist/node/hooks/useGetSchema.stories.js +0 -98
- package/dist/node/hooks/useGetSchema.stories.js.map +0 -1
- package/dist/node/hooks/useGetSchema.stories.mjs +0 -63
- package/dist/node/hooks/useGetSchema.stories.mjs.map +0 -1
- package/dist/node/hooks/useSchemaDefinitions.mjs +0 -25
- package/dist/node/hooks/useSchemaList.mjs +0 -47
- package/dist/node/hooks/useSchemaStats.mjs +0 -49
- package/dist/node/index.mjs +0 -4
- package/dist/node/index.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/hooks/stories/TestSchemaHooks.stories.tsx"],"sourcesContent":["import { Alert, Button, TextField, Typography } from '@mui/material'\nimport { Decorator, Meta, StoryFn } from '@storybook/react'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { HttpBridge, HttpBridgeConfigSchema } from '@xyo-network/http-bridge'\nimport { MemoryNode } from '@xyo-network/node-memory'\nimport { NodeConfigSchema } from '@xyo-network/node-model'\nimport { NodeProvider } from '@xyo-network/react-node'\nimport { DefaultSeedPhrase } from '@xyo-network/react-storybook'\nimport { useWallet, WalletProvider } from '@xyo-network/react-wallet'\nimport { SchemaCache } from '@xyo-network/schema-cache'\nimport { useState } from 'react'\n\nimport { useSchemaDefinitions } from '../useSchemaDefinitions'\nimport { useSchemaList } from '../useSchemaList'\nimport { useSchemaStats } from '../useSchemaStats'\n\nconst apiConfig = { apiDomain: 'https://api.archivist.xyo.network' }\nconst nodeUrl = 'http://localhost:8080/node'\n\nconst MemoryNodeDecorator: Decorator = (Story, args) => {\n const [node, setNode] = useState<MemoryNode>()\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async () => {\n const node = await MemoryNode.create({ config: { schema: NodeConfigSchema } })\n const bridge = await HttpBridge.create({ config: { nodeUrl, schema: HttpBridgeConfigSchema, security: { allowAnonymous: true } } })\n await node.register(bridge)\n await node.attach(bridge.address, true)\n setNode(node)\n },\n [],\n )\n\n const [wallet] = useWallet({ mnemonic: DefaultSeedPhrase })\n\n return (\n <WalletProvider rootWallet={wallet}>\n <NodeProvider node={node}>\n <Story {...args} />\n </NodeProvider>\n </WalletProvider>\n )\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n decorators: [MemoryNodeDecorator],\n title: 'schema/Hooks',\n} as Meta\n\nconst Template: StoryFn<React.FC> = () => {\n SchemaCache.instance.proxy = `${apiConfig.apiDomain}/domain`\n const [addressText, setAddressText] = useState<string>('')\n const [address, setAddress] = useState<string>()\n const [schemaStats, schemaStatsError] = useSchemaStats(address)\n const [schemaList, schemaListError] = useSchemaList(address)\n const mappedSchemaList = schemaList?.schemas?.map((name) => ({ name })) as { name: string }[]\n const schemaDefinitions = useSchemaDefinitions(mappedSchemaList)\n\n return (\n <div style={{ display: 'flex', flexDirection: 'column', rowGap: '16px' }}>\n {schemaStatsError ? <Alert severity={'error'}>{schemaStatsError.message ?? schemaListError?.message}</Alert> : null}\n <FlexGrowRow columnGap={4}>\n <TextField fullWidth size=\"small\" value={address} label=\"Address\" onChange={(event) => setAddressText(event.target.value)} />\n <Button variant=\"contained\" onClick={() => setAddress(addressText)} sx={{ whiteSpace: 'nowrap' }}>\n Get Stats\n </Button>\n </FlexGrowRow>\n <Typography variant={'h2'}>Schema Stats</Typography>\n <code>\n <pre>{JSON.stringify(schemaStats, null, 2)}</pre>\n </code>\n <Typography variant={'h2'}>Schema List</Typography>\n <code>\n <pre>{JSON.stringify(schemaList, null, 2)}</pre>\n </code>\n <Typography variant={'h2'}>Schema Definitions</Typography>\n <pre>\n <code>{JSON.stringify(schemaDefinitions, null, 2)}</code>\n </pre>\n </div>\n )\n}\n\nconst Default = Template.bind({})\n\nexport { Default }\n"],"mappings":"AAwCQ,cAwBF,YAxBE;AAxCR,SAAS,OAAO,QAAQ,WAAW,kBAAkB;AAErD,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,YAAY,8BAA8B;AACnD,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAC7B,SAAS,yBAAyB;AAClC,SAAS,WAAW,sBAAsB;AAC1C,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AAEzB,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAE/B,MAAM,YAAY,EAAE,WAAW,oCAAoC;AACnE,MAAM,UAAU;AAEhB,MAAM,sBAAiC,CAAC,OAAO,SAAS;AACtD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAqB;AAE7C;AAAA;AAAA,IAEE,YAAY;AACV,YAAMA,QAAO,MAAM,WAAW,OAAO,EAAE,QAAQ,EAAE,QAAQ,iBAAiB,EAAE,CAAC;AAC7E,YAAM,SAAS,MAAM,WAAW,OAAO,EAAE,QAAQ,EAAE,SAAS,QAAQ,wBAAwB,UAAU,EAAE,gBAAgB,KAAK,EAAE,EAAE,CAAC;AAClI,YAAMA,MAAK,SAAS,MAAM;AAC1B,YAAMA,MAAK,OAAO,OAAO,SAAS,IAAI;AACtC,cAAQA,KAAI;AAAA,IACd;AAAA,IACA,CAAC;AAAA,EACH;AAEA,QAAM,CAAC,MAAM,IAAI,UAAU,EAAE,UAAU,kBAAkB,CAAC;AAE1D,SACE,oBAAC,kBAAe,YAAY,QAC1B,8BAAC,gBAAa,MACZ,8BAAC,SAAO,GAAG,MAAM,GACnB,GACF;AAEJ;AAGA,IAAO,kCAAQ;AAAA,EACb,YAA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;AAEA,MAAM,UAAU,SAAS,KAAK,CAAC,CAAC;","names":["node"]}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FormControl, TextField, Typography } from "@mui/material";
|
|
3
|
-
import { FlexCol, FlexRow } from "@xylabs/react-flexbox";
|
|
4
|
-
import { SchemaCache } from "@xyo-network/schema-cache";
|
|
5
|
-
import { lazy, Suspense, useEffect, useState } from "react";
|
|
6
|
-
import { useGetSchemaPayload } from "./useGetSchema";
|
|
7
|
-
const JsonView = lazy(() => import(
|
|
8
|
-
/* webpackChunkName: "jsonView" */
|
|
9
|
-
"react-json-view"
|
|
10
|
-
));
|
|
11
|
-
SchemaCache.instance.proxy = "https://beta.api.archivist.xyo.network/domain";
|
|
12
|
-
const UseGetSchemaComponent = ({ schema }) => {
|
|
13
|
-
const exampleSchemas = ["network.xyo.domain", "network.xyo.payload", "network.xyo.schema"];
|
|
14
|
-
const [schemaFieldValue, setSchemaFieldValue] = useState("");
|
|
15
|
-
const { schemaPayload } = useGetSchemaPayload(schemaFieldValue);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
if (schema) {
|
|
18
|
-
setSchemaFieldValue(schema);
|
|
19
|
-
}
|
|
20
|
-
}, [schema]);
|
|
21
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22
|
-
/* @__PURE__ */ jsxs(Typography, { variant: "body1", fontWeight: "bold", mb: 2, children: [
|
|
23
|
-
"Example schemas to test:",
|
|
24
|
-
exampleSchemas.map((schema2, index) => /* @__PURE__ */ jsx(
|
|
25
|
-
Typography,
|
|
26
|
-
{
|
|
27
|
-
component: "span",
|
|
28
|
-
mx: 1,
|
|
29
|
-
onClick: () => setSchemaFieldValue(schema2),
|
|
30
|
-
sx: { cursor: "pointer", textDecoration: "underline" },
|
|
31
|
-
children: schema2
|
|
32
|
-
},
|
|
33
|
-
index
|
|
34
|
-
))
|
|
35
|
-
] }),
|
|
36
|
-
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(TextField, { value: schemaFieldValue, label: "Schema Name", onChange: (e) => setSchemaFieldValue(e.target.value) }) }),
|
|
37
|
-
/* @__PURE__ */ jsx(FlexRow, { my: 3, justifyContent: "start", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(FlexCol, { busy: true }), children: /* @__PURE__ */ jsx(JsonView, { src: schemaPayload || {} }) }) })
|
|
38
|
-
] });
|
|
39
|
-
};
|
|
40
|
-
const StorybookEntry = {
|
|
41
|
-
argTypes: {},
|
|
42
|
-
component: UseGetSchemaComponent,
|
|
43
|
-
parameters: {
|
|
44
|
-
docs: {
|
|
45
|
-
page: null
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
title: "payload/useGetSchema"
|
|
49
|
-
};
|
|
50
|
-
const Template = ({ schema }) => {
|
|
51
|
-
return /* @__PURE__ */ jsx(UseGetSchemaComponent, { schema });
|
|
52
|
-
};
|
|
53
|
-
const Default = Template.bind({});
|
|
54
|
-
Default.args = { schema: "network.xyo.schema" };
|
|
55
|
-
const Domain = Template.bind({});
|
|
56
|
-
Domain.args = { schema: "network.xyo.domain" };
|
|
57
|
-
var useGetSchema_stories_default = StorybookEntry;
|
|
58
|
-
export {
|
|
59
|
-
Default,
|
|
60
|
-
Domain,
|
|
61
|
-
useGetSchema_stories_default as default
|
|
62
|
-
};
|
|
63
|
-
//# sourceMappingURL=useGetSchema.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/useGetSchema.stories.tsx"],"sourcesContent":["import { FormControl, TextField, Typography } from '@mui/material'\nimport { Meta, StoryFn } from '@storybook/react'\nimport { FlexCol, FlexRow } from '@xylabs/react-flexbox'\nimport { SchemaCache } from '@xyo-network/schema-cache'\nimport { lazy, Suspense, useEffect, useState } from 'react'\n\nimport { useGetSchemaPayload } from './useGetSchema'\n\nconst JsonView = lazy(() => import(/* webpackChunkName: \"jsonView\" */ 'react-json-view'))\n\nSchemaCache.instance.proxy = 'https://beta.api.archivist.xyo.network/domain'\n\nconst UseGetSchemaComponent: React.FC<{ schema: string }> = ({ schema }) => {\n const exampleSchemas = ['network.xyo.domain', 'network.xyo.payload', 'network.xyo.schema']\n const [schemaFieldValue, setSchemaFieldValue] = useState('')\n const { schemaPayload } = useGetSchemaPayload(schemaFieldValue)\n\n useEffect(() => {\n if (schema) {\n setSchemaFieldValue(schema)\n }\n }, [schema])\n\n return (\n <>\n <Typography variant=\"body1\" fontWeight=\"bold\" mb={2}>\n Example schemas to test:\n {exampleSchemas.map((schema, index) => (\n <Typography\n component=\"span\"\n mx={1}\n key={index}\n onClick={() => setSchemaFieldValue(schema)}\n sx={{ cursor: 'pointer', textDecoration: 'underline' }}\n >\n {schema}\n </Typography>\n ))}\n </Typography>\n <FormControl>\n <TextField value={schemaFieldValue} label=\"Schema Name\" onChange={(e) => setSchemaFieldValue(e.target.value)} />\n </FormControl>\n <FlexRow my={3} justifyContent=\"start\">\n <Suspense fallback={<FlexCol busy />}>\n <JsonView src={schemaPayload || {}} />\n </Suspense>\n </FlexRow>\n </>\n )\n}\n\nconst StorybookEntry: Meta = {\n argTypes: {},\n component: UseGetSchemaComponent,\n parameters: {\n docs: {\n page: null,\n },\n },\n title: 'payload/useGetSchema',\n}\n\nconst Template: StoryFn<typeof UseGetSchemaComponent> = ({ schema }) => {\n return <UseGetSchemaComponent schema={schema} />\n}\n\nconst Default = Template.bind({})\nDefault.args = { schema: 'network.xyo.schema' }\n\nconst Domain = Template.bind({})\nDomain.args = { schema: 'network.xyo.domain' }\n\nexport { Default, Domain }\n\n// eslint-disable-next-line import/no-default-export\nexport default StorybookEntry\n"],"mappings":"AAwBI,mBAIM,KAHJ,YADF;AAxBJ,SAAS,aAAa,WAAW,kBAAkB;AAEnD,SAAS,SAAS,eAAe;AACjC,SAAS,mBAAmB;AAC5B,SAAS,MAAM,UAAU,WAAW,gBAAgB;AAEpD,SAA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AACtE,SAAO,oBAAC,yBAAsB,QAAgB;AAChD;AAEA,MAAM,UAAU,SAAS,KAAK,CAAC,CAAC;AAChC,QAAQ,OAAO,EAAE,QAAQ,qBAAqB;AAE9C,MAAM,SAAS,SAAS,KAAK,CAAC,CAAC;AAC/B,OAAO,OAAO,EAAE,QAAQ,qBAAqB;AAK7C,IAAO,+BAAQ;","names":["schema"]}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { NewReleases as NewReleasesIcon, OpenInNew as OpenInNewIcon, Verified as VerifiedIcon } from "@mui/icons-material";
|
|
3
|
-
import { IconButton } from "@mui/material";
|
|
4
|
-
import { useAsyncEffect } from "@xylabs/react-async-effect";
|
|
5
|
-
import { LinkEx } from "@xylabs/react-link";
|
|
6
|
-
import { useEvent } from "@xyo-network/react-event";
|
|
7
|
-
import { Property, PropertyValue } from "@xyo-network/react-property";
|
|
8
|
-
import { SchemaCache } from "@xyo-network/schema-cache";
|
|
9
|
-
import { forwardRef, useState } from "react";
|
|
10
|
-
const useResolveSchema = (schema) => {
|
|
11
|
-
const [entry, setEntry] = useState();
|
|
12
|
-
useAsyncEffect(
|
|
13
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
|
-
async (mounted) => {
|
|
15
|
-
if (schema) {
|
|
16
|
-
const entry2 = await SchemaCache.instance.get(schema);
|
|
17
|
-
if (mounted()) {
|
|
18
|
-
setEntry(entry2);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
[schema]
|
|
23
|
-
);
|
|
24
|
-
return entry;
|
|
25
|
-
};
|
|
26
|
-
const SchemaProperty = forwardRef(
|
|
27
|
-
({ showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props }, forwardedRef) => {
|
|
28
|
-
const resolvedSchema = useResolveSchema(value);
|
|
29
|
-
const [buttonRef, buttonDispatch] = useEvent(void 0);
|
|
30
|
-
const [divRef, divDispatch] = useEvent(void 0);
|
|
31
|
-
const onClick = (dispatch, openNewWindow = false) => {
|
|
32
|
-
dispatch?.(
|
|
33
|
-
"schema",
|
|
34
|
-
"click",
|
|
35
|
-
JSON.stringify({
|
|
36
|
-
openNewWindow,
|
|
37
|
-
schema: value
|
|
38
|
-
})
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
return /* @__PURE__ */ jsxs(Property, { ref: forwardedRef, title: "Schema", value, tip: "Schema sent with the payload", titleProps, ...props, children: [
|
|
42
|
-
value && showStatusIcon ? resolvedSchema === null ? /* @__PURE__ */ jsx(IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch), children: /* @__PURE__ */ jsx(NewReleasesIcon, { color: "warning", fontSize: "inherit" }) }) : resolvedSchema === void 0 ? /* @__PURE__ */ jsx(IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch), children: /* @__PURE__ */ jsx(NewReleasesIcon, { color: "disabled", fontSize: "inherit" }) }) : /* @__PURE__ */ jsx(IconButton, { rel: "noopener noreferrer", size: "small", target: "_blank", href: resolvedSchema?.huri?.href ?? "", children: /* @__PURE__ */ jsx(VerifiedIcon, { color: "success", fontSize: "inherit" }) }) : null,
|
|
43
|
-
value ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44
|
-
showLinkNames ? /* @__PURE__ */ jsx(LinkEx, { display: "block", width: "100%", sx: { cursor: "pointer" }, children: /* @__PURE__ */ jsx(PropertyValue, { ref: divRef, value, title: "view schema", onClick: () => onClick(divDispatch) }) }) : /* @__PURE__ */ jsx(PropertyValue, { ref: divRef, value, title: "view schema", onClick: () => onClick(divDispatch) }),
|
|
45
|
-
showOpenNewWindowLink ? /* @__PURE__ */ jsx(IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch, true), children: /* @__PURE__ */ jsx(OpenInNewIcon, { fontSize: "inherit" }) }) : null
|
|
46
|
-
] }) : null
|
|
47
|
-
] });
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
SchemaProperty.displayName = "SchemaProperty";
|
|
51
|
-
export {
|
|
52
|
-
SchemaProperty
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=SchemaProperty.mjs.map
|
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
var SchemaProperty_stories_exports = {};
|
|
20
|
-
__export(SchemaProperty_stories_exports, {
|
|
21
|
-
Default: () => Default,
|
|
22
|
-
WithUnverifiedValue: () => WithUnverifiedValue,
|
|
23
|
-
WithVerifiedValue: () => WithVerifiedValue,
|
|
24
|
-
WithVerifiedValuePaper: () => WithVerifiedValuePaper,
|
|
25
|
-
default: () => SchemaProperty_stories_default
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(SchemaProperty_stories_exports);
|
|
28
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
-
var import_react_event = require("@xyo-network/react-event");
|
|
30
|
-
var import_react_storybook = require("@xyo-network/react-storybook");
|
|
31
|
-
var import_SchemaProperty = require("./SchemaProperty");
|
|
32
|
-
const StorybookEntry = {
|
|
33
|
-
component: import_SchemaProperty.SchemaProperty,
|
|
34
|
-
decorators: [import_react_storybook.useAppThemeDecorator],
|
|
35
|
-
parameters: {
|
|
36
|
-
docs: {
|
|
37
|
-
page: null
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
title: "Schema/SchemaProperty"
|
|
41
|
-
};
|
|
42
|
-
const Template = (args) => {
|
|
43
|
-
const [ref] = (0, import_react_event.useEvent)((noun, verb, data) => {
|
|
44
|
-
console.log(`${noun}|${verb}|${data}`);
|
|
45
|
-
});
|
|
46
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SchemaProperty.SchemaProperty, { ...args }) });
|
|
47
|
-
};
|
|
48
|
-
const Default = Template.bind({});
|
|
49
|
-
Default.args = {};
|
|
50
|
-
const WithVerifiedValue = Template.bind({});
|
|
51
|
-
WithVerifiedValue.args = { value: "network.xyo.schema" };
|
|
52
|
-
const WithVerifiedValuePaper = Template.bind({});
|
|
53
|
-
WithVerifiedValuePaper.args = { paper: true, value: "network.xyo.schema" };
|
|
54
|
-
const WithUnverifiedValue = Template.bind({});
|
|
55
|
-
WithUnverifiedValue.args = { value: "network.xyo.blahblah" };
|
|
56
|
-
var SchemaProperty_stories_default = StorybookEntry;
|
|
57
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
-
0 && (module.exports = {
|
|
59
|
-
Default,
|
|
60
|
-
WithUnverifiedValue,
|
|
61
|
-
WithVerifiedValue,
|
|
62
|
-
WithVerifiedValuePaper
|
|
63
|
-
});
|
|
64
|
-
//# sourceMappingURL=SchemaProperty.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Property/SchemaProperty.stories.tsx"],"sourcesContent":["import { Meta, StoryFn } from '@storybook/react'\nimport { useEvent } from '@xyo-network/react-event'\nimport { useAppThemeDecorator } from '@xyo-network/react-storybook'\n\nimport { SchemaProperty, SchemaPropertyProps } from './SchemaProperty'\n\nconst StorybookEntry: Meta = {\n component: SchemaProperty,\n decorators: [useAppThemeDecorator],\n parameters: {\n docs: {\n page: null,\n },\n },\n title: 'Schema/SchemaProperty',\n}\n\nconst Template: StoryFn<typeof SchemaProperty> = (args: SchemaPropertyProps) => {\n const [ref] = useEvent<HTMLDivElement>((noun, verb, data) => {\n console.log(`${noun}|${verb}|${data}`)\n })\n return (\n <div ref={ref}>\n <SchemaProperty {...args} />\n </div>\n )\n}\n\nconst Default = Template.bind({})\nDefault.args = {}\n\nconst WithVerifiedValue = Template.bind({})\nWithVerifiedValue.args = { value: 'network.xyo.schema' }\n\nconst WithVerifiedValuePaper = Template.bind({})\nWithVerifiedValuePaper.args = { paper: true, value: 'network.xyo.schema' }\n\nconst WithUnverifiedValue = Template.bind({})\nWithUnverifiedValue.args = { value: 'network.xyo.blahblah' }\n\nexport { Default, WithUnverifiedValue, WithVerifiedValue, WithVerifiedValuePaper }\n\n// eslint-disable-next-line import/no-default-export\nexport default StorybookEntry\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBM;AAtBN,yBAAyB;AACzB,6BAAqC;AAErC,4BAAoD;AAEpD,MAAM,iBAAuB;AAAA,EAC3B,WAAW;AAAA,EACX,YAAY,CAAC,2CAAoB;AAAA,EACjC,YAAY;AAAA,IACV,MAAM;AAAA,MACJ,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,OAAO;AACT;AAEA,MAAM,WAA2C,CAAC,SAA8B;AAC9E,QAAM,CAAC,GAAG,QAAI,6BAAyB,CAAC,MAAM,MAAM,SAAS;AAC3D,YAAQ,IAAI,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE;AAAA,EACvC,CAAC;AACD,SACE,4CAAC,SAAI,KACH,sDAAC,wCAAgB,GAAG,MAAM,GAC5B;AAEJ;AAEA,MAAM,UAAU,SAAS,KAAK,CAAC,CAAC;AAChC,QAAQ,OAAO,CAAC;AAEhB,MAAM,oBAAoB,SAAS,KAAK,CAAC,CAAC;AAC1C,kBAAkB,OAAO,EAAE,OAAO,qBAAqB;AAEvD,MAAM,yBAAyB,SAAS,KAAK,CAAC,CAAC;AAC/C,uBAAuB,OAAO,EAAE,OAAO,MAAM,OAAO,qBAAqB;AAEzE,MAAM,sBAAsB,SAAS,KAAK,CAAC,CAAC;AAC5C,oBAAoB,OAAO,EAAE,OAAO,uBAAuB;AAK3D,IAAO,iCAAQ;","names":[]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEvent } from "@xyo-network/react-event";
|
|
3
|
-
import { useAppThemeDecorator } from "@xyo-network/react-storybook";
|
|
4
|
-
import { SchemaProperty } from "./SchemaProperty";
|
|
5
|
-
const StorybookEntry = {
|
|
6
|
-
component: SchemaProperty,
|
|
7
|
-
decorators: [useAppThemeDecorator],
|
|
8
|
-
parameters: {
|
|
9
|
-
docs: {
|
|
10
|
-
page: null
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
title: "Schema/SchemaProperty"
|
|
14
|
-
};
|
|
15
|
-
const Template = (args) => {
|
|
16
|
-
const [ref] = useEvent((noun, verb, data) => {
|
|
17
|
-
console.log(`${noun}|${verb}|${data}`);
|
|
18
|
-
});
|
|
19
|
-
return /* @__PURE__ */ jsx("div", { ref, children: /* @__PURE__ */ jsx(SchemaProperty, { ...args }) });
|
|
20
|
-
};
|
|
21
|
-
const Default = Template.bind({});
|
|
22
|
-
Default.args = {};
|
|
23
|
-
const WithVerifiedValue = Template.bind({});
|
|
24
|
-
WithVerifiedValue.args = { value: "network.xyo.schema" };
|
|
25
|
-
const WithVerifiedValuePaper = Template.bind({});
|
|
26
|
-
WithVerifiedValuePaper.args = { paper: true, value: "network.xyo.schema" };
|
|
27
|
-
const WithUnverifiedValue = Template.bind({});
|
|
28
|
-
WithUnverifiedValue.args = { value: "network.xyo.blahblah" };
|
|
29
|
-
var SchemaProperty_stories_default = StorybookEntry;
|
|
30
|
-
export {
|
|
31
|
-
Default,
|
|
32
|
-
WithUnverifiedValue,
|
|
33
|
-
WithVerifiedValue,
|
|
34
|
-
WithVerifiedValuePaper,
|
|
35
|
-
SchemaProperty_stories_default as default
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=SchemaProperty.stories.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Property/SchemaProperty.stories.tsx"],"sourcesContent":["import { Meta, StoryFn } from '@storybook/react'\nimport { useEvent } from '@xyo-network/react-event'\nimport { useAppThemeDecorator } from '@xyo-network/react-storybook'\n\nimport { SchemaProperty, SchemaPropertyProps } from './SchemaProperty'\n\nconst StorybookEntry: Meta = {\n component: SchemaProperty,\n decorators: [useAppThemeDecorator],\n parameters: {\n docs: {\n page: null,\n },\n },\n title: 'Schema/SchemaProperty',\n}\n\nconst Template: StoryFn<typeof SchemaProperty> = (args: SchemaPropertyProps) => {\n const [ref] = useEvent<HTMLDivElement>((noun, verb, data) => {\n console.log(`${noun}|${verb}|${data}`)\n })\n return (\n <div ref={ref}>\n <SchemaProperty {...args} />\n </div>\n )\n}\n\nconst Default = Template.bind({})\nDefault.args = {}\n\nconst WithVerifiedValue = Template.bind({})\nWithVerifiedValue.args = { value: 'network.xyo.schema' }\n\nconst WithVerifiedValuePaper = Template.bind({})\nWithVerifiedValuePaper.args = { paper: true, value: 'network.xyo.schema' }\n\nconst WithUnverifiedValue = Template.bind({})\nWithUnverifiedValue.args = { value: 'network.xyo.blahblah' }\n\nexport { Default, WithUnverifiedValue, WithVerifiedValue, WithVerifiedValuePaper }\n\n// eslint-disable-next-line import/no-default-export\nexport default StorybookEntry\n"],"mappings":"AAuBM;AAtBN,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AAErC,SAAS,sBAA2C;AAEpD,MAAM,iBAAuB;AAAA,EAC3B,WAAW;AAAA,EACX,YAAY,CAAC,oBAAoB;AAAA,EACjC,YAAY;AAAA,IACV,MAAM;AAAA,MACJ,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,OAAO;AACT;AAEA,MAAM,WAA2C,CAAC,SAA8B;AAC9E,QAAM,CAAC,GAAG,IAAI,SAAyB,CAAC,MAAM,MAAM,SAAS;AAC3D,YAAQ,IAAI,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE;AAAA,EACvC,CAAC;AACD,SACE,oBAAC,SAAI,KACH,8BAAC,kBAAgB,GAAG,MAAM,GAC5B;AAEJ;AAEA,MAAM,UAAU,SAAS,KAAK,CAAC,CAAC;AAChC,QAAQ,OAAO,CAAC;AAEhB,MAAM,oBAAoB,SAAS,KAAK,CAAC,CAAC;AAC1C,kBAAkB,OAAO,EAAE,OAAO,qBAAqB;AAEvD,MAAM,yBAAyB,SAAS,KAAK,CAAC,CAAC;AAC/C,uBAAuB,OAAO,EAAE,OAAO,MAAM,OAAO,qBAAqB;AAEzE,MAAM,sBAAsB,SAAS,KAAK,CAAC,CAAC;AAC5C,oBAAoB,OAAO,EAAE,OAAO,uBAAuB;AAK3D,IAAO,iCAAQ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/Property/index.ts"],"sourcesContent":["export * from './SchemaProperty'\n"],"mappings":"AAAA,cAAc;","names":[]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { MenuItem, Typography } from "@mui/material";
|
|
3
|
-
import { SelectEx } from "@xylabs/react-select";
|
|
4
|
-
import { useSchema } from "../../contexts";
|
|
5
|
-
const SchemaSelectEx = ({ onChange, ...props }) => {
|
|
6
|
-
const { schema, setSchema, schemaList } = useSchema(false);
|
|
7
|
-
return /* @__PURE__ */ jsxs(
|
|
8
|
-
SelectEx,
|
|
9
|
-
{
|
|
10
|
-
variant: "outlined",
|
|
11
|
-
size: "small",
|
|
12
|
-
value: schema ?? "none",
|
|
13
|
-
onChange: (event, child) => {
|
|
14
|
-
if (event.target.value !== schema) {
|
|
15
|
-
onChange?.(event, child);
|
|
16
|
-
setSchema?.(event.target.value);
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
renderValue: (value) => {
|
|
20
|
-
return /* @__PURE__ */ jsx(Typography, { children: value === "none" ? "- None -" : value });
|
|
21
|
-
},
|
|
22
|
-
...props,
|
|
23
|
-
children: [
|
|
24
|
-
schemaList?.map((schema2, index) => {
|
|
25
|
-
return /* @__PURE__ */ jsx(MenuItem, { value: schema2, children: schema2 }, index);
|
|
26
|
-
}),
|
|
27
|
-
/* @__PURE__ */ jsx(MenuItem, { value: "none", children: "- None -" }, "none")
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
export {
|
|
33
|
-
SchemaSelectEx
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=SchemaSelectEx.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/SelectEx/SchemaSelectEx.tsx"],"sourcesContent":["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, ...props }) => {\n const { schema, setSchema, schemaList } = useSchema(false)\n\n return (\n <SelectEx\n variant=\"outlined\"\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"],"mappings":"AAWI,SAWW,KAXX;AAXJ,SAAS,UAAU,kBAAkB;AACrC,SAAS,gBAA+B;AAExC,SAAS,iBAAiB;AAInB,MAAM,iBAAgD,CAAC,EAAE,UAAU,GAAG,MAAM,MAAM;AACvF,QAAM,EAAE,QAAQ,WAAW,WAAW,IAAI,UAAU,KAAK;AAEzD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,OAAO,UAAU;AAAA,MACjB,UAAU,CAAC,OAAO,UAAU;AAC1B,YAAI,MAAM,OAAO,UAAU,QAAQ;AACjC,qBAAW,OAAO,KAAK;AACvB,sBAAY,MAAM,OAAO,KAAK;AAAA,QAChC;AAAA,MACF;AAAA,MACA,aAAa,CAAC,UAAU;AACtB,eAAO,oBAAC,cAAY,oBAAU,SAAS,aAAa,OAAM;AAAA,MAC5D;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,oBAAY,IAAI,CAACA,SAAQ,UAAU;AAClC,iBACE,oBAAC,YAAqB,OAAOA,SAC1B,UAAAA,WADY,KAEf;AAAA,QAEJ,CAAC;AAAA,QACD,oBAAC,YAAoB,OAAM,QAAO,wBAApB,MAEd;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["schema"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/SelectEx/index.ts"],"sourcesContent":["export * from './SchemaSelectEx'\n"],"mappings":"AAAA,cAAc;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["export * from './Property'\nexport * from './SelectEx'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { compact } from "@xylabs/lodash";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { useSchemaStats } from "../../../hooks";
|
|
5
|
-
import { SchemaContext } from "../Context";
|
|
6
|
-
const SchemaMemoryProvider = ({ defaultSchema, knownSchemaList = [], ...props }) => {
|
|
7
|
-
const [schema, setSchema] = useState(defaultSchema);
|
|
8
|
-
const [schemaList, setSchemaList] = useState(knownSchemaList);
|
|
9
|
-
const [fetchedSchemaStats] = useSchemaStats();
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
if (fetchedSchemaStats) {
|
|
12
|
-
const schemaList2 = compact(fetchedSchemaStats.map(({ name }) => name));
|
|
13
|
-
setSchemaList(schemaList2);
|
|
14
|
-
}
|
|
15
|
-
}, [fetchedSchemaStats]);
|
|
16
|
-
return /* @__PURE__ */ jsx(SchemaContext.Provider, { value: { provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList }, ...props });
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
SchemaMemoryProvider
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=Memory.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/contexts/Schema/Provider/Memory.tsx"],"sourcesContent":["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"],"mappings":"AAoBS;AApBT,SAAS,eAAe;AAExB,SAAS,WAAW,gBAAgB;AAEpC,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAGvB,MAAM,uBAAoE,CAAC,EAAE,eAAe,kBAAkB,CAAC,GAAG,GAAG,MAAM,MAAM;AACtI,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,aAAa;AAClD,QAAM,CAAC,YAAY,aAAa,IAAI,SAA+B,eAAe;AAClF,QAAM,CAAC,kBAAkB,IAAI,eAAe;AAE5C,YAAU,MAAM;AACd,QAAI,oBAAoB;AACtB,YAAMA,cAAa,QAAQ,mBAAmB,IAAI,CAAC,EAAE,KAAK,MAAM,IAAI,CAAC;AACrE,oBAAcA,WAAU;AAAA,IAC1B;AAAA,EACF,GAAG,CAAC,kBAAkB,CAAC;AAEvB,SAAO,oBAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,mBAAmB,YAAY,WAAW,cAAc,GAAI,GAAG,OAAO;AACpJ;","names":["schemaList"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=Props.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect } from "react";
|
|
3
|
-
import { useSearchParams } from "react-router-dom";
|
|
4
|
-
import { SchemaContext } from "../Context";
|
|
5
|
-
import { useSchema } from "../use";
|
|
6
|
-
import { SchemaMemoryProvider } from "./Memory";
|
|
7
|
-
const SchemaRouteProviderInner = ({ children }) => {
|
|
8
|
-
const { schema, setSchema, schemaList } = useSchema();
|
|
9
|
-
const [params, setParams] = useSearchParams();
|
|
10
|
-
const routeSchema = params.get("schema");
|
|
11
|
-
const setSchemaParam = useCallback(
|
|
12
|
-
(schema2) => {
|
|
13
|
-
if (schema2) {
|
|
14
|
-
params.set("schema", schema2);
|
|
15
|
-
setParams(params, { replace: true });
|
|
16
|
-
setSchema?.(schema2);
|
|
17
|
-
} else {
|
|
18
|
-
params.delete("network");
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
[params, setParams, setSchema]
|
|
22
|
-
);
|
|
23
|
-
const setSchemaLocal = useCallback(
|
|
24
|
-
(schema2) => {
|
|
25
|
-
setSchemaParam(schema2);
|
|
26
|
-
setSchema?.(schema2);
|
|
27
|
-
},
|
|
28
|
-
[setSchemaParam, setSchema]
|
|
29
|
-
);
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (routeSchema !== schema) {
|
|
32
|
-
if (routeSchema === void 0 && schema !== void 0) {
|
|
33
|
-
setSchemaLocal(schema);
|
|
34
|
-
} else if (routeSchema) {
|
|
35
|
-
setSchema?.(routeSchema);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal]);
|
|
39
|
-
return /* @__PURE__ */ jsx(SchemaContext.Provider, { value: { provided: true, schema, schemaList, setSchema: setSchemaLocal }, children });
|
|
40
|
-
};
|
|
41
|
-
const SchemaRouteProvider = ({ knownSchemaList, defaultSchema, ...props }) => {
|
|
42
|
-
return /* @__PURE__ */ jsx(SchemaMemoryProvider, { knownSchemaList, defaultSchema, children: /* @__PURE__ */ jsx(SchemaRouteProviderInner, { ...props }) });
|
|
43
|
-
};
|
|
44
|
-
export {
|
|
45
|
-
SchemaRouteProvider
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=Route.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/contexts/Schema/Provider/Route.tsx"],"sourcesContent":["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"],"mappings":"AAoDS;AAnDT,SAAS,aAAa,iBAAiB;AACvC,SAAS,uBAAuB;AAEhC,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AAGrC,MAAM,2BAAmD,CAAC,EAAE,SAAS,MAAM;AACzE,QAAM,EAAE,QAAQ,WAAW,WAAW,IAAI,UAAU;AAEpD,QAAM,CAAC,QAAQ,SAAS,IAAI,gBAAgB;AAE5C,QAAM,cAAc,OAAO,IAAI,QAAQ;AAGvC,QAAM,iBAAiB;AAAA,IACrB,CAACA,YAAoB;AACnB,UAAIA,SAAQ;AACV,eAAO,IAAI,UAAUA,OAAM;AAC3B,kBAAU,QAAQ,EAAE,SAAS,KAAK,CAAC;AACnC,oBAAYA,OAAM;AAAA,MACpB,OAAO;AACL,eAAO,OAAO,SAAS;AAAA,MACzB;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,WAAW,SAAS;AAAA,EAC/B;AAGA,QAAM,iBAAiB;AAAA,IACrB,CAACA,YAAmB;AAClB,qBAAeA,OAAM;AACrB,kBAAYA,OAAM;AAAA,IACpB;AAAA,IACA,CAAC,gBAAgB,SAAS;AAAA,EAC5B;AAGA,YAAU,MAAM;AACd,QAAI,gBAAgB,QAAQ;AAC1B,UAAI,gBAAgB,UAAa,WAAW,QAAW;AAErD,uBAAe,MAAM;AAAA,MACvB,WAAW,aAAa;AAEtB,oBAAY,WAAW;AAAA,MACzB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,aAAa,QAAQ,gBAAgB,WAAW,cAAc,CAAC;AAEnE,SAAO,oBAAC,cAAc,UAAd,EAAuB,OAAO,EAAE,UAAU,MAAM,QAAQ,YAAY,WAAW,eAAe,GAAI,UAAS;AACrH;AAEO,MAAM,sBAAmE,CAAC,EAAE,iBAAiB,eAAe,GAAG,MAAM,MAAM;AAChI,SACE,oBAAC,wBAAqB,iBAAkC,eACtD,8BAAC,4BAA0B,GAAG,OAAO,GACvC;AAEJ;","names":["schema"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/contexts/Schema/Provider/index.ts"],"sourcesContent":["export * from './Memory'\nexport * from './Props'\nexport * from './Route'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=State.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/contexts/Schema/index.ts"],"sourcesContent":["export * from './Context'\nexport * from './Provider'\nexport * from './State'\nexport * from './use'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { useContextEx } from "@xyo-network/react-shared";
|
|
2
|
-
import { SchemaContext } from "./Context";
|
|
3
|
-
const useSchema = (required = false) => {
|
|
4
|
-
return useContextEx(SchemaContext, "Schema", required);
|
|
5
|
-
};
|
|
6
|
-
export {
|
|
7
|
-
useSchema
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=use.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/contexts/Schema/use.ts"],"sourcesContent":["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,SAAS,oBAAoB;AAE7B,SAAS,qBAAqB;AAGvB,MAAM,YAAY,CAAC,WAAW,UAAU;AAC7C,SAAO,aAAiC,eAAe,UAAU,QAAQ;AAC3E;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/contexts/index.ts"],"sourcesContent":["export * from './Schema'\n"],"mappings":"AAAA,cAAc;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export * from './useGetSchema'\nexport * from './useSchemaDefinitions'\nexport * from './useSchemaList'\nexport * from './useSchemaStats'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -1,89 +0,0 @@
|
|
|
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
|
-
var TestSchemaHooks_stories_exports = {};
|
|
20
|
-
__export(TestSchemaHooks_stories_exports, {
|
|
21
|
-
Default: () => Default,
|
|
22
|
-
default: () => TestSchemaHooks_stories_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(TestSchemaHooks_stories_exports);
|
|
25
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
-
var import_material = require("@mui/material");
|
|
27
|
-
var import_react_async_effect = require("@xylabs/react-async-effect");
|
|
28
|
-
var import_react_flexbox = require("@xylabs/react-flexbox");
|
|
29
|
-
var import_http_bridge = require("@xyo-network/http-bridge");
|
|
30
|
-
var import_node_memory = require("@xyo-network/node-memory");
|
|
31
|
-
var import_node_model = require("@xyo-network/node-model");
|
|
32
|
-
var import_react_node = require("@xyo-network/react-node");
|
|
33
|
-
var import_react_storybook = require("@xyo-network/react-storybook");
|
|
34
|
-
var import_react_wallet = require("@xyo-network/react-wallet");
|
|
35
|
-
var import_schema_cache = require("@xyo-network/schema-cache");
|
|
36
|
-
var import_react2 = require("react");
|
|
37
|
-
var import_useSchemaDefinitions = require("../useSchemaDefinitions");
|
|
38
|
-
var import_useSchemaList = require("../useSchemaList");
|
|
39
|
-
var import_useSchemaStats = require("../useSchemaStats");
|
|
40
|
-
const apiConfig = { apiDomain: "https://api.archivist.xyo.network" };
|
|
41
|
-
const nodeUrl = "http://localhost:8080/node";
|
|
42
|
-
const MemoryNodeDecorator = (Story, args) => {
|
|
43
|
-
const [node, setNode] = (0, import_react2.useState)();
|
|
44
|
-
(0, import_react_async_effect.useAsyncEffect)(
|
|
45
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
-
async () => {
|
|
47
|
-
const node2 = await import_node_memory.MemoryNode.create({ config: { schema: import_node_model.NodeConfigSchema } });
|
|
48
|
-
const bridge = await import_http_bridge.HttpBridge.create({ config: { nodeUrl, schema: import_http_bridge.HttpBridgeConfigSchema, security: { allowAnonymous: true } } });
|
|
49
|
-
await node2.register(bridge);
|
|
50
|
-
await node2.attach(bridge.address, true);
|
|
51
|
-
setNode(node2);
|
|
52
|
-
},
|
|
53
|
-
[]
|
|
54
|
-
);
|
|
55
|
-
const [wallet] = (0, import_react_wallet.useWallet)({ mnemonic: import_react_storybook.DefaultSeedPhrase });
|
|
56
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_wallet.WalletProvider, { rootWallet: wallet, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_node.NodeProvider, { node, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Story, { ...args }) }) });
|
|
57
|
-
};
|
|
58
|
-
var TestSchemaHooks_stories_default = {
|
|
59
|
-
decorators: [MemoryNodeDecorator],
|
|
60
|
-
title: "schema/Hooks"
|
|
61
|
-
};
|
|
62
|
-
const Template = () => {
|
|
63
|
-
import_schema_cache.SchemaCache.instance.proxy = `${apiConfig.apiDomain}/domain`;
|
|
64
|
-
const [addressText, setAddressText] = (0, import_react2.useState)("");
|
|
65
|
-
const [address, setAddress] = (0, import_react2.useState)();
|
|
66
|
-
const [schemaStats, schemaStatsError] = (0, import_useSchemaStats.useSchemaStats)(address);
|
|
67
|
-
const [schemaList, schemaListError] = (0, import_useSchemaList.useSchemaList)(address);
|
|
68
|
-
const mappedSchemaList = schemaList?.schemas?.map((name) => ({ name }));
|
|
69
|
-
const schemaDefinitions = (0, import_useSchemaDefinitions.useSchemaDefinitions)(mappedSchemaList);
|
|
70
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", rowGap: "16px" }, children: [
|
|
71
|
-
schemaStatsError ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Alert, { severity: "error", children: schemaStatsError.message ?? schemaListError?.message }) : null,
|
|
72
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_flexbox.FlexGrowRow, { columnGap: 4, children: [
|
|
73
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.TextField, { fullWidth: true, size: "small", value: address, label: "Address", onChange: (event) => setAddressText(event.target.value) }),
|
|
74
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Button, { variant: "contained", onClick: () => setAddress(addressText), sx: { whiteSpace: "nowrap" }, children: "Get Stats" })
|
|
75
|
-
] }),
|
|
76
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "h2", children: "Schema Stats" }),
|
|
77
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: JSON.stringify(schemaStats, null, 2) }) }),
|
|
78
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "h2", children: "Schema List" }),
|
|
79
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: JSON.stringify(schemaList, null, 2) }) }),
|
|
80
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "h2", children: "Schema Definitions" }),
|
|
81
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: JSON.stringify(schemaDefinitions, null, 2) }) })
|
|
82
|
-
] });
|
|
83
|
-
};
|
|
84
|
-
const Default = Template.bind({});
|
|
85
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
-
0 && (module.exports = {
|
|
87
|
-
Default
|
|
88
|
-
});
|
|
89
|
-
//# sourceMappingURL=TestSchemaHooks.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/hooks/stories/TestSchemaHooks.stories.tsx"],"sourcesContent":["import { Alert, Button, TextField, Typography } from '@mui/material'\nimport { Decorator, Meta, StoryFn } from '@storybook/react'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { HttpBridge, HttpBridgeConfigSchema } from '@xyo-network/http-bridge'\nimport { MemoryNode } from '@xyo-network/node-memory'\nimport { NodeConfigSchema } from '@xyo-network/node-model'\nimport { NodeProvider } from '@xyo-network/react-node'\nimport { DefaultSeedPhrase } from '@xyo-network/react-storybook'\nimport { useWallet, WalletProvider } from '@xyo-network/react-wallet'\nimport { SchemaCache } from '@xyo-network/schema-cache'\nimport { useState } from 'react'\n\nimport { useSchemaDefinitions } from '../useSchemaDefinitions'\nimport { useSchemaList } from '../useSchemaList'\nimport { useSchemaStats } from '../useSchemaStats'\n\nconst apiConfig = { apiDomain: 'https://api.archivist.xyo.network' }\nconst nodeUrl = 'http://localhost:8080/node'\n\nconst MemoryNodeDecorator: Decorator = (Story, args) => {\n const [node, setNode] = useState<MemoryNode>()\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async () => {\n const node = await MemoryNode.create({ config: { schema: NodeConfigSchema } })\n const bridge = await HttpBridge.create({ config: { nodeUrl, schema: HttpBridgeConfigSchema, security: { allowAnonymous: true } } })\n await node.register(bridge)\n await node.attach(bridge.address, true)\n setNode(node)\n },\n [],\n )\n\n const [wallet] = useWallet({ mnemonic: DefaultSeedPhrase })\n\n return (\n <WalletProvider rootWallet={wallet}>\n <NodeProvider node={node}>\n <Story {...args} />\n </NodeProvider>\n </WalletProvider>\n )\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n decorators: [MemoryNodeDecorator],\n title: 'schema/Hooks',\n} as Meta\n\nconst Template: StoryFn<React.FC> = () => {\n SchemaCache.instance.proxy = `${apiConfig.apiDomain}/domain`\n const [addressText, setAddressText] = useState<string>('')\n const [address, setAddress] = useState<string>()\n const [schemaStats, schemaStatsError] = useSchemaStats(address)\n const [schemaList, schemaListError] = useSchemaList(address)\n const mappedSchemaList = schemaList?.schemas?.map((name) => ({ name })) as { name: string }[]\n const schemaDefinitions = useSchemaDefinitions(mappedSchemaList)\n\n return (\n <div style={{ display: 'flex', flexDirection: 'column', rowGap: '16px' }}>\n {schemaStatsError ? <Alert severity={'error'}>{schemaStatsError.message ?? schemaListError?.message}</Alert> : null}\n <FlexGrowRow columnGap={4}>\n <TextField fullWidth size=\"small\" value={address} label=\"Address\" onChange={(event) => setAddressText(event.target.value)} />\n <Button variant=\"contained\" onClick={() => setAddress(addressText)} sx={{ whiteSpace: 'nowrap' }}>\n Get Stats\n </Button>\n </FlexGrowRow>\n <Typography variant={'h2'}>Schema Stats</Typography>\n <code>\n <pre>{JSON.stringify(schemaStats, null, 2)}</pre>\n </code>\n <Typography variant={'h2'}>Schema List</Typography>\n <code>\n <pre>{JSON.stringify(schemaList, null, 2)}</pre>\n </code>\n <Typography variant={'h2'}>Schema Definitions</Typography>\n <pre>\n <code>{JSON.stringify(schemaDefinitions, null, 2)}</code>\n </pre>\n </div>\n )\n}\n\nconst Default = Template.bind({})\n\nexport { Default }\n"],"mappings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