shokupan 0.9.0 → 0.10.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/dist/analyzer-BqIe1p0R.js +35 -0
- package/dist/analyzer-BqIe1p0R.js.map +1 -0
- package/dist/analyzer-CKLGLFtx.cjs +35 -0
- package/dist/analyzer-CKLGLFtx.cjs.map +1 -0
- package/dist/{analyzer-Ce_7JxZh.js → analyzer.impl-CV6W1Eq7.js} +238 -21
- package/dist/analyzer.impl-CV6W1Eq7.js.map +1 -0
- package/dist/{analyzer-Bei1sVWp.cjs → analyzer.impl-D9Yi1Hax.cjs} +237 -20
- package/dist/analyzer.impl-D9Yi1Hax.cjs.map +1 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/context.d.ts +19 -7
- package/dist/http-server-BEMPIs33.cjs.map +1 -1
- package/dist/http-server-CCeagTyU.js.map +1 -1
- package/dist/index.cjs +1500 -275
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1482 -256
- package/dist/index.js.map +1 -1
- package/dist/plugins/application/api-explorer/plugin.d.ts +9 -0
- package/dist/plugins/application/api-explorer/static/explorer-client.mjs +880 -0
- package/dist/plugins/application/api-explorer/static/style.css +767 -0
- package/dist/plugins/application/api-explorer/static/theme.css +128 -0
- package/dist/plugins/application/asyncapi/generator.d.ts +3 -0
- package/dist/plugins/application/asyncapi/plugin.d.ts +15 -0
- package/dist/plugins/application/asyncapi/static/asyncapi-client.mjs +748 -0
- package/dist/plugins/application/asyncapi/static/style.css +565 -0
- package/dist/plugins/application/asyncapi/static/theme.css +128 -0
- package/dist/plugins/application/auth.d.ts +3 -1
- package/dist/plugins/application/dashboard/metrics-collector.d.ts +3 -1
- package/dist/plugins/application/dashboard/plugin.d.ts +13 -3
- package/dist/plugins/application/dashboard/static/registry.css +0 -53
- package/dist/plugins/application/dashboard/static/styles.css +29 -20
- package/dist/plugins/application/dashboard/static/tabulator.css +83 -31
- package/dist/plugins/application/dashboard/static/theme.css +128 -0
- package/dist/plugins/application/graphql-apollo.d.ts +33 -0
- package/dist/plugins/application/graphql-yoga.d.ts +25 -0
- package/dist/plugins/application/openapi/analyzer.d.ts +12 -119
- package/dist/plugins/application/openapi/analyzer.impl.d.ts +167 -0
- package/dist/plugins/application/scalar.d.ts +9 -2
- package/dist/router.d.ts +80 -51
- package/dist/shokupan.d.ts +14 -8
- package/dist/util/datastore.d.ts +71 -7
- package/dist/util/decorators.d.ts +2 -2
- package/dist/util/types.d.ts +96 -3
- package/package.json +32 -12
- package/dist/analyzer-Bei1sVWp.cjs.map +0 -1
- package/dist/analyzer-Ce_7JxZh.js.map +0 -1
- package/dist/plugins/application/dashboard/static/scrollbar.css +0 -24
- package/dist/plugins/application/dashboard/template.eta +0 -246
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HeadersInit } from 'bun';
|
|
2
|
+
import { $appRoot } from '../../../util/symbol';
|
|
2
3
|
import { ShokupanHooks, ShokupanPlugin } from '../../../util/types';
|
|
3
4
|
export interface RequestLog {
|
|
4
5
|
method: string;
|
|
@@ -15,21 +16,30 @@ export interface DashboardConfig {
|
|
|
15
16
|
* Retention time in milliseconds
|
|
16
17
|
*/
|
|
17
18
|
retentionMs?: number;
|
|
19
|
+
integrations?: {
|
|
20
|
+
scalar?: boolean | {
|
|
21
|
+
path?: string;
|
|
22
|
+
};
|
|
23
|
+
asyncapi?: boolean | {
|
|
24
|
+
path?: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
18
27
|
}
|
|
19
28
|
export declare class Dashboard implements ShokupanPlugin {
|
|
20
29
|
private readonly dashboardConfig;
|
|
21
|
-
private
|
|
22
|
-
private static getBasePath;
|
|
30
|
+
private [$appRoot];
|
|
23
31
|
private router;
|
|
24
32
|
private metrics;
|
|
25
|
-
private eta;
|
|
26
33
|
private startTime;
|
|
27
34
|
private instrumented;
|
|
28
35
|
private metricsCollector;
|
|
36
|
+
get db(): import('../../../util/datastore').SurrealDatastore;
|
|
29
37
|
constructor(dashboardConfig?: DashboardConfig);
|
|
30
38
|
onInit(app: any, options?: {
|
|
31
39
|
path?: string;
|
|
32
40
|
}): void;
|
|
41
|
+
private detectIntegrations;
|
|
42
|
+
private static getBasePath;
|
|
33
43
|
private setupRoutes;
|
|
34
44
|
private instrumentApp;
|
|
35
45
|
private assignIdsToRegistry;
|
|
@@ -43,59 +43,6 @@
|
|
|
43
43
|
font-weight: bold;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.badge-GET {
|
|
47
|
-
background: #0f172a;
|
|
48
|
-
color: #3b82f6;
|
|
49
|
-
border: 1px solid #3b82f6;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.badge-POST {
|
|
53
|
-
background: #0f172a;
|
|
54
|
-
color: #22c55e;
|
|
55
|
-
border: 1px solid #22c55e;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.badge-PUT {
|
|
59
|
-
background: #0f172a;
|
|
60
|
-
color: #eab308;
|
|
61
|
-
border: 1px solid #eab308;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.badge-PATCH {
|
|
65
|
-
background: #0f172a;
|
|
66
|
-
color: #08d3ea;
|
|
67
|
-
border: 1px solid #08eae6;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.badge-HEAD {
|
|
71
|
-
background: #0f172a;
|
|
72
|
-
color: #e3ea08;
|
|
73
|
-
border: 1px solid #e3ea08;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.badge-OPTIONS {
|
|
77
|
-
background: #0f172a;
|
|
78
|
-
color: #838383;
|
|
79
|
-
border: 1px solid #838383;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.badge-DELETE {
|
|
83
|
-
background: #0f172a;
|
|
84
|
-
color: #ef4444;
|
|
85
|
-
border: 1px solid #ef4444;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.badge-ROUTER {
|
|
89
|
-
background: #334155;
|
|
90
|
-
color: #f8fafc;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.badge-CONTROLLER {
|
|
94
|
-
background: #475569;
|
|
95
|
-
color: #f8fafc;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
46
|
/* Tooltip Styling */
|
|
100
47
|
.tooltip {
|
|
101
48
|
position: relative;
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
:root
|
|
2
|
-
--bg-primary: #0f172a;
|
|
3
|
-
--bg-secondary: #1e293b;
|
|
4
|
-
--text-primary: #f8fafc;
|
|
5
|
-
--text-secondary: #94a3b8;
|
|
6
|
-
--text-emphasis: #60a5fa;
|
|
7
|
-
--accent: #3b82f6;
|
|
8
|
-
--success: #22c55e;
|
|
9
|
-
--error: #ef4444;
|
|
10
|
-
--card-border: #334155;
|
|
11
|
-
}
|
|
1
|
+
/* :root variables are now provided by theme.css */
|
|
12
2
|
|
|
13
3
|
* {
|
|
14
4
|
box-sizing: border-box;
|
|
@@ -27,21 +17,30 @@ body {
|
|
|
27
17
|
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
28
18
|
background-color: var(--bg-primary);
|
|
29
19
|
color: var(--text-primary);
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
height: 100vh;
|
|
21
|
+
overflow: hidden;
|
|
32
22
|
}
|
|
33
23
|
|
|
34
24
|
header {
|
|
35
|
-
|
|
25
|
+
width: 100%;
|
|
26
|
+
background-color: var(--bg-header);
|
|
27
|
+
padding: 0 1rem;
|
|
36
28
|
display: flex;
|
|
37
29
|
justify-content: space-between;
|
|
38
30
|
align-items: center;
|
|
39
31
|
}
|
|
40
32
|
|
|
33
|
+
iframe {
|
|
34
|
+
flex: 1;
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: 100%;
|
|
37
|
+
border: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
41
40
|
h1 {
|
|
42
41
|
font-size: 2rem;
|
|
43
42
|
font-weight: 700;
|
|
44
|
-
background: linear-gradient(to right, var(--accent),
|
|
43
|
+
background: linear-gradient(to right, var(--accent), var(--primary));
|
|
45
44
|
-webkit-background-clip: text;
|
|
46
45
|
background-clip: text;
|
|
47
46
|
color: transparent;
|
|
@@ -55,9 +54,8 @@ select {
|
|
|
55
54
|
display: flex;
|
|
56
55
|
flex: 1;
|
|
57
56
|
flex-direction: column;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
overflow: auto
|
|
57
|
+
align-items: center;
|
|
58
|
+
overflow: hidden;
|
|
61
59
|
}
|
|
62
60
|
|
|
63
61
|
.metrics-grid {
|
|
@@ -92,7 +90,6 @@ select {
|
|
|
92
90
|
color: var(--text-secondary);
|
|
93
91
|
font-size: 0.875rem;
|
|
94
92
|
margin-bottom: 0.5rem;
|
|
95
|
-
text-transform: uppercase;
|
|
96
93
|
letter-spacing: 0.05em;
|
|
97
94
|
height: 48px;
|
|
98
95
|
line-height: 48px;
|
|
@@ -142,6 +139,10 @@ select {
|
|
|
142
139
|
transition: all 0.2s;
|
|
143
140
|
}
|
|
144
141
|
|
|
142
|
+
.tab-btn:focus-visible {
|
|
143
|
+
outline: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
145
146
|
.tab-btn:hover {
|
|
146
147
|
color: var(--text-primary);
|
|
147
148
|
}
|
|
@@ -153,12 +154,20 @@ select {
|
|
|
153
154
|
|
|
154
155
|
.tab-content {
|
|
155
156
|
display: none;
|
|
157
|
+
flex-direction: column;
|
|
158
|
+
flex: 1;
|
|
159
|
+
overflow: auto;
|
|
160
|
+
width: -webkit-fill-available;
|
|
161
|
+
/* width: 1200px; */
|
|
162
|
+
max-width: 1200px;
|
|
163
|
+
margin: 0 2rem;
|
|
156
164
|
}
|
|
157
165
|
|
|
158
166
|
.tab-content.active {
|
|
159
|
-
display:
|
|
167
|
+
display: flex;
|
|
160
168
|
}
|
|
161
169
|
|
|
170
|
+
|
|
162
171
|
/* Graph */
|
|
163
172
|
#cy {
|
|
164
173
|
width: 100%;
|
|
@@ -1,66 +1,118 @@
|
|
|
1
|
+
/* Tabulator Theme Overrides - Merged with Layout */
|
|
1
2
|
.tabulator {
|
|
2
3
|
height: 100%;
|
|
3
4
|
width: 100%;
|
|
4
|
-
background-color:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
.tabulator .tabulator-tableholder .tabulator-table {
|
|
8
|
-
color: #ccc;
|
|
9
|
-
background-color: #0f1322;
|
|
5
|
+
background-color: var(--bg-card);
|
|
6
|
+
border: 1px solid var(--card-border);
|
|
7
|
+
color: var(--text-primary);
|
|
10
8
|
}
|
|
11
9
|
|
|
10
|
+
/* Header */
|
|
12
11
|
.tabulator .tabulator-header {
|
|
13
|
-
color:
|
|
14
|
-
|
|
15
|
-
border-
|
|
16
|
-
|
|
12
|
+
background-color: var(--bg-card);
|
|
13
|
+
border-top: 0;
|
|
14
|
+
border-bottom: 2px solid var(--table-header-border-color);
|
|
15
|
+
color: var(--primary);
|
|
16
|
+
font-weight: bold;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.tabulator .tabulator-header .tabulator-col {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
background-color: var(--bg-card);
|
|
21
|
+
border-right: 1px solid var(--card-border);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.tabulator .tabulator-header .tabulator-col:hover {
|
|
25
|
+
background-color: var(--bg-primary);
|
|
22
26
|
}
|
|
23
27
|
|
|
28
|
+
.tabulator .tabulator-header .tabulator-col-content {
|
|
29
|
+
padding: 12px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Sortable Columns */
|
|
24
33
|
.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=none] .tabulator-col-content .tabulator-col-sorter {
|
|
25
|
-
color:
|
|
34
|
+
color: var(--text-secondary);
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
.tabulator .tabulator-header .tabulator-col.tabulator-sortable.tabulator-col-sorter-element:hover {
|
|
29
|
-
background-color:
|
|
38
|
+
background-color: var(--bg-primary);
|
|
30
39
|
}
|
|
31
40
|
|
|
41
|
+
/* Filter Inputs */
|
|
42
|
+
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input {
|
|
43
|
+
background-color: var(--bg-primary);
|
|
44
|
+
color: var(--text-primary);
|
|
45
|
+
border: 1px solid var(--card-border);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input:focus {
|
|
49
|
+
background-color: var(--bg-secondary);
|
|
50
|
+
color: var(--text-primary);
|
|
51
|
+
border-color: var(--primary);
|
|
52
|
+
outline: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Rows */
|
|
32
56
|
.tabulator .tabulator-row {
|
|
33
|
-
|
|
57
|
+
background-color: var(--bg-card);
|
|
58
|
+
border-bottom: 1px solid var(--card-border);
|
|
59
|
+
color: var(--text-primary);
|
|
34
60
|
transition: background-color 100ms ease;
|
|
35
61
|
}
|
|
36
62
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
63
|
+
/* Higher specificity to override Tabulator default themes */
|
|
64
|
+
.tabulator .tabulator-row.tabulator-row-even,
|
|
65
|
+
.tabulator-row.tabulator-row-even {
|
|
66
|
+
background-color: var(--bg-primary) !important;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.tabulator .tabulator-row.tabulator-row-odd,
|
|
70
|
+
.tabulator-row.tabulator-row-odd {
|
|
71
|
+
background-color: var(--bg-card) !important;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.tabulator .tabulator-row.tabulator-selected {
|
|
75
|
+
background-color: var(--bg-primary) !important;
|
|
76
|
+
color: var(--text-primary);
|
|
40
77
|
}
|
|
41
78
|
|
|
42
79
|
.tabulator .tabulator-row:hover {
|
|
43
|
-
background-color:
|
|
80
|
+
background-color: var(--bg-primary) !important;
|
|
81
|
+
color: var(--text-primary);
|
|
82
|
+
cursor: pointer;
|
|
44
83
|
}
|
|
45
84
|
|
|
46
|
-
|
|
47
|
-
|
|
85
|
+
/* Cells */
|
|
86
|
+
.tabulator .tabulator-row .tabulator-cell {
|
|
87
|
+
border-right: 1px solid var(--card-border);
|
|
88
|
+
padding: 10px;
|
|
89
|
+
align-content: center;
|
|
48
90
|
}
|
|
49
91
|
|
|
50
|
-
|
|
51
|
-
|
|
92
|
+
/* Footer / Pagination */
|
|
93
|
+
.tabulator .tabulator-footer {
|
|
94
|
+
background-color: var(--bg-card);
|
|
95
|
+
border-top: 2px solid var(--table-header-border-color);
|
|
52
96
|
}
|
|
53
97
|
|
|
54
|
-
.tabulator .tabulator-
|
|
55
|
-
background-color:
|
|
98
|
+
.tabulator .tabulator-footer .tabulator-page {
|
|
99
|
+
background-color: var(--bg-primary);
|
|
100
|
+
color: var(--text-primary);
|
|
101
|
+
border: 1px solid var(--border-color);
|
|
102
|
+
border-radius: 4px;
|
|
56
103
|
}
|
|
57
104
|
|
|
58
|
-
.tabulator .tabulator-
|
|
59
|
-
background-color:
|
|
60
|
-
color:
|
|
105
|
+
.tabulator .tabulator-footer .tabulator-page:hover {
|
|
106
|
+
background-color: var(--table-header-border-color);
|
|
107
|
+
color: var(--text-primary);
|
|
61
108
|
}
|
|
62
109
|
|
|
63
|
-
.tabulator .tabulator-
|
|
64
|
-
background-color:
|
|
65
|
-
color:
|
|
110
|
+
.tabulator .tabulator-footer .tabulator-page.active {
|
|
111
|
+
background-color: var(--primary);
|
|
112
|
+
color: var(--bg-card);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Sorting Icons */
|
|
116
|
+
.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-arrow {
|
|
117
|
+
border-bottom-color: var(--text-secondary);
|
|
66
118
|
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/* Raw Palette - Dark (Now Default) */
|
|
3
|
+
--palette-dark-primary: #FFB380;
|
|
4
|
+
/* Warm Filament */
|
|
5
|
+
--palette-dark-secondary: #7B5E7B;
|
|
6
|
+
/* Yeast Purple */
|
|
7
|
+
--palette-dark-accent: #D6D3D1;
|
|
8
|
+
/* Flour Dust */
|
|
9
|
+
--palette-dark-bg: #1A1614;
|
|
10
|
+
/* Oven Depth */
|
|
11
|
+
--palette-dark-card: #2A2421;
|
|
12
|
+
|
|
13
|
+
--palette-dark-header: rgb(39, 27, 19);
|
|
14
|
+
/* Proofing Drawer */
|
|
15
|
+
|
|
16
|
+
/* Universal defaults (tokens) */
|
|
17
|
+
--shokupan-font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
|
18
|
+
|
|
19
|
+
/* Theme Variables - Enforced Dark Mode */
|
|
20
|
+
--bg-primary: var(--palette-dark-bg);
|
|
21
|
+
--bg-secondary: var(--palette-dark-card);
|
|
22
|
+
--bg-card: var(--palette-dark-card);
|
|
23
|
+
--bg-header: var(--palette-dark-header);
|
|
24
|
+
|
|
25
|
+
--text-primary: #F0F0F0;
|
|
26
|
+
--text-secondary: var(--palette-dark-accent);
|
|
27
|
+
--text-muted: rgba(214, 211, 209, 0.5);
|
|
28
|
+
|
|
29
|
+
--primary: var(--palette-dark-primary);
|
|
30
|
+
--secondary: var(--palette-dark-secondary);
|
|
31
|
+
--accent: var(--palette-dark-accent);
|
|
32
|
+
|
|
33
|
+
--border-color: rgba(214, 211, 209, 0.2);
|
|
34
|
+
--card-border: rgba(214, 211, 209, 0.2);
|
|
35
|
+
|
|
36
|
+
--table-header-border-color: rgba(214, 211, 209, 0.2);
|
|
37
|
+
|
|
38
|
+
--link-color: var(--palette-dark-primary);
|
|
39
|
+
--link-hover: #FFCBA0;
|
|
40
|
+
|
|
41
|
+
--button-bg: var(--palette-dark-primary);
|
|
42
|
+
--button-text: #1A1614;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
::-webkit-scrollbar {
|
|
46
|
+
width: 8px;
|
|
47
|
+
height: 8px;
|
|
48
|
+
background-color: var(--bg-primary);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
::-webkit-scrollbar-thumb {
|
|
52
|
+
border-radius: 10px;
|
|
53
|
+
background-color: var(--primary);
|
|
54
|
+
box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
::-webkit-scrollbar-track {
|
|
58
|
+
border-radius: 10px;
|
|
59
|
+
background-color: var(--bg-secondary);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
::-webkit-scrollbar-corner {
|
|
63
|
+
box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.badge-SEND {
|
|
67
|
+
background: rgba(59, 130, 246, 0.15);
|
|
68
|
+
color: #60a5fa;
|
|
69
|
+
border: 1px solid rgba(59, 130, 246, 0.3);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.badge-RECV {
|
|
73
|
+
background: rgba(16, 185, 129, 0.15);
|
|
74
|
+
color: #34d399;
|
|
75
|
+
border: 1px solid rgba(16, 185, 129, 0.3);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.badge-GET {
|
|
79
|
+
background: #0f172a;
|
|
80
|
+
color: #3b82f6;
|
|
81
|
+
border: 1px solid #3b82f6;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.badge-POST {
|
|
85
|
+
background: #0f172a;
|
|
86
|
+
color: #22c55e;
|
|
87
|
+
border: 1px solid #22c55e;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.badge-PUT {
|
|
91
|
+
background: #0f172a;
|
|
92
|
+
color: #eab308;
|
|
93
|
+
border: 1px solid #eab308;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.badge-PATCH {
|
|
97
|
+
background: #0f172a;
|
|
98
|
+
color: #08d3ea;
|
|
99
|
+
border: 1px solid #08eae6;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.badge-HEAD {
|
|
103
|
+
background: #0f172a;
|
|
104
|
+
color: #e3ea08;
|
|
105
|
+
border: 1px solid #e3ea08;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.badge-OPTIONS {
|
|
109
|
+
background: #0f172a;
|
|
110
|
+
color: #838383;
|
|
111
|
+
border: 1px solid #838383;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.badge-DELETE {
|
|
115
|
+
background: #0f172a;
|
|
116
|
+
color: #ef4444;
|
|
117
|
+
border: 1px solid #ef4444;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.badge-ROUTER {
|
|
121
|
+
background: #334155;
|
|
122
|
+
color: #f8fafc;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.badge-CONTROLLER {
|
|
126
|
+
background: #475569;
|
|
127
|
+
color: #f8fafc;
|
|
128
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ApolloServer } from '@apollo/server';
|
|
2
|
+
import { ShokupanRouter } from '../../router';
|
|
3
|
+
import { Shokupan } from '../../shokupan';
|
|
4
|
+
import { ShokupanPlugin, ShokupanPluginOptions } from '../../util/types';
|
|
5
|
+
export interface GraphQLPluginOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Path to mount the GraphQL endpoint to.
|
|
8
|
+
* @default '/graphql'
|
|
9
|
+
*/
|
|
10
|
+
path?: string;
|
|
11
|
+
/**
|
|
12
|
+
* GraphQL Type Definitions
|
|
13
|
+
*/
|
|
14
|
+
typeDefs: any;
|
|
15
|
+
/**
|
|
16
|
+
* GraphQL Resolvers
|
|
17
|
+
*/
|
|
18
|
+
resolvers: any;
|
|
19
|
+
/**
|
|
20
|
+
* Optional Apollo Server configuration
|
|
21
|
+
*/
|
|
22
|
+
apolloConfig?: Omit<ConstructorParameters<typeof ApolloServer>[0], 'typeDefs' | 'resolvers'>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* GraphQL Apollo Server Plugin for Shokupan.
|
|
26
|
+
* Enables serving GraphQL APIs using Apollo Server 4.
|
|
27
|
+
*/
|
|
28
|
+
export declare class GraphQLApolloPlugin extends ShokupanRouter<any> implements ShokupanPlugin {
|
|
29
|
+
private pluginOptions;
|
|
30
|
+
private apolloServer;
|
|
31
|
+
constructor(pluginOptions: GraphQLPluginOptions);
|
|
32
|
+
onInit(app: Shokupan, options?: ShokupanPluginOptions): Promise<void>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { YogaServerOptions } from 'graphql-yoga';
|
|
2
|
+
import { ShokupanRouter } from '../../router';
|
|
3
|
+
import { Shokupan } from '../../shokupan';
|
|
4
|
+
import { ShokupanPlugin, ShokupanPluginOptions } from '../../util/types';
|
|
5
|
+
export interface GraphQLYogaPluginOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Path to mount the GraphQL endpoint to.
|
|
8
|
+
* @default '/graphql'
|
|
9
|
+
*/
|
|
10
|
+
path?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Yoga Server configuration
|
|
13
|
+
*/
|
|
14
|
+
yogaConfig: YogaServerOptions<any, any>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* GraphQL Yoga Plugin for Shokupan.
|
|
18
|
+
* Enables serving GraphQL APIs using GraphQL Yoga.
|
|
19
|
+
*/
|
|
20
|
+
export declare class GraphQLYogaPlugin extends ShokupanRouter<any> implements ShokupanPlugin {
|
|
21
|
+
private pluginOptions;
|
|
22
|
+
private yoga;
|
|
23
|
+
constructor(pluginOptions: GraphQLYogaPluginOptions);
|
|
24
|
+
onInit(app: Shokupan, options?: ShokupanPluginOptions): Promise<void>;
|
|
25
|
+
}
|
|
@@ -1,133 +1,27 @@
|
|
|
1
|
+
import { ApplicationInstance } from './analyzer.impl';
|
|
2
|
+
export type { ApplicationInstance, RouteInfo } from './analyzer.impl';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
handlerName?: string;
|
|
8
|
-
handlerSource?: string;
|
|
9
|
-
requestTypes?: {
|
|
10
|
-
body?: any;
|
|
11
|
-
query?: Record<string, string>;
|
|
12
|
-
params?: Record<string, string>;
|
|
13
|
-
headers?: Record<string, string>;
|
|
14
|
-
};
|
|
15
|
-
responseType?: string;
|
|
16
|
-
responseSchema?: any;
|
|
17
|
-
summary?: string;
|
|
18
|
-
description?: string;
|
|
19
|
-
tags?: string[];
|
|
20
|
-
operationId?: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Dependency information
|
|
24
|
-
*/
|
|
25
|
-
interface DependencyInfo {
|
|
26
|
-
packageName: string;
|
|
27
|
-
version?: string;
|
|
28
|
-
importPath: string;
|
|
29
|
-
isExternal: boolean;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Application/Router instance found in code
|
|
33
|
-
*/
|
|
34
|
-
export interface ApplicationInstance {
|
|
35
|
-
name: string;
|
|
36
|
-
filePath: string;
|
|
37
|
-
className: 'Shokupan' | 'ShokupanRouter' | 'Controller';
|
|
38
|
-
routes: RouteInfo[];
|
|
39
|
-
mounted: MountInfo[];
|
|
40
|
-
}
|
|
41
|
-
interface MountInfo {
|
|
42
|
-
prefix: string;
|
|
43
|
-
target: string;
|
|
44
|
-
dependency?: DependencyInfo;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Main analyzer class
|
|
4
|
+
* OpenAPI Analyzer Wrapper.
|
|
5
|
+
*
|
|
6
|
+
* This class wraps the actual OpenAPIAnalyzer implementation to facilitate
|
|
7
|
+
* lazy loading of the 'typescript' peer dependency. The actual implementation
|
|
8
|
+
* and the 'typescript' module are only loaded when `analyze()` is called.
|
|
48
9
|
*/
|
|
49
10
|
export declare class OpenAPIAnalyzer {
|
|
50
11
|
private rootDir;
|
|
51
|
-
private files;
|
|
52
|
-
private applications;
|
|
53
|
-
private program?;
|
|
54
12
|
private entrypoint?;
|
|
13
|
+
private analyzerImpl;
|
|
55
14
|
constructor(rootDir: string, entrypoint?: string);
|
|
56
15
|
/**
|
|
57
|
-
* Main analysis entry point
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Main analysis entry point
|
|
16
|
+
* Main analysis entry point.
|
|
17
|
+
* Dynamically imports the implementation and runs the analysis.
|
|
61
18
|
*/
|
|
62
19
|
analyze(): Promise<{
|
|
63
20
|
applications: ApplicationInstance[];
|
|
64
21
|
}>;
|
|
65
22
|
/**
|
|
66
|
-
*
|
|
67
|
-
|
|
68
|
-
private scanDirectory;
|
|
69
|
-
/**
|
|
70
|
-
* Process source maps to reconstruct TypeScript
|
|
71
|
-
*/
|
|
72
|
-
private processSourceMaps;
|
|
73
|
-
/**
|
|
74
|
-
* Parse TypeScript files and create AST
|
|
75
|
-
*/
|
|
76
|
-
private parseTypeScriptFiles;
|
|
77
|
-
/**
|
|
78
|
-
* Find all Shokupan/ShokupanRouter instances
|
|
79
|
-
*/
|
|
80
|
-
private findApplications;
|
|
81
|
-
/**
|
|
82
|
-
* Visit AST node to find application instances
|
|
83
|
-
*/
|
|
84
|
-
private visitNode;
|
|
85
|
-
/**
|
|
86
|
-
* Extract route information from applications
|
|
87
|
-
*/
|
|
88
|
-
private extractRoutes;
|
|
89
|
-
/**
|
|
90
|
-
* Extract routes from a Controller class
|
|
91
|
-
*/
|
|
92
|
-
private extractRoutesFromController;
|
|
93
|
-
/**
|
|
94
|
-
* Extract routes from a specific file
|
|
95
|
-
*/
|
|
96
|
-
private extractRoutesFromFile;
|
|
97
|
-
/**
|
|
98
|
-
* Extract route information from a route call (e.g., app.get('/path', handler))
|
|
99
|
-
*/
|
|
100
|
-
private extractRouteFromCall;
|
|
101
|
-
/**
|
|
102
|
-
* Analyze a route handler to extract type information
|
|
103
|
-
*/
|
|
104
|
-
private analyzeHandler;
|
|
105
|
-
/**
|
|
106
|
-
* Convert an Expression node to an OpenAPI schema (best effort)
|
|
107
|
-
*/
|
|
108
|
-
private convertExpressionToSchema;
|
|
109
|
-
/**
|
|
110
|
-
* Check if an expression is a call to ctx.body()
|
|
111
|
-
*/
|
|
112
|
-
private isCtxBodyCall;
|
|
113
|
-
/**
|
|
114
|
-
* Convert a TypeScript TypeNode to an OpenAPI schema
|
|
115
|
-
*/
|
|
116
|
-
private convertTypeNodeToSchema;
|
|
117
|
-
/**
|
|
118
|
-
* Extract mount information from mount call
|
|
119
|
-
*/
|
|
120
|
-
private extractMountFromCall;
|
|
121
|
-
/**
|
|
122
|
-
* Check if a reference is to an external dependency
|
|
123
|
-
*/
|
|
124
|
-
private checkIfExternalDependency;
|
|
125
|
-
/**
|
|
126
|
-
* Get package version from package.json
|
|
127
|
-
*/
|
|
128
|
-
private getPackageVersion;
|
|
129
|
-
/**
|
|
130
|
-
* Generate OpenAPI specification
|
|
23
|
+
* Generate OpenAPI specification.
|
|
24
|
+
* Must be called after analyze().
|
|
131
25
|
*/
|
|
132
26
|
generateOpenAPISpec(): any;
|
|
133
27
|
}
|
|
@@ -135,4 +29,3 @@ export declare class OpenAPIAnalyzer {
|
|
|
135
29
|
* Analyze a directory and generate OpenAPI spec
|
|
136
30
|
*/
|
|
137
31
|
export declare function analyzeDirectory(directory: string): Promise<any>;
|
|
138
|
-
export {};
|