v1.2.2 - Fix network error on background, auto-retry streaming with reconnect
This commit is contained in:
12
node_modules/@kvs/node-localstorage/lib/index.d.ts
generated
vendored
Normal file
12
node_modules/@kvs/node-localstorage/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { JsonValue, KvsStorage } from "@kvs/storage";
|
||||
import { KVS, KVSOptions } from "@kvs/types";
|
||||
export type KvsLocalStorageSchema = {
|
||||
[index: string]: JsonValue;
|
||||
};
|
||||
export type KvsLocalStorage<Schema extends KvsLocalStorageSchema> = KVS<Schema>;
|
||||
export type KvsLocalStorageOptions<Schema extends KvsLocalStorageSchema> = KVSOptions<Schema> & {
|
||||
kvsVersionKey?: string;
|
||||
storeFilePath?: string;
|
||||
storeQuota?: number;
|
||||
};
|
||||
export declare const kvsLocalStorage: <Schema extends KvsLocalStorageSchema>(options: KvsLocalStorageOptions<Schema>) => Promise<KvsStorage<Schema>>;
|
||||
31
node_modules/@kvs/node-localstorage/lib/index.js
generated
vendored
Normal file
31
node_modules/@kvs/node-localstorage/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.kvsLocalStorage = void 0;
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const storage_1 = require("@kvs/storage");
|
||||
const promises_1 = __importDefault(require("node:fs/promises"));
|
||||
// @ts-ignore
|
||||
const node_localstorage_1 = require("node-localstorage");
|
||||
// @ts-ignore
|
||||
const app_root_path_1 = __importDefault(require("app-root-path"));
|
||||
const kvsLocalStorage = async (options) => {
|
||||
const defaultCacheDir = path_1.default.join(app_root_path_1.default.toString(), ".cache");
|
||||
if (!options.storeFilePath) {
|
||||
await promises_1.default.mkdir(defaultCacheDir, {
|
||||
recursive: true
|
||||
});
|
||||
}
|
||||
const saveFilePath = options.storeFilePath
|
||||
? options.storeFilePath
|
||||
: path_1.default.join(defaultCacheDir, "kvs-node-localstorage");
|
||||
const storeQuota = options.storeQuota ? options.storeQuota : 5 * 1024 * 1024;
|
||||
return (0, storage_1.kvsStorage)({
|
||||
...options,
|
||||
storage: new node_localstorage_1.LocalStorage(saveFilePath, storeQuota)
|
||||
});
|
||||
};
|
||||
exports.kvsLocalStorage = kvsLocalStorage;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@kvs/node-localstorage/lib/index.js.map
generated
vendored
Normal file
1
node_modules/@kvs/node-localstorage/lib/index.js.map
generated
vendored
Normal file
@@ -0,0 +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;AAW7B,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,CAAC;QACzB,MAAM,kBAAE,CAAC,KAAK,CAAC,eAAe,EAAE;YAC5B,SAAS,EAAE,IAAI;SAClB,CAAC,CAAC;IACP,CAAC;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,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;IAC7E,OAAO,IAAA,oBAAU,EAAC;QACd,GAAG,OAAO;QACV,OAAO,EAAE,IAAI,gCAAY,CAAC,YAAY,EAAE,UAAU,CAAC;KACtD,CAAC,CAAC;AACP,CAAC,CAAC;AAjBW,QAAA,eAAe,mBAiB1B"}
|
||||
Reference in New Issue
Block a user