@wxn0brp/db-storage-dir 0.2.3 → 0.2.5

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
@@ -40,7 +40,7 @@ export declare class FileActions extends ActionsBase {
40
40
  /**
41
41
  * Add a new entry to the specified database.
42
42
  */
43
- add(query: VQuery): Promise<import("@wxn0brp/db-core/types/arg").Arg>;
43
+ add(query: VQuery): Promise<import("@wxn0brp/db-core/types/arg").Arg<Data>>;
44
44
  /**
45
45
  * Find entries in the specified database based on search criteria.
46
46
  */
package/dist/action.js CHANGED
@@ -4,6 +4,7 @@ import { findUtil } from "@wxn0brp/db-core/utils/action";
4
4
  import { promises } from "fs";
5
5
  import { resolve, sep } from "path";
6
6
  import { FileActionsUtils } from "./action.utils.js";
7
+ import { exists } from "./utils.js";
7
8
  /**
8
9
  * A class representing database actions on files.
9
10
  * @class
@@ -33,7 +34,7 @@ export class FileActions extends ActionsBase {
33
34
  };
34
35
  }
35
36
  async init() {
36
- if (!await promises.exists(this.folder))
37
+ if (!await exists(this.folder))
37
38
  await promises.mkdir(this.folder, { recursive: true });
38
39
  }
39
40
  _getCollectionPath(collection) {
@@ -1,4 +1,5 @@
1
- import { exists, mkdir, readdir, stat, writeFile } from "fs/promises";
1
+ import { mkdir, readdir, stat, writeFile } from "fs/promises";
2
+ import { exists } from "./utils.js";
2
3
  export class FileActionsUtils {
3
4
  /**
4
5
  * Get the last file in the specified directory.
@@ -0,0 +1 @@
1
+ export declare function exists(path: string): Promise<boolean>;
package/dist/utils.js ADDED
@@ -0,0 +1,10 @@
1
+ import { access } from "node:fs/promises";
2
+ export async function exists(path) {
3
+ try {
4
+ await access(path);
5
+ return true;
6
+ }
7
+ catch {
8
+ return false;
9
+ }
10
+ }
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "0.2.3";
1
+ export const version = "0.2.5";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/db-storage-dir",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "wxn0brP",
@@ -21,11 +21,11 @@
21
21
  "json5": "^2.2.3"
22
22
  },
23
23
  "peerDependencies": {
24
- "@wxn0brp/db-core": "~0.8.0"
24
+ "@wxn0brp/db-core": "~0.9.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/bun": "*",
28
- "@wxn0brp/db-core": "~0.8.0",
28
+ "@wxn0brp/db-core": "~0.9.0",
29
29
  "tsc-alias": "*",
30
30
  "typescript": "*"
31
31
  },