ag-common 0.0.419 → 0.0.421
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/api/helpers/api.js +35 -34
- package/dist/api/helpers/aws.js +13 -9
- package/dist/api/helpers/cloudfront.js +24 -7
- package/dist/api/helpers/dynamo.js +134 -85
- package/dist/api/helpers/dynamoInfra.js +19 -14
- package/dist/api/helpers/enforceDynamoProvisionCap.js +18 -14
- package/dist/api/helpers/index.js +30 -14
- package/dist/api/helpers/openApiHelpers.js +37 -34
- package/dist/api/helpers/s3.js +126 -81
- package/dist/api/helpers/ses.js +28 -9
- package/dist/api/helpers/sqs.js +26 -9
- package/dist/api/helpers/ssm.js +14 -8
- package/dist/api/helpers/sts.js +34 -16
- package/dist/api/helpers/validateOpenApi.js +103 -92
- package/dist/api/helpers/validations.js +46 -29
- package/dist/api/index.js +18 -2
- package/dist/api/openapi-prefix.js +38 -25
- package/dist/api/types/aws.js +2 -1
- package/dist/api/types/index.js +17 -1
- package/dist/common/const.js +5 -2
- package/dist/common/helpers/array.js +19 -8
- package/dist/common/helpers/async.js +28 -10
- package/dist/common/helpers/binary.js +10 -5
- package/dist/common/helpers/date.js +25 -14
- package/dist/common/helpers/email.js +11 -5
- package/dist/common/helpers/func.js +7 -3
- package/dist/common/helpers/generator.js +24 -9
- package/dist/common/helpers/groupBy.js +9 -3
- package/dist/common/helpers/hashCode.js +9 -3
- package/dist/common/helpers/i18n.js +17 -9
- package/dist/common/helpers/index.js +34 -18
- package/dist/common/helpers/log.js +28 -16
- package/dist/common/helpers/math.js +21 -9
- package/dist/common/helpers/memo.js +7 -3
- package/dist/common/helpers/object.js +35 -20
- package/dist/common/helpers/random.js +10 -4
- package/dist/common/helpers/secondsInNearest.js +7 -2
- package/dist/common/helpers/sleep.js +5 -1
- package/dist/common/helpers/string/base64.js +7 -2
- package/dist/common/helpers/string/chunk.js +5 -1
- package/dist/common/helpers/string/contains.js +7 -2
- package/dist/common/helpers/string/getExtendedStringSegment.js +9 -5
- package/dist/common/helpers/string/index.js +26 -10
- package/dist/common/helpers/string/json.js +5 -1
- package/dist/common/helpers/string/object.js +5 -1
- package/dist/common/helpers/string/surround.js +5 -1
- package/dist/common/helpers/string/trim.js +7 -2
- package/dist/common/helpers/string/truncate.js +5 -1
- package/dist/common/helpers/string/url.js +9 -4
- package/dist/common/index.js +18 -2
- package/dist/index.js +19 -3
- package/dist/ui/components/BorderGradient/index.js +25 -18
- package/dist/ui/components/Button/index.js +25 -17
- package/dist/ui/components/Chevron/index.js +16 -9
- package/dist/ui/components/Close/index.js +13 -6
- package/dist/ui/components/Confirm/Dialog.js +25 -9
- package/dist/ui/components/Confirm/Modal.js +27 -20
- package/dist/ui/components/Confirm/index.js +19 -3
- package/dist/ui/components/Confirm/types.js +2 -1
- package/dist/ui/components/DropdownList/Base.js +64 -33
- package/dist/ui/components/DropdownList/Dialog.js +24 -8
- package/dist/ui/components/DropdownList/index.js +18 -2
- package/dist/ui/components/DropdownList/types.js +2 -1
- package/dist/ui/components/FlexColumn/index.js +14 -4
- package/dist/ui/components/FlexRow/index.js +14 -4
- package/dist/ui/components/HeadersRaw/index.js +27 -20
- package/dist/ui/components/HorizontalScrollBar/index.js +34 -6
- package/dist/ui/components/Icon/index.js +16 -9
- package/dist/ui/components/Image/index.js +28 -10
- package/dist/ui/components/InfiniteScroll/index.js +50 -18
- package/dist/ui/components/KebabDots/index.js +13 -6
- package/dist/ui/components/Loader/index.js +39 -9
- package/dist/ui/components/Modal/Dialog.js +23 -7
- package/dist/ui/components/Modal/Modal.js +49 -19
- package/dist/ui/components/Modal/index.js +19 -3
- package/dist/ui/components/Modal/types.js +2 -1
- package/dist/ui/components/OpenApiCodeBlock/OpenApiCodeBlock.js +34 -26
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/body.js +19 -12
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/getCurlLines.js +11 -6
- package/dist/ui/components/OpenApiCodeBlock/curl/helpers/security.js +15 -8
- package/dist/ui/components/OpenApiCodeBlock/curl/index.js +21 -14
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/call.js +15 -8
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/getFetchLines.js +8 -3
- package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/req.js +34 -27
- package/dist/ui/components/OpenApiCodeBlock/fetch/index.js +18 -11
- package/dist/ui/components/OpenApiCodeBlock/helpers/common.js +17 -7
- package/dist/ui/components/OpenApiCodeBlock/helpers/joinJsx.js +15 -6
- package/dist/ui/components/OpenApiCodeBlock/index.js +18 -2
- package/dist/ui/components/OpenApiCodeBlock/types.js +2 -1
- package/dist/ui/components/PieChart/index.js +18 -11
- package/dist/ui/components/ProgressBar/index.js +45 -15
- package/dist/ui/components/Prompt/Dialog.js +23 -7
- package/dist/ui/components/Prompt/Modal.js +55 -25
- package/dist/ui/components/Prompt/index.js +18 -2
- package/dist/ui/components/RowOrColumn/index.js +17 -7
- package/dist/ui/components/Search/AutoHideSearchBox.js +56 -24
- package/dist/ui/components/Search/Base.js +52 -21
- package/dist/ui/components/Search/Dialog.js +26 -10
- package/dist/ui/components/Search/Inline.js +10 -3
- package/dist/ui/components/Search/Modal.js +17 -10
- package/dist/ui/components/Search/SearchBox.js +58 -26
- package/dist/ui/components/Search/index.js +23 -7
- package/dist/ui/components/Search/types.js +2 -1
- package/dist/ui/components/Sidebar/index.js +25 -18
- package/dist/ui/components/SparkLine/index.js +27 -17
- package/dist/ui/components/Table/index.js +22 -15
- package/dist/ui/components/TextEdit/CheckboxEdit.js +51 -21
- package/dist/ui/components/TextEdit/ColourEdit.js +44 -17
- package/dist/ui/components/TextEdit/LengthBox.js +12 -5
- package/dist/ui/components/TextEdit/ListboxEdit.js +42 -15
- package/dist/ui/components/TextEdit/RadioGroup.js +43 -13
- package/dist/ui/components/TextEdit/TextEdit.js +78 -48
- package/dist/ui/components/TextEdit/common.js +17 -11
- package/dist/ui/components/TextEdit/index.js +22 -6
- package/dist/ui/components/TextEdit/types.js +2 -1
- package/dist/ui/components/TextWithButton/index.js +40 -10
- package/dist/ui/components/TimelineChart/index.js +24 -14
- package/dist/ui/components/Toast/Cross.js +16 -9
- package/dist/ui/components/Toast/Tick.js +11 -4
- package/dist/ui/components/Toast/Warning.js +15 -8
- package/dist/ui/components/Toast/base.js +65 -33
- package/dist/ui/components/Toast/index.js +18 -2
- package/dist/ui/components/Toast/types.js +2 -1
- package/dist/ui/components/UserImage/index.js +48 -17
- package/dist/ui/components/index.js +46 -30
- package/dist/ui/helpers/axiosHelper.js +39 -25
- package/dist/ui/helpers/browserHelpers.js +22 -7
- package/dist/ui/helpers/callOpenApi/cached.js +37 -18
- package/dist/ui/helpers/callOpenApi/direct.js +59 -46
- package/dist/ui/helpers/callOpenApi/helpers.js +40 -25
- package/dist/ui/helpers/callOpenApi/hook.js +36 -47
- package/dist/ui/helpers/callOpenApi/index.js +21 -5
- package/dist/ui/helpers/callOpenApi/types.js +2 -1
- package/dist/ui/helpers/cognito.js +2 -1
- package/dist/ui/helpers/cookie/const.js +5 -2
- package/dist/ui/helpers/cookie/get.js +14 -13
- package/dist/ui/helpers/cookie/index.js +21 -5
- package/dist/ui/helpers/cookie/raw.js +16 -9
- package/dist/ui/helpers/cookie/set.js +15 -10
- package/dist/ui/helpers/cookie/use.js +16 -23
- package/dist/ui/helpers/date.js +15 -10
- package/dist/ui/helpers/debounce.js +10 -5
- package/dist/ui/helpers/dom.js +13 -6
- package/dist/ui/helpers/extractAttributes.js +7 -2
- package/dist/ui/helpers/index.js +41 -25
- package/dist/ui/helpers/jwt.js +2 -1
- package/dist/ui/helpers/plural.js +5 -1
- package/dist/ui/helpers/routes.js +24 -17
- package/dist/ui/helpers/serviceWorker.js +23 -8
- package/dist/ui/helpers/useContextMenu.js +14 -9
- package/dist/ui/helpers/useElementAttribute.js +7 -3
- package/dist/ui/helpers/useGranularHook.js +10 -5
- package/dist/ui/helpers/useInterval.js +12 -8
- package/dist/ui/helpers/useLocalStorage.js +32 -24
- package/dist/ui/helpers/useLockBodyScroll.js +7 -3
- package/dist/ui/helpers/useOnClickOutside.js +12 -7
- package/dist/ui/helpers/useOnScroll.js +21 -15
- package/dist/ui/helpers/useOverloadPageSearch.js +7 -3
- package/dist/ui/helpers/useQueryString.js +20 -14
- package/dist/ui/helpers/useResize.js +19 -17
- package/dist/ui/helpers/useTimeout.js +9 -5
- package/dist/ui/icons/ChevronRight.js +9 -3
- package/dist/ui/icons/CrossIcon.js +12 -5
- package/dist/ui/icons/Door.js +10 -4
- package/dist/ui/icons/HorizontalDots.js +9 -3
- package/dist/ui/icons/Magnify.js +10 -3
- package/dist/ui/icons/Pencil.js +12 -5
- package/dist/ui/icons/Save.js +11 -4
- package/dist/ui/icons/Undo.js +12 -5
- package/dist/ui/icons/UserOutline.js +9 -3
- package/dist/ui/icons/index.js +25 -9
- package/dist/ui/index.js +20 -4
- package/dist/ui/styles/colours.js +12 -7
- package/dist/ui/styles/common.js +22 -14
- package/dist/ui/styles/index.js +20 -4
- package/dist/ui/styles/media.js +10 -7
- package/dist/ui/styles/standaloneStyles.js +16 -10
- package/package.json +2 -2
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.OpenApiCodeBlock = void 0;
|
|
7
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const FlexRow_1 = require("../FlexRow");
|
|
10
|
+
const curl_1 = require("./curl");
|
|
11
|
+
const fetch_1 = require("./fetch");
|
|
12
|
+
const common_1 = require("./helpers/common");
|
|
13
|
+
const Base = styled_1.default.div `
|
|
8
14
|
display: flex;
|
|
9
15
|
flex-flow: column;
|
|
10
16
|
width: calc(100% - 4rem);
|
|
@@ -13,46 +19,48 @@ const Base = styled.div `
|
|
|
13
19
|
margin: 1rem;
|
|
14
20
|
padding: 1rem;
|
|
15
21
|
`;
|
|
16
|
-
const Verb =
|
|
22
|
+
const Verb = styled_1.default.div `
|
|
17
23
|
background-color: #333;
|
|
18
24
|
color: white;
|
|
19
25
|
margin-right: 0.5rem;
|
|
20
26
|
padding: 0.25rem;
|
|
21
27
|
font-size: 0.8rem;
|
|
22
28
|
`;
|
|
23
|
-
const ApiName =
|
|
29
|
+
const ApiName = styled_1.default.div `
|
|
24
30
|
font-weight: bold;
|
|
25
31
|
font-size: 1.5rem;
|
|
26
32
|
`;
|
|
27
|
-
const BlockTitle =
|
|
33
|
+
const BlockTitle = styled_1.default.div `
|
|
28
34
|
color: #333;
|
|
29
35
|
font-size: 1.2rem;
|
|
30
36
|
margin-top: 2rem;
|
|
31
37
|
`;
|
|
32
|
-
const Block =
|
|
38
|
+
const Block = styled_1.default.div `
|
|
33
39
|
background-color: rgba(0, 0, 0, 0.1);
|
|
34
40
|
padding: 1rem;
|
|
35
41
|
margin-top: 0.5rem;
|
|
36
42
|
`;
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
const OpenApiCodeBlock = (p) => {
|
|
44
|
+
var _a;
|
|
45
|
+
const ops = (0, common_1.getOperation)(p);
|
|
39
46
|
if (ops.error || !ops.verb || !ops.operation) {
|
|
40
|
-
return
|
|
47
|
+
return react_1.default.createElement(Base, null, ops.error);
|
|
41
48
|
}
|
|
42
49
|
const { verb, operation, path } = ops;
|
|
43
|
-
return (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
return (react_1.default.createElement(Base, null,
|
|
51
|
+
react_1.default.createElement(FlexRow_1.FlexRow, { center: true },
|
|
52
|
+
react_1.default.createElement(Verb, null, verb),
|
|
53
|
+
react_1.default.createElement(ApiName, null, (_a = operation.description) !== null && _a !== void 0 ? _a : path)),
|
|
54
|
+
react_1.default.createElement(BlockTitle, null, "Definition"),
|
|
55
|
+
react_1.default.createElement(Block, null,
|
|
49
56
|
verb.toUpperCase(),
|
|
50
57
|
" ",
|
|
51
58
|
path),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
react_1.default.createElement(BlockTitle, null, "Example curl Request"),
|
|
60
|
+
react_1.default.createElement(Block, null,
|
|
61
|
+
react_1.default.createElement(curl_1.Curl, { ops: ops, p: p })),
|
|
62
|
+
react_1.default.createElement(BlockTitle, null, "Example fetch Request"),
|
|
63
|
+
react_1.default.createElement(Block, null,
|
|
64
|
+
react_1.default.createElement(fetch_1.Fetch, { ops: ops, p: p }))));
|
|
58
65
|
};
|
|
66
|
+
exports.OpenApiCodeBlock = OpenApiCodeBlock;
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getBody = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const common_1 = require("../../helpers/common");
|
|
9
|
+
const getBody = (p) => {
|
|
10
|
+
const { nice } = (0, common_1.getBodyJson)(p) || {};
|
|
5
11
|
if (!nice) {
|
|
6
12
|
return { content: undefined, header: undefined };
|
|
7
13
|
}
|
|
8
|
-
const content = (
|
|
14
|
+
const content = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
9
15
|
"-d @- <<'EOF'",
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
react_1.default.createElement("br", null),
|
|
17
|
+
react_1.default.createElement(common_1.Highlight2, null, nice),
|
|
18
|
+
react_1.default.createElement("br", null),
|
|
13
19
|
"EOF"));
|
|
14
|
-
const header = (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
const header = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
21
|
+
react_1.default.createElement("span", null, "--header "),
|
|
22
|
+
react_1.default.createElement(common_1.Highlight, null,
|
|
23
|
+
react_1.default.createElement(common_1.Highlight, null, "'Content-Type: application/json'"))));
|
|
18
24
|
return {
|
|
19
25
|
content,
|
|
20
26
|
header,
|
|
21
27
|
};
|
|
22
28
|
};
|
|
29
|
+
exports.getBody = getBody;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCurlLines = void 0;
|
|
4
|
+
const body_1 = require("./body");
|
|
5
|
+
const security_1 = require("./security");
|
|
6
|
+
const getCurlLines = (ops, p) => {
|
|
7
|
+
var _a;
|
|
4
8
|
const { operation, path, verb, fullApiUrl } = ops;
|
|
5
9
|
const withPath = fullApiUrl + path;
|
|
6
|
-
const secline = getSecurityLine(p, { operation });
|
|
10
|
+
const secline = (0, security_1.getSecurityLine)(p, { operation });
|
|
7
11
|
if (secline.error) {
|
|
8
12
|
return { error: secline.error };
|
|
9
13
|
}
|
|
10
|
-
const bodyLines = getBody(p)
|
|
14
|
+
const bodyLines = (_a = (0, body_1.getBody)(p)) !== null && _a !== void 0 ? _a : undefined;
|
|
11
15
|
const headerLines = [];
|
|
12
16
|
if (secline.content) {
|
|
13
17
|
headerLines.push(secline.content);
|
|
@@ -21,7 +25,8 @@ export const getCurlLines = (ops, p) => {
|
|
|
21
25
|
error: undefined,
|
|
22
26
|
headerLines: headerLines,
|
|
23
27
|
fullApiUrl: withPath,
|
|
24
|
-
bodyLine: bodyLines
|
|
28
|
+
bodyLine: bodyLines === null || bodyLines === void 0 ? void 0 : bodyLines.content,
|
|
25
29
|
operation,
|
|
26
30
|
};
|
|
27
31
|
};
|
|
32
|
+
exports.getCurlLines = getCurlLines;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getSecurityLine = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const common_1 = require("../../helpers/common");
|
|
9
|
+
const getSecurityLine = (p, { operation }) => {
|
|
10
|
+
const sec = (0, common_1.getSecurity)(p, { operation });
|
|
5
11
|
if (sec === null) {
|
|
6
12
|
return { error: 'not supported sec in', content: undefined };
|
|
7
13
|
}
|
|
@@ -9,13 +15,14 @@ export const getSecurityLine = (p, { operation }) => {
|
|
|
9
15
|
return { content: undefined };
|
|
10
16
|
}
|
|
11
17
|
return {
|
|
12
|
-
content: (
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
content: (react_1.default.createElement(react_1.default.Fragment, null,
|
|
19
|
+
react_1.default.createElement("span", null, "--header "),
|
|
20
|
+
react_1.default.createElement(common_1.Highlight, null,
|
|
15
21
|
"'",
|
|
16
22
|
sec.name,
|
|
17
23
|
": ",
|
|
18
|
-
|
|
24
|
+
react_1.default.createElement(common_1.Highlight2, null, p.apiKey || '(API KEY)'),
|
|
19
25
|
"'"))),
|
|
20
26
|
};
|
|
21
27
|
};
|
|
28
|
+
exports.getSecurityLine = getSecurityLine;
|
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Curl = void 0;
|
|
7
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const array_1 = require("../../../../common/helpers/array");
|
|
10
|
+
const common_1 = require("../helpers/common");
|
|
11
|
+
const joinJsx_1 = require("../helpers/joinJsx");
|
|
12
|
+
const getCurlLines_1 = require("./helpers/getCurlLines");
|
|
13
|
+
const Base = styled_1.default.div `
|
|
8
14
|
white-space: pre;
|
|
9
15
|
`;
|
|
10
|
-
|
|
11
|
-
const { fullApiUrl, headerLines, bodyLine } = getCurlLines(ops, p);
|
|
16
|
+
const Curl = ({ ops, p, }) => {
|
|
17
|
+
const { fullApiUrl, headerLines, bodyLine } = (0, getCurlLines_1.getCurlLines)(ops, p);
|
|
12
18
|
const { verb } = ops;
|
|
13
19
|
const rows = [
|
|
14
|
-
|
|
20
|
+
react_1.default.createElement(react_1.default.Fragment, null,
|
|
15
21
|
"curl --request ",
|
|
16
22
|
verb.toUpperCase()),
|
|
17
|
-
|
|
23
|
+
react_1.default.createElement(react_1.default.Fragment, null,
|
|
18
24
|
"--url ",
|
|
19
|
-
|
|
25
|
+
react_1.default.createElement(common_1.Highlight, null,
|
|
20
26
|
"'",
|
|
21
27
|
fullApiUrl,
|
|
22
28
|
"'")),
|
|
23
29
|
...(headerLines || []),
|
|
24
30
|
bodyLine,
|
|
25
|
-
].filter(notEmpty);
|
|
26
|
-
return
|
|
31
|
+
].filter(array_1.notEmpty);
|
|
32
|
+
return react_1.default.createElement(Base, null, (0, joinJsx_1.joinJsxWithSlash)(rows));
|
|
27
33
|
};
|
|
34
|
+
exports.Curl = Curl;
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getFetchCall = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const common_1 = require("../../helpers/common");
|
|
9
|
+
const getFetchCall = (p, ops) => {
|
|
10
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
11
|
+
react_1.default.createElement(common_1.Highlight, null, "const"),
|
|
6
12
|
"\u00A0response = ",
|
|
7
|
-
|
|
13
|
+
react_1.default.createElement(common_1.Highlight, null, "await"),
|
|
8
14
|
' ',
|
|
9
|
-
|
|
15
|
+
react_1.default.createElement(common_1.Highlight2, null, "fetch"),
|
|
10
16
|
"(",
|
|
11
|
-
|
|
17
|
+
react_1.default.createElement(common_1.Highlight, null,
|
|
12
18
|
"'",
|
|
13
19
|
ops.fullApiUrl,
|
|
14
20
|
"'"),
|
|
15
21
|
",\u00A0 requestOptions);"));
|
|
16
22
|
};
|
|
23
|
+
exports.getFetchCall = getFetchCall;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFetchLines = void 0;
|
|
4
|
+
const req_1 = require("./req");
|
|
5
|
+
const getFetchLines = (ops, p) => {
|
|
6
|
+
var _a;
|
|
3
7
|
const { operation, path, verb, fullApiUrl } = ops;
|
|
4
8
|
const withPath = fullApiUrl + path;
|
|
5
|
-
const reqContent = getRequestOptions(p, ops)
|
|
9
|
+
const reqContent = (_a = (0, req_1.getRequestOptions)(p, ops)) !== null && _a !== void 0 ? _a : undefined;
|
|
6
10
|
return {
|
|
7
11
|
verb,
|
|
8
12
|
path,
|
|
@@ -12,3 +16,4 @@ export const getFetchLines = (ops, p) => {
|
|
|
12
16
|
operation,
|
|
13
17
|
};
|
|
14
18
|
};
|
|
19
|
+
exports.getFetchLines = getFetchLines;
|
|
@@ -1,69 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getRequestOptions = void 0;
|
|
7
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const common_1 = require("../../helpers/common");
|
|
10
|
+
const joinJsx_1 = require("../../helpers/joinJsx");
|
|
11
|
+
const rb = react_1.default.createElement(react_1.default.Fragment, null, "}");
|
|
12
|
+
const lb = react_1.default.createElement(react_1.default.Fragment, null, "{");
|
|
13
|
+
const Lpad = styled_1.default.div `
|
|
8
14
|
padding-left: 0.5rem;
|
|
9
15
|
`;
|
|
10
|
-
|
|
11
|
-
const { nice } = getBodyJson(p) || {};
|
|
16
|
+
const getRequestOptions = (p, ops) => {
|
|
17
|
+
const { nice } = (0, common_1.getBodyJson)(p) || {};
|
|
12
18
|
if (!nice) {
|
|
13
19
|
return undefined;
|
|
14
20
|
}
|
|
15
|
-
const sec = getSecurity(p, ops);
|
|
16
|
-
const h1 = (
|
|
21
|
+
const sec = (0, common_1.getSecurity)(p, ops);
|
|
22
|
+
const h1 = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
17
23
|
' ',
|
|
18
|
-
|
|
24
|
+
react_1.default.createElement(common_1.Highlight, null, "'Content-Type'"),
|
|
19
25
|
":",
|
|
20
26
|
' ',
|
|
21
|
-
|
|
27
|
+
react_1.default.createElement(common_1.Highlight, null, "'application/json'")));
|
|
22
28
|
let h2;
|
|
23
29
|
if (sec) {
|
|
24
|
-
h2 = (
|
|
30
|
+
h2 = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
25
31
|
' ',
|
|
26
|
-
|
|
32
|
+
react_1.default.createElement(common_1.Highlight, null,
|
|
27
33
|
"'",
|
|
28
34
|
sec.name,
|
|
29
35
|
"'"),
|
|
30
36
|
":",
|
|
31
37
|
' ',
|
|
32
|
-
|
|
38
|
+
react_1.default.createElement(common_1.Highlight, null,
|
|
33
39
|
"'",
|
|
34
40
|
p.apiKey || '(API KEY)',
|
|
35
41
|
"'")));
|
|
36
42
|
}
|
|
37
|
-
const header = !sec ? (
|
|
43
|
+
const header = !sec ? (react_1.default.createElement(react_1.default.Fragment, null)) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
38
44
|
"headers: ",
|
|
39
45
|
lb,
|
|
40
|
-
|
|
46
|
+
react_1.default.createElement(Lpad, null, (0, joinJsx_1.joinJsxWithComma)([h1, h2])),
|
|
41
47
|
rb,
|
|
42
48
|
","));
|
|
43
|
-
const body = (
|
|
49
|
+
const body = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
44
50
|
"body: ",
|
|
45
|
-
|
|
51
|
+
react_1.default.createElement(common_1.Highlight2, null, "JSON"),
|
|
46
52
|
".",
|
|
47
|
-
|
|
53
|
+
react_1.default.createElement(common_1.Highlight, null, "stringify"),
|
|
48
54
|
"(",
|
|
49
55
|
nice,
|
|
50
56
|
")"));
|
|
51
|
-
const content = (
|
|
57
|
+
const content = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
52
58
|
"const requestOptions = ",
|
|
53
59
|
lb,
|
|
54
|
-
|
|
60
|
+
react_1.default.createElement(Lpad, null,
|
|
55
61
|
"method: ",
|
|
56
|
-
|
|
62
|
+
react_1.default.createElement(common_1.Highlight, null,
|
|
57
63
|
"'",
|
|
58
64
|
ops.verb.toUpperCase(),
|
|
59
65
|
"'"),
|
|
60
66
|
",",
|
|
61
|
-
|
|
67
|
+
react_1.default.createElement("br", null),
|
|
62
68
|
header,
|
|
63
|
-
|
|
69
|
+
react_1.default.createElement("br", null),
|
|
64
70
|
body,
|
|
65
|
-
|
|
71
|
+
react_1.default.createElement("br", null)),
|
|
66
72
|
rb,
|
|
67
73
|
";"));
|
|
68
74
|
return content;
|
|
69
75
|
};
|
|
76
|
+
exports.getRequestOptions = getRequestOptions;
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Fetch = void 0;
|
|
7
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const call_1 = require("./helpers/call");
|
|
10
|
+
const getFetchLines_1 = require("./helpers/getFetchLines");
|
|
11
|
+
const Base = styled_1.default.div `
|
|
6
12
|
white-space: pre;
|
|
7
13
|
`;
|
|
8
|
-
|
|
9
|
-
const { reqContent } = getFetchLines(ops, p);
|
|
10
|
-
const x = getFetchCall(p, ops);
|
|
11
|
-
return (
|
|
14
|
+
const Fetch = ({ ops, p, }) => {
|
|
15
|
+
const { reqContent } = (0, getFetchLines_1.getFetchLines)(ops, p);
|
|
16
|
+
const x = (0, call_1.getFetchCall)(p, ops);
|
|
17
|
+
return (react_1.default.createElement(Base, null,
|
|
12
18
|
reqContent,
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
react_1.default.createElement("br", null),
|
|
20
|
+
react_1.default.createElement("br", null),
|
|
15
21
|
x));
|
|
16
22
|
};
|
|
23
|
+
exports.Fetch = Fetch;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getSecurity = exports.getBodyJson = exports.getOperation = exports.Highlight2 = exports.Highlight = void 0;
|
|
7
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
+
exports.Highlight = styled_1.default.span `
|
|
3
9
|
color: green;
|
|
4
10
|
text-transform: capitalize;
|
|
5
11
|
`;
|
|
6
|
-
|
|
12
|
+
exports.Highlight2 = styled_1.default.span `
|
|
7
13
|
color: indianred;
|
|
8
14
|
`;
|
|
9
15
|
const indexOfNumber = (str, char, num = 0) => {
|
|
@@ -26,7 +32,7 @@ const getFunctionName = (p) => {
|
|
|
26
32
|
ret = ret.substring(i1, i2);
|
|
27
33
|
return ret;
|
|
28
34
|
};
|
|
29
|
-
|
|
35
|
+
const getOperation = (p) => {
|
|
30
36
|
let path;
|
|
31
37
|
let verb;
|
|
32
38
|
const func = getFunctionName(p);
|
|
@@ -45,7 +51,8 @@ export const getOperation = (p) => {
|
|
|
45
51
|
const operation = p.schema.paths[path][verb];
|
|
46
52
|
return { operation, verb, path, fullApiUrl: getApiUrl(p) };
|
|
47
53
|
};
|
|
48
|
-
|
|
54
|
+
exports.getOperation = getOperation;
|
|
55
|
+
const getBodyJson = (p) => {
|
|
49
56
|
const body = p.funcF.toString();
|
|
50
57
|
const bstart = indexOfNumber(body, '(', 1);
|
|
51
58
|
const bend = !bstart ? undefined : body.lastIndexOf(')');
|
|
@@ -63,8 +70,10 @@ export const getBodyJson = (p) => {
|
|
|
63
70
|
const nice = JSON.stringify(JSON.parse(cleaned), null, 2);
|
|
64
71
|
return { nice, raw };
|
|
65
72
|
};
|
|
66
|
-
|
|
67
|
-
|
|
73
|
+
exports.getBodyJson = getBodyJson;
|
|
74
|
+
const getSecurity = (p, { operation }) => {
|
|
75
|
+
var _a;
|
|
76
|
+
const security1 = (_a = operation.security) === null || _a === void 0 ? void 0 : _a[0];
|
|
68
77
|
const security2 = !security1 ? undefined : Object.keys(security1)[0];
|
|
69
78
|
const security = !security2
|
|
70
79
|
? undefined
|
|
@@ -77,3 +86,4 @@ export const getSecurity = (p, { operation }) => {
|
|
|
77
86
|
}
|
|
78
87
|
return undefined;
|
|
79
88
|
};
|
|
89
|
+
exports.getSecurity = getSecurity;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.joinJsxWithComma = exports.joinJsxWithSlash = exports.joinJsx = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const array_1 = require("../../../../common/helpers/array");
|
|
9
|
+
const joinJsx = (items, sep) => {
|
|
4
10
|
const ret = [];
|
|
5
|
-
items.filter(notEmpty).forEach((i, index) => {
|
|
11
|
+
items.filter(array_1.notEmpty).forEach((i, index) => {
|
|
6
12
|
ret.push(i);
|
|
7
13
|
if (index !== items.length - 1) {
|
|
8
14
|
for (const s of sep) {
|
|
@@ -12,5 +18,8 @@ export const joinJsx = (items, sep) => {
|
|
|
12
18
|
});
|
|
13
19
|
return ret;
|
|
14
20
|
};
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
exports.joinJsx = joinJsx;
|
|
22
|
+
const joinJsxWithSlash = (items) => (0, exports.joinJsx)(items, [react_1.default.createElement(react_1.default.Fragment, null, "\u00A0\\"), react_1.default.createElement("br", { key: "br1" })]);
|
|
23
|
+
exports.joinJsxWithSlash = joinJsxWithSlash;
|
|
24
|
+
const joinJsxWithComma = (items) => (0, exports.joinJsx)(items, [react_1.default.createElement(react_1.default.Fragment, null, ","), react_1.default.createElement("br", { key: "br1" })]);
|
|
25
|
+
exports.joinJsxWithComma = joinJsxWithComma;
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./OpenApiCodeBlock"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PieChart = void 0;
|
|
7
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const Base = styled_1.default.div `
|
|
4
10
|
width: 100%;
|
|
5
11
|
height: 100%;
|
|
6
12
|
`;
|
|
7
|
-
|
|
13
|
+
const PieChart = ({ data, className }) => {
|
|
8
14
|
const total = data.reduce((sum, { value }) => sum + value, 0);
|
|
9
15
|
const width = 500;
|
|
10
16
|
const height = 500;
|
|
@@ -12,8 +18,8 @@ export const PieChart = ({ data, className }) => {
|
|
|
12
18
|
const centerY = height / 2;
|
|
13
19
|
const radius = Math.min(width, height) / 2;
|
|
14
20
|
let cumulativeAngle = 0;
|
|
15
|
-
return (
|
|
16
|
-
|
|
21
|
+
return (react_1.default.createElement(Base, { className: className },
|
|
22
|
+
react_1.default.createElement("svg", { viewBox: `0 0 ${width} ${height}` }, data.map(({ label, value, color }) => {
|
|
17
23
|
const angle = (value / total) * 360;
|
|
18
24
|
const startX = centerX + radius * Math.cos((cumulativeAngle * Math.PI) / 180);
|
|
19
25
|
const startY = centerY + radius * Math.sin((cumulativeAngle * Math.PI) / 180);
|
|
@@ -26,10 +32,11 @@ export const PieChart = ({ data, className }) => {
|
|
|
26
32
|
const midX = centerX + radius * 0.75 * Math.cos((midAngle * Math.PI) / 180);
|
|
27
33
|
const midY = centerY + radius * 0.75 * Math.sin((midAngle * Math.PI) / 180);
|
|
28
34
|
cumulativeAngle += angle;
|
|
29
|
-
return (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
return (react_1.default.createElement("g", { key: label },
|
|
36
|
+
react_1.default.createElement("title", null, `${label}: ${value}`),
|
|
37
|
+
react_1.default.createElement("path", { d: `M ${startX} ${startY} A ${radius} ${radius} 0 ${largeArcFlag} 1 ${endX} ${endY} L ${centerX} ${centerY} Z`, fill: color }),
|
|
38
|
+
react_1.default.createElement("text", { x: midX, y: midY, textAnchor: "middle", alignmentBaseline: "middle", stroke: "white", strokeWidth: "6px" }, label),
|
|
39
|
+
react_1.default.createElement("text", { x: midX, y: midY, textAnchor: "middle", alignmentBaseline: "middle", fill: "black" }, label)));
|
|
34
40
|
}))));
|
|
35
41
|
};
|
|
42
|
+
exports.PieChart = PieChart;
|