remult 0.27.23-next.1 → 0.27.23-next.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/esm/src/data-api.js +1 -1
- package/esm/src/validators.js +4 -0
- package/package.json +1 -1
- package/src/data-api.js +1 -1
- package/src/remult3/remult3.d.ts +1 -1
- package/src/validators.d.ts +6 -0
- package/src/validators.js +10 -0
package/esm/src/data-api.js
CHANGED
|
@@ -115,7 +115,7 @@ export class DataApi {
|
|
|
115
115
|
let { aggregate, ...rest } = body;
|
|
116
116
|
let [{ r }, [aggregates]] = await Promise.all([
|
|
117
117
|
this.getArrayImpl(request, rest),
|
|
118
|
-
this.groupBy(request, aggregate),
|
|
118
|
+
this.groupBy(request, { ...aggregate, where: body.where }),
|
|
119
119
|
]);
|
|
120
120
|
return {
|
|
121
121
|
items: r,
|
package/esm/src/validators.js
CHANGED
|
@@ -92,6 +92,10 @@ export class Validators {
|
|
|
92
92
|
* Validator to check if a string's length is greater than or equal to a minimum length.
|
|
93
93
|
*/
|
|
94
94
|
static minLength = createValueValidatorWithArgs((val, minLength) => val.length >= minLength, (maxLength) => `Value must be at least ${maxLength} characters`);
|
|
95
|
+
/**
|
|
96
|
+
* Validator to check if a value is within a specified range.
|
|
97
|
+
*/
|
|
98
|
+
static range = createValueValidatorWithArgs((val, [minValue, maxValue]) => val >= minValue && val <= maxValue, ([minValue, maxValue]) => `Value must be between ${minValue} and ${maxValue}`);
|
|
95
99
|
static defaultMessage = 'Invalid value';
|
|
96
100
|
}
|
|
97
101
|
/**
|
package/package.json
CHANGED
package/src/data-api.js
CHANGED
|
@@ -201,7 +201,7 @@ var DataApi = /** @class */ (function () {
|
|
|
201
201
|
aggregate = body.aggregate, rest = tslib_1.__rest(body, ["aggregate"]);
|
|
202
202
|
return [4 /*yield*/, Promise.all([
|
|
203
203
|
this.getArrayImpl(request, rest),
|
|
204
|
-
this.groupBy(request, aggregate),
|
|
204
|
+
this.groupBy(request, tslib_1.__assign(tslib_1.__assign({}, aggregate), { where: body.where })),
|
|
205
205
|
])];
|
|
206
206
|
case 2:
|
|
207
207
|
_a = tslib_1.__read.apply(void 0, [_c.sent(), 2]), r = _a[0].r, _b = tslib_1.__read(_a[1], 1), aggregates = _b[0];
|
package/src/remult3/remult3.d.ts
CHANGED
|
@@ -1161,7 +1161,7 @@ export declare type EntityIdFields<entityType> = {
|
|
|
1161
1161
|
};
|
|
1162
1162
|
export interface ClassFieldDecoratorContextStub<entityType, valueType> {
|
|
1163
1163
|
readonly access: {
|
|
1164
|
-
set(object: entityType, value: valueType): void;
|
|
1164
|
+
set(object: entityType, value: valueType | null): void;
|
|
1165
1165
|
};
|
|
1166
1166
|
readonly name: string;
|
|
1167
1167
|
}
|
package/src/validators.d.ts
CHANGED
|
@@ -75,6 +75,12 @@ export declare class Validators {
|
|
|
75
75
|
static minLength: ValidatorWithArgs<string, number> & {
|
|
76
76
|
defaultMessage: ValueValidationMessage<number>;
|
|
77
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* Validator to check if a value is within a specified range.
|
|
80
|
+
*/
|
|
81
|
+
static range: ValidatorWithArgs<number, [number, number]> & {
|
|
82
|
+
defaultMessage: ValueValidationMessage<[number, number]>;
|
|
83
|
+
};
|
|
78
84
|
static defaultMessage: string;
|
|
79
85
|
}
|
|
80
86
|
/**
|
package/src/validators.js
CHANGED
|
@@ -136,6 +136,16 @@ var Validators = /** @class */ (function () {
|
|
|
136
136
|
* Validator to check if a string's length is greater than or equal to a minimum length.
|
|
137
137
|
*/
|
|
138
138
|
Validators.minLength = createValueValidatorWithArgs(function (val, minLength) { return val.length >= minLength; }, function (maxLength) { return "Value must be at least ".concat(maxLength, " characters"); });
|
|
139
|
+
/**
|
|
140
|
+
* Validator to check if a value is within a specified range.
|
|
141
|
+
*/
|
|
142
|
+
Validators.range = createValueValidatorWithArgs(function (val, _b) {
|
|
143
|
+
var _c = tslib_1.__read(_b, 2), minValue = _c[0], maxValue = _c[1];
|
|
144
|
+
return val >= minValue && val <= maxValue;
|
|
145
|
+
}, function (_b) {
|
|
146
|
+
var _c = tslib_1.__read(_b, 2), minValue = _c[0], maxValue = _c[1];
|
|
147
|
+
return "Value must be between ".concat(minValue, " and ").concat(maxValue);
|
|
148
|
+
});
|
|
139
149
|
Validators.defaultMessage = 'Invalid value';
|
|
140
150
|
return Validators;
|
|
141
151
|
}());
|