@lota-sdk/core 0.1.13 → 0.1.14

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.1.13",
3
+ "version": "0.1.14",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -30,7 +30,7 @@
30
30
  "@ai-sdk/devtools": "^0.0.15",
31
31
  "@ai-sdk/openai": "^3.0.41",
32
32
  "@logtape/logtape": "^2.0.4",
33
- "@lota-sdk/shared": "0.1.13",
33
+ "@lota-sdk/shared": "0.1.14",
34
34
  "@mendable/firecrawl-js": "^4.16.0",
35
35
  "@surrealdb/node": "^3.0.3",
36
36
  "ai": "^6.0.116",
package/src/db/service.ts CHANGED
@@ -53,11 +53,12 @@ interface FindManyOptions {
53
53
  type MutationBuilder = {
54
54
  content: (data: Record<string, unknown>) => MutationBuilder
55
55
  replace: (data: Record<string, unknown>) => MutationBuilder
56
- patch: (data: Record<string, unknown>) => MutationBuilder
57
56
  merge: (data: Record<string, unknown>) => MutationBuilder
58
57
  output: (mode: 'after' | 'before') => Promise<unknown>
59
58
  }
60
59
 
60
+ type RecordMutation = Extract<Mutation, 'content' | 'replace' | 'merge'>
61
+
61
62
  export type CreateMutationBuilder = {
62
63
  content: (data: Record<string, unknown>) => CreateMutationBuilder
63
64
  output: (mode: 'after' | 'before') => Promise<unknown>
@@ -75,7 +76,7 @@ export interface DatabaseTransaction {
75
76
 
76
77
  function configureMutation(
77
78
  builder: MutationBuilder,
78
- mutation: Mutation,
79
+ mutation: RecordMutation,
79
80
  data: Record<string, unknown>,
80
81
  ): MutationBuilder {
81
82
  if (mutation === 'content') {
@@ -84,9 +85,6 @@ function configureMutation(
84
85
  if (mutation === 'replace') {
85
86
  return builder.replace(data)
86
87
  }
87
- if (mutation === 'patch') {
88
- return builder.patch(data)
89
- }
90
88
  return builder.merge(data)
91
89
  }
92
90
 
@@ -496,7 +494,6 @@ export class SurrealDBService {
496
494
  return {
497
495
  content: (data) => this.wrapMutationBuilder(builder.content(this.normalizeMutationData(data))),
498
496
  replace: (data) => this.wrapMutationBuilder(builder.replace(this.normalizeMutationData(data))),
499
- patch: (data) => this.wrapMutationBuilder(builder.patch(this.normalizeMutationData(data))),
500
497
  merge: (data) => this.wrapMutationBuilder(builder.merge(this.normalizeMutationData(data))),
501
498
  output: (mode) => builder.output(mode),
502
499
  }
@@ -719,7 +716,7 @@ export class SurrealDBService {
719
716
  id: unknown,
720
717
  data: Record<string, unknown>,
721
718
  schema: T,
722
- options?: { mutation?: Mutation },
719
+ options?: { mutation?: RecordMutation },
723
720
  ): Promise<z.infer<T> | null> {
724
721
  const recordId = this.normalizeRecordId(id, table)
725
722
 
@@ -746,7 +743,7 @@ export class SurrealDBService {
746
743
  id: unknown,
747
744
  data: Record<string, unknown>,
748
745
  schema: T,
749
- options?: { mutation?: Mutation },
746
+ options?: { mutation?: RecordMutation },
750
747
  ): Promise<z.infer<T>> {
751
748
  const recordId = this.normalizeRecordId(id, table)
752
749
  const keys = Object.keys(data)