@necessarylion/adonis-autoswagger 0.0.1
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/LICENSE +21 -0
- package/README.md +586 -0
- package/dist/adonishelpers.d.ts +6 -0
- package/dist/adonishelpers.js +70 -0
- package/dist/autoswagger.d.ts +30 -0
- package/dist/autoswagger.js +777 -0
- package/dist/example.d.ts +73 -0
- package/dist/example.js +349 -0
- package/dist/helpers.d.ts +7 -0
- package/dist/helpers.js +54 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/parsers.d.ts +73 -0
- package/dist/parsers.js +1107 -0
- package/dist/scalarCustomCss.d.ts +1 -0
- package/dist/scalarCustomCss.js +133 -0
- package/dist/types.d.ts +60 -0
- package/dist/types.js +14 -0
- package/package.json +48 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const scalarCustomCss = "\n/* basic theme */\n.light-mode {\n --theme-background-1: #fff;\n --theme-background-2: #fafaf9;\n --theme-background-3: rgb(245 245 245);\n\n --theme-color-1: #21201c;\n --theme-color-2: #63635d;\n --theme-color-3: #8e8e8e;\n\n --theme-color-accent: #5a45ff;\n --theme-background-accent: #5a45ff1f;\n\n --theme-border-color: color(display-p3 0.913 0.912 0.903);\n --theme-code-language-color-supersede: var(--theme-color-1);\n --theme-code-languages-background-supersede: var(--theme-background-3);\n}\n.dark-mode {\n --theme-background-1: #0f0f0f;\n --theme-background-2: #222222;\n --theme-background-3: #272727;\n\n --theme-color-1: #e2e4e8;\n --theme-color-2: rgba(255, 255, 255, 0.62);\n --theme-color-3: #6a737d;\n\n --theme-color-accent: #e2ddfe;\n --theme-background-accent: #3c2d6a;\n\n --theme-border-color: rgba(255, 255, 255, 0.1);\n --theme-code-language-color-supersede: var(--theme-color-1);\n --theme-code-languages-background-supersede: var(--theme-background-3);\n}\n\n/* Document Sidebar */\n.light-mode .t-doc__sidebar,\n.dark-mode .t-doc__sidebar {\n --sidebar-background-1: var(--theme-background-1);\n --sidebar-color-1: var(--theme-color-1);\n --sidebar-color-2: var(--theme-color-2);\n --sidebar-border-color: var(--theme-border-color);\n\n --sidebar-item-hover-background: var(--theme-background-2);\n --sidebar-item-hover-color: currentColor;\n\n --sidebar-item-active-background: var(--theme-background-accent);\n --sidebar-color-active: var(--theme-color-accent);\n\n --sidebar-search-background: var(--theme-background-2);\n --sidebar-search-color: var(--theme-color-3);\n --sidebar-search-border-color: var(--theme-border-color);\n}\n\n/* advanced */\n.light-mode {\n --theme-color-green: #0e766e;\n --theme-color-red: #e53935;\n --theme-color-yellow: #e2931d;\n --theme-color-blue: #0f766e;\n --theme-color-orange: #f76d47;\n --theme-color-purple: #4338ca;\n}\n.dark-mode {\n --theme-color-green: #0ad8b6;\n --theme-color-red: #e5484d;\n --theme-color-yellow: #eac063;\n --theme-color-blue: #6abaff;\n --theme-color-orange: #ff9b52;\n --theme-color-purple: #6550b9;\n}\n/* custom-theme */\n.show-api-client-button:before {\n background: white !important;\n}\n.show-api-client-button span,\n.show-api-client-button svg {\n color: var(--theme-background-1) !important;\n}\n.section:not(:last-of-type),\n.section-container {\n border-top: none !important;\n border-bottom: none !important;\n}\n.section-container:after,\n.tag-section-container section.section:after {\n content: \"\";\n width: 100%;\n height: 1px;\n position: absolute;\n top: 0;\n left: 0;\n background: repeating-linear-gradient(\n 90deg,\n var(--theme-border-color) 0 4px,\n transparent 0 8px\n );\n}\n.section-container:nth-of-type(2):after {\n display: none;\n}\n.tag-section-container .section:first-of-type:after {\n display: none;\n}\n.sidebar {\n border-right: none !important;\n}\n.t-doc__sidebar {\n position: relative;\n}\n.t-doc__sidebar:after {\n content: \"\";\n width: 1px;\n height: 100%;\n position: absolute;\n right: 0;\n top: 0;\n background: repeating-linear-gradient(\n 0deg,\n var(--theme-border-color) 0 4px,\n transparent 0 8px\n );\n display: block;\n}\n.download-cta .download-button,\n.scalar-api-reference .section .markdown a {\n --theme-color-accent: var(--theme-color-1) !important;\n text-decoration: underline !important;\n cursor: pointer;\n}";
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scalarCustomCss = void 0;
|
|
4
|
+
exports.scalarCustomCss = `
|
|
5
|
+
/* basic theme */
|
|
6
|
+
.light-mode {
|
|
7
|
+
--theme-background-1: #fff;
|
|
8
|
+
--theme-background-2: #fafaf9;
|
|
9
|
+
--theme-background-3: rgb(245 245 245);
|
|
10
|
+
|
|
11
|
+
--theme-color-1: #21201c;
|
|
12
|
+
--theme-color-2: #63635d;
|
|
13
|
+
--theme-color-3: #8e8e8e;
|
|
14
|
+
|
|
15
|
+
--theme-color-accent: #5a45ff;
|
|
16
|
+
--theme-background-accent: #5a45ff1f;
|
|
17
|
+
|
|
18
|
+
--theme-border-color: color(display-p3 0.913 0.912 0.903);
|
|
19
|
+
--theme-code-language-color-supersede: var(--theme-color-1);
|
|
20
|
+
--theme-code-languages-background-supersede: var(--theme-background-3);
|
|
21
|
+
}
|
|
22
|
+
.dark-mode {
|
|
23
|
+
--theme-background-1: #0f0f0f;
|
|
24
|
+
--theme-background-2: #222222;
|
|
25
|
+
--theme-background-3: #272727;
|
|
26
|
+
|
|
27
|
+
--theme-color-1: #e2e4e8;
|
|
28
|
+
--theme-color-2: rgba(255, 255, 255, 0.62);
|
|
29
|
+
--theme-color-3: #6a737d;
|
|
30
|
+
|
|
31
|
+
--theme-color-accent: #e2ddfe;
|
|
32
|
+
--theme-background-accent: #3c2d6a;
|
|
33
|
+
|
|
34
|
+
--theme-border-color: rgba(255, 255, 255, 0.1);
|
|
35
|
+
--theme-code-language-color-supersede: var(--theme-color-1);
|
|
36
|
+
--theme-code-languages-background-supersede: var(--theme-background-3);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Document Sidebar */
|
|
40
|
+
.light-mode .t-doc__sidebar,
|
|
41
|
+
.dark-mode .t-doc__sidebar {
|
|
42
|
+
--sidebar-background-1: var(--theme-background-1);
|
|
43
|
+
--sidebar-color-1: var(--theme-color-1);
|
|
44
|
+
--sidebar-color-2: var(--theme-color-2);
|
|
45
|
+
--sidebar-border-color: var(--theme-border-color);
|
|
46
|
+
|
|
47
|
+
--sidebar-item-hover-background: var(--theme-background-2);
|
|
48
|
+
--sidebar-item-hover-color: currentColor;
|
|
49
|
+
|
|
50
|
+
--sidebar-item-active-background: var(--theme-background-accent);
|
|
51
|
+
--sidebar-color-active: var(--theme-color-accent);
|
|
52
|
+
|
|
53
|
+
--sidebar-search-background: var(--theme-background-2);
|
|
54
|
+
--sidebar-search-color: var(--theme-color-3);
|
|
55
|
+
--sidebar-search-border-color: var(--theme-border-color);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* advanced */
|
|
59
|
+
.light-mode {
|
|
60
|
+
--theme-color-green: #0e766e;
|
|
61
|
+
--theme-color-red: #e53935;
|
|
62
|
+
--theme-color-yellow: #e2931d;
|
|
63
|
+
--theme-color-blue: #0f766e;
|
|
64
|
+
--theme-color-orange: #f76d47;
|
|
65
|
+
--theme-color-purple: #4338ca;
|
|
66
|
+
}
|
|
67
|
+
.dark-mode {
|
|
68
|
+
--theme-color-green: #0ad8b6;
|
|
69
|
+
--theme-color-red: #e5484d;
|
|
70
|
+
--theme-color-yellow: #eac063;
|
|
71
|
+
--theme-color-blue: #6abaff;
|
|
72
|
+
--theme-color-orange: #ff9b52;
|
|
73
|
+
--theme-color-purple: #6550b9;
|
|
74
|
+
}
|
|
75
|
+
/* custom-theme */
|
|
76
|
+
.show-api-client-button:before {
|
|
77
|
+
background: white !important;
|
|
78
|
+
}
|
|
79
|
+
.show-api-client-button span,
|
|
80
|
+
.show-api-client-button svg {
|
|
81
|
+
color: var(--theme-background-1) !important;
|
|
82
|
+
}
|
|
83
|
+
.section:not(:last-of-type),
|
|
84
|
+
.section-container {
|
|
85
|
+
border-top: none !important;
|
|
86
|
+
border-bottom: none !important;
|
|
87
|
+
}
|
|
88
|
+
.section-container:after,
|
|
89
|
+
.tag-section-container section.section:after {
|
|
90
|
+
content: "";
|
|
91
|
+
width: 100%;
|
|
92
|
+
height: 1px;
|
|
93
|
+
position: absolute;
|
|
94
|
+
top: 0;
|
|
95
|
+
left: 0;
|
|
96
|
+
background: repeating-linear-gradient(
|
|
97
|
+
90deg,
|
|
98
|
+
var(--theme-border-color) 0 4px,
|
|
99
|
+
transparent 0 8px
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
.section-container:nth-of-type(2):after {
|
|
103
|
+
display: none;
|
|
104
|
+
}
|
|
105
|
+
.tag-section-container .section:first-of-type:after {
|
|
106
|
+
display: none;
|
|
107
|
+
}
|
|
108
|
+
.sidebar {
|
|
109
|
+
border-right: none !important;
|
|
110
|
+
}
|
|
111
|
+
.t-doc__sidebar {
|
|
112
|
+
position: relative;
|
|
113
|
+
}
|
|
114
|
+
.t-doc__sidebar:after {
|
|
115
|
+
content: "";
|
|
116
|
+
width: 1px;
|
|
117
|
+
height: 100%;
|
|
118
|
+
position: absolute;
|
|
119
|
+
right: 0;
|
|
120
|
+
top: 0;
|
|
121
|
+
background: repeating-linear-gradient(
|
|
122
|
+
0deg,
|
|
123
|
+
var(--theme-border-color) 0 4px,
|
|
124
|
+
transparent 0 8px
|
|
125
|
+
);
|
|
126
|
+
display: block;
|
|
127
|
+
}
|
|
128
|
+
.download-cta .download-button,
|
|
129
|
+
.scalar-api-reference .section .markdown a {
|
|
130
|
+
--theme-color-accent: var(--theme-color-1) !important;
|
|
131
|
+
text-decoration: underline !important;
|
|
132
|
+
cursor: pointer;
|
|
133
|
+
}`;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Autoswagger interfaces
|
|
3
|
+
*/
|
|
4
|
+
export interface options {
|
|
5
|
+
title?: string;
|
|
6
|
+
ignore: string[];
|
|
7
|
+
version?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
path: string;
|
|
10
|
+
tagIndex: number;
|
|
11
|
+
snakeCase: boolean;
|
|
12
|
+
common: common;
|
|
13
|
+
fileNameInSummary?: boolean;
|
|
14
|
+
preferredPutPatch?: string;
|
|
15
|
+
persistAuthorization?: boolean;
|
|
16
|
+
appPath?: string;
|
|
17
|
+
debug?: boolean;
|
|
18
|
+
info?: any;
|
|
19
|
+
securitySchemes?: any;
|
|
20
|
+
productionEnv?: string;
|
|
21
|
+
authMiddlewares?: string[];
|
|
22
|
+
defaultSecurityScheme?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface common {
|
|
25
|
+
headers: any;
|
|
26
|
+
parameters: any;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Adonis routes
|
|
30
|
+
*/
|
|
31
|
+
export interface AdonisRouteMeta {
|
|
32
|
+
resolvedHandler: {
|
|
33
|
+
type: string;
|
|
34
|
+
namespace?: string;
|
|
35
|
+
method?: string;
|
|
36
|
+
};
|
|
37
|
+
resolvedMiddleware: Array<{
|
|
38
|
+
type: string;
|
|
39
|
+
args?: any[];
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
export interface v6Handler {
|
|
43
|
+
method?: string;
|
|
44
|
+
moduleNameOrPath?: string;
|
|
45
|
+
reference: string | any[];
|
|
46
|
+
name: string;
|
|
47
|
+
}
|
|
48
|
+
export interface AdonisRoute {
|
|
49
|
+
methods: string[];
|
|
50
|
+
pattern: string;
|
|
51
|
+
meta: AdonisRouteMeta;
|
|
52
|
+
middleware: string[] | any;
|
|
53
|
+
name?: string;
|
|
54
|
+
params: string[];
|
|
55
|
+
handler?: string | v6Handler;
|
|
56
|
+
}
|
|
57
|
+
export interface AdonisRoutes {
|
|
58
|
+
root: AdonisRoute[];
|
|
59
|
+
}
|
|
60
|
+
export declare const standardTypes: string[];
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.standardTypes = void 0;
|
|
4
|
+
exports.standardTypes = [
|
|
5
|
+
"string",
|
|
6
|
+
"number",
|
|
7
|
+
"integer",
|
|
8
|
+
"datetime",
|
|
9
|
+
"date",
|
|
10
|
+
"boolean",
|
|
11
|
+
"any",
|
|
12
|
+
]
|
|
13
|
+
.map((type) => [type, type + "[]"])
|
|
14
|
+
.flat();
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@necessarylion/adonis-autoswagger",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Auto-Generate swagger docs for AdonisJS",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"dev": "watchexec -e ts -- tsc",
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"prepare": "npm run build"
|
|
12
|
+
},
|
|
13
|
+
"author": "Adis Durakovic <adis.durakovic@gmail.com>",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/necessarylion/adonis-autoswagger"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@vinejs/vine": "^2.1.0",
|
|
21
|
+
"abstract-syntax-tree": "^2.20.5",
|
|
22
|
+
"change-case": "^4.1.2",
|
|
23
|
+
"espree": "^9.3.1",
|
|
24
|
+
"extract-comments": "^1.1.0",
|
|
25
|
+
"http-status-code": "^2.1.0",
|
|
26
|
+
"json-to-pretty-yaml": "^1.2.2",
|
|
27
|
+
"lodash": "^4.17.21",
|
|
28
|
+
"parse-imports": "^1.1.2",
|
|
29
|
+
"typescript": "^5.8.2",
|
|
30
|
+
"typescript-parser": "^2.6.1"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/lodash": "^4.14.202",
|
|
34
|
+
"@types/node": "^20.10.4"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"/dist"
|
|
38
|
+
],
|
|
39
|
+
"prettier": {
|
|
40
|
+
"trailingComma": "es5",
|
|
41
|
+
"semi": true,
|
|
42
|
+
"useTabs": false,
|
|
43
|
+
"quoteProps": "consistent",
|
|
44
|
+
"bracketSpacing": true,
|
|
45
|
+
"arrowParens": "always"
|
|
46
|
+
},
|
|
47
|
+
"packageManager": "pnpm@8.11.0"
|
|
48
|
+
}
|