@based/schema 0.0.6 → 0.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/dist/deepPartial.d.ts +0 -0
- package/dist/deepPartial.js +3 -0
- package/dist/deepPartial.js.map +1 -0
- package/dist/set/checkDefaultAndValue.d.ts +3 -0
- package/dist/set/checkDefaultAndValue.js +33 -0
- package/dist/set/checkDefaultAndValue.js.map +1 -0
- package/dist/set/collections.js +80 -56
- package/dist/set/collections.js.map +1 -1
- package/dist/set/enum.d.ts +2 -0
- package/dist/set/enum.js +15 -0
- package/dist/set/enum.js.map +1 -0
- package/dist/set/error.d.ts +4 -1
- package/dist/set/error.js +3 -0
- package/dist/set/error.js.map +1 -1
- package/dist/set/fieldValidator.d.ts +6 -0
- package/dist/set/fieldValidator.js +144 -0
- package/dist/set/fieldValidator.js.map +1 -0
- package/dist/set/handleError.d.ts +1 -0
- package/dist/set/handleError.js +9 -0
- package/dist/set/handleError.js.map +1 -0
- package/dist/set/index.d.ts +1 -1
- package/dist/set/index.js +5 -3
- package/dist/set/index.js.map +1 -1
- package/dist/set/number copy.d.ts +4 -0
- package/dist/set/number copy.js +57 -0
- package/dist/set/number copy.js.map +1 -0
- package/dist/set/number.js +86 -33
- package/dist/set/number.js.map +1 -1
- package/dist/set/parseDefaultAndValue.d.ts +3 -0
- package/dist/set/parseDefaultAndValue.js +33 -0
- package/dist/set/parseDefaultAndValue.js.map +1 -0
- package/dist/set/references.js +10 -14
- package/dist/set/references.js.map +1 -1
- package/dist/set/rest copy.d.ts +5 -0
- package/dist/set/rest copy.js +53 -0
- package/dist/set/rest copy.js.map +1 -0
- package/dist/set/rest.js +45 -22
- package/dist/set/rest.js.map +1 -1
- package/dist/set/string.js +41 -21
- package/dist/set/string.js.map +1 -1
- package/dist/set/types.d.ts +1 -1
- package/dist/setWalker.d.ts +11 -0
- package/dist/setWalker.js +189 -0
- package/dist/setWalker.js.map +1 -0
- package/dist/transformers.d.ts +3 -0
- package/dist/transformers.js +18 -0
- package/dist/transformers.js.map +1 -0
- package/dist/typeWalker.d.ts +3 -0
- package/dist/typeWalker.js +18 -0
- package/dist/typeWalker.js.map +1 -0
- package/dist/validate.d.ts +4 -0
- package/dist/validate.js +34 -0
- package/dist/validate.js.map +1 -0
- package/dist/validateFields.d.ts +4 -0
- package/dist/validateFields.js +34 -0
- package/dist/validateFields.js.map +1 -0
- package/dist/validateSchema copy.d.ts +4 -0
- package/dist/validateSchema copy.js +34 -0
- package/dist/validateSchema copy.js.map +1 -0
- package/package.json +1 -1
- package/src/set/collections.ts +111 -88
- package/src/set/error.ts +3 -0
- package/src/set/index.ts +6 -3
- package/src/set/number.ts +109 -37
- package/src/set/parseDefaultAndValue.ts +44 -0
- package/src/set/references.ts +14 -14
- package/src/set/rest.ts +80 -21
- package/src/set/string.ts +75 -23
- package/src/set/types.ts +3 -2
- package/test/setWalker.ts +93 -5
- package/dist/parse.d.ts +0 -2
- package/dist/parse.js +0 -9
- package/dist/parse.js.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.integer = exports.number = exports.timestamp = void 0;
|
|
4
|
+
const error_1 = require("./error");
|
|
5
|
+
const timestamp = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
6
|
+
if (typeof value === 'string') {
|
|
7
|
+
if (value === 'now') {
|
|
8
|
+
value = Date.now();
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
const d = new Date(value);
|
|
12
|
+
value = d.valueOf();
|
|
13
|
+
if (isNaN(value)) {
|
|
14
|
+
throw (0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// // smaller then / larger then steps
|
|
19
|
+
// if (typeof value !== 'number') {
|
|
20
|
+
// throw createError(path, target.type, 'timestamp', value)
|
|
21
|
+
// }
|
|
22
|
+
// if (fieldSchema.maximum) {
|
|
23
|
+
// if (fieldSchema.exclusiveMaximum && value > value) {
|
|
24
|
+
// throw createError(path, target.type, 'timestamp', value)
|
|
25
|
+
// } else if (value >= value) {
|
|
26
|
+
// throw createError(path, target.type, 'timestamp', value)
|
|
27
|
+
// }
|
|
28
|
+
// }
|
|
29
|
+
// if (fieldSchema.minimum) {
|
|
30
|
+
// if (fieldSchema.exclusiveMinimum && value < value) {
|
|
31
|
+
// throw createError(path, target.type, 'timestamp', value)
|
|
32
|
+
// } else if (value <= value) {
|
|
33
|
+
// throw createError(path, target.type, 'timestamp', value)
|
|
34
|
+
// }
|
|
35
|
+
// }
|
|
36
|
+
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
37
|
+
};
|
|
38
|
+
exports.timestamp = timestamp;
|
|
39
|
+
const number = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
40
|
+
// value .default
|
|
41
|
+
// $increment / $decrement
|
|
42
|
+
if (typeof value !== 'number') {
|
|
43
|
+
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
44
|
+
}
|
|
45
|
+
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
46
|
+
};
|
|
47
|
+
exports.number = number;
|
|
48
|
+
const integer = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
49
|
+
// value .default
|
|
50
|
+
// $increment / $decrement
|
|
51
|
+
if (typeof value !== 'number' || value - Math.floor(value) !== 0) {
|
|
52
|
+
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
53
|
+
}
|
|
54
|
+
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
55
|
+
};
|
|
56
|
+
exports.integer = integer;
|
|
57
|
+
//# sourceMappingURL=number%20copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number copy.js","sourceRoot":"","sources":["../../src/set/number copy.ts"],"names":[],"mappings":";;;AACA,mCAA2C;AAEpC,MAAM,SAAS,GA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AE,CAAC,CAAA;AACpE,CAAC,CAAA;AAhBY,QAAA,MAAM,UAgBlB;AAEM,MAAM,OAAO,GAAsB,KAAK,EAC7C,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,EAAE;IACF,iBAAiB;IACjB,0BAA0B;IAC1B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;QAChE,IAAA,aAAK,EAAC,IAAI,EAAE,kBAAU,CAAC,eAAe,CAAC,CAAA;KACxC;IACD,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAA;AACpE,CAAC,CAAA;AAdY,QAAA,OAAO,WAcnB"}
|
package/dist/set/number.js
CHANGED
|
@@ -2,7 +2,61 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.integer = exports.number = exports.timestamp = void 0;
|
|
4
4
|
const error_1 = require("./error");
|
|
5
|
-
const
|
|
5
|
+
const validate = (path, value, fieldSchema) => {
|
|
6
|
+
if (typeof value !== 'number') {
|
|
7
|
+
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
8
|
+
}
|
|
9
|
+
if (fieldSchema.type === 'integer' && value - Math.floor(value) !== 0) {
|
|
10
|
+
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
11
|
+
}
|
|
12
|
+
if (fieldSchema.multipleOf &&
|
|
13
|
+
value / fieldSchema.multipleOf -
|
|
14
|
+
Math.floor(value / fieldSchema.multipleOf) !==
|
|
15
|
+
0) {
|
|
16
|
+
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
17
|
+
}
|
|
18
|
+
if (fieldSchema.maximum) {
|
|
19
|
+
if (fieldSchema.exclusiveMaximum && value > value) {
|
|
20
|
+
(0, error_1.error)(path, error_1.ParseError.exceedsMaximum);
|
|
21
|
+
}
|
|
22
|
+
else if (value >= value) {
|
|
23
|
+
(0, error_1.error)(path, error_1.ParseError.exceedsMaximum);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (fieldSchema.minimum) {
|
|
27
|
+
if (fieldSchema.exclusiveMinimum && value < value) {
|
|
28
|
+
(0, error_1.error)(path, error_1.ParseError.subceedsMinimum);
|
|
29
|
+
}
|
|
30
|
+
else if (value <= value) {
|
|
31
|
+
(0, error_1.error)(path, error_1.ParseError.subceedsMinimum);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return value;
|
|
35
|
+
};
|
|
36
|
+
const shared = (path, value, fieldSchema) => {
|
|
37
|
+
if (typeof value === 'object') {
|
|
38
|
+
if (value.$increment) {
|
|
39
|
+
validate([...path, '$increment'], value.$increment, fieldSchema);
|
|
40
|
+
}
|
|
41
|
+
if (value.$decrement) {
|
|
42
|
+
validate([...path, '$decrement'], value.$decrement, fieldSchema);
|
|
43
|
+
}
|
|
44
|
+
if (value.$value !== undefined) {
|
|
45
|
+
validate(path, value.$value, fieldSchema);
|
|
46
|
+
}
|
|
47
|
+
if (value.$default !== undefined) {
|
|
48
|
+
if (value.$value !== undefined) {
|
|
49
|
+
(0, error_1.error)(path, error_1.ParseError.valueAndDefault);
|
|
50
|
+
}
|
|
51
|
+
validate(path, value.$default, fieldSchema);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
validate(path, value, fieldSchema);
|
|
56
|
+
}
|
|
57
|
+
return value;
|
|
58
|
+
};
|
|
59
|
+
const timestamp = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
6
60
|
if (typeof value === 'string') {
|
|
7
61
|
if (value === 'now') {
|
|
8
62
|
value = Date.now();
|
|
@@ -11,47 +65,46 @@ const timestamp = async (path, value, fieldSchema, typeSchema, target, handlers)
|
|
|
11
65
|
const d = new Date(value);
|
|
12
66
|
value = d.valueOf();
|
|
13
67
|
if (isNaN(value)) {
|
|
14
|
-
|
|
68
|
+
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
15
69
|
}
|
|
16
70
|
}
|
|
17
71
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// }
|
|
29
|
-
// if (fieldSchema.minimum) {
|
|
30
|
-
// if (fieldSchema.exclusiveMinimum && value < value) {
|
|
31
|
-
// throw createError(path, target.type, 'timestamp', value)
|
|
32
|
-
// } else if (value <= value) {
|
|
33
|
-
// throw createError(path, target.type, 'timestamp', value)
|
|
34
|
-
// }
|
|
35
|
-
// }
|
|
36
|
-
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
72
|
+
const parsedValue = shared(path, value, fieldSchema);
|
|
73
|
+
if (!noCollect) {
|
|
74
|
+
handlers.collect({
|
|
75
|
+
path,
|
|
76
|
+
value: parsedValue,
|
|
77
|
+
typeSchema,
|
|
78
|
+
fieldSchema,
|
|
79
|
+
target,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
37
82
|
};
|
|
38
83
|
exports.timestamp = timestamp;
|
|
39
|
-
const number = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
84
|
+
const number = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
85
|
+
const parsedValue = shared(path, value, fieldSchema);
|
|
86
|
+
if (!noCollect) {
|
|
87
|
+
handlers.collect({
|
|
88
|
+
path,
|
|
89
|
+
value: parsedValue,
|
|
90
|
+
typeSchema,
|
|
91
|
+
fieldSchema,
|
|
92
|
+
target,
|
|
93
|
+
});
|
|
44
94
|
}
|
|
45
|
-
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
46
95
|
};
|
|
47
96
|
exports.number = number;
|
|
48
|
-
const integer = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
97
|
+
const integer = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
98
|
+
const parsedValue = shared(path, value, fieldSchema);
|
|
99
|
+
if (!noCollect) {
|
|
100
|
+
handlers.collect({
|
|
101
|
+
path,
|
|
102
|
+
value: parsedValue,
|
|
103
|
+
typeSchema,
|
|
104
|
+
fieldSchema,
|
|
105
|
+
target,
|
|
106
|
+
});
|
|
53
107
|
}
|
|
54
|
-
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
55
108
|
};
|
|
56
109
|
exports.integer = integer;
|
|
57
110
|
//# sourceMappingURL=number.js.map
|
package/dist/set/number.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../src/set/number.ts"],"names":[],"mappings":";;;AACA,mCAA2C;
|
|
1
|
+
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../src/set/number.ts"],"names":[],"mappings":";;;AACA,mCAA2C;AAO3C,MAAM,QAAQ,GAAG,CACf,IAAyB,EACzB,KAAU,EACV,WAG6B,EACrB,EAAE;IACV,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,IAAA,aAAK,EAAC,IAAI,EAAE,kBAAU,CAAC,eAAe,CAAC,CAAA;KACxC;IACD,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;QACrE,IAAA,aAAK,EAAC,IAAI,EAAE,kBAAU,CAAC,eAAe,CAAC,CAAA;KACxC;IACD,IACE,WAAW,CAAC,UAAU;QACtB,KAAK,GAAG,WAAW,CAAC,UAAU;YAC5B,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,WAAW,CAAC,UAAU,CAAC;YAC1C,CAAC,EACH;QACA,IAAA,a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F,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,CAAA;IACpD,IAAI,CAAC,SAAS,EAAE;QACd,QAAQ,CAAC,OAAO,CAAC;YACf,IAAI;YACJ,KAAK,EAAE,WAAW;YAClB,UAAU;YACV,WAAW;YACX,MAAM;SACP,CAAC,CAAA;KACH;AACH,CAAC,CAAA;AAnBY,QAAA,MAAM,UAmBlB;AAEM,MAAM,OAAO,GAAsB,KAAK,EAC7C,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,SAAS,EACT,EAAE;IACF,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,CAAA;IACpD,IAAI,CAAC,SAAS,EAAE;QACd,QAAQ,CAAC,OAAO,CAAC;YACf,IAAI;YACJ,KAAK,EAAE,WAAW;YAClB,UAAU;YACV,WAAW;YACX,MAAM;SACP,CAAC,CAAA;KACH;AACH,CAAC,CAAA;AAnBY,QAAA,OAAO,WAmBnB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseValueAndDefault = void 0;
|
|
7
|
+
const error_1 = require("./error");
|
|
8
|
+
const parsers_1 = __importDefault(require("./parsers"));
|
|
9
|
+
const parseValueAndDefault = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
10
|
+
let handled = false;
|
|
11
|
+
if (typeof value === 'object') {
|
|
12
|
+
const typeDef = fieldSchema.type ?? ('enum' in fieldSchema ? 'enum' : '');
|
|
13
|
+
const parse = parsers_1.default[typeDef];
|
|
14
|
+
if (value.$value !== undefined) {
|
|
15
|
+
// TODO: for errors handle path a bit smarter...
|
|
16
|
+
parse(path, value.$value, fieldSchema, typeSchema, target, handlers, true);
|
|
17
|
+
handled = true;
|
|
18
|
+
}
|
|
19
|
+
if (value.$default !== undefined) {
|
|
20
|
+
if (value.$value !== undefined) {
|
|
21
|
+
(0, error_1.error)(path, error_1.ParseError.valueAndDefault);
|
|
22
|
+
}
|
|
23
|
+
parse(path, value.$default, fieldSchema, typeSchema, target, handlers, true);
|
|
24
|
+
handled = true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (handled && !noCollect) {
|
|
28
|
+
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
29
|
+
}
|
|
30
|
+
return handled;
|
|
31
|
+
};
|
|
32
|
+
exports.parseValueAndDefault = parseValueAndDefault;
|
|
33
|
+
//# sourceMappingURL=parseDefaultAndValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseDefaultAndValue.js","sourceRoot":"","sources":["../../src/set/parseDefaultAndValue.ts"],"names":[],"mappings":";;;;;;AAEA,mCAA2C;AAC3C,wDAA+B;AAExB,MAAM,oBAAoB,GAAoC,KAAK,EACxE,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,SAAS,EACS,EAAE;IACpB,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;QACzE,MAAM,KAAK,GAAG,iBAAO,CAAC,OAAO,CAAC,CAAA;QAC9B,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE;YAC9B,gDAAgD;YAChD,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;YAC1E,OAAO,GAAG,IAAI,CAAA;SACf;QACD,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE;YAChC,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE;gBAC9B,IAAA,aAAK,EAAC,IAAI,EAAE,kBAAU,CAAC,eAAe,CAAC,CAAA;aACxC;YACD,KAAK,CACH,IAAI,EACJ,KAAK,CAAC,QAAQ,EACd,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,IAAI,CACL,CAAA;YACD,OAAO,GAAG,IAAI,CAAA;SACf;KACF;IACD,IAAI,OAAO,IAAI,CAAC,SAAS,EAAE;QACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAA;KACnE;IACD,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAtCY,QAAA,oBAAoB,wBAsChC"}
|
package/dist/set/references.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.references = exports.reference = void 0;
|
|
4
4
|
const error_1 = require("./error");
|
|
5
|
-
const reference = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
5
|
+
const reference = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
6
6
|
// $no root
|
|
7
7
|
// prob pass these as options
|
|
8
8
|
// value .default
|
|
@@ -44,38 +44,34 @@ const reference = async (path, value, fieldSchema, typeSchema, target, handlers)
|
|
|
44
44
|
(0, error_1.error)(path, error_1.ParseError.referenceIsIncorrectType);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
if (!noCollect) {
|
|
48
|
+
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
49
|
+
}
|
|
48
50
|
};
|
|
49
51
|
exports.reference = reference;
|
|
50
|
-
const references = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
52
|
+
const references = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
51
53
|
// default
|
|
52
54
|
// $no root
|
|
53
55
|
if (Array.isArray(value)) {
|
|
54
|
-
const handler = {
|
|
55
|
-
...handlers,
|
|
56
|
-
collect: () => { },
|
|
57
|
-
};
|
|
58
56
|
await Promise.all(value.map((v, i) => {
|
|
59
57
|
return (0, exports.reference)([...path, i], v,
|
|
60
58
|
// not nice slow
|
|
61
|
-
{ ...fieldSchema, type: 'reference' }, typeSchema, target,
|
|
59
|
+
{ ...fieldSchema, type: 'reference' }, typeSchema, target, handlers, true);
|
|
62
60
|
}));
|
|
63
61
|
value = { $value: value };
|
|
64
62
|
}
|
|
65
63
|
else if (typeof value === 'object') {
|
|
66
64
|
if (value.$add) {
|
|
67
|
-
const handler = {
|
|
68
|
-
...handlers,
|
|
69
|
-
collect: () => { },
|
|
70
|
-
};
|
|
71
65
|
await Promise.all(value.$add.map((v, i) => {
|
|
72
66
|
return (0, exports.reference)([...path, '$add', i], v,
|
|
73
67
|
// not nice slow
|
|
74
|
-
{ ...fieldSchema, type: 'reference' }, typeSchema, target,
|
|
68
|
+
{ ...fieldSchema, type: 'reference' }, typeSchema, target, handlers, true);
|
|
75
69
|
}));
|
|
76
70
|
}
|
|
77
71
|
}
|
|
78
|
-
|
|
72
|
+
if (!noCollect) {
|
|
73
|
+
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
74
|
+
}
|
|
79
75
|
};
|
|
80
76
|
exports.references = references;
|
|
81
77
|
//# sourceMappingURL=references.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.js","sourceRoot":"","sources":["../../src/set/references.ts"],"names":[],"mappings":";;;AACA,mCAA2C;AAEpC,MAAM,SAAS,GAAwB,KAAK,EACjD,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,EAAE;IACF,WAAW;IACX,6BAA6B;IAC7B,iBAAiB;IAC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,EAAE,GAAG,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,EACrC,UAAU,EACV,MAAM,EACN,QAAQ,EACR,IAAI,CACL,CAAA;QACH,CAAC,CAAC,CACH,CAAA;QACD,KAAK,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;KAC1B;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACpC,IAAI,KAAK,CAAC,IAAI,EAAE;YACd,MAAM,OAAO,CAAC,GAAG,CACf,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;gBACtB,OAAO,IAAA,iBAAS,EACd,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,EACpB,CAAC;gBACD,gBAAgB;gBAChB,EAAE,GAAG,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,EACrC,UAAU,EACV,MAAM,EACN,QAAQ,EACR,IAAI,CACL,CAAA;YACH,CAAC,CAAC,CACH,CAAA;SACF;KACF;IACD,IAAI,CAAC,SAAS,EAAE;QACd,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAA;KACnE;AACH,CAAC,CAAA;AAhDY,QAAA,UAAU,cAgDtB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.json = exports.enumParser = exports.boolean = exports.cardinality = void 0;
|
|
4
|
+
const utils_1 = require("@saulx/utils");
|
|
5
|
+
const hash_1 = require("@saulx/hash");
|
|
6
|
+
const error_1 = require("./error");
|
|
7
|
+
const cardinality = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
8
|
+
if (value && typeof value === 'object') {
|
|
9
|
+
value = (0, hash_1.hashObjectIgnoreKeyOrder)(value).toString(16);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
value = (0, hash_1.hash)(value).toString(16);
|
|
13
|
+
}
|
|
14
|
+
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
15
|
+
};
|
|
16
|
+
exports.cardinality = cardinality;
|
|
17
|
+
const boolean = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
18
|
+
// value .default
|
|
19
|
+
// $increment / $decrement
|
|
20
|
+
if (typeof value !== 'boolean') {
|
|
21
|
+
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
22
|
+
}
|
|
23
|
+
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
24
|
+
};
|
|
25
|
+
exports.boolean = boolean;
|
|
26
|
+
const enumParser = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
27
|
+
const enumValues = fieldSchema.enum;
|
|
28
|
+
for (let i = 0; i < enumValues.length; i++) {
|
|
29
|
+
if ((0, utils_1.deepEqual)(enumValues[i], value)) {
|
|
30
|
+
handlers.collect({ path, value: i, typeSchema, fieldSchema, target });
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
35
|
+
};
|
|
36
|
+
exports.enumParser = enumParser;
|
|
37
|
+
const json = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
38
|
+
try {
|
|
39
|
+
const parsedValue = JSON.stringify(value);
|
|
40
|
+
handlers.collect({
|
|
41
|
+
path,
|
|
42
|
+
value: parsedValue,
|
|
43
|
+
typeSchema,
|
|
44
|
+
fieldSchema,
|
|
45
|
+
target,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
throw err(path, error_1.ParseError.incorrectFormat);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
exports.json = json;
|
|
53
|
+
//# sourceMappingURL=rest%20copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rest copy.js","sourceRoot":"","sources":["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AAC,EAAE,EAAE;QAC1C,IAAI,IAAA,iBAAS,EAAC,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE;YACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAA;YACrE,OAAM;SACP;KACF;IACD,IAAA,aAAK,EAAC,IAAI,EAAE,kBAAU,CAAC,eAAe,CAAC,CAAA;AACzC,CAAC,CAAA;AAhBY,QAAA,UAAU,cAgBtB;AAEM,MAAM,IAAI,GAAmB,KAAK,EACvC,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,EAAE;IACF,IAAI;QACF,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;QACzC,QAAQ,CAAC,OAAO,CAAC;YACf,IAAI;YACJ,KAAK,EAAE,WAAW;YAClB,UAAU;YACV,WAAW;YACX,MAAM;SACP,CAAC,CAAA;KACH;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,GAAG,CAAC,IAAI,EAAE,kBAAU,CAAC,eAAe,CAAC,CAAA;KAC5C;AACH,CAAC,CAAA;AApBY,QAAA,IAAI,QAoBhB"}
|
package/dist/set/rest.js
CHANGED
|
@@ -4,49 +4,72 @@ exports.json = exports.enumParser = exports.boolean = exports.cardinality = void
|
|
|
4
4
|
const utils_1 = require("@saulx/utils");
|
|
5
5
|
const hash_1 = require("@saulx/hash");
|
|
6
6
|
const error_1 = require("./error");
|
|
7
|
-
const
|
|
7
|
+
const parseDefaultAndValue_1 = require("./parseDefaultAndValue");
|
|
8
|
+
const cardinality = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
8
9
|
if (value && typeof value === 'object') {
|
|
9
|
-
value
|
|
10
|
+
if (value.$default !== undefined) {
|
|
11
|
+
(0, error_1.error)(path, error_1.ParseError.defaultNotSupported);
|
|
12
|
+
}
|
|
13
|
+
if (value.$value !== undefined) {
|
|
14
|
+
value = (0, hash_1.hashObjectIgnoreKeyOrder)(value.$value).toString(16);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
value = (0, hash_1.hashObjectIgnoreKeyOrder)(value).toString(16);
|
|
18
|
+
}
|
|
10
19
|
}
|
|
11
20
|
else {
|
|
12
21
|
value = (0, hash_1.hash)(value).toString(16);
|
|
13
22
|
}
|
|
14
|
-
|
|
23
|
+
if (!noCollect) {
|
|
24
|
+
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
25
|
+
}
|
|
15
26
|
};
|
|
16
27
|
exports.cardinality = cardinality;
|
|
17
|
-
const boolean = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
const boolean = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
29
|
+
if (await (0, parseDefaultAndValue_1.parseValueAndDefault)(path, value, fieldSchema, typeSchema, target, handlers, noCollect)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
20
32
|
if (typeof value !== 'boolean') {
|
|
21
33
|
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
22
34
|
}
|
|
23
|
-
|
|
35
|
+
if (!noCollect) {
|
|
36
|
+
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
37
|
+
}
|
|
24
38
|
};
|
|
25
39
|
exports.boolean = boolean;
|
|
26
|
-
const enumParser = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
40
|
+
const enumParser = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
27
41
|
const enumValues = fieldSchema.enum;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
42
|
+
if (!(await (0, parseDefaultAndValue_1.parseValueAndDefault)(path, value, fieldSchema, typeSchema, target, handlers, noCollect))) {
|
|
43
|
+
for (let i = 0; i < enumValues.length; i++) {
|
|
44
|
+
if ((0, utils_1.deepEqual)(enumValues[i], value)) {
|
|
45
|
+
if (!noCollect) {
|
|
46
|
+
handlers.collect({ path, value: i, typeSchema, fieldSchema, target });
|
|
47
|
+
}
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
32
50
|
}
|
|
51
|
+
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
33
52
|
}
|
|
34
|
-
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
35
53
|
};
|
|
36
54
|
exports.enumParser = enumParser;
|
|
37
|
-
const json = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
55
|
+
const json = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
56
|
+
if (await (0, parseDefaultAndValue_1.parseValueAndDefault)(path, value, fieldSchema, typeSchema, target, handlers, noCollect)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
38
59
|
try {
|
|
39
60
|
const parsedValue = JSON.stringify(value);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
61
|
+
if (!noCollect) {
|
|
62
|
+
handlers.collect({
|
|
63
|
+
path,
|
|
64
|
+
value: parsedValue,
|
|
65
|
+
typeSchema,
|
|
66
|
+
fieldSchema,
|
|
67
|
+
target,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
47
70
|
}
|
|
48
71
|
catch (err) {
|
|
49
|
-
|
|
72
|
+
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
50
73
|
}
|
|
51
74
|
};
|
|
52
75
|
exports.json = json;
|
package/dist/set/rest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rest.js","sourceRoot":"","sources":["../../src/set/rest.ts"],"names":[],"mappings":";;;AACA,wCAAwC;AACxC,sCAA4D;AAC5D,mCAA2C;
|
|
1
|
+
{"version":3,"file":"rest.js","sourceRoot":"","sources":["../../src/set/rest.ts"],"names":[],"mappings":";;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AAQ,EACR,SAAS,CACV,EACD;QACA,OAAM;KACP;IAED,IAAI;QACF,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;QACzC,IAAI,CAAC,SAAS,EAAE;YACd,QAAQ,CAAC,OAAO,CAAC;gBACf,IAAI;gBACJ,KAAK,EAAE,WAAW;gBAClB,UAAU;gBACV,WAAW;gBACX,MAAM;aACP,CAAC,CAAA;SACH;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,IAAA,aAAK,EAAC,IAAI,EAAE,kBAAU,CAAC,eAAe,CAAC,CAAA;KACxC;AACH,CAAC,CAAA;AArCY,QAAA,IAAI,QAqChB"}
|
package/dist/set/string.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.text = exports.string = void 0;
|
|
7
7
|
const error_1 = require("./error");
|
|
8
8
|
const validator_1 = __importDefault(require("validator"));
|
|
9
|
+
const parseDefaultAndValue_1 = require("./parseDefaultAndValue");
|
|
9
10
|
const formatPatterns = {
|
|
10
11
|
email: validator_1.default.isEmail,
|
|
11
12
|
URL: validator_1.default.isURL,
|
|
@@ -89,47 +90,66 @@ const validate = (path, value, fieldSchema) => {
|
|
|
89
90
|
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
90
91
|
}
|
|
91
92
|
};
|
|
92
|
-
const string = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
93
|
+
const string = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
94
|
+
if (await (0, parseDefaultAndValue_1.parseValueAndDefault)(path, value, fieldSchema, typeSchema, target, handlers, noCollect)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
93
97
|
validate(path, value, fieldSchema);
|
|
94
|
-
|
|
98
|
+
if (!noCollect) {
|
|
99
|
+
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
100
|
+
}
|
|
95
101
|
};
|
|
96
102
|
exports.string = string;
|
|
97
|
-
const text = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
103
|
+
const text = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
98
104
|
const valueType = typeof value;
|
|
99
105
|
if (target.$language && valueType === 'string') {
|
|
100
106
|
validate(path, value, fieldSchema);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
if (!noCollect) {
|
|
108
|
+
handlers.collect({
|
|
109
|
+
path,
|
|
110
|
+
value: { [target.$language]: value },
|
|
111
|
+
typeSchema,
|
|
112
|
+
fieldSchema,
|
|
113
|
+
target,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
108
116
|
return;
|
|
109
117
|
}
|
|
110
118
|
if (valueType !== 'object') {
|
|
111
119
|
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
112
120
|
}
|
|
121
|
+
if (target.$language &&
|
|
122
|
+
(await (0, parseDefaultAndValue_1.parseValueAndDefault)(path, value, fieldSchema, typeSchema, target, handlers, noCollect))) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
113
125
|
for (const key in value) {
|
|
114
126
|
const newPath = [...path, key];
|
|
115
|
-
if (typeof value[key] === 'object'
|
|
127
|
+
if (typeof value[key] === 'object') {
|
|
128
|
+
if (value[key].$value) {
|
|
129
|
+
(0, exports.text)([...path, key, '$value'], value[key].$value, fieldSchema, typeSchema, target, handlers, true);
|
|
130
|
+
}
|
|
131
|
+
if (!noCollect) {
|
|
132
|
+
handlers.collect({
|
|
133
|
+
path: newPath,
|
|
134
|
+
value: null,
|
|
135
|
+
typeSchema,
|
|
136
|
+
fieldSchema,
|
|
137
|
+
target,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
// if
|
|
143
|
+
// validate(newPath, value[key], fieldSchema)
|
|
144
|
+
if (!noCollect) {
|
|
116
145
|
handlers.collect({
|
|
117
146
|
path: newPath,
|
|
118
|
-
value:
|
|
147
|
+
value: value[key],
|
|
119
148
|
typeSchema,
|
|
120
149
|
fieldSchema,
|
|
121
150
|
target,
|
|
122
151
|
});
|
|
123
|
-
continue;
|
|
124
152
|
}
|
|
125
|
-
validate(newPath, value[key], fieldSchema);
|
|
126
|
-
handlers.collect({
|
|
127
|
-
path: newPath,
|
|
128
|
-
value: value[key],
|
|
129
|
-
typeSchema,
|
|
130
|
-
fieldSchema,
|
|
131
|
-
target,
|
|
132
|
-
});
|
|
133
153
|
}
|
|
134
154
|
};
|
|
135
155
|
exports.text = text;
|
package/dist/set/string.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/set/string.ts"],"names":[],"mappings":";;;;;;AACA,mCAA2C;AAE3C,0DAAkC;
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/set/string.ts"],"names":[],"mappings":";;;;;;AACA,mCAA2C;AAE3C,0DAAkC;AAClC,iEAA6D;AAE7D,MAAM,cAAc,GAGhB;IACF,KAAK,EAAE,mBAAU,CAAC,OAAO;IACzB,GAAG,EAAE,mBAAU,CAAC,KAAK;IACrB,UAAU,EAAE,mBAAU,CAAC,YAAY;IACnC,EAAE,EAAE,mBAAU,CAAC,IAAI;IACnB,OAAO,EAAE,mBAAU,CAAC,SAAS;IAC7B,IAAI,EAAE,mBAAU,CAAC,MAAM;IACvB,IAAI,EAAE,mBAAU,CAAC,MAAM;IACvB,GAAG,EAAE,mBAAU,CAAC,KAAK;IACrB,KAAK,EAAE,mBAAU,CAAC,OAAO;IACzB,YAAY,EAAE,mBAAU,CAAC,cAAc;IACvC,YAAY,EAAE,mBAAU,CAAC,cAAc;IACvC,mBAAmB,EAAE,mBAAU,CAAC,qBAAqB;IACrD,cAAc,EAAE,mBAAU,CAAC,gBAAgB;IAC3C,IAAI,EAAE,mBAAU,CAAC,MAAM;IACvB,SAAS,EAAE,mBAAU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