@wxn0brp/db-storage-csv 0.120.1 → 0.131.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 → adapter.d.ts} +2 -2
- package/dist/{action.js → adapter.js} +7 -4
- package/dist/index.d.ts +4 -1
- package/dist/index.js +5 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
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
|
|
6
|
+
export declare class AdapterCsv 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 {
|
|
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
|
|
7
|
+
export class AdapterCsv 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,6 @@
|
|
|
1
1
|
import { ValtheraClass } from "@wxn0brp/db-core";
|
|
2
|
-
import { Opts } from "./
|
|
2
|
+
import { AdapterCsv, Opts } from "./adapter.js";
|
|
3
3
|
export declare function createCsvValthera(opts: Opts): ValtheraClass;
|
|
4
|
+
export declare const DYNAMIC: {
|
|
5
|
+
def: (opts: Opts) => AdapterCsv;
|
|
6
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ValtheraClass } from "@wxn0brp/db-core";
|
|
2
|
-
import {
|
|
2
|
+
import { AdapterCsv } from "./adapter.js";
|
|
3
3
|
export function createCsvValthera(opts) {
|
|
4
|
-
const csvStorage = new
|
|
4
|
+
const csvStorage = new AdapterCsv(opts);
|
|
5
5
|
return new ValtheraClass({
|
|
6
6
|
adapter: csvStorage,
|
|
7
7
|
});
|
|
8
8
|
}
|
|
9
|
+
export const DYNAMIC = {
|
|
10
|
+
def: (opts) => new AdapterCsv(opts),
|
|
11
|
+
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.
|
|
1
|
+
export declare const version = "0.131.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "0.
|
|
1
|
+
export const version = "0.131.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wxn0brp/db-storage-csv",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.131.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.
|
|
23
|
-
"csv": "^6.6.
|
|
22
|
+
"@wxn0brp/db-core": "^0.13.0",
|
|
23
|
+
"csv": "^6.6.4"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/bun": "*",
|