@mashroom/mashroom-storage
Advanced tools
Comparing version 1.2.3 to 1.3.0
@@ -7,3 +7,3 @@ { | ||
"license": "MIT", | ||
"version": "1.2.3", | ||
"version": "1.3.0", | ||
"files": [ | ||
@@ -14,8 +14,8 @@ "dist/**", | ||
"dependencies": { | ||
"@mashroom/mashroom-utils": "1.2.3" | ||
"@mashroom/mashroom-utils": "1.3.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.6.4", | ||
"@mashroom/mashroom": "1.2.3", | ||
"eslint": "^6.6.0", | ||
"@babel/cli": "^7.8.3", | ||
"@mashroom/mashroom": "1.3.0", | ||
"eslint": "^6.8.0", | ||
"jest": "^24.9.0" | ||
@@ -22,0 +22,0 @@ }, |
// @flow | ||
import type {MashroomPluginConfig, MashroomPluginContextHolder} from '@mashroom/mashroom/type-definitions'; | ||
export type StorageObject<T: {}> = T & {| | ||
_id: string | ||
|} | ||
export type StorageObjectFilter<T: {}> = {[$Keys<StorageObject<T>>]: any}; | ||
export type StorageUpdateResult = { | ||
modifiedCount: number, | ||
}; | ||
/** | ||
* Mashroom storage collection | ||
*/ | ||
export interface MashroomStorageCollection<T: {}> { | ||
/** | ||
* Find all items that match given filter (e.g. { name: 'foo' }). | ||
*/ | ||
find(filter?: StorageObjectFilter<T>, limit?: number): Promise<Array<StorageObject<T>>>; | ||
/** | ||
* Return the first item that matches the given filter or null otherwise. | ||
*/ | ||
findOne(filter: StorageObjectFilter<T>): Promise<?StorageObject<T>>; | ||
/** | ||
* Insert one item | ||
*/ | ||
insertOne(item: T): Promise<StorageObject<T>>; | ||
/** | ||
* Update the first item that matches the given filter. | ||
*/ | ||
updateOne(filter: StorageObjectFilter<T>, propertiesToUpdate: $Shape<StorageObject<T>>): Promise<StorageUpdateResult>; | ||
/** | ||
* Replace the first item that matches the given filter. | ||
*/ | ||
replaceOne(filter: StorageObjectFilter<T>, newItem: T): Promise<StorageUpdateResult>; | ||
/** | ||
* Delete the first item that matches the given filter. | ||
*/ | ||
deleteOne(filter: StorageObjectFilter<T>): Promise<StorageUpdateResult>; | ||
/** | ||
* Delete all items that matches the given filter. | ||
*/ | ||
deleteMany(filter: StorageObjectFilter<T>): Promise<StorageUpdateResult>; | ||
} | ||
/** | ||
* Mashroom storage interface | ||
*/ | ||
export interface MashroomStorage { | ||
/** | ||
* Get (or create) the MashroomStorageCollection with given name. | ||
*/ | ||
getCollection<T: {}>(name: string): Promise<MashroomStorageCollection<T>>; | ||
} | ||
export interface MashroomStorageService { | ||
/** | ||
* Get (or create) the MashroomStorageCollection with given name. | ||
*/ | ||
getCollection<T: {}>(name: string): Promise<MashroomStorageCollection<T>>; | ||
} | ||
export type MashroomStorageProviderMap = { | ||
[name: string]: MashroomStorage | ||
}; | ||
export interface MashroomStorageRegistry { | ||
registerStorage(name: string, storage: MashroomStorage): void; | ||
unregisterStorage(name: string): void; | ||
getStorage(name: string): ?MashroomStorage; | ||
+storages: MashroomStorageProviderMap; | ||
} | ||
/** | ||
* Bootstrap method definition for storage plugins | ||
*/ | ||
export type MashroomStoragePluginBootstrapFunction = (pluginName: string, pluginConfig: MashroomPluginConfig, contextHolder: MashroomPluginContextHolder) => Promise<MashroomStorage>; | ||
export type * from './api'; |
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
16275
13
281
+ Added@mashroom/mashroom-utils@1.3.0(transitive)
- Removed@mashroom/mashroom-utils@1.2.3(transitive)