@kvs/node-localstorage 1.1.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.d.ts +1 -1
- package/lib/index.js +8 -13
- package/lib/index.js.map +1 -1
- package/module/index.d.ts +1 -1
- package/module/index.js +7 -13
- package/module/index.js.map +1 -1
- package/package.json +9 -10
- package/CHANGELOG.md +0 -57
package/lib/index.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export declare type KvsLocalStorageOptions<Schema extends KvsLocalStorageSchema>
|
|
|
8
8
|
kvsVersionKey?: string;
|
|
9
9
|
storeFilePath?: string;
|
|
10
10
|
};
|
|
11
|
-
export declare const kvsLocalStorage: <Schema extends KvsLocalStorageSchema>(options: KvsLocalStorageOptions<Schema>) => Promise<
|
|
11
|
+
export declare const kvsLocalStorage: <Schema extends KvsLocalStorageSchema>(options: KvsLocalStorageOptions<Schema>) => Promise<KvsStorage<Schema>>;
|
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,14 +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
|
-
|
|
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 storage_1.kvsStorage(
|
|
33
|
-
|
|
23
|
+
return (0, storage_1.kvsStorage)({
|
|
24
|
+
...options,
|
|
25
|
+
storage: new node_localstorage_1.LocalStorage(saveFilePath)
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
exports.kvsLocalStorage = kvsLocalStorage;
|
|
34
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.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export declare type KvsLocalStorageOptions<Schema extends KvsLocalStorageSchema>
|
|
|
8
8
|
kvsVersionKey?: string;
|
|
9
9
|
storeFilePath?: string;
|
|
10
10
|
};
|
|
11
|
-
export declare const kvsLocalStorage: <Schema extends KvsLocalStorageSchema>(options: KvsLocalStorageOptions<Schema>) => Promise<
|
|
11
|
+
export declare const kvsLocalStorage: <Schema extends KvsLocalStorageSchema>(options: KvsLocalStorageOptions<Schema>) => Promise<KvsStorage<Schema>>;
|
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": "
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Node.js localstorage for KVS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kvs",
|
|
@@ -45,25 +45,24 @@
|
|
|
45
45
|
"trailingComma": "none"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@kvs/storage": "^
|
|
48
|
+
"@kvs/storage": "^2.0.0",
|
|
49
49
|
"app-root-path": "^3.0.0",
|
|
50
50
|
"mkdirp": "^1.0.4",
|
|
51
51
|
"node-localstorage": "^2.1.6"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@jsdevtools/karma-config": "^3.1.7",
|
|
55
|
-
"@kvs/common-test-case": "^
|
|
56
|
-
"@types/mocha": "^
|
|
57
|
-
"@types/node": "^
|
|
58
|
-
"
|
|
59
|
-
"mocha": "^8.1.1",
|
|
55
|
+
"@kvs/common-test-case": "^2.1.0",
|
|
56
|
+
"@types/mocha": "^9.0.0",
|
|
57
|
+
"@types/node": "^16.9.1",
|
|
58
|
+
"mocha": "^9.1.1",
|
|
60
59
|
"prettier": "^2.0.5",
|
|
61
60
|
"rimraf": "^3.0.2",
|
|
62
|
-
"ts-loader": "^8.0
|
|
63
|
-
"typescript": "^
|
|
61
|
+
"ts-loader": "^8.2.0",
|
|
62
|
+
"typescript": "^4.2.4"
|
|
64
63
|
},
|
|
65
64
|
"publishConfig": {
|
|
66
65
|
"access": "public"
|
|
67
66
|
},
|
|
68
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "ac9e606e7952f1fd69b2bbf27671d068cb71ade8"
|
|
69
68
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# [1.1.0](https://github.com/azu/kvs/compare/v1.0.0...v1.1.0) (2020-10-29)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Features
|
|
10
|
-
|
|
11
|
-
* **examples:** add basic example ([#14](https://github.com/azu/kvs/issues/14)) ([351215d](https://github.com/azu/kvs/commit/351215d6c04158201768036caaa6e792c72717ea))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# [1.0.0](https://github.com/azu/kvs/compare/v0.3.1...v1.0.0) (2020-08-22)
|
|
18
|
-
|
|
19
|
-
**Note:** Version bump only for package @kvs/node-localstorage
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# [0.3.0](https://github.com/azu/kvs/compare/v0.2.1...v0.3.0) (2020-08-22)
|
|
26
|
-
|
|
27
|
-
**Note:** Version bump only for package @kvs/node-localstorage
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
## [0.2.1](https://github.com/azu/kvs/compare/v0.2.0...v0.2.1) (2020-08-22)
|
|
34
|
-
|
|
35
|
-
**Note:** Version bump only for package @kvs/node-localstorage
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
# [0.2.0](https://github.com/azu/kvs/compare/v0.1.0...v0.2.0) (2020-08-08)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
### Features
|
|
45
|
-
|
|
46
|
-
* **@kvs/env:** migrate Schema Type ([0951d08](https://github.com/azu/kvs/commit/0951d08405d42588454878a03c9082961ad0c363))
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
# 0.1.0 (2020-08-08)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
### Features
|
|
56
|
-
|
|
57
|
-
* **@kvs/node-localstorage:** add node implementation ([5160012](https://github.com/azu/kvs/commit/516001286c96ac85cb54d55fbba62549d6d7eb0e))
|