@e22m4u/ts-rest-router 0.2.5 → 0.2.6
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/index.cjs +7 -7
- package/dist/esm/decorators/request-data/request-data-decorator.js +7 -7
- package/dist/esm/decorators/request-data/request-data-decorator.spec.js +4 -4
- package/package.json +1 -1
- package/src/decorators/request-data/request-data-decorator.spec.ts +4 -4
- package/src/decorators/request-data/request-data-decorator.ts +7 -1
package/dist/cjs/index.cjs
CHANGED
@@ -306,7 +306,7 @@ function createRequestDataDecoratorWithSource(source) {
|
|
306
306
|
};
|
307
307
|
}
|
308
308
|
__name(createRequestDataDecoratorWithSource, "createRequestDataDecoratorWithSource");
|
309
|
-
function createRequestDataPropertyDecoratorWithSource(source) {
|
309
|
+
function createRequestDataPropertyDecoratorWithSource(source, defaultType) {
|
310
310
|
return function(propertyKey, schemaOrType) {
|
311
311
|
const properties = {};
|
312
312
|
const rootSchema = { type: import_ts_data_schema.DataType.OBJECT };
|
@@ -317,7 +317,7 @@ function createRequestDataPropertyDecoratorWithSource(source) {
|
|
317
317
|
properties[propertyKey] = { type: schemaOrType };
|
318
318
|
rootSchema.properties = properties;
|
319
319
|
} else {
|
320
|
-
properties[propertyKey] = { type:
|
320
|
+
properties[propertyKey] = { type: defaultType };
|
321
321
|
rootSchema.properties = properties;
|
322
322
|
}
|
323
323
|
return requestData({
|
@@ -329,15 +329,15 @@ function createRequestDataPropertyDecoratorWithSource(source) {
|
|
329
329
|
}
|
330
330
|
__name(createRequestDataPropertyDecoratorWithSource, "createRequestDataPropertyDecoratorWithSource");
|
331
331
|
var requestParams = createRequestDataDecoratorWithSource(RequestDataSource.PARAMS);
|
332
|
-
var requestParam = createRequestDataPropertyDecoratorWithSource(RequestDataSource.PARAMS);
|
332
|
+
var requestParam = createRequestDataPropertyDecoratorWithSource(RequestDataSource.PARAMS, import_ts_data_schema.DataType.STRING);
|
333
333
|
var requestQueries = createRequestDataDecoratorWithSource(RequestDataSource.QUERY);
|
334
|
-
var requestQuery = createRequestDataPropertyDecoratorWithSource(RequestDataSource.QUERY);
|
334
|
+
var requestQuery = createRequestDataPropertyDecoratorWithSource(RequestDataSource.QUERY, import_ts_data_schema.DataType.STRING);
|
335
335
|
var requestHeaders = createRequestDataDecoratorWithSource(RequestDataSource.HEADERS);
|
336
|
-
var requestHeader = createRequestDataPropertyDecoratorWithSource(RequestDataSource.HEADERS);
|
336
|
+
var requestHeader = createRequestDataPropertyDecoratorWithSource(RequestDataSource.HEADERS, import_ts_data_schema.DataType.STRING);
|
337
337
|
var requestCookies = createRequestDataDecoratorWithSource(RequestDataSource.COOKIE);
|
338
|
-
var requestCookie = createRequestDataPropertyDecoratorWithSource(RequestDataSource.COOKIE);
|
338
|
+
var requestCookie = createRequestDataPropertyDecoratorWithSource(RequestDataSource.COOKIE, import_ts_data_schema.DataType.STRING);
|
339
339
|
var requestBody = createRequestDataDecoratorWithSource(RequestDataSource.BODY);
|
340
|
-
var requestField = createRequestDataPropertyDecoratorWithSource(RequestDataSource.BODY);
|
340
|
+
var requestField = createRequestDataPropertyDecoratorWithSource(RequestDataSource.BODY, import_ts_data_schema.DataType.ANY);
|
341
341
|
|
342
342
|
// dist/esm/decorators/after-action/after-action-metadata.js
|
343
343
|
var import_ts_reflector9 = require("@e22m4u/ts-reflector");
|
@@ -42,7 +42,7 @@ function createRequestDataDecoratorWithSource(source) {
|
|
42
42
|
*
|
43
43
|
* @param source
|
44
44
|
*/
|
45
|
-
function createRequestDataPropertyDecoratorWithSource(source) {
|
45
|
+
function createRequestDataPropertyDecoratorWithSource(source, defaultType) {
|
46
46
|
return function (propertyKey, schemaOrType) {
|
47
47
|
const properties = {};
|
48
48
|
const rootSchema = { type: DataType.OBJECT };
|
@@ -55,7 +55,7 @@ function createRequestDataPropertyDecoratorWithSource(source) {
|
|
55
55
|
rootSchema.properties = properties;
|
56
56
|
}
|
57
57
|
else {
|
58
|
-
properties[propertyKey] = { type:
|
58
|
+
properties[propertyKey] = { type: defaultType };
|
59
59
|
rootSchema.properties = properties;
|
60
60
|
}
|
61
61
|
return requestData({
|
@@ -69,12 +69,12 @@ function createRequestDataPropertyDecoratorWithSource(source) {
|
|
69
69
|
* Decorator aliases.
|
70
70
|
*/
|
71
71
|
export const requestParams = createRequestDataDecoratorWithSource(RequestDataSource.PARAMS);
|
72
|
-
export const requestParam = createRequestDataPropertyDecoratorWithSource(RequestDataSource.PARAMS);
|
72
|
+
export const requestParam = createRequestDataPropertyDecoratorWithSource(RequestDataSource.PARAMS, DataType.STRING);
|
73
73
|
export const requestQueries = createRequestDataDecoratorWithSource(RequestDataSource.QUERY);
|
74
|
-
export const requestQuery = createRequestDataPropertyDecoratorWithSource(RequestDataSource.QUERY);
|
74
|
+
export const requestQuery = createRequestDataPropertyDecoratorWithSource(RequestDataSource.QUERY, DataType.STRING);
|
75
75
|
export const requestHeaders = createRequestDataDecoratorWithSource(RequestDataSource.HEADERS);
|
76
|
-
export const requestHeader = createRequestDataPropertyDecoratorWithSource(RequestDataSource.HEADERS);
|
76
|
+
export const requestHeader = createRequestDataPropertyDecoratorWithSource(RequestDataSource.HEADERS, DataType.STRING);
|
77
77
|
export const requestCookies = createRequestDataDecoratorWithSource(RequestDataSource.COOKIE);
|
78
|
-
export const requestCookie = createRequestDataPropertyDecoratorWithSource(RequestDataSource.COOKIE);
|
78
|
+
export const requestCookie = createRequestDataPropertyDecoratorWithSource(RequestDataSource.COOKIE, DataType.STRING);
|
79
79
|
export const requestBody = createRequestDataDecoratorWithSource(RequestDataSource.BODY);
|
80
|
-
export const requestField = createRequestDataPropertyDecoratorWithSource(RequestDataSource.BODY);
|
80
|
+
export const requestField = createRequestDataPropertyDecoratorWithSource(RequestDataSource.BODY, DataType.ANY);
|
@@ -203,7 +203,7 @@ describe('requestData', function () {
|
|
203
203
|
type: DataType.OBJECT,
|
204
204
|
properties: {
|
205
205
|
[propertyKey]: {
|
206
|
-
type: DataType.
|
206
|
+
type: DataType.STRING,
|
207
207
|
},
|
208
208
|
},
|
209
209
|
},
|
@@ -283,7 +283,7 @@ describe('requestData', function () {
|
|
283
283
|
type: DataType.OBJECT,
|
284
284
|
properties: {
|
285
285
|
[propertyKey]: {
|
286
|
-
type: DataType.
|
286
|
+
type: DataType.STRING,
|
287
287
|
},
|
288
288
|
},
|
289
289
|
},
|
@@ -363,7 +363,7 @@ describe('requestData', function () {
|
|
363
363
|
type: DataType.OBJECT,
|
364
364
|
properties: {
|
365
365
|
[propertyKey]: {
|
366
|
-
type: DataType.
|
366
|
+
type: DataType.STRING,
|
367
367
|
},
|
368
368
|
},
|
369
369
|
},
|
@@ -443,7 +443,7 @@ describe('requestData', function () {
|
|
443
443
|
type: DataType.OBJECT,
|
444
444
|
properties: {
|
445
445
|
[propertyKey]: {
|
446
|
-
type: DataType.
|
446
|
+
type: DataType.STRING,
|
447
447
|
},
|
448
448
|
},
|
449
449
|
},
|
package/package.json
CHANGED
@@ -174,7 +174,7 @@ describe('requestData', function () {
|
|
174
174
|
type: DataType.OBJECT,
|
175
175
|
properties: {
|
176
176
|
[propertyKey]: {
|
177
|
-
type: DataType.
|
177
|
+
type: DataType.STRING,
|
178
178
|
},
|
179
179
|
},
|
180
180
|
},
|
@@ -248,7 +248,7 @@ describe('requestData', function () {
|
|
248
248
|
type: DataType.OBJECT,
|
249
249
|
properties: {
|
250
250
|
[propertyKey]: {
|
251
|
-
type: DataType.
|
251
|
+
type: DataType.STRING,
|
252
252
|
},
|
253
253
|
},
|
254
254
|
},
|
@@ -322,7 +322,7 @@ describe('requestData', function () {
|
|
322
322
|
type: DataType.OBJECT,
|
323
323
|
properties: {
|
324
324
|
[propertyKey]: {
|
325
|
-
type: DataType.
|
325
|
+
type: DataType.STRING,
|
326
326
|
},
|
327
327
|
},
|
328
328
|
},
|
@@ -396,7 +396,7 @@ describe('requestData', function () {
|
|
396
396
|
type: DataType.OBJECT,
|
397
397
|
properties: {
|
398
398
|
[propertyKey]: {
|
399
|
-
type: DataType.
|
399
|
+
type: DataType.STRING,
|
400
400
|
},
|
401
401
|
},
|
402
402
|
},
|
@@ -62,6 +62,7 @@ function createRequestDataDecoratorWithSource(source: RequestDataSource) {
|
|
62
62
|
*/
|
63
63
|
function createRequestDataPropertyDecoratorWithSource(
|
64
64
|
source: RequestDataSource,
|
65
|
+
defaultType: DataType,
|
65
66
|
) {
|
66
67
|
return function (propertyKey: string, schemaOrType?: DataSchema | DataType) {
|
67
68
|
const properties = {} as NoUndef<DataSchema['properties']>;
|
@@ -73,7 +74,7 @@ function createRequestDataPropertyDecoratorWithSource(
|
|
73
74
|
properties[propertyKey] = {type: schemaOrType};
|
74
75
|
rootSchema.properties = properties;
|
75
76
|
} else {
|
76
|
-
properties[propertyKey] = {type:
|
77
|
+
properties[propertyKey] = {type: defaultType};
|
77
78
|
rootSchema.properties = properties;
|
78
79
|
}
|
79
80
|
return requestData({
|
@@ -92,28 +93,33 @@ export const requestParams = createRequestDataDecoratorWithSource(
|
|
92
93
|
);
|
93
94
|
export const requestParam = createRequestDataPropertyDecoratorWithSource(
|
94
95
|
RequestDataSource.PARAMS,
|
96
|
+
DataType.STRING,
|
95
97
|
);
|
96
98
|
export const requestQueries = createRequestDataDecoratorWithSource(
|
97
99
|
RequestDataSource.QUERY,
|
98
100
|
);
|
99
101
|
export const requestQuery = createRequestDataPropertyDecoratorWithSource(
|
100
102
|
RequestDataSource.QUERY,
|
103
|
+
DataType.STRING,
|
101
104
|
);
|
102
105
|
export const requestHeaders = createRequestDataDecoratorWithSource(
|
103
106
|
RequestDataSource.HEADERS,
|
104
107
|
);
|
105
108
|
export const requestHeader = createRequestDataPropertyDecoratorWithSource(
|
106
109
|
RequestDataSource.HEADERS,
|
110
|
+
DataType.STRING,
|
107
111
|
);
|
108
112
|
export const requestCookies = createRequestDataDecoratorWithSource(
|
109
113
|
RequestDataSource.COOKIE,
|
110
114
|
);
|
111
115
|
export const requestCookie = createRequestDataPropertyDecoratorWithSource(
|
112
116
|
RequestDataSource.COOKIE,
|
117
|
+
DataType.STRING,
|
113
118
|
);
|
114
119
|
export const requestBody = createRequestDataDecoratorWithSource(
|
115
120
|
RequestDataSource.BODY,
|
116
121
|
);
|
117
122
|
export const requestField = createRequestDataPropertyDecoratorWithSource(
|
118
123
|
RequestDataSource.BODY,
|
124
|
+
DataType.ANY,
|
119
125
|
);
|