@based/schema 1.3.2 → 2.1.0

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.
Files changed (71) hide show
  1. package/dist/set/fields/string.d.ts.map +1 -1
  2. package/dist/set/fields/string.js +3 -1
  3. package/dist/set/fields/string.js.map +1 -1
  4. package/dist/set/index.d.ts.map +1 -1
  5. package/dist/set/index.js +3 -1
  6. package/dist/set/index.js.map +1 -1
  7. package/dist/types.d.ts +5 -2
  8. package/dist/types.d.ts.map +1 -1
  9. package/dist/types.js +17 -1
  10. package/dist/types.js.map +1 -1
  11. package/dist/updateSchema.js +1 -1
  12. package/dist/updateSchema.js.map +1 -1
  13. package/dist/validateSchema.d.ts.map +1 -1
  14. package/dist/validateSchema.js +5 -2
  15. package/dist/validateSchema.js.map +1 -1
  16. package/package.json +1 -1
  17. package/dist/set/collections.d.ts +0 -5
  18. package/dist/set/collections.js +0 -211
  19. package/dist/set/collections.js.map +0 -1
  20. package/dist/set/error.d.ts +0 -15
  21. package/dist/set/error.js +0 -24
  22. package/dist/set/error.js.map +0 -1
  23. package/dist/set/number.d.ts +0 -4
  24. package/dist/set/number.js +0 -111
  25. package/dist/set/number.js.map +0 -1
  26. package/dist/set/parseDefaultAndValue.d.ts +0 -3
  27. package/dist/set/parseDefaultAndValue.js +0 -33
  28. package/dist/set/parseDefaultAndValue.js.map +0 -1
  29. package/dist/set/parsers.d.ts +0 -3
  30. package/dist/set/parsers.js +0 -42
  31. package/dist/set/parsers.js.map +0 -1
  32. package/dist/set/references.d.ts +0 -3
  33. package/dist/set/references.js +0 -77
  34. package/dist/set/references.js.map +0 -1
  35. package/dist/set/rest.d.ts +0 -5
  36. package/dist/set/rest.js +0 -76
  37. package/dist/set/rest.js.map +0 -1
  38. package/dist/set/string.d.ts +0 -3
  39. package/dist/set/string.js +0 -173
  40. package/dist/set/string.js.map +0 -1
  41. package/src/error.ts +0 -19
  42. package/src/index.ts +0 -7
  43. package/src/languages.ts +0 -188
  44. package/src/set/fields/array.ts +0 -155
  45. package/src/set/fields/index.ts +0 -70
  46. package/src/set/fields/number.ts +0 -144
  47. package/src/set/fields/object.ts +0 -31
  48. package/src/set/fields/references.ts +0 -140
  49. package/src/set/fields/set.ts +0 -63
  50. package/src/set/fields/string.ts +0 -287
  51. package/src/set/index.ts +0 -182
  52. package/src/set/isValidId.ts +0 -23
  53. package/src/set/types.ts +0 -0
  54. package/src/types.ts +0 -361
  55. package/src/updateSchema.ts +0 -18
  56. package/src/validateSchema.ts +0 -61
  57. package/src/walker/args.ts +0 -209
  58. package/src/walker/index.ts +0 -48
  59. package/src/walker/parse.ts +0 -233
  60. package/src/walker/types.ts +0 -81
  61. package/test/array.ts +0 -388
  62. package/test/number.ts +0 -435
  63. package/test/reference.ts +0 -218
  64. package/test/rest.ts +0 -184
  65. package/test/set.ts +0 -103
  66. package/test/string.ts +0 -118
  67. package/test/text.ts +0 -342
  68. package/test/utils/index.ts +0 -23
  69. package/test/validateSchema.ts +0 -41
  70. package/test/walker.ts +0 -318
  71. package/tsconfig.json +0 -9
@@ -1,111 +0,0 @@
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 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) => {
60
- if (typeof value === 'string') {
61
- // TODO: now + 10 and stuff
62
- if (value === 'now') {
63
- value = Date.now();
64
- }
65
- else {
66
- const d = new Date(value);
67
- value = d.valueOf();
68
- if (isNaN(value)) {
69
- (0, error_1.error)(path, error_1.ParseError.incorrectFormat);
70
- }
71
- }
72
- }
73
- const parsedValue = shared(path, value, fieldSchema);
74
- if (!noCollect) {
75
- handlers.collect({
76
- path,
77
- value: parsedValue,
78
- typeSchema,
79
- fieldSchema,
80
- target,
81
- });
82
- }
83
- };
84
- exports.timestamp = timestamp;
85
- const number = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
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
- }
96
- };
97
- exports.number = number;
98
- const integer = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
99
- const parsedValue = shared(path, value, fieldSchema);
100
- if (!noCollect) {
101
- handlers.collect({
102
- path,
103
- value: parsedValue,
104
- typeSchema,
105
- fieldSchema,
106
- target,
107
- });
108
- }
109
- };
110
- exports.integer = integer;
111
- //# sourceMappingURL=number.js.map
@@ -1 +0,0 @@
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,aAAK,EAAC,IAAI,EAAE,kBAAU,CAAC,eAAe,CAAC,CAAA;KACxC;IACD,IAAI,WAAW,CAAC,OAAO,EAAE;QACvB,IAAI,WAAW,CAAC,gBAAgB,IAAI,KAAK,GAAG,KAAK,EAAE;YACjD,IAAA,aAAK,EAAC,IAAI,EAAE,kBAAU,CAAC,cAAc,CAAC,CAAA;SACvC;aAAM,IAAI,KAAK,IAAI,KAAK,EAAE;YACzB,IAAA,aAAK,EAAC,IAAI,EAAE,kBAAU,CAAC,cAAc,CAAC,CAAA;SACvC;KACF;IACD,IAAI,WAAW,CAAC,OAAO,EAAE;QACvB,IAAI,WAAW,CAAC,gBAAgB,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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"}
@@ -1,3 +0,0 @@
1
- import { BasedSchemaFields } from '../types';
2
- import { Parser } from './types';
3
- export declare const parseValueAndDefault: Parser<keyof BasedSchemaFields>;
@@ -1,33 +0,0 @@
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
- await 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
- await 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
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseDefaultAndValue.js","sourceRoot":"","sources":["../../src/set/parseD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"}
@@ -1,3 +0,0 @@
1
- import { Parsers } from './types';
2
- declare const parsers: Parsers;
3
- export default parsers;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- const references = __importStar(require("./references"));
27
- const collections = __importStar(require("./collections"));
28
- const number = __importStar(require("./number"));
29
- const string = __importStar(require("./string"));
30
- const rest_1 = require("./rest");
31
- const parsers = {
32
- ...string,
33
- ...references,
34
- ...collections,
35
- ...number,
36
- enum: rest_1.enumParser,
37
- boolean: rest_1.boolean,
38
- cardinality: rest_1.cardinality,
39
- json: rest_1.json,
40
- };
41
- exports.default = parsers;
42
- //# sourceMappingURL=parsers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../src/set/parsers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,yDAA0C;AAC1C,2DAA4C;AAC5C,iDAAkC;AAClC,iDAAkC;AAElC,iCAA+D;AAE/D,MAAM,OAAO,GAAY;IACvB,GAAG,MAAM;IACT,GAAG,UAAU;IACb,GAAG,WAAW;IACd,GAAG,MAAM;IACT,IAAI,EAAE,iBAAU;IAChB,OAAO,EAAP,cAAO;IACP,WAAW,EAAX,kBAAW;IACX,IAAI,EAAJ,WAAI;CACL,CAAA;AAED,kBAAe,OAAO,CAAA"}
@@ -1,3 +0,0 @@
1
- import { Parser } from './types';
2
- export declare const reference: Parser<'reference'>;
3
- export declare const references: Parser<'references'>;
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.references = exports.reference = void 0;
4
- const error_1 = require("./error");
5
- const reference = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
6
- // $no root
7
- // prob pass these as options
8
- // value .default
9
- // $value
10
- if (typeof value !== 'string') {
11
- (0, error_1.error)(path, error_1.ParseError.incorrectFormat);
12
- }
13
- if ('allowedTypes' in fieldSchema) {
14
- const prefix = value.slice(0, 2);
15
- const targetType = target.schema.prefixToTypeMapping[prefix];
16
- if (!targetType) {
17
- (0, error_1.error)(path, error_1.ParseError.referenceIsIncorrectType);
18
- }
19
- let typeMatches = false;
20
- for (const t of fieldSchema.allowedTypes) {
21
- if (typeof t === 'string') {
22
- if (t === targetType) {
23
- typeMatches = true;
24
- break;
25
- }
26
- }
27
- else {
28
- if (t.type && t.type === targetType) {
29
- typeMatches = true;
30
- if (t.$filter) {
31
- if (!(await handlers.referenceFilterCondition(value, t.$filter))) {
32
- (0, error_1.error)(path, error_1.ParseError.referenceIsIncorrectType);
33
- }
34
- }
35
- }
36
- else if (!t.type && t.$filter) {
37
- if (!(await handlers.referenceFilterCondition(value, t.$filter))) {
38
- (0, error_1.error)(path, error_1.ParseError.referenceIsIncorrectType);
39
- }
40
- }
41
- }
42
- }
43
- if (typeMatches === false) {
44
- (0, error_1.error)(path, error_1.ParseError.referenceIsIncorrectType);
45
- }
46
- }
47
- if (!noCollect) {
48
- handlers.collect({ path, value, typeSchema, fieldSchema, target });
49
- }
50
- };
51
- exports.reference = reference;
52
- const references = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
53
- // default
54
- // $no root
55
- if (Array.isArray(value)) {
56
- await Promise.all(value.map((v, i) => {
57
- return (0, exports.reference)([...path, i], v,
58
- // not nice slow
59
- { ...fieldSchema, type: 'reference' }, typeSchema, target, handlers, true);
60
- }));
61
- value = { $value: value };
62
- }
63
- else if (typeof value === 'object') {
64
- if (value.$add) {
65
- await Promise.all(value.$add.map((v, i) => {
66
- return (0, exports.reference)([...path, '$add', i], v,
67
- // not nice slow
68
- { ...fieldSchema, type: 'reference' }, typeSchema, target, handlers, true);
69
- }));
70
- }
71
- }
72
- if (!noCollect) {
73
- handlers.collect({ path, value, typeSchema, fieldSchema, target });
74
- }
75
- };
76
- exports.references = references;
77
- //# sourceMappingURL=references.js.map
@@ -1 +0,0 @@
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,SAAS,EACT,EAAE;IACF,WAAW;IACX,6BAA6B;IAC7B,iBAAiB;IACjB,SAAS;IAET,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,IAAA,aAAK,EAAC,IAAI,EAAE,kBAAU,CAAC,eAAe,CAAC,CAAA;KACxC;IAED,IAAI,cAAc,IAAI,WAAW,EAAE;QACjC,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QAChC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAA;QAC5D,IAAI,CAAC,UAAU,EAAE;YACf,IAAA,aAAK,EAAC,IAAI,EAAE,kBAAU,CAAC,wBAAwB,CAAC,CAAA;SACjD;QACD,IAAI,WA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SAAS,EACT,EAAE;IACF,UAAU;IACV,WAAW;IACX,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACxB,MAAM,OAAO,CAAC,GAAG,CACf,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,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"}
@@ -1,5 +0,0 @@
1
- import { Parser } from './types';
2
- export declare const cardinality: Parser<'cardinality'>;
3
- export declare const boolean: Parser<'boolean'>;
4
- export declare const enumParser: Parser<'enum'>;
5
- export declare const json: Parser<'json'>;
package/dist/set/rest.js DELETED
@@ -1,76 +0,0 @@
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 parseDefaultAndValue_1 = require("./parseDefaultAndValue");
8
- const cardinality = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
9
- if (value && typeof value === 'object') {
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
- }
19
- }
20
- else {
21
- value = (0, hash_1.hash)(value).toString(16);
22
- }
23
- if (!noCollect) {
24
- handlers.collect({ path, value, typeSchema, fieldSchema, target });
25
- }
26
- };
27
- exports.cardinality = cardinality;
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
- }
32
- if (typeof value !== 'boolean') {
33
- (0, error_1.error)(path, error_1.ParseError.incorrectFormat);
34
- }
35
- if (!noCollect) {
36
- handlers.collect({ path, value, typeSchema, fieldSchema, target });
37
- }
38
- };
39
- exports.boolean = boolean;
40
- const enumParser = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
41
- const enumValues = fieldSchema.enum;
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
- }
50
- }
51
- (0, error_1.error)(path, error_1.ParseError.incorrectFormat);
52
- }
53
- };
54
- exports.enumParser = enumParser;
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
- }
59
- try {
60
- const parsedValue = JSON.stringify(value);
61
- if (!noCollect) {
62
- handlers.collect({
63
- path,
64
- value: parsedValue,
65
- typeSchema,
66
- fieldSchema,
67
- target,
68
- });
69
- }
70
- }
71
- catch (err) {
72
- (0, error_1.error)(path, error_1.ParseError.incorrectFormat);
73
- }
74
- };
75
- exports.json = json;
76
- //# sourceMappingURL=rest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rest.js","sourceRoot":"","sources":["../../src/set/rest.ts"],"names":[],"mappings":";;;AACA,wCAAwC;AACxC,sCAA4D;AAC5D,mCAA2C;AAC3C,iEAA6D;AAEtD,MAAM,WAAW,GAA0B,KAAK,EACrD,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,SAAS,EACT,EAAE;IACF,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACtC,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE;YAChC,IAAA,aAAK,EAAC,IAAI,EAAE,kBAAU,CAAC,mBAAmB,CAAC,CAAA;SAC5C;QACD,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE;YAC9B,KAAK,GAAG,IAAA,+BAAwB,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;SAC5D;aAAM;YACL,KAAK,GAAG,IAAA,+BAAwB,EAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;SACrD;KACF;SAAM;QACL,KAAK,GAAG,IAAA,WAAI,EAAC,KAAK,CAAC,C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,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE;gBACnC,IAAI,CAAC,SAAS,EAAE;oBACd,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAA;iBACtE;gBACD,OAAM;aACP;SACF;QACD,IAAA,aAAK,EAAC,IAAI,EAAE,kBAAU,CAAC,eAAe,CAAC,CAAA;KACxC;AACH,CAAC,CAAA;AA/BY,QAAA,UAAU,cA+BtB;AAEM,MAAM,IAAI,GAAmB,KAAK,EACvC,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,SAAS,EACT,EAAE;IACF,IACE,MAAM,IAAA,2CAAoB,EACxB,IAAI,EACJ,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,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"}
@@ -1,3 +0,0 @@
1
- import { Parser } from './types';
2
- export declare const string: Parser<'string'>;
3
- export declare const text: Parser<'text'>;
@@ -1,173 +0,0 @@
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.text = exports.string = void 0;
7
- const error_1 = require("./error");
8
- const validator_1 = __importDefault(require("validator"));
9
- const parseDefaultAndValue_1 = require("./parseDefaultAndValue");
10
- const formatPatterns = {
11
- email: validator_1.default.isEmail,
12
- URL: validator_1.default.isURL,
13
- MACAddress: validator_1.default.isMACAddress,
14
- IP: validator_1.default.isIP,
15
- IPRange: validator_1.default.isIPRange,
16
- FQDN: validator_1.default.isFQDN,
17
- IBAN: validator_1.default.isIBAN,
18
- BIC: validator_1.default.isBIC,
19
- alpha: validator_1.default.isAlpha,
20
- alphaLocales: validator_1.default.isAlphaLocales,
21
- alphanumeric: validator_1.default.isAlphanumeric,
22
- alphanumericLocales: validator_1.default.isAlphanumericLocales,
23
- passportNumber: validator_1.default.isPassportNumber,
24
- port: validator_1.default.isPort,
25
- lowercase: validator_1.default.isLowercase,
26
- uppercase: validator_1.default.isUppercase,
27
- ascii: validator_1.default.isAscii,
28
- semVer: validator_1.default.isSemVer,
29
- surrogatePair: validator_1.default.isSurrogatePair,
30
- IMEI: validator_1.default.isIMEI,
31
- hexadecimal: validator_1.default.isHexadecimal,
32
- octal: validator_1.default.isOctal,
33
- hexColor: validator_1.default.isHexColor,
34
- rgbColor: validator_1.default.isRgbColor,
35
- HSL: validator_1.default.isHSL,
36
- ISRC: validator_1.default.isISRC,
37
- MD5: validator_1.default.isMD5,
38
- JWT: validator_1.default.isJWT,
39
- UUID: validator_1.default.isUUID,
40
- luhnNumber: validator_1.default.isLuhnNumber,
41
- creditCard: validator_1.default.isCreditCard,
42
- identityCard: validator_1.default.isIdentityCard,
43
- EAN: validator_1.default.isEAN,
44
- ISIN: validator_1.default.isISIN,
45
- ISBN: validator_1.default.isISBN,
46
- ISSN: validator_1.default.isISSN,
47
- mobilePhone: validator_1.default.isMobilePhone,
48
- mobilePhoneLocales: validator_1.default.isMobilePhoneLocales,
49
- postalCode: validator_1.default.isPostalCode,
50
- postalCodeLocales: validator_1.default.isPostalCodeLocales,
51
- ethereumAddress: validator_1.default.isEthereumAddress,
52
- currency: validator_1.default.isCurrency,
53
- btcAddress: validator_1.default.isBtcAddress,
54
- ISO6391: validator_1.default.isISO6391,
55
- ISO8601: validator_1.default.isISO8601,
56
- RFC3339: validator_1.default.isRFC3339,
57
- ISO31661Alpha2: validator_1.default.isISO31661Alpha2,
58
- ISO31661Alpha3: validator_1.default.isISO31661Alpha3,
59
- ISO4217: validator_1.default.isISO4217,
60
- base32: validator_1.default.isBase32,
61
- base58: validator_1.default.isBase58,
62
- base64: validator_1.default.isBase64,
63
- dataURI: validator_1.default.isDataURI,
64
- magnetURI: validator_1.default.isMagnetURI,
65
- mimeType: validator_1.default.isMimeType,
66
- latLong: validator_1.default.isLatLong,
67
- slug: validator_1.default.isSlug,
68
- strongPassword: validator_1.default.isStrongPassword,
69
- taxID: validator_1.default.isTaxID,
70
- licensePlate: validator_1.default.isLicensePlate,
71
- VAT: validator_1.default.isVAT,
72
- };
73
- const validate = (path, value, fieldSchema) => {
74
- if (typeof value !== 'string') {
75
- (0, error_1.error)(path, error_1.ParseError.incorrectFormat);
76
- }
77
- if (fieldSchema.minLength && value.length < fieldSchema.minLength) {
78
- (0, error_1.error)(path, error_1.ParseError.subceedsMinimum);
79
- }
80
- if (fieldSchema.maxLength && value.length > fieldSchema.maxLength) {
81
- (0, error_1.error)(path, error_1.ParseError.exceedsMaximum);
82
- }
83
- if (fieldSchema.pattern) {
84
- const re = new RegExp(fieldSchema.pattern);
85
- if (!re.test(value)) {
86
- (0, error_1.error)(path, error_1.ParseError.incorrectFormat);
87
- }
88
- }
89
- if (fieldSchema.format && !formatPatterns[fieldSchema.format](value)) {
90
- (0, error_1.error)(path, error_1.ParseError.incorrectFormat);
91
- }
92
- };
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
- }
97
- validate(path, value, fieldSchema);
98
- if (!noCollect) {
99
- handlers.collect({ path, value, typeSchema, fieldSchema, target });
100
- }
101
- };
102
- exports.string = string;
103
- const text = async (path, value, fieldSchema, typeSchema, target, handlers, noCollect) => {
104
- const valueType = typeof value;
105
- if (target.$language && valueType === 'string') {
106
- validate(path, value, fieldSchema);
107
- if (!noCollect) {
108
- handlers.collect({
109
- path,
110
- value: { [target.$language]: value },
111
- typeSchema,
112
- fieldSchema,
113
- target,
114
- });
115
- }
116
- return;
117
- }
118
- if (valueType !== 'object') {
119
- (0, error_1.error)(path, error_1.ParseError.incorrectFormat);
120
- }
121
- if (target.$language &&
122
- (await (0, parseDefaultAndValue_1.parseValueAndDefault)(path, value, fieldSchema, typeSchema, target, handlers, noCollect))) {
123
- return;
124
- }
125
- else if (await (0, parseDefaultAndValue_1.parseValueAndDefault)(path, value, fieldSchema, typeSchema, target, handlers, true)) {
126
- if (!noCollect) {
127
- handlers.collect({
128
- path,
129
- value,
130
- typeSchema,
131
- fieldSchema,
132
- target,
133
- });
134
- }
135
- return;
136
- }
137
- for (const key in value) {
138
- const newPath = [...path, key];
139
- // @ts-ignore
140
- if (!target.schema.languages.includes(key)) {
141
- (0, error_1.error)(newPath, error_1.ParseError.languageNotSupported);
142
- }
143
- if (typeof value[key] === 'object') {
144
- if (value[key].$value) {
145
- await (0, exports.text)([...newPath, '$value'], value[key].$value, fieldSchema, typeSchema, target, handlers, true);
146
- }
147
- if (!noCollect) {
148
- handlers.collect({
149
- path: newPath,
150
- value: null,
151
- typeSchema,
152
- fieldSchema,
153
- target,
154
- });
155
- }
156
- continue;
157
- }
158
- if (!(await (0, parseDefaultAndValue_1.parseValueAndDefault)(path, { [key]: value[key] }, fieldSchema, typeSchema, target, handlers, true))) {
159
- validate(newPath, value[key], fieldSchema);
160
- }
161
- if (!noCollect) {
162
- handlers.collect({
163
- path: newPath,
164
- value: value[key],
165
- typeSchema,
166
- fieldSchema,
167
- target,
168
- });
169
- }
170
- }
171
- };
172
- exports.text = text;
173
- //# sourceMappingURL=string.js.map
@@ -1 +0,0 @@
1
- {"version":3,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B,UAAU;gBACV,WAAW;gBACX,MAAM;aACP,CAAC,CAAA;SACH;KACF;AACH,CAAC,CAAA;AAzHY,QAAA,IAAI,QAyHhB"}
package/src/error.ts DELETED
@@ -1,19 +0,0 @@
1
- export enum ParseError {
2
- 'incorrectFieldType',
3
- 'incorrectNodeType',
4
- 'exceedsMaximum',
5
- 'subceedsMinimum',
6
- 'fieldDoesNotExist',
7
- 'incorrectFormat',
8
- 'referenceIsIncorrectType',
9
- 'valueAndDefault',
10
- 'defaultNotSupported',
11
- 'multipleOperationsNotAllowed',
12
- 'requiredFieldNotDefined',
13
- 'languageNotSupported',
14
- 'invalidJSON',
15
- 'noLanguageFound',
16
- 'cannotDeleteNodeFromModify',
17
- 'nestedModifyObjectNotAllowed',
18
- 'infinityNotSupported',
19
- }
package/src/index.ts DELETED
@@ -1,7 +0,0 @@
1
- export * from './types'
2
-
3
- export * from './validateSchema'
4
-
5
- export * from './walker'
6
-
7
- export * from './set'