@based/schema 0.0.6 → 0.0.7
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/collections.js +37 -53
- 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/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 +72 -31
- package/dist/set/number.js.map +1 -1
- 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 +18 -14
- package/dist/set/rest.js.map +1 -1
- package/dist/set/string.js +34 -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 +51 -82
- package/src/set/index.ts +6 -3
- package/src/set/number.ts +93 -35
- package/src/set/references.ts +14 -14
- package/src/set/rest.ts +21 -14
- package/src/set/string.ts +48 -23
- package/src/set/types.ts +2 -1
- package/test/setWalker.ts +7 -0
- package/dist/parse.d.ts +0 -2
- package/dist/parse.js +0 -9
- package/dist/parse.js.map +0 -1
package/dist/set/number.js
CHANGED
|
@@ -2,7 +2,46 @@
|
|
|
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.maximum) {
|
|
10
|
+
if (fieldSchema.exclusiveMaximum && value > value) {
|
|
11
|
+
(0, error_1.error)(path, error_1.ParseError.exceedsMaximum);
|
|
12
|
+
}
|
|
13
|
+
else if (value >= value) {
|
|
14
|
+
(0, error_1.error)(path, error_1.ParseError.exceedsMaximum);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (fieldSchema.minimum) {
|
|
18
|
+
if (fieldSchema.exclusiveMinimum && value < value) {
|
|
19
|
+
(0, error_1.error)(path, error_1.ParseError.subceedsMinimum);
|
|
20
|
+
}
|
|
21
|
+
else if (value <= value) {
|
|
22
|
+
(0, error_1.error)(path, error_1.ParseError.subceedsMinimum);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return value;
|
|
26
|
+
};
|
|
27
|
+
const shared = (path, value, fieldSchema) => {
|
|
28
|
+
if (typeof value === 'object') {
|
|
29
|
+
if (value.$increment) {
|
|
30
|
+
validate([...path, '$increment'], value.$increment, fieldSchema);
|
|
31
|
+
}
|
|
32
|
+
if (value.$decrement) {
|
|
33
|
+
validate([...path, '$decrement'], value.$decrement, fieldSchema);
|
|
34
|
+
}
|
|
35
|
+
if (value.$value) {
|
|
36
|
+
validate([...path], value.$value, fieldSchema);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
validate(path, value, fieldSchema);
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
};
|
|
44
|
+
const timestamp = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
6
45
|
if (typeof value === 'string') {
|
|
7
46
|
if (value === 'now') {
|
|
8
47
|
value = Date.now();
|
|
@@ -15,43 +54,45 @@ const timestamp = async (path, value, fieldSchema, typeSchema, target, handlers)
|
|
|
15
54
|
}
|
|
16
55
|
}
|
|
17
56
|
}
|
|
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 });
|
|
57
|
+
const parsedValue = shared(path, value, fieldSchema);
|
|
58
|
+
if (!noCollect) {
|
|
59
|
+
handlers.collect({
|
|
60
|
+
path,
|
|
61
|
+
value: parsedValue,
|
|
62
|
+
typeSchema,
|
|
63
|
+
fieldSchema,
|
|
64
|
+
target,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
37
67
|
};
|
|
38
68
|
exports.timestamp = timestamp;
|
|
39
|
-
const number = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
69
|
+
const number = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
70
|
+
const parsedValue = shared(path, value, fieldSchema);
|
|
71
|
+
if (!noCollect) {
|
|
72
|
+
handlers.collect({
|
|
73
|
+
path,
|
|
74
|
+
value: parsedValue,
|
|
75
|
+
typeSchema,
|
|
76
|
+
fieldSchema,
|
|
77
|
+
target,
|
|
78
|
+
});
|
|
44
79
|
}
|
|
45
|
-
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
46
80
|
};
|
|
47
81
|
exports.number = number;
|
|
48
|
-
const integer = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
49
|
-
|
|
50
|
-
// $increment / $decrement
|
|
51
|
-
if (typeof value !== 'number' || value - Math.floor(value) !== 0) {
|
|
82
|
+
const integer = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
83
|
+
if (typeof value === 'number' && value - Math.floor(value) !== 0) {
|
|
52
84
|
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
53
85
|
}
|
|
54
|
-
|
|
86
|
+
const parsedValue = shared(path, value, fieldSchema);
|
|
87
|
+
if (!noCollect) {
|
|
88
|
+
handlers.collect({
|
|
89
|
+
path,
|
|
90
|
+
value: parsedValue,
|
|
91
|
+
typeSchema,
|
|
92
|
+
fieldSchema,
|
|
93
|
+
target,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
55
96
|
};
|
|
56
97
|
exports.integer = integer;
|
|
57
98
|
//# 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,GA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C;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,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,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;AAtBY,QAAA,OAAO,WAsBnB"}
|
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,KA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AAC,EAAE,CAAC,EAAE,EAAE;YACjB,OAAO,IAAA,iBAAS,EACd,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,EACZ,CAAC;YACD,gBAAgB;YAChB,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":["../../src/set/rest copy.ts"],"names":[],"mappings":";;;AACA,wCAAwC;AACxC,sCAA4D;AAC5D,mCAA2C;AAEpC,MAAM,WAAW,GAA0B,KAAK,EACrD,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,EAAE;IACF,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACtC,KAAK,GAAG,IAAA,+BAAwB,EAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;KACrD;SAAM;QACL,KAAK,GAAG,IAAA,WAAI,EAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;KACjC;IACD,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAA;AACpE,CAAC,CAAA;AAdY,QAAA,WAAW,eAcvB;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,SAAS,EAAE;QAC9B,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;AAEM,MAAM,UAAU,GAAmB,KAAK,EAC7C,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,EAAE;IACF,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAA;IACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,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
|
@@ -14,36 +14,40 @@ const cardinality = async (path, value, fieldSchema, typeSchema, target, handler
|
|
|
14
14
|
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
15
15
|
};
|
|
16
16
|
exports.cardinality = cardinality;
|
|
17
|
-
const boolean = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
18
|
-
// value .default
|
|
19
|
-
// $increment / $decrement
|
|
17
|
+
const boolean = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
20
18
|
if (typeof value !== 'boolean') {
|
|
21
19
|
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
22
20
|
}
|
|
23
|
-
|
|
21
|
+
if (!noCollect) {
|
|
22
|
+
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
23
|
+
}
|
|
24
24
|
};
|
|
25
25
|
exports.boolean = boolean;
|
|
26
|
-
const enumParser = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
26
|
+
const enumParser = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
27
27
|
const enumValues = fieldSchema.enum;
|
|
28
28
|
for (let i = 0; i < enumValues.length; i++) {
|
|
29
29
|
if ((0, utils_1.deepEqual)(enumValues[i], value)) {
|
|
30
|
-
|
|
30
|
+
if (!noCollect) {
|
|
31
|
+
handlers.collect({ path, value: i, typeSchema, fieldSchema, target });
|
|
32
|
+
}
|
|
31
33
|
return;
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
35
37
|
};
|
|
36
38
|
exports.enumParser = enumParser;
|
|
37
|
-
const json = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
39
|
+
const json = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
38
40
|
try {
|
|
39
41
|
const parsedValue = JSON.stringify(value);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
if (!noCollect) {
|
|
43
|
+
handlers.collect({
|
|
44
|
+
path,
|
|
45
|
+
value: parsedValue,
|
|
46
|
+
typeSchema,
|
|
47
|
+
fieldSchema,
|
|
48
|
+
target,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
47
51
|
}
|
|
48
52
|
catch (err) {
|
|
49
53
|
throw err(path, error_1.ParseError.incorrectFormat);
|
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;AAEpC,MAAM,WAAW,GAA0B,KAAK,EACrD,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,EAAE;IACF,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACtC,KAAK,GAAG,IAAA,+BAAwB,EAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;KACrD;SAAM;QACL,KAAK,GAAG,IAAA,WAAI,EAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;KACjC;IACD,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAA;AACpE,CAAC,CAAA;AAdY,QAAA,WAAW,eAcvB;AAEM,MAAM,OAAO,GAAsB,KAAK,EAC7C,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,EAAE;IACF,
|
|
1
|
+
{"version":3,"file":"rest.js","sourceRoot":"","sources":["../../src/set/rest.ts"],"names":[],"mappings":";;;AACA,wCAAwC;AACxC,sCAA4D;AAC5D,mCAA2C;AAEpC,MAAM,WAAW,GAA0B,KAAK,EACrD,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,EAAE;IACF,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACtC,KAAK,GAAG,IAAA,+BAAwB,EAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;KACrD;SAAM;QACL,KAAK,GAAG,IAAA,WAAI,EAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA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AI,GAAmB,KAAK,EACvC,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,SAAS,EACT,EAAE;IACF,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,MAAM,GAAG,CAAC,IAAI,EAAE,kBAAU,CAAC,eAAe,CAAC,CAAA;KAC5C;AACH,CAAC,CAAA;AAvBY,QAAA,IAAI,QAuBhB"}
|
package/dist/set/string.js
CHANGED
|
@@ -89,22 +89,26 @@ const validate = (path, value, fieldSchema) => {
|
|
|
89
89
|
(0, error_1.error)(path, error_1.ParseError.incorrectFormat);
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
|
-
const string = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
92
|
+
const string = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
93
93
|
validate(path, value, fieldSchema);
|
|
94
|
-
|
|
94
|
+
if (!noCollect) {
|
|
95
|
+
handlers.collect({ path, value, typeSchema, fieldSchema, target });
|
|
96
|
+
}
|
|
95
97
|
};
|
|
96
98
|
exports.string = string;
|
|
97
|
-
const text = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
99
|
+
const text = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
|
|
98
100
|
const valueType = typeof value;
|
|
99
101
|
if (target.$language && valueType === 'string') {
|
|
100
102
|
validate(path, value, fieldSchema);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
if (!noCollect) {
|
|
104
|
+
handlers.collect({
|
|
105
|
+
path,
|
|
106
|
+
value: { [target.$language]: value },
|
|
107
|
+
typeSchema,
|
|
108
|
+
fieldSchema,
|
|
109
|
+
target,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
108
112
|
return;
|
|
109
113
|
}
|
|
110
114
|
if (valueType !== 'object') {
|
|
@@ -112,24 +116,33 @@ const text = async (path, value, fieldSchema, typeSchema, target, handlers) => {
|
|
|
112
116
|
}
|
|
113
117
|
for (const key in value) {
|
|
114
118
|
const newPath = [...path, key];
|
|
115
|
-
if (typeof value[key] === 'object'
|
|
119
|
+
if (typeof value[key] === 'object') {
|
|
120
|
+
if (value[key].$value) {
|
|
121
|
+
(0, exports.text)([...path, key, '$value'], value[key].$value, fieldSchema, typeSchema, target, handlers, true);
|
|
122
|
+
}
|
|
123
|
+
// if (value[key].$default) {
|
|
124
|
+
// }
|
|
125
|
+
if (!noCollect) {
|
|
126
|
+
handlers.collect({
|
|
127
|
+
path: newPath,
|
|
128
|
+
value: null,
|
|
129
|
+
typeSchema,
|
|
130
|
+
fieldSchema,
|
|
131
|
+
target,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
validate(newPath, value[key], fieldSchema);
|
|
137
|
+
if (!noCollect) {
|
|
116
138
|
handlers.collect({
|
|
117
139
|
path: newPath,
|
|
118
|
-
value:
|
|
140
|
+
value: value[key],
|
|
119
141
|
typeSchema,
|
|
120
142
|
fieldSchema,
|
|
121
143
|
target,
|
|
122
144
|
});
|
|
123
|
-
continue;
|
|
124
145
|
}
|
|
125
|
-
validate(newPath, value[key], fieldSchema);
|
|
126
|
-
handlers.collect({
|
|
127
|
-
path: newPath,
|
|
128
|
-
value: value[key],
|
|
129
|
-
typeSchema,
|
|
130
|
-
fieldSchema,
|
|
131
|
-
target,
|
|
132
|
-
});
|
|
133
146
|
}
|
|
134
147
|
};
|
|
135
148
|
exports.text = text;
|
package/dist/set/string.js.map
CHANGED
|
@@ -1 +1 @@
|
|
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OAAO;oBACb,KAAK,EAAE,IAAI;oBACX,UAAU;oBACV,WAAW;oBACX,MAAM;iBACP,CAAC,CAAA;aACH;YACD,SAAQ;SACT;QAED,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,CAAA;QAE1C,IAAI,CAAC,SAAS,EAAE;YACd,QAAQ,CAAC,OAAO,CAAC;gBACf,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC;gBACjB,UAAU;gBACV,WAAW;gBACX,MAAM;aACP,CAAC,CAAA;SACH;KACF;AACH,CAAC,CAAA;AAvEY,QAAA,IAAI,QAuEhB"}
|
package/dist/set/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BasedSchemaType, BasedSetHandlers, BasedSetTarget, BasedSchemaFields } from '../types';
|
|
2
|
-
export type Parser<K extends keyof BasedSchemaFields> = (path: (string | number)[], value: any, fieldSchema: BasedSchemaFields[K], typeSchema: BasedSchemaType, target: BasedSetTarget, handlers: BasedSetHandlers) => Promise<void>;
|
|
2
|
+
export type Parser<K extends keyof BasedSchemaFields> = (path: (string | number)[], value: any, fieldSchema: BasedSchemaFields[K], typeSchema: BasedSchemaType, target: BasedSetTarget, handlers: BasedSetHandlers, noCollect?: boolean) => Promise<void>;
|
|
3
3
|
export type Parsers = {
|
|
4
4
|
[Key in keyof BasedSchemaFields]: Parser<Key>;
|
|
5
5
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BasedSchemaField, BasedSchemaType, BasedSchema, BasedSchemaLanguage } from './types';
|
|
2
|
+
type Target = {
|
|
3
|
+
type: string;
|
|
4
|
+
$alias?: string;
|
|
5
|
+
$id?: string;
|
|
6
|
+
$language?: BasedSchemaLanguage;
|
|
7
|
+
};
|
|
8
|
+
export declare const setWalker: (schema: BasedSchema, value: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}, collect: (path: (string | number)[], value: any, typeSchema: BasedSchemaType, fieldSchema: BasedSchemaField, target: Target) => void) => Target;
|
|
11
|
+
export {};
|