ag-grid-url-sync 0.2.2 → 0.2.3

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.
@@ -1,5 +1,5 @@
1
1
  import { InvalidFilterError, InvalidURLError, OPERATION_MAP } from './types.js';
2
- import { validateFilterValue, validateAndParseNumber, validateNumberRange, validateNumberFilter, DEFAULT_CONFIG } from './validation.js';
2
+ import { validateFilterValue, validateAndParseNumber, validateNumberRange, validateNumberFilter, validateAndParseDate, validateAndParseDateRange, validateDateFilter, DEFAULT_CONFIG } from './validation.js';
3
3
  /**
4
4
  * Detects if an operation is number-specific
5
5
  */
@@ -13,11 +13,69 @@ function isNumberOperation(operation) {
13
13
  ].includes(operation);
14
14
  }
15
15
  /**
16
- * Detects if an operation works with both text and number filters
16
+ * Detects if an operation is date-specific
17
+ */
18
+ function isDateOperation(operation) {
19
+ return [
20
+ 'dateBefore',
21
+ 'dateBeforeOrEqual',
22
+ 'dateAfter',
23
+ 'dateAfterOrEqual',
24
+ 'dateRange'
25
+ ].includes(operation);
26
+ }
27
+ /**
28
+ * Detects if an operation works across multiple filter types (shared operations)
17
29
  */
18
30
  function isSharedOperation(operation) {
19
31
  return ['eq', 'notEqual', 'blank', 'notBlank'].includes(operation);
20
32
  }
33
+ /**
34
+ * Attempts to parse a value as a date and returns the filter type
35
+ * This is used for shared operations to determine if they should be treated as date filters
36
+ */
37
+ function tryParseAsDate(value) {
38
+ try {
39
+ validateAndParseDate(value);
40
+ return 'date';
41
+ }
42
+ catch {
43
+ return null;
44
+ }
45
+ }
46
+ /**
47
+ * Detects the most appropriate filter type for a shared operation based on the value
48
+ * Priority: Date > Number > Text (if the value can be parsed as date/number, prefer that type)
49
+ */
50
+ function detectFilterTypeForSharedOperation(operation, value) {
51
+ // Blank operations default to text (most common case)
52
+ if (operation === 'blank' || operation === 'notBlank') {
53
+ return 'text';
54
+ }
55
+ // For eq/notEqual operations, try to detect the most specific type
56
+ if (operation === 'eq' || operation === 'notEqual') {
57
+ // Try date first (most specific format)
58
+ if (tryParseAsDate(value) === 'date') {
59
+ return 'date';
60
+ }
61
+ // Try number second
62
+ try {
63
+ const numValue = parseFloat(value);
64
+ if (!isNaN(numValue) && Number.isFinite(numValue)) {
65
+ const validation = validateNumberFilter(numValue);
66
+ if (validation.valid) {
67
+ return 'number';
68
+ }
69
+ }
70
+ }
71
+ catch {
72
+ // Fall through to text
73
+ }
74
+ // Default to text
75
+ return 'text';
76
+ }
77
+ return 'text';
78
+ }
21
79
  /**
22
80
  * Extracts column name and operation from a filter parameter
23
81
  */
@@ -52,7 +110,22 @@ export function parseFilterParam(param, value, expectedPrefix) {
52
110
  if (!filterOp) {
53
111
  throw new InvalidFilterError(`Unsupported filter operation: ${operation}`);
54
112
  }
55
- // Handle range operations
113
+ // Handle date range operations
114
+ if (filterOp === 'dateRange') {
115
+ try {
116
+ const [startDate, endDate] = validateAndParseDateRange(value);
117
+ return {
118
+ filterType: 'date',
119
+ type: filterOp,
120
+ filter: startDate,
121
+ filterTo: endDate
122
+ };
123
+ }
124
+ catch (error) {
125
+ throw new InvalidFilterError(error instanceof Error ? error.message : 'Invalid date range');
126
+ }
127
+ }
128
+ // Handle number range operations
56
129
  if (filterOp === 'inRange') {
57
130
  const rangeParts = value.split(',');
58
131
  if (rangeParts.length !== 2) {
@@ -71,7 +144,25 @@ export function parseFilterParam(param, value, expectedPrefix) {
71
144
  filterTo: max
72
145
  };
73
146
  }
74
- // Handle number operations
147
+ // Handle date-specific operations
148
+ if (isDateOperation(filterOp)) {
149
+ try {
150
+ const dateValue = validateAndParseDate(value);
151
+ const validation = validateDateFilter(dateValue, filterOp);
152
+ if (!validation.valid) {
153
+ throw new InvalidFilterError(validation.error || 'Invalid date filter');
154
+ }
155
+ return {
156
+ filterType: 'date',
157
+ type: filterOp,
158
+ filter: dateValue
159
+ };
160
+ }
161
+ catch (error) {
162
+ throw new InvalidFilterError(error instanceof Error ? error.message : 'Invalid date filter');
163
+ }
164
+ }
165
+ // Handle number-specific operations
75
166
  if (isNumberOperation(filterOp)) {
76
167
  const numValue = validateAndParseNumber(value);
77
168
  return {
@@ -80,40 +171,48 @@ export function parseFilterParam(param, value, expectedPrefix) {
80
171
  filter: numValue
81
172
  };
82
173
  }
83
- // Handle blank operations first (work for both text and number but default to text)
84
- if (filterOp === 'blank' || filterOp === 'notBlank') {
85
- return {
86
- filterType: 'text',
87
- type: filterOp,
88
- filter: '' // Blank operations don't use the value
89
- };
90
- }
91
- // Handle shared operations (eq, notEqual) - detect if they should be number based on value
174
+ // Handle shared operations (eq, notEqual, blank, notBlank)
92
175
  if (isSharedOperation(filterOp)) {
93
- // Try to parse as number first
94
- try {
95
- const numValue = parseFloat(value);
96
- if (!isNaN(numValue) && Number.isFinite(numValue)) {
97
- const validation = validateNumberFilter(numValue);
98
- if (validation.valid) {
99
- return {
100
- filterType: 'number',
101
- type: filterOp,
102
- filter: numValue
103
- };
104
- }
176
+ const detectedType = detectFilterTypeForSharedOperation(filterOp, value);
177
+ if (detectedType === 'date') {
178
+ try {
179
+ const dateValue = validateAndParseDate(value);
180
+ return {
181
+ filterType: 'date',
182
+ type: filterOp,
183
+ filter: dateValue
184
+ };
185
+ }
186
+ catch {
187
+ // If date parsing fails, fall back to text
105
188
  }
106
189
  }
107
- catch {
108
- // Fall through to text handling
190
+ if (detectedType === 'number') {
191
+ try {
192
+ const numValue = parseFloat(value);
193
+ if (!isNaN(numValue) && Number.isFinite(numValue)) {
194
+ const validation = validateNumberFilter(numValue);
195
+ if (validation.valid) {
196
+ return {
197
+ filterType: 'number',
198
+ type: filterOp,
199
+ filter: numValue
200
+ };
201
+ }
202
+ }
203
+ }
204
+ catch {
205
+ // Fall through to text handling
206
+ }
109
207
  }
208
+ // Handle as text filter (default for shared operations)
110
209
  return {
111
210
  filterType: 'text',
112
211
  type: filterOp,
113
- filter: value || ''
212
+ filter: filterOp === 'blank' || filterOp === 'notBlank' ? '' : value || ''
114
213
  };
115
214
  }
116
- // Handle text operations (existing logic)
215
+ // Handle text-specific operations (existing logic)
117
216
  return {
118
217
  filterType: 'text',
119
218
  type: filterOp,
@@ -125,7 +224,32 @@ export function parseFilterParam(param, value, expectedPrefix) {
125
224
  */
126
225
  export function parseUrlFilters(url, config) {
127
226
  try {
128
- const urlObj = new URL(url);
227
+ // Handle empty or whitespace-only URLs gracefully
228
+ if (!url || url.trim() === '') {
229
+ return {};
230
+ }
231
+ // Check for obviously malformed URLs that should throw errors
232
+ if (url === 'not-a-url' ||
233
+ url.startsWith('://') ||
234
+ (!url.includes('://') &&
235
+ !url.startsWith('/') &&
236
+ !url.startsWith('?') &&
237
+ url.includes('.'))) {
238
+ throw new Error('Invalid URL format');
239
+ }
240
+ // If URL starts with '?' treat as query string only
241
+ let urlToProcess = url;
242
+ if (url.startsWith('?')) {
243
+ urlToProcess = `http://example.com${url}`;
244
+ }
245
+ else if (!url.includes('://') && !url.startsWith('/')) {
246
+ // For other cases without protocol, try to handle as query string
247
+ urlToProcess = `http://example.com?${url}`;
248
+ }
249
+ else {
250
+ urlToProcess = url;
251
+ }
252
+ const urlObj = new URL(urlToProcess);
129
253
  const filterState = {};
130
254
  for (const [param, value] of urlObj.searchParams.entries()) {
131
255
  if (!param.startsWith(config.paramPrefix))
@@ -142,23 +266,28 @@ export function parseUrlFilters(url, config) {
142
266
  filter: validatedValue
143
267
  };
144
268
  }
269
+ else if (filterParam.filterType === 'date') {
270
+ // Date filters are already validated in parseFilterParam
271
+ filterState[columnName] = filterParam;
272
+ }
145
273
  else {
146
274
  // Number filters are already validated in parseFilterParam
147
275
  filterState[columnName] = filterParam;
148
276
  }
149
277
  }
150
- catch (err) {
278
+ catch (error) {
279
+ // Log parsing errors through the configured error handler
151
280
  if (config.onParseError) {
152
- config.onParseError(err);
281
+ config.onParseError(error);
153
282
  }
154
- // Skip invalid filters but continue processing
283
+ // Continue processing other parameters instead of failing completely
155
284
  continue;
156
285
  }
157
286
  }
158
287
  return filterState;
159
288
  }
160
- catch (err) {
161
- throw new InvalidURLError(`Failed to parse URL: ${err.message}`);
289
+ catch (error) {
290
+ throw new InvalidURLError(`Failed to parse URL: ${error instanceof Error ? error.message : 'Unknown error'}`);
162
291
  }
163
292
  }
164
293
  //# sourceMappingURL=url-parser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"url-parser.js","sourceRoot":"","sources":["../../src/core/url-parser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/E,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACf,MAAM,iBAAiB,CAAA;AAExB;;GAEG;AACH,SAAS,iBAAiB,CAAC,SAAiB;IAC1C,OAAO;QACL,UAAU;QACV,iBAAiB;QACjB,aAAa;QACb,oBAAoB;QACpB,SAAS;KACV,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;AACvB,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CAAC,SAAiB;IAC1C,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;AACpE,CAAC;AAED;;GAEG;AACH,SAAS,yBAAyB,CAChC,KAAa,EACb,cAAuB;IAEvB,MAAM,wBAAwB,GAAG,CAAC,MAAc,EAAU,EAAE,CAC1D,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,CAAA;IAE9C,MAAM,eAAe,GAAG,cAAc;QACpC,CAAC,CAAC,wBAAwB,CAAC,cAAc,CAAC;QAC1C,CAAC,CAAC,wBAAwB,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;IAExD,MAAM,aAAa,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAClD,IAAI,CAAC,KAAK,CAA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AAwC;gBACxC,IAAI,WAAW,CAAC,UAAU,KAAK,MAAM,EAAE,CAAC;oBACtC,MAAM,cAAc,GAAG,mBAAmB,CACxC,KAAK,EACL,MAAM,EACN,WAAW,CAAC,IAAI,CACjB,CAAA;oBACD,WAAW,CAAC,UAAU,CAAC,GAAG;wBACxB,GAAG,WAAW;wBACd,MAAM,EAAE,cAAc;qBACvB,CAAA;gBACH,CAAC;qBAAM,CAAC;oBACN,2DAA2D;oBAC3D,WAAW,CAAC,UAAU,CAAC,GAAG,WAAW,CAAA;gBACvC,CAAC;YACH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;oBACxB,MAAM,CAAC,YAAY,CAAC,GAAY,CAAC,CAAA;gBACnC,CAAC;gBACD,+CAA+C;gBAC/C,SAAQ;YACV,CAAC;QACH,CAAC;QAED,OAAO,WAAW,CAAA;IACpB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,eAAe,CAAC,wBAAyB,GAAa,CAAC,OAAO,EAAE,CAAC,CAAA;IAC7E,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"url-parser.js","sourceRoot":"","sources":["../../src/core/url-parser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/E,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,cAAc,EACf,MAAM,iBAAiB,CAAA;AAExB;;GAEG;AACH,SAAS,iBAAiB,CAAC,SAAiB;IAC1C,OAAO;QACL,UAAU;QACV,iBAAiB;QACjB,aAAa;QACb,oBAAoB;QACpB,SAAS;KACV,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;AACvB,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,SAAiB;IACxC,OA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C,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CACnF,CAAA;IACH,CAAC;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { InternalConfig, FilterOperation } from './types.js';
1
+ import type { InternalConfig, FilterOperation, DateFilterOperation } from './types.js';
2
2
  /**
3
3
  * Default configuration values
4
4
  */
@@ -9,10 +9,12 @@ export declare const DEFAULT_CONFIG: {
9
9
  /**
10
10
  * Validation result interface
11
11
  */
12
- export interface ValidationResult {
13
- valid: boolean;
14
- error?: string;
15
- }
12
+ export type ValidationResult = {
13
+ valid: true;
14
+ } | {
15
+ valid: false;
16
+ error: string;
17
+ };
16
18
  /**
17
19
  * Validates a text filter value against configuration constraints
18
20
  *
@@ -45,3 +47,34 @@ export declare function validateNumberRange(min: number, max: number): Validatio
45
47
  * @returns Parsed number or throws InvalidFilterError
46
48
  */
47
49
  export declare function validateAndParseNumber(value: string): number;
50
+ /**
51
+ * Validates and parses a date string in ISO format (YYYY-MM-DD)
52
+ *
53
+ * @param value - String representation of date in ISO format
54
+ * @returns Validated ISO date string
55
+ * @throws InvalidDateError if date format is invalid or date doesn't exist
56
+ */
57
+ export declare function validateAndParseDate(value: string): string;
58
+ /**
59
+ * Validates a date filter value
60
+ *
61
+ * @param value - The date value to validate
62
+ * @param operation - The date filter operation
63
+ * @returns Validation result
64
+ */
65
+ export declare function validateDateFilter(value: string, operation: DateFilterOperation): ValidationResult;
66
+ /**
67
+ * Validates a date range filter
68
+ *
69
+ * @param startDate - The start date (ISO format)
70
+ * @param endDate - The end date (ISO format)
71
+ * @returns Validation result
72
+ */
73
+ export declare function validateDateRange(startDate: string, endDate: string): ValidationResult;
74
+ /**
75
+ * Validates a date range from comma-separated string input
76
+ *
77
+ * @param rangeValue - Comma-separated date range (e.g., "2024-01-01,2024-12-31")
78
+ * @returns Tuple of [startDate, endDate] or throws InvalidDateError
79
+ */
80
+ export declare function validateAndParseDateRange(rangeValue: string): [string, string];
@@ -1,4 +1,4 @@
1
- import { InvalidFilterError } from './types.js';
1
+ import { InvalidFilterError, InvalidDateError } from './types.js';
2
2
  /**
3
3
  * Default configuration values
4
4
  */
@@ -71,10 +71,17 @@ export function validateNumberRange(min, max) {
71
71
  * @returns Parsed number or throws InvalidFilterError
72
72
  */
73
73
  export function validateAndParseNumber(value) {
74
- if (!value || value.trim() === '') {
74
+ const trimmedValue = value?.trim();
75
+ if (!trimmedValue) {
75
76
  throw new InvalidFilterError('Number filter value cannot be empty');
76
77
  }
77
- const numValue = parseFloat(value);
78
+ // Use a regex to validate proper number format before parsing
79
+ // This prevents parseFloat from accepting partial numbers like "42abc" -> 42
80
+ const numberRegex = /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;
81
+ if (!numberRegex.test(trimmedValue)) {
82
+ throw new InvalidFilterError(`Invalid number format: ${value}`);
83
+ }
84
+ const numValue = parseFloat(trimmedValue);
78
85
  if (isNaN(numValue)) {
79
86
  throw new InvalidFilterError(`Invalid number format: ${value}`);
80
87
  }
@@ -84,4 +91,109 @@ export function validateAndParseNumber(value) {
84
91
  }
85
92
  return numValue;
86
93
  }
94
+ /**
95
+ * Validates and parses a date string in ISO format (YYYY-MM-DD)
96
+ *
97
+ * @param value - String representation of date in ISO format
98
+ * @returns Validated ISO date string
99
+ * @throws InvalidDateError if date format is invalid or date doesn't exist
100
+ */
101
+ export function validateAndParseDate(value) {
102
+ const trimmedValue = value?.trim();
103
+ if (!trimmedValue) {
104
+ throw new InvalidDateError('Date filter value cannot be empty');
105
+ }
106
+ // Validate ISO date format (YYYY-MM-DD)
107
+ const isoDateRegex = /^\d{4}-\d{2}-\d{2}$/;
108
+ if (!isoDateRegex.test(trimmedValue)) {
109
+ throw new InvalidDateError(`Invalid date format '${value}'. Expected ISO format YYYY-MM-DD (e.g., 2024-01-15)`);
110
+ }
111
+ // Validate that it's a real date by parsing
112
+ const date = new Date(trimmedValue + 'T00:00:00.000Z'); // Force UTC to avoid timezone issues
113
+ if (isNaN(date.getTime())) {
114
+ throw new InvalidDateError(`Invalid date '${value}'. Date does not exist in the calendar`);
115
+ }
116
+ // Additional validation: ensure the parsed date matches the input
117
+ // This catches edge cases like February 30th that might parse differently
118
+ const [year, month, day] = trimmedValue.split('-').map(Number);
119
+ if (date.getUTCFullYear() !== year ||
120
+ date.getUTCMonth() + 1 !== month ||
121
+ date.getUTCDate() !== day) {
122
+ throw new InvalidDateError(`Invalid date '${value}'. Date components don't match calendar date`);
123
+ }
124
+ return trimmedValue;
125
+ }
126
+ /**
127
+ * Validates a date filter value
128
+ *
129
+ * @param value - The date value to validate
130
+ * @param operation - The date filter operation
131
+ * @returns Validation result
132
+ */
133
+ export function validateDateFilter(value, operation) {
134
+ // Blank operations don't require date validation
135
+ if (operation === 'blank' || operation === 'notBlank') {
136
+ return { valid: true };
137
+ }
138
+ try {
139
+ validateAndParseDate(value);
140
+ return { valid: true };
141
+ }
142
+ catch (error) {
143
+ return {
144
+ valid: false,
145
+ error: error instanceof Error ? error.message : 'Invalid date'
146
+ };
147
+ }
148
+ }
149
+ /**
150
+ * Validates a date range filter
151
+ *
152
+ * @param startDate - The start date (ISO format)
153
+ * @param endDate - The end date (ISO format)
154
+ * @returns Validation result
155
+ */
156
+ export function validateDateRange(startDate, endDate) {
157
+ try {
158
+ const validStartDate = validateAndParseDate(startDate);
159
+ const validEndDate = validateAndParseDate(endDate);
160
+ // Check that start date <= end date
161
+ if (validStartDate > validEndDate) {
162
+ return {
163
+ valid: false,
164
+ error: `Date range invalid: start date '${startDate}' must be before or equal to end date '${endDate}'`
165
+ };
166
+ }
167
+ return { valid: true };
168
+ }
169
+ catch (error) {
170
+ return {
171
+ valid: false,
172
+ error: error instanceof Error ? error.message : 'Invalid date range'
173
+ };
174
+ }
175
+ }
176
+ /**
177
+ * Validates a date range from comma-separated string input
178
+ *
179
+ * @param rangeValue - Comma-separated date range (e.g., "2024-01-01,2024-12-31")
180
+ * @returns Tuple of [startDate, endDate] or throws InvalidDateError
181
+ */
182
+ export function validateAndParseDateRange(rangeValue) {
183
+ const trimmedValue = rangeValue?.trim();
184
+ if (!trimmedValue) {
185
+ throw new InvalidDateError('Date range value cannot be empty');
186
+ }
187
+ const rangeParts = trimmedValue.split(',');
188
+ if (rangeParts.length !== 2) {
189
+ throw new InvalidDateError('Date range must contain exactly two dates separated by comma (e.g., "2024-01-01,2024-12-31")');
190
+ }
191
+ const startDate = validateAndParseDate(rangeParts[0]?.trim() ?? '');
192
+ const endDate = validateAndParseDate(rangeParts[1]?.trim() ?? '');
193
+ const rangeValidation = validateDateRange(startDate, endDate);
194
+ if (!rangeValidation.valid) {
195
+ throw new InvalidDateError(rangeValidation.error ?? 'Invalid date range');
196
+ }
197
+ return [startDate, endDate];
198
+ }
87
199
  //# sourceMappingURL=validation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/core/validation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,WAAW,EAAE,IAAI;IACjB,cAAc,EAAE,GAAG;CACX,CAAA;AAUV;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAa,EACb,MAAsB,EACtB,SAA2B;IAE3B,kDAAkD;IAClD,IAAI,SAAS,KAAK,OAAO,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;QACtD,OAAO,EAAE,CAAA;IACX,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,cAAc,EAAE,CAAC;QACzC,MAAM,IAAI,kBAAkB,CAC1B,0CAA0C,MAAM,CAAC,cAAc,aAAa,CAC7E,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,0BAA0B;IAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,C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AAY,GAAG,UAAU,EAAE,IAAI,EAAE,CAAA;IACvC,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,gBAAgB,CAAC,kCAAkC,CAAC,CAAA;IAChE,CAAC;IAED,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC1C,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,gBAAgB,CACxB,8FAA8F,CAC/F,CAAA;IACH,CAAC;IAED,MAAM,SAAS,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;IACnE,MAAM,OAAO,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;IAEjE,MAAM,eAAe,GAAG,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAC7D,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAC3B,MAAM,IAAI,gBAAgB,CAAC,eAAe,CAAC,KAAK,IAAI,oBAAoB,CAAC,CAAA;IAC3E,CAAC;IAED,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC7B,CAAC"}
@@ -13,6 +13,11 @@ export interface UseAGGridUrlSyncOptions extends AGGridUrlSyncConfig {
13
13
  * Default: true
14
14
  */
15
15
  enabledWhenReady?: boolean;
16
+ /**
17
+ * Optional error handler for hook-level errors (initialization, URL operations, etc.)
18
+ * This supplements the core onParseError callback for comprehensive error handling
19
+ */
20
+ onError?: (error: Error, context: string) => void;
16
21
  }
17
22
  /**
18
23
  * Return type for the useAGGridUrlSync hook