v1.2.2 - Fix network error on background, auto-retry streaming with reconnect
This commit is contained in:
12
node_modules/@kvs/node-localstorage/module/index.d.ts
generated
vendored
Normal file
12
node_modules/@kvs/node-localstorage/module/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>>;
|
||||
24
node_modules/@kvs/node-localstorage/module/index.js
generated
vendored
Normal file
24
node_modules/@kvs/node-localstorage/module/index.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import path from "path";
|
||||
import { kvsStorage } from "@kvs/storage";
|
||||
import fs from "node:fs/promises";
|
||||
// @ts-ignore
|
||||
import { LocalStorage } from "node-localstorage";
|
||||
// @ts-ignore
|
||||
import appRoot from "app-root-path";
|
||||
export const kvsLocalStorage = async (options) => {
|
||||
const defaultCacheDir = path.join(appRoot.toString(), ".cache");
|
||||
if (!options.storeFilePath) {
|
||||
await fs.mkdir(defaultCacheDir, {
|
||||
recursive: true
|
||||
});
|
||||
}
|
||||
const saveFilePath = options.storeFilePath
|
||||
? options.storeFilePath
|
||||
: path.join(defaultCacheDir, "kvs-node-localstorage");
|
||||
const storeQuota = options.storeQuota ? options.storeQuota : 5 * 1024 * 1024;
|
||||
return kvsStorage({
|
||||
...options,
|
||||
storage: new LocalStorage(saveFilePath, storeQuota)
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@kvs/node-localstorage/module/index.js.map
generated
vendored
Normal file
1
node_modules/@kvs/node-localstorage/module/index.js.map
generated
vendored
Normal file
@@ -0,0 +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;AAWpC,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,CAAC;QACzB,MAAM,EAAE,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,IAAI,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,UAAU,CAAC;QACd,GAAG,OAAO;QACV,OAAO,EAAE,IAAI,YAAY,CAAC,YAAY,EAAE,UAAU,CAAC;KACtD,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
Reference in New Issue
Block a user