@wxn0brp/db-core 0.12.3 → 0.12.4-alpha.1

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,7 +1,9 @@
1
1
  import { ActionsBaseInterface } from "../types/action.js";
2
2
  import { DataInternal } from "../types/data.js";
3
+ import { Id } from "../types/Id.js";
3
4
  import { AdapterOpts } from "../types/options.js";
4
5
  import { VQueryT } from "../types/query.js";
6
+ import { TransactionHandle } from "../types/transaction.js";
5
7
  export declare abstract class ActionsBase implements ActionsBaseInterface {
6
8
  _inited: boolean;
7
9
  adapterOpts: AdapterOpts;
@@ -20,6 +22,9 @@ export declare abstract class ActionsBase implements ActionsBaseInterface {
20
22
  abstract updateOne(config: VQueryT.Update): Promise<DataInternal | null>;
21
23
  abstract remove(config: VQueryT.Remove): Promise<DataInternal[]>;
22
24
  abstract removeOne(config: VQueryT.Remove): Promise<DataInternal | null>;
25
+ beginTransaction(id: Id): Promise<TransactionHandle>;
26
+ commitTransaction(handle: TransactionHandle): Promise<void>;
27
+ rollbackTransaction(handle: TransactionHandle): Promise<void>;
23
28
  updateOneOrAdd(config: VQueryT.UpdateOneOrAdd): Promise<VQueryT.UpdateOneOrAddResult<DataInternal>>;
24
29
  toggleOne(config: VQueryT.ToggleOne): Promise<VQueryT.ToggleOneResult<DataInternal>>;
25
30
  }
@@ -10,6 +10,15 @@ export class ActionsBase {
10
10
  version = "ActionsBase-core-" + version;
11
11
  async init(...args) { }
12
12
  async close(...args) { }
13
+ async beginTransaction(id) {
14
+ throw new Error("Transactions are not supported for ActionsBase");
15
+ }
16
+ async commitTransaction(handle) {
17
+ throw new Error("Transactions are not supported for ActionsBase");
18
+ }
19
+ async rollbackTransaction(handle) {
20
+ throw new Error("Transactions are not supported for ActionsBase");
21
+ }
13
22
  async updateOneOrAdd(config) {
14
23
  const res = await this.updateOne(config);
15
24
  if (res)
@@ -1,5 +1,6 @@
1
1
  import { ActionsBase } from "../base/actions.js";
2
2
  import { VQueryT } from "../types/query.js";
3
+ import { TransactionHandle } from "../types/transaction.js";
3
4
  export declare class MultiBackend extends ActionsBase {
4
5
  backends: ActionsBase[];
5
6
  primaryBackend: ActionsBase;
@@ -17,4 +18,7 @@ export declare class MultiBackend extends ActionsBase {
17
18
  issetCollection(collection: string): Promise<boolean>;
18
19
  removeCollection(collection: string): Promise<boolean>;
19
20
  getCollections(): Promise<string[]>;
21
+ beginTransaction(): Promise<TransactionHandle>;
22
+ commitTransaction(): Promise<void>;
23
+ rollbackTransaction(): Promise<void>;
20
24
  }
@@ -100,4 +100,13 @@ export class MultiBackend extends ActionsBase {
100
100
  });
101
101
  return Array.from(uniqueCollections);
102
102
  }
103
+ async beginTransaction() {
104
+ throw new Error("Transactions are not supported for MultiBackend");
105
+ }
106
+ async commitTransaction() {
107
+ throw new Error("Transactions are not supported for MultiBackend");
108
+ }
109
+ async rollbackTransaction() {
110
+ throw new Error("Transactions are not supported for MultiBackend");
111
+ }
103
112
  }
@@ -1,5 +1,6 @@
1
1
  import { ActionsBase } from "../base/actions.js";
2
2
  import { VQueryT, VQuery } from "../types/query.js";
3
+ import { TransactionHandle } from "../types/transaction.js";
3
4
  export type MatchRule = string | RegExp | ((config: VQuery) => boolean);
4
5
  export interface RouteEntry {
5
6
  match: MatchRule;
@@ -25,4 +26,7 @@ export declare class RoutedStorage extends ActionsBase {
25
26
  issetCollection(collection: string): Promise<boolean>;
26
27
  removeCollection(collection: string): Promise<boolean>;
27
28
  getCollections(): Promise<string[]>;
29
+ beginTransaction(): Promise<TransactionHandle>;
30
+ commitTransaction(): Promise<void>;
31
+ rollbackTransaction(): Promise<void>;
28
32
  }
@@ -96,4 +96,13 @@ export class RoutedStorage extends ActionsBase {
96
96
  const merged = new Set(all.flat());
97
97
  return Array.from(merged);
98
98
  }
99
+ async beginTransaction() {
100
+ throw new Error("Transactions are not supported for RoutedStorage");
101
+ }
102
+ async commitTransaction() {
103
+ throw new Error("Transactions are not supported for RoutedStorage");
104
+ }
105
+ async rollbackTransaction() {
106
+ throw new Error("Transactions are not supported for RoutedStorage");
107
+ }
99
108
  }
@@ -0,0 +1,30 @@
1
+ import { Collection } from "../helpers/collection.js";
2
+ import { Data } from "../types/data.js";
3
+ import { VQueryT } from "../types/query.js";
4
+ import { TransactionHandle } from "../types/transaction.js";
5
+ import { ValtheraClass } from "./valthera.js";
6
+ /**
7
+ * Transaction context. Operations are executed directly through the parent
8
+ * database with the transaction handle passed to the executor.
9
+ */
10
+ export declare class Transaction {
11
+ readonly handle: TransactionHandle;
12
+ _parent: ValtheraClass;
13
+ constructor(handle: TransactionHandle, _parent: ValtheraClass);
14
+ c<T = Data>(name: string): Collection<T>;
15
+ add<T = Data>(q: VQueryT.Add<T>): Promise<T>;
16
+ find<T = Data>(q: VQueryT.Find<T, true>): Promise<T[]>;
17
+ findOne<T = Data>(q: VQueryT.FindOne<T>): Promise<T>;
18
+ update<T = Data>(q: VQueryT.Update<T>): Promise<T[]>;
19
+ updateOne<T = Data>(q: VQueryT.Update<T>): Promise<T>;
20
+ remove<T = Data>(q: VQueryT.Remove<T>): Promise<T[]>;
21
+ removeOne<T = Data>(q: VQueryT.Remove<T>): Promise<T>;
22
+ updateOneOrAdd<T = Data>(q: VQueryT.UpdateOneOrAdd<T>): Promise<VQueryT.UpdateOneOrAddResult<T>>;
23
+ toggleOne<T = Data>(q: VQueryT.ToggleOne<T>): Promise<VQueryT.ToggleOneResult<T>>;
24
+ ensureCollection(collection: string): Promise<boolean>;
25
+ issetCollection(collection: string): Promise<boolean>;
26
+ getCollections(): Promise<string[]>;
27
+ removeCollection(collection: string): Promise<boolean>;
28
+ commit(): Promise<void>;
29
+ rollback(): Promise<void>;
30
+ }
@@ -0,0 +1,71 @@
1
+ import { Collection } from "../helpers/collection.js";
2
+ import { applyAddDefaults, applyFindDefaults, applyFindOneDefaults, applyRemoveDefaults, applyToggleOneDefaults, applyUpdateDefaults, applyUpdateOneOrAddDefaults, } from "../helpers/queryDefaults.js";
3
+ /**
4
+ * Transaction context. Operations are executed directly through the parent
5
+ * database with the transaction handle passed to the executor.
6
+ */
7
+ export class Transaction {
8
+ handle;
9
+ _parent;
10
+ constructor(handle, _parent) {
11
+ this.handle = handle;
12
+ this._parent = _parent;
13
+ }
14
+ c(name) {
15
+ return new Collection(this, name);
16
+ }
17
+ add(q) {
18
+ applyAddDefaults(q);
19
+ return this._parent.execute("add", q, this.handle);
20
+ }
21
+ find(q) {
22
+ applyFindDefaults(q);
23
+ return this._parent.execute("find", q, this.handle);
24
+ }
25
+ findOne(q) {
26
+ applyFindOneDefaults(q);
27
+ return this._parent.execute("findOne", q, this.handle);
28
+ }
29
+ update(q) {
30
+ applyUpdateDefaults(q);
31
+ return this._parent.execute("update", q, this.handle);
32
+ }
33
+ updateOne(q) {
34
+ applyUpdateDefaults(q);
35
+ return this._parent.execute("updateOne", q, this.handle);
36
+ }
37
+ remove(q) {
38
+ applyRemoveDefaults(q);
39
+ return this._parent.execute("remove", q, this.handle);
40
+ }
41
+ removeOne(q) {
42
+ applyRemoveDefaults(q);
43
+ return this._parent.execute("removeOne", q, this.handle);
44
+ }
45
+ updateOneOrAdd(q) {
46
+ applyUpdateOneOrAddDefaults(q);
47
+ return this._parent.execute("updateOneOrAdd", q, this.handle);
48
+ }
49
+ toggleOne(q) {
50
+ applyToggleOneDefaults(q);
51
+ return this._parent.execute("toggleOne", q, this.handle);
52
+ }
53
+ ensureCollection(collection) {
54
+ return this._parent.adapter.ensureCollection(collection);
55
+ }
56
+ issetCollection(collection) {
57
+ return this._parent.adapter.issetCollection(collection);
58
+ }
59
+ getCollections() {
60
+ return this._parent.adapter.getCollections();
61
+ }
62
+ removeCollection(collection) {
63
+ return this._parent.adapter.removeCollection(collection);
64
+ }
65
+ async commit() {
66
+ await this._parent.adapter.commitTransaction(this.handle);
67
+ }
68
+ async rollback() {
69
+ await this._parent.adapter.rollbackTransaction(this.handle);
70
+ }
71
+ }
@@ -6,7 +6,9 @@ import { Data } from "../types/data.js";
6
6
  import { DbOpts } from "../types/options.js";
7
7
  import { ValtheraPlugin } from "../types/plugin.js";
8
8
  import { VQuery, VQueryT } from "../types/query.js";
9
+ import { TransactionHandle } from "../types/transaction.js";
9
10
  import { ValtheraCompatible } from "../types/valthera.js";
11
+ import { Transaction } from "./transaction.js";
10
12
  /**
11
13
  * Represents a database management class for performing CRUD operations.
12
14
  * @class
@@ -16,9 +18,9 @@ export declare class ValtheraClass implements ValtheraCompatible {
16
18
  adapter: ActionsBase;
17
19
  executor: ExecutorInterface;
18
20
  emitter: VEE<{
19
- [K in keyof ValtheraCompatible]: (query: VQuery, result: Awaited<ReturnType<ValtheraCompatible[K]>>) => void;
21
+ [K in keyof Omit<ValtheraCompatible, "c">]: (query: VQuery, result: Awaited<ReturnType<ValtheraCompatible[K]>>) => void;
20
22
  } & {
21
- "*": (name: keyof ValtheraCompatible, query: VQuery, result: any) => void;
23
+ "*": (name: keyof Omit<ValtheraCompatible, "c">, query: VQuery, result: any) => void;
22
24
  }>;
23
25
  version: string;
24
26
  _plugins: ValtheraPlugin[];
@@ -27,7 +29,7 @@ export declare class ValtheraClass implements ValtheraCompatible {
27
29
  constructor(options: DbOpts);
28
30
  init(...args: any[]): Promise<any>;
29
31
  close(...args: any[]): Promise<any>;
30
- execute<T>(name: keyof ValtheraCompatible, query: VQuery<any> | string): Promise<T>;
32
+ execute<T>(name: keyof ValtheraCompatible, query: VQuery<any> | string, txHandle?: TransactionHandle): Promise<T>;
31
33
  /**
32
34
  * Create a new instance of a Collection class.
33
35
  */
@@ -84,4 +86,19 @@ export declare class ValtheraClass implements ValtheraCompatible {
84
86
  * Removes a database collection from the database.
85
87
  */
86
88
  removeCollection(collection: string): Promise<boolean>;
89
+ /**
90
+ * @experimental
91
+ *
92
+ * Executes operations within a transaction. Automatically rolls back on error.
93
+ *
94
+ * Receives a transaction-scoped object (`tx`) whose operations are executed
95
+ * within the transaction context.
96
+ *
97
+ * This feature is highly experimental and may change or be removed at any time.
98
+ *
99
+ * - Transaction support depends on the adapter implementation.
100
+ * - Collections must be declared upfront to ensure proper locking.
101
+ * - Operations invoked via the original `db` reference are NOT part of the transaction.
102
+ */
103
+ transaction<T>(collections: string[], fn: (tx: Transaction) => Promise<T>): Promise<T>;
87
104
  }
@@ -1,7 +1,10 @@
1
1
  import { VEE } from "@wxn0brp/event-emitter";
2
2
  import { Collection } from "../helpers/collection.js";
3
3
  import { SmartExecutor } from "../helpers/executor.js";
4
+ import { genId } from "../helpers/gen.js";
5
+ import { applyAddDefaults, applyFindDefaults, applyFindOneDefaults, applyRemoveDefaults, applyToggleOneDefaults, applyUpdateDefaults, applyUpdateOneOrAddDefaults, } from "../helpers/queryDefaults.js";
4
6
  import { version } from "../version.js";
7
+ import { Transaction } from "./transaction.js";
5
8
  /**
6
9
  * Represents a database management class for performing CRUD operations.
7
10
  * @class
@@ -34,6 +37,7 @@ export class ValtheraClass {
34
37
  this.adapter.adapterOpts = options.adapterOpts;
35
38
  }
36
39
  }
40
+ options.executorAware ??= true;
37
41
  }
38
42
  async init(...args) {
39
43
  if (this.adapter?._inited)
@@ -46,6 +50,7 @@ export class ValtheraClass {
46
50
  self.adapter = await self.options.adapter();
47
51
  // if the executor is not set, and the action wants a smart executor
48
52
  if (!self.options.executor &&
53
+ self.options.executorAware &&
49
54
  self.adapter.smartExecutor &&
50
55
  self.executor instanceof SmartExecutor)
51
56
  self.executor.aware = true;
@@ -70,8 +75,10 @@ export class ValtheraClass {
70
75
  self.adapter._inited = false;
71
76
  });
72
77
  }
73
- async execute(name, query) {
78
+ async execute(name, query, txHandle) {
74
79
  await this.init();
80
+ if (txHandle && typeof query === "object")
81
+ query.transaction = txHandle;
75
82
  const plugins = this._plugins;
76
83
  const self = this;
77
84
  let idx = 0;
@@ -81,6 +88,8 @@ export class ValtheraClass {
81
88
  next: async () => {
82
89
  if (idx < plugins.length)
83
90
  return plugins[idx++].execute(ctx);
91
+ if (txHandle)
92
+ return self.adapter[ctx.op](query, txHandle);
84
93
  return self.executor.addOp(self.adapter[ctx.op].bind(self.adapter), ctx.query, typeof ctx.query === "string" ? ctx.query : ctx.query.collection);
85
94
  },
86
95
  };
@@ -120,79 +129,63 @@ export class ValtheraClass {
120
129
  * Add data to a database.
121
130
  */
122
131
  add(query) {
123
- query.control ||= {};
124
- query.id_gen ??= true;
132
+ applyAddDefaults(query);
125
133
  return this.execute("add", query);
126
134
  }
127
135
  /**
128
136
  * Find data in a database.
129
137
  */
130
138
  find(query) {
131
- query.search ||= {};
132
- query.dbFindOpts ||= {};
133
- query.findOpts ||= {};
134
- query.context ||= {};
135
- query.control ||= {};
139
+ applyFindDefaults(query);
136
140
  return this.execute("find", query);
137
141
  }
138
142
  /**
139
143
  * Find one data entry in a database.
140
144
  */
141
145
  findOne(query) {
142
- query.findOpts ||= {};
143
- query.context ||= {};
144
- query.control ||= {};
146
+ applyFindOneDefaults(query);
145
147
  return this.execute("findOne", query);
146
148
  }
147
149
  /**
148
150
  * Update data in a database.
149
151
  */
150
152
  update(query) {
151
- query.context ||= {};
152
- query.control ||= {};
153
+ applyUpdateDefaults(query);
153
154
  return this.execute("update", query);
154
155
  }
155
156
  /**
156
157
  * Update one data entry in a database.
157
158
  */
158
159
  updateOne(query) {
159
- query.context ||= {};
160
- query.control ||= {};
160
+ applyUpdateDefaults(query);
161
161
  return this.execute("updateOne", query);
162
162
  }
163
163
  /**
164
164
  * Remove data from a database.
165
165
  */
166
166
  remove(query) {
167
- query.context ||= {};
168
- query.control ||= {};
167
+ applyRemoveDefaults(query);
169
168
  return this.execute("remove", query);
170
169
  }
171
170
  /**
172
171
  * Remove one data entry from a database.
173
172
  */
174
173
  removeOne(query) {
175
- query.context ||= {};
176
- query.control ||= {};
174
+ applyRemoveDefaults(query);
177
175
  return this.execute("removeOne", query);
178
176
  }
179
177
  /**
180
178
  * Asynchronously updates one entry in a database or adds a new one if it doesn't exist.
181
179
  */
182
180
  updateOneOrAdd(query) {
183
- query.context ||= {};
184
- query.add_arg ||= {};
185
- query.control ||= {};
186
- query.id_gen ??= true;
181
+ applyUpdateOneOrAddDefaults(query);
187
182
  return this.execute("updateOneOrAdd", query);
188
183
  }
189
184
  /**
190
185
  * Asynchronously removes one entry in a database or adds a new one if it doesn't exist. Usage e.g. for toggling a flag.
191
186
  */
192
187
  toggleOne(query) {
193
- query.data ||= {};
194
- query.context ||= {};
195
- query.control ||= {};
188
+ applyToggleOneDefaults(query);
196
189
  return this.execute("toggleOne", query);
197
190
  }
198
191
  /**
@@ -202,4 +195,54 @@ export class ValtheraClass {
202
195
  this._collections.delete(collection);
203
196
  return this.execute("removeCollection", collection);
204
197
  }
198
+ /**
199
+ * @experimental
200
+ *
201
+ * Executes operations within a transaction. Automatically rolls back on error.
202
+ *
203
+ * Receives a transaction-scoped object (`tx`) whose operations are executed
204
+ * within the transaction context.
205
+ *
206
+ * This feature is highly experimental and may change or be removed at any time.
207
+ *
208
+ * - Transaction support depends on the adapter implementation.
209
+ * - Collections must be declared upfront to ensure proper locking.
210
+ * - Operations invoked via the original `db` reference are NOT part of the transaction.
211
+ */
212
+ async transaction(collections, fn) {
213
+ await this.init();
214
+ const releases = [];
215
+ const promises = collections.map(collection => {
216
+ let started;
217
+ const startedPromise = new Promise(r => (started = r));
218
+ this.executor.addOp(async () => {
219
+ started();
220
+ await new Promise(resolve => releases.push(resolve));
221
+ }, undefined, collection);
222
+ return startedPromise;
223
+ });
224
+ await Promise.all(promises);
225
+ const handle = await this.adapter.beginTransaction(genId());
226
+ const tx = new Transaction(handle, this);
227
+ try {
228
+ const result = await fn(tx);
229
+ await tx.commit();
230
+ return result;
231
+ }
232
+ catch (err) {
233
+ try {
234
+ await tx.rollback();
235
+ }
236
+ catch (rollbackErr) {
237
+ throw new AggregateError([
238
+ err,
239
+ rollbackErr,
240
+ ], "Transaction failed and rollback failed");
241
+ }
242
+ throw err;
243
+ }
244
+ finally {
245
+ releases.forEach(release => release());
246
+ }
247
+ }
205
248
  }
@@ -11,11 +11,13 @@ export async function addId(query, actions, defaultGen = true) {
11
11
  data[idKey] = genId();
12
12
  return;
13
13
  }
14
+ const txOpts = query.transaction ? { transaction: query.transaction } : {};
14
15
  const find = (await actions.findOne({
15
16
  collection: "__vdb_id",
16
17
  search: {
17
18
  c: collection,
18
19
  },
20
+ ...txOpts,
19
21
  }));
20
22
  data[idKey] = find?.i ? find.i + 1 : 1;
21
23
  await actions.updateOneOrAdd({
@@ -29,5 +31,6 @@ export async function addId(query, actions, defaultGen = true) {
29
31
  },
30
32
  },
31
33
  id_gen: false,
34
+ ...txOpts,
32
35
  });
33
36
  }
@@ -0,0 +1,8 @@
1
+ import { VQueryT } from "../types/query.js";
2
+ export declare function applyAddDefaults<T>(q: VQueryT.Add<T>): void;
3
+ export declare function applyFindDefaults<T>(q: VQueryT.Find<T>): void;
4
+ export declare function applyFindOneDefaults<T>(q: VQueryT.FindOne<T>): void;
5
+ export declare function applyUpdateDefaults<T>(q: VQueryT.Update<T>): void;
6
+ export declare function applyRemoveDefaults<T>(q: VQueryT.Remove<T>): void;
7
+ export declare function applyUpdateOneOrAddDefaults<T>(q: VQueryT.UpdateOneOrAdd<T>): void;
8
+ export declare function applyToggleOneDefaults<T>(q: VQueryT.ToggleOne<T>): void;
@@ -0,0 +1,35 @@
1
+ export function applyAddDefaults(q) {
2
+ q.control ||= {};
3
+ q.id_gen ??= true;
4
+ }
5
+ export function applyFindDefaults(q) {
6
+ q.search ||= {};
7
+ q.dbFindOpts ||= {};
8
+ q.findOpts ||= {};
9
+ q.context ||= {};
10
+ q.control ||= {};
11
+ }
12
+ export function applyFindOneDefaults(q) {
13
+ q.findOpts ||= {};
14
+ q.context ||= {};
15
+ q.control ||= {};
16
+ }
17
+ export function applyUpdateDefaults(q) {
18
+ q.context ||= {};
19
+ q.control ||= {};
20
+ }
21
+ export function applyRemoveDefaults(q) {
22
+ q.context ||= {};
23
+ q.control ||= {};
24
+ }
25
+ export function applyUpdateOneOrAddDefaults(q) {
26
+ q.context ||= {};
27
+ q.add_arg ||= {};
28
+ q.control ||= {};
29
+ q.id_gen ??= true;
30
+ }
31
+ export function applyToggleOneDefaults(q) {
32
+ q.data ||= {};
33
+ q.context ||= {};
34
+ q.control ||= {};
35
+ }
@@ -1,6 +1,8 @@
1
1
  import { DataInternal } from "./data.js";
2
+ import { Id } from "./Id.js";
2
3
  import { AdapterOpts } from "./options.js";
3
4
  import { VQueryT } from "./query.js";
5
+ import { TransactionHandle } from "./transaction.js";
4
6
  export interface ActionsBaseInterface {
5
7
  _inited: boolean;
6
8
  adapterOpts: AdapterOpts;
@@ -20,4 +22,7 @@ export interface ActionsBaseInterface {
20
22
  removeOne(query: VQueryT.Remove): Promise<DataInternal | null>;
21
23
  updateOneOrAdd(query: VQueryT.UpdateOneOrAdd): Promise<VQueryT.UpdateOneOrAddResult<DataInternal>>;
22
24
  toggleOne(query: VQueryT.ToggleOne): Promise<VQueryT.ToggleOneResult<DataInternal>>;
25
+ beginTransaction(id: Id): Promise<TransactionHandle>;
26
+ commitTransaction(handle: TransactionHandle): Promise<void>;
27
+ rollbackTransaction(handle: TransactionHandle): Promise<void>;
23
28
  }
@@ -1,10 +1,11 @@
1
1
  import { ActionsBase } from "../base/actions.js";
2
- import { Executor } from "../helpers/executor.js";
2
+ import { ExecutorInterface } from "../helpers/executor.js";
3
3
  import { KeysMatching } from "./utils.js";
4
4
  export type AdapterValue = ActionsBase | (() => Promise<ActionsBase>);
5
5
  export interface DbOpts {
6
6
  adapter: AdapterValue;
7
- executor?: Executor;
7
+ executor?: ExecutorInterface;
8
+ executorAware?: boolean;
8
9
  adapterOpts?: AdapterOpts;
9
10
  }
10
11
  export interface AdapterOpts {
@@ -1,6 +1,7 @@
1
1
  import { Arg, Search, Updater } from "./arg.js";
2
2
  import { Data } from "./data.js";
3
3
  import { DbFindOpts, FindOpts } from "./options.js";
4
+ import { TransactionHandle } from "./transaction.js";
4
5
  import { VContext } from "./types.js";
5
6
  /**
6
7
  * To extend via adapters
@@ -25,11 +26,13 @@ export interface VQuery<T = Data, AllowFn extends boolean = true> {
25
26
  add_arg?: Arg<T>;
26
27
  updater?: Updater<T, AllowFn>;
27
28
  control?: VQuery_Control;
29
+ transaction?: TransactionHandle;
28
30
  }
29
31
  export declare namespace VQueryT {
30
32
  type QueryBase<T = Data> = {
31
33
  collection: string;
32
34
  control?: VQuery_Control;
35
+ transaction?: TransactionHandle;
33
36
  };
34
37
  type Add<T = Data> = QueryBase<T> & {
35
38
  data: Arg<T>;
@@ -0,0 +1,4 @@
1
+ export interface TransactionHandle {
2
+ id: string;
3
+ _adapterData?: unknown;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "0.12.3";
1
+ export declare const version = "0.12.4-alpha.1";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "0.12.3";
1
+ export const version = "0.12.4-alpha.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/db-core",
3
- "version": "0.12.3",
3
+ "version": "0.12.4-alpha.1",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "author": "wxn0brP",