@pbvision/fastify-firestore-service 0.0.3 → 0.0.5
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/docs/api.md +1 -1
- package/package.json +2 -2
- package/src/api/api.js +8 -8
- package/src/api/db-api.js +1 -1
- package/src/api/exception.js +2 -2
- package/test/environment.js +1 -1
package/docs/api.md
CHANGED
|
@@ -93,7 +93,7 @@ Notice that inputs can be configured to use a default value if none is provided
|
|
|
93
93
|
(see `num2`). Inputs can also be configured to just have their value be
|
|
94
94
|
undefined if omitted with the `optional()` marker (see `more`).
|
|
95
95
|
|
|
96
|
-
The `BODY`, `PATH_PARAMS`, `HEADERS`, and `QS` properties all support a mapping of field names to
|
|
96
|
+
The `BODY`, `PATH_PARAMS`, `HEADERS`, and `QS` properties all support a mapping of field names to Schema objects. For advanced usages like specifying a default value or description, the mapping can be replaced with an Object schema `S.obj({})`. For example:
|
|
97
97
|
```javascript
|
|
98
98
|
static BODY = S.obj({ a: S.str })
|
|
99
99
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pbvision/fastify-firestore-service",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Web Framework using Fastify and Firestore ORM",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"debug": "./node_modules/nodemon/bin/nodemon.js --no-lazy --legacy-watch --watch ./src --watch ./examples --watch ./test --inspect=9229 ./node_modules/jest/bin/jest.js --coverage --config=./jest.config.json --runInBand",
|
|
14
14
|
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --config=./jest.config.json --coverage",
|
|
15
15
|
"setup": "yarn install --frozen-lockfile && pip install -r requirements.txt",
|
|
16
|
-
"start-local-db": "./node_modules/firestore-orm/scripts/start-local-db.sh"
|
|
16
|
+
"start-local-db": "./node_modules/@pbvision/firestore-orm/scripts/start-local-db.sh"
|
|
17
17
|
},
|
|
18
18
|
"contributors": [
|
|
19
19
|
"David Underhill",
|
package/src/api/api.js
CHANGED
|
@@ -158,25 +158,25 @@ class API {
|
|
|
158
158
|
static TAG = undefined
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
|
-
* The
|
|
161
|
+
* The Schema describing the HTTP headers this API handles, if any.
|
|
162
162
|
* @public
|
|
163
163
|
*/
|
|
164
164
|
static HEADERS = undefined
|
|
165
165
|
|
|
166
166
|
/**
|
|
167
|
-
* The
|
|
167
|
+
* The Schema describing the path params this API handles, if any.
|
|
168
168
|
* @public
|
|
169
169
|
*/
|
|
170
170
|
static PATH_PARAMS = undefined
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
|
-
* The
|
|
173
|
+
* The Schema describing the query string this API handles, if any.
|
|
174
174
|
* @public
|
|
175
175
|
*/
|
|
176
176
|
static QS = undefined
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
|
-
* The
|
|
179
|
+
* The Schema describing the request body this API handles. Note that
|
|
180
180
|
* GET requests should not have request bodies. Use HTTP POST requests if
|
|
181
181
|
* request data size is too big to fit in the query string.
|
|
182
182
|
* @public
|
|
@@ -520,7 +520,7 @@ class API {
|
|
|
520
520
|
/**
|
|
521
521
|
* Removes the required marker from any top-level properties which have a
|
|
522
522
|
* default value.
|
|
523
|
-
* @param {
|
|
523
|
+
* @param {Schema} schema a Schema object
|
|
524
524
|
* @private
|
|
525
525
|
*/
|
|
526
526
|
static __makeParamsWithDefaultValuesOptional (schema) {
|
|
@@ -548,7 +548,7 @@ class API {
|
|
|
548
548
|
static _getHeaders () {
|
|
549
549
|
let headers = this.HEADERS
|
|
550
550
|
if (headers) {
|
|
551
|
-
headers = headers.
|
|
551
|
+
headers = headers.isSchema
|
|
552
552
|
? headers
|
|
553
553
|
: S.obj(headers)
|
|
554
554
|
}
|
|
@@ -603,7 +603,7 @@ class API {
|
|
|
603
603
|
}
|
|
604
604
|
|
|
605
605
|
/**
|
|
606
|
-
* Return a mapping from status code to
|
|
606
|
+
* Return a mapping from status code to Schemas.
|
|
607
607
|
* @private
|
|
608
608
|
*/
|
|
609
609
|
static _getResponseSchemas () {
|
|
@@ -680,7 +680,7 @@ class API {
|
|
|
680
680
|
/** @private */
|
|
681
681
|
static get swaggerSchema () {
|
|
682
682
|
const wrapInSchema = (x) => {
|
|
683
|
-
return x.
|
|
683
|
+
return x.isSchema ? x : S.obj(x)
|
|
684
684
|
}
|
|
685
685
|
|
|
686
686
|
// istanbul ignore next
|
package/src/api/db-api.js
CHANGED
package/src/api/exception.js
CHANGED
|
@@ -39,11 +39,11 @@ class __RequestDone extends Error {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* Gets a
|
|
42
|
+
* Gets a Schema object.
|
|
43
43
|
*/
|
|
44
44
|
static get schema () {
|
|
45
45
|
let schema = this.SCHEMA
|
|
46
|
-
if (!schema.
|
|
46
|
+
if (!schema.isSchema) {
|
|
47
47
|
schema = S.obj(schema)
|
|
48
48
|
}
|
|
49
49
|
return schema
|
package/test/environment.js
CHANGED