@kvs/node-localstorage 2.1.5 → 2.2.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 CHANGED
@@ -7,5 +7,6 @@ export type KvsLocalStorage<Schema extends KvsLocalStorageSchema> = KVS<Schema>;
7
7
  export type KvsLocalStorageOptions<Schema extends KvsLocalStorageSchema> = KVSOptions<Schema> & {
8
8
  kvsVersionKey?: string;
9
9
  storeFilePath?: string;
10
+ storeQuota?: number;
10
11
  };
11
12
  export declare const kvsLocalStorage: <Schema extends KvsLocalStorageSchema>(options: KvsLocalStorageOptions<Schema>) => Promise<KvsStorage<Schema>>;
package/lib/index.js CHANGED
@@ -21,9 +21,10 @@ const kvsLocalStorage = async (options) => {
21
21
  const saveFilePath = options.storeFilePath
22
22
  ? options.storeFilePath
23
23
  : path_1.default.join(defaultCacheDir, "kvs-node-localstorage");
24
+ const storeQuota = options.storeQuota ? options.storeQuota : 5 * 1024 * 1024;
24
25
  return (0, storage_1.kvsStorage)({
25
26
  ...options,
26
- storage: new node_localstorage_1.LocalStorage(saveFilePath)
27
+ storage: new node_localstorage_1.LocalStorage(saveFilePath, storeQuota)
27
28
  });
28
29
  };
29
30
  exports.kvsLocalStorage = kvsLocalStorage;
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,0CAAiE;AAEjE,gEAAkC;AAClC,aAAa;AACb,yDAAiD;AACjD,aAAa;AACb,kEAAoC;AAU7B,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,kBAAE,CAAC,KAAK,CAAC,e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AU,CAAC;KACtD,CAAC,CAAC;AACP,CAAC,CAAC;AAjBW,QAAA,eAAe,mBAiB1B"}
package/module/index.d.ts CHANGED
@@ -7,5 +7,6 @@ export type KvsLocalStorage<Schema extends KvsLocalStorageSchema> = KVS<Schema>;
7
7
  export type KvsLocalStorageOptions<Schema extends KvsLocalStorageSchema> = KVSOptions<Schema> & {
8
8
  kvsVersionKey?: string;
9
9
  storeFilePath?: string;
10
+ storeQuota?: number;
10
11
  };
11
12
  export declare const kvsLocalStorage: <Schema extends KvsLocalStorageSchema>(options: KvsLocalStorageOptions<Schema>) => Promise<KvsStorage<Schema>>;
package/module/index.js CHANGED
@@ -15,9 +15,10 @@ export const kvsLocalStorage = async (options) => {
15
15
  const saveFilePath = options.storeFilePath
16
16
  ? options.storeFilePath
17
17
  : path.join(defaultCacheDir, "kvs-node-localstorage");
18
+ const storeQuota = options.storeQuota ? options.storeQuota : 5 * 1024 * 1024;
18
19
  return kvsStorage({
19
20
  ...options,
20
- storage: new LocalStorage(saveFilePath)
21
+ storage: new LocalStorage(saveFilePath, storeQuota)
21
22
  });
22
23
  };
23
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,aAAa;AACb,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,aAAa;AACb,OAAO,OAAO,MAAM,eAAe,CAAC;AAUpC,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;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CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;IAC7E,OAAO,UAAU,CAAC;QACd,GAAG,OAAO;QACV,OAAO,EAAE,IAAI,YAAY,CAAC,YAAY,EAAE,UAAU,CAAC;KACtD,CAAC,CAAC;AACP,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,66 +1,66 @@
1
1
  {
2
- "name": "@kvs/node-localstorage",
3
- "version": "2.1.5",
4
- "description": "Node.js localstorage for KVS.",
5
- "keywords": [
6
- "kvs",
7
- "browser",
8
- "localstorage"
9
- ],
10
- "homepage": "https://github.com/azu/kvs/tree/master/packages/node-localstorage/",
11
- "bugs": {
12
- "url": "https://github.com/azu/kvs/issues"
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "https://github.com/azu/kvs.git"
17
- },
18
- "license": "MIT",
19
- "author": "azu",
20
- "sideEffects": false,
21
- "main": "lib/index.js",
22
- "module": "module/index.js",
23
- "types": "lib/index.d.ts",
24
- "directories": {
25
- "lib": "lib",
26
- "test": "test"
27
- },
28
- "files": [
29
- "bin/",
30
- "lib/",
31
- "module"
32
- ],
33
- "scripts": {
34
- "build": "tsc -p . && tsc --project ./tsconfig.module.json",
35
- "clean": "rimraf lib/ module/",
36
- "prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"",
37
- "prepublishOnly": "npm run clean && npm run build",
38
- "test": "mocha \"test/**/*.ts\"",
39
- "watch": "tsc -p . --watch"
40
- },
41
- "prettier": {
42
- "printWidth": 120,
43
- "singleQuote": false,
44
- "tabWidth": 4,
45
- "trailingComma": "none"
46
- },
47
- "dependencies": {
48
- "@kvs/storage": "^2.1.4",
49
- "app-root-path": "^3.1.0",
50
- "node-localstorage": "^2.1.6"
51
- },
52
- "devDependencies": {
53
- "@kvs/common-test-case": "^2.1.4",
54
- "@types/mocha": "^10.0.1",
55
- "@types/node": "^20.4.2",
56
- "mocha": "^10.2.0",
57
- "prettier": "^3.0.0",
58
- "rimraf": "^5.0.1",
59
- "ts-loader": "^9.4.4",
60
- "typescript": "^5.1.6"
61
- },
62
- "publishConfig": {
63
- "access": "public"
64
- },
65
- "gitHead": "bd85ca1e2b31c32bcf52f780727f971db115aab7"
2
+ "name": "@kvs/node-localstorage",
3
+ "version": "2.2.0",
4
+ "description": "Node.js localstorage for KVS.",
5
+ "keywords": [
6
+ "kvs",
7
+ "browser",
8
+ "localstorage"
9
+ ],
10
+ "homepage": "https://github.com/azu/kvs/tree/master/packages/node-localstorage/",
11
+ "bugs": {
12
+ "url": "https://github.com/azu/kvs/issues"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/azu/kvs.git"
17
+ },
18
+ "license": "MIT",
19
+ "author": "azu",
20
+ "sideEffects": false,
21
+ "main": "lib/index.js",
22
+ "module": "module/index.js",
23
+ "types": "lib/index.d.ts",
24
+ "directories": {
25
+ "lib": "lib",
26
+ "test": "test"
27
+ },
28
+ "files": [
29
+ "bin/",
30
+ "lib/",
31
+ "module"
32
+ ],
33
+ "scripts": {
34
+ "build": "tsc -p . && tsc --project ./tsconfig.module.json",
35
+ "clean": "rimraf lib/ module/",
36
+ "prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"",
37
+ "prepublishOnly": "npm run clean && npm run build",
38
+ "test": "mocha \"test/**/*.ts\"",
39
+ "watch": "tsc -p . --watch"
40
+ },
41
+ "prettier": {
42
+ "printWidth": 120,
43
+ "singleQuote": false,
44
+ "tabWidth": 4,
45
+ "trailingComma": "none"
46
+ },
47
+ "dependencies": {
48
+ "@kvs/storage": "^2.1.4",
49
+ "app-root-path": "^3.1.0",
50
+ "node-localstorage": "^2.1.6"
51
+ },
52
+ "devDependencies": {
53
+ "@kvs/common-test-case": "^2.1.4",
54
+ "@types/mocha": "^10.0.1",
55
+ "@types/node": "^20.4.2",
56
+ "mocha": "^10.2.0",
57
+ "prettier": "^3.0.0",
58
+ "rimraf": "^5.0.1",
59
+ "ts-loader": "^9.4.4",
60
+ "typescript": "^5.1.6"
61
+ },
62
+ "publishConfig": {
63
+ "access": "public"
64
+ },
65
+ "gitHead": "b7d5841d3a745e4645cfd3e1a9f06b4d3e6730e0"
66
66
  }