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

@common-stack/store-mongo

Package Overview
Dependencies
Maintainers
1
Versions
214
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@common-stack/store-mongo - npm Package Compare versions

Comparing version 0.6.1-alpha.4 to 3.0.1-alpha.0

6

lib/dataloaders/bulk-dataloader.d.ts
import * as DataLoader from 'dataloader';
import { IBaseService } from '../interfaces';
import { DataLoaderOptions, IBaseService, IDataLoader } from '../interfaces';
export declare class BulkDataLoader<T extends {
id: string;
}> extends DataLoader<string, T> {
}> extends DataLoader<string, T> implements IDataLoader<T> {
private readonly service;
constructor(service: IBaseService<T>);
withOptions: DataLoader<DataLoaderOptions<T>, T[], DataLoaderOptions<T>>;
}

@@ -21,2 +21,13 @@ /******/ (() => { // webpackBootstrap

};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));

@@ -32,2 +43,9 @@ exports.BulkDataLoader = void 0;

});
this.service = service;
this.withOptions = new DataLoader(async (options) => {
const [_a] = options, { id, searchKey } = _a, rest = __rest(_a, ["id", "searchKey"]);
const ids = options.map((option) => option.id);
const vehicleModelVariants = await this.service.getAll(Object.assign(Object.assign({}, rest), { criteria: Object.assign(Object.assign({}, rest.criteria), { [searchKey]: { $in: ids } }) }));
return ids.map((modelId) => vehicleModelVariants.filter((i) => i[searchKey].toString() === modelId.toString()));
});
}

@@ -34,0 +52,0 @@ };

import * as DataLoader from 'dataloader';
export type IDataLoader<T> = DataLoader<string, T>;
import { IBaseService } from './base-service';
export type DataLoaderOptions<T> = Parameters<IBaseService<T>['getAll']>[0] & {
id: string;
searchKey: keyof T;
};
export type IDataLoader<T> = DataLoader<string, T> & {
withOptions: DataLoader<DataLoaderOptions<T>, T[]>;
};
{
"name": "@common-stack/store-mongo",
"version": "0.6.1-alpha.4",
"version": "3.0.1-alpha.0",
"description": "Sample core for higher packages to depend on",

@@ -22,3 +22,3 @@ "license": "ISC",

"dependencies": {
"@common-stack/core": "0.6.1-alpha.4"
"@common-stack/core": "3.0.1-alpha.0"
},

@@ -35,3 +35,3 @@ "peerDependencies": {

},
"gitHead": "8f1002595ef0da183fc26d37a4a185b9c94cfc76"
"gitHead": "2c5be38e54fcffe218106da86a39bf5c253e504d"
}

Sorry, the diff of this file is not supported yet

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