@wxn0brp/db-core 0.12.8-alpha.0 → 0.12.8-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.
@@ -26,6 +26,7 @@ export declare abstract class ActionsBase implements ActionsBaseInterface {
26
26
  commitTransaction(handle: TransactionHandle): Promise<void>;
27
27
  rollbackTransaction(handle: TransactionHandle): Promise<void>;
28
28
  createIndex(config: VQueryT.CreateIndex): Promise<void>;
29
+ removeIndex(config: VQueryT.RemoveIndex): Promise<void>;
29
30
  updateOneOrAdd(config: VQueryT.UpdateOneOrAdd): Promise<VQueryT.UpdateOneOrAddResult<DataInternal>>;
30
31
  toggleOne(config: VQueryT.ToggleOne): Promise<VQueryT.ToggleOneResult<DataInternal>>;
31
32
  count(config: VQueryT.Count): Promise<number>;
@@ -22,6 +22,9 @@ export class ActionsBase {
22
22
  async createIndex(config) {
23
23
  // No-op: adapter does not use indexes internally
24
24
  }
25
+ async removeIndex(config) {
26
+ // No-op: adapter does not use indexes internally
27
+ }
25
28
  async updateOneOrAdd(config) {
26
29
  const res = await this.updateOne(config);
27
30
  if (res)
@@ -92,6 +92,10 @@ export declare class ValtheraClass implements ValtheraCompatible {
92
92
  * Create an index on a collection.
93
93
  */
94
94
  createIndex(collection: string, fields: string[], opts?: IndexOpts): Promise<void>;
95
+ /**
96
+ * Remove an index from a collection. Adapter-dependent.
97
+ */
98
+ removeIndex(collection: string, fields: string[]): Promise<void>;
95
99
  count(query: VQueryT.Count): Promise<number>;
96
100
  /**
97
101
  * @experimental
@@ -219,6 +219,19 @@ export class ValtheraClass {
219
219
  index,
220
220
  });
221
221
  }
222
+ /**
223
+ * Remove an index from a collection. Adapter-dependent.
224
+ */
225
+ async removeIndex(collection, fields) {
226
+ const index = {
227
+ collection,
228
+ fields,
229
+ };
230
+ await this.execute("removeIndex", {
231
+ collection,
232
+ index,
233
+ });
234
+ }
222
235
  count(query) {
223
236
  applyCountDefaults(query);
224
237
  return this.execute("count", query);
@@ -61,4 +61,8 @@ export declare class Collection<D = Data> {
61
61
  * Create an index on this collection.
62
62
  */
63
63
  createIndex(fields: string[], opts?: IndexOpts): Promise<void>;
64
+ /**
65
+ * Remove an index from this collection. Adapter-dependent.
66
+ */
67
+ removeIndex(fields: string[]): Promise<void>;
64
68
  }
@@ -123,4 +123,10 @@ export class Collection {
123
123
  createIndex(fields, opts) {
124
124
  return this.db.createIndex(this.collection, fields, opts);
125
125
  }
126
+ /**
127
+ * Remove an index from this collection. Adapter-dependent.
128
+ */
129
+ removeIndex(fields) {
130
+ return this.db.removeIndex(this.collection, fields);
131
+ }
126
132
  }
@@ -28,4 +28,5 @@ export interface ActionsBaseInterface {
28
28
  commitTransaction(handle: TransactionHandle): Promise<void>;
29
29
  rollbackTransaction(handle: TransactionHandle): Promise<void>;
30
30
  createIndex(config: VQueryT.CreateIndex): Promise<void>;
31
+ removeIndex(config: VQueryT.RemoveIndex): Promise<void>;
31
32
  }
@@ -88,6 +88,9 @@ export declare namespace VQueryT {
88
88
  type CreateIndex<T = Data> = QueryBase<T> & {
89
89
  index: IndexDefinition;
90
90
  };
91
+ type RemoveIndex<T = Data> = QueryBase<T> & {
92
+ index: IndexDefinition;
93
+ };
91
94
  type Count<T = Data> = QueryBase<T> & {
92
95
  search: Search<T, false>;
93
96
  };
@@ -18,6 +18,7 @@ export interface ValtheraCompatible {
18
18
  updateOneOrAdd<T = Data>(query: VQueryT.UpdateOneOrAdd<T>): Promise<VQueryT.UpdateOneOrAddResult<T>>;
19
19
  toggleOne<T = Data>(query: VQueryT.ToggleOne<T>): Promise<VQueryT.ToggleOneResult<T>>;
20
20
  createIndex(collection: string, fields: string[], opts?: IndexOpts): Promise<void>;
21
+ removeIndex(collection: string, fields: string[]): Promise<void>;
21
22
  count(query: VQueryT.Count): Promise<number>;
22
23
  bulkAdd<T = Data>(query: VQueryT.BulkAdd<T>): Promise<T[]>;
23
24
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "0.12.8-alpha.0";
1
+ export declare const version = "0.12.8-alpha.1";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "0.12.8-alpha.0";
1
+ export const version = "0.12.8-alpha.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/db-core",
3
- "version": "0.12.8-alpha.0",
3
+ "version": "0.12.8-alpha.1",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "author": "wxn0brP",