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.
Files changed (179) hide show
  1. package/dist/api/helpers/api.js +34 -35
  2. package/dist/api/helpers/aws.js +9 -13
  3. package/dist/api/helpers/cloudfront.js +7 -24
  4. package/dist/api/helpers/dynamo.js +85 -134
  5. package/dist/api/helpers/dynamoInfra.js +14 -19
  6. package/dist/api/helpers/enforceDynamoProvisionCap.js +14 -18
  7. package/dist/api/helpers/index.js +14 -30
  8. package/dist/api/helpers/openApiHelpers.d.ts +2 -3
  9. package/dist/api/helpers/openApiHelpers.js +34 -37
  10. package/dist/api/helpers/s3.js +81 -126
  11. package/dist/api/helpers/ses.js +9 -28
  12. package/dist/api/helpers/sqs.js +9 -26
  13. package/dist/api/helpers/ssm.js +8 -14
  14. package/dist/api/helpers/sts.js +16 -34
  15. package/dist/api/helpers/validateOpenApi.js +92 -103
  16. package/dist/api/helpers/validations.js +29 -46
  17. package/dist/api/index.js +2 -18
  18. package/dist/api/openapi-prefix.js +25 -38
  19. package/dist/api/types/aws.js +1 -2
  20. package/dist/api/types/index.js +1 -17
  21. package/dist/common/const.js +2 -5
  22. package/dist/common/helpers/array.js +8 -19
  23. package/dist/common/helpers/async.js +10 -28
  24. package/dist/common/helpers/binary.js +5 -10
  25. package/dist/common/helpers/date.js +14 -25
  26. package/dist/common/helpers/email.js +5 -11
  27. package/dist/common/helpers/func.js +3 -7
  28. package/dist/common/helpers/generator.js +9 -24
  29. package/dist/common/helpers/groupBy.js +3 -9
  30. package/dist/common/helpers/hashCode.js +3 -9
  31. package/dist/common/helpers/i18n.js +9 -17
  32. package/dist/common/helpers/index.js +18 -34
  33. package/dist/common/helpers/log.js +16 -28
  34. package/dist/common/helpers/math.js +9 -21
  35. package/dist/common/helpers/memo.js +3 -7
  36. package/dist/common/helpers/object.js +20 -35
  37. package/dist/common/helpers/random.js +4 -10
  38. package/dist/common/helpers/secondsInNearest.js +2 -7
  39. package/dist/common/helpers/sleep.js +1 -5
  40. package/dist/common/helpers/string/base64.js +2 -7
  41. package/dist/common/helpers/string/chunk.js +1 -5
  42. package/dist/common/helpers/string/contains.js +2 -7
  43. package/dist/common/helpers/string/getExtendedStringSegment.js +5 -9
  44. package/dist/common/helpers/string/index.js +10 -26
  45. package/dist/common/helpers/string/json.js +1 -5
  46. package/dist/common/helpers/string/object.js +1 -5
  47. package/dist/common/helpers/string/surround.js +1 -5
  48. package/dist/common/helpers/string/trim.js +2 -7
  49. package/dist/common/helpers/string/truncate.js +1 -5
  50. package/dist/common/helpers/string/url.js +4 -9
  51. package/dist/common/index.js +2 -18
  52. package/dist/index.js +3 -19
  53. package/dist/ui/components/BorderGradient/index.js +18 -25
  54. package/dist/ui/components/Button/index.js +17 -25
  55. package/dist/ui/components/Chevron/index.js +9 -16
  56. package/dist/ui/components/Close/index.js +6 -13
  57. package/dist/ui/components/Confirm/Dialog.js +9 -25
  58. package/dist/ui/components/Confirm/Modal.js +20 -27
  59. package/dist/ui/components/Confirm/index.js +3 -19
  60. package/dist/ui/components/Confirm/types.js +1 -2
  61. package/dist/ui/components/DropdownList/Base.js +33 -64
  62. package/dist/ui/components/DropdownList/Dialog.js +8 -24
  63. package/dist/ui/components/DropdownList/index.js +2 -18
  64. package/dist/ui/components/DropdownList/types.js +1 -2
  65. package/dist/ui/components/FlexColumn/index.js +4 -14
  66. package/dist/ui/components/FlexRow/index.js +4 -14
  67. package/dist/ui/components/HeadersRaw/index.js +20 -27
  68. package/dist/ui/components/HorizontalScrollBar/index.js +6 -34
  69. package/dist/ui/components/Icon/index.js +9 -16
  70. package/dist/ui/components/Image/index.js +10 -28
  71. package/dist/ui/components/InfiniteScroll/index.js +18 -50
  72. package/dist/ui/components/KebabDots/index.js +6 -13
  73. package/dist/ui/components/Loader/index.js +9 -39
  74. package/dist/ui/components/Modal/Dialog.js +7 -23
  75. package/dist/ui/components/Modal/Modal.js +19 -49
  76. package/dist/ui/components/Modal/index.js +3 -19
  77. package/dist/ui/components/Modal/types.js +1 -2
  78. package/dist/ui/components/OpenApiCodeBlock/OpenApiCodeBlock.js +26 -34
  79. package/dist/ui/components/OpenApiCodeBlock/curl/helpers/body.js +12 -19
  80. package/dist/ui/components/OpenApiCodeBlock/curl/helpers/getCurlLines.js +6 -11
  81. package/dist/ui/components/OpenApiCodeBlock/curl/helpers/security.js +8 -15
  82. package/dist/ui/components/OpenApiCodeBlock/curl/index.js +14 -21
  83. package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/call.js +8 -15
  84. package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/getFetchLines.js +3 -8
  85. package/dist/ui/components/OpenApiCodeBlock/fetch/helpers/req.js +27 -34
  86. package/dist/ui/components/OpenApiCodeBlock/fetch/index.js +11 -18
  87. package/dist/ui/components/OpenApiCodeBlock/helpers/common.js +7 -17
  88. package/dist/ui/components/OpenApiCodeBlock/helpers/joinJsx.js +6 -15
  89. package/dist/ui/components/OpenApiCodeBlock/index.js +2 -18
  90. package/dist/ui/components/OpenApiCodeBlock/types.js +1 -2
  91. package/dist/ui/components/PieChart/index.js +11 -18
  92. package/dist/ui/components/ProgressBar/index.js +15 -45
  93. package/dist/ui/components/Prompt/Dialog.js +7 -23
  94. package/dist/ui/components/Prompt/Modal.js +25 -55
  95. package/dist/ui/components/Prompt/index.js +2 -18
  96. package/dist/ui/components/RowOrColumn/index.js +7 -17
  97. package/dist/ui/components/Search/AutoHideSearchBox.js +24 -56
  98. package/dist/ui/components/Search/Base.js +21 -52
  99. package/dist/ui/components/Search/Dialog.js +10 -26
  100. package/dist/ui/components/Search/Inline.js +3 -10
  101. package/dist/ui/components/Search/Modal.js +10 -17
  102. package/dist/ui/components/Search/SearchBox.js +26 -58
  103. package/dist/ui/components/Search/index.js +7 -23
  104. package/dist/ui/components/Search/types.js +1 -2
  105. package/dist/ui/components/Sidebar/index.js +18 -25
  106. package/dist/ui/components/SparkLine/index.js +17 -27
  107. package/dist/ui/components/Table/index.js +15 -22
  108. package/dist/ui/components/TextEdit/CheckboxEdit.js +21 -51
  109. package/dist/ui/components/TextEdit/ColourEdit.js +17 -44
  110. package/dist/ui/components/TextEdit/LengthBox.js +5 -12
  111. package/dist/ui/components/TextEdit/ListboxEdit.js +15 -42
  112. package/dist/ui/components/TextEdit/RadioGroup.js +13 -43
  113. package/dist/ui/components/TextEdit/TextEdit.js +48 -78
  114. package/dist/ui/components/TextEdit/common.js +11 -17
  115. package/dist/ui/components/TextEdit/index.js +6 -22
  116. package/dist/ui/components/TextEdit/types.js +1 -2
  117. package/dist/ui/components/TextWithButton/index.js +10 -40
  118. package/dist/ui/components/TimelineChart/index.js +14 -24
  119. package/dist/ui/components/Toast/Cross.js +9 -16
  120. package/dist/ui/components/Toast/Tick.js +4 -11
  121. package/dist/ui/components/Toast/Warning.js +8 -15
  122. package/dist/ui/components/Toast/base.js +33 -65
  123. package/dist/ui/components/Toast/index.js +2 -18
  124. package/dist/ui/components/Toast/types.js +1 -2
  125. package/dist/ui/components/UserImage/index.js +17 -48
  126. package/dist/ui/components/index.js +30 -46
  127. package/dist/ui/helpers/axiosHelper.js +25 -39
  128. package/dist/ui/helpers/browserHelpers.js +7 -22
  129. package/dist/ui/helpers/callOpenApi/cached.js +18 -37
  130. package/dist/ui/helpers/callOpenApi/direct.js +46 -59
  131. package/dist/ui/helpers/callOpenApi/helpers.js +25 -40
  132. package/dist/ui/helpers/callOpenApi/hook.js +47 -36
  133. package/dist/ui/helpers/callOpenApi/index.js +5 -21
  134. package/dist/ui/helpers/callOpenApi/types.js +1 -2
  135. package/dist/ui/helpers/cognito.js +1 -2
  136. package/dist/ui/helpers/cookie/const.js +2 -5
  137. package/dist/ui/helpers/cookie/get.js +13 -14
  138. package/dist/ui/helpers/cookie/index.js +5 -21
  139. package/dist/ui/helpers/cookie/raw.js +9 -16
  140. package/dist/ui/helpers/cookie/set.js +10 -15
  141. package/dist/ui/helpers/cookie/use.js +23 -16
  142. package/dist/ui/helpers/date.js +10 -15
  143. package/dist/ui/helpers/debounce.js +5 -10
  144. package/dist/ui/helpers/dom.js +6 -13
  145. package/dist/ui/helpers/extractAttributes.js +2 -7
  146. package/dist/ui/helpers/index.js +25 -41
  147. package/dist/ui/helpers/jwt.js +1 -2
  148. package/dist/ui/helpers/plural.js +1 -5
  149. package/dist/ui/helpers/routes.js +17 -24
  150. package/dist/ui/helpers/serviceWorker.js +8 -23
  151. package/dist/ui/helpers/useContextMenu.js +9 -14
  152. package/dist/ui/helpers/useElementAttribute.js +3 -7
  153. package/dist/ui/helpers/useGranularHook.js +5 -10
  154. package/dist/ui/helpers/useInterval.js +8 -12
  155. package/dist/ui/helpers/useLocalStorage.js +24 -32
  156. package/dist/ui/helpers/useLockBodyScroll.js +3 -7
  157. package/dist/ui/helpers/useOnClickOutside.js +7 -12
  158. package/dist/ui/helpers/useOnScroll.js +15 -21
  159. package/dist/ui/helpers/useOverloadPageSearch.js +3 -7
  160. package/dist/ui/helpers/useQueryString.js +14 -20
  161. package/dist/ui/helpers/useResize.js +8 -12
  162. package/dist/ui/helpers/useTimeout.js +5 -9
  163. package/dist/ui/icons/ChevronRight.js +3 -9
  164. package/dist/ui/icons/CrossIcon.js +5 -12
  165. package/dist/ui/icons/Door.js +4 -10
  166. package/dist/ui/icons/HorizontalDots.js +3 -9
  167. package/dist/ui/icons/Magnify.js +3 -10
  168. package/dist/ui/icons/Pencil.js +5 -12
  169. package/dist/ui/icons/Save.js +4 -11
  170. package/dist/ui/icons/Undo.js +5 -12
  171. package/dist/ui/icons/UserOutline.js +3 -9
  172. package/dist/ui/icons/index.js +9 -25
  173. package/dist/ui/index.js +4 -20
  174. package/dist/ui/styles/colours.js +7 -12
  175. package/dist/ui/styles/common.js +14 -22
  176. package/dist/ui/styles/index.js +4 -20
  177. package/dist/ui/styles/media.js +7 -10
  178. package/dist/ui/styles/standaloneStyles.js +10 -16
  179. package/package.json +18 -17
@@ -1,16 +1,10 @@
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 `
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 = styled_1.default.div `
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 = styled_1.default.div `
23
+ const ApiName = styled.div `
30
24
  font-weight: bold;
31
25
  font-size: 1.5rem;
32
26
  `;
33
- const BlockTitle = styled_1.default.div `
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 = styled_1.default.div `
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
- var _a;
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 react_1.default.createElement(Base, null, ops.error);
40
+ return React.createElement(Base, null, ops.error);
48
41
  }
49
42
  const { verb, operation, path } = ops;
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,
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
- 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 }))));
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
- "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) || {};
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 = (react_1.default.createElement(react_1.default.Fragment, null,
8
+ const content = (React.createElement(React.Fragment, null,
15
9
  "-d @- <<'EOF'",
16
- react_1.default.createElement("br", null),
17
- react_1.default.createElement(common_1.Highlight2, null, nice),
18
- react_1.default.createElement("br", null),
10
+ React.createElement("br", null),
11
+ React.createElement(Highlight2, null, nice),
12
+ React.createElement("br", null),
19
13
  "EOF"));
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'"))));
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
- "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;
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 = (0, security_1.getSecurityLine)(p, { operation });
6
+ const secline = getSecurityLine(p, { operation });
11
7
  if (secline.error) {
12
8
  return { error: secline.error };
13
9
  }
14
- const bodyLines = (_a = (0, body_1.getBody)(p)) !== null && _a !== void 0 ? _a : undefined;
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 === null || bodyLines === void 0 ? void 0 : bodyLines.content,
24
+ bodyLine: bodyLines?.content,
29
25
  operation,
30
26
  };
31
27
  };
32
- exports.getCurlLines = getCurlLines;
@@ -1,13 +1,7 @@
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 });
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: (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,
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
- react_1.default.createElement(common_1.Highlight2, null, p.apiKey || '(API KEY)'),
18
+ React.createElement(Highlight2, null, p.apiKey || '(API KEY)'),
25
19
  "'"))),
26
20
  };
27
21
  };
28
- exports.getSecurityLine = getSecurityLine;
@@ -1,34 +1,27 @@
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 `
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 } = (0, getCurlLines_1.getCurlLines)(ops, p);
10
+ export const Curl = ({ ops, p, }) => {
11
+ const { fullApiUrl, headerLines, bodyLine } = getCurlLines(ops, p);
18
12
  const { verb } = ops;
19
13
  const rows = [
20
- react_1.default.createElement(react_1.default.Fragment, null,
14
+ React.createElement(React.Fragment, null,
21
15
  "curl --request ",
22
16
  verb.toUpperCase()),
23
- react_1.default.createElement(react_1.default.Fragment, null,
17
+ React.createElement(React.Fragment, null,
24
18
  "--url ",
25
- react_1.default.createElement(common_1.Highlight, null,
19
+ React.createElement(Highlight, null,
26
20
  "'",
27
21
  fullApiUrl,
28
22
  "'")),
29
23
  ...(headerLines || []),
30
24
  bodyLine,
31
- ].filter(array_1.notEmpty);
32
- return react_1.default.createElement(Base, null, (0, joinJsx_1.joinJsxWithSlash)(rows));
25
+ ].filter(notEmpty);
26
+ return React.createElement(Base, null, joinJsxWithSlash(rows));
33
27
  };
34
- exports.Curl = Curl;
@@ -1,23 +1,16 @@
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"),
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
- react_1.default.createElement(common_1.Highlight, null, "await"),
7
+ React.createElement(Highlight, null, "await"),
14
8
  ' ',
15
- react_1.default.createElement(common_1.Highlight2, null, "fetch"),
9
+ React.createElement(Highlight2, null, "fetch"),
16
10
  "(",
17
- react_1.default.createElement(common_1.Highlight, null,
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
- "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;
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 = (_a = (0, req_1.getRequestOptions)(p, ops)) !== null && _a !== void 0 ? _a : undefined;
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
- "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 `
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 } = (0, common_1.getBodyJson)(p) || {};
10
+ export const getRequestOptions = (p, ops) => {
11
+ const { nice } = getBodyJson(p) || {};
18
12
  if (!nice) {
19
13
  return undefined;
20
14
  }
21
- const sec = (0, common_1.getSecurity)(p, ops);
22
- const h1 = (react_1.default.createElement(react_1.default.Fragment, null,
15
+ const sec = getSecurity(p, ops);
16
+ const h1 = (React.createElement(React.Fragment, null,
23
17
  ' ',
24
- react_1.default.createElement(common_1.Highlight, null, "'Content-Type'"),
18
+ React.createElement(Highlight, null, "'Content-Type'"),
25
19
  ":",
26
20
  ' ',
27
- react_1.default.createElement(common_1.Highlight, null, "'application/json'")));
21
+ React.createElement(Highlight, null, "'application/json'")));
28
22
  let h2;
29
23
  if (sec) {
30
- h2 = (react_1.default.createElement(react_1.default.Fragment, null,
24
+ h2 = (React.createElement(React.Fragment, null,
31
25
  ' ',
32
- react_1.default.createElement(common_1.Highlight, null,
26
+ React.createElement(Highlight, null,
33
27
  "'",
34
28
  sec.name,
35
29
  "'"),
36
30
  ":",
37
31
  ' ',
38
- react_1.default.createElement(common_1.Highlight, null,
32
+ React.createElement(Highlight, null,
39
33
  "'",
40
34
  p.apiKey || '(API KEY)',
41
35
  "'")));
42
36
  }
43
- const header = !sec ? (react_1.default.createElement(react_1.default.Fragment, null)) : (react_1.default.createElement(react_1.default.Fragment, null,
37
+ const header = !sec ? (React.createElement(React.Fragment, null)) : (React.createElement(React.Fragment, null,
44
38
  "headers: ",
45
39
  lb,
46
- react_1.default.createElement(Lpad, null, (0, joinJsx_1.joinJsxWithComma)([h1, h2])),
40
+ React.createElement(Lpad, null, joinJsxWithComma([h1, h2])),
47
41
  rb,
48
42
  ","));
49
- const body = (react_1.default.createElement(react_1.default.Fragment, null,
43
+ const body = (React.createElement(React.Fragment, null,
50
44
  "body: ",
51
- react_1.default.createElement(common_1.Highlight2, null, "JSON"),
45
+ React.createElement(Highlight2, null, "JSON"),
52
46
  ".",
53
- react_1.default.createElement(common_1.Highlight, null, "stringify"),
47
+ React.createElement(Highlight, null, "stringify"),
54
48
  "(",
55
49
  nice,
56
50
  ")"));
57
- const content = (react_1.default.createElement(react_1.default.Fragment, null,
51
+ const content = (React.createElement(React.Fragment, null,
58
52
  "const requestOptions = ",
59
53
  lb,
60
- react_1.default.createElement(Lpad, null,
54
+ React.createElement(Lpad, null,
61
55
  "method: ",
62
- react_1.default.createElement(common_1.Highlight, null,
56
+ React.createElement(Highlight, null,
63
57
  "'",
64
58
  ops.verb.toUpperCase(),
65
59
  "'"),
66
60
  ",",
67
- react_1.default.createElement("br", null),
61
+ React.createElement("br", null),
68
62
  header,
69
- react_1.default.createElement("br", null),
63
+ React.createElement("br", null),
70
64
  body,
71
- react_1.default.createElement("br", null)),
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
- "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 `
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 } = (0, getFetchLines_1.getFetchLines)(ops, p);
16
- const x = (0, call_1.getFetchCall)(p, ops);
17
- return (react_1.default.createElement(Base, null,
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
- react_1.default.createElement("br", null),
20
- react_1.default.createElement("br", null),
13
+ React.createElement("br", null),
14
+ React.createElement("br", null),
21
15
  x));
22
16
  };
23
- exports.Fetch = Fetch;
@@ -1,15 +1,9 @@
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 `
1
+ import styled from '@emotion/styled';
2
+ export const Highlight = styled.span `
9
3
  color: green;
10
4
  text-transform: capitalize;
11
5
  `;
12
- exports.Highlight2 = styled_1.default.span `
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
- exports.getOperation = getOperation;
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
- 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];
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
- "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) => {
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(array_1.notEmpty).forEach((i, index) => {
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
- 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;
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
- "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
+ export * from './OpenApiCodeBlock';
2
+ export * from './types';
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,16 +1,10 @@
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 `
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 (react_1.default.createElement(Base, { className: className },
22
- react_1.default.createElement("svg", { viewBox: `0 0 ${width} ${height}` }, data.map(({ label, value, color }) => {
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 (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)));
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;