@xyo-network/react-payload-details 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/Details/DataDetails.cjs +106 -0
- package/dist/browser/components/Details/DataDetails.cjs.map +1 -0
- package/dist/browser/components/Details/DataDetails.d.cts +11 -0
- package/dist/browser/components/Details/DataDetails.d.cts.map +1 -0
- package/dist/browser/components/Details/Details.cjs +196 -0
- package/dist/browser/components/Details/Details.cjs.map +1 -0
- package/dist/browser/components/Details/Details.d.cts +20 -0
- package/dist/browser/components/Details/Details.d.cts.map +1 -0
- package/dist/browser/components/Details/HashSourceDetails.cjs +47 -0
- package/dist/{node/components/Details/HashSourceDetails.mjs.map → browser/components/Details/HashSourceDetails.cjs.map} +1 -1
- package/dist/browser/components/Details/HashSourceDetails.d.cts +9 -0
- package/dist/browser/components/Details/HashSourceDetails.d.cts.map +1 -0
- package/dist/browser/components/Details/JsonDetails.cjs +66 -0
- package/dist/{node/components/Details/JsonDetails.mjs.map → browser/components/Details/JsonDetails.cjs.map} +1 -1
- package/dist/browser/components/Details/JsonDetails.d.cts +10 -0
- package/dist/browser/components/Details/JsonDetails.d.cts.map +1 -0
- package/dist/browser/components/Details/ValidationDetails/ValidationDetails.cjs +57 -0
- package/dist/{node/components/Details/ValidationDetails/ValidationDetails.mjs.map → browser/components/Details/ValidationDetails/ValidationDetails.cjs.map} +1 -1
- package/dist/browser/components/Details/ValidationDetails/ValidationDetails.d.cts +4 -0
- package/dist/browser/components/Details/ValidationDetails/ValidationDetails.d.cts.map +1 -0
- package/dist/browser/components/Details/ValidationDetails/ValidationDetailsProps.cjs +19 -0
- package/dist/browser/components/Details/ValidationDetails/ValidationDetailsProps.cjs.map +1 -0
- package/dist/browser/components/Details/ValidationDetails/ValidationDetailsProps.d.cts +7 -0
- package/dist/browser/components/Details/ValidationDetails/ValidationDetailsProps.d.cts.map +1 -0
- package/dist/browser/components/Details/ValidationDetails/index.cjs +59 -0
- package/dist/browser/components/Details/ValidationDetails/index.cjs.map +1 -0
- package/dist/browser/components/Details/ValidationDetails/index.d.cts +3 -0
- package/dist/browser/components/Details/ValidationDetails/index.d.cts.map +1 -0
- package/dist/browser/components/Details/index.cjs +201 -0
- package/dist/browser/components/Details/index.cjs.map +1 -0
- package/dist/browser/components/Details/index.d.cts +5 -0
- package/dist/browser/components/Details/index.d.cts.map +1 -0
- package/dist/browser/components/index.cjs +201 -0
- package/dist/browser/components/index.cjs.map +1 -0
- package/dist/browser/components/index.d.cts +2 -0
- package/dist/browser/components/index.d.cts.map +1 -0
- package/dist/browser/index.cjs +201 -0
- package/dist/browser/index.cjs.map +1 -0
- package/dist/browser/index.d.cts +2 -0
- package/dist/browser/index.d.cts.map +1 -0
- package/dist/docs.json +1333 -0
- package/dist/node/components/Details/DataDetails.cjs +110 -0
- package/dist/node/components/Details/DataDetails.cjs.map +1 -0
- package/dist/node/components/Details/DataDetails.d.cts +11 -0
- package/dist/node/components/Details/DataDetails.d.cts.map +1 -0
- package/dist/node/components/Details/DataDetails.js +50 -49
- package/dist/node/components/Details/DataDetails.js.map +1 -1
- package/dist/node/components/Details/Details.cjs +200 -0
- package/dist/node/components/Details/Details.cjs.map +1 -0
- package/dist/node/components/Details/Details.d.cts +20 -0
- package/dist/node/components/Details/Details.d.cts.map +1 -0
- package/dist/node/components/Details/Details.js +157 -34
- package/dist/node/components/Details/Details.js.map +1 -1
- package/dist/node/components/Details/HashSourceDetails.cjs +51 -0
- package/dist/node/components/Details/HashSourceDetails.cjs.map +1 -0
- package/dist/node/components/Details/HashSourceDetails.d.cts +9 -0
- package/dist/node/components/Details/HashSourceDetails.d.cts.map +1 -0
- package/dist/node/components/Details/HashSourceDetails.js +20 -43
- package/dist/node/components/Details/HashSourceDetails.js.map +1 -1
- package/dist/node/components/Details/JsonDetails.cjs +70 -0
- package/dist/node/components/Details/JsonDetails.cjs.map +1 -0
- package/dist/node/components/Details/JsonDetails.d.cts +10 -0
- package/dist/node/components/Details/JsonDetails.d.cts.map +1 -0
- package/dist/node/components/Details/JsonDetails.js +13 -46
- package/dist/node/components/Details/JsonDetails.js.map +1 -1
- package/dist/node/components/Details/ValidationDetails/ValidationDetails.cjs +61 -0
- package/dist/node/components/Details/ValidationDetails/ValidationDetails.cjs.map +1 -0
- package/dist/node/components/Details/ValidationDetails/ValidationDetails.d.cts +4 -0
- package/dist/node/components/Details/ValidationDetails/ValidationDetails.d.cts.map +1 -0
- package/dist/node/components/Details/ValidationDetails/ValidationDetails.js +19 -42
- package/dist/node/components/Details/ValidationDetails/ValidationDetails.js.map +1 -1
- package/dist/node/components/Details/ValidationDetails/ValidationDetailsProps.cjs +19 -0
- package/dist/node/components/Details/ValidationDetails/ValidationDetailsProps.cjs.map +1 -0
- package/dist/node/components/Details/ValidationDetails/ValidationDetailsProps.d.cts +7 -0
- package/dist/node/components/Details/ValidationDetails/ValidationDetailsProps.d.cts.map +1 -0
- package/dist/node/components/Details/ValidationDetails/ValidationDetailsProps.js +0 -16
- package/dist/node/components/Details/ValidationDetails/ValidationDetailsProps.js.map +1 -1
- package/dist/node/components/Details/ValidationDetails/index.cjs +63 -0
- package/dist/node/components/Details/ValidationDetails/index.cjs.map +1 -0
- package/dist/node/components/Details/ValidationDetails/index.d.cts +3 -0
- package/dist/node/components/Details/ValidationDetails/index.d.cts.map +1 -0
- package/dist/node/components/Details/ValidationDetails/index.js +33 -22
- package/dist/node/components/Details/ValidationDetails/index.js.map +1 -1
- package/dist/node/components/Details/index.cjs +208 -0
- package/dist/node/components/Details/index.cjs.map +1 -0
- package/dist/node/components/Details/index.d.cts +5 -0
- package/dist/node/components/Details/index.d.cts.map +1 -0
- package/dist/node/components/Details/index.js +164 -25
- package/dist/node/components/Details/index.js.map +1 -1
- package/dist/node/components/index.cjs +208 -0
- package/dist/node/components/index.cjs.map +1 -0
- package/dist/node/components/index.d.cts +2 -0
- package/dist/node/components/index.d.cts.map +1 -0
- package/dist/node/components/index.js +164 -19
- package/dist/node/components/index.js.map +1 -1
- package/dist/node/index.cjs +208 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +2 -0
- package/dist/node/index.d.cts.map +1 -0
- package/dist/node/index.js +164 -19
- package/dist/node/index.js.map +1 -1
- package/package.json +24 -24
- package/dist/browser/components/Details/Details.stories.js +0 -55
- package/dist/browser/components/Details/Details.stories.js.map +0 -1
- package/dist/browser/components/Details/ValidationDetails/ValidationDetails.stories.js +0 -49
- package/dist/browser/components/Details/ValidationDetails/ValidationDetails.stories.js.map +0 -1
- package/dist/node/components/Details/DataDetails.mjs +0 -60
- package/dist/node/components/Details/DataDetails.mjs.map +0 -1
- package/dist/node/components/Details/Details.mjs +0 -18
- package/dist/node/components/Details/Details.mjs.map +0 -1
- package/dist/node/components/Details/Details.stories.js +0 -86
- package/dist/node/components/Details/Details.stories.js.map +0 -1
- package/dist/node/components/Details/Details.stories.mjs +0 -55
- package/dist/node/components/Details/Details.stories.mjs.map +0 -1
- package/dist/node/components/Details/HashSourceDetails.mjs +0 -25
- package/dist/node/components/Details/JsonDetails.mjs +0 -34
- package/dist/node/components/Details/ValidationDetails/ValidationDetails.mjs +0 -35
- package/dist/node/components/Details/ValidationDetails/ValidationDetails.stories.js +0 -75
- package/dist/node/components/Details/ValidationDetails/ValidationDetails.stories.js.map +0 -1
- package/dist/node/components/Details/ValidationDetails/ValidationDetails.stories.mjs +0 -49
- package/dist/node/components/Details/ValidationDetails/ValidationDetails.stories.mjs.map +0 -1
- package/dist/node/components/Details/ValidationDetails/ValidationDetailsProps.mjs +0 -1
- package/dist/node/components/Details/ValidationDetails/ValidationDetailsProps.mjs.map +0 -1
- package/dist/node/components/Details/ValidationDetails/index.mjs +0 -3
- package/dist/node/components/Details/ValidationDetails/index.mjs.map +0 -1
- package/dist/node/components/Details/index.mjs +0 -5
- package/dist/node/components/Details/index.mjs.map +0 -1
- package/dist/node/components/index.mjs +0 -2
- package/dist/node/components/index.mjs.map +0 -1
- package/dist/node/index.mjs +0 -2
- package/dist/node/index.mjs.map +0 -1
@@ -0,0 +1,61 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
|
20
|
+
// src/components/Details/ValidationDetails/ValidationDetails.tsx
|
21
|
+
var ValidationDetails_exports = {};
|
22
|
+
__export(ValidationDetails_exports, {
|
23
|
+
PayloadValidationDetails: () => PayloadValidationDetails
|
24
|
+
});
|
25
|
+
module.exports = __toCommonJS(ValidationDetails_exports);
|
26
|
+
var import_material = require("@mui/material");
|
27
|
+
var import_react_flexbox = require("@xylabs/react-flexbox");
|
28
|
+
var import_react_promise = require("@xylabs/react-promise");
|
29
|
+
var import_payload_validator = require("@xyo-network/payload-validator");
|
30
|
+
var import_react_property = require("@xyo-network/react-property");
|
31
|
+
var import_react_schema = require("@xyo-network/react-schema");
|
32
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
33
|
+
var PayloadValidationDetails = ({ skipBody = false, value, ...props }) => {
|
34
|
+
const [validateErrors] = (0, import_react_promise.usePromise)(async () => value ? await new import_payload_validator.PayloadValidator(value).validate() : void 0, [value]);
|
35
|
+
const bodyErrors = skipBody ? [] : validateErrors ?? [];
|
36
|
+
const errors = [...bodyErrors];
|
37
|
+
let elevation = 2;
|
38
|
+
if (props.paper) {
|
39
|
+
elevation += props.elevation ?? 0;
|
40
|
+
}
|
41
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_property.PropertyGroup, { titleProps: { elevation }, title: "Validation", tip: "The results from validating the payload", ...props, children: [
|
42
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
43
|
+
import_react_property.Property,
|
44
|
+
{
|
45
|
+
titleProps: { elevation },
|
46
|
+
flexGrow: 1,
|
47
|
+
title: "Valid",
|
48
|
+
value: errors.length === 0 ? "True" : "False",
|
49
|
+
tip: errors.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_flexbox.FlexCol, { children: errors.map((error, index) => {
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { children: error.toString() }, index);
|
51
|
+
}) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { children: "No Errors" })
|
52
|
+
}
|
53
|
+
),
|
54
|
+
(value == null ? void 0 : value.schema) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_schema.SchemaProperty, { flexGrow: 1, titleProps: { elevation }, value: value.schema })
|
55
|
+
] });
|
56
|
+
};
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
58
|
+
0 && (module.exports = {
|
59
|
+
PayloadValidationDetails
|
60
|
+
});
|
61
|
+
//# sourceMappingURL=ValidationDetails.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Details/ValidationDetails/ValidationDetails.tsx"],"sourcesContent":["import { Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { usePromise } from '@xylabs/react-promise'\nimport { PayloadValidator } from '@xyo-network/payload-validator'\nimport { Property, PropertyGroup } from '@xyo-network/react-property'\nimport { SchemaProperty } from '@xyo-network/react-schema'\n\nimport { PayloadValidationDetailsProps } from './ValidationDetailsProps'\n\nexport const PayloadValidationDetails: React.FC<PayloadValidationDetailsProps> = ({ skipBody = false, value, ...props }) => {\n const [validateErrors] = usePromise(async () => (value ? await new PayloadValidator(value).validate() : undefined), [value])\n\n const bodyErrors = skipBody ? [] : validateErrors ?? []\n const errors: Error[] = [...bodyErrors]\n\n let elevation = 2\n if (props.paper) {\n elevation += props.elevation ?? 0\n }\n\n return (\n <PropertyGroup titleProps={{ elevation }} title=\"Validation\" tip=\"The results from validating the payload\" {...props}>\n <Property\n titleProps={{ elevation }}\n flexGrow={1}\n title=\"Valid\"\n value={errors.length === 0 ? 'True' : 'False'}\n tip={\n errors.length > 0 ? (\n <FlexCol>\n {errors.map((error, index) => {\n return <Typography key={index}>{error.toString()}</Typography>\n })}\n </FlexCol>\n ) : (\n <Typography>No Errors</Typography>\n )\n }\n />\n {value?.schema && <SchemaProperty flexGrow={1} titleProps={{ elevation }} value={value.schema} />}\n </PropertyGroup>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA2B;AAC3B,2BAAwB;AACxB,2BAA2B;AAC3B,+BAAiC;AACjC,4BAAwC;AACxC,0BAA+B;AAgB3B;AAZG,IAAM,2BAAoE,CAAC,EAAE,WAAW,OAAO,OAAO,GAAG,MAAM,MAAM;AAC1H,QAAM,CAAC,cAAc,QAAI,iCAAW,YAAa,QAAQ,MAAM,IAAI,0CAAiB,KAAK,EAAE,SAAS,IAAI,QAAY,CAAC,KAAK,CAAC;AAE3H,QAAM,aAAa,WAAW,CAAC,IAAI,kBAAkB,CAAC;AACtD,QAAM,SAAkB,CAAC,GAAG,UAAU;AAEtC,MAAI,YAAY;AAChB,MAAI,MAAM,OAAO;AACf,iBAAa,MAAM,aAAa;AAAA,EAClC;AAEA,SACE,6CAAC,uCAAc,YAAY,EAAE,UAAU,GAAG,OAAM,cAAa,KAAI,2CAA2C,GAAG,OAC7G;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,YAAY,EAAE,UAAU;AAAA,QACxB,UAAU;AAAA,QACV,OAAM;AAAA,QACN,OAAO,OAAO,WAAW,IAAI,SAAS;AAAA,QACtC,KACE,OAAO,SAAS,IACd,4CAAC,gCACE,iBAAO,IAAI,CAAC,OAAO,UAAU;AAC5B,iBAAO,4CAAC,8BAAwB,gBAAM,SAAS,KAAvB,KAAyB;AAAA,QACnD,CAAC,GACH,IAEA,4CAAC,8BAAW,uBAAS;AAAA;AAAA,IAG3B;AAAA,KACC,+BAAO,WAAU,4CAAC,sCAAe,UAAU,GAAG,YAAY,EAAE,UAAU,GAAG,OAAO,MAAM,QAAQ;AAAA,KACjG;AAEJ;","names":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ValidationDetails.d.ts","sourceRoot":"","sources":["../../../../../src/components/Details/ValidationDetails/ValidationDetails.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAA;AAExE,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,6BAA6B,CAiC5E,CAAA"}
|
@@ -1,59 +1,36 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
}
|
10
|
-
|
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 ValidationDetails_exports = {};
|
20
|
-
__export(ValidationDetails_exports, {
|
21
|
-
PayloadValidationDetails: () => PayloadValidationDetails
|
22
|
-
});
|
23
|
-
module.exports = __toCommonJS(ValidationDetails_exports);
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
25
|
-
var import_material = require("@mui/material");
|
26
|
-
var import_react_flexbox = require("@xylabs/react-flexbox");
|
27
|
-
var import_react_promise = require("@xylabs/react-promise");
|
28
|
-
var import_payload_validator = require("@xyo-network/payload-validator");
|
29
|
-
var import_react_property = require("@xyo-network/react-property");
|
30
|
-
var import_react_schema = require("@xyo-network/react-schema");
|
31
|
-
const PayloadValidationDetails = ({ skipBody = false, value, ...props }) => {
|
32
|
-
const [validateErrors] = (0, import_react_promise.usePromise)(async () => value ? await new import_payload_validator.PayloadValidator(value).validate() : void 0, [value]);
|
1
|
+
// src/components/Details/ValidationDetails/ValidationDetails.tsx
|
2
|
+
import { Typography } from "@mui/material";
|
3
|
+
import { FlexCol } from "@xylabs/react-flexbox";
|
4
|
+
import { usePromise } from "@xylabs/react-promise";
|
5
|
+
import { PayloadValidator } from "@xyo-network/payload-validator";
|
6
|
+
import { Property, PropertyGroup } from "@xyo-network/react-property";
|
7
|
+
import { SchemaProperty } from "@xyo-network/react-schema";
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
9
|
+
var PayloadValidationDetails = ({ skipBody = false, value, ...props }) => {
|
10
|
+
const [validateErrors] = usePromise(async () => value ? await new PayloadValidator(value).validate() : void 0, [value]);
|
33
11
|
const bodyErrors = skipBody ? [] : validateErrors ?? [];
|
34
12
|
const errors = [...bodyErrors];
|
35
13
|
let elevation = 2;
|
36
14
|
if (props.paper) {
|
37
15
|
elevation += props.elevation ?? 0;
|
38
16
|
}
|
39
|
-
return /* @__PURE__ */
|
40
|
-
/* @__PURE__ */
|
41
|
-
|
17
|
+
return /* @__PURE__ */ jsxs(PropertyGroup, { titleProps: { elevation }, title: "Validation", tip: "The results from validating the payload", ...props, children: [
|
18
|
+
/* @__PURE__ */ jsx(
|
19
|
+
Property,
|
42
20
|
{
|
43
21
|
titleProps: { elevation },
|
44
22
|
flexGrow: 1,
|
45
23
|
title: "Valid",
|
46
24
|
value: errors.length === 0 ? "True" : "False",
|
47
|
-
tip: errors.length > 0 ? /* @__PURE__ */
|
48
|
-
return /* @__PURE__ */
|
49
|
-
}) }) : /* @__PURE__ */
|
25
|
+
tip: errors.length > 0 ? /* @__PURE__ */ jsx(FlexCol, { children: errors.map((error, index) => {
|
26
|
+
return /* @__PURE__ */ jsx(Typography, { children: error.toString() }, index);
|
27
|
+
}) }) : /* @__PURE__ */ jsx(Typography, { children: "No Errors" })
|
50
28
|
}
|
51
29
|
),
|
52
|
-
value
|
30
|
+
(value == null ? void 0 : value.schema) && /* @__PURE__ */ jsx(SchemaProperty, { flexGrow: 1, titleProps: { elevation }, value: value.schema })
|
53
31
|
] });
|
54
32
|
};
|
55
|
-
|
56
|
-
0 && (module.exports = {
|
33
|
+
export {
|
57
34
|
PayloadValidationDetails
|
58
|
-
}
|
35
|
+
};
|
59
36
|
//# sourceMappingURL=ValidationDetails.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/Details/ValidationDetails/ValidationDetails.tsx"],"sourcesContent":["import { Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { usePromise } from '@xylabs/react-promise'\nimport { PayloadValidator } from '@xyo-network/payload-validator'\nimport { Property, PropertyGroup } from '@xyo-network/react-property'\nimport { SchemaProperty } from '@xyo-network/react-schema'\n\nimport { PayloadValidationDetailsProps } from './ValidationDetailsProps'\n\nexport const PayloadValidationDetails: React.FC<PayloadValidationDetailsProps> = ({ skipBody = false, value, ...props }) => {\n const [validateErrors] = usePromise(async () => (value ? await new PayloadValidator(value).validate() : undefined), [value])\n\n const bodyErrors = skipBody ? [] : validateErrors ?? []\n const errors: Error[] = [...bodyErrors]\n\n let elevation = 2\n if (props.paper) {\n elevation += props.elevation ?? 0\n }\n\n return (\n <PropertyGroup titleProps={{ elevation }} title=\"Validation\" tip=\"The results from validating the payload\" {...props}>\n <Property\n titleProps={{ elevation }}\n flexGrow={1}\n title=\"Valid\"\n value={errors.length === 0 ? 'True' : 'False'}\n tip={\n errors.length > 0 ? (\n <FlexCol>\n {errors.map((error, index) => {\n return <Typography key={index}>{error.toString()}</Typography>\n })}\n </FlexCol>\n ) : (\n <Typography>No Errors</Typography>\n )\n }\n />\n {value?.schema && <SchemaProperty flexGrow={1} titleProps={{ elevation }} value={value.schema} />}\n </PropertyGroup>\n )\n}\n"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Details/ValidationDetails/ValidationDetails.tsx"],"sourcesContent":["import { Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { usePromise } from '@xylabs/react-promise'\nimport { PayloadValidator } from '@xyo-network/payload-validator'\nimport { Property, PropertyGroup } from '@xyo-network/react-property'\nimport { SchemaProperty } from '@xyo-network/react-schema'\n\nimport { PayloadValidationDetailsProps } from './ValidationDetailsProps'\n\nexport const PayloadValidationDetails: React.FC<PayloadValidationDetailsProps> = ({ skipBody = false, value, ...props }) => {\n const [validateErrors] = usePromise(async () => (value ? await new PayloadValidator(value).validate() : undefined), [value])\n\n const bodyErrors = skipBody ? [] : validateErrors ?? []\n const errors: Error[] = [...bodyErrors]\n\n let elevation = 2\n if (props.paper) {\n elevation += props.elevation ?? 0\n }\n\n return (\n <PropertyGroup titleProps={{ elevation }} title=\"Validation\" tip=\"The results from validating the payload\" {...props}>\n <Property\n titleProps={{ elevation }}\n flexGrow={1}\n title=\"Valid\"\n value={errors.length === 0 ? 'True' : 'False'}\n tip={\n errors.length > 0 ? (\n <FlexCol>\n {errors.map((error, index) => {\n return <Typography key={index}>{error.toString()}</Typography>\n })}\n </FlexCol>\n ) : (\n <Typography>No Errors</Typography>\n )\n }\n />\n {value?.schema && <SchemaProperty flexGrow={1} titleProps={{ elevation }} value={value.schema} />}\n </PropertyGroup>\n )\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AACjC,SAAS,UAAU,qBAAqB;AACxC,SAAS,sBAAsB;AAgB3B,SAUmB,KAVnB;AAZG,IAAM,2BAAoE,CAAC,EAAE,WAAW,OAAO,OAAO,GAAG,MAAM,MAAM;AAC1H,QAAM,CAAC,cAAc,IAAI,WAAW,YAAa,QAAQ,MAAM,IAAI,iBAAiB,KAAK,EAAE,SAAS,IAAI,QAAY,CAAC,KAAK,CAAC;AAE3H,QAAM,aAAa,WAAW,CAAC,IAAI,kBAAkB,CAAC;AACtD,QAAM,SAAkB,CAAC,GAAG,UAAU;AAEtC,MAAI,YAAY;AAChB,MAAI,MAAM,OAAO;AACf,iBAAa,MAAM,aAAa;AAAA,EAClC;AAEA,SACE,qBAAC,iBAAc,YAAY,EAAE,UAAU,GAAG,OAAM,cAAa,KAAI,2CAA2C,GAAG,OAC7G;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,YAAY,EAAE,UAAU;AAAA,QACxB,UAAU;AAAA,QACV,OAAM;AAAA,QACN,OAAO,OAAO,WAAW,IAAI,SAAS;AAAA,QACtC,KACE,OAAO,SAAS,IACd,oBAAC,WACE,iBAAO,IAAI,CAAC,OAAO,UAAU;AAC5B,iBAAO,oBAAC,cAAwB,gBAAM,SAAS,KAAvB,KAAyB;AAAA,QACnD,CAAC,GACH,IAEA,oBAAC,cAAW,uBAAS;AAAA;AAAA,IAG3B;AAAA,KACC,+BAAO,WAAU,oBAAC,kBAAe,UAAU,GAAG,YAAY,EAAE,UAAU,GAAG,OAAO,MAAM,QAAQ;AAAA,KACjG;AAEJ;","names":[]}
|
@@ -0,0 +1,19 @@
|
|
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 __copyProps = (to, from, except, desc) => {
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
8
|
+
for (let key of __getOwnPropNames(from))
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
11
|
+
}
|
12
|
+
return to;
|
13
|
+
};
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
15
|
+
|
16
|
+
// src/components/Details/ValidationDetails/ValidationDetailsProps.ts
|
17
|
+
var ValidationDetailsProps_exports = {};
|
18
|
+
module.exports = __toCommonJS(ValidationDetailsProps_exports);
|
19
|
+
//# sourceMappingURL=ValidationDetailsProps.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Details/ValidationDetails/ValidationDetailsProps.ts"],"sourcesContent":["import { Payload } from '@xyo-network/payload-model'\nimport { PropertyGroupProps } from '@xyo-network/react-property'\n\nexport type PayloadValidationDetailsProps = PropertyGroupProps & {\n skipBody?: boolean\n value?: Payload\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { Payload } from '@xyo-network/payload-model';
|
2
|
+
import { PropertyGroupProps } from '@xyo-network/react-property';
|
3
|
+
export type PayloadValidationDetailsProps = PropertyGroupProps & {
|
4
|
+
skipBody?: boolean;
|
5
|
+
value?: Payload;
|
6
|
+
};
|
7
|
+
//# sourceMappingURL=ValidationDetailsProps.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ValidationDetailsProps.d.ts","sourceRoot":"","sources":["../../../../../src/components/Details/ValidationDetails/ValidationDetailsProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAEhE,MAAM,MAAM,6BAA6B,GAAG,kBAAkB,GAAG;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA"}
|
@@ -1,17 +1 @@
|
|
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 __copyProps = (to, from, except, desc) => {
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
8
|
-
for (let key of __getOwnPropNames(from))
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
11
|
-
}
|
12
|
-
return to;
|
13
|
-
};
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
15
|
-
var ValidationDetailsProps_exports = {};
|
16
|
-
module.exports = __toCommonJS(ValidationDetailsProps_exports);
|
17
1
|
//# sourceMappingURL=ValidationDetailsProps.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":[
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
|
20
|
+
// src/components/Details/ValidationDetails/index.ts
|
21
|
+
var ValidationDetails_exports = {};
|
22
|
+
__export(ValidationDetails_exports, {
|
23
|
+
PayloadValidationDetails: () => PayloadValidationDetails
|
24
|
+
});
|
25
|
+
module.exports = __toCommonJS(ValidationDetails_exports);
|
26
|
+
|
27
|
+
// src/components/Details/ValidationDetails/ValidationDetails.tsx
|
28
|
+
var import_material = require("@mui/material");
|
29
|
+
var import_react_flexbox = require("@xylabs/react-flexbox");
|
30
|
+
var import_react_promise = require("@xylabs/react-promise");
|
31
|
+
var import_payload_validator = require("@xyo-network/payload-validator");
|
32
|
+
var import_react_property = require("@xyo-network/react-property");
|
33
|
+
var import_react_schema = require("@xyo-network/react-schema");
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
35
|
+
var PayloadValidationDetails = ({ skipBody = false, value, ...props }) => {
|
36
|
+
const [validateErrors] = (0, import_react_promise.usePromise)(async () => value ? await new import_payload_validator.PayloadValidator(value).validate() : void 0, [value]);
|
37
|
+
const bodyErrors = skipBody ? [] : validateErrors ?? [];
|
38
|
+
const errors = [...bodyErrors];
|
39
|
+
let elevation = 2;
|
40
|
+
if (props.paper) {
|
41
|
+
elevation += props.elevation ?? 0;
|
42
|
+
}
|
43
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_property.PropertyGroup, { titleProps: { elevation }, title: "Validation", tip: "The results from validating the payload", ...props, children: [
|
44
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
45
|
+
import_react_property.Property,
|
46
|
+
{
|
47
|
+
titleProps: { elevation },
|
48
|
+
flexGrow: 1,
|
49
|
+
title: "Valid",
|
50
|
+
value: errors.length === 0 ? "True" : "False",
|
51
|
+
tip: errors.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_flexbox.FlexCol, { children: errors.map((error, index) => {
|
52
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { children: error.toString() }, index);
|
53
|
+
}) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { children: "No Errors" })
|
54
|
+
}
|
55
|
+
),
|
56
|
+
(value == null ? void 0 : value.schema) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_schema.SchemaProperty, { flexGrow: 1, titleProps: { elevation }, value: value.schema })
|
57
|
+
] });
|
58
|
+
};
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
60
|
+
0 && (module.exports = {
|
61
|
+
PayloadValidationDetails
|
62
|
+
});
|
63
|
+
//# sourceMappingURL=index.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Details/ValidationDetails/index.ts","../../../../../src/components/Details/ValidationDetails/ValidationDetails.tsx"],"sourcesContent":["export * from './ValidationDetails'\nexport * from './ValidationDetailsProps'\n","import { Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { usePromise } from '@xylabs/react-promise'\nimport { PayloadValidator } from '@xyo-network/payload-validator'\nimport { Property, PropertyGroup } from '@xyo-network/react-property'\nimport { SchemaProperty } from '@xyo-network/react-schema'\n\nimport { PayloadValidationDetailsProps } from './ValidationDetailsProps'\n\nexport const PayloadValidationDetails: React.FC<PayloadValidationDetailsProps> = ({ skipBody = false, value, ...props }) => {\n const [validateErrors] = usePromise(async () => (value ? await new PayloadValidator(value).validate() : undefined), [value])\n\n const bodyErrors = skipBody ? [] : validateErrors ?? []\n const errors: Error[] = [...bodyErrors]\n\n let elevation = 2\n if (props.paper) {\n elevation += props.elevation ?? 0\n }\n\n return (\n <PropertyGroup titleProps={{ elevation }} title=\"Validation\" tip=\"The results from validating the payload\" {...props}>\n <Property\n titleProps={{ elevation }}\n flexGrow={1}\n title=\"Valid\"\n value={errors.length === 0 ? 'True' : 'False'}\n tip={\n errors.length > 0 ? (\n <FlexCol>\n {errors.map((error, index) => {\n return <Typography key={index}>{error.toString()}</Typography>\n })}\n </FlexCol>\n ) : (\n <Typography>No Errors</Typography>\n )\n }\n />\n {value?.schema && <SchemaProperty flexGrow={1} titleProps={{ elevation }} value={value.schema} />}\n </PropertyGroup>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sBAA2B;AAC3B,2BAAwB;AACxB,2BAA2B;AAC3B,+BAAiC;AACjC,4BAAwC;AACxC,0BAA+B;AAgB3B;AAZG,IAAM,2BAAoE,CAAC,EAAE,WAAW,OAAO,OAAO,GAAG,MAAM,MAAM;AAC1H,QAAM,CAAC,cAAc,QAAI,iCAAW,YAAa,QAAQ,MAAM,IAAI,0CAAiB,KAAK,EAAE,SAAS,IAAI,QAAY,CAAC,KAAK,CAAC;AAE3H,QAAM,aAAa,WAAW,CAAC,IAAI,kBAAkB,CAAC;AACtD,QAAM,SAAkB,CAAC,GAAG,UAAU;AAEtC,MAAI,YAAY;AAChB,MAAI,MAAM,OAAO;AACf,iBAAa,MAAM,aAAa;AAAA,EAClC;AAEA,SACE,6CAAC,uCAAc,YAAY,EAAE,UAAU,GAAG,OAAM,cAAa,KAAI,2CAA2C,GAAG,OAC7G;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,YAAY,EAAE,UAAU;AAAA,QACxB,UAAU;AAAA,QACV,OAAM;AAAA,QACN,OAAO,OAAO,WAAW,IAAI,SAAS;AAAA,QACtC,KACE,OAAO,SAAS,IACd,4CAAC,gCACE,iBAAO,IAAI,CAAC,OAAO,UAAU;AAC5B,iBAAO,4CAAC,8BAAwB,gBAAM,SAAS,KAAvB,KAAyB;AAAA,QACnD,CAAC,GACH,IAEA,4CAAC,8BAAW,uBAAS;AAAA;AAAA,IAG3B;AAAA,KACC,+BAAO,WAAU,4CAAC,sCAAe,UAAU,GAAG,YAAY,EAAE,UAAU,GAAG,OAAO,MAAM,QAAQ;AAAA,KACjG;AAEJ;","names":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Details/ValidationDetails/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA"}
|
@@ -1,25 +1,36 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
// src/components/Details/ValidationDetails/ValidationDetails.tsx
|
2
|
+
import { Typography } from "@mui/material";
|
3
|
+
import { FlexCol } from "@xylabs/react-flexbox";
|
4
|
+
import { usePromise } from "@xylabs/react-promise";
|
5
|
+
import { PayloadValidator } from "@xyo-network/payload-validator";
|
6
|
+
import { Property, PropertyGroup } from "@xyo-network/react-property";
|
7
|
+
import { SchemaProperty } from "@xyo-network/react-schema";
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
9
|
+
var PayloadValidationDetails = ({ skipBody = false, value, ...props }) => {
|
10
|
+
const [validateErrors] = usePromise(async () => value ? await new PayloadValidator(value).validate() : void 0, [value]);
|
11
|
+
const bodyErrors = skipBody ? [] : validateErrors ?? [];
|
12
|
+
const errors = [...bodyErrors];
|
13
|
+
let elevation = 2;
|
14
|
+
if (props.paper) {
|
15
|
+
elevation += props.elevation ?? 0;
|
11
16
|
}
|
12
|
-
return
|
17
|
+
return /* @__PURE__ */ jsxs(PropertyGroup, { titleProps: { elevation }, title: "Validation", tip: "The results from validating the payload", ...props, children: [
|
18
|
+
/* @__PURE__ */ jsx(
|
19
|
+
Property,
|
20
|
+
{
|
21
|
+
titleProps: { elevation },
|
22
|
+
flexGrow: 1,
|
23
|
+
title: "Valid",
|
24
|
+
value: errors.length === 0 ? "True" : "False",
|
25
|
+
tip: errors.length > 0 ? /* @__PURE__ */ jsx(FlexCol, { children: errors.map((error, index) => {
|
26
|
+
return /* @__PURE__ */ jsx(Typography, { children: error.toString() }, index);
|
27
|
+
}) }) : /* @__PURE__ */ jsx(Typography, { children: "No Errors" })
|
28
|
+
}
|
29
|
+
),
|
30
|
+
(value == null ? void 0 : value.schema) && /* @__PURE__ */ jsx(SchemaProperty, { flexGrow: 1, titleProps: { elevation }, value: value.schema })
|
31
|
+
] });
|
32
|
+
};
|
33
|
+
export {
|
34
|
+
PayloadValidationDetails
|
13
35
|
};
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
16
|
-
var ValidationDetails_exports = {};
|
17
|
-
module.exports = __toCommonJS(ValidationDetails_exports);
|
18
|
-
__reExport(ValidationDetails_exports, require("./ValidationDetails"), module.exports);
|
19
|
-
__reExport(ValidationDetails_exports, require("./ValidationDetailsProps"), module.exports);
|
20
|
-
// Annotate the CommonJS export names for ESM import in node:
|
21
|
-
0 && (module.exports = {
|
22
|
-
...require("./ValidationDetails"),
|
23
|
-
...require("./ValidationDetailsProps")
|
24
|
-
});
|
25
36
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/Details/ValidationDetails/
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Details/ValidationDetails/ValidationDetails.tsx"],"sourcesContent":["import { Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { usePromise } from '@xylabs/react-promise'\nimport { PayloadValidator } from '@xyo-network/payload-validator'\nimport { Property, PropertyGroup } from '@xyo-network/react-property'\nimport { SchemaProperty } from '@xyo-network/react-schema'\n\nimport { PayloadValidationDetailsProps } from './ValidationDetailsProps'\n\nexport const PayloadValidationDetails: React.FC<PayloadValidationDetailsProps> = ({ skipBody = false, value, ...props }) => {\n const [validateErrors] = usePromise(async () => (value ? await new PayloadValidator(value).validate() : undefined), [value])\n\n const bodyErrors = skipBody ? [] : validateErrors ?? []\n const errors: Error[] = [...bodyErrors]\n\n let elevation = 2\n if (props.paper) {\n elevation += props.elevation ?? 0\n }\n\n return (\n <PropertyGroup titleProps={{ elevation }} title=\"Validation\" tip=\"The results from validating the payload\" {...props}>\n <Property\n titleProps={{ elevation }}\n flexGrow={1}\n title=\"Valid\"\n value={errors.length === 0 ? 'True' : 'False'}\n tip={\n errors.length > 0 ? (\n <FlexCol>\n {errors.map((error, index) => {\n return <Typography key={index}>{error.toString()}</Typography>\n })}\n </FlexCol>\n ) : (\n <Typography>No Errors</Typography>\n )\n }\n />\n {value?.schema && <SchemaProperty flexGrow={1} titleProps={{ elevation }} value={value.schema} />}\n </PropertyGroup>\n )\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AACjC,SAAS,UAAU,qBAAqB;AACxC,SAAS,sBAAsB;AAgB3B,SAUmB,KAVnB;AAZG,IAAM,2BAAoE,CAAC,EAAE,WAAW,OAAO,OAAO,GAAG,MAAM,MAAM;AAC1H,QAAM,CAAC,cAAc,IAAI,WAAW,YAAa,QAAQ,MAAM,IAAI,iBAAiB,KAAK,EAAE,SAAS,IAAI,QAAY,CAAC,KAAK,CAAC;AAE3H,QAAM,aAAa,WAAW,CAAC,IAAI,kBAAkB,CAAC;AACtD,QAAM,SAAkB,CAAC,GAAG,UAAU;AAEtC,MAAI,YAAY;AAChB,MAAI,MAAM,OAAO;AACf,iBAAa,MAAM,aAAa;AAAA,EAClC;AAEA,SACE,qBAAC,iBAAc,YAAY,EAAE,UAAU,GAAG,OAAM,cAAa,KAAI,2CAA2C,GAAG,OAC7G;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,YAAY,EAAE,UAAU;AAAA,QACxB,UAAU;AAAA,QACV,OAAM;AAAA,QACN,OAAO,OAAO,WAAW,IAAI,SAAS;AAAA,QACtC,KACE,OAAO,SAAS,IACd,oBAAC,WACE,iBAAO,IAAI,CAAC,OAAO,UAAU;AAC5B,iBAAO,oBAAC,cAAwB,gBAAM,SAAS,KAAvB,KAAyB;AAAA,QACnD,CAAC,GACH,IAEA,oBAAC,cAAW,uBAAS;AAAA;AAAA,IAG3B;AAAA,KACC,+BAAO,WAAU,oBAAC,kBAAe,UAAU,GAAG,YAAY,EAAE,UAAU,GAAG,OAAO,MAAM,QAAQ;AAAA,KACjG;AAEJ;","names":[]}
|
@@ -0,0 +1,208 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
+
|
30
|
+
// src/components/Details/index.ts
|
31
|
+
var Details_exports = {};
|
32
|
+
__export(Details_exports, {
|
33
|
+
PayloadDataDetails: () => PayloadDataDetails,
|
34
|
+
PayloadDetails: () => PayloadDetails,
|
35
|
+
PayloadJsonDetails: () => PayloadJsonDetails,
|
36
|
+
PayloadValidationDetails: () => PayloadValidationDetails
|
37
|
+
});
|
38
|
+
module.exports = __toCommonJS(Details_exports);
|
39
|
+
|
40
|
+
// src/components/Details/DataDetails.tsx
|
41
|
+
var import_icons_material2 = require("@mui/icons-material");
|
42
|
+
var import_material2 = require("@mui/material");
|
43
|
+
var import_react_button = require("@xylabs/react-button");
|
44
|
+
var import_hash2 = require("@xyo-network/hash");
|
45
|
+
var import_react_property = require("@xyo-network/react-property");
|
46
|
+
var import_react_shared = require("@xyo-network/react-shared");
|
47
|
+
var import_react = require("react");
|
48
|
+
|
49
|
+
// src/components/Details/HashSourceDetails.tsx
|
50
|
+
var import_icons_material = require("@mui/icons-material");
|
51
|
+
var import_material = require("@mui/material");
|
52
|
+
var import_react_flexbox = require("@xylabs/react-flexbox");
|
53
|
+
var import_react_quick_tip_button = require("@xylabs/react-quick-tip-button");
|
54
|
+
var import_hash = require("@xyo-network/hash");
|
55
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
56
|
+
var PayloadHashSourceDetails = ({ noTitle = false, payload, ...props }) => {
|
57
|
+
const theme = (0, import_material.useTheme)();
|
58
|
+
const payloadString = payload ? JSON.stringify(import_hash.PayloadHasher.hashFields(payload), null, 2) : "";
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_flexbox.FlexCol, { alignItems: "stretch", ...props, children: [
|
60
|
+
noTitle ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_flexbox.FlexRow, { margin: 1, justifyContent: "flex-start", children: [
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { children: "Hash Source" }),
|
62
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_quick_tip_button.QuickTipButton, { title: "Hash Source", children: "The actual string used to generate the hash (SHA256)" })
|
63
|
+
] }),
|
64
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_flexbox.FlexRow, { children: [
|
65
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_flexbox.FlexGrowRow, { background: true, border: 1, borderColor: theme.palette.divider, justifyContent: "start", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { padding: 2, fontFamily: "monospace", variant: "body1", sx: { overflowWrap: "break-word", wordBreak: "break-all" }, children: payloadString }) }),
|
66
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.IconButton, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.ContentCopy, {}) })
|
67
|
+
] }),
|
68
|
+
noTitle ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_flexbox.FlexRow, { margin: 1, justifyContent: "flex-start", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "body2", children: "The actual string used to generate the hash (SHA256). This can be used to validate the hash manually." }) }) : null
|
69
|
+
] });
|
70
|
+
};
|
71
|
+
|
72
|
+
// src/components/Details/DataDetails.tsx
|
73
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
74
|
+
var PayloadDataDetails = ({ size, badge, payload, ...props }) => {
|
75
|
+
const payloadString = payload ? JSON.stringify(import_hash2.PayloadHasher.hashFields(payload), null, 2) : "";
|
76
|
+
const [viewSourceOpen, setViewSourceOpen] = (0, import_react.useState)(false);
|
77
|
+
const hash = (0, import_react_shared.usePayloadHash)(payload);
|
78
|
+
let elevation = 2;
|
79
|
+
if (props.paper) {
|
80
|
+
elevation += props.elevation ?? 0;
|
81
|
+
}
|
82
|
+
const actions = [
|
83
|
+
{
|
84
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material2.Visibility, {}),
|
85
|
+
name: "View",
|
86
|
+
onClick: () => setViewSourceOpen(true)
|
87
|
+
},
|
88
|
+
{
|
89
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material2.ContentCopy, {}),
|
90
|
+
name: "Copy",
|
91
|
+
onClick: async () => await navigator.clipboard.writeText(hash ?? "")
|
92
|
+
}
|
93
|
+
];
|
94
|
+
const onCopy = async () => {
|
95
|
+
await navigator.clipboard.writeText(payloadString);
|
96
|
+
};
|
97
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
99
|
+
import_react_property.Property,
|
100
|
+
{
|
101
|
+
titleProps: { elevation },
|
102
|
+
badge,
|
103
|
+
size,
|
104
|
+
actions,
|
105
|
+
title: "Payload Hash",
|
106
|
+
value: hash ?? "<Unknown>",
|
107
|
+
tip: "This is the payload hash",
|
108
|
+
...props
|
109
|
+
}
|
110
|
+
),
|
111
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material2.Dialog, { open: viewSourceOpen, onClose: () => setViewSourceOpen(false), children: [
|
112
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.DialogTitle, { children: "Hash Source" }),
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.DialogContent, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PayloadHashSourceDetails, { noTitle: true, payload }) }),
|
114
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material2.DialogActions, { children: [
|
115
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_button.ButtonEx, { color: "secondary", onClick: onCopy, children: "Copy" }),
|
116
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_button.ButtonEx, { color: "secondary", onClick: () => setViewSourceOpen(false), children: "Close" })
|
117
|
+
] })
|
118
|
+
] })
|
119
|
+
] });
|
120
|
+
};
|
121
|
+
|
122
|
+
// src/components/Details/Details.tsx
|
123
|
+
var import_react_flexbox4 = require("@xylabs/react-flexbox");
|
124
|
+
var import_react3 = require("react");
|
125
|
+
|
126
|
+
// src/components/Details/JsonDetails.tsx
|
127
|
+
var import_material3 = require("@mui/material");
|
128
|
+
var import_react_flexbox2 = require("@xylabs/react-flexbox");
|
129
|
+
var import_react_property2 = require("@xyo-network/react-property");
|
130
|
+
var import_react2 = require("react");
|
131
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
132
|
+
var JsonView = (0, import_react2.lazy)(() => import(
|
133
|
+
/* webpackChunkName: "jsonView" */
|
134
|
+
"react-json-view"
|
135
|
+
));
|
136
|
+
var PayloadJsonDetails = ({ jsonViewProps, payload = {}, ...props }) => {
|
137
|
+
const { breakpoints, palette } = (0, import_material3.useTheme)();
|
138
|
+
const belowSm = (0, import_material3.useMediaQuery)(breakpoints.down("sm"));
|
139
|
+
let elevation = 2;
|
140
|
+
if (props.paper) {
|
141
|
+
elevation += props.elevation ?? 0;
|
142
|
+
}
|
143
|
+
const jsonTheme = palette.mode === "dark" ? "shapeshifter" : void 0;
|
144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_property2.PropertyGroup, { titleProps: { elevation }, title: "JSON", tip: "The raw JSON of the payload", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Paper, { square: true, variant: "elevation", style: { overflow: "hidden", padding: "16px", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react2.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_flexbox2.FlexGrowRow, {}), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
145
|
+
JsonView,
|
146
|
+
{
|
147
|
+
groupArraysAfterLength: 20,
|
148
|
+
style: { backgroundColor: void 0, overflow: "hidden" },
|
149
|
+
src: payload,
|
150
|
+
enableClipboard: true,
|
151
|
+
theme: jsonTheme,
|
152
|
+
collapseStringsAfterLength: belowSm ? 24 : 32,
|
153
|
+
...jsonViewProps
|
154
|
+
}
|
155
|
+
) }) }) });
|
156
|
+
};
|
157
|
+
|
158
|
+
// src/components/Details/ValidationDetails/ValidationDetails.tsx
|
159
|
+
var import_material4 = require("@mui/material");
|
160
|
+
var import_react_flexbox3 = require("@xylabs/react-flexbox");
|
161
|
+
var import_react_promise = require("@xylabs/react-promise");
|
162
|
+
var import_payload_validator = require("@xyo-network/payload-validator");
|
163
|
+
var import_react_property3 = require("@xyo-network/react-property");
|
164
|
+
var import_react_schema = require("@xyo-network/react-schema");
|
165
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
166
|
+
var PayloadValidationDetails = ({ skipBody = false, value, ...props }) => {
|
167
|
+
const [validateErrors] = (0, import_react_promise.usePromise)(async () => value ? await new import_payload_validator.PayloadValidator(value).validate() : void 0, [value]);
|
168
|
+
const bodyErrors = skipBody ? [] : validateErrors ?? [];
|
169
|
+
const errors = [...bodyErrors];
|
170
|
+
let elevation = 2;
|
171
|
+
if (props.paper) {
|
172
|
+
elevation += props.elevation ?? 0;
|
173
|
+
}
|
174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_property3.PropertyGroup, { titleProps: { elevation }, title: "Validation", tip: "The results from validating the payload", ...props, children: [
|
175
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
176
|
+
import_react_property3.Property,
|
177
|
+
{
|
178
|
+
titleProps: { elevation },
|
179
|
+
flexGrow: 1,
|
180
|
+
title: "Valid",
|
181
|
+
value: errors.length === 0 ? "True" : "False",
|
182
|
+
tip: errors.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_flexbox3.FlexCol, { children: errors.map((error, index) => {
|
183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material4.Typography, { children: error.toString() }, index);
|
184
|
+
}) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material4.Typography, { children: "No Errors" })
|
185
|
+
}
|
186
|
+
),
|
187
|
+
(value == null ? void 0 : value.schema) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_schema.SchemaProperty, { flexGrow: 1, titleProps: { elevation }, value: value.schema })
|
188
|
+
] });
|
189
|
+
};
|
190
|
+
|
191
|
+
// src/components/Details/Details.tsx
|
192
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
193
|
+
var PayloadDetails = (0, import_react3.forwardRef)(({ paper, payload, ...props }, ref) => {
|
194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_flexbox4.FlexCol, { gap: 1, justifyContent: "flex-start", alignItems: "stretch", marginTop: 2, marginBottom: 8, ref, ...props, children: [
|
195
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PayloadDataDetails, { paper, size: "large", badge: true, payload }),
|
196
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PayloadValidationDetails, { paper, value: payload }),
|
197
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PayloadJsonDetails, { paper, payload })
|
198
|
+
] });
|
199
|
+
});
|
200
|
+
PayloadDetails.displayName = "PayloadDetails";
|
201
|
+
// Annotate the CommonJS export names for ESM import in node:
|
202
|
+
0 && (module.exports = {
|
203
|
+
PayloadDataDetails,
|
204
|
+
PayloadDetails,
|
205
|
+
PayloadJsonDetails,
|
206
|
+
PayloadValidationDetails
|
207
|
+
});
|
208
|
+
//# sourceMappingURL=index.cjs.map
|