ai-database 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 (72) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/.turbo/turbo-test.log +102 -0
  3. package/README.md +381 -68
  4. package/TESTING.md +410 -0
  5. package/TEST_SUMMARY.md +250 -0
  6. package/TODO.md +128 -0
  7. package/dist/ai-promise-db.d.ts +370 -0
  8. package/dist/ai-promise-db.d.ts.map +1 -0
  9. package/dist/ai-promise-db.js +839 -0
  10. package/dist/ai-promise-db.js.map +1 -0
  11. package/dist/authorization.d.ts +531 -0
  12. package/dist/authorization.d.ts.map +1 -0
  13. package/dist/authorization.js +632 -0
  14. package/dist/authorization.js.map +1 -0
  15. package/dist/durable-clickhouse.d.ts +193 -0
  16. package/dist/durable-clickhouse.d.ts.map +1 -0
  17. package/dist/durable-clickhouse.js +422 -0
  18. package/dist/durable-clickhouse.js.map +1 -0
  19. package/dist/durable-promise.d.ts +182 -0
  20. package/dist/durable-promise.d.ts.map +1 -0
  21. package/dist/durable-promise.js +409 -0
  22. package/dist/durable-promise.js.map +1 -0
  23. package/dist/execution-queue.d.ts +239 -0
  24. package/dist/execution-queue.d.ts.map +1 -0
  25. package/dist/execution-queue.js +400 -0
  26. package/dist/execution-queue.js.map +1 -0
  27. package/dist/index.d.ts +50 -191
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +79 -462
  30. package/dist/index.js.map +1 -0
  31. package/dist/linguistic.d.ts +115 -0
  32. package/dist/linguistic.d.ts.map +1 -0
  33. package/dist/linguistic.js +379 -0
  34. package/dist/linguistic.js.map +1 -0
  35. package/dist/memory-provider.d.ts +304 -0
  36. package/dist/memory-provider.d.ts.map +1 -0
  37. package/dist/memory-provider.js +785 -0
  38. package/dist/memory-provider.js.map +1 -0
  39. package/dist/schema.d.ts +899 -0
  40. package/dist/schema.d.ts.map +1 -0
  41. package/dist/schema.js +1165 -0
  42. package/dist/schema.js.map +1 -0
  43. package/dist/tests.d.ts +107 -0
  44. package/dist/tests.d.ts.map +1 -0
  45. package/dist/tests.js +568 -0
  46. package/dist/tests.js.map +1 -0
  47. package/dist/types.d.ts +972 -0
  48. package/dist/types.d.ts.map +1 -0
  49. package/dist/types.js +126 -0
  50. package/dist/types.js.map +1 -0
  51. package/package.json +37 -37
  52. package/src/ai-promise-db.ts +1243 -0
  53. package/src/authorization.ts +1102 -0
  54. package/src/durable-clickhouse.ts +596 -0
  55. package/src/durable-promise.ts +582 -0
  56. package/src/execution-queue.ts +608 -0
  57. package/src/index.test.ts +868 -0
  58. package/src/index.ts +337 -0
  59. package/src/linguistic.ts +404 -0
  60. package/src/memory-provider.test.ts +1036 -0
  61. package/src/memory-provider.ts +1119 -0
  62. package/src/schema.test.ts +1254 -0
  63. package/src/schema.ts +2296 -0
  64. package/src/tests.ts +725 -0
  65. package/src/types.ts +1177 -0
  66. package/test/README.md +153 -0
  67. package/test/edge-cases.test.ts +646 -0
  68. package/test/provider-resolution.test.ts +402 -0
  69. package/tsconfig.json +9 -0
  70. package/vitest.config.ts +19 -0
  71. package/dist/index.d.mts +0 -195
  72. package/dist/index.mjs +0 -430
package/TODO.md ADDED
@@ -0,0 +1,128 @@
1
+ # ai-database TODO
2
+
3
+ ## Core Features
4
+
5
+ ### Natural Language Queries
6
+ - [x] Define `NLQueryResult`, `NLQueryFn`, `NLQueryContext`, `NLQueryPlan` types
7
+ - [x] Implement `setNLQueryGenerator()` for custom AI integration
8
+ - [x] Implement `buildNLQueryContext()` to extract schema metadata
9
+ - [x] Implement `executeNLQuery()` with fallback to search
10
+ - [x] Add tagged template support for `db\`query\`` syntax
11
+ - [ ] Wire up `db.ask` and type-specific NL queries in DB factory
12
+ - [ ] Add streaming support for NL query results
13
+ - [ ] Add query caching/memoization
14
+ - [ ] Add query history/suggestions
15
+
16
+ ### Self-Describing Schema
17
+ - [x] Define `ThingSchema`, `NounSchema`, `VerbSchema`, `EdgeSchema`
18
+ - [x] Define `SystemSchema` combining all system types
19
+ - [ ] Auto-populate Noun records when DB() is called
20
+ - [ ] Auto-populate Edge records when relationships are defined
21
+ - [ ] Auto-populate Verb records for standard actions
22
+ - [ ] Add `db.Noun`, `db.Verb`, `db.Edge` accessors
23
+ - [ ] Implement `Thing.type` -> `Noun` relationship
24
+ - [ ] Implement `Noun.things` -> all instances backref
25
+
26
+ ### Noun & Verb Types
27
+ - [x] Define `Noun`, `NounProperty`, `NounRelationship` interfaces
28
+ - [x] Define `Verb` interface with all conjugation forms
29
+ - [x] Implement `defineNoun()` and `defineVerb()` helpers
30
+ - [x] Implement `nounToSchema()` converter
31
+ - [x] Define standard `Verbs` constant (create, update, delete, publish, archive)
32
+
33
+ ### AI-Powered Linguistic Inference
34
+ - [x] Basic `conjugate()`, `pluralize()`, `singularize()` with common rules
35
+ - [x] Basic `inferNoun()` from type name
36
+ - [ ] **Use AI for unknown nouns/verbs** - if not in Things table, ask AI once and cache
37
+ - [ ] Remove brittle rule-based code in favor of AI inference
38
+ - [ ] Store AI-generated forms in Noun/Verb records for future lookups
39
+ - [ ] Add confidence scores to AI-generated linguistic forms
40
+
41
+ ### TypeMeta
42
+ - [x] Define `TypeMeta` interface
43
+ - [x] Implement `Type()` accessor function
44
+ - [x] Include slug/slugPlural for URL generation
45
+ - [x] Include event type names (created, updated, deleted)
46
+ - [x] Include verb-derived fields (createdAt, createdBy, etc.)
47
+
48
+ ## Provider Implementation
49
+
50
+ ### MemoryProvider
51
+ - [x] Implement `Semaphore` for concurrency control
52
+ - [x] Implement Event storage and emission
53
+ - [x] Implement Action lifecycle management
54
+ - [x] Implement Artifact storage with invalidation
55
+ - [x] Add pattern matching for event subscriptions
56
+ - [ ] Add persistence option (save/load to JSON)
57
+ - [ ] Add TTL support for artifacts
58
+
59
+ > **Note**: Production providers (SQLite, ClickHouse, Postgres, etc.) are implemented in `@mdxdb/*` packages.
60
+
61
+ ## Query Capabilities
62
+
63
+ ### Filtering
64
+ - [x] Document SQL-style operators ($gt, $lt, $in, etc.)
65
+ - [x] Document Document-style nested queries
66
+ - [x] Document Graph-style relationship traversal
67
+ - [ ] Implement all documented operators in MemoryProvider
68
+ - [ ] Add query validation
69
+ - [ ] Add query optimization hints
70
+
71
+ ### Search
72
+ - [x] Define SearchOptions interface
73
+ - [ ] Implement hybrid search (vector + BM25)
74
+ - [ ] Add embedding generation
75
+ - [ ] Add chunking for long content
76
+ - [ ] Add re-ranking
77
+
78
+ ## Testing
79
+
80
+ ### Unit Tests
81
+ - [x] Schema parsing tests
82
+ - [x] Noun/Verb type tests
83
+ - [x] Basic conjugate/pluralize/singularize tests
84
+ - [x] TypeMeta tests
85
+ - [x] Semaphore tests
86
+ - [x] Event emission tests
87
+ - [x] Action lifecycle tests
88
+ - [x] Artifact storage tests
89
+ - [x] System schema tests
90
+ - [x] Edge creation tests
91
+ - [ ] NL query execution tests
92
+ - [ ] AI linguistic inference tests
93
+
94
+ ### Integration Tests
95
+ - [ ] Full CRUD workflow
96
+ - [ ] Relationship traversal
97
+ - [ ] Event-driven workflows
98
+ - [ ] Search accuracy benchmarks
99
+
100
+ ## Documentation
101
+
102
+ - [x] README: Core primitives
103
+ - [x] README: Actions for durable execution
104
+ - [x] README: Events for reactivity
105
+ - [x] README: Artifacts for caching
106
+ - [x] README: Query styles (SQL, Document, Graph)
107
+ - [x] README: Natural language queries
108
+ - [x] README: Self-describing schema
109
+ - [x] README: Noun & Verb types
110
+ - [x] README: AI auto-generation
111
+ - [ ] API reference with examples
112
+ - [ ] Migration guide
113
+ - [ ] Performance tuning guide
114
+
115
+ ## Future Ideas
116
+
117
+ - [ ] Schema migrations
118
+ - [ ] Real-time subscriptions (WebSocket)
119
+ - [ ] Offline-first with sync
120
+ - [ ] Multi-tenancy support
121
+ - [ ] Row-level security
122
+ - [ ] Audit logging
123
+ - [ ] Data lineage tracking
124
+ - [ ] Schema versioning
125
+ - [ ] Import/export (JSON, CSV, Parquet)
126
+ - [ ] GraphQL API generation
127
+ - [ ] REST API generation
128
+ - [ ] Admin UI
@@ -0,0 +1,370 @@
1
+ /**
2
+ * AIPromise Database Layer
3
+ *
4
+ * Brings promise pipelining, destructuring schema inference, and batch
5
+ * processing to database operations—just like ai-functions.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * // Chain without await
10
+ * const leads = db.Lead.list()
11
+ * const enriched = await leads.map(lead => ({
12
+ * lead,
13
+ * customer: lead.customer, // Batch loaded
14
+ * orders: lead.customer.orders, // Batch loaded
15
+ * }))
16
+ *
17
+ * // Destructure for projections
18
+ * const { name, email } = await db.Lead.first()
19
+ * ```
20
+ *
21
+ * @packageDocumentation
22
+ */
23
+ /** Symbol to identify DBPromise instances */
24
+ export declare const DB_PROMISE_SYMBOL: unique symbol;
25
+ /** Symbol to get raw promise */
26
+ export declare const RAW_DB_PROMISE_SYMBOL: unique symbol;
27
+ /** Options for DBPromise creation */
28
+ export interface DBPromiseOptions<T> {
29
+ /** The entity type */
30
+ type?: string;
31
+ /** Parent promise (for relationship chains) */
32
+ parent?: DBPromise<unknown>;
33
+ /** Property path from parent */
34
+ propertyPath?: string[];
35
+ /** Executor function */
36
+ executor: () => Promise<T>;
37
+ /** Batch context for .map() */
38
+ batchContext?: BatchContext;
39
+ /** Actions API for persistence (injected by wrapEntityOperations) */
40
+ actionsAPI?: ForEachActionsAPI;
41
+ }
42
+ /** Batch context for recording map operations */
43
+ interface BatchContext {
44
+ items: unknown[];
45
+ recordings: Map<string, PropertyRecording>;
46
+ }
47
+ /** Recording of property accesses */
48
+ interface PropertyRecording {
49
+ paths: Set<string>;
50
+ relations: Map<string, RelationRecording>;
51
+ }
52
+ /** Recording of relation accesses */
53
+ interface RelationRecording {
54
+ type: string;
55
+ isArray: boolean;
56
+ nestedPaths: Set<string>;
57
+ }
58
+ /**
59
+ * Progress info for forEach operations
60
+ */
61
+ export interface ForEachProgress {
62
+ /** Current item index (0-based) */
63
+ index: number;
64
+ /** Total items (if known) */
65
+ total?: number;
66
+ /** Number of items completed */
67
+ completed: number;
68
+ /** Number of items failed */
69
+ failed: number;
70
+ /** Number of items skipped */
71
+ skipped: number;
72
+ /** Current item being processed */
73
+ current?: unknown;
74
+ /** Elapsed time in ms */
75
+ elapsed: number;
76
+ /** Estimated time remaining in ms (if total known) */
77
+ remaining?: number;
78
+ /** Items per second */
79
+ rate: number;
80
+ }
81
+ /**
82
+ * Error handling result
83
+ */
84
+ export type ForEachErrorAction = 'continue' | 'retry' | 'skip' | 'stop';
85
+ /**
86
+ * Actions API interface for persistence (internal)
87
+ */
88
+ export interface ForEachActionsAPI {
89
+ create(data: {
90
+ type: string;
91
+ data: unknown;
92
+ total?: number;
93
+ }): Promise<{
94
+ id: string;
95
+ }>;
96
+ get(id: string): Promise<ForEachActionState | null>;
97
+ update(id: string, updates: Partial<ForEachActionState>): Promise<unknown>;
98
+ }
99
+ /**
100
+ * Action state for forEach persistence
101
+ */
102
+ export interface ForEachActionState {
103
+ id: string;
104
+ type: string;
105
+ status: 'pending' | 'active' | 'completed' | 'failed';
106
+ progress?: number;
107
+ total?: number;
108
+ data: {
109
+ /** IDs of items that have been processed */
110
+ processedIds?: string[];
111
+ [key: string]: unknown;
112
+ };
113
+ result?: ForEachResult;
114
+ error?: string;
115
+ }
116
+ /**
117
+ * Options for forEach operations
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * // Simple
122
+ * await db.Lead.forEach(lead => console.log(lead.name))
123
+ *
124
+ * // With concurrency
125
+ * await db.Lead.forEach(async lead => {
126
+ * await processLead(lead)
127
+ * }, { concurrency: 10 })
128
+ *
129
+ * // Persist progress (survives crashes)
130
+ * await db.Lead.forEach(processLead, { persist: true })
131
+ *
132
+ * // Resume from where we left off
133
+ * await db.Lead.forEach(processLead, { resume: 'action-123' })
134
+ * ```
135
+ */
136
+ export interface ForEachOptions<T = unknown> {
137
+ /**
138
+ * Maximum concurrent operations (default: 1)
139
+ */
140
+ concurrency?: number;
141
+ /**
142
+ * Batch size for fetching items (default: 100)
143
+ */
144
+ batchSize?: number;
145
+ /**
146
+ * Maximum retries per item (default: 0)
147
+ */
148
+ maxRetries?: number;
149
+ /**
150
+ * Delay between retries in ms, or function for backoff (default: 1000)
151
+ */
152
+ retryDelay?: number | ((attempt: number) => number);
153
+ /**
154
+ * Progress callback
155
+ */
156
+ onProgress?: (progress: ForEachProgress) => void;
157
+ /**
158
+ * Error handling: 'continue' | 'retry' | 'skip' | 'stop' (default: 'continue')
159
+ */
160
+ onError?: ForEachErrorAction | ((error: Error, item: T, attempt: number) => ForEachErrorAction | Promise<ForEachErrorAction>);
161
+ /**
162
+ * Called when an item completes
163
+ */
164
+ onComplete?: (item: T, result: unknown, index: number) => void | Promise<void>;
165
+ /**
166
+ * AbortController signal
167
+ */
168
+ signal?: AbortSignal;
169
+ /**
170
+ * Timeout per item in ms
171
+ */
172
+ timeout?: number;
173
+ /**
174
+ * Persist progress to actions (survives crashes)
175
+ * - `true`: Auto-name action as "{Entity}.forEach"
176
+ * - `string`: Custom action name
177
+ */
178
+ persist?: boolean | string;
179
+ /**
180
+ * Resume from existing action ID (skips already-processed items)
181
+ */
182
+ resume?: string;
183
+ /**
184
+ * Filter entities before processing
185
+ */
186
+ where?: Record<string, unknown>;
187
+ }
188
+ /**
189
+ * Result of forEach operation
190
+ */
191
+ export interface ForEachResult {
192
+ /** Total items processed */
193
+ total: number;
194
+ /** Items completed successfully */
195
+ completed: number;
196
+ /** Items that failed */
197
+ failed: number;
198
+ /** Items skipped */
199
+ skipped: number;
200
+ /** Total elapsed time in ms */
201
+ elapsed: number;
202
+ /** Errors encountered (if any) */
203
+ errors: Array<{
204
+ item: unknown;
205
+ error: Error;
206
+ index: number;
207
+ }>;
208
+ /** Was the operation cancelled? */
209
+ cancelled: boolean;
210
+ /** Action ID if persistence was enabled */
211
+ actionId?: string;
212
+ }
213
+ /**
214
+ * DBPromise - Promise pipelining for database operations
215
+ *
216
+ * Like AIPromise but for database queries. Enables:
217
+ * - Property access tracking for projections
218
+ * - Batch relationship loading
219
+ * - .map() for processing arrays efficiently
220
+ */
221
+ export declare class DBPromise<T> implements PromiseLike<T> {
222
+ readonly [DB_PROMISE_SYMBOL] = true;
223
+ private _options;
224
+ private _accessedProps;
225
+ private _propertyPath;
226
+ private _parent;
227
+ private _resolver;
228
+ private _resolvedValue;
229
+ private _isResolved;
230
+ private _pendingRelations;
231
+ constructor(options: DBPromiseOptions<T>);
232
+ /** Get accessed properties */
233
+ get accessedProps(): Set<string>;
234
+ /** Get property path */
235
+ get path(): string[];
236
+ /** Check if resolved */
237
+ get isResolved(): boolean;
238
+ /**
239
+ * Resolve this promise
240
+ */
241
+ resolve(): Promise<T>;
242
+ /**
243
+ * Map over array results with batch optimization
244
+ *
245
+ * @example
246
+ * ```ts
247
+ * const customers = db.Customer.list()
248
+ * const withOrders = await customers.map(customer => ({
249
+ * name: customer.name,
250
+ * orders: customer.orders, // Batch loaded!
251
+ * total: customer.orders.length,
252
+ * }))
253
+ * ```
254
+ */
255
+ map<U>(callback: (item: DBPromise<T extends (infer I)[] ? I : T>, index: number) => U): DBPromise<U[]>;
256
+ /**
257
+ * Filter results
258
+ */
259
+ filter(predicate: (item: T extends (infer I)[] ? I : T, index: number) => boolean): DBPromise<T>;
260
+ /**
261
+ * Sort results
262
+ */
263
+ sort(compareFn?: (a: T extends (infer I)[] ? I : T, b: T extends (infer I)[] ? I : T) => number): DBPromise<T>;
264
+ /**
265
+ * Limit results
266
+ */
267
+ limit(n: number): DBPromise<T>;
268
+ /**
269
+ * Get first item
270
+ */
271
+ first(): DBPromise<T extends (infer I)[] ? I | null : T>;
272
+ /**
273
+ * Process each item with concurrency control, progress tracking, and error handling
274
+ *
275
+ * Designed for large-scale operations like AI generations or workflows.
276
+ *
277
+ * @example
278
+ * ```ts
279
+ * // Simple - process sequentially
280
+ * await db.Lead.list().forEach(async lead => {
281
+ * await processLead(lead)
282
+ * })
283
+ *
284
+ * // With concurrency and progress
285
+ * await db.Lead.list().forEach(async lead => {
286
+ * const analysis = await ai`analyze ${lead}`
287
+ * await db.Lead.update(lead.$id, { analysis })
288
+ * }, {
289
+ * concurrency: 10,
290
+ * onProgress: p => console.log(`${p.completed}/${p.total} (${p.rate}/s)`),
291
+ * })
292
+ *
293
+ * // With error handling and retries
294
+ * const result = await db.Order.list().forEach(async order => {
295
+ * await sendInvoice(order)
296
+ * }, {
297
+ * concurrency: 5,
298
+ * maxRetries: 3,
299
+ * retryDelay: attempt => 1000 * Math.pow(2, attempt),
300
+ * onError: (err, order) => err.code === 'RATE_LIMIT' ? 'retry' : 'continue',
301
+ * })
302
+ *
303
+ * console.log(`Sent ${result.completed}, failed ${result.failed}`)
304
+ * ```
305
+ */
306
+ forEach<U>(callback: (item: T extends (infer I)[] ? I : T, index: number) => U | Promise<U>, options?: ForEachOptions<T extends (infer I)[] ? I : T>): Promise<ForEachResult>;
307
+ /**
308
+ * Async iteration
309
+ */
310
+ [Symbol.asyncIterator](): AsyncIterator<T extends (infer I)[] ? I : T>;
311
+ /**
312
+ * Promise interface - then()
313
+ */
314
+ then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
315
+ /**
316
+ * Promise interface - catch()
317
+ */
318
+ catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
319
+ /**
320
+ * Promise interface - finally()
321
+ */
322
+ finally(onfinally?: (() => void) | null): Promise<T>;
323
+ }
324
+ /**
325
+ * Check if a value is a DBPromise
326
+ */
327
+ export declare function isDBPromise(value: unknown): value is DBPromise<unknown>;
328
+ /**
329
+ * Get the raw DBPromise from a proxied value
330
+ */
331
+ export declare function getRawDBPromise<T>(value: DBPromise<T>): DBPromise<T>;
332
+ /**
333
+ * Create a DBPromise for a list query
334
+ */
335
+ export declare function createListPromise<T>(type: string, executor: () => Promise<T[]>): DBPromise<T[]>;
336
+ /**
337
+ * Create a DBPromise for a single entity query
338
+ */
339
+ export declare function createEntityPromise<T>(type: string, executor: () => Promise<T | null>): DBPromise<T | null>;
340
+ /**
341
+ * Create a DBPromise for a search query
342
+ */
343
+ export declare function createSearchPromise<T>(type: string, executor: () => Promise<T[]>): DBPromise<T[]>;
344
+ /**
345
+ * Wrap EntityOperations to return DBPromise
346
+ */
347
+ export declare function wrapEntityOperations<T>(typeName: string, operations: {
348
+ get: (id: string) => Promise<T | null>;
349
+ list: (options?: any) => Promise<T[]>;
350
+ find: (where: any) => Promise<T[]>;
351
+ search: (query: string, options?: any) => Promise<T[]>;
352
+ create: (...args: any[]) => Promise<T>;
353
+ update: (id: string, data: any) => Promise<T>;
354
+ upsert: (id: string, data: any) => Promise<T>;
355
+ delete: (id: string) => Promise<boolean>;
356
+ forEach: (...args: any[]) => Promise<void>;
357
+ }, actionsAPI?: ForEachActionsAPI): {
358
+ get: (id: string) => DBPromise<T | null>;
359
+ list: (options?: any) => DBPromise<T[]>;
360
+ find: (where: any) => DBPromise<T[]>;
361
+ search: (query: string, options?: any) => DBPromise<T[]>;
362
+ create: (...args: any[]) => Promise<T>;
363
+ update: (id: string, data: any) => Promise<T>;
364
+ upsert: (id: string, data: any) => Promise<T>;
365
+ delete: (id: string) => Promise<boolean>;
366
+ forEach: <U>(callback: (item: T, index: number) => U | Promise<U>, options?: ForEachOptions<T>) => Promise<ForEachResult>;
367
+ first: () => DBPromise<T | null>;
368
+ };
369
+ export {};
370
+ //# sourceMappingURL=ai-promise-db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-promise-db.d.ts","sourceRoot":"","sources":["../src/ai-promise-db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH,6CAA6C;AAC7C,eAAO,MAAM,iBAAiB,eAA2B,CAAA;AAEzD,gCAAgC;AAChC,eAAO,MAAM,qBAAqB,eAA+B,CAAA;AASjE,qCAAqC;AACrC,MAAM,WAAW,gBAAgB,CAAC,CAA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