remult 3.1.1 → 3.1.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.
@@ -19,6 +19,28 @@ export function standardSchema(repo, ...fields) {
19
19
  version: 1,
20
20
  vendor: 'remult',
21
21
  async validate(value) {
22
+ if (typeof value !== 'object') {
23
+ if (fields.length > 0) {
24
+ return {
25
+ issues: [
26
+ {
27
+ message: `Invalid shape, expected: { ${fields
28
+ .map((f) => `${String(f)}: ___`)
29
+ .join(', ')} }`,
30
+ path: [],
31
+ },
32
+ ],
33
+ };
34
+ }
35
+ return {
36
+ issues: [
37
+ {
38
+ message: `Invalid shape, expected an object of entity: ${String(repo.metadata.key)}`,
39
+ path: [],
40
+ },
41
+ ],
42
+ };
43
+ }
22
44
  const item = value;
23
45
  try {
24
46
  const error = await repo.validate(item, ...fields);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "homepage": "https://remult.dev",
6
6
  "repository": {
@@ -33,6 +33,28 @@ function standardSchema(repo) {
33
33
  return tslib_1.__generator(this, function (_b) {
34
34
  switch (_b.label) {
35
35
  case 0:
36
+ if (typeof value !== 'object') {
37
+ if (fields.length > 0) {
38
+ return [2 /*return*/, {
39
+ issues: [
40
+ {
41
+ message: "Invalid shape, expected: { ".concat(fields
42
+ .map(function (f) { return "".concat(String(f), ": ___"); })
43
+ .join(', '), " }"),
44
+ path: [],
45
+ },
46
+ ],
47
+ }];
48
+ }
49
+ return [2 /*return*/, {
50
+ issues: [
51
+ {
52
+ message: "Invalid shape, expected an object of entity: ".concat(String(repo.metadata.key)),
53
+ path: [],
54
+ },
55
+ ],
56
+ }];
57
+ }
36
58
  item = value;
37
59
  _b.label = 1;
38
60
  case 1: