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