interface-store
Advanced tools
Comparing version 4.0.0 to 4.1.0
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.InterfaceStore = factory()}(typeof self !== 'undefined' ? self : this, function () { | ||
"use strict";var InterfaceStore=(()=>{var o=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var l=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of p(e))!s.call(t,a)&&a!==n&&o(t,a,{get:()=>e[a],enumerable:!(i=r(e,a))||i.enumerable});return t};var y=t=>l(o({},"__esModule",{value:!0}),t);var A={};return y(A);})(); | ||
"use strict";var InterfaceStore=(()=>{var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var r=Object.prototype.hasOwnProperty;var y=(e,t,s,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of p(t))!r.call(e,n)&&n!==s&&i(e,n,{get:()=>t[n],enumerable:!(o=a(t,n))||o.enumerable});return e};var l=e=>y(i({},"__esModule",{value:!0}),e);var A={};return l(A);})(); | ||
return InterfaceStore})); |
@@ -0,2 +1,8 @@ | ||
/** | ||
* An iterable or async iterable of values | ||
*/ | ||
export type AwaitIterable<T> = Iterable<T> | AsyncIterable<T>; | ||
/** | ||
* A value or a promise of a value | ||
*/ | ||
export type Await<T> = Promise<T> | T; | ||
@@ -6,6 +12,6 @@ /** | ||
*/ | ||
export interface Options { | ||
export interface AbortOptions { | ||
signal?: AbortSignal; | ||
} | ||
export interface Store<Key, Value, Pair> { | ||
export interface Store<Key, Value, Pair, HasOptionsExtension = {}, PutOptionsExtension = {}, PutManyOptionsExtension = {}, GetOptionsExtension = {}, GetManyOptionsExtension = {}, DeleteOptionsExtension = {}, DeleteManyOptionsExtension = {}> { | ||
/** | ||
@@ -25,3 +31,3 @@ * Check for the existence of a value for the passed key | ||
*/ | ||
has: (key: Key, options?: Options) => Await<boolean>; | ||
has: (key: Key, options?: AbortOptions & HasOptionsExtension) => Await<boolean>; | ||
/** | ||
@@ -36,3 +42,3 @@ * Store the passed value under the passed key | ||
*/ | ||
put: (key: Key, val: Value, options?: Options) => Await<void>; | ||
put: (key: Key, val: Value, options?: AbortOptions & PutOptionsExtension) => Await<void>; | ||
/** | ||
@@ -50,3 +56,3 @@ * Store the given key/value pairs | ||
*/ | ||
putMany: (source: AwaitIterable<Pair>, options?: Options) => AwaitIterable<Pair>; | ||
putMany: (source: AwaitIterable<Pair>, options?: AbortOptions & PutManyOptionsExtension) => AwaitIterable<Pair>; | ||
/** | ||
@@ -62,3 +68,3 @@ * Retrieve the value stored under the given key | ||
*/ | ||
get: (key: Key, options?: Options) => Await<Value>; | ||
get: (key: Key, options?: AbortOptions & GetOptionsExtension) => Await<Value>; | ||
/** | ||
@@ -75,3 +81,3 @@ * Retrieve values for the passed keys | ||
*/ | ||
getMany: (source: AwaitIterable<Key>, options?: Options) => AwaitIterable<Value>; | ||
getMany: (source: AwaitIterable<Key>, options?: AbortOptions & GetManyOptionsExtension) => AwaitIterable<Value>; | ||
/** | ||
@@ -87,3 +93,3 @@ * Remove the record for the passed key | ||
*/ | ||
delete: (key: Key, options?: Options) => Await<void>; | ||
delete: (key: Key, options?: AbortOptions & DeleteOptionsExtension) => Await<void>; | ||
/** | ||
@@ -102,4 +108,4 @@ * Remove values for the passed keys | ||
*/ | ||
deleteMany: (source: AwaitIterable<Key>, options?: Options) => AwaitIterable<Key>; | ||
deleteMany: (source: AwaitIterable<Key>, options?: AbortOptions & DeleteManyOptionsExtension) => AwaitIterable<Key>; | ||
} | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"Options": "https://ipfs.github.io/js-ipfs-interfaces/interfaces/interface_blockstore._internal_.Options.html", | ||
"AbortOptions": "https://ipfs.github.io/js-ipfs-interfaces/interfaces/interface_blockstore._internal_.AbortOptions.html", | ||
"Store": "https://ipfs.github.io/js-ipfs-interfaces/interfaces/interface_blockstore._internal_.Store.html", | ||
@@ -4,0 +4,0 @@ "Await": "https://ipfs.github.io/js-ipfs-interfaces/types/interface_blockstore._internal_.Await.html", |
{ | ||
"name": "interface-store", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "A generic interface for storing and retrieving data", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT", |
/** | ||
* An iterable or async iterable of values | ||
*/ | ||
export type AwaitIterable<T> = Iterable<T> | AsyncIterable<T> | ||
/** | ||
* A value or a promise of a value | ||
*/ | ||
export type Await<T> = Promise<T> | T | ||
@@ -8,7 +15,10 @@ | ||
*/ | ||
export interface Options { | ||
export interface AbortOptions { | ||
signal?: AbortSignal | ||
} | ||
export interface Store<Key, Value, Pair> { | ||
export interface Store<Key, Value, Pair, HasOptionsExtension = {}, | ||
PutOptionsExtension = {}, PutManyOptionsExtension = {}, | ||
GetOptionsExtension = {}, GetManyOptionsExtension = {}, | ||
DeleteOptionsExtension = {}, DeleteManyOptionsExtension = {}> { | ||
/** | ||
@@ -28,3 +38,3 @@ * Check for the existence of a value for the passed key | ||
*/ | ||
has: (key: Key, options?: Options) => Await<boolean> | ||
has: (key: Key, options?: AbortOptions & HasOptionsExtension) => Await<boolean> | ||
@@ -40,3 +50,3 @@ /** | ||
*/ | ||
put: (key: Key, val: Value, options?: Options) => Await<void> | ||
put: (key: Key, val: Value, options?: AbortOptions & PutOptionsExtension) => Await<void> | ||
@@ -57,3 +67,3 @@ /** | ||
source: AwaitIterable<Pair>, | ||
options?: Options | ||
options?: AbortOptions & PutManyOptionsExtension | ||
) => AwaitIterable<Pair> | ||
@@ -71,3 +81,3 @@ | ||
*/ | ||
get: (key: Key, options?: Options) => Await<Value> | ||
get: (key: Key, options?: AbortOptions & GetOptionsExtension) => Await<Value> | ||
@@ -87,3 +97,3 @@ /** | ||
source: AwaitIterable<Key>, | ||
options?: Options | ||
options?: AbortOptions & GetManyOptionsExtension | ||
) => AwaitIterable<Value> | ||
@@ -101,3 +111,3 @@ | ||
*/ | ||
delete: (key: Key, options?: Options) => Await<void> | ||
delete: (key: Key, options?: AbortOptions & DeleteOptionsExtension) => Await<void> | ||
@@ -119,4 +129,4 @@ /** | ||
source: AwaitIterable<Key>, | ||
options?: Options | ||
options?: AbortOptions & DeleteManyOptionsExtension | ||
) => AwaitIterable<Key> | ||
} |
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
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
42690
225