@wxn0brp/db-storage-dir 0.101.0-alpha.1 → 0.101.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.
package/dist/action.d.ts CHANGED
@@ -54,19 +54,19 @@ export declare class FileActions extends ActionsBase {
54
54
  /**
55
55
  * Update entries in the specified database based on search criteria and an updater function or object.
56
56
  */
57
- update(query: Query.UpdateQuery): Promise<any[]>;
57
+ update(query: Query.UpdateQuery): Promise<import("@wxn0brp/db-core/types/data").DataInternal[]>;
58
58
  /**
59
59
  * Update the first matching entry in the specified database based on search criteria and an updater function or object.
60
60
  */
61
- updateOne(query: Query.UpdateQuery): Promise<any>;
61
+ updateOne(query: Query.UpdateQuery): Promise<import("@wxn0brp/db-core/types/data").DataInternal>;
62
62
  /**
63
63
  * Remove entries from the specified database based on search criteria.
64
64
  */
65
- remove(query: Query.RemoveQuery): Promise<any[]>;
65
+ remove(query: Query.RemoveQuery): Promise<import("@wxn0brp/db-core/types/data").DataInternal[]>;
66
66
  /**
67
67
  * Remove the first matching entry from the specified database based on search criteria.
68
68
  */
69
- removeOne(query: Query.RemoveQuery): Promise<any>;
69
+ removeOne(query: Query.RemoveQuery): Promise<import("@wxn0brp/db-core/types/data").DataInternal>;
70
70
  /**
71
71
  * Removes a database collection from the file system.
72
72
  */
package/dist/action.js CHANGED
@@ -82,7 +82,7 @@ export class FileActions extends ActionsBase {
82
82
  */
83
83
  async ensureCollection(collection) {
84
84
  if (await this.issetCollection(collection))
85
- return;
85
+ return false;
86
86
  const c_path = this._getCollectionPath(collection);
87
87
  await promises.mkdir(c_path, { recursive: true });
88
88
  return true;
@@ -160,7 +160,7 @@ export class FileActions extends ActionsBase {
160
160
  this._ensureQueryFormat(query);
161
161
  await this.ensureCollection(collection);
162
162
  const res = await this.utils.operationUpdater(this._getCollectionPath(collection), this.fileCpu.update.bind(this.fileCpu), true, query);
163
- return res[0];
163
+ return res[0] ?? null;
164
164
  }
165
165
  /**
166
166
  * Remove entries from the specified database based on search criteria.
@@ -179,7 +179,7 @@ export class FileActions extends ActionsBase {
179
179
  this._ensureQueryFormat(query);
180
180
  await this.ensureCollection(query.collection);
181
181
  const res = await this.utils.operationUpdater(this._getCollectionPath(collection), this.fileCpu.remove.bind(this.fileCpu), true, query);
182
- return res[0];
182
+ return res[0] ?? null;
183
183
  }
184
184
  /**
185
185
  * Removes a database collection from the file system.
@@ -1,4 +1,5 @@
1
1
  import { VQuery } from "@wxn0brp/db-core/types/query";
2
+ import { DataInternal } from "@wxn0brp/db-core/types/data";
2
3
  export declare class FileActionsUtils {
3
4
  /**
4
5
  * Get the last file in the specified directory.
@@ -8,5 +9,5 @@ export declare class FileActionsUtils {
8
9
  * Get all files in a directory sorted by name.
9
10
  */
10
11
  getSortedFiles(folder: string, query: VQuery): Promise<string[]>;
11
- operationUpdater(c_path: string, worker: (file: string, config: VQuery, one: boolean) => Promise<boolean>, one: boolean, config: VQuery): Promise<any[]>;
12
+ operationUpdater(c_path: string, worker: (file: string, config: VQuery, one: boolean) => Promise<boolean>, one: boolean, config: VQuery): Promise<DataInternal[]>;
12
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/db-storage-dir",
3
- "version": "0.101.0-alpha.1",
3
+ "version": "0.101.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "wxn0brP",
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "peerDependencies": {
21
21
  "@wxn0brp/db-core": "^0.10.2",
22
- "json5": ""
22
+ "json5": "^2.2.3"
23
23
  },
24
24
  "peerDependenciesMeta": {
25
25
  "json5": {