@hono-di/core 0.0.7 → 0.0.9
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/core.cjs +420 -182
- package/dist/core.js +420 -182
- package/dist/decorators.cjs +76 -54
- package/dist/decorators.js +76 -54
- package/dist/index.cjs +417 -231
- package/dist/index.js +417 -231
- package/package.json +2 -1
package/dist/decorators.cjs
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
require('reflect-metadata');
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
7
|
|
|
7
8
|
// src/constants.ts
|
|
8
9
|
var METADATA_KEYS = {
|
|
@@ -26,15 +27,15 @@ var METADATA_KEYS = {
|
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
// src/injector/scope.ts
|
|
29
|
-
var Scope = /* @__PURE__ */ ((Scope2)
|
|
30
|
+
var Scope = /* @__PURE__ */ (function(Scope2) {
|
|
30
31
|
Scope2[Scope2["DEFAULT"] = 0] = "DEFAULT";
|
|
31
32
|
Scope2[Scope2["TRANSIENT"] = 1] = "TRANSIENT";
|
|
32
33
|
Scope2[Scope2["REQUEST"] = 2] = "REQUEST";
|
|
33
34
|
return Scope2;
|
|
34
|
-
})(
|
|
35
|
+
})({});
|
|
35
36
|
|
|
36
37
|
// src/interfaces.ts
|
|
37
|
-
var RequestMethod = /* @__PURE__ */ ((RequestMethod2)
|
|
38
|
+
var RequestMethod = /* @__PURE__ */ (function(RequestMethod2) {
|
|
38
39
|
RequestMethod2["GET"] = "get";
|
|
39
40
|
RequestMethod2["POST"] = "post";
|
|
40
41
|
RequestMethod2["PUT"] = "put";
|
|
@@ -44,7 +45,7 @@ var RequestMethod = /* @__PURE__ */ ((RequestMethod2) => {
|
|
|
44
45
|
RequestMethod2["OPTIONS"] = "options";
|
|
45
46
|
RequestMethod2["HEAD"] = "head";
|
|
46
47
|
return RequestMethod2;
|
|
47
|
-
})(
|
|
48
|
+
})({});
|
|
48
49
|
|
|
49
50
|
// src/decorators.ts
|
|
50
51
|
function Global() {
|
|
@@ -52,22 +53,28 @@ function Global() {
|
|
|
52
53
|
Reflect.defineMetadata(METADATA_KEYS.GLOBAL, true, target);
|
|
53
54
|
};
|
|
54
55
|
}
|
|
56
|
+
__name(Global, "Global");
|
|
55
57
|
function Module(options) {
|
|
56
58
|
return (target) => {
|
|
57
59
|
Reflect.defineMetadata(METADATA_KEYS.MODULE, options, target);
|
|
58
60
|
};
|
|
59
61
|
}
|
|
62
|
+
__name(Module, "Module");
|
|
60
63
|
function Injectable(options) {
|
|
61
64
|
return (target) => {
|
|
62
|
-
Reflect.defineMetadata(METADATA_KEYS.SCOPE, options?.scope ??
|
|
65
|
+
Reflect.defineMetadata(METADATA_KEYS.SCOPE, options?.scope ?? Scope.DEFAULT, target);
|
|
63
66
|
};
|
|
64
67
|
}
|
|
68
|
+
__name(Injectable, "Injectable");
|
|
65
69
|
function Controller(prefix = "") {
|
|
66
70
|
return (target) => {
|
|
67
|
-
Reflect.defineMetadata(METADATA_KEYS.CONTROLLER, {
|
|
68
|
-
|
|
71
|
+
Reflect.defineMetadata(METADATA_KEYS.CONTROLLER, {
|
|
72
|
+
prefix
|
|
73
|
+
}, target);
|
|
74
|
+
Reflect.defineMetadata(METADATA_KEYS.SCOPE, Scope.DEFAULT, target);
|
|
69
75
|
};
|
|
70
76
|
}
|
|
77
|
+
__name(Controller, "Controller");
|
|
71
78
|
function createRouteDecorator(method) {
|
|
72
79
|
return (path = "/") => {
|
|
73
80
|
return (target, propertyKey, descriptor) => {
|
|
@@ -84,20 +91,22 @@ function createRouteDecorator(method) {
|
|
|
84
91
|
};
|
|
85
92
|
};
|
|
86
93
|
}
|
|
87
|
-
|
|
88
|
-
var
|
|
89
|
-
var
|
|
90
|
-
var
|
|
91
|
-
var
|
|
92
|
-
var
|
|
93
|
-
var
|
|
94
|
-
var
|
|
94
|
+
__name(createRouteDecorator, "createRouteDecorator");
|
|
95
|
+
var Get = createRouteDecorator(RequestMethod.GET);
|
|
96
|
+
var Post = createRouteDecorator(RequestMethod.POST);
|
|
97
|
+
var Put = createRouteDecorator(RequestMethod.PUT);
|
|
98
|
+
var Delete = createRouteDecorator(RequestMethod.DELETE);
|
|
99
|
+
var Patch = createRouteDecorator(RequestMethod.PATCH);
|
|
100
|
+
var Options = createRouteDecorator(RequestMethod.OPTIONS);
|
|
101
|
+
var Head = createRouteDecorator(RequestMethod.HEAD);
|
|
102
|
+
var All = createRouteDecorator(RequestMethod.ALL);
|
|
95
103
|
function Catch(...exceptions) {
|
|
96
104
|
return (target) => {
|
|
97
105
|
Reflect.defineMetadata(METADATA_KEYS.FILTER_CATCH, exceptions, target);
|
|
98
|
-
Reflect.defineMetadata(METADATA_KEYS.SCOPE,
|
|
106
|
+
Reflect.defineMetadata(METADATA_KEYS.SCOPE, Scope.DEFAULT, target);
|
|
99
107
|
};
|
|
100
108
|
}
|
|
109
|
+
__name(Catch, "Catch");
|
|
101
110
|
function UseFilters(...filters) {
|
|
102
111
|
return (target, propertyKey, descriptor) => {
|
|
103
112
|
if (descriptor) {
|
|
@@ -108,6 +117,7 @@ function UseFilters(...filters) {
|
|
|
108
117
|
return target;
|
|
109
118
|
};
|
|
110
119
|
}
|
|
120
|
+
__name(UseFilters, "UseFilters");
|
|
111
121
|
function Inject(token) {
|
|
112
122
|
return (target, propertyKey, parameterIndex) => {
|
|
113
123
|
if (parameterIndex !== void 0) {
|
|
@@ -116,11 +126,15 @@ function Inject(token) {
|
|
|
116
126
|
Reflect.defineMetadata(METADATA_KEYS.INJECTIONS, injections, target);
|
|
117
127
|
} else {
|
|
118
128
|
const properties = Reflect.getMetadata(METADATA_KEYS.PROPERTY_DEPS, target.constructor) || [];
|
|
119
|
-
properties.push({
|
|
129
|
+
properties.push({
|
|
130
|
+
key: propertyKey,
|
|
131
|
+
token
|
|
132
|
+
});
|
|
120
133
|
Reflect.defineMetadata(METADATA_KEYS.PROPERTY_DEPS, properties, target.constructor);
|
|
121
134
|
}
|
|
122
135
|
};
|
|
123
136
|
}
|
|
137
|
+
__name(Inject, "Inject");
|
|
124
138
|
function Optional() {
|
|
125
139
|
return (target, propertyKey, parameterIndex) => {
|
|
126
140
|
if (parameterIndex !== void 0) {
|
|
@@ -134,6 +148,7 @@ function Optional() {
|
|
|
134
148
|
}
|
|
135
149
|
};
|
|
136
150
|
}
|
|
151
|
+
__name(Optional, "Optional");
|
|
137
152
|
function UseGuards(...guards) {
|
|
138
153
|
return (target, propertyKey, descriptor) => {
|
|
139
154
|
if (descriptor) {
|
|
@@ -144,6 +159,7 @@ function UseGuards(...guards) {
|
|
|
144
159
|
return target;
|
|
145
160
|
};
|
|
146
161
|
}
|
|
162
|
+
__name(UseGuards, "UseGuards");
|
|
147
163
|
function UseInterceptors(...interceptors) {
|
|
148
164
|
return (target, propertyKey, descriptor) => {
|
|
149
165
|
if (descriptor) {
|
|
@@ -154,6 +170,7 @@ function UseInterceptors(...interceptors) {
|
|
|
154
170
|
return target;
|
|
155
171
|
};
|
|
156
172
|
}
|
|
173
|
+
__name(UseInterceptors, "UseInterceptors");
|
|
157
174
|
function UsePipes(...pipes) {
|
|
158
175
|
return (target, propertyKey, descriptor) => {
|
|
159
176
|
if (descriptor) {
|
|
@@ -164,7 +181,8 @@ function UsePipes(...pipes) {
|
|
|
164
181
|
return target;
|
|
165
182
|
};
|
|
166
183
|
}
|
|
167
|
-
|
|
184
|
+
__name(UsePipes, "UsePipes");
|
|
185
|
+
var RouteParamtypes = /* @__PURE__ */ (function(RouteParamtypes2) {
|
|
168
186
|
RouteParamtypes2[RouteParamtypes2["REQUEST"] = 0] = "REQUEST";
|
|
169
187
|
RouteParamtypes2[RouteParamtypes2["RESPONSE"] = 1] = "RESPONSE";
|
|
170
188
|
RouteParamtypes2[RouteParamtypes2["NEXT"] = 2] = "NEXT";
|
|
@@ -180,7 +198,7 @@ var RouteParamtypes = /* @__PURE__ */ ((RouteParamtypes2) => {
|
|
|
180
198
|
RouteParamtypes2[RouteParamtypes2["CONTEXT"] = 12] = "CONTEXT";
|
|
181
199
|
RouteParamtypes2[RouteParamtypes2["CUSTOM"] = 13] = "CUSTOM";
|
|
182
200
|
return RouteParamtypes2;
|
|
183
|
-
})(
|
|
201
|
+
})({});
|
|
184
202
|
function assignMetadata(args, paramtype, index, data, ...pipes) {
|
|
185
203
|
return {
|
|
186
204
|
...args,
|
|
@@ -192,53 +210,50 @@ function assignMetadata(args, paramtype, index, data, ...pipes) {
|
|
|
192
210
|
}
|
|
193
211
|
};
|
|
194
212
|
}
|
|
213
|
+
__name(assignMetadata, "assignMetadata");
|
|
195
214
|
function createRouteParamDecorator(paramtype) {
|
|
196
215
|
return (data) => {
|
|
197
216
|
return (target, key, index) => {
|
|
198
217
|
const args = Reflect.getMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
|
199
|
-
Reflect.defineMetadata(
|
|
200
|
-
METADATA_KEYS.ROUTE_ARGS_METADATA,
|
|
201
|
-
assignMetadata(args, paramtype, index, data),
|
|
202
|
-
target.constructor,
|
|
203
|
-
key
|
|
204
|
-
);
|
|
218
|
+
Reflect.defineMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data), target.constructor, key);
|
|
205
219
|
};
|
|
206
220
|
};
|
|
207
221
|
}
|
|
222
|
+
__name(createRouteParamDecorator, "createRouteParamDecorator");
|
|
208
223
|
function createPipesRouteParamDecorator(paramtype) {
|
|
209
224
|
return (data, ...pipes) => {
|
|
210
225
|
return (target, key, index) => {
|
|
211
226
|
const args = Reflect.getMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
|
212
|
-
Reflect.defineMetadata(
|
|
213
|
-
METADATA_KEYS.ROUTE_ARGS_METADATA,
|
|
214
|
-
assignMetadata(args, paramtype, index, data, ...pipes),
|
|
215
|
-
target.constructor,
|
|
216
|
-
key
|
|
217
|
-
);
|
|
227
|
+
Reflect.defineMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data, ...pipes), target.constructor, key);
|
|
218
228
|
};
|
|
219
229
|
};
|
|
220
230
|
}
|
|
221
|
-
|
|
222
|
-
var
|
|
223
|
-
var
|
|
224
|
-
var
|
|
225
|
-
var
|
|
226
|
-
var
|
|
227
|
-
var
|
|
228
|
-
var
|
|
229
|
-
var
|
|
231
|
+
__name(createPipesRouteParamDecorator, "createPipesRouteParamDecorator");
|
|
232
|
+
var Request = createRouteParamDecorator(0);
|
|
233
|
+
var Response = createRouteParamDecorator(1);
|
|
234
|
+
var Next = createRouteParamDecorator(2);
|
|
235
|
+
var Session = createRouteParamDecorator(7);
|
|
236
|
+
var FileParam = createRouteParamDecorator(8);
|
|
237
|
+
var Files = createRouteParamDecorator(9);
|
|
238
|
+
var Ip = createRouteParamDecorator(11);
|
|
239
|
+
var HostParam = createRouteParamDecorator(10);
|
|
240
|
+
var Ctx = createRouteParamDecorator(12);
|
|
230
241
|
function Body(property, ...pipes) {
|
|
231
|
-
return createPipesRouteParamDecorator(3
|
|
242
|
+
return createPipesRouteParamDecorator(3)(property, ...pipes);
|
|
232
243
|
}
|
|
244
|
+
__name(Body, "Body");
|
|
233
245
|
function Query(property, ...pipes) {
|
|
234
|
-
return createPipesRouteParamDecorator(4
|
|
246
|
+
return createPipesRouteParamDecorator(4)(property, ...pipes);
|
|
235
247
|
}
|
|
248
|
+
__name(Query, "Query");
|
|
236
249
|
function Param(property, ...pipes) {
|
|
237
|
-
return createPipesRouteParamDecorator(5
|
|
250
|
+
return createPipesRouteParamDecorator(5)(property, ...pipes);
|
|
238
251
|
}
|
|
252
|
+
__name(Param, "Param");
|
|
239
253
|
function Headers(property, ...pipes) {
|
|
240
|
-
return createPipesRouteParamDecorator(6
|
|
254
|
+
return createPipesRouteParamDecorator(6)(property, ...pipes);
|
|
241
255
|
}
|
|
256
|
+
__name(Headers, "Headers");
|
|
242
257
|
function SetMetadata(metadataKey, metadataValue) {
|
|
243
258
|
return (target, key, descriptor) => {
|
|
244
259
|
if (descriptor) {
|
|
@@ -249,26 +264,36 @@ function SetMetadata(metadataKey, metadataValue) {
|
|
|
249
264
|
return target;
|
|
250
265
|
};
|
|
251
266
|
}
|
|
267
|
+
__name(SetMetadata, "SetMetadata");
|
|
252
268
|
function HttpCode(statusCode) {
|
|
253
269
|
return (target, key, descriptor) => {
|
|
254
270
|
Reflect.defineMetadata(METADATA_KEYS.HTTP_CODE, statusCode, descriptor.value);
|
|
255
271
|
return descriptor;
|
|
256
272
|
};
|
|
257
273
|
}
|
|
274
|
+
__name(HttpCode, "HttpCode");
|
|
258
275
|
function Header(name, value) {
|
|
259
276
|
return (target, key, descriptor) => {
|
|
260
277
|
const headers = Reflect.getMetadata(METADATA_KEYS.HEADERS, descriptor.value) || [];
|
|
261
|
-
headers.push({
|
|
278
|
+
headers.push({
|
|
279
|
+
name,
|
|
280
|
+
value
|
|
281
|
+
});
|
|
262
282
|
Reflect.defineMetadata(METADATA_KEYS.HEADERS, headers, descriptor.value);
|
|
263
283
|
return descriptor;
|
|
264
284
|
};
|
|
265
285
|
}
|
|
286
|
+
__name(Header, "Header");
|
|
266
287
|
function Redirect(url, statusCode = 302) {
|
|
267
288
|
return (target, key, descriptor) => {
|
|
268
|
-
Reflect.defineMetadata(METADATA_KEYS.REDIRECT, {
|
|
289
|
+
Reflect.defineMetadata(METADATA_KEYS.REDIRECT, {
|
|
290
|
+
url,
|
|
291
|
+
statusCode
|
|
292
|
+
}, descriptor.value);
|
|
269
293
|
return descriptor;
|
|
270
294
|
};
|
|
271
295
|
}
|
|
296
|
+
__name(Redirect, "Redirect");
|
|
272
297
|
function applyDecorators(...decorators) {
|
|
273
298
|
return (target, propertyKey, descriptor) => {
|
|
274
299
|
for (const decorator of decorators) {
|
|
@@ -284,20 +309,17 @@ function applyDecorators(...decorators) {
|
|
|
284
309
|
}
|
|
285
310
|
};
|
|
286
311
|
}
|
|
312
|
+
__name(applyDecorators, "applyDecorators");
|
|
287
313
|
function createParamDecorator(factory) {
|
|
288
|
-
const paramtype = 13
|
|
314
|
+
const paramtype = 13;
|
|
289
315
|
return (data) => {
|
|
290
316
|
return (target, key, index) => {
|
|
291
317
|
const args = Reflect.getMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
|
292
|
-
Reflect.defineMetadata(
|
|
293
|
-
METADATA_KEYS.ROUTE_ARGS_METADATA,
|
|
294
|
-
assignMetadata(args, paramtype, index, data, factory),
|
|
295
|
-
target.constructor,
|
|
296
|
-
key
|
|
297
|
-
);
|
|
318
|
+
Reflect.defineMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data, factory), target.constructor, key);
|
|
298
319
|
};
|
|
299
320
|
};
|
|
300
321
|
}
|
|
322
|
+
__name(createParamDecorator, "createParamDecorator");
|
|
301
323
|
|
|
302
324
|
exports.All = All;
|
|
303
325
|
exports.Body = Body;
|
package/dist/decorators.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
5
|
|
|
5
6
|
// src/constants.ts
|
|
6
7
|
var METADATA_KEYS = {
|
|
@@ -24,15 +25,15 @@ var METADATA_KEYS = {
|
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
// src/injector/scope.ts
|
|
27
|
-
var Scope = /* @__PURE__ */ ((Scope2)
|
|
28
|
+
var Scope = /* @__PURE__ */ (function(Scope2) {
|
|
28
29
|
Scope2[Scope2["DEFAULT"] = 0] = "DEFAULT";
|
|
29
30
|
Scope2[Scope2["TRANSIENT"] = 1] = "TRANSIENT";
|
|
30
31
|
Scope2[Scope2["REQUEST"] = 2] = "REQUEST";
|
|
31
32
|
return Scope2;
|
|
32
|
-
})(
|
|
33
|
+
})({});
|
|
33
34
|
|
|
34
35
|
// src/interfaces.ts
|
|
35
|
-
var RequestMethod = /* @__PURE__ */ ((RequestMethod2)
|
|
36
|
+
var RequestMethod = /* @__PURE__ */ (function(RequestMethod2) {
|
|
36
37
|
RequestMethod2["GET"] = "get";
|
|
37
38
|
RequestMethod2["POST"] = "post";
|
|
38
39
|
RequestMethod2["PUT"] = "put";
|
|
@@ -42,7 +43,7 @@ var RequestMethod = /* @__PURE__ */ ((RequestMethod2) => {
|
|
|
42
43
|
RequestMethod2["OPTIONS"] = "options";
|
|
43
44
|
RequestMethod2["HEAD"] = "head";
|
|
44
45
|
return RequestMethod2;
|
|
45
|
-
})(
|
|
46
|
+
})({});
|
|
46
47
|
|
|
47
48
|
// src/decorators.ts
|
|
48
49
|
function Global() {
|
|
@@ -50,22 +51,28 @@ function Global() {
|
|
|
50
51
|
Reflect.defineMetadata(METADATA_KEYS.GLOBAL, true, target);
|
|
51
52
|
};
|
|
52
53
|
}
|
|
54
|
+
__name(Global, "Global");
|
|
53
55
|
function Module(options) {
|
|
54
56
|
return (target) => {
|
|
55
57
|
Reflect.defineMetadata(METADATA_KEYS.MODULE, options, target);
|
|
56
58
|
};
|
|
57
59
|
}
|
|
60
|
+
__name(Module, "Module");
|
|
58
61
|
function Injectable(options) {
|
|
59
62
|
return (target) => {
|
|
60
|
-
Reflect.defineMetadata(METADATA_KEYS.SCOPE, options?.scope ??
|
|
63
|
+
Reflect.defineMetadata(METADATA_KEYS.SCOPE, options?.scope ?? Scope.DEFAULT, target);
|
|
61
64
|
};
|
|
62
65
|
}
|
|
66
|
+
__name(Injectable, "Injectable");
|
|
63
67
|
function Controller(prefix = "") {
|
|
64
68
|
return (target) => {
|
|
65
|
-
Reflect.defineMetadata(METADATA_KEYS.CONTROLLER, {
|
|
66
|
-
|
|
69
|
+
Reflect.defineMetadata(METADATA_KEYS.CONTROLLER, {
|
|
70
|
+
prefix
|
|
71
|
+
}, target);
|
|
72
|
+
Reflect.defineMetadata(METADATA_KEYS.SCOPE, Scope.DEFAULT, target);
|
|
67
73
|
};
|
|
68
74
|
}
|
|
75
|
+
__name(Controller, "Controller");
|
|
69
76
|
function createRouteDecorator(method) {
|
|
70
77
|
return (path = "/") => {
|
|
71
78
|
return (target, propertyKey, descriptor) => {
|
|
@@ -82,20 +89,22 @@ function createRouteDecorator(method) {
|
|
|
82
89
|
};
|
|
83
90
|
};
|
|
84
91
|
}
|
|
85
|
-
|
|
86
|
-
var
|
|
87
|
-
var
|
|
88
|
-
var
|
|
89
|
-
var
|
|
90
|
-
var
|
|
91
|
-
var
|
|
92
|
-
var
|
|
92
|
+
__name(createRouteDecorator, "createRouteDecorator");
|
|
93
|
+
var Get = createRouteDecorator(RequestMethod.GET);
|
|
94
|
+
var Post = createRouteDecorator(RequestMethod.POST);
|
|
95
|
+
var Put = createRouteDecorator(RequestMethod.PUT);
|
|
96
|
+
var Delete = createRouteDecorator(RequestMethod.DELETE);
|
|
97
|
+
var Patch = createRouteDecorator(RequestMethod.PATCH);
|
|
98
|
+
var Options = createRouteDecorator(RequestMethod.OPTIONS);
|
|
99
|
+
var Head = createRouteDecorator(RequestMethod.HEAD);
|
|
100
|
+
var All = createRouteDecorator(RequestMethod.ALL);
|
|
93
101
|
function Catch(...exceptions) {
|
|
94
102
|
return (target) => {
|
|
95
103
|
Reflect.defineMetadata(METADATA_KEYS.FILTER_CATCH, exceptions, target);
|
|
96
|
-
Reflect.defineMetadata(METADATA_KEYS.SCOPE,
|
|
104
|
+
Reflect.defineMetadata(METADATA_KEYS.SCOPE, Scope.DEFAULT, target);
|
|
97
105
|
};
|
|
98
106
|
}
|
|
107
|
+
__name(Catch, "Catch");
|
|
99
108
|
function UseFilters(...filters) {
|
|
100
109
|
return (target, propertyKey, descriptor) => {
|
|
101
110
|
if (descriptor) {
|
|
@@ -106,6 +115,7 @@ function UseFilters(...filters) {
|
|
|
106
115
|
return target;
|
|
107
116
|
};
|
|
108
117
|
}
|
|
118
|
+
__name(UseFilters, "UseFilters");
|
|
109
119
|
function Inject(token) {
|
|
110
120
|
return (target, propertyKey, parameterIndex) => {
|
|
111
121
|
if (parameterIndex !== void 0) {
|
|
@@ -114,11 +124,15 @@ function Inject(token) {
|
|
|
114
124
|
Reflect.defineMetadata(METADATA_KEYS.INJECTIONS, injections, target);
|
|
115
125
|
} else {
|
|
116
126
|
const properties = Reflect.getMetadata(METADATA_KEYS.PROPERTY_DEPS, target.constructor) || [];
|
|
117
|
-
properties.push({
|
|
127
|
+
properties.push({
|
|
128
|
+
key: propertyKey,
|
|
129
|
+
token
|
|
130
|
+
});
|
|
118
131
|
Reflect.defineMetadata(METADATA_KEYS.PROPERTY_DEPS, properties, target.constructor);
|
|
119
132
|
}
|
|
120
133
|
};
|
|
121
134
|
}
|
|
135
|
+
__name(Inject, "Inject");
|
|
122
136
|
function Optional() {
|
|
123
137
|
return (target, propertyKey, parameterIndex) => {
|
|
124
138
|
if (parameterIndex !== void 0) {
|
|
@@ -132,6 +146,7 @@ function Optional() {
|
|
|
132
146
|
}
|
|
133
147
|
};
|
|
134
148
|
}
|
|
149
|
+
__name(Optional, "Optional");
|
|
135
150
|
function UseGuards(...guards) {
|
|
136
151
|
return (target, propertyKey, descriptor) => {
|
|
137
152
|
if (descriptor) {
|
|
@@ -142,6 +157,7 @@ function UseGuards(...guards) {
|
|
|
142
157
|
return target;
|
|
143
158
|
};
|
|
144
159
|
}
|
|
160
|
+
__name(UseGuards, "UseGuards");
|
|
145
161
|
function UseInterceptors(...interceptors) {
|
|
146
162
|
return (target, propertyKey, descriptor) => {
|
|
147
163
|
if (descriptor) {
|
|
@@ -152,6 +168,7 @@ function UseInterceptors(...interceptors) {
|
|
|
152
168
|
return target;
|
|
153
169
|
};
|
|
154
170
|
}
|
|
171
|
+
__name(UseInterceptors, "UseInterceptors");
|
|
155
172
|
function UsePipes(...pipes) {
|
|
156
173
|
return (target, propertyKey, descriptor) => {
|
|
157
174
|
if (descriptor) {
|
|
@@ -162,7 +179,8 @@ function UsePipes(...pipes) {
|
|
|
162
179
|
return target;
|
|
163
180
|
};
|
|
164
181
|
}
|
|
165
|
-
|
|
182
|
+
__name(UsePipes, "UsePipes");
|
|
183
|
+
var RouteParamtypes = /* @__PURE__ */ (function(RouteParamtypes2) {
|
|
166
184
|
RouteParamtypes2[RouteParamtypes2["REQUEST"] = 0] = "REQUEST";
|
|
167
185
|
RouteParamtypes2[RouteParamtypes2["RESPONSE"] = 1] = "RESPONSE";
|
|
168
186
|
RouteParamtypes2[RouteParamtypes2["NEXT"] = 2] = "NEXT";
|
|
@@ -178,7 +196,7 @@ var RouteParamtypes = /* @__PURE__ */ ((RouteParamtypes2) => {
|
|
|
178
196
|
RouteParamtypes2[RouteParamtypes2["CONTEXT"] = 12] = "CONTEXT";
|
|
179
197
|
RouteParamtypes2[RouteParamtypes2["CUSTOM"] = 13] = "CUSTOM";
|
|
180
198
|
return RouteParamtypes2;
|
|
181
|
-
})(
|
|
199
|
+
})({});
|
|
182
200
|
function assignMetadata(args, paramtype, index, data, ...pipes) {
|
|
183
201
|
return {
|
|
184
202
|
...args,
|
|
@@ -190,53 +208,50 @@ function assignMetadata(args, paramtype, index, data, ...pipes) {
|
|
|
190
208
|
}
|
|
191
209
|
};
|
|
192
210
|
}
|
|
211
|
+
__name(assignMetadata, "assignMetadata");
|
|
193
212
|
function createRouteParamDecorator(paramtype) {
|
|
194
213
|
return (data) => {
|
|
195
214
|
return (target, key, index) => {
|
|
196
215
|
const args = Reflect.getMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
|
197
|
-
Reflect.defineMetadata(
|
|
198
|
-
METADATA_KEYS.ROUTE_ARGS_METADATA,
|
|
199
|
-
assignMetadata(args, paramtype, index, data),
|
|
200
|
-
target.constructor,
|
|
201
|
-
key
|
|
202
|
-
);
|
|
216
|
+
Reflect.defineMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data), target.constructor, key);
|
|
203
217
|
};
|
|
204
218
|
};
|
|
205
219
|
}
|
|
220
|
+
__name(createRouteParamDecorator, "createRouteParamDecorator");
|
|
206
221
|
function createPipesRouteParamDecorator(paramtype) {
|
|
207
222
|
return (data, ...pipes) => {
|
|
208
223
|
return (target, key, index) => {
|
|
209
224
|
const args = Reflect.getMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
|
210
|
-
Reflect.defineMetadata(
|
|
211
|
-
METADATA_KEYS.ROUTE_ARGS_METADATA,
|
|
212
|
-
assignMetadata(args, paramtype, index, data, ...pipes),
|
|
213
|
-
target.constructor,
|
|
214
|
-
key
|
|
215
|
-
);
|
|
225
|
+
Reflect.defineMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data, ...pipes), target.constructor, key);
|
|
216
226
|
};
|
|
217
227
|
};
|
|
218
228
|
}
|
|
219
|
-
|
|
220
|
-
var
|
|
221
|
-
var
|
|
222
|
-
var
|
|
223
|
-
var
|
|
224
|
-
var
|
|
225
|
-
var
|
|
226
|
-
var
|
|
227
|
-
var
|
|
229
|
+
__name(createPipesRouteParamDecorator, "createPipesRouteParamDecorator");
|
|
230
|
+
var Request = createRouteParamDecorator(0);
|
|
231
|
+
var Response = createRouteParamDecorator(1);
|
|
232
|
+
var Next = createRouteParamDecorator(2);
|
|
233
|
+
var Session = createRouteParamDecorator(7);
|
|
234
|
+
var FileParam = createRouteParamDecorator(8);
|
|
235
|
+
var Files = createRouteParamDecorator(9);
|
|
236
|
+
var Ip = createRouteParamDecorator(11);
|
|
237
|
+
var HostParam = createRouteParamDecorator(10);
|
|
238
|
+
var Ctx = createRouteParamDecorator(12);
|
|
228
239
|
function Body(property, ...pipes) {
|
|
229
|
-
return createPipesRouteParamDecorator(3
|
|
240
|
+
return createPipesRouteParamDecorator(3)(property, ...pipes);
|
|
230
241
|
}
|
|
242
|
+
__name(Body, "Body");
|
|
231
243
|
function Query(property, ...pipes) {
|
|
232
|
-
return createPipesRouteParamDecorator(4
|
|
244
|
+
return createPipesRouteParamDecorator(4)(property, ...pipes);
|
|
233
245
|
}
|
|
246
|
+
__name(Query, "Query");
|
|
234
247
|
function Param(property, ...pipes) {
|
|
235
|
-
return createPipesRouteParamDecorator(5
|
|
248
|
+
return createPipesRouteParamDecorator(5)(property, ...pipes);
|
|
236
249
|
}
|
|
250
|
+
__name(Param, "Param");
|
|
237
251
|
function Headers(property, ...pipes) {
|
|
238
|
-
return createPipesRouteParamDecorator(6
|
|
252
|
+
return createPipesRouteParamDecorator(6)(property, ...pipes);
|
|
239
253
|
}
|
|
254
|
+
__name(Headers, "Headers");
|
|
240
255
|
function SetMetadata(metadataKey, metadataValue) {
|
|
241
256
|
return (target, key, descriptor) => {
|
|
242
257
|
if (descriptor) {
|
|
@@ -247,26 +262,36 @@ function SetMetadata(metadataKey, metadataValue) {
|
|
|
247
262
|
return target;
|
|
248
263
|
};
|
|
249
264
|
}
|
|
265
|
+
__name(SetMetadata, "SetMetadata");
|
|
250
266
|
function HttpCode(statusCode) {
|
|
251
267
|
return (target, key, descriptor) => {
|
|
252
268
|
Reflect.defineMetadata(METADATA_KEYS.HTTP_CODE, statusCode, descriptor.value);
|
|
253
269
|
return descriptor;
|
|
254
270
|
};
|
|
255
271
|
}
|
|
272
|
+
__name(HttpCode, "HttpCode");
|
|
256
273
|
function Header(name, value) {
|
|
257
274
|
return (target, key, descriptor) => {
|
|
258
275
|
const headers = Reflect.getMetadata(METADATA_KEYS.HEADERS, descriptor.value) || [];
|
|
259
|
-
headers.push({
|
|
276
|
+
headers.push({
|
|
277
|
+
name,
|
|
278
|
+
value
|
|
279
|
+
});
|
|
260
280
|
Reflect.defineMetadata(METADATA_KEYS.HEADERS, headers, descriptor.value);
|
|
261
281
|
return descriptor;
|
|
262
282
|
};
|
|
263
283
|
}
|
|
284
|
+
__name(Header, "Header");
|
|
264
285
|
function Redirect(url, statusCode = 302) {
|
|
265
286
|
return (target, key, descriptor) => {
|
|
266
|
-
Reflect.defineMetadata(METADATA_KEYS.REDIRECT, {
|
|
287
|
+
Reflect.defineMetadata(METADATA_KEYS.REDIRECT, {
|
|
288
|
+
url,
|
|
289
|
+
statusCode
|
|
290
|
+
}, descriptor.value);
|
|
267
291
|
return descriptor;
|
|
268
292
|
};
|
|
269
293
|
}
|
|
294
|
+
__name(Redirect, "Redirect");
|
|
270
295
|
function applyDecorators(...decorators) {
|
|
271
296
|
return (target, propertyKey, descriptor) => {
|
|
272
297
|
for (const decorator of decorators) {
|
|
@@ -282,19 +307,16 @@ function applyDecorators(...decorators) {
|
|
|
282
307
|
}
|
|
283
308
|
};
|
|
284
309
|
}
|
|
310
|
+
__name(applyDecorators, "applyDecorators");
|
|
285
311
|
function createParamDecorator(factory) {
|
|
286
|
-
const paramtype = 13
|
|
312
|
+
const paramtype = 13;
|
|
287
313
|
return (data) => {
|
|
288
314
|
return (target, key, index) => {
|
|
289
315
|
const args = Reflect.getMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
|
290
|
-
Reflect.defineMetadata(
|
|
291
|
-
METADATA_KEYS.ROUTE_ARGS_METADATA,
|
|
292
|
-
assignMetadata(args, paramtype, index, data, factory),
|
|
293
|
-
target.constructor,
|
|
294
|
-
key
|
|
295
|
-
);
|
|
316
|
+
Reflect.defineMetadata(METADATA_KEYS.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data, factory), target.constructor, key);
|
|
296
317
|
};
|
|
297
318
|
};
|
|
298
319
|
}
|
|
320
|
+
__name(createParamDecorator, "createParamDecorator");
|
|
299
321
|
|
|
300
322
|
export { All, Body, Catch, Controller, Ctx, Delete, FileParam, Files, Get, Global, Head, Header, Headers, HostParam, HttpCode, Inject, Injectable, Ip, Module, Next, Optional, Options, Param, Patch, Post, Put, Query, Redirect, Request, RequestMethod, Response, RouteParamtypes, Scope, Session, SetMetadata, UseFilters, UseGuards, UseInterceptors, UsePipes, applyDecorators, assignMetadata, createParamDecorator };
|