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