@wxn0brp/db-storage-csv 0.120.1 → 0.130.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.
@@ -1,9 +1,9 @@
1
- import { CustomActionsBase } from "@wxn0brp/db-core/base/custom";
1
+ import { CustomAdapterBase } from "@wxn0brp/db-core/base/customAdapter";
2
2
  export interface Opts {
3
3
  file?: string;
4
4
  dir?: string;
5
5
  }
6
- export declare class DbStorageCsv extends CustomActionsBase {
6
+ export declare class DbStorageCsv extends CustomAdapterBase {
7
7
  opts: Opts;
8
8
  version: string;
9
9
  constructor(opts: Opts);
@@ -1,9 +1,10 @@
1
1
  import { CustomFileCpu } from "@wxn0brp/db-core";
2
- import { CustomActionsBase } from "@wxn0brp/db-core/base/custom";
2
+ import { CustomAdapterBase } from "@wxn0brp/db-core/base/customAdapter";
3
+ import { pathRepair } from "@wxn0brp/db-core/base/customFileCpu";
3
4
  import { parse, stringify } from "csv/sync";
4
5
  import { access, mkdir, readdir, readFile, rm, writeFile } from "fs/promises";
5
6
  import { version } from "./version.js";
6
- export class DbStorageCsv extends CustomActionsBase {
7
+ export class DbStorageCsv extends CustomAdapterBase {
7
8
  opts;
8
9
  version = version;
9
10
  constructor(opts) {
@@ -16,7 +17,7 @@ export class DbStorageCsv extends CustomActionsBase {
16
17
  return this.opts.file;
17
18
  }
18
19
  else if (this.opts.dir) {
19
- return this.opts.dir + "/" + collection + ".csv";
20
+ return this.opts.dir + "/" + pathRepair(collection) + ".csv";
20
21
  }
21
22
  }
22
23
  async read(file) {
@@ -113,7 +114,9 @@ export class DbStorageCsv extends CustomActionsBase {
113
114
  }
114
115
  }
115
116
  async removeCollection(collection) {
116
- await rm(this._getPath(collection));
117
+ await rm(this._getPath(collection), {
118
+ force: true,
119
+ });
117
120
  return true;
118
121
  }
119
122
  }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { ValtheraClass } from "@wxn0brp/db-core";
2
- import { Opts } from "./action.js";
2
+ import { Opts } from "./adapter.js";
3
3
  export declare function createCsvValthera(opts: Opts): ValtheraClass;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ValtheraClass } from "@wxn0brp/db-core";
2
- import { DbStorageCsv } from "./action.js";
2
+ import { DbStorageCsv } from "./adapter.js";
3
3
  export function createCsvValthera(opts) {
4
4
  const csvStorage = new DbStorageCsv(opts);
5
5
  return new ValtheraClass({
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "0.120.1";
1
+ export declare const version = "0.130.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = "0.120.1";
1
+ export const version = "0.130.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/db-storage-csv",
3
- "version": "0.120.1",
3
+ "version": "0.130.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "ValtheraDB Storage CSV",
@@ -19,8 +19,8 @@
19
19
  "csv"
20
20
  ],
21
21
  "dependencies": {
22
- "@wxn0brp/db-core": "^0.12.2",
23
- "csv": "^6.6.3"
22
+ "@wxn0brp/db-core": "^0.13.0",
23
+ "csv": "^6.6.4"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/bun": "*",