@lota-sdk/core 0.4.29 → 0.4.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lota-sdk/core",
3
- "version": "0.4.29",
3
+ "version": "0.4.30",
4
4
  "files": [
5
5
  "src",
6
6
  "infrastructure/schema"
@@ -32,7 +32,7 @@
32
32
  "@ai-sdk/provider": "^3.0.9",
33
33
  "@chat-adapter/slack": "^4.26.0",
34
34
  "@chat-adapter/state-ioredis": "^4.26.0",
35
- "@lota-sdk/shared": "0.4.29",
35
+ "@lota-sdk/shared": "0.4.30",
36
36
  "@mendable/firecrawl-js": "^4.20.0",
37
37
  "@surrealdb/node": "^3.0.3",
38
38
  "ai": "^6.0.170",
@@ -6,9 +6,32 @@ import { recordIdToString } from './record-id'
6
6
  import { TABLES } from './tables'
7
7
 
8
8
  export function isUniqueIndexConflict(error: unknown, indexName: string): boolean {
9
- if (!(error instanceof Error)) return false
10
- const message = error.message
11
- return message.includes(indexName) && message.includes('already contains')
9
+ const visited = new Set<unknown>()
10
+ const stack: unknown[] = [error]
11
+
12
+ while (stack.length > 0) {
13
+ const current = stack.pop()
14
+ if (current === null || current === undefined || visited.has(current)) continue
15
+ visited.add(current)
16
+
17
+ if (typeof current === 'string') {
18
+ if (current.includes(indexName) && current.includes('already contains')) return true
19
+ continue
20
+ }
21
+
22
+ if (current instanceof Error) {
23
+ if (current.message.includes(indexName) && current.message.includes('already contains')) return true
24
+ stack.push(current.cause)
25
+ continue
26
+ }
27
+
28
+ if (typeof current === 'object') {
29
+ const record = current as Record<string, unknown>
30
+ stack.push(record.message, record.cause)
31
+ }
32
+ }
33
+
34
+ return false
12
35
  }
13
36
 
14
37
  const coerceDate = (value: unknown): Date => {