@feathersjs/typebox 5.0.6 → 5.0.8
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/CHANGELOG.md +16 -0
- package/lib/index.js.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +17 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [5.0.8](https://github.com/feathersjs/feathers/compare/v5.0.7...v5.0.8) (2023-07-19)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @feathersjs/typebox
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [5.0.7](https://github.com/feathersjs/feathers/compare/v5.0.6...v5.0.7) (2023-07-14)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @feathersjs/typebox
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [5.0.6](https://github.com/feathersjs/feathers/compare/v5.0.5...v5.0.6) (2023-06-15)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @feathersjs/typebox
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAA0G;AAC1G,+CAAiF;AAEjF,oDAAiC;AACjC,oDAAiC;AAQjC;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,CAAiB,MAA4B,EAAE,SAAc,EAAmB,EAAE,CAC5G,mBAAU,CAAC,YAAY,CAAC,MAAa,EAAE,SAAS,CAAC,CAAA;AADtC,QAAA,YAAY,gBAC0B;AAEnD;;;;;;;;;GASG;AACI,MAAM,gBAAgB,GAAG,CAAC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AAA;AADpF,QAAA,cAAc,kBACsE"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersjs/typebox",
|
|
3
3
|
"description": "TypeBox integration for @feathersjs/schema",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.8",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
6
|
"main": "lib/",
|
|
7
7
|
"types": "lib/",
|
|
@@ -54,15 +54,15 @@
|
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@feathersjs/schema": "^5.0.
|
|
57
|
+
"@feathersjs/schema": "^5.0.8",
|
|
58
58
|
"@sinclair/typebox": "^0.25.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/mocha": "^10.0.1",
|
|
62
|
-
"@types/node": "^20.
|
|
62
|
+
"@types/node": "^20.4.2",
|
|
63
63
|
"mocha": "^10.2.0",
|
|
64
64
|
"shx": "^0.3.4",
|
|
65
|
-
"typescript": "^5.1.
|
|
65
|
+
"typescript": "^5.1.6"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "414336a047a556f1986b4bb253416d5b8a973d9f"
|
|
68
68
|
}
|
package/src/index.ts
CHANGED
|
@@ -61,13 +61,16 @@ const arrayOfKeys = <T extends TObject>(type: T) => {
|
|
|
61
61
|
* @returns The `$sort` syntax schema
|
|
62
62
|
*/
|
|
63
63
|
export function sortDefinition<T extends TObject>(schema: T) {
|
|
64
|
-
const properties = Object.keys(schema.properties).reduce(
|
|
65
|
-
|
|
64
|
+
const properties = Object.keys(schema.properties).reduce(
|
|
65
|
+
(res, key) => {
|
|
66
|
+
const result = res as any
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
result[key] = Type.Optional(Type.Integer({ minimum: -1, maximum: 1 }))
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
return result
|
|
71
|
+
},
|
|
72
|
+
{} as { [K in keyof T['properties']]: TOptional<TInteger> }
|
|
73
|
+
)
|
|
71
74
|
|
|
72
75
|
return Type.Object(properties, { additionalProperties: false })
|
|
73
76
|
}
|
|
@@ -125,14 +128,17 @@ export const queryProperties = <
|
|
|
125
128
|
definition: T,
|
|
126
129
|
extensions: X = {} as X
|
|
127
130
|
) => {
|
|
128
|
-
const properties = Object.keys(definition.properties).reduce(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
const properties = Object.keys(definition.properties).reduce(
|
|
132
|
+
(res, key) => {
|
|
133
|
+
const result = res as any
|
|
134
|
+
const value = definition.properties[key]
|
|
131
135
|
|
|
132
|
-
|
|
136
|
+
result[key] = queryProperty(value, extensions[key])
|
|
133
137
|
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
return result
|
|
139
|
+
},
|
|
140
|
+
{} as { [K in keyof T['properties']]: QueryProperty<T['properties'][K], X[K]> }
|
|
141
|
+
)
|
|
136
142
|
|
|
137
143
|
return Type.Optional(Type.Object(properties, { additionalProperties: false }))
|
|
138
144
|
}
|