@based/schema 2.2.10 → 2.2.12

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 (95) hide show
  1. package/dist/{display → src/display}/index.d.ts +1 -1
  2. package/dist/src/display/index.js +16 -0
  3. package/dist/{display → src/display}/number.js +1 -3
  4. package/dist/{display → src/display}/string.js +1 -3
  5. package/dist/{display → src/display}/timestamp.js +1 -3
  6. package/dist/{error.js → src/error.js} +2 -5
  7. package/dist/src/index.d.ts +5 -0
  8. package/dist/src/index.js +6 -0
  9. package/dist/{languages.js → src/languages.js} +1 -4
  10. package/dist/src/set/fields/array.d.ts +2 -0
  11. package/dist/{set → src/set}/fields/array.js +10 -14
  12. package/dist/src/set/fields/index.d.ts +3 -0
  13. package/dist/src/set/fields/index.js +71 -0
  14. package/dist/{set → src/set}/fields/number.d.ts +1 -1
  15. package/dist/{set → src/set}/fields/number.js +15 -21
  16. package/dist/{set → src/set}/fields/object.d.ts +1 -1
  17. package/dist/src/set/fields/object.js +28 -0
  18. package/dist/{set → src/set}/fields/references.d.ts +1 -1
  19. package/dist/{set → src/set}/fields/references.js +13 -18
  20. package/dist/src/set/fields/set.d.ts +2 -0
  21. package/dist/{set → src/set}/fields/set.js +4 -8
  22. package/dist/{set → src/set}/fields/string.d.ts +1 -1
  23. package/dist/{set → src/set}/fields/string.js +87 -95
  24. package/dist/{set → src/set}/index.d.ts +2 -2
  25. package/dist/{set → src/set}/index.js +21 -25
  26. package/dist/{set → src/set}/isValidId.d.ts +1 -1
  27. package/dist/{set → src/set}/isValidId.js +1 -5
  28. package/dist/{types.d.ts → src/types.d.ts} +7 -6
  29. package/dist/src/types.js +23 -0
  30. package/dist/src/updateSchema.d.ts +2 -0
  31. package/dist/src/updateSchema.js +12 -0
  32. package/dist/src/validateSchema.d.ts +4 -0
  33. package/dist/{validateSchema.js → src/validateSchema.js} +5 -11
  34. package/dist/{walker → src/walker}/args.d.ts +4 -4
  35. package/dist/{walker → src/walker}/args.js +8 -12
  36. package/dist/src/walker/index.d.ts +6 -0
  37. package/dist/src/walker/index.js +31 -0
  38. package/dist/{walker → src/walker}/parse.d.ts +1 -1
  39. package/dist/{walker → src/walker}/parse.js +7 -11
  40. package/dist/{walker → src/walker}/types.d.ts +3 -3
  41. package/dist/{walker → src/walker}/types.js +2 -5
  42. package/dist/test/array.d.ts +1 -0
  43. package/dist/test/array.js +342 -0
  44. package/dist/test/display.d.ts +1 -0
  45. package/dist/test/display.js +103 -0
  46. package/dist/test/number.d.ts +1 -0
  47. package/dist/test/number.js +374 -0
  48. package/dist/test/reference.d.ts +1 -0
  49. package/dist/test/reference.js +186 -0
  50. package/dist/test/rest.d.ts +1 -0
  51. package/dist/test/rest.js +168 -0
  52. package/dist/test/set.d.ts +1 -0
  53. package/dist/test/set.js +95 -0
  54. package/dist/test/string.d.ts +1 -0
  55. package/dist/test/string.js +120 -0
  56. package/dist/test/text.d.ts +1 -0
  57. package/dist/test/text.js +324 -0
  58. package/dist/test/utils/index.d.ts +11 -0
  59. package/dist/test/utils/index.js +17 -0
  60. package/dist/test/validateSchema.d.ts +1 -0
  61. package/dist/test/validateSchema.js +38 -0
  62. package/dist/test/walker.d.ts +1 -0
  63. package/dist/test/walker.js +289 -0
  64. package/package.json +8 -13
  65. package/dist/display/dateString copy.d.ts +0 -3
  66. package/dist/display/dateString copy.js +0 -127
  67. package/dist/display/dateString.d.ts +0 -3
  68. package/dist/display/dateString.js +0 -127
  69. package/dist/display/display.d.ts +0 -1
  70. package/dist/display/display.js +0 -8
  71. package/dist/display/index.js +0 -26
  72. package/dist/display/number copy.d.ts +0 -3
  73. package/dist/display/number copy.js +0 -81
  74. package/dist/display.d.ts +0 -2
  75. package/dist/display.js +0 -8
  76. package/dist/index.d.ts +0 -5
  77. package/dist/index.js +0 -22
  78. package/dist/set/fields/array.d.ts +0 -2
  79. package/dist/set/fields/index.d.ts +0 -3
  80. package/dist/set/fields/index.js +0 -74
  81. package/dist/set/fields/object.js +0 -33
  82. package/dist/set/fields/set.d.ts +0 -2
  83. package/dist/set/types.d.ts +0 -0
  84. package/dist/set/types.js +0 -1
  85. package/dist/types.js +0 -27
  86. package/dist/updateSchema.d.ts +0 -2
  87. package/dist/updateSchema.js +0 -16
  88. package/dist/validateSchema.d.ts +0 -4
  89. package/dist/walker/index.d.ts +0 -6
  90. package/dist/walker/index.js +0 -49
  91. /package/dist/{display → src/display}/number.d.ts +0 -0
  92. /package/dist/{display → src/display}/string.d.ts +0 -0
  93. /package/dist/{display → src/display}/timestamp.d.ts +0 -0
  94. /package/dist/{error.d.ts → src/error.d.ts} +0 -0
  95. /package/dist/{languages.d.ts → src/languages.d.ts} +0 -0
@@ -1,2 +1,2 @@
1
- import { BasedSchemaField } from '../types';
1
+ import { BasedSchemaField } from '../types.js';
2
2
  export declare const display: (value: string | number | void, field: BasedSchemaField) => string | number | void;
@@ -0,0 +1,16 @@
1
+ import timestampDisplay from './timestamp.js';
2
+ import numberDisplay from './number.js';
3
+ import stringDisplay from './string.js';
4
+ export const display = (value, field) => {
5
+ if (field.type === 'timestamp' && typeof value === 'number') {
6
+ return timestampDisplay(value, field.display);
7
+ }
8
+ if (field.type === 'number' && typeof value === 'number') {
9
+ return numberDisplay(value, field.display);
10
+ }
11
+ if (field.type === 'string' && typeof value === 'string') {
12
+ return stringDisplay(value, field.display);
13
+ }
14
+ return value;
15
+ };
16
+ //# sourceMappingURL=index.js.map
@@ -1,5 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  const parseNumber = (nr, format) => {
4
2
  if (!format) {
5
3
  return nr;
@@ -85,5 +83,5 @@ const parseNumber = (nr, format) => {
85
83
  return nr;
86
84
  }
87
85
  };
88
- exports.default = parseNumber;
86
+ export default parseNumber;
89
87
  //# sourceMappingURL=number.js.map
@@ -1,5 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  const parseString = (value, format) => {
4
2
  if (!format) {
5
3
  return value;
@@ -19,5 +17,5 @@ const parseString = (value, format) => {
19
17
  }
20
18
  return value;
21
19
  };
22
- exports.default = parseString;
20
+ export default parseString;
23
21
  //# sourceMappingURL=string.js.map
@@ -1,5 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  const addZero = (d) => {
4
2
  const s = d + '';
5
3
  if (s.length === 1) {
@@ -7,7 +5,7 @@ const addZero = (d) => {
7
5
  }
8
6
  return s;
9
7
  };
10
- exports.default = (nr, format) => {
8
+ export default (nr, format) => {
11
9
  if (!format) {
12
10
  return nr;
13
11
  }
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ParseError = void 0;
4
- var ParseError;
1
+ export var ParseError;
5
2
  (function (ParseError) {
6
3
  ParseError[ParseError["incorrectFieldType"] = 0] = "incorrectFieldType";
7
4
  ParseError[ParseError["incorrectNodeType"] = 1] = "incorrectNodeType";
@@ -20,5 +17,5 @@ var ParseError;
20
17
  ParseError[ParseError["cannotDeleteNodeFromModify"] = 14] = "cannotDeleteNodeFromModify";
21
18
  ParseError[ParseError["nestedModifyObjectNotAllowed"] = 15] = "nestedModifyObjectNotAllowed";
22
19
  ParseError[ParseError["infinityNotSupported"] = 16] = "infinityNotSupported";
23
- })(ParseError || (exports.ParseError = ParseError = {}));
20
+ })(ParseError || (ParseError = {}));
24
21
  //# sourceMappingURL=error.js.map
@@ -0,0 +1,5 @@
1
+ export * from './types.js';
2
+ export * from './validateSchema.js';
3
+ export * from './walker/index.js';
4
+ export * from './set/index.js';
5
+ export * from './display/index.js';
@@ -0,0 +1,6 @@
1
+ export * from './types.js';
2
+ export * from './validateSchema.js';
3
+ export * from './walker/index.js';
4
+ export * from './set/index.js';
5
+ export * from './display/index.js';
6
+ //# sourceMappingURL=index.js.map
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.languages = void 0;
4
- exports.languages = {
1
+ export const languages = {
5
2
  ab: 'Abkhazian',
6
3
  aa: 'Afar',
7
4
  af: 'Afrikaans',
@@ -0,0 +1,2 @@
1
+ import { FieldParser } from '../../walker/index.js';
2
+ export declare const array: FieldParser<'array'>;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.array = void 0;
4
- const utils_1 = require("@saulx/utils");
5
- const error_1 = require("../../error");
1
+ import { setByPath } from '@saulx/utils';
2
+ import { ParseError } from '../../error.js';
6
3
  const collectOperation = (fromArgs, collected, value, makeNegative) => {
7
4
  fromArgs.collect(value);
8
5
  if (collected.length) {
@@ -34,7 +31,7 @@ const parseArray = async (args, value, idx = 0) => {
34
31
  const p = nArgs.path.slice(args.path.length);
35
32
  // @ts-ignore
36
33
  p[0] = p[0] - idx;
37
- (0, utils_1.setByPath)(arr, p, nArgs.value);
34
+ setByPath(arr, p, nArgs.value);
38
35
  if (collectNested) {
39
36
  collected.push(nArgs);
40
37
  }
@@ -47,7 +44,7 @@ const parseArray = async (args, value, idx = 0) => {
47
44
  const operations = {
48
45
  $insert: async (args, value) => {
49
46
  if (typeof value.$insert.$idx !== 'number') {
50
- args.error(error_1.ParseError.incorrectFormat);
47
+ args.error(ParseError.incorrectFormat);
51
48
  return;
52
49
  }
53
50
  const { collected, arr } = await parseArray(args, value.$insert.$value, value.$insert.$idx);
@@ -66,7 +63,7 @@ const operations = {
66
63
  },
67
64
  $remove: async (args, value) => {
68
65
  if (typeof value.$remove.$idx !== 'number') {
69
- args.error(error_1.ParseError.incorrectFormat);
66
+ args.error(ParseError.incorrectFormat);
70
67
  return;
71
68
  }
72
69
  args.collect(value);
@@ -74,7 +71,7 @@ const operations = {
74
71
  $assign: async (args, value) => {
75
72
  if (typeof value.$assign !== 'object' ||
76
73
  typeof value.$assign.$idx !== 'number') {
77
- args.error(error_1.ParseError.incorrectFormat);
74
+ args.error(ParseError.incorrectFormat);
78
75
  return;
79
76
  }
80
77
  await args.parse({
@@ -84,10 +81,10 @@ const operations = {
84
81
  });
85
82
  },
86
83
  };
87
- const array = async (args) => {
84
+ export const array = async (args) => {
88
85
  args.stop();
89
86
  if (typeof args.value !== 'object') {
90
- args.error(error_1.ParseError.incorrectFormat);
87
+ args.error(ParseError.incorrectFormat);
91
88
  return;
92
89
  }
93
90
  let value = '$value' in args.value ? args.value.$value : args.value;
@@ -108,16 +105,15 @@ const array = async (args) => {
108
105
  for (const key in value) {
109
106
  if (operations[key]) {
110
107
  if (hasOperation) {
111
- args.error(error_1.ParseError.multipleOperationsNotAllowed);
108
+ args.error(ParseError.multipleOperationsNotAllowed);
112
109
  return;
113
110
  }
114
111
  await operations[key](args, value);
115
112
  hasOperation = true;
116
113
  }
117
114
  else {
118
- args.error(error_1.ParseError.fieldDoesNotExist);
115
+ args.error(ParseError.fieldDoesNotExist);
119
116
  }
120
117
  }
121
118
  };
122
- exports.array = array;
123
119
  //# sourceMappingURL=array.js.map
@@ -0,0 +1,3 @@
1
+ import { FieldParsers } from '../../walker/index.js';
2
+ import { BasedSetTarget } from '../../types.js';
3
+ export declare const fields: Partial<FieldParsers<BasedSetTarget>>;
@@ -0,0 +1,71 @@
1
+ import { ParseError } from '../../error.js';
2
+ import { array } from './array.js';
3
+ import { object, record } from './object.js';
4
+ import { number, integer, timestamp } from './number.js';
5
+ import { string, text } from './string.js';
6
+ import { reference, references } from './references.js';
7
+ import { set } from './set.js';
8
+ import { hashObjectIgnoreKeyOrder, hash } from '@saulx/hash';
9
+ import { deepEqual } from '@saulx/utils';
10
+ export const fields = {
11
+ array,
12
+ object,
13
+ record,
14
+ number,
15
+ integer,
16
+ timestamp,
17
+ string,
18
+ set,
19
+ text,
20
+ reference,
21
+ references,
22
+ cardinality: async (args) => {
23
+ let hashedValue;
24
+ if (args.value && typeof args.value === 'object') {
25
+ args.stop();
26
+ if (args.value.$default !== undefined) {
27
+ args.error(ParseError.defaultNotSupported);
28
+ return;
29
+ }
30
+ if (args.value.$value !== undefined) {
31
+ hashedValue = hashObjectIgnoreKeyOrder(args.value.$value).toString(16);
32
+ }
33
+ else {
34
+ hashedValue = hashObjectIgnoreKeyOrder(args.value).toString(16);
35
+ }
36
+ }
37
+ else {
38
+ hashedValue = hash(args.value).toString(16);
39
+ }
40
+ args.collect(hashedValue);
41
+ },
42
+ boolean: async (args) => {
43
+ if (typeof args.value !== 'boolean') {
44
+ args.error(ParseError.incorrectFormat);
45
+ return;
46
+ }
47
+ args.collect();
48
+ },
49
+ json: async (args) => {
50
+ args.stop();
51
+ try {
52
+ const parsedValue = JSON.stringify(args.value);
53
+ args.collect(parsedValue);
54
+ }
55
+ catch (err) {
56
+ args.error(ParseError.invalidJSON);
57
+ }
58
+ },
59
+ enum: async (args) => {
60
+ // args.stop()
61
+ const enumValues = args.fieldSchema.enum;
62
+ for (let i = 0; i < enumValues.length; i++) {
63
+ if (deepEqual(enumValues[i], args.value)) {
64
+ args.collect(i);
65
+ return;
66
+ }
67
+ }
68
+ args.error(ParseError.incorrectFormat);
69
+ },
70
+ };
71
+ //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { FieldParser } from '../../walker';
1
+ import { FieldParser } from '../../walker/index.js';
2
2
  export declare const number: FieldParser<'number'>;
3
3
  export declare const integer: FieldParser<'integer'>;
4
4
  export declare const timestamp: FieldParser<'timestamp'>;
@@ -1,30 +1,27 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.timestamp = exports.integer = exports.number = void 0;
4
- const error_1 = require("../../error");
1
+ import { ParseError } from '../../error.js';
5
2
  const validateNumber = (args, value, ignoreMinMax) => {
6
3
  const { fieldSchema } = args;
7
4
  if (typeof value !== 'number') {
8
- args.error(error_1.ParseError.incorrectFormat);
5
+ args.error(ParseError.incorrectFormat);
9
6
  return false;
10
7
  }
11
8
  if (isNaN(value)) {
12
- args.error(error_1.ParseError.incorrectFormat);
9
+ args.error(ParseError.incorrectFormat);
13
10
  return false;
14
11
  }
15
12
  if (value === Infinity || value === -Infinity) {
16
- args.error(error_1.ParseError.infinityNotSupported);
13
+ args.error(ParseError.infinityNotSupported);
17
14
  return false;
18
15
  }
19
16
  if (fieldSchema.type === 'integer' && value - Math.floor(value) !== 0) {
20
- args.error(error_1.ParseError.incorrectFormat);
17
+ args.error(ParseError.incorrectFormat);
21
18
  return false;
22
19
  }
23
20
  if (fieldSchema.multipleOf &&
24
21
  value / fieldSchema.multipleOf -
25
22
  Math.floor(value / fieldSchema.multipleOf) !==
26
23
  0) {
27
- args.error(error_1.ParseError.incorrectFormat);
24
+ args.error(ParseError.incorrectFormat);
28
25
  return false;
29
26
  }
30
27
  if (ignoreMinMax) {
@@ -34,24 +31,24 @@ const validateNumber = (args, value, ignoreMinMax) => {
34
31
  if (fieldSchema.maximum) {
35
32
  if (fieldSchema.exclusiveMaximum) {
36
33
  if (value >= fieldSchema.maximum) {
37
- args.error(error_1.ParseError.exceedsMaximum);
34
+ args.error(ParseError.exceedsMaximum);
38
35
  return false;
39
36
  }
40
37
  }
41
38
  else if (value > fieldSchema.maximum) {
42
- args.error(error_1.ParseError.exceedsMaximum);
39
+ args.error(ParseError.exceedsMaximum);
43
40
  return false;
44
41
  }
45
42
  }
46
43
  if (fieldSchema.minimum) {
47
44
  if (fieldSchema.exclusiveMinimum) {
48
45
  if (value <= fieldSchema.minimum) {
49
- args.error(error_1.ParseError.subceedsMinimum);
46
+ args.error(ParseError.subceedsMinimum);
50
47
  return false;
51
48
  }
52
49
  }
53
50
  else if (value < fieldSchema.minimum) {
54
- args.error(error_1.ParseError.subceedsMinimum);
51
+ args.error(ParseError.subceedsMinimum);
55
52
  return false;
56
53
  }
57
54
  }
@@ -85,27 +82,25 @@ const validate = (args, value) => {
85
82
  }
86
83
  }
87
84
  else {
88
- args.create({ key }).error(error_1.ParseError.fieldDoesNotExist);
85
+ args.create({ key }).error(ParseError.fieldDoesNotExist);
89
86
  return false;
90
87
  }
91
88
  }
92
89
  return true;
93
90
  };
94
- const number = async (args) => {
91
+ export const number = async (args) => {
95
92
  if (!validate(args, args.value)) {
96
93
  return;
97
94
  }
98
95
  args.collect();
99
96
  };
100
- exports.number = number;
101
- const integer = async (args) => {
97
+ export const integer = async (args) => {
102
98
  if (!validate(args, args.value)) {
103
99
  return;
104
100
  }
105
101
  args.collect();
106
102
  };
107
- exports.integer = integer;
108
- const timestamp = async (args) => {
103
+ export const timestamp = async (args) => {
109
104
  if (typeof args.value === 'string') {
110
105
  if (args.value === 'now') {
111
106
  // TODO: + 1s + 10s etc
@@ -115,7 +110,7 @@ const timestamp = async (args) => {
115
110
  const d = new Date(args.value);
116
111
  args.value = d.valueOf();
117
112
  if (isNaN(args.value)) {
118
- args.error(error_1.ParseError.incorrectFormat);
113
+ args.error(ParseError.incorrectFormat);
119
114
  return;
120
115
  }
121
116
  }
@@ -125,5 +120,4 @@ const timestamp = async (args) => {
125
120
  }
126
121
  args.collect();
127
122
  };
128
- exports.timestamp = timestamp;
129
123
  //# sourceMappingURL=number.js.map
@@ -1,3 +1,3 @@
1
- import { FieldParser } from '../../walker';
1
+ import { FieldParser } from '../../walker/index.js';
2
2
  export declare const object: FieldParser<'object'>;
3
3
  export declare const record: FieldParser<'record'>;
@@ -0,0 +1,28 @@
1
+ import { ParseError } from '../../error.js';
2
+ export const object = async (args) => {
3
+ if (typeof args.value !== 'object' || args.value === null) {
4
+ args.error(ParseError.incorrectFormat);
5
+ return;
6
+ }
7
+ const isArray = Array.isArray(args.value);
8
+ if (isArray) {
9
+ args.error(ParseError.incorrectFormat);
10
+ return;
11
+ }
12
+ args.collect();
13
+ return args;
14
+ };
15
+ export const record = async (args) => {
16
+ if (typeof args.value !== 'object' || args.value === null) {
17
+ args.error(ParseError.incorrectFormat);
18
+ return;
19
+ }
20
+ const isArray = Array.isArray(args.value);
21
+ if (isArray) {
22
+ args.error(ParseError.incorrectFormat);
23
+ return;
24
+ }
25
+ args.collect();
26
+ return args;
27
+ };
28
+ //# sourceMappingURL=object.js.map
@@ -1,3 +1,3 @@
1
- import { FieldParser } from '../../walker';
1
+ import { FieldParser } from '../../walker/index.js';
2
2
  export declare const reference: FieldParser<'reference'>;
3
3
  export declare const references: FieldParser<'references'>;
@@ -1,8 +1,5 @@
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 isValidId_1 = require("../isValidId");
1
+ import { ParseError } from '../../error.js';
2
+ import { isValidId } from '../isValidId.js';
6
3
  async function parseOperator(args, key) {
7
4
  if (Array.isArray(args.value[key])) {
8
5
  const n = args.create({
@@ -21,7 +18,7 @@ async function parseOperator(args, key) {
21
18
  key,
22
19
  skipCollection: true,
23
20
  });
24
- await (0, exports.reference)(n);
21
+ await reference(n);
25
22
  return [n.value];
26
23
  }
27
24
  const typeIsAllowed = (args, type) => {
@@ -58,13 +55,13 @@ const typeIsAllowed = (args, type) => {
58
55
  }
59
56
  return true;
60
57
  };
61
- const reference = async (args) => {
58
+ export const reference = async (args) => {
62
59
  // TODO: setting an object here , handling $alias (both async hooks)
63
60
  // Block if path contains $remove (maybe not for $alias)
64
61
  if (typeof args.value === 'object') {
65
62
  if (args.root._opts.asyncOperationHandler) {
66
63
  if (args.value.type && !typeIsAllowed(args, args.value.type)) {
67
- args.error(error_1.ParseError.referenceIsIncorrectType);
64
+ args.error(ParseError.referenceIsIncorrectType);
68
65
  return;
69
66
  }
70
67
  if (!args.target.errors.length) {
@@ -72,12 +69,12 @@ const reference = async (args) => {
72
69
  }
73
70
  }
74
71
  else {
75
- args.error(error_1.ParseError.nestedModifyObjectNotAllowed);
72
+ args.error(ParseError.nestedModifyObjectNotAllowed);
76
73
  return;
77
74
  }
78
75
  }
79
- if (!(0, isValidId_1.isValidId)(args.schema, args.value)) {
80
- args.error(error_1.ParseError.incorrectFormat);
76
+ if (!isValidId(args.schema, args.value)) {
77
+ args.error(ParseError.incorrectFormat);
81
78
  return;
82
79
  }
83
80
  const prefix = args.value.slice(0, 2);
@@ -86,14 +83,13 @@ const reference = async (args) => {
86
83
  args.collect();
87
84
  }
88
85
  else {
89
- args.error(error_1.ParseError.referenceIsIncorrectType);
86
+ args.error(ParseError.referenceIsIncorrectType);
90
87
  }
91
88
  };
92
- exports.reference = reference;
93
- const references = async (args) => {
89
+ export const references = async (args) => {
94
90
  const { value } = args;
95
91
  if (typeof value !== 'object' || value === null) {
96
- args.error(error_1.ParseError.incorrectFormat);
92
+ args.error(ParseError.incorrectFormat);
97
93
  return;
98
94
  }
99
95
  args.stop();
@@ -104,7 +100,7 @@ const references = async (args) => {
104
100
  key,
105
101
  skipCollection: true,
106
102
  });
107
- await (0, exports.reference)(n);
103
+ await reference(n);
108
104
  return n.value;
109
105
  }));
110
106
  args.value = { $value: parseValues };
@@ -118,11 +114,10 @@ const references = async (args) => {
118
114
  args.value.$remove = await parseOperator(args, key);
119
115
  }
120
116
  else {
121
- args.create({ key }).error(error_1.ParseError.fieldDoesNotExist);
117
+ args.create({ key }).error(ParseError.fieldDoesNotExist);
122
118
  }
123
119
  }
124
120
  }
125
121
  args.collect();
126
122
  };
127
- exports.references = references;
128
123
  //# sourceMappingURL=references.js.map
@@ -0,0 +1,2 @@
1
+ import { FieldParser } from '../../walker/index.js';
2
+ export declare const set: FieldParser<'set'>;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.set = void 0;
4
- const error_1 = require("../../error");
1
+ import { ParseError } from '../../error.js';
5
2
  async function parseOperator(args, key) {
6
3
  if (Array.isArray(args.value[key])) {
7
4
  const n = args.create({
@@ -24,9 +21,9 @@ async function parseOperator(args, key) {
24
21
  await n.parse();
25
22
  return [n.value];
26
23
  }
27
- const set = async (args) => {
24
+ export const set = async (args) => {
28
25
  if (typeof args.value !== 'object' || args.value === null) {
29
- args.error(error_1.ParseError.incorrectFormat);
26
+ args.error(ParseError.incorrectFormat);
30
27
  return;
31
28
  }
32
29
  args.stop();
@@ -53,11 +50,10 @@ const set = async (args) => {
53
50
  args.value.$remove = await parseOperator(args, key);
54
51
  }
55
52
  else {
56
- args.create({ key }).error(error_1.ParseError.fieldDoesNotExist);
53
+ args.create({ key }).error(ParseError.fieldDoesNotExist);
57
54
  }
58
55
  }
59
56
  }
60
57
  args.collect();
61
58
  };
62
- exports.set = set;
63
59
  //# sourceMappingURL=set.js.map
@@ -1,3 +1,3 @@
1
- import { FieldParser } from '../../walker';
1
+ import { FieldParser } from '../../walker/index.js';
2
2
  export declare const string: FieldParser<'string'>;
3
3
  export declare const text: FieldParser<'text'>;