@digi-frontend/dgate-api-documentation 1.4.5 → 1.4.7

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 (45) hide show
  1. package/dist/assets/icons/index.d.ts +27 -0
  2. package/dist/components/Chips/Chips.d.ts +17 -0
  3. package/dist/components/InfoForm/InfoForm.d.ts +4 -0
  4. package/dist/components/JsonInput/JsonInput.d.ts +15 -0
  5. package/dist/components/LivePreview/LivePreview.d.ts +8 -0
  6. package/dist/components/MethodAccordion/MethodAccordion.d.ts +13 -0
  7. package/dist/components/SVGLoader/SVGLoader.d.ts +8 -0
  8. package/dist/components/SectionHead/SectionHead.d.ts +10 -0
  9. package/dist/components/SimpleLabelValue/SimpleLabelValue.d.ts +11 -0
  10. package/dist/components/SimpleLabelValue/index.d.ts +1 -0
  11. package/dist/components/Tooltip/Tooltip.d.ts +19 -0
  12. package/dist/components/dialog/dialog.d.ts +47 -0
  13. package/dist/components/dialog/index.d.ts +5 -0
  14. package/dist/components/table/table.d.ts +13 -0
  15. package/dist/components/table/tags-table.d.ts +11 -0
  16. package/dist/constants/index.d.ts +73 -0
  17. package/dist/constants/methods.constant.d.ts +16 -0
  18. package/dist/constants/regex.d.ts +7 -0
  19. package/dist/context/SectionToggleContext.d.ts +37 -0
  20. package/dist/helpers/docs.helper.d.ts +3 -0
  21. package/dist/helpers/layout.helper.d.ts +7 -0
  22. package/dist/helpers/methodAccordion.helper.d.ts +2 -0
  23. package/dist/index.d.ts +2 -0
  24. package/dist/index.js +13 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/layout/docsComponents/Codebox/Codebox.d.ts +5 -0
  27. package/dist/layout/docsComponents/DocsAside/DocsAside.d.ts +6 -0
  28. package/dist/layout/docsComponents/DocsContent/DocsContent.d.ts +12 -0
  29. package/dist/layout/docsComponents/DocsContent/EndpointPage/index.d.ts +7 -0
  30. package/dist/layout/docsComponents/DocsContent/OverviewPage/index.d.ts +10 -0
  31. package/dist/layout/docsComponents/DocsHeader/DocsHeader.d.ts +7 -0
  32. package/dist/layout/docsComponents/DocsSideMenuTree/DocsSideMenuTree.d.ts +18 -0
  33. package/dist/layout/docsComponents/index.d.ts +17 -0
  34. package/dist/layout/docsLayout.d.ts +31 -0
  35. package/dist/layout/layout.d.ts +10 -0
  36. package/dist/types/docsLayout.type.d.ts +7 -0
  37. package/dist/types/index.d.ts +27 -2
  38. package/dist/types/layout.type.d.ts +29 -0
  39. package/dist/types/openApi.d.ts +98 -0
  40. package/dist/types/transformedOpenApi.d.ts +50 -0
  41. package/dist/utils/index.d.ts +2 -0
  42. package/dist/validator/form.scheme.d.ts +49 -0
  43. package/package.json +9 -8
  44. package/rollup.config.js +3 -13
  45. package/tsconfig.json +4 -3
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ declare const Codebox: ({ code }: {
3
+ code: string;
4
+ }) => React.JSX.Element;
5
+ export default Codebox;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { EndpointData } from 'src/layout/docsLayout';
3
+ declare const DocsAside: ({ data }: {
4
+ data: EndpointData;
5
+ }) => React.JSX.Element;
6
+ export default DocsAside;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import './style.scss';
3
+ import { EndpointData, OverviewData } from 'src/layout/docsLayout';
4
+ declare const DocsContent: ({ data, activeType, setActiveItemData, setActiveType, onProductNavigate, apis, }: {
5
+ data: OverviewData | EndpointData;
6
+ activeType: "OVERVIEW" | "ENDPOINT";
7
+ setActiveItemData: React.Dispatch<React.SetStateAction<OverviewData | EndpointData>>;
8
+ setActiveType: React.Dispatch<React.SetStateAction<"OVERVIEW" | "ENDPOINT">>;
9
+ onProductNavigate?: (productId: number) => void;
10
+ apis: OverviewData[];
11
+ }) => React.JSX.Element;
12
+ export default DocsContent;
@@ -0,0 +1,7 @@
1
+ import { EndpointData, OverviewData } from 'src/layout/docsLayout';
2
+ import './style.scss';
3
+ export declare const EndpointPage: ({ data, setActiveType, setActiveItemData, }: {
4
+ data: EndpointData;
5
+ setActiveType: React.Dispatch<React.SetStateAction<"OVERVIEW" | "ENDPOINT">>;
6
+ setActiveItemData: React.Dispatch<React.SetStateAction<OverviewData | EndpointData>>;
7
+ }) => import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import './style.scss';
2
+ import { EndpointData, OverviewData } from 'src/layout/docsLayout';
3
+ import React from 'react';
4
+ export declare const OverviewPage: ({ data, setActiveItemData, setActiveType, onProductNavigate, apis, }: {
5
+ data: OverviewData;
6
+ setActiveItemData: React.Dispatch<React.SetStateAction<OverviewData | EndpointData>>;
7
+ setActiveType: React.Dispatch<React.SetStateAction<"OVERVIEW" | "ENDPOINT">>;
8
+ onProductNavigate?: (productId: number) => void;
9
+ apis: OverviewData[];
10
+ }) => React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { OverviewData } from '../../../../src/layout/docsLayout';
3
+ declare const DocsHeader: ({ transformedOpenApis, updateFilteredData, }: {
4
+ transformedOpenApis: OverviewData[];
5
+ updateFilteredData: (filteredItems: OverviewData[], isReset?: boolean) => void;
6
+ }) => React.JSX.Element;
7
+ export default DocsHeader;
@@ -0,0 +1,18 @@
1
+ import './style.scss';
2
+ import React from 'react';
3
+ import { EndpointData, OverviewData } from 'src/layout/docsLayout';
4
+ declare const DocsSideMenuTree: ({ apis, setActiveItemData, isFirstApiExpanded, setIsFirstApiExpanded, setActiveType, canSelectFirstApi, canFocusSection, setCanFocusSection, activeApiId, setCanSelectFirstApi, }: {
5
+ apis: OverviewData[];
6
+ setActiveItemData: React.Dispatch<React.SetStateAction<OverviewData | EndpointData>>;
7
+ activeItemData: OverviewData | EndpointData;
8
+ isFirstApiExpanded: boolean;
9
+ setIsFirstApiExpanded: React.Dispatch<React.SetStateAction<boolean>>;
10
+ setActiveType: React.Dispatch<React.SetStateAction<"OVERVIEW" | "ENDPOINT">>;
11
+ activeType: "OVERVIEW" | "ENDPOINT";
12
+ canSelectFirstApi?: boolean;
13
+ canFocusSection: boolean;
14
+ setCanFocusSection: React.Dispatch<React.SetStateAction<boolean>>;
15
+ activeApiId: string;
16
+ setCanSelectFirstApi: React.Dispatch<React.SetStateAction<boolean>>;
17
+ }) => React.JSX.Element;
18
+ export default DocsSideMenuTree;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import DocsHeader from './DocsHeader/DocsHeader';
3
+ import DocsSideMenuTree from './DocsSideMenuTree/DocsSideMenuTree';
4
+ import DocsContent from './DocsContent/DocsContent';
5
+ import DocsAside from './DocsAside/DocsAside';
6
+ import './index.scss';
7
+ type LayoutProps = {
8
+ children: React.ReactNode;
9
+ };
10
+ type CompoundLayout = React.FC<LayoutProps> & {
11
+ DocsHeader: typeof DocsHeader;
12
+ DocsSideMenuTree: typeof DocsSideMenuTree;
13
+ DocsContent: typeof DocsContent;
14
+ DocsAside: typeof DocsAside;
15
+ };
16
+ declare const Layout: CompoundLayout;
17
+ export default Layout;
@@ -0,0 +1,31 @@
1
+ import React, { JSX } from 'react';
2
+ import { HTTPMethod, OpenAPIFile, Parameter, RequestBody, Responses } from '@entities/openApi';
3
+ import { ApiSpecModel } from '@entities/index';
4
+ interface ILayoutProps {
5
+ apis?: ApiSpecModel[];
6
+ activeApiId?: string;
7
+ onProductNavigate?: (productId: number) => void;
8
+ }
9
+ export interface TagData {
10
+ id: string;
11
+ method: HTTPMethod;
12
+ path: string;
13
+ tags: string[];
14
+ responses: Responses;
15
+ summary?: string;
16
+ description: string;
17
+ parameters?: Parameter[];
18
+ requestBody?: RequestBody;
19
+ }
20
+ export interface EndpointData extends TagData {
21
+ api: OverviewData;
22
+ }
23
+ export interface OverviewData extends Omit<ApiSpecModel, 'metaData'> {
24
+ description: string;
25
+ title: string;
26
+ version: string;
27
+ tags: Record<string, TagData[]>;
28
+ servers: OpenAPIFile['servers'];
29
+ }
30
+ declare const _default: React.MemoExoticComponent<({ apis, activeApiId, onProductNavigate }: ILayoutProps) => JSX.Element>;
31
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { JSX } from 'react';
2
+ import { OpenAPIFile } from '../types/openApi';
3
+ interface ILayoutProps {
4
+ openApiJson?: OpenAPIFile;
5
+ handleSave?: (values: unknown) => unknown;
6
+ setIsFormDirty?: any;
7
+ openApiErrors?: any;
8
+ }
9
+ declare const Layout: ({ openApiJson, handleSave, setIsFormDirty, openApiErrors, }: ILayoutProps) => JSX.Element;
10
+ export default Layout;
@@ -0,0 +1,7 @@
1
+ export declare enum SectionEnum {
2
+ OVERVIEW = "overview",
3
+ RESOURCE = "resource",
4
+ API_SECTION = "apiSection",
5
+ TAG_SECTION = "tagSection",
6
+ ENDPOINTS_SECTION = "endpointsSection"
7
+ }
@@ -1,2 +1,27 @@
1
- export { default as Layout } from './layout/layout';
2
- export { default as DocsLayout } from './layout/docsLayout';
1
+ import { OpenAPIFile } from './openApi';
2
+ export interface ApiSpecModel {
3
+ apiSpecId: string;
4
+ contextPath: string;
5
+ apiVersions: {
6
+ addVersionToContextPath: boolean;
7
+ apiSpecId: string;
8
+ name: string;
9
+ metaData: {
10
+ version: string;
11
+ };
12
+ }[];
13
+ associatedProduct: {
14
+ availableOnDevPortal: boolean;
15
+ name: string;
16
+ premium: boolean;
17
+ productId: number;
18
+ };
19
+ metaData: {
20
+ version: string;
21
+ apiVersionOf: string;
22
+ openApiJson: OpenAPIFile;
23
+ tags: string[];
24
+ createdDateTime: string;
25
+ lastUpdatedDateTime: string;
26
+ };
27
+ }
@@ -0,0 +1,29 @@
1
+ import { HTTPMethod } from './openApi';
2
+ export type TransformedMethod = {
3
+ type: HTTPMethod;
4
+ tags: string[];
5
+ summary?: string;
6
+ parameters: any;
7
+ requestBody: {
8
+ content: {
9
+ contentType: string;
10
+ schema: {
11
+ properties: string;
12
+ type: string;
13
+ };
14
+ };
15
+ };
16
+ responses: {
17
+ code: string;
18
+ content: {
19
+ contentType?: string;
20
+ schema?: unknown;
21
+ };
22
+ headers: any;
23
+ }[];
24
+ };
25
+ export type TransformedPath = {
26
+ path: string;
27
+ methods: TransformedMethod[];
28
+ };
29
+ export type TransformedPathsArray = TransformedPath[];
@@ -0,0 +1,98 @@
1
+ export interface OpenAPIFile {
2
+ openapi: string;
3
+ info: {
4
+ title: string;
5
+ description: string;
6
+ version: string;
7
+ };
8
+ servers?: {
9
+ url: string;
10
+ description?: string;
11
+ }[];
12
+ paths: {
13
+ [path: string]: Partial<Record<HTTPMethod, {
14
+ tags: string[];
15
+ responses: Responses;
16
+ summary?: string;
17
+ description?: string;
18
+ parameters?: Parameter[];
19
+ requestBody?: RequestBody;
20
+ }>>;
21
+ };
22
+ components?: {
23
+ schemas?: {
24
+ [schemaName: string]: Schema;
25
+ };
26
+ securitySchemes?: {
27
+ [schemeName: string]: SecurityScheme;
28
+ };
29
+ };
30
+ security?: {
31
+ [schemeName: string]: string[];
32
+ }[];
33
+ tags?: {
34
+ name: string;
35
+ description?: string;
36
+ externalDocs?: {
37
+ url: string;
38
+ description: string;
39
+ }[];
40
+ }[];
41
+ }
42
+ export interface Tags {
43
+ name: string;
44
+ description?: string;
45
+ externalDocs?: {
46
+ url: string;
47
+ description: string;
48
+ }[];
49
+ }
50
+ export interface Parameter {
51
+ name: string;
52
+ in: 'query' | 'header' | 'path' | 'cookie';
53
+ description?: string;
54
+ required: boolean;
55
+ schema: Schema;
56
+ }
57
+ export interface RequestBody {
58
+ description?: string;
59
+ required: boolean;
60
+ content: {
61
+ [contentType: string]: {
62
+ schema: Schema;
63
+ };
64
+ };
65
+ }
66
+ export interface Responses {
67
+ [statusCode: string]: {
68
+ description: string;
69
+ headers?: any;
70
+ content?: {
71
+ [contentType: string]: {
72
+ schema: Schema;
73
+ };
74
+ };
75
+ };
76
+ }
77
+ interface Schema {
78
+ type?: string;
79
+ format?: string;
80
+ properties?: {
81
+ [propertyName: string]: Schema;
82
+ };
83
+ items?: Schema;
84
+ enum?: string[];
85
+ required?: string[];
86
+ }
87
+ export interface SecurityScheme {
88
+ type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
89
+ description?: string;
90
+ name?: string;
91
+ in?: 'query' | 'header' | 'cookie';
92
+ scheme?: string;
93
+ bearerFormat?: string;
94
+ flows?: any;
95
+ openIdConnectUrl?: string;
96
+ }
97
+ export type HTTPMethod = 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace';
98
+ export {};
@@ -0,0 +1,50 @@
1
+ import { TransformedPathsArray } from "./layout.type";
2
+ export interface TransformedOpenApi {
3
+ openapi: string;
4
+ info: {
5
+ title: string;
6
+ description?: string;
7
+ version: string;
8
+ };
9
+ servers?: {
10
+ url: string;
11
+ description?: string;
12
+ }[];
13
+ paths: TransformedPathsArray;
14
+ components?: {
15
+ schemas?: {
16
+ [schemaName: string]: Schema;
17
+ };
18
+ securitySchemes?: {
19
+ [schemeName: string]: SecurityScheme;
20
+ };
21
+ };
22
+ security?: {
23
+ [schemeName: string]: string[];
24
+ }[];
25
+ tags?: {
26
+ name: string;
27
+ description?: string;
28
+ }[];
29
+ }
30
+ interface Schema {
31
+ type?: string;
32
+ format?: string;
33
+ properties?: {
34
+ [propertyName: string]: Schema;
35
+ };
36
+ items?: Schema;
37
+ enum?: string[];
38
+ required?: string[];
39
+ }
40
+ interface SecurityScheme {
41
+ type: "apiKey" | "http" | "oauth2" | "openIdConnect";
42
+ description?: string;
43
+ name?: string;
44
+ in?: "query" | "header" | "cookie";
45
+ scheme?: string;
46
+ bearerFormat?: string;
47
+ flows?: any;
48
+ openIdConnectUrl?: string;
49
+ }
50
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const copyToClipboard: (text: string) => Promise<any>;
2
+ export declare const capitalizeFirstLetter: (text: string) => string;
@@ -0,0 +1,49 @@
1
+ import * as yup from 'yup';
2
+ export declare const schemaValidation: yup.ObjectSchema<{
3
+ openapi: string;
4
+ info: {
5
+ title?: string;
6
+ description?: string;
7
+ version?: string;
8
+ };
9
+ servers: {
10
+ description?: string;
11
+ url?: string;
12
+ }[];
13
+ paths: {
14
+ path?: string;
15
+ methods?: {
16
+ summary?: string;
17
+ type?: string;
18
+ description?: string;
19
+ tags?: string[];
20
+ requestBody?: {};
21
+ }[];
22
+ }[];
23
+ components: {
24
+ securitySchemes?: {};
25
+ schemas?: {};
26
+ };
27
+ security: {
28
+ schemeName?: string[];
29
+ }[];
30
+ tags: {
31
+ name?: string;
32
+ description?: string;
33
+ }[];
34
+ }, yup.AnyObject, {
35
+ openapi: undefined;
36
+ info: {
37
+ title: undefined;
38
+ description: undefined;
39
+ version: undefined;
40
+ };
41
+ servers: undefined;
42
+ paths: "";
43
+ components: {
44
+ schemas: undefined;
45
+ securitySchemes: {};
46
+ };
47
+ security: undefined;
48
+ tags: undefined;
49
+ }, "">;
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@digi-frontend/dgate-api-documentation",
3
- "version": "1.4.5",
4
- "main": "dist/src/index.js",
5
- "module": "dist/src/index.js",
6
- "types": "dist/types/index.d.ts",
3
+ "version": "1.4.7",
4
+ "main": "dist/cjs/index.js",
5
+ "module": "dist/esm/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "style": "dist/style.css",
7
8
  "scripts": {
8
9
  "test": "echo \"Error: no test specified\" && exit 1",
9
10
  "build": "tsc --noEmit --skipLibCheck || true && rollup -c || true"
@@ -30,10 +31,10 @@
30
31
  "yup": "^1.6.1"
31
32
  },
32
33
  "devDependencies": {
33
- "@rollup/plugin-commonjs": "^28.0.2",
34
+ "@rollup/plugin-commonjs": "^28.0.6",
34
35
  "@rollup/plugin-json": "^6.1.0",
35
- "@rollup/plugin-node-resolve": "^16.0.0",
36
- "@rollup/plugin-typescript": "^12.1.2",
36
+ "@rollup/plugin-node-resolve": "^16.0.1",
37
+ "@rollup/plugin-typescript": "^12.1.4",
37
38
  "@rollup/plugin-url": "^8.0.2",
38
39
  "@types/react": "^19.0.7",
39
40
  "@types/react-dom": "^19.0.3",
@@ -41,7 +42,7 @@
41
42
  "rollup-plugin-postcss": "^4.0.2",
42
43
  "rollup-plugin-sass": "^1.15.2",
43
44
  "rollup-plugin-terser": "^7.0.2",
44
- "sass": "^1.83.4",
45
+ "sass": "^1.90.0",
45
46
  "typescript": "^5.7.3",
46
47
  "typescript-plugin-css-modules": "^5.1.0"
47
48
  }
package/rollup.config.js CHANGED
@@ -9,29 +9,19 @@ import json from '@rollup/plugin-json'
9
9
 
10
10
  export default {
11
11
  input: 'src/index.ts',
12
- output: [
13
- {
14
- dir: 'dist',
15
- format: 'esm',
16
- preserveModules: true,
17
- sourcemap: true,
18
- },
19
- ],
12
+ output: [{ dir: 'dist', format: 'esm', sourcemap: true }],
20
13
  plugins: [
21
14
  resolve(),
22
15
  commonjs(),
23
- typescript({ tsconfig: './tsconfig.json' }),
16
+ typescript({ tsconfig: './tsconfig.json', declaration: true, declarationMap: false }),
24
17
  postcss({
25
18
  modules: false,
26
19
  extract: 'style.css',
27
- minimize: true,
28
20
  use: ['sass'],
21
+ minimize: true,
29
22
  }),
30
23
  terser(),
31
24
  url({ limit: 0 }),
32
- sass({
33
- output: 'dist/styles.css',
34
- }),
35
25
  json(),
36
26
  ],
37
27
  external: ['react', 'react-dom'],
package/tsconfig.json CHANGED
@@ -2,14 +2,15 @@
2
2
  "compilerOptions": {
3
3
  "outDir": "dist",
4
4
  "module": "ESNext",
5
- "target": "ES6",
5
+ "target": "es6",
6
6
  "lib": ["DOM", "DOM.Iterable", "ESNext"],
7
7
  "declaration": true,
8
- "declarationDir": "dist/types",
9
- "jsx": "react-jsx",
8
+ "jsx": "react",
10
9
  "strict": false,
11
10
  "moduleResolution": "node",
12
11
  "esModuleInterop": true,
12
+ "emitDeclarationOnly": true,
13
+
13
14
  "skipLibCheck": true,
14
15
  "forceConsistentCasingInFileNames": true,
15
16
  "importHelpers": true,