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.
@@ -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,
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "0.27.23-next.1",
3
+ "version": "0.27.23-next.2",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "homepage": "https://remult.dev",
6
6
  "repository": {
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];
@@ -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
  }
@@ -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
  }());