Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mashroom/mashroom-storage

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mashroom/mashroom-storage - npm Package Compare versions

Comparing version 1.2.3 to 1.3.0

type-definitions/api.js

10

package.json

@@ -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';
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc