@hypequery/protocol 0.1.0 → 0.2.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 (101) hide show
  1. package/README.md +50 -9
  2. package/dist/deployments/errors.d.ts +8 -0
  3. package/dist/deployments/errors.d.ts.map +1 -0
  4. package/dist/deployments/errors.js +13 -0
  5. package/dist/deployments/index.d.ts +5 -0
  6. package/dist/deployments/index.d.ts.map +1 -0
  7. package/dist/deployments/index.js +3 -0
  8. package/dist/deployments/limits.d.ts +4 -0
  9. package/dist/deployments/limits.d.ts.map +1 -0
  10. package/dist/deployments/limits.js +23 -0
  11. package/dist/deployments/types.d.ts +148 -0
  12. package/dist/deployments/types.d.ts.map +1 -0
  13. package/dist/deployments/types.js +1 -0
  14. package/dist/deployments/validate.d.ts +4 -0
  15. package/dist/deployments/validate.d.ts.map +1 -0
  16. package/dist/deployments/validate.js +527 -0
  17. package/dist/expressions/errors.d.ts +8 -0
  18. package/dist/expressions/errors.d.ts.map +1 -0
  19. package/dist/expressions/errors.js +13 -0
  20. package/dist/expressions/index.d.ts +5 -0
  21. package/dist/expressions/index.d.ts.map +1 -0
  22. package/dist/expressions/index.js +3 -0
  23. package/dist/expressions/limits.d.ts +4 -0
  24. package/dist/expressions/limits.d.ts.map +1 -0
  25. package/dist/expressions/limits.js +17 -0
  26. package/dist/expressions/types.d.ts +77 -0
  27. package/dist/expressions/types.d.ts.map +1 -0
  28. package/dist/expressions/types.js +1 -0
  29. package/dist/expressions/validate.d.ts +4 -0
  30. package/dist/expressions/validate.d.ts.map +1 -0
  31. package/dist/expressions/validate.js +338 -0
  32. package/dist/identifiers/identifiers.d.ts +14 -0
  33. package/dist/identifiers/identifiers.d.ts.map +1 -0
  34. package/dist/identifiers/identifiers.js +87 -0
  35. package/dist/identifiers/index.d.ts +4 -0
  36. package/dist/identifiers/index.d.ts.map +1 -0
  37. package/dist/identifiers/index.js +2 -0
  38. package/dist/identifiers/types.d.ts +16 -0
  39. package/dist/identifiers/types.d.ts.map +1 -0
  40. package/dist/identifiers/types.js +5 -0
  41. package/dist/index.d.ts +12 -8
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +6 -1
  44. package/dist/query-implementations/errors.d.ts +8 -0
  45. package/dist/query-implementations/errors.d.ts.map +1 -0
  46. package/dist/query-implementations/errors.js +13 -0
  47. package/dist/query-implementations/index.d.ts +5 -0
  48. package/dist/query-implementations/index.d.ts.map +1 -0
  49. package/dist/query-implementations/index.js +3 -0
  50. package/dist/query-implementations/limits.d.ts +4 -0
  51. package/dist/query-implementations/limits.d.ts.map +1 -0
  52. package/dist/query-implementations/limits.js +22 -0
  53. package/dist/query-implementations/types.d.ts +57 -0
  54. package/dist/query-implementations/types.d.ts.map +1 -0
  55. package/dist/query-implementations/types.js +1 -0
  56. package/dist/query-implementations/validate.d.ts +4 -0
  57. package/dist/query-implementations/validate.d.ts.map +1 -0
  58. package/dist/query-implementations/validate.js +248 -0
  59. package/dist/schemas/errors.d.ts +8 -0
  60. package/dist/schemas/errors.d.ts.map +1 -0
  61. package/dist/schemas/errors.js +13 -0
  62. package/dist/schemas/index.d.ts +5 -0
  63. package/dist/schemas/index.d.ts.map +1 -0
  64. package/dist/schemas/index.js +3 -0
  65. package/dist/schemas/limits.d.ts +4 -0
  66. package/dist/schemas/limits.d.ts.map +1 -0
  67. package/dist/schemas/limits.js +20 -0
  68. package/dist/schemas/types.d.ts +60 -0
  69. package/dist/schemas/types.d.ts.map +1 -0
  70. package/dist/schemas/types.js +1 -0
  71. package/dist/schemas/validate.d.ts +3 -0
  72. package/dist/schemas/validate.d.ts.map +1 -0
  73. package/dist/schemas/validate.js +391 -0
  74. package/dist/values/codec.d.ts +13 -0
  75. package/dist/values/codec.d.ts.map +1 -0
  76. package/dist/values/codec.js +39 -0
  77. package/dist/values/errors.d.ts +8 -0
  78. package/dist/values/errors.d.ts.map +1 -0
  79. package/dist/values/errors.js +13 -0
  80. package/dist/values/index.d.ts +7 -0
  81. package/dist/values/index.d.ts.map +1 -0
  82. package/dist/values/index.js +4 -0
  83. package/dist/values/jcs.d.ts +2 -0
  84. package/dist/values/jcs.d.ts.map +1 -0
  85. package/dist/values/jcs.js +23 -0
  86. package/dist/values/limits.d.ts +4 -0
  87. package/dist/values/limits.d.ts.map +1 -0
  88. package/dist/values/limits.js +26 -0
  89. package/dist/values/parser.d.ts +3 -0
  90. package/dist/values/parser.d.ts.map +1 -0
  91. package/dist/values/parser.js +254 -0
  92. package/dist/values/snapshot.d.ts +3 -0
  93. package/dist/values/snapshot.d.ts.map +1 -0
  94. package/dist/values/snapshot.js +96 -0
  95. package/dist/values/types.d.ts +78 -0
  96. package/dist/values/types.d.ts.map +1 -0
  97. package/dist/values/types.js +1 -0
  98. package/dist/values/validate.d.ts +7 -0
  99. package/dist/values/validate.d.ts.map +1 -0
  100. package/dist/values/validate.js +332 -0
  101. package/package.json +4 -1
@@ -0,0 +1,254 @@
1
+ import { valueError } from './errors.js';
2
+ const textEncoder = new TextEncoder();
3
+ class DuplicateAwareJsonParser {
4
+ source;
5
+ limits;
6
+ index = 0;
7
+ syntaxNodes = 0;
8
+ constructor(source, limits) {
9
+ this.source = source;
10
+ this.limits = limits;
11
+ }
12
+ parse() {
13
+ this.skipWhitespace();
14
+ const value = this.parseValue(0);
15
+ this.skipWhitespace();
16
+ if (this.index !== this.source.length) {
17
+ valueError('HQ_VALUE_INVALID_JSON');
18
+ }
19
+ return value;
20
+ }
21
+ parseValue(depth) {
22
+ this.syntaxNodes += 1;
23
+ if (this.syntaxNodes > this.limits.maxNodes * 16) {
24
+ valueError('HQ_VALUE_TOO_MANY_NODES');
25
+ }
26
+ if (depth > this.limits.maxDepth * 4 + 8) {
27
+ valueError('HQ_VALUE_TOO_DEEP');
28
+ }
29
+ const token = this.source[this.index];
30
+ if (token === '"')
31
+ return this.parseString();
32
+ if (token === '{')
33
+ return this.parseObject(depth + 1);
34
+ if (token === '[')
35
+ return this.parseArray(depth + 1);
36
+ if (token === 't')
37
+ return this.parseLiteral('true', true);
38
+ if (token === 'f')
39
+ return this.parseLiteral('false', false);
40
+ if (token === 'n')
41
+ return this.parseLiteral('null', null);
42
+ if (token === '-' || (token !== undefined && token >= '0' && token <= '9')) {
43
+ return this.parseNumber();
44
+ }
45
+ valueError('HQ_VALUE_INVALID_JSON');
46
+ }
47
+ parseLiteral(source, value) {
48
+ if (this.source.slice(this.index, this.index + source.length) !== source) {
49
+ valueError('HQ_VALUE_INVALID_JSON');
50
+ }
51
+ this.index += source.length;
52
+ return value;
53
+ }
54
+ parseObject(depth) {
55
+ this.index += 1;
56
+ this.skipWhitespace();
57
+ const result = Object.create(null);
58
+ const keys = new Set();
59
+ if (this.source[this.index] === '}') {
60
+ this.index += 1;
61
+ return result;
62
+ }
63
+ while (true) {
64
+ if (this.source[this.index] !== '"') {
65
+ valueError('HQ_VALUE_INVALID_JSON');
66
+ }
67
+ const key = this.parseString();
68
+ if (keys.has(key)) {
69
+ valueError('HQ_VALUE_DUPLICATE_KEY');
70
+ }
71
+ keys.add(key);
72
+ this.skipWhitespace();
73
+ if (this.source[this.index] !== ':') {
74
+ valueError('HQ_VALUE_INVALID_JSON');
75
+ }
76
+ this.index += 1;
77
+ this.skipWhitespace();
78
+ const value = this.parseValue(depth);
79
+ Object.defineProperty(result, key, {
80
+ value,
81
+ enumerable: true,
82
+ configurable: false,
83
+ writable: false,
84
+ });
85
+ this.skipWhitespace();
86
+ const separator = this.source[this.index];
87
+ if (separator === '}') {
88
+ this.index += 1;
89
+ return result;
90
+ }
91
+ if (separator !== ',') {
92
+ valueError('HQ_VALUE_INVALID_JSON');
93
+ }
94
+ this.index += 1;
95
+ this.skipWhitespace();
96
+ }
97
+ }
98
+ parseArray(depth) {
99
+ this.index += 1;
100
+ this.skipWhitespace();
101
+ const result = [];
102
+ if (this.source[this.index] === ']') {
103
+ this.index += 1;
104
+ return result;
105
+ }
106
+ while (true) {
107
+ result.push(this.parseValue(depth));
108
+ this.skipWhitespace();
109
+ const separator = this.source[this.index];
110
+ if (separator === ']') {
111
+ this.index += 1;
112
+ return result;
113
+ }
114
+ if (separator !== ',') {
115
+ valueError('HQ_VALUE_INVALID_JSON');
116
+ }
117
+ this.index += 1;
118
+ this.skipWhitespace();
119
+ }
120
+ }
121
+ parseString() {
122
+ this.index += 1;
123
+ let result = '';
124
+ while (this.index < this.source.length) {
125
+ const character = this.source[this.index];
126
+ if (character === '"') {
127
+ this.index += 1;
128
+ return result;
129
+ }
130
+ if (character === '\\') {
131
+ this.index += 1;
132
+ result += this.parseEscape();
133
+ continue;
134
+ }
135
+ const code = this.source.charCodeAt(this.index);
136
+ if (code <= 0x1f) {
137
+ valueError('HQ_VALUE_INVALID_JSON');
138
+ }
139
+ if (code >= 0xd800 && code <= 0xdbff) {
140
+ const low = this.source.charCodeAt(this.index + 1);
141
+ if (low < 0xdc00 || low > 0xdfff) {
142
+ valueError('HQ_VALUE_INVALID_UNICODE');
143
+ }
144
+ result += character + this.source[this.index + 1];
145
+ this.index += 2;
146
+ continue;
147
+ }
148
+ if (code >= 0xdc00 && code <= 0xdfff) {
149
+ valueError('HQ_VALUE_INVALID_UNICODE');
150
+ }
151
+ result += character;
152
+ this.index += 1;
153
+ }
154
+ valueError('HQ_VALUE_INVALID_JSON');
155
+ }
156
+ parseEscape() {
157
+ const escape = this.source[this.index];
158
+ this.index += 1;
159
+ const simple = {
160
+ '"': '"',
161
+ '\\': '\\',
162
+ '/': '/',
163
+ b: '\b',
164
+ f: '\f',
165
+ n: '\n',
166
+ r: '\r',
167
+ t: '\t',
168
+ };
169
+ if (escape !== undefined && Object.hasOwn(simple, escape)) {
170
+ return simple[escape];
171
+ }
172
+ if (escape !== 'u') {
173
+ valueError('HQ_VALUE_INVALID_JSON');
174
+ }
175
+ const high = this.parseHexCodeUnit();
176
+ if (high >= 0xd800 && high <= 0xdbff) {
177
+ if (this.source.slice(this.index, this.index + 2) !== '\\u') {
178
+ valueError('HQ_VALUE_INVALID_UNICODE');
179
+ }
180
+ this.index += 2;
181
+ const low = this.parseHexCodeUnit();
182
+ if (low < 0xdc00 || low > 0xdfff) {
183
+ valueError('HQ_VALUE_INVALID_UNICODE');
184
+ }
185
+ return String.fromCharCode(high, low);
186
+ }
187
+ if (high >= 0xdc00 && high <= 0xdfff) {
188
+ valueError('HQ_VALUE_INVALID_UNICODE');
189
+ }
190
+ return String.fromCharCode(high);
191
+ }
192
+ parseHexCodeUnit() {
193
+ const value = this.source.slice(this.index, this.index + 4);
194
+ if (!/^[0-9a-fA-F]{4}$/.test(value)) {
195
+ valueError('HQ_VALUE_INVALID_JSON');
196
+ }
197
+ this.index += 4;
198
+ return Number.parseInt(value, 16);
199
+ }
200
+ parseNumber() {
201
+ const match = this.source.slice(this.index).match(/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/);
202
+ if (!match) {
203
+ valueError('HQ_VALUE_INVALID_JSON');
204
+ }
205
+ const token = match[0];
206
+ this.index += token.length;
207
+ const value = Number(token);
208
+ if (!Number.isFinite(value)) {
209
+ valueError('HQ_VALUE_NON_FINITE_FLOAT');
210
+ }
211
+ if (Object.is(value, -0)) {
212
+ valueError('HQ_VALUE_NEGATIVE_ZERO');
213
+ }
214
+ return value;
215
+ }
216
+ skipWhitespace() {
217
+ while (this.source[this.index] === ' '
218
+ || this.source[this.index] === '\n'
219
+ || this.source[this.index] === '\r'
220
+ || this.source[this.index] === '\t') {
221
+ this.index += 1;
222
+ }
223
+ }
224
+ }
225
+ export function parseDuplicateAwareJson(input, limits) {
226
+ let source;
227
+ let byteLength;
228
+ if (typeof input === 'string') {
229
+ if (input.length > limits.maxInputBytes) {
230
+ valueError('HQ_VALUE_TOO_LARGE');
231
+ }
232
+ source = input;
233
+ byteLength = textEncoder.encode(input).byteLength;
234
+ }
235
+ else if (input instanceof Uint8Array) {
236
+ byteLength = input.byteLength;
237
+ try {
238
+ source = new TextDecoder('utf-8', { fatal: true }).decode(input);
239
+ }
240
+ catch {
241
+ valueError('HQ_VALUE_INVALID_UNICODE');
242
+ }
243
+ }
244
+ else {
245
+ valueError('HQ_VALUE_INVALID_JSON');
246
+ }
247
+ if (byteLength > limits.maxInputBytes) {
248
+ valueError('HQ_VALUE_TOO_LARGE');
249
+ }
250
+ if (source.charCodeAt(0) === 0xfeff) {
251
+ valueError('HQ_VALUE_INVALID_JSON');
252
+ }
253
+ return new DuplicateAwareJsonParser(source, limits).parse();
254
+ }
@@ -0,0 +1,3 @@
1
+ import type { CanonicalValueLimits } from './types.js';
2
+ export declare function snapshotPlainData(input: unknown, limits: Readonly<CanonicalValueLimits>): unknown;
3
+ //# sourceMappingURL=snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/values/snapshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAgJvD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,QAAQ,CAAC,oBAAoB,CAAC,GACrC,OAAO,CAMT"}
@@ -0,0 +1,96 @@
1
+ import { valueError } from './errors.js';
2
+ function incrementNodes(state, path) {
3
+ state.nodes += 1;
4
+ // Structural tag fields add overhead beyond logical value nodes. This guard
5
+ // prevents unbounded allocation before exact logical validation runs.
6
+ if (state.nodes > state.limits.maxNodes * 16) {
7
+ valueError('HQ_VALUE_TOO_MANY_NODES', path);
8
+ }
9
+ }
10
+ function snapshotArray(input, state, path, syntaxDepth) {
11
+ const descriptors = Object.getOwnPropertyDescriptors(input);
12
+ const ownKeys = Reflect.ownKeys(descriptors);
13
+ const lengthDescriptor = descriptors.length;
14
+ if (!lengthDescriptor || typeof lengthDescriptor.value !== 'number') {
15
+ valueError('HQ_VALUE_UNSAFE_OBJECT', path);
16
+ }
17
+ const length = lengthDescriptor.value;
18
+ if (!Number.isSafeInteger(length) || length < 0 || length > state.limits.maxNodes * 2) {
19
+ valueError('HQ_VALUE_TOO_MANY_NODES', path);
20
+ }
21
+ for (const key of ownKeys) {
22
+ if (key === 'length')
23
+ continue;
24
+ if (typeof key !== 'string' || !/^(0|[1-9]\d*)$/.test(key)) {
25
+ valueError('HQ_VALUE_UNSAFE_OBJECT', path);
26
+ }
27
+ }
28
+ const result = [];
29
+ for (let index = 0; index < length; index += 1) {
30
+ const descriptor = descriptors[String(index)];
31
+ if (!descriptor || !('value' in descriptor) || !descriptor.enumerable) {
32
+ valueError('HQ_VALUE_INVALID_FORMAT', `${path}[${index}]`);
33
+ }
34
+ result.push(snapshotUnknown(descriptor.value, state, `${path}[${index}]`, syntaxDepth + 1));
35
+ }
36
+ return result;
37
+ }
38
+ function snapshotObject(input, state, path, syntaxDepth) {
39
+ const prototype = Object.getPrototypeOf(input);
40
+ if (prototype !== Object.prototype && prototype !== null) {
41
+ valueError('HQ_VALUE_UNSAFE_OBJECT', path);
42
+ }
43
+ const descriptors = Object.getOwnPropertyDescriptors(input);
44
+ const result = Object.create(null);
45
+ for (const key of Reflect.ownKeys(descriptors)) {
46
+ if (typeof key !== 'string') {
47
+ valueError('HQ_VALUE_UNSAFE_OBJECT', path);
48
+ }
49
+ const descriptor = descriptors[key];
50
+ if (!descriptor || !('value' in descriptor) || !descriptor.enumerable) {
51
+ valueError('HQ_VALUE_UNSAFE_OBJECT', `${path}.${key}`);
52
+ }
53
+ Object.defineProperty(result, key, {
54
+ value: snapshotUnknown(descriptor.value, state, `${path}.${key}`, syntaxDepth + 1),
55
+ enumerable: true,
56
+ configurable: false,
57
+ writable: false,
58
+ });
59
+ }
60
+ return result;
61
+ }
62
+ function snapshotUnknown(input, state, path, syntaxDepth) {
63
+ incrementNodes(state, path);
64
+ if (syntaxDepth > state.limits.maxDepth * 4 + 8) {
65
+ valueError('HQ_VALUE_TOO_DEEP', path);
66
+ }
67
+ if (input === null
68
+ || typeof input === 'boolean'
69
+ || typeof input === 'string'
70
+ || typeof input === 'number') {
71
+ return input;
72
+ }
73
+ if (typeof input !== 'object') {
74
+ valueError('HQ_VALUE_UNSAFE_OBJECT', path);
75
+ }
76
+ if (state.active.has(input)) {
77
+ valueError('HQ_VALUE_INVALID_FORMAT', path);
78
+ }
79
+ state.active.add(input);
80
+ try {
81
+ if (Array.isArray(input)) {
82
+ return snapshotArray(input, state, path, syntaxDepth);
83
+ }
84
+ return snapshotObject(input, state, path, syntaxDepth);
85
+ }
86
+ finally {
87
+ state.active.delete(input);
88
+ }
89
+ }
90
+ export function snapshotPlainData(input, limits) {
91
+ return snapshotUnknown(input, {
92
+ limits,
93
+ active: new WeakSet(),
94
+ nodes: 0,
95
+ }, '$', 0);
96
+ }
@@ -0,0 +1,78 @@
1
+ export interface CanonicalValueLimits {
2
+ readonly maxInputBytes: number;
3
+ readonly maxCanonicalBytes: number;
4
+ readonly maxDepth: number;
5
+ readonly maxNodes: number;
6
+ readonly maxCollectionItems: number;
7
+ readonly maxStringBytes: number;
8
+ readonly maxDecodedBytes: number;
9
+ }
10
+ export interface CanonicalValueOptions {
11
+ /** Product policy may lower, but never raise, the version 1 limits. */
12
+ readonly limits?: Partial<CanonicalValueLimits>;
13
+ /** Containing ClickHouse type when validation depends on schema context. */
14
+ readonly declaredClickHouseType?: string;
15
+ }
16
+ interface TagEnvelope<T> {
17
+ readonly $hypequery: T;
18
+ }
19
+ interface VersionOneTag {
20
+ readonly type: string;
21
+ readonly version: 1;
22
+ }
23
+ export type IntegerTaggedValue = TagEnvelope<VersionOneTag & {
24
+ readonly type: 'integer';
25
+ readonly bits: 8 | 16 | 32 | 64 | 128 | 256;
26
+ readonly signed: boolean;
27
+ readonly value: string;
28
+ }>;
29
+ export type DecimalTaggedValue = TagEnvelope<VersionOneTag & {
30
+ readonly type: 'decimal';
31
+ readonly coefficient: string;
32
+ readonly precision: number;
33
+ readonly scale: number;
34
+ }>;
35
+ export type DateTaggedValue = TagEnvelope<VersionOneTag & {
36
+ readonly type: 'date';
37
+ readonly clickhouseType: 'Date' | 'Date32';
38
+ readonly value: string;
39
+ }>;
40
+ export type DatetimeTaggedValue = TagEnvelope<VersionOneTag & {
41
+ readonly type: 'datetime';
42
+ readonly clickhouseType: 'DateTime' | 'DateTime64';
43
+ readonly precision: number;
44
+ readonly timezone: string;
45
+ readonly value: string;
46
+ }>;
47
+ export type UuidTaggedValue = TagEnvelope<VersionOneTag & {
48
+ readonly type: 'uuid';
49
+ readonly value: string;
50
+ }>;
51
+ export type BytesTaggedValue = TagEnvelope<VersionOneTag & {
52
+ readonly type: 'bytes';
53
+ readonly encoding: 'base64url';
54
+ readonly value: string;
55
+ }>;
56
+ export type EnumTaggedValue = TagEnvelope<VersionOneTag & {
57
+ readonly type: 'enum';
58
+ readonly bits: 8 | 16;
59
+ readonly code: number;
60
+ readonly label: string;
61
+ }>;
62
+ export type ArrayTaggedValue = TagEnvelope<VersionOneTag & {
63
+ readonly type: 'array';
64
+ readonly values: readonly CanonicalValue[];
65
+ }>;
66
+ export type TupleTaggedValue = TagEnvelope<VersionOneTag & {
67
+ readonly type: 'tuple';
68
+ readonly values: readonly CanonicalValue[];
69
+ }>;
70
+ export type MapTaggedValue = TagEnvelope<VersionOneTag & {
71
+ readonly type: 'map';
72
+ readonly entries: readonly (readonly [CanonicalValue, CanonicalValue])[];
73
+ }>;
74
+ export type TaggedValue = IntegerTaggedValue | DecimalTaggedValue | DateTaggedValue | DatetimeTaggedValue | UuidTaggedValue | BytesTaggedValue | EnumTaggedValue | ArrayTaggedValue | TupleTaggedValue | MapTaggedValue;
75
+ /** Native numbers always carry floating-point semantics. Integers are tagged. */
76
+ export type CanonicalValue = null | boolean | string | number | TaggedValue;
77
+ export {};
78
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/values/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC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C5C,CAAC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,aAAa,GAAG;IACzD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC;CAC5C,CAAC,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,aAAa,GAAG;IACvD,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;CAC1E,CAAC,CAAC;AAEH,MAAM,MAAM,WAAW,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,eAAe,GACf,mBAAmB,GACnB,eAAe,GACf,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,cAAc,CAAC;AAEnB,iFAAiF;AACjF,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { CanonicalValue, CanonicalValueLimits, CanonicalValueOptions } from './types.js';
2
+ export declare function validateCanonicalValue(input: unknown, options?: CanonicalValueOptions): CanonicalValue;
3
+ /** Package-internal path for arbitrary input when limits are already resolved. */
4
+ export declare function validateCanonicalValueWithLimits(input: unknown, limits: Readonly<CanonicalValueLimits>, declaredClickHouseType?: string): CanonicalValue;
5
+ /** Package-internal path for trees created by the duplicate-aware parser. */
6
+ export declare function validateParsedCanonicalValue(parsed: unknown, limits: Readonly<CanonicalValueLimits>, declaredClickHouseType?: string): CanonicalValue;
7
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/values/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AA0VpB,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,OAAO,GAAE,qBAA0B,GAClC,cAAc,CAOhB;AAYD,kFAAkF;AAClF,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EACtC,sBAAsB,CAAC,EAAE,MAAM,GAC9B,cAAc,CAGhB;AAED,6EAA6E;AAC7E,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EACtC,sBAAsB,CAAC,EAAE,MAAM,GAC9B,cAAc,CAEhB"}