bootpress 9.0.1 → 9.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/README.md +12 -4
- package/index.js +15 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -219,7 +219,15 @@ There must be only one element in an array schema which defines ````ArrayOf<Sche
|
|
|
219
219
|
### **asStrict(any, string | object | array)**
|
|
220
220
|
Same as 'as' method but doesn't try to parse different types instead throws error.
|
|
221
221
|
|
|
222
|
-
|
|
222
|
+
# Release Notes
|
|
223
|
+
|
|
224
|
+
## v9.0.2:
|
|
225
|
+
- Added support for null/undefined returning async functions
|
|
226
|
+
|
|
227
|
+
## v9.0.1:
|
|
228
|
+
- Fixed errors in argument passers
|
|
229
|
+
|
|
230
|
+
## v9.0.0:
|
|
223
231
|
- New Feature:
|
|
224
232
|
- Type checking for each argument while passing arguments to service methods
|
|
225
233
|
- Deprecated:
|
|
@@ -228,14 +236,14 @@ Same as 'as' method but doesn't try to parse different types instead throws erro
|
|
|
228
236
|
- Added:
|
|
229
237
|
- PassQuery, PassCookie, PassParam
|
|
230
238
|
|
|
231
|
-
## v8.0.0
|
|
239
|
+
## v8.0.0:
|
|
232
240
|
- Added support for async service functions. (You don't need to await if you wrapped your service with Bootpress functions)
|
|
233
241
|
- Bugfix for falsy response values
|
|
234
242
|
- Simplified implementation
|
|
235
243
|
|
|
236
|
-
## v7.1.0
|
|
244
|
+
## v7.1.0:
|
|
237
245
|
- getOrThrow: Throws specified error when value is an empty array too.
|
|
238
|
-
## v7.0.0
|
|
246
|
+
## v7.0.0:
|
|
239
247
|
|
|
240
248
|
### Deprecated helper methods:
|
|
241
249
|
- asSchema
|
package/index.js
CHANGED
|
@@ -42,7 +42,11 @@ function RestService(service) {
|
|
|
42
42
|
}
|
|
43
43
|
else if (result instanceof Promise) {
|
|
44
44
|
result.then(r => {
|
|
45
|
-
|
|
45
|
+
if (r == undefined) {
|
|
46
|
+
reply(res, 204, null);
|
|
47
|
+
} else {
|
|
48
|
+
reply(res, r.status ?? 200, r.data ?? r);
|
|
49
|
+
}
|
|
46
50
|
}).catch(e => {
|
|
47
51
|
reply(res, e.status ?? 500, e.message ?? e);
|
|
48
52
|
})
|
|
@@ -70,7 +74,11 @@ function RestMethod(callback) {
|
|
|
70
74
|
}
|
|
71
75
|
else if (result instanceof Promise) {
|
|
72
76
|
result.then(r => {
|
|
73
|
-
|
|
77
|
+
if (r == undefined) {
|
|
78
|
+
reply(res, 204, undefined);
|
|
79
|
+
} else {
|
|
80
|
+
reply(res, r.status ?? 200, r.data ?? r);
|
|
81
|
+
}
|
|
74
82
|
}).catch(e => {
|
|
75
83
|
reply(res, e.status ?? 500, e.message ?? e);
|
|
76
84
|
})
|
|
@@ -96,7 +104,11 @@ function Restify(target, key, desc) {
|
|
|
96
104
|
}
|
|
97
105
|
else if (result instanceof Promise) {
|
|
98
106
|
result.then(r => {
|
|
99
|
-
|
|
107
|
+
if (r == undefined) {
|
|
108
|
+
reply(res, 204, null);
|
|
109
|
+
} else {
|
|
110
|
+
reply(res, r.status ?? 200, r.data ?? r);
|
|
111
|
+
}
|
|
100
112
|
}).catch(e => {
|
|
101
113
|
reply(res, e.status ?? 500, e.message ?? e);
|
|
102
114
|
})
|