key-file-storage
Advanced tools
Comparing version 2.2.1 to 2.2.2
export default function keyFileStorage(kfsPath: string, cacheConfig?: number | boolean): any; |
@@ -0,0 +0,0 @@ "use strict"; |
export default function createCache(cacheConfig?: number | boolean): {}; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -15,3 +15,3 @@ export default function keyFileBasic(kfsPath: string, cache: { | ||
querySync: (collection: string) => any; | ||
queryAsync: (collection: string) => Promise<unknown>; | ||
queryAsync: (collection: string) => Promise<any>; | ||
}; |
@@ -194,4 +194,6 @@ "use strict"; | ||
function querySync(collection) { | ||
collection = path_1.join(kfsPath, validizeKey(collection)); | ||
if (collection in cache) | ||
return cache[collection]; | ||
try { | ||
collection = path_1.join(kfsPath, validizeKey(collection)); | ||
var files = recurFs.readdir.sync(collection, function (resource, status) { | ||
@@ -201,3 +203,3 @@ return status.isFile(); | ||
files = files.map(function (file) { return path_1.relative(kfsPath, file); }); | ||
return files || []; | ||
return (cache[collection] = files || []); | ||
} | ||
@@ -209,4 +211,6 @@ catch (err) { | ||
function queryAsync(collection) { | ||
collection = path_1.join(kfsPath, validizeKey(collection)); | ||
if (collection in cache) | ||
return Promise.resolve(cache[collection]); | ||
return new Promise(function (resolve, reject) { | ||
collection = path_1.join(kfsPath, validizeKey(collection)); | ||
//// This implementation does not work with empty folders: | ||
@@ -227,3 +231,3 @@ // recurFs.readdir(collection, function(resource, status, next) { | ||
if (err.code === 'ENOENT') | ||
resolve([]); | ||
resolve((cache[collection] = [])); | ||
else | ||
@@ -249,3 +253,3 @@ reject(err); | ||
if (!jobNumber) { | ||
resolve(fileList); | ||
resolve((cache[collection] = fileList)); | ||
} | ||
@@ -272,3 +276,3 @@ files.forEach(function (file) { | ||
if (!jobNumber) { | ||
resolve(fileList); | ||
resolve((cache[collection] = fileList)); | ||
} | ||
@@ -275,0 +279,0 @@ }); |
export default function createKfs(kfsPath: string, cache: { | ||
[x: string]: any; | ||
}): any; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import createCache from './src/create-cache'; |
{ | ||
"name": "key-file-storage", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "Simple key-value storage directly on file system, maps each key to a separate file.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -0,0 +0,0 @@ # key-file-storage |
@@ -0,0 +0,0 @@ export default function createCache(cacheConfig?: number | boolean) { |
@@ -206,4 +206,5 @@ import { | ||
function querySync(collection: string) { | ||
collection = join(kfsPath, validizeKey(collection)); | ||
if (collection in cache) return cache[collection]; | ||
try { | ||
collection = join(kfsPath, validizeKey(collection)); | ||
var files = recurFs.readdir.sync(collection, function(resource: any, status: { isFile: () => void }) { | ||
@@ -213,3 +214,3 @@ return status.isFile(); | ||
files = files.map((file: string) => relative(kfsPath, file)); | ||
return files || []; | ||
return (cache[collection] = files || []); | ||
} catch (err) { | ||
@@ -221,5 +222,6 @@ return []; | ||
function queryAsync(collection: string) { | ||
collection = join(kfsPath, validizeKey(collection)); | ||
if (collection in cache) return Promise.resolve(cache[collection]); | ||
return new Promise(function(resolve, reject) { | ||
collection = join(kfsPath, validizeKey(collection)); | ||
//// This implementation does not work with empty folders: | ||
@@ -243,3 +245,3 @@ // recurFs.readdir(collection, function(resource, status, next) { | ||
if (err) { | ||
if (err.code === 'ENOENT') resolve([]); | ||
if (err.code === 'ENOENT') resolve((cache[collection] = [])); | ||
else reject(err); | ||
@@ -262,3 +264,3 @@ } else { | ||
if (!jobNumber) { | ||
resolve(fileList); | ||
resolve((cache[collection] = fileList)); | ||
} | ||
@@ -282,3 +284,3 @@ files.forEach(function(file) { | ||
if (!jobNumber) { | ||
resolve(fileList); | ||
resolve((cache[collection] = fileList)); | ||
} | ||
@@ -285,0 +287,0 @@ }); |
@@ -0,0 +0,0 @@ import keyFileBasic from './key-file-basic'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import keyFileStorage from '.'; |
@@ -0,0 +0,0 @@ { |
{ | ||
"extends": ["tslint:recommended", "tslint-config-prettier"] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
58928
26
1615
0
2