@feathersjs/typebox 5.0.27 → 5.0.29
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 +8 -0
- package/lib/index.d.ts +48 -48
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.29](https://github.com/feathersjs/feathers/compare/v5.0.28...v5.0.29) (2024-07-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @feathersjs/typebox
|
|
9
|
+
|
|
10
|
+
## [5.0.28](https://github.com/feathersjs/feathers/compare/v5.0.27...v5.0.28) (2024-07-10)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @feathersjs/typebox
|
|
13
|
+
|
|
6
14
|
## [5.0.27](https://github.com/feathersjs/feathers/compare/v5.0.26...v5.0.27) (2024-06-18)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @feathersjs/typebox
|
package/lib/index.d.ts
CHANGED
|
@@ -67,17 +67,17 @@ export declare const queryProperty: <T extends TSchema, X extends {
|
|
|
67
67
|
* @param extensions Additional properties to add to a property query
|
|
68
68
|
* @returns The Feathers query syntax schema
|
|
69
69
|
*/
|
|
70
|
-
export declare const queryProperties: <T extends TObject
|
|
70
|
+
export declare const queryProperties: <T extends TObject, X extends { [K in keyof T["properties"]]?: {
|
|
71
71
|
[key: string]: TSchema;
|
|
72
|
-
}; }>(definition: T, extensions?: X) => TOptional<TObject<{ [
|
|
73
|
-
$gt: T["properties"][
|
|
74
|
-
$gte: T["properties"][
|
|
75
|
-
$lt: T["properties"][
|
|
76
|
-
$lte: T["properties"][
|
|
77
|
-
$ne: T["properties"][
|
|
78
|
-
$in: T["properties"][
|
|
79
|
-
$nin: T["properties"][
|
|
80
|
-
}>, TObject<X[
|
|
72
|
+
}; }>(definition: T, extensions?: X) => TOptional<TObject<{ [K in keyof T["properties"]]: TOptional<TUnion<[T["properties"][K], import("@sinclair/typebox").TPartial<TIntersect<[TObject<{
|
|
73
|
+
$gt: T["properties"][K];
|
|
74
|
+
$gte: T["properties"][K];
|
|
75
|
+
$lt: T["properties"][K];
|
|
76
|
+
$lte: T["properties"][K];
|
|
77
|
+
$ne: T["properties"][K];
|
|
78
|
+
$in: T["properties"][K] | import("@sinclair/typebox").TArray<T["properties"][K]>;
|
|
79
|
+
$nin: T["properties"][K] | import("@sinclair/typebox").TArray<T["properties"][K]>;
|
|
80
|
+
}>, TObject<X[K]>]>>]>>; }>>;
|
|
81
81
|
/**
|
|
82
82
|
* Creates a TypeBox schema for the complete Feathers query syntax including `$limit`, $skip`, `$or`
|
|
83
83
|
* and `$sort` and `$select` for the allowed properties.
|
|
@@ -87,48 +87,48 @@ export declare const queryProperties: <T extends TObject<import("@sinclair/typeb
|
|
|
87
87
|
* @param options Options for the TypeBox object schema
|
|
88
88
|
* @returns A TypeBox object representing the complete Feathers query syntax for the given properties
|
|
89
89
|
*/
|
|
90
|
-
export declare const querySyntax: <T extends TObject
|
|
90
|
+
export declare const querySyntax: <T extends TObject, X extends { [K in keyof T["properties"]]?: {
|
|
91
91
|
[key: string]: TSchema;
|
|
92
92
|
}; }>(type: T, extensions?: X, options?: ObjectOptions) => TIntersect<[import("@sinclair/typebox").TPartial<TObject<{
|
|
93
93
|
$limit: import("@sinclair/typebox").TNumber;
|
|
94
94
|
$skip: import("@sinclair/typebox").TNumber;
|
|
95
|
-
$sort: TObject<{ [
|
|
95
|
+
$sort: TObject<{ [K in keyof T["properties"]]: TOptional<TInteger>; }>;
|
|
96
96
|
$select: import("@sinclair/typebox").TUnsafe<(keyof T["properties"])[]>;
|
|
97
|
-
$and: import("@sinclair/typebox").TArray<TUnion<[TOptional<TObject<{ [
|
|
98
|
-
$gt: T["properties"][
|
|
99
|
-
$gte: T["properties"][
|
|
100
|
-
$lt: T["properties"][
|
|
101
|
-
$lte: T["properties"][
|
|
102
|
-
$ne: T["properties"][
|
|
103
|
-
$in: T["properties"][
|
|
104
|
-
$nin: T["properties"][
|
|
105
|
-
}>, TObject<X[
|
|
106
|
-
$or: import("@sinclair/typebox").TArray<TOptional<TObject<{ [
|
|
107
|
-
$gt: T["properties"][
|
|
108
|
-
$gte: T["properties"][
|
|
109
|
-
$lt: T["properties"][
|
|
110
|
-
$lte: T["properties"][
|
|
111
|
-
$ne: T["properties"][
|
|
112
|
-
$in: T["properties"][
|
|
113
|
-
$nin: T["properties"][
|
|
114
|
-
}>, TObject<X[
|
|
97
|
+
$and: import("@sinclair/typebox").TArray<TUnion<[TOptional<TObject<{ [K_1 in keyof T["properties"]]: TOptional<TUnion<[T["properties"][K_1], import("@sinclair/typebox").TPartial<TIntersect<[TObject<{
|
|
98
|
+
$gt: T["properties"][K_1];
|
|
99
|
+
$gte: T["properties"][K_1];
|
|
100
|
+
$lt: T["properties"][K_1];
|
|
101
|
+
$lte: T["properties"][K_1];
|
|
102
|
+
$ne: T["properties"][K_1];
|
|
103
|
+
$in: T["properties"][K_1] | import("@sinclair/typebox").TArray<T["properties"][K_1]>;
|
|
104
|
+
$nin: T["properties"][K_1] | import("@sinclair/typebox").TArray<T["properties"][K_1]>;
|
|
105
|
+
}>, TObject<X[K_1]>]>>]>>; }>>, TObject<{
|
|
106
|
+
$or: import("@sinclair/typebox").TArray<TOptional<TObject<{ [K_1 in keyof T["properties"]]: TOptional<TUnion<[T["properties"][K_1], import("@sinclair/typebox").TPartial<TIntersect<[TObject<{
|
|
107
|
+
$gt: T["properties"][K_1];
|
|
108
|
+
$gte: T["properties"][K_1];
|
|
109
|
+
$lt: T["properties"][K_1];
|
|
110
|
+
$lte: T["properties"][K_1];
|
|
111
|
+
$ne: T["properties"][K_1];
|
|
112
|
+
$in: T["properties"][K_1] | import("@sinclair/typebox").TArray<T["properties"][K_1]>;
|
|
113
|
+
$nin: T["properties"][K_1] | import("@sinclair/typebox").TArray<T["properties"][K_1]>;
|
|
114
|
+
}>, TObject<X[K_1]>]>>]>>; }>>>;
|
|
115
115
|
}>]>>;
|
|
116
|
-
$or: import("@sinclair/typebox").TArray<TOptional<TObject<{ [
|
|
117
|
-
$gt: T["properties"][
|
|
118
|
-
$gte: T["properties"][
|
|
119
|
-
$lt: T["properties"][
|
|
120
|
-
$lte: T["properties"][
|
|
121
|
-
$ne: T["properties"][
|
|
122
|
-
$in: T["properties"][
|
|
123
|
-
$nin: T["properties"][
|
|
124
|
-
}>, TObject<X[
|
|
125
|
-
}>>, TOptional<TObject<{ [
|
|
126
|
-
$gt: T["properties"][
|
|
127
|
-
$gte: T["properties"][
|
|
128
|
-
$lt: T["properties"][
|
|
129
|
-
$lte: T["properties"][
|
|
130
|
-
$ne: T["properties"][
|
|
131
|
-
$in: T["properties"][
|
|
132
|
-
$nin: T["properties"][
|
|
133
|
-
}>, TObject<X[
|
|
116
|
+
$or: import("@sinclair/typebox").TArray<TOptional<TObject<{ [K_1 in keyof T["properties"]]: TOptional<TUnion<[T["properties"][K_1], import("@sinclair/typebox").TPartial<TIntersect<[TObject<{
|
|
117
|
+
$gt: T["properties"][K_1];
|
|
118
|
+
$gte: T["properties"][K_1];
|
|
119
|
+
$lt: T["properties"][K_1];
|
|
120
|
+
$lte: T["properties"][K_1];
|
|
121
|
+
$ne: T["properties"][K_1];
|
|
122
|
+
$in: T["properties"][K_1] | import("@sinclair/typebox").TArray<T["properties"][K_1]>;
|
|
123
|
+
$nin: T["properties"][K_1] | import("@sinclair/typebox").TArray<T["properties"][K_1]>;
|
|
124
|
+
}>, TObject<X[K_1]>]>>]>>; }>>>;
|
|
125
|
+
}>>, TOptional<TObject<{ [K_1 in keyof T["properties"]]: TOptional<TUnion<[T["properties"][K_1], import("@sinclair/typebox").TPartial<TIntersect<[TObject<{
|
|
126
|
+
$gt: T["properties"][K_1];
|
|
127
|
+
$gte: T["properties"][K_1];
|
|
128
|
+
$lt: T["properties"][K_1];
|
|
129
|
+
$lte: T["properties"][K_1];
|
|
130
|
+
$ne: T["properties"][K_1];
|
|
131
|
+
$in: T["properties"][K_1] | import("@sinclair/typebox").TArray<T["properties"][K_1]>;
|
|
132
|
+
$nin: T["properties"][K_1] | import("@sinclair/typebox").TArray<T["properties"][K_1]>;
|
|
133
|
+
}>, TObject<X[K_1]>]>>]>>; }>>]>;
|
|
134
134
|
export declare const ObjectIdSchema: () => TUnion<[import("@sinclair/typebox").TString<string>, TObject<{}>]>;
|
package/lib/index.js
CHANGED
|
@@ -14,7 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ObjectIdSchema = exports.querySyntax = exports.queryProperties = exports.queryProperty = exports.
|
|
17
|
+
exports.ObjectIdSchema = exports.querySyntax = exports.queryProperties = exports.queryProperty = exports.getDataValidator = exports.getValidator = void 0;
|
|
18
|
+
exports.StringEnum = StringEnum;
|
|
19
|
+
exports.sortDefinition = sortDefinition;
|
|
18
20
|
const typebox_1 = require("@sinclair/typebox");
|
|
19
21
|
const schema_1 = require("@feathersjs/schema");
|
|
20
22
|
__exportStar(require("@sinclair/typebox"), exports);
|
|
@@ -48,7 +50,6 @@ exports.getDataValidator = getDataValidator;
|
|
|
48
50
|
function StringEnum(allowedValues, options) {
|
|
49
51
|
return typebox_1.Type.Unsafe({ type: 'string', enum: allowedValues, ...options });
|
|
50
52
|
}
|
|
51
|
-
exports.StringEnum = StringEnum;
|
|
52
53
|
const arrayOfKeys = (type) => {
|
|
53
54
|
const keys = Object.keys(type.properties);
|
|
54
55
|
return typebox_1.Type.Unsafe({
|
|
@@ -74,7 +75,6 @@ function sortDefinition(schema) {
|
|
|
74
75
|
}, {});
|
|
75
76
|
return typebox_1.Type.Object(properties, { additionalProperties: false });
|
|
76
77
|
}
|
|
77
|
-
exports.sortDefinition = sortDefinition;
|
|
78
78
|
/**
|
|
79
79
|
* Returns the standard Feathers query syntax for a property schema,
|
|
80
80
|
* including operators like `$gt`, `$lt` etc. for a single property
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAoDA,gCAEC;AAoBD,wCAaC;AAvFD,+CAU0B;AAC1B,+CAAiF;AAEjF,oDAAiC;AACjC,oDAAiC;AAQjC;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,CAC1B,MAA0D,EAC1D,SAAc,EACG,EAAE,CAAC,mBAAU,CAAC,YAAY,CAAC,MAAa,EAAE,SAAS,CAAC,CAAA;AAH1D,QAAA,YAAY,gBAG8C;AAEvE;;;;;;;;;GASG;AACI,MAAM,gBAAgB,GAAG,CAAC,GAA6B,EAAE,SAAc,EAAoB,EAAE,CAClG,mBAAU,CAAC,gBAAgB,CAAC,GAAU,EAAE,SAAS,CAAC,CAAA;AADvC,QAAA,gBAAgB,oBACuB;AAEpD;;;;GAIG;AACH,SAAgB,UAAU,CAAqB,aAAqB,EAAE,OAAgC;IACpG,OAAO,cAAI,CAAC,MAAM,CAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC,CAAA;AACpF,CAAC;AAED,MAAM,WAAW,GAAG,CAAoB,IAAO,EAAE,EAAE;IACjD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IACzC,OAAO,cAAI,CAAC,MAAM,CAA4B;QAC5C,IAAI,EAAE,OAAO;QACb,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G,cAAI,CAAC,KAAK,CAAC,cAAI,CAAC,KAAK,CAAC,CAAC,cAAc,EAAE,cAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IAE3E,OAAO,cAAI,CAAC,SAAS,CACnB;QACE,cAAI,CAAC,OAAO,CACV,cAAI,CAAC,MAAM,CACT;YACE,MAAM,EAAE,cAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;YACnC,KAAK,EAAE,cAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;YAClC,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC;YAC3B,OAAO,EAAE,WAAW,CAAC,IAAI,CAAC;YAC1B,IAAI;YACJ,GAAG;SACJ,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAChC,CACF;QACD,cAAc;KACf,EACD,OAAO,CACR,CAAA;AACH,CAAC,CAAA;AA/BY,QAAA,WAAW,eA+BvB;AAEM,MAAM,cAAc,GAAG,GAAG,EAAE,CACjC,cAAI,CAAC,KAAK,CAAC,CAAC,cAAI,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,cAAI,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;AADnF,QAAA,cAAc,kBACqE"}
|
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.29",
|
|
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.29",
|
|
58
58
|
"@sinclair/typebox": "^0.25.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@types/mocha": "^10.0.
|
|
62
|
-
"@types/node": "^20.
|
|
63
|
-
"mocha": "^10.
|
|
61
|
+
"@types/mocha": "^10.0.7",
|
|
62
|
+
"@types/node": "^20.14.10",
|
|
63
|
+
"mocha": "^10.6.0",
|
|
64
64
|
"shx": "^0.3.4",
|
|
65
|
-
"typescript": "^5.
|
|
65
|
+
"typescript": "^5.5.3"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "6330134f97a1de4b627d41e8bcc2287498d5faa2"
|
|
68
68
|
}
|