@dooboostore/simple-boot-http-server 1.0.32 → 1.0.33
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/cjs/SimpleBootHttpServer.js +2 -1
- package/dist/cjs/SimpleBootHttpServer.js.map +2 -2
- package/dist/cjs/decorators/MethodMapping.js +9 -0
- package/dist/cjs/decorators/MethodMapping.js.map +2 -2
- package/dist/esm/SimpleBootHttpServer.js +2 -1
- package/dist/esm/SimpleBootHttpServer.js.map +2 -2
- package/dist/esm/decorators/MethodMapping.js +9 -0
- package/dist/esm/decorators/MethodMapping.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js +11 -1
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js.map +2 -2
- package/dist/types/SimpleBootHttpServer.d.ts.map +1 -1
- package/dist/types/decorators/MethodMapping.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js +11 -1
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js.map +2 -2
- package/package.json +1 -1
- package/src/SimpleBootHttpServer.ts +4 -1
- package/src/decorators/MethodMapping.ts +9 -0
package/package.json
CHANGED
|
@@ -390,7 +390,10 @@ export class SimpleBootHttpServer extends SimpleApplication {
|
|
|
390
390
|
console.error('request error:', e);
|
|
391
391
|
transactionManager?.catch(e);
|
|
392
392
|
rr.resStatusCode(e instanceof HttpError ? e.status : HttpStatus.InternalServerError)
|
|
393
|
-
const
|
|
393
|
+
const globalAdvice = this.option.globalAdvice;
|
|
394
|
+
// getOrNewSim takes { target }; passing the class directly
|
|
395
|
+
// destructures to undefined and silently disables globalAdvice.
|
|
396
|
+
const execute = typeof globalAdvice === 'function' ? this.simstanceManager.getOrNewSim({ target: globalAdvice }) : globalAdvice;
|
|
394
397
|
if (!execute) {
|
|
395
398
|
rr.resEnd();
|
|
396
399
|
// rr.resEnd().catch(e => {
|
|
@@ -69,6 +69,7 @@ export function GET(configOrTarget?: Omit<MappingConfig, 'method'> | any, proper
|
|
|
69
69
|
process({ method: HttpMethod.GET }, configOrTarget, propertyKey, descriptor);
|
|
70
70
|
} else {
|
|
71
71
|
return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
|
|
72
|
+
configOrTarget = configOrTarget ?? {};
|
|
72
73
|
configOrTarget.method = HttpMethod.GET;
|
|
73
74
|
process(configOrTarget, target, propertyKey, descriptor);
|
|
74
75
|
};
|
|
@@ -88,6 +89,7 @@ export function POST(configOrTarget?: Omit<MappingConfig, 'method'> | any, prope
|
|
|
88
89
|
process({ method: HttpMethod.POST }, configOrTarget, propertyKey, descriptor);
|
|
89
90
|
} else {
|
|
90
91
|
return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
|
|
92
|
+
configOrTarget = configOrTarget ?? {};
|
|
91
93
|
configOrTarget.method = HttpMethod.POST;
|
|
92
94
|
process(configOrTarget, target, propertyKey, descriptor);
|
|
93
95
|
};
|
|
@@ -107,6 +109,7 @@ export function DELETE(configOrTarget?: Omit<MappingConfig, 'method'> | any, pro
|
|
|
107
109
|
process({ method: HttpMethod.DELETE }, configOrTarget, propertyKey, descriptor);
|
|
108
110
|
} else {
|
|
109
111
|
return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
|
|
112
|
+
configOrTarget = configOrTarget ?? {};
|
|
110
113
|
configOrTarget.method = HttpMethod.DELETE;
|
|
111
114
|
process(configOrTarget, target, propertyKey, descriptor);
|
|
112
115
|
};
|
|
@@ -126,6 +129,7 @@ export function PUT(configOrTarget?: Omit<MappingConfig, 'method'> | any, proper
|
|
|
126
129
|
process({ method: HttpMethod.PUT }, configOrTarget, propertyKey, descriptor);
|
|
127
130
|
} else {
|
|
128
131
|
return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
|
|
132
|
+
configOrTarget = configOrTarget ?? {};
|
|
129
133
|
configOrTarget.method = HttpMethod.PUT;
|
|
130
134
|
process(configOrTarget, target, propertyKey, descriptor);
|
|
131
135
|
};
|
|
@@ -145,6 +149,7 @@ export function PATCH(configOrTarget?: Omit<MappingConfig, 'method'> | any, prop
|
|
|
145
149
|
process({ method: HttpMethod.PATCH }, configOrTarget, propertyKey, descriptor);
|
|
146
150
|
} else {
|
|
147
151
|
return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
|
|
152
|
+
configOrTarget = configOrTarget ?? {};
|
|
148
153
|
configOrTarget.method = HttpMethod.PATCH;
|
|
149
154
|
process(configOrTarget, target, propertyKey, descriptor);
|
|
150
155
|
};
|
|
@@ -164,6 +169,7 @@ export function OPTIONS(configOrTarget?: Omit<MappingConfig, 'method'> | any, pr
|
|
|
164
169
|
process({ method: HttpMethod.OPTIONS }, configOrTarget, propertyKey, descriptor);
|
|
165
170
|
} else {
|
|
166
171
|
return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
|
|
172
|
+
configOrTarget = configOrTarget ?? {};
|
|
167
173
|
configOrTarget.method = HttpMethod.OPTIONS;
|
|
168
174
|
process(configOrTarget, target, propertyKey, descriptor);
|
|
169
175
|
};
|
|
@@ -183,6 +189,7 @@ export function HEAD(configOrTarget?: Omit<MappingConfig, 'method'> | any, prope
|
|
|
183
189
|
process({ method: HttpMethod.HEAD }, configOrTarget, propertyKey, descriptor);
|
|
184
190
|
} else {
|
|
185
191
|
return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
|
|
192
|
+
configOrTarget = configOrTarget ?? {};
|
|
186
193
|
configOrTarget.method = HttpMethod.HEAD;
|
|
187
194
|
process(configOrTarget, target, propertyKey, descriptor);
|
|
188
195
|
};
|
|
@@ -202,6 +209,7 @@ export function TRACE(configOrTarget?: Omit<MappingConfig, 'method'> | any, prop
|
|
|
202
209
|
process({ method: HttpMethod.TRACE }, configOrTarget, propertyKey, descriptor);
|
|
203
210
|
} else {
|
|
204
211
|
return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
|
|
212
|
+
configOrTarget = configOrTarget ?? {};
|
|
205
213
|
configOrTarget.method = HttpMethod.TRACE;
|
|
206
214
|
process(configOrTarget, target, propertyKey, descriptor);
|
|
207
215
|
};
|
|
@@ -221,6 +229,7 @@ export function CONNECT(configOrTarget?: Omit<MappingConfig, 'method'> | any, pr
|
|
|
221
229
|
process({ method: HttpMethod.CONNECT }, configOrTarget, propertyKey, descriptor);
|
|
222
230
|
} else {
|
|
223
231
|
return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
|
|
232
|
+
configOrTarget = configOrTarget ?? {};
|
|
224
233
|
configOrTarget.method = HttpMethod.CONNECT;
|
|
225
234
|
process(configOrTarget, target, propertyKey, descriptor);
|
|
226
235
|
};
|