@object-ui/data-objectstack 0.3.0 → 0.5.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.
package/dist/index.d.cts CHANGED
@@ -8,7 +8,186 @@ import { DataSource, QueryParams, QueryResult } from '@object-ui/types';
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
10
  */
11
+ /**
12
+ * Base error class for all ObjectStack adapter errors
13
+ */
14
+ declare class ObjectStackError extends Error {
15
+ code: string;
16
+ statusCode?: number | undefined;
17
+ details?: Record<string, unknown> | undefined;
18
+ /**
19
+ * Create a new ObjectStackError
20
+ *
21
+ * @param message - Human-readable error message
22
+ * @param code - Unique error code for programmatic handling
23
+ * @param statusCode - Optional HTTP status code
24
+ * @param details - Optional additional error details for debugging
25
+ */
26
+ constructor(message: string, code: string, statusCode?: number | undefined, details?: Record<string, unknown> | undefined);
27
+ /**
28
+ * Convert error to JSON for logging/debugging
29
+ */
30
+ toJSON(): {
31
+ name: string;
32
+ message: string;
33
+ code: string;
34
+ statusCode: number | undefined;
35
+ details: Record<string, unknown> | undefined;
36
+ stack: string | undefined;
37
+ };
38
+ }
39
+ /**
40
+ * Error thrown when requested metadata/schema is not found
41
+ */
42
+ declare class MetadataNotFoundError extends ObjectStackError {
43
+ constructor(objectName: string, details?: Record<string, unknown>);
44
+ }
45
+ /**
46
+ * Error thrown when a bulk operation fails
47
+ */
48
+ declare class BulkOperationError extends ObjectStackError {
49
+ successCount: number;
50
+ failureCount: number;
51
+ errors: Array<{
52
+ index: number;
53
+ error: unknown;
54
+ }>;
55
+ /**
56
+ * Create a new BulkOperationError
57
+ *
58
+ * @param operation - The bulk operation that failed (create, update, delete)
59
+ * @param successCount - Number of successful operations
60
+ * @param failureCount - Number of failed operations
61
+ * @param errors - Array of individual errors
62
+ * @param details - Additional error details
63
+ */
64
+ constructor(operation: 'create' | 'update' | 'delete', successCount: number, failureCount: number, errors: Array<{
65
+ index: number;
66
+ error: unknown;
67
+ }>, details?: Record<string, unknown>);
68
+ /**
69
+ * Get a summary of the bulk operation failure
70
+ */
71
+ getSummary(): {
72
+ operation: string;
73
+ total: number;
74
+ successful: number;
75
+ failed: number;
76
+ failureRate: number;
77
+ errors: {
78
+ index: number;
79
+ error: unknown;
80
+ }[];
81
+ };
82
+ }
83
+ /**
84
+ * Error thrown when connection to ObjectStack server fails
85
+ */
86
+ declare class ConnectionError extends ObjectStackError {
87
+ url?: string | undefined;
88
+ constructor(message: string, url?: string | undefined, details?: Record<string, unknown>, statusCode?: number);
89
+ }
90
+ /**
91
+ * Error thrown when authentication fails
92
+ */
93
+ declare class AuthenticationError extends ObjectStackError {
94
+ constructor(message?: string, details?: Record<string, unknown>, statusCode?: number);
95
+ }
96
+ /**
97
+ * Error thrown when data validation fails
98
+ */
99
+ declare class ValidationError extends ObjectStackError {
100
+ field?: string | undefined;
101
+ validationErrors?: Array<{
102
+ field: string;
103
+ message: string;
104
+ }> | undefined;
105
+ /**
106
+ * Create a new ValidationError
107
+ *
108
+ * @param message - Human-readable error message
109
+ * @param field - The field that failed validation (optional)
110
+ * @param validationErrors - Array of validation error details
111
+ * @param details - Additional error details
112
+ */
113
+ constructor(message: string, field?: string | undefined, validationErrors?: Array<{
114
+ field: string;
115
+ message: string;
116
+ }> | undefined, details?: Record<string, unknown>);
117
+ /**
118
+ * Get all validation errors as a formatted list
119
+ */
120
+ getValidationErrors(): {
121
+ field: string;
122
+ message: string;
123
+ }[];
124
+ }
125
+ /**
126
+ * Helper function to create an error from an HTTP response
127
+ *
128
+ * @param response - Response object or error from fetch/axios
129
+ * @param context - Additional context for debugging
130
+ * @returns Appropriate error instance
131
+ */
132
+ declare function createErrorFromResponse(response: Record<string, unknown>, context?: string): ObjectStackError;
133
+ /**
134
+ * Type guard to check if an error is an ObjectStackError
135
+ */
136
+ declare function isObjectStackError(error: unknown): error is ObjectStackError;
137
+ /**
138
+ * Type guard to check if an error is a specific ObjectStack error type
139
+ */
140
+ declare function isErrorType<T extends ObjectStackError>(error: unknown, errorClass: new (...args: any[]) => T): error is T;
11
141
 
142
+ /**
143
+ * ObjectUI
144
+ * Copyright (c) 2024-present ObjectStack Inc.
145
+ *
146
+ * This source code is licensed under the MIT license found in the
147
+ * LICENSE file in the root directory of this source tree.
148
+ */
149
+ /**
150
+ * Cache statistics for monitoring
151
+ */
152
+ interface CacheStats {
153
+ size: number;
154
+ maxSize: number;
155
+ hits: number;
156
+ misses: number;
157
+ evictions: number;
158
+ hitRate: number;
159
+ }
160
+
161
+ /**
162
+ * Connection state for monitoring
163
+ */
164
+ type ConnectionState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting' | 'error';
165
+ /**
166
+ * Connection state change event
167
+ */
168
+ interface ConnectionStateEvent {
169
+ state: ConnectionState;
170
+ timestamp: number;
171
+ error?: Error;
172
+ }
173
+ /**
174
+ * Batch operation progress event
175
+ */
176
+ interface BatchProgressEvent {
177
+ operation: 'create' | 'update' | 'delete';
178
+ total: number;
179
+ completed: number;
180
+ failed: number;
181
+ percentage: number;
182
+ }
183
+ /**
184
+ * Event listener type for connection state changes
185
+ */
186
+ type ConnectionStateListener = (event: ConnectionStateEvent) => void;
187
+ /**
188
+ * Event listener type for batch operation progress
189
+ */
190
+ type BatchProgressListener = (event: BatchProgressEvent) => void;
12
191
  /**
13
192
  * ObjectStack Data Source Adapter
14
193
  *
@@ -22,7 +201,14 @@ import { DataSource, QueryParams, QueryResult } from '@object-ui/types';
22
201
  *
23
202
  * const dataSource = new ObjectStackAdapter({
24
203
  * baseUrl: 'https://api.example.com',
25
- * token: 'your-api-token'
204
+ * token: 'your-api-token',
205
+ * autoReconnect: true,
206
+ * maxReconnectAttempts: 5
207
+ * });
208
+ *
209
+ * // Monitor connection state
210
+ * dataSource.onConnectionStateChange((event) => {
211
+ * console.log('Connection state:', event.state);
26
212
  * });
27
213
  *
28
214
  * const users = await dataSource.find('users', {
@@ -31,19 +217,62 @@ import { DataSource, QueryParams, QueryResult } from '@object-ui/types';
31
217
  * });
32
218
  * ```
33
219
  */
34
- declare class ObjectStackAdapter<T = any> implements DataSource<T> {
220
+ declare class ObjectStackAdapter<T = unknown> implements DataSource<T> {
35
221
  private client;
36
222
  private connected;
223
+ private metadataCache;
224
+ private connectionState;
225
+ private connectionStateListeners;
226
+ private batchProgressListeners;
227
+ private autoReconnect;
228
+ private maxReconnectAttempts;
229
+ private reconnectDelay;
230
+ private reconnectAttempts;
37
231
  constructor(config: {
38
232
  baseUrl: string;
39
233
  token?: string;
40
234
  fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
235
+ cache?: {
236
+ maxSize?: number;
237
+ ttl?: number;
238
+ };
239
+ autoReconnect?: boolean;
240
+ maxReconnectAttempts?: number;
241
+ reconnectDelay?: number;
41
242
  });
42
243
  /**
43
244
  * Ensure the client is connected to the server.
44
245
  * Call this before making requests or it will auto-connect on first request.
45
246
  */
46
247
  connect(): Promise<void>;
248
+ /**
249
+ * Attempt to reconnect to the server with exponential backoff
250
+ */
251
+ private attemptReconnect;
252
+ /**
253
+ * Get the current connection state
254
+ */
255
+ getConnectionState(): ConnectionState;
256
+ /**
257
+ * Check if the adapter is currently connected
258
+ */
259
+ isConnected(): boolean;
260
+ /**
261
+ * Register a listener for connection state changes
262
+ */
263
+ onConnectionStateChange(listener: ConnectionStateListener): () => void;
264
+ /**
265
+ * Register a listener for batch operation progress
266
+ */
267
+ onBatchProgress(listener: BatchProgressListener): () => void;
268
+ /**
269
+ * Set connection state and notify listeners
270
+ */
271
+ private setConnectionState;
272
+ /**
273
+ * Emit batch progress event to listeners
274
+ */
275
+ private emitBatchProgress;
47
276
  /**
48
277
  * Find multiple records with query parameters.
49
278
  * Converts OData-style params to ObjectStack query options.
@@ -66,7 +295,13 @@ declare class ObjectStackAdapter<T = any> implements DataSource<T> {
66
295
  */
67
296
  delete(resource: string, id: string | number): Promise<boolean>;
68
297
  /**
69
- * Bulk operations (optional implementation).
298
+ * Bulk operations with optimized batch processing and error handling.
299
+ * Emits progress events for tracking operation status.
300
+ *
301
+ * @param resource - Resource name
302
+ * @param operation - Operation type (create, update, delete)
303
+ * @param data - Array of records to process
304
+ * @returns Promise resolving to array of results
70
305
  */
71
306
  bulk(resource: string, operation: 'create' | 'update' | 'delete', data: Partial<T>[]): Promise<T[]>;
72
307
  /**
@@ -76,15 +311,30 @@ declare class ObjectStackAdapter<T = any> implements DataSource<T> {
76
311
  private convertQueryParams;
77
312
  /**
78
313
  * Get object schema/metadata from ObjectStack.
314
+ * Uses caching to improve performance for repeated requests.
79
315
  *
80
316
  * @param objectName - Object name
81
317
  * @returns Promise resolving to the object schema
82
318
  */
83
- getObjectSchema(objectName: string): Promise<any>;
319
+ getObjectSchema(objectName: string): Promise<unknown>;
84
320
  /**
85
321
  * Get access to the underlying ObjectStack client for advanced operations.
86
322
  */
87
323
  getClient(): ObjectStackClient;
324
+ /**
325
+ * Get cache statistics for monitoring performance.
326
+ */
327
+ getCacheStats(): CacheStats;
328
+ /**
329
+ * Invalidate metadata cache entries.
330
+ *
331
+ * @param key - Optional key to invalidate. If omitted, invalidates all entries.
332
+ */
333
+ invalidateCache(key?: string): void;
334
+ /**
335
+ * Clear all cache entries and statistics.
336
+ */
337
+ clearCache(): void;
88
338
  }
89
339
  /**
90
340
  * Factory function to create an ObjectStack data source.
@@ -93,14 +343,24 @@ declare class ObjectStackAdapter<T = any> implements DataSource<T> {
93
343
  * ```typescript
94
344
  * const dataSource = createObjectStackAdapter({
95
345
  * baseUrl: process.env.API_URL,
96
- * token: process.env.API_TOKEN
346
+ * token: process.env.API_TOKEN,
347
+ * cache: { maxSize: 100, ttl: 300000 },
348
+ * autoReconnect: true,
349
+ * maxReconnectAttempts: 5
97
350
  * });
98
351
  * ```
99
352
  */
100
- declare function createObjectStackAdapter<T = any>(config: {
353
+ declare function createObjectStackAdapter<T = unknown>(config: {
101
354
  baseUrl: string;
102
355
  token?: string;
103
356
  fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
357
+ cache?: {
358
+ maxSize?: number;
359
+ ttl?: number;
360
+ };
361
+ autoReconnect?: boolean;
362
+ maxReconnectAttempts?: number;
363
+ reconnectDelay?: number;
104
364
  }): DataSource<T>;
105
365
 
106
- export { ObjectStackAdapter, createObjectStackAdapter };
366
+ export { AuthenticationError, type BatchProgressEvent, type BatchProgressListener, BulkOperationError, type CacheStats, ConnectionError, type ConnectionState, type ConnectionStateEvent, type ConnectionStateListener, MetadataNotFoundError, ObjectStackAdapter, ObjectStackError, ValidationError, createErrorFromResponse, createObjectStackAdapter, isErrorType, isObjectStackError };
package/dist/index.d.ts CHANGED
@@ -8,7 +8,186 @@ import { DataSource, QueryParams, QueryResult } from '@object-ui/types';
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
10
  */
11
+ /**
12
+ * Base error class for all ObjectStack adapter errors
13
+ */
14
+ declare class ObjectStackError extends Error {
15
+ code: string;
16
+ statusCode?: number | undefined;
17
+ details?: Record<string, unknown> | undefined;
18
+ /**
19
+ * Create a new ObjectStackError
20
+ *
21
+ * @param message - Human-readable error message
22
+ * @param code - Unique error code for programmatic handling
23
+ * @param statusCode - Optional HTTP status code
24
+ * @param details - Optional additional error details for debugging
25
+ */
26
+ constructor(message: string, code: string, statusCode?: number | undefined, details?: Record<string, unknown> | undefined);
27
+ /**
28
+ * Convert error to JSON for logging/debugging
29
+ */
30
+ toJSON(): {
31
+ name: string;
32
+ message: string;
33
+ code: string;
34
+ statusCode: number | undefined;
35
+ details: Record<string, unknown> | undefined;
36
+ stack: string | undefined;
37
+ };
38
+ }
39
+ /**
40
+ * Error thrown when requested metadata/schema is not found
41
+ */
42
+ declare class MetadataNotFoundError extends ObjectStackError {
43
+ constructor(objectName: string, details?: Record<string, unknown>);
44
+ }
45
+ /**
46
+ * Error thrown when a bulk operation fails
47
+ */
48
+ declare class BulkOperationError extends ObjectStackError {
49
+ successCount: number;
50
+ failureCount: number;
51
+ errors: Array<{
52
+ index: number;
53
+ error: unknown;
54
+ }>;
55
+ /**
56
+ * Create a new BulkOperationError
57
+ *
58
+ * @param operation - The bulk operation that failed (create, update, delete)
59
+ * @param successCount - Number of successful operations
60
+ * @param failureCount - Number of failed operations
61
+ * @param errors - Array of individual errors
62
+ * @param details - Additional error details
63
+ */
64
+ constructor(operation: 'create' | 'update' | 'delete', successCount: number, failureCount: number, errors: Array<{
65
+ index: number;
66
+ error: unknown;
67
+ }>, details?: Record<string, unknown>);
68
+ /**
69
+ * Get a summary of the bulk operation failure
70
+ */
71
+ getSummary(): {
72
+ operation: string;
73
+ total: number;
74
+ successful: number;
75
+ failed: number;
76
+ failureRate: number;
77
+ errors: {
78
+ index: number;
79
+ error: unknown;
80
+ }[];
81
+ };
82
+ }
83
+ /**
84
+ * Error thrown when connection to ObjectStack server fails
85
+ */
86
+ declare class ConnectionError extends ObjectStackError {
87
+ url?: string | undefined;
88
+ constructor(message: string, url?: string | undefined, details?: Record<string, unknown>, statusCode?: number);
89
+ }
90
+ /**
91
+ * Error thrown when authentication fails
92
+ */
93
+ declare class AuthenticationError extends ObjectStackError {
94
+ constructor(message?: string, details?: Record<string, unknown>, statusCode?: number);
95
+ }
96
+ /**
97
+ * Error thrown when data validation fails
98
+ */
99
+ declare class ValidationError extends ObjectStackError {
100
+ field?: string | undefined;
101
+ validationErrors?: Array<{
102
+ field: string;
103
+ message: string;
104
+ }> | undefined;
105
+ /**
106
+ * Create a new ValidationError
107
+ *
108
+ * @param message - Human-readable error message
109
+ * @param field - The field that failed validation (optional)
110
+ * @param validationErrors - Array of validation error details
111
+ * @param details - Additional error details
112
+ */
113
+ constructor(message: string, field?: string | undefined, validationErrors?: Array<{
114
+ field: string;
115
+ message: string;
116
+ }> | undefined, details?: Record<string, unknown>);
117
+ /**
118
+ * Get all validation errors as a formatted list
119
+ */
120
+ getValidationErrors(): {
121
+ field: string;
122
+ message: string;
123
+ }[];
124
+ }
125
+ /**
126
+ * Helper function to create an error from an HTTP response
127
+ *
128
+ * @param response - Response object or error from fetch/axios
129
+ * @param context - Additional context for debugging
130
+ * @returns Appropriate error instance
131
+ */
132
+ declare function createErrorFromResponse(response: Record<string, unknown>, context?: string): ObjectStackError;
133
+ /**
134
+ * Type guard to check if an error is an ObjectStackError
135
+ */
136
+ declare function isObjectStackError(error: unknown): error is ObjectStackError;
137
+ /**
138
+ * Type guard to check if an error is a specific ObjectStack error type
139
+ */
140
+ declare function isErrorType<T extends ObjectStackError>(error: unknown, errorClass: new (...args: any[]) => T): error is T;
11
141
 
142
+ /**
143
+ * ObjectUI
144
+ * Copyright (c) 2024-present ObjectStack Inc.
145
+ *
146
+ * This source code is licensed under the MIT license found in the
147
+ * LICENSE file in the root directory of this source tree.
148
+ */
149
+ /**
150
+ * Cache statistics for monitoring
151
+ */
152
+ interface CacheStats {
153
+ size: number;
154
+ maxSize: number;
155
+ hits: number;
156
+ misses: number;
157
+ evictions: number;
158
+ hitRate: number;
159
+ }
160
+
161
+ /**
162
+ * Connection state for monitoring
163
+ */
164
+ type ConnectionState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting' | 'error';
165
+ /**
166
+ * Connection state change event
167
+ */
168
+ interface ConnectionStateEvent {
169
+ state: ConnectionState;
170
+ timestamp: number;
171
+ error?: Error;
172
+ }
173
+ /**
174
+ * Batch operation progress event
175
+ */
176
+ interface BatchProgressEvent {
177
+ operation: 'create' | 'update' | 'delete';
178
+ total: number;
179
+ completed: number;
180
+ failed: number;
181
+ percentage: number;
182
+ }
183
+ /**
184
+ * Event listener type for connection state changes
185
+ */
186
+ type ConnectionStateListener = (event: ConnectionStateEvent) => void;
187
+ /**
188
+ * Event listener type for batch operation progress
189
+ */
190
+ type BatchProgressListener = (event: BatchProgressEvent) => void;
12
191
  /**
13
192
  * ObjectStack Data Source Adapter
14
193
  *
@@ -22,7 +201,14 @@ import { DataSource, QueryParams, QueryResult } from '@object-ui/types';
22
201
  *
23
202
  * const dataSource = new ObjectStackAdapter({
24
203
  * baseUrl: 'https://api.example.com',
25
- * token: 'your-api-token'
204
+ * token: 'your-api-token',
205
+ * autoReconnect: true,
206
+ * maxReconnectAttempts: 5
207
+ * });
208
+ *
209
+ * // Monitor connection state
210
+ * dataSource.onConnectionStateChange((event) => {
211
+ * console.log('Connection state:', event.state);
26
212
  * });
27
213
  *
28
214
  * const users = await dataSource.find('users', {
@@ -31,19 +217,62 @@ import { DataSource, QueryParams, QueryResult } from '@object-ui/types';
31
217
  * });
32
218
  * ```
33
219
  */
34
- declare class ObjectStackAdapter<T = any> implements DataSource<T> {
220
+ declare class ObjectStackAdapter<T = unknown> implements DataSource<T> {
35
221
  private client;
36
222
  private connected;
223
+ private metadataCache;
224
+ private connectionState;
225
+ private connectionStateListeners;
226
+ private batchProgressListeners;
227
+ private autoReconnect;
228
+ private maxReconnectAttempts;
229
+ private reconnectDelay;
230
+ private reconnectAttempts;
37
231
  constructor(config: {
38
232
  baseUrl: string;
39
233
  token?: string;
40
234
  fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
235
+ cache?: {
236
+ maxSize?: number;
237
+ ttl?: number;
238
+ };
239
+ autoReconnect?: boolean;
240
+ maxReconnectAttempts?: number;
241
+ reconnectDelay?: number;
41
242
  });
42
243
  /**
43
244
  * Ensure the client is connected to the server.
44
245
  * Call this before making requests or it will auto-connect on first request.
45
246
  */
46
247
  connect(): Promise<void>;
248
+ /**
249
+ * Attempt to reconnect to the server with exponential backoff
250
+ */
251
+ private attemptReconnect;
252
+ /**
253
+ * Get the current connection state
254
+ */
255
+ getConnectionState(): ConnectionState;
256
+ /**
257
+ * Check if the adapter is currently connected
258
+ */
259
+ isConnected(): boolean;
260
+ /**
261
+ * Register a listener for connection state changes
262
+ */
263
+ onConnectionStateChange(listener: ConnectionStateListener): () => void;
264
+ /**
265
+ * Register a listener for batch operation progress
266
+ */
267
+ onBatchProgress(listener: BatchProgressListener): () => void;
268
+ /**
269
+ * Set connection state and notify listeners
270
+ */
271
+ private setConnectionState;
272
+ /**
273
+ * Emit batch progress event to listeners
274
+ */
275
+ private emitBatchProgress;
47
276
  /**
48
277
  * Find multiple records with query parameters.
49
278
  * Converts OData-style params to ObjectStack query options.
@@ -66,7 +295,13 @@ declare class ObjectStackAdapter<T = any> implements DataSource<T> {
66
295
  */
67
296
  delete(resource: string, id: string | number): Promise<boolean>;
68
297
  /**
69
- * Bulk operations (optional implementation).
298
+ * Bulk operations with optimized batch processing and error handling.
299
+ * Emits progress events for tracking operation status.
300
+ *
301
+ * @param resource - Resource name
302
+ * @param operation - Operation type (create, update, delete)
303
+ * @param data - Array of records to process
304
+ * @returns Promise resolving to array of results
70
305
  */
71
306
  bulk(resource: string, operation: 'create' | 'update' | 'delete', data: Partial<T>[]): Promise<T[]>;
72
307
  /**
@@ -76,15 +311,30 @@ declare class ObjectStackAdapter<T = any> implements DataSource<T> {
76
311
  private convertQueryParams;
77
312
  /**
78
313
  * Get object schema/metadata from ObjectStack.
314
+ * Uses caching to improve performance for repeated requests.
79
315
  *
80
316
  * @param objectName - Object name
81
317
  * @returns Promise resolving to the object schema
82
318
  */
83
- getObjectSchema(objectName: string): Promise<any>;
319
+ getObjectSchema(objectName: string): Promise<unknown>;
84
320
  /**
85
321
  * Get access to the underlying ObjectStack client for advanced operations.
86
322
  */
87
323
  getClient(): ObjectStackClient;
324
+ /**
325
+ * Get cache statistics for monitoring performance.
326
+ */
327
+ getCacheStats(): CacheStats;
328
+ /**
329
+ * Invalidate metadata cache entries.
330
+ *
331
+ * @param key - Optional key to invalidate. If omitted, invalidates all entries.
332
+ */
333
+ invalidateCache(key?: string): void;
334
+ /**
335
+ * Clear all cache entries and statistics.
336
+ */
337
+ clearCache(): void;
88
338
  }
89
339
  /**
90
340
  * Factory function to create an ObjectStack data source.
@@ -93,14 +343,24 @@ declare class ObjectStackAdapter<T = any> implements DataSource<T> {
93
343
  * ```typescript
94
344
  * const dataSource = createObjectStackAdapter({
95
345
  * baseUrl: process.env.API_URL,
96
- * token: process.env.API_TOKEN
346
+ * token: process.env.API_TOKEN,
347
+ * cache: { maxSize: 100, ttl: 300000 },
348
+ * autoReconnect: true,
349
+ * maxReconnectAttempts: 5
97
350
  * });
98
351
  * ```
99
352
  */
100
- declare function createObjectStackAdapter<T = any>(config: {
353
+ declare function createObjectStackAdapter<T = unknown>(config: {
101
354
  baseUrl: string;
102
355
  token?: string;
103
356
  fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
357
+ cache?: {
358
+ maxSize?: number;
359
+ ttl?: number;
360
+ };
361
+ autoReconnect?: boolean;
362
+ maxReconnectAttempts?: number;
363
+ reconnectDelay?: number;
104
364
  }): DataSource<T>;
105
365
 
106
- export { ObjectStackAdapter, createObjectStackAdapter };
366
+ export { AuthenticationError, type BatchProgressEvent, type BatchProgressListener, BulkOperationError, type CacheStats, ConnectionError, type ConnectionState, type ConnectionStateEvent, type ConnectionStateListener, MetadataNotFoundError, ObjectStackAdapter, ObjectStackError, ValidationError, createErrorFromResponse, createObjectStackAdapter, isErrorType, isObjectStackError };