@kvs/node-localstorage 2.0.0 → 2.1.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/lib/index.js +7 -13
- package/lib/index.js.map +1 -1
- package/module/index.js +7 -13
- package/module/index.js.map +1 -1
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -21,15 +12,18 @@ const node_localstorage_1 = require("node-localstorage");
|
|
|
21
12
|
const app_root_path_1 = __importDefault(require("app-root-path"));
|
|
22
13
|
// @ts-ignore
|
|
23
14
|
const mkdirp_1 = __importDefault(require("mkdirp"));
|
|
24
|
-
const kvsLocalStorage = (options) =>
|
|
15
|
+
const kvsLocalStorage = async (options) => {
|
|
25
16
|
const defaultCacheDir = path_1.default.join(app_root_path_1.default.toString(), ".cache");
|
|
26
17
|
if (!options.storeFilePath) {
|
|
27
|
-
|
|
18
|
+
await (0, mkdirp_1.default)(defaultCacheDir);
|
|
28
19
|
}
|
|
29
20
|
const saveFilePath = options.storeFilePath
|
|
30
21
|
? options.storeFilePath
|
|
31
22
|
: path_1.default.join(defaultCacheDir, "kvs-node-localstorage");
|
|
32
|
-
return (0, storage_1.kvsStorage)(
|
|
33
|
-
|
|
23
|
+
return (0, storage_1.kvsStorage)({
|
|
24
|
+
...options,
|
|
25
|
+
storage: new node_localstorage_1.LocalStorage(saveFilePath)
|
|
26
|
+
});
|
|
27
|
+
};
|
|
34
28
|
exports.kvsLocalStorage = kvsLocalStorage;
|
|
35
29
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,0CAAiE;AAEjE,aAAa;AACb,yDAAiD;AACjD,aAAa;AACb,kEAAoC;AACpC,aAAa;AACb,oDAA4B;AAUrB,MAAM,eAAe,GAAG,KAAK,EAChC,OAAuC,EACZ,EAAE;IAC7B,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,uBAAO,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC;IAChE,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE;QACxB,MAAM,IAAA,gBAAM,EAAC,eAAe,CAAC,CAAC;KACjC;IACD,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa;QACtC,CAAC,CAAC,OAAO,CAAC,aAAa;QACvB,CAAC,CAAC,cAAI,CAAC,IAAI,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC;IAC1D,OAAO,IAAA,oBAAU,EAAC;QACd,GAAG,OAAO;QACV,OAAO,EAAE,IAAI,gCAAY,CAAC,YAAY,CAAC;KAC1C,CAAC,CAAC;AACP,CAAC,CAAC;AAdW,QAAA,eAAe,mBAc1B"}
|
package/module/index.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import path from "path";
|
|
11
2
|
import { kvsStorage } from "@kvs/storage";
|
|
12
3
|
// @ts-ignore
|
|
@@ -15,14 +6,17 @@ import { LocalStorage } from "node-localstorage";
|
|
|
15
6
|
import appRoot from "app-root-path";
|
|
16
7
|
// @ts-ignore
|
|
17
8
|
import mkdirp from "mkdirp";
|
|
18
|
-
export const kvsLocalStorage = (options) =>
|
|
9
|
+
export const kvsLocalStorage = async (options) => {
|
|
19
10
|
const defaultCacheDir = path.join(appRoot.toString(), ".cache");
|
|
20
11
|
if (!options.storeFilePath) {
|
|
21
|
-
|
|
12
|
+
await mkdirp(defaultCacheDir);
|
|
22
13
|
}
|
|
23
14
|
const saveFilePath = options.storeFilePath
|
|
24
15
|
? options.storeFilePath
|
|
25
16
|
: path.join(defaultCacheDir, "kvs-node-localstorage");
|
|
26
|
-
return kvsStorage(
|
|
27
|
-
|
|
17
|
+
return kvsStorage({
|
|
18
|
+
...options,
|
|
19
|
+
storage: new LocalStorage(saveFilePath)
|
|
20
|
+
});
|
|
21
|
+
};
|
|
28
22
|
//# sourceMappingURL=index.js.map
|
package/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAyB,UAAU,EAAE,MAAM,cAAc,CAAC;AAEjE,aAAa;AACb,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,aAAa;AACb,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,aAAa;AACb,OAAO,MAAM,MAAM,QAAQ,CAAC;AAU5B,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAChC,OAAuC,EACZ,EAAE;IAC7B,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC;IAChE,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE;QACxB,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;KACjC;IACD,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa;QACtC,CAAC,CAAC,OAAO,CAAC,aAAa;QACvB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAAC;IAC1D,OAAO,UAAU,CAAC;QACd,GAAG,OAAO;QACV,OAAO,EAAE,IAAI,YAAY,CAAC,YAAY,CAAC;KAC1C,CAAC,CAAC;AACP,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kvs/node-localstorage",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Node.js localstorage for KVS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kvs",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@jsdevtools/karma-config": "^3.1.7",
|
|
55
|
-
"@kvs/common-test-case": "^2.
|
|
55
|
+
"@kvs/common-test-case": "^2.1.0",
|
|
56
56
|
"@types/mocha": "^9.0.0",
|
|
57
57
|
"@types/node": "^16.9.1",
|
|
58
58
|
"mocha": "^9.1.1",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "ac9e606e7952f1fd69b2bbf27671d068cb71ade8"
|
|
68
68
|
}
|