@skalfa/skalfa-api-core 1.0.2
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/.github/workflows/publish.yml +40 -0
- package/dist/auth/auth.d.ts +19 -0
- package/dist/auth/auth.js +227 -0
- package/dist/auth/auth.js.map +1 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.js +2 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth.util.d.ts +19 -0
- package/dist/auth.util.js +183 -0
- package/dist/auth.util.js.map +1 -0
- package/dist/commands/cli.d.ts +1 -0
- package/dist/commands/cli.js +78 -0
- package/dist/commands/cli.js.map +1 -0
- package/dist/commands/make/basic-controller.d.ts +2 -0
- package/dist/commands/make/basic-controller.js +40 -0
- package/dist/commands/make/basic-controller.js.map +1 -0
- package/dist/commands/make/basic-migration.d.ts +5 -0
- package/dist/commands/make/basic-migration.js +60 -0
- package/dist/commands/make/basic-migration.js.map +1 -0
- package/dist/commands/make/basic-model.d.ts +2 -0
- package/dist/commands/make/basic-model.js +25 -0
- package/dist/commands/make/basic-model.js.map +1 -0
- package/dist/commands/make/basic-seeder.d.ts +3 -0
- package/dist/commands/make/basic-seeder.js +32 -0
- package/dist/commands/make/basic-seeder.js.map +1 -0
- package/dist/commands/make/blueprint.d.ts +2 -0
- package/dist/commands/make/blueprint.js +29 -0
- package/dist/commands/make/blueprint.js.map +1 -0
- package/dist/commands/make/da-migration.d.ts +5 -0
- package/dist/commands/make/da-migration.js +60 -0
- package/dist/commands/make/da-migration.js.map +1 -0
- package/dist/commands/make/light-controller.d.ts +3 -0
- package/dist/commands/make/light-controller.js +54 -0
- package/dist/commands/make/light-controller.js.map +1 -0
- package/dist/commands/make/light-model.d.ts +3 -0
- package/dist/commands/make/light-model.js +50 -0
- package/dist/commands/make/light-model.js.map +1 -0
- package/dist/commands/make/mail.d.ts +2 -0
- package/dist/commands/make/mail.js +41 -0
- package/dist/commands/make/mail.js.map +1 -0
- package/dist/commands/make/notification.d.ts +2 -0
- package/dist/commands/make/notification.js +33 -0
- package/dist/commands/make/notification.js.map +1 -0
- package/dist/commands/make/queue.d.ts +2 -0
- package/dist/commands/make/queue.js +35 -0
- package/dist/commands/make/queue.js.map +1 -0
- package/dist/commands/runner/barrels.d.ts +3 -0
- package/dist/commands/runner/barrels.js +78 -0
- package/dist/commands/runner/barrels.js.map +1 -0
- package/dist/commands/runner/blueprint/controller-generation.d.ts +1 -0
- package/dist/commands/runner/blueprint/controller-generation.js +147 -0
- package/dist/commands/runner/blueprint/controller-generation.js.map +1 -0
- package/dist/commands/runner/blueprint/documentation-generation.d.ts +6 -0
- package/dist/commands/runner/blueprint/documentation-generation.js +337 -0
- package/dist/commands/runner/blueprint/documentation-generation.js.map +1 -0
- package/dist/commands/runner/blueprint/migration-generation.d.ts +1 -0
- package/dist/commands/runner/blueprint/migration-generation.js +120 -0
- package/dist/commands/runner/blueprint/migration-generation.js.map +1 -0
- package/dist/commands/runner/blueprint/model-generation.d.ts +1 -0
- package/dist/commands/runner/blueprint/model-generation.js +122 -0
- package/dist/commands/runner/blueprint/model-generation.js.map +1 -0
- package/dist/commands/runner/blueprint/runner.d.ts +23 -0
- package/dist/commands/runner/blueprint/runner.js +139 -0
- package/dist/commands/runner/blueprint/runner.js.map +1 -0
- package/dist/commands/runner/blueprint/seeder-generation.d.ts +1 -0
- package/dist/commands/runner/blueprint/seeder-generation.js +40 -0
- package/dist/commands/runner/blueprint/seeder-generation.js.map +1 -0
- package/dist/commands/runner/da-migration.d.ts +39 -0
- package/dist/commands/runner/da-migration.js +262 -0
- package/dist/commands/runner/da-migration.js.map +1 -0
- package/dist/commands/runner/migration.d.ts +11 -0
- package/dist/commands/runner/migration.js +188 -0
- package/dist/commands/runner/migration.js.map +1 -0
- package/dist/commands/runner/seeder.d.ts +3 -0
- package/dist/commands/runner/seeder.js +40 -0
- package/dist/commands/runner/seeder.js.map +1 -0
- package/dist/commands/stubs/index.d.ts +14 -0
- package/dist/commands/stubs/index.js +277 -0
- package/dist/commands/stubs/index.js.map +1 -0
- package/dist/context/context.d.ts +7 -0
- package/dist/context/context.js +11 -0
- package/dist/context/context.js.map +1 -0
- package/dist/context/index.d.ts +1 -0
- package/dist/context/index.js +2 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context.util.d.ts +7 -0
- package/dist/context.util.js +11 -0
- package/dist/context.util.js.map +1 -0
- package/dist/controller/controller.d.ts +118 -0
- package/dist/controller/controller.js +147 -0
- package/dist/controller/controller.js.map +1 -0
- package/dist/controller/index.d.ts +1 -0
- package/dist/controller/index.js +2 -0
- package/dist/controller/index.js.map +1 -0
- package/dist/controller.util.d.ts +118 -0
- package/dist/controller.util.js +144 -0
- package/dist/controller.util.js.map +1 -0
- package/dist/conversion/conversion.d.ts +8 -0
- package/dist/conversion/conversion.js +52 -0
- package/dist/conversion/conversion.js.map +1 -0
- package/dist/conversion/index.d.ts +1 -0
- package/dist/conversion/index.js +2 -0
- package/dist/conversion/index.js.map +1 -0
- package/dist/conversion.util.d.ts +8 -0
- package/dist/conversion.util.js +52 -0
- package/dist/conversion.util.js.map +1 -0
- package/dist/db/db.d.ts +84 -0
- package/dist/db/db.js +177 -0
- package/dist/db/db.js.map +1 -0
- package/dist/db/index.d.ts +1 -0
- package/dist/db/index.js +2 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db.util.d.ts +84 -0
- package/dist/db.util.js +177 -0
- package/dist/db.util.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/index.d.ts +1 -0
- package/dist/logger/index.js +2 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logger/logger.d.ts +30 -0
- package/dist/logger/logger.js +126 -0
- package/dist/logger/logger.js.map +1 -0
- package/dist/logger.util.d.ts +30 -0
- package/dist/logger.util.js +126 -0
- package/dist/logger.util.js.map +1 -0
- package/dist/mail/index.d.ts +1 -0
- package/dist/mail/index.js +2 -0
- package/dist/mail/index.js.map +1 -0
- package/dist/mail/mail.d.ts +21 -0
- package/dist/mail/mail.js +53 -0
- package/dist/mail/mail.js.map +1 -0
- package/dist/mail.util.d.ts +21 -0
- package/dist/mail.util.js +53 -0
- package/dist/mail.util.js.map +1 -0
- package/dist/middleware/index.d.ts +1 -0
- package/dist/middleware/index.js +2 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/middleware.d.ts +263 -0
- package/dist/middleware/middleware.js +233 -0
- package/dist/middleware/middleware.js.map +1 -0
- package/dist/middleware.util.d.ts +263 -0
- package/dist/middleware.util.js +233 -0
- package/dist/middleware.util.js.map +1 -0
- package/dist/model/index.d.ts +3 -0
- package/dist/model/index.js +4 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/model.d.ts +204 -0
- package/dist/model/model.js +1495 -0
- package/dist/model/model.js.map +1 -0
- package/dist/model.util.d.ts +204 -0
- package/dist/model.util.js +1495 -0
- package/dist/model.util.js.map +1 -0
- package/dist/permission/index.d.ts +1 -0
- package/dist/permission/index.js +2 -0
- package/dist/permission/index.js.map +1 -0
- package/dist/permission/permission.d.ts +38 -0
- package/dist/permission/permission.js +91 -0
- package/dist/permission/permission.js.map +1 -0
- package/dist/permission.util.d.ts +38 -0
- package/dist/permission.util.js +91 -0
- package/dist/permission.util.js.map +1 -0
- package/dist/registry/index.d.ts +1 -0
- package/dist/registry/index.js +2 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/registry.d.ts +28 -0
- package/dist/registry/registry.js +19 -0
- package/dist/registry/registry.js.map +1 -0
- package/dist/registry.util.d.ts +28 -0
- package/dist/registry.util.js +19 -0
- package/dist/registry.util.js.map +1 -0
- package/dist/route/index.d.ts +1 -0
- package/dist/route/index.js +2 -0
- package/dist/route/index.js.map +1 -0
- package/dist/route/route.d.ts +1 -0
- package/dist/route/route.js +12 -0
- package/dist/route/route.js.map +1 -0
- package/dist/route.util.d.ts +1 -0
- package/dist/route.util.js +12 -0
- package/dist/route.util.js.map +1 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +2 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/storage.d.ts +56 -0
- package/dist/storage/storage.js +86 -0
- package/dist/storage/storage.js.map +1 -0
- package/dist/storage.util.d.ts +56 -0
- package/dist/storage.util.js +82 -0
- package/dist/storage.util.js.map +1 -0
- package/dist/validation/index.d.ts +1 -0
- package/dist/validation/index.js +2 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/validation.d.ts +7 -0
- package/dist/validation/validation.js +245 -0
- package/dist/validation/validation.js.map +1 -0
- package/dist/validation.util.d.ts +7 -0
- package/dist/validation.util.js +237 -0
- package/dist/validation.util.js.map +1 -0
- package/package.json +34 -0
- package/src/auth/auth.ts +282 -0
- package/src/auth/index.ts +1 -0
- package/src/commands/cli.ts +89 -0
- package/src/commands/make/basic-controller.ts +49 -0
- package/src/commands/make/basic-migration.ts +89 -0
- package/src/commands/make/basic-model.ts +32 -0
- package/src/commands/make/basic-seeder.ts +38 -0
- package/src/commands/make/blueprint.ts +36 -0
- package/src/commands/make/da-migration.ts +90 -0
- package/src/commands/make/light-controller.ts +67 -0
- package/src/commands/make/light-model.ts +61 -0
- package/src/commands/make/mail.ts +51 -0
- package/src/commands/make/notification.ts +43 -0
- package/src/commands/make/queue.ts +45 -0
- package/src/commands/runner/barrels.ts +85 -0
- package/src/commands/runner/blueprint/controller-generation.ts +194 -0
- package/src/commands/runner/blueprint/documentation-generation.ts +463 -0
- package/src/commands/runner/blueprint/migration-generation.ts +153 -0
- package/src/commands/runner/blueprint/model-generation.ts +149 -0
- package/src/commands/runner/blueprint/runner.ts +181 -0
- package/src/commands/runner/blueprint/seeder-generation.ts +55 -0
- package/src/commands/runner/da-migration.ts +333 -0
- package/src/commands/runner/migration.ts +245 -0
- package/src/commands/runner/seeder.ts +44 -0
- package/src/commands/stubs/index.ts +289 -0
- package/src/context/context.ts +17 -0
- package/src/context/index.ts +1 -0
- package/src/controller/controller.ts +240 -0
- package/src/controller/index.ts +1 -0
- package/src/conversion/conversion.ts +65 -0
- package/src/conversion/index.ts +1 -0
- package/src/index.ts +22 -0
- package/src/logger/index.ts +1 -0
- package/src/logger/logger.ts +177 -0
- package/src/mail/index.ts +1 -0
- package/src/mail/mail.ts +86 -0
- package/src/middleware/index.ts +1 -0
- package/src/middleware/middleware.ts +289 -0
- package/src/permission/index.ts +1 -0
- package/src/permission/permission.ts +136 -0
- package/src/registry/index.ts +1 -0
- package/src/registry/registry.ts +37 -0
- package/src/route/index.ts +1 -0
- package/src/route/route.ts +12 -0
- package/src/storage/index.ts +1 -0
- package/src/storage/storage.ts +107 -0
- package/src/validation/index.ts +1 -0
- package/src/validation/validation.ts +346 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
declare module "elysia" {
|
|
3
|
+
interface Elysia {
|
|
4
|
+
api(basePath: string, controller: {
|
|
5
|
+
index?: any;
|
|
6
|
+
store?: any;
|
|
7
|
+
show?: any;
|
|
8
|
+
update?: any;
|
|
9
|
+
destroy?: any;
|
|
10
|
+
}): this;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare const middleware: {
|
|
14
|
+
Auth: (app: Elysia) => Elysia<"", {
|
|
15
|
+
decorator: {};
|
|
16
|
+
store: {};
|
|
17
|
+
derive: {};
|
|
18
|
+
resolve: {};
|
|
19
|
+
}, {
|
|
20
|
+
typebox: {};
|
|
21
|
+
error: {};
|
|
22
|
+
}, {
|
|
23
|
+
schema: {};
|
|
24
|
+
standaloneSchema: {};
|
|
25
|
+
macro: {};
|
|
26
|
+
macroFn: {};
|
|
27
|
+
parser: {};
|
|
28
|
+
response: {};
|
|
29
|
+
}, {}, {
|
|
30
|
+
derive: {};
|
|
31
|
+
resolve: {};
|
|
32
|
+
schema: {};
|
|
33
|
+
standaloneSchema: {};
|
|
34
|
+
response: {};
|
|
35
|
+
}, {
|
|
36
|
+
derive: {
|
|
37
|
+
readonly user: any;
|
|
38
|
+
readonly permissions: any;
|
|
39
|
+
readonly token: any;
|
|
40
|
+
};
|
|
41
|
+
resolve: {};
|
|
42
|
+
schema: {};
|
|
43
|
+
standaloneSchema: {};
|
|
44
|
+
response: import("elysia").ExtractErrorFromHandle<{
|
|
45
|
+
readonly user: any;
|
|
46
|
+
readonly permissions: any;
|
|
47
|
+
readonly token: any;
|
|
48
|
+
}>;
|
|
49
|
+
}>;
|
|
50
|
+
Private: (app: Elysia) => Elysia<"", {
|
|
51
|
+
decorator: {};
|
|
52
|
+
store: {};
|
|
53
|
+
derive: {};
|
|
54
|
+
resolve: {};
|
|
55
|
+
}, {
|
|
56
|
+
typebox: {};
|
|
57
|
+
error: {};
|
|
58
|
+
}, {
|
|
59
|
+
schema: {};
|
|
60
|
+
standaloneSchema: {};
|
|
61
|
+
macro: {};
|
|
62
|
+
macroFn: {};
|
|
63
|
+
parser: {};
|
|
64
|
+
response: {};
|
|
65
|
+
}, {}, {
|
|
66
|
+
derive: {};
|
|
67
|
+
resolve: {};
|
|
68
|
+
schema: {};
|
|
69
|
+
standaloneSchema: {};
|
|
70
|
+
response: {};
|
|
71
|
+
}, {
|
|
72
|
+
derive: Partial<void & {}>;
|
|
73
|
+
resolve: {};
|
|
74
|
+
schema: {};
|
|
75
|
+
standaloneSchema: {};
|
|
76
|
+
response: import("elysia").ExtractErrorFromHandle<void>;
|
|
77
|
+
}>;
|
|
78
|
+
Cors: (app: Elysia) => Elysia<"", {
|
|
79
|
+
decorator: {};
|
|
80
|
+
store: {};
|
|
81
|
+
derive: {};
|
|
82
|
+
resolve: {};
|
|
83
|
+
}, {
|
|
84
|
+
typebox: {};
|
|
85
|
+
error: {};
|
|
86
|
+
}, {
|
|
87
|
+
schema: {};
|
|
88
|
+
standaloneSchema: {};
|
|
89
|
+
macro: {};
|
|
90
|
+
macroFn: {};
|
|
91
|
+
parser: {};
|
|
92
|
+
response: {};
|
|
93
|
+
}, {}, {
|
|
94
|
+
derive: {};
|
|
95
|
+
resolve: {};
|
|
96
|
+
schema: {};
|
|
97
|
+
standaloneSchema: {};
|
|
98
|
+
response: {};
|
|
99
|
+
}, {
|
|
100
|
+
derive: {};
|
|
101
|
+
resolve: {};
|
|
102
|
+
schema: {};
|
|
103
|
+
standaloneSchema: {};
|
|
104
|
+
response: {
|
|
105
|
+
200: Response;
|
|
106
|
+
};
|
|
107
|
+
}>;
|
|
108
|
+
RateLimiter: (app: Elysia, options?: {
|
|
109
|
+
windowMs?: number;
|
|
110
|
+
max?: number;
|
|
111
|
+
}) => Elysia<"", {
|
|
112
|
+
decorator: {};
|
|
113
|
+
store: {};
|
|
114
|
+
derive: {};
|
|
115
|
+
resolve: {};
|
|
116
|
+
}, {
|
|
117
|
+
typebox: {};
|
|
118
|
+
error: {};
|
|
119
|
+
}, {
|
|
120
|
+
schema: {};
|
|
121
|
+
standaloneSchema: {};
|
|
122
|
+
macro: {};
|
|
123
|
+
macroFn: {};
|
|
124
|
+
parser: {};
|
|
125
|
+
response: {};
|
|
126
|
+
}, {}, {
|
|
127
|
+
derive: {};
|
|
128
|
+
resolve: {};
|
|
129
|
+
schema: {};
|
|
130
|
+
standaloneSchema: {};
|
|
131
|
+
response: {};
|
|
132
|
+
}, {
|
|
133
|
+
derive: {};
|
|
134
|
+
resolve: {};
|
|
135
|
+
schema: {};
|
|
136
|
+
standaloneSchema: {};
|
|
137
|
+
response: {};
|
|
138
|
+
}>;
|
|
139
|
+
BodyParse: (app: Elysia) => Elysia<"", {
|
|
140
|
+
decorator: {};
|
|
141
|
+
store: {
|
|
142
|
+
rawBody?: any;
|
|
143
|
+
};
|
|
144
|
+
derive: {};
|
|
145
|
+
resolve: {};
|
|
146
|
+
}, {
|
|
147
|
+
typebox: {};
|
|
148
|
+
error: {};
|
|
149
|
+
}, {
|
|
150
|
+
schema: {};
|
|
151
|
+
standaloneSchema: {};
|
|
152
|
+
macro: {};
|
|
153
|
+
macroFn: {};
|
|
154
|
+
parser: {};
|
|
155
|
+
response: {};
|
|
156
|
+
}, {}, {
|
|
157
|
+
derive: {};
|
|
158
|
+
resolve: {};
|
|
159
|
+
schema: {};
|
|
160
|
+
standaloneSchema: {};
|
|
161
|
+
response: {};
|
|
162
|
+
}, {
|
|
163
|
+
derive: {
|
|
164
|
+
readonly payload: any;
|
|
165
|
+
};
|
|
166
|
+
resolve: {};
|
|
167
|
+
schema: {};
|
|
168
|
+
standaloneSchema: {};
|
|
169
|
+
response: import("elysia").ExtractErrorFromHandle<{
|
|
170
|
+
readonly payload: any;
|
|
171
|
+
}>;
|
|
172
|
+
}>;
|
|
173
|
+
AccessLog: (app: Elysia) => Elysia<"", {
|
|
174
|
+
decorator: {};
|
|
175
|
+
store: {
|
|
176
|
+
startedAt?: number | undefined;
|
|
177
|
+
};
|
|
178
|
+
derive: {};
|
|
179
|
+
resolve: {};
|
|
180
|
+
}, {
|
|
181
|
+
typebox: {};
|
|
182
|
+
error: {};
|
|
183
|
+
}, {
|
|
184
|
+
schema: {};
|
|
185
|
+
standaloneSchema: {};
|
|
186
|
+
macro: {};
|
|
187
|
+
macroFn: {};
|
|
188
|
+
parser: {};
|
|
189
|
+
response: {};
|
|
190
|
+
}, {}, {
|
|
191
|
+
derive: {};
|
|
192
|
+
resolve: {};
|
|
193
|
+
schema: {};
|
|
194
|
+
standaloneSchema: {};
|
|
195
|
+
response: {};
|
|
196
|
+
}, {
|
|
197
|
+
derive: {};
|
|
198
|
+
resolve: {};
|
|
199
|
+
schema: {};
|
|
200
|
+
standaloneSchema: {};
|
|
201
|
+
response: {};
|
|
202
|
+
}>;
|
|
203
|
+
ErrorHandler: (app: Elysia) => Elysia<"", {
|
|
204
|
+
decorator: {};
|
|
205
|
+
store: {};
|
|
206
|
+
derive: {};
|
|
207
|
+
resolve: {};
|
|
208
|
+
}, {
|
|
209
|
+
typebox: {};
|
|
210
|
+
error: {};
|
|
211
|
+
}, {
|
|
212
|
+
schema: {};
|
|
213
|
+
standaloneSchema: {};
|
|
214
|
+
macro: {};
|
|
215
|
+
macroFn: {};
|
|
216
|
+
parser: {};
|
|
217
|
+
response: {};
|
|
218
|
+
}, {}, {
|
|
219
|
+
derive: {};
|
|
220
|
+
resolve: {};
|
|
221
|
+
schema: {};
|
|
222
|
+
standaloneSchema: {};
|
|
223
|
+
response: {};
|
|
224
|
+
}, {
|
|
225
|
+
derive: {};
|
|
226
|
+
resolve: {};
|
|
227
|
+
schema: {};
|
|
228
|
+
standaloneSchema: {};
|
|
229
|
+
response: {
|
|
230
|
+
200: {
|
|
231
|
+
message: string;
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
}>;
|
|
235
|
+
Context: (app: Elysia) => Elysia<"", {
|
|
236
|
+
decorator: {};
|
|
237
|
+
store: {};
|
|
238
|
+
derive: {};
|
|
239
|
+
resolve: {};
|
|
240
|
+
}, {
|
|
241
|
+
typebox: {};
|
|
242
|
+
error: {};
|
|
243
|
+
}, {
|
|
244
|
+
schema: {};
|
|
245
|
+
standaloneSchema: {};
|
|
246
|
+
macro: {};
|
|
247
|
+
macroFn: {};
|
|
248
|
+
parser: {};
|
|
249
|
+
response: {};
|
|
250
|
+
}, {}, {
|
|
251
|
+
derive: {};
|
|
252
|
+
resolve: {};
|
|
253
|
+
schema: {};
|
|
254
|
+
standaloneSchema: {};
|
|
255
|
+
response: {};
|
|
256
|
+
}, {
|
|
257
|
+
derive: {};
|
|
258
|
+
resolve: {};
|
|
259
|
+
schema: {};
|
|
260
|
+
standaloneSchema: {};
|
|
261
|
+
response: import("elysia").ExtractErrorFromHandle<{}>;
|
|
262
|
+
}>;
|
|
263
|
+
};
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { status } from 'elysia';
|
|
2
|
+
import { auth, context, logger } from '@utils';
|
|
3
|
+
const errors = {
|
|
4
|
+
unauthorized: {
|
|
5
|
+
status: 401,
|
|
6
|
+
message: "Unauthorized!"
|
|
7
|
+
},
|
|
8
|
+
ratelimited: {
|
|
9
|
+
status: 429,
|
|
10
|
+
message: "Too many requests!"
|
|
11
|
+
},
|
|
12
|
+
notfound: {
|
|
13
|
+
status: 404,
|
|
14
|
+
message: "Endpoint not found!"
|
|
15
|
+
},
|
|
16
|
+
request: {
|
|
17
|
+
status: 400,
|
|
18
|
+
message: "Bad Request!"
|
|
19
|
+
},
|
|
20
|
+
error: {
|
|
21
|
+
status: 500,
|
|
22
|
+
message: "Endpoint not found!"
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export const middleware = {
|
|
26
|
+
// =============================>
|
|
27
|
+
// ## Middleware: Auth hand;er
|
|
28
|
+
// =============================>
|
|
29
|
+
Auth: (app) => app.derive(async ({ request }) => {
|
|
30
|
+
const authHeader = request.headers.get('authorization');
|
|
31
|
+
if (!authHeader || !authHeader.startsWith('Bearer '))
|
|
32
|
+
return { user: null, permissions: [], token: null };
|
|
33
|
+
const bearer = authHeader.substring(7).trim();
|
|
34
|
+
const result = await auth.verifyAccessToken(bearer, request);
|
|
35
|
+
if (!result)
|
|
36
|
+
return { user: null, permissions: [], token: null };
|
|
37
|
+
return {
|
|
38
|
+
user: result.user,
|
|
39
|
+
permissions: result.permissions,
|
|
40
|
+
token: result.token,
|
|
41
|
+
};
|
|
42
|
+
}),
|
|
43
|
+
// =============================>
|
|
44
|
+
// ## Middleware: Private handler
|
|
45
|
+
// =============================>
|
|
46
|
+
Private: (app) => app.derive(async ({ user }) => {
|
|
47
|
+
if (!user) {
|
|
48
|
+
throw status(errors.unauthorized.status, { message: errors.unauthorized.message });
|
|
49
|
+
}
|
|
50
|
+
}),
|
|
51
|
+
// =============================>
|
|
52
|
+
// ## Middleware: Cors handler
|
|
53
|
+
// =============================>
|
|
54
|
+
Cors: (app) => app.onRequest(({ request, set }) => {
|
|
55
|
+
const origin = request.headers.get('origin') ?? '';
|
|
56
|
+
let allowedOrigin = '*';
|
|
57
|
+
const originsConf = process.env.APP_CORS_ORIGINS || '*';
|
|
58
|
+
if (originsConf !== '*') {
|
|
59
|
+
try {
|
|
60
|
+
const allowedOrigins = JSON.parse(originsConf);
|
|
61
|
+
if (Array.isArray(allowedOrigins) && allowedOrigins.includes(origin)) {
|
|
62
|
+
allowedOrigin = origin || "";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
const em = 'Cors Error: Failed to parse APP_CORS_ORIGINS, fallback to "*"';
|
|
67
|
+
logger.error(em, { error: em });
|
|
68
|
+
allowedOrigin = '';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
set.headers['Access-Control-Allow-Origin'] = allowedOrigin;
|
|
72
|
+
set.headers['Access-Control-Allow-Methods'] = process.env.APP_CORS_METHODS || 'GET, POST, PUT, DELETE, OPTIONS';
|
|
73
|
+
set.headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization, X-Option, x-App';
|
|
74
|
+
set.headers['Access-Control-Allow-Credentials'] = 'true';
|
|
75
|
+
if (request.method === 'OPTIONS') {
|
|
76
|
+
return new Response(null, { status: 204, });
|
|
77
|
+
}
|
|
78
|
+
}),
|
|
79
|
+
// =============================>
|
|
80
|
+
// ## Middleware: Rate limiter handler
|
|
81
|
+
// =============================>
|
|
82
|
+
RateLimiter: (app, options) => app.onRequest(({ request, set, store }) => {
|
|
83
|
+
const max = options?.max || (process.env.APP_RATELIMIT_COUNTDOWN ? Number(process.env.APP_RATE_LIMIT) : 60);
|
|
84
|
+
const windowMs = options?.windowMs || (process.env.APP_RATELIMIT_COUNTDOWN ? Number(process.env.APP_RATELIMIT_COUNTDOWN) : 60_000);
|
|
85
|
+
const user = store?.user;
|
|
86
|
+
const key = getClientKey(request, user?.id);
|
|
87
|
+
const now = Date.now();
|
|
88
|
+
let record = rateLimitStore.get(key);
|
|
89
|
+
if (!record || record.expiresAt < now) {
|
|
90
|
+
record = { count: 1, expiresAt: now + windowMs };
|
|
91
|
+
rateLimitStore.set(key, record);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
record.count++;
|
|
95
|
+
}
|
|
96
|
+
set.headers['X-RateLimit-Limit'] = String(max);
|
|
97
|
+
set.headers['X-RateLimit-Remaining'] = String(Math.max(0, max - record.count));
|
|
98
|
+
set.headers['X-RateLimit-Reset'] = String(record.expiresAt);
|
|
99
|
+
if (record.count > max)
|
|
100
|
+
throw status(errors.ratelimited.status, { message: errors.ratelimited.message });
|
|
101
|
+
}),
|
|
102
|
+
// =============================>
|
|
103
|
+
// ## Middleware: Body parse handler
|
|
104
|
+
// =============================>
|
|
105
|
+
BodyParse: (app) => app.state({}).onRequest(async ({ request, store }) => {
|
|
106
|
+
const text = await request.clone().text();
|
|
107
|
+
const contentType = request.headers.get("content-type") || "";
|
|
108
|
+
let rawBody = {};
|
|
109
|
+
try {
|
|
110
|
+
if (contentType.includes("application/json")) {
|
|
111
|
+
rawBody = text ? JSON.parse(text) : {};
|
|
112
|
+
}
|
|
113
|
+
else if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
114
|
+
const params = new URLSearchParams(text);
|
|
115
|
+
for (const [key, value] of params.entries())
|
|
116
|
+
bodyParseNestedSet(rawBody, key, value);
|
|
117
|
+
}
|
|
118
|
+
else if (contentType.includes("multipart/form-data")) {
|
|
119
|
+
const formData = await request.clone().formData();
|
|
120
|
+
for (const [key, value] of formData.entries())
|
|
121
|
+
bodyParseNestedSet(rawBody, key, value);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
rawBody = {};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch (e) {
|
|
128
|
+
const em = e instanceof Error ? e.message : String(e);
|
|
129
|
+
logger.error(`Body parse error: ${em}`, { error: em });
|
|
130
|
+
rawBody = {};
|
|
131
|
+
throw status(errors.request.status, { message: errors.request.message });
|
|
132
|
+
}
|
|
133
|
+
store.rawBody = rawBody;
|
|
134
|
+
}).derive(({ store }) => {
|
|
135
|
+
const payload = bodyParseKeyFormat(store.rawBody || {});
|
|
136
|
+
return { payload };
|
|
137
|
+
}),
|
|
138
|
+
AccessLog: (app) => app.state({}).onRequest(({ store }) => { store.startedAt = Date.now(); }).onAfterResponse(({ request, set, store }) => {
|
|
139
|
+
const method = request.method;
|
|
140
|
+
const url = new URL(request.url);
|
|
141
|
+
const path = url.pathname;
|
|
142
|
+
const status = Number(set.status) ?? 200;
|
|
143
|
+
const latency = Date.now() - (store.startedAt ?? Date.now());
|
|
144
|
+
const agent = request.headers.get("user-agent") || 'unknown';
|
|
145
|
+
const ip = request.headers.get('x-forwarded-for')?.split(',')[0]?.trim() || request.headers.get('cf-connecting-ip') || 'unknown';
|
|
146
|
+
logger.info(`${method} : ${path} - ${status} - ${latency}ms - ${ip}]`);
|
|
147
|
+
logger.access({ method, path, status, latency, ip, agent });
|
|
148
|
+
}),
|
|
149
|
+
// =============================>
|
|
150
|
+
// ## Middleware: Error handler
|
|
151
|
+
// =============================>
|
|
152
|
+
ErrorHandler: (app) => app.onError(({ code, set, error, request }) => {
|
|
153
|
+
if (code === 'NOT_FOUND') {
|
|
154
|
+
set.status = errors.notfound.status;
|
|
155
|
+
return { message: errors.notfound.message };
|
|
156
|
+
}
|
|
157
|
+
if (code === 'INTERNAL_SERVER_ERROR') {
|
|
158
|
+
set.status = errors.error.status;
|
|
159
|
+
const em = error.message;
|
|
160
|
+
const url = new URL(request.url);
|
|
161
|
+
const path = url.pathname;
|
|
162
|
+
logger.error(`error: ${em}`, { error: em, reference: path });
|
|
163
|
+
return { message: em };
|
|
164
|
+
}
|
|
165
|
+
}),
|
|
166
|
+
Context: (app) => app.derive(async ({ store }) => {
|
|
167
|
+
const userId = store?.user?.id;
|
|
168
|
+
return context.run({
|
|
169
|
+
user_id: userId,
|
|
170
|
+
}, () => ({}));
|
|
171
|
+
}),
|
|
172
|
+
};
|
|
173
|
+
// =============================>
|
|
174
|
+
// ## Middleware: Body parse helpers
|
|
175
|
+
// =============================>
|
|
176
|
+
function bodyParseKeyFormat(input) {
|
|
177
|
+
if (typeof input !== "object" || input === null || input instanceof File)
|
|
178
|
+
return input;
|
|
179
|
+
if (Array.isArray(input))
|
|
180
|
+
return input.map(bodyParseKeyFormat);
|
|
181
|
+
const result = {};
|
|
182
|
+
for (const [key, value] of Object.entries(input)) {
|
|
183
|
+
if (key.includes(".") || key.includes("[")) {
|
|
184
|
+
bodyParseNestedSet(result, key, bodyParseKeyFormat(value));
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
result[key] = bodyParseKeyFormat(value);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return result;
|
|
191
|
+
}
|
|
192
|
+
function bodyParseNestedSet(obj, path, value) {
|
|
193
|
+
const parts = bodyParsePathFormat(path);
|
|
194
|
+
let current = obj;
|
|
195
|
+
for (let i = 0; i < parts.length; i++) {
|
|
196
|
+
const key = parts[i];
|
|
197
|
+
const isLast = i === parts.length - 1;
|
|
198
|
+
if (isLast) {
|
|
199
|
+
current[key] = bodyParseValueFormat(value);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
if (!(key in current)) {
|
|
203
|
+
const nextKey = parts[i + 1];
|
|
204
|
+
current[key] = isNaN(Number(nextKey)) ? {} : [];
|
|
205
|
+
}
|
|
206
|
+
current = current[key];
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function bodyParsePathFormat(path) {
|
|
211
|
+
return path.replace(/\[(\w+)\]/g, ".$1").replace(/^\./, "").split(".");
|
|
212
|
+
}
|
|
213
|
+
function bodyParseValueFormat(value) {
|
|
214
|
+
if (value == "" || value == null || value == "null")
|
|
215
|
+
return null;
|
|
216
|
+
if (typeof value !== "string")
|
|
217
|
+
return value;
|
|
218
|
+
if (value === "true")
|
|
219
|
+
return true;
|
|
220
|
+
if (value === "false")
|
|
221
|
+
return false;
|
|
222
|
+
if (!isNaN(Number(value)))
|
|
223
|
+
return Number(value);
|
|
224
|
+
return value;
|
|
225
|
+
}
|
|
226
|
+
const rateLimitStore = new Map();
|
|
227
|
+
function getClientKey(request, userId) {
|
|
228
|
+
if (userId)
|
|
229
|
+
return `user:${userId}`;
|
|
230
|
+
const ip = request.headers.get('x-forwarded-for')?.split(',')[0]?.trim() || request.headers.get('cf-connecting-ip') || 'unknown';
|
|
231
|
+
return `ip:${ip}`;
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=middleware.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.util.js","sourceRoot":"","sources":["../src/middleware.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAkB9C,MAAM,MAAM,GAAG;IACb,YAAY,EAAE;QACZ,MAAM,EAAE,GAAG;QACX,OAAO,EAAE,eAAe;KACzB;IACD,WAAW,EAAE;QACX,MAAM,EAAE,GAAG;QACX,OAAO,EAAE,oBAAoB;KAC9B;IACD,QAAQ,EAAE;QACR,MAAM,EAAE,GAAG;QACX,OAAO,EAAE,qBAAqB;KAC/B;IACD,OAAO,EAAE;QACP,MAAM,EAAE,GAAG;QACX,OAAO,EAAE,cAAc;KACxB;IACD,KAAK,EAAE;QACL,MAAM,EAAE,GAAG;QACX,OAAO,EAAE,qBAAqB;KAC/B;CACF,CAAA;AAGD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,iCAAiC;IACjC,8BAA8B;IAC9B,iCAAiC;IACjC,IAAI,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACpD,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;QAEvD,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,KA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