datastore-fs
Advanced tools
Comparing version
@@ -15,3 +15,4 @@ /** | ||
import { BaseDatastore } from 'datastore-core'; | ||
import { Key, type KeyQuery, type Pair, type Query } from 'interface-datastore'; | ||
import { Key } from 'interface-datastore'; | ||
import type { KeyQuery, Pair, Query } from 'interface-datastore'; | ||
import type { AwaitIterable } from 'interface-store'; | ||
@@ -18,0 +19,0 @@ export interface FsDatastoreInit { |
@@ -17,6 +17,7 @@ /** | ||
import { promisify } from 'util'; | ||
import { BaseDatastore, Errors } from 'datastore-core'; | ||
import { BaseDatastore } from 'datastore-core'; | ||
// @ts-expect-error no types | ||
import fwa from 'fast-write-atomic'; | ||
import { Key } from 'interface-datastore'; | ||
import { OpenFailedError, NotFoundError, PutFailedError, DeleteFailedError } from 'interface-store'; | ||
import glob from 'it-glob'; | ||
@@ -75,3 +76,3 @@ import map from 'it-map'; | ||
if (this.errorIfExists) { | ||
throw Errors.dbOpenFailedError(new Error(`Datastore directory: ${this.path} already exists`)); | ||
throw new OpenFailedError(`Datastore directory: ${this.path} already exists`); | ||
} | ||
@@ -86,3 +87,3 @@ } | ||
else { | ||
throw Errors.notFoundError(new Error(`Datastore directory: ${this.path} does not exist`)); | ||
throw new NotFoundError(`Datastore directory: ${this.path} does not exist`); | ||
} | ||
@@ -135,3 +136,3 @@ } | ||
catch (err) { | ||
throw Errors.dbWriteFailedError(err); | ||
throw new PutFailedError(String(err)); | ||
} | ||
@@ -157,3 +158,3 @@ } | ||
catch (err) { | ||
throw Errors.notFoundError(err); | ||
throw new NotFoundError(String(err)); | ||
} | ||
@@ -205,3 +206,3 @@ return data; | ||
} | ||
throw Errors.dbDeleteFailedError(err); | ||
throw new DeleteFailedError(String(err)); | ||
} | ||
@@ -208,0 +209,0 @@ } |
{ | ||
"name": "datastore-fs", | ||
"version": "9.1.9", | ||
"version": "10.0.0", | ||
"description": "Datastore implementation with file system backend", | ||
@@ -58,6 +58,6 @@ "author": "Friedel Ziegelmayer<dignifiedquire@gmail.com>", | ||
"dependencies": { | ||
"datastore-core": "^9.0.0", | ||
"datastore-core": "10.0.0", | ||
"fast-write-atomic": "^0.2.1", | ||
"interface-datastore": "^8.0.0", | ||
"interface-store": "^5.0.0", | ||
"interface-store": "6.0.0", | ||
"it-glob": "^3.0.1", | ||
@@ -70,5 +70,5 @@ "it-map": "^3.0.5", | ||
"aegir": "^42.2.3", | ||
"interface-datastore-tests": "^5.0.0", | ||
"interface-datastore-tests": "6.0.0", | ||
"ipfs-utils": "^9.0.14" | ||
} | ||
} |
@@ -18,13 +18,11 @@ /** | ||
import { promisify } from 'util' | ||
import { | ||
BaseDatastore, Errors | ||
} from 'datastore-core' | ||
import { BaseDatastore } from 'datastore-core' | ||
// @ts-expect-error no types | ||
import fwa from 'fast-write-atomic' | ||
import { | ||
Key, type KeyQuery, type Pair, type Query | ||
} from 'interface-datastore' | ||
import { Key } from 'interface-datastore' | ||
import { OpenFailedError, NotFoundError, PutFailedError, DeleteFailedError } from 'interface-store' | ||
import glob from 'it-glob' | ||
import map from 'it-map' | ||
import parallel from 'it-parallel-batch' | ||
import type { KeyQuery, Pair, Query } from 'interface-datastore' | ||
import type { AwaitIterable } from 'interface-store' | ||
@@ -98,3 +96,3 @@ | ||
if (this.errorIfExists) { | ||
throw Errors.dbOpenFailedError(new Error(`Datastore directory: ${this.path} already exists`)) | ||
throw new OpenFailedError(`Datastore directory: ${this.path} already exists`) | ||
} | ||
@@ -107,3 +105,3 @@ } catch (err: any) { | ||
} else { | ||
throw Errors.notFoundError(new Error(`Datastore directory: ${this.path} does not exist`)) | ||
throw new NotFoundError(`Datastore directory: ${this.path} does not exist`) | ||
} | ||
@@ -166,3 +164,3 @@ } | ||
} catch (err: any) { | ||
throw Errors.dbWriteFailedError(err) | ||
throw new PutFailedError(String(err)) | ||
} | ||
@@ -193,3 +191,3 @@ } | ||
} catch (err: any) { | ||
throw Errors.notFoundError(err) | ||
throw new NotFoundError(String(err)) | ||
} | ||
@@ -252,3 +250,3 @@ return data | ||
throw Errors.dbDeleteFailedError(err) | ||
throw new DeleteFailedError(String(err)) | ||
} | ||
@@ -255,0 +253,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
29848
0.86%+ Added
+ Added
- Removed
- Removed
- Removed
Updated
Updated