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

iridium

Package Overview
Dependencies
Maintainers
1
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iridium - npm Package Compare versions

Comparing version 7.2.0 to 7.2.1

2

dist/lib/MapReduce.d.ts

@@ -33,3 +33,3 @@ import * as MongoDB from "mongodb";

export interface ReduceFunction<Key, Value> {
(key: Key, values: Value[]): Value;
(key: Key, values: Value[]): Value | Value[] | any;
}

@@ -36,0 +36,0 @@ /**

@@ -391,5 +391,3 @@ /// <reference types="bluebird" />

*/
mapReduce<Key, Value>(instanceType: InstanceImplementation<MapReducedDocument<Key, Value>, any> & {
mapReduceOptions: MapReduceFunctions<TDocument, Key, Value>;
}, options: MapReduceOptions): Bluebird<void>;
mapReduce<Key, Value>(instanceType: InstanceImplementation<MapReducedDocument<Key, Value>, any>, options: MapReduceOptions): Bluebird<void>;
/**

@@ -396,0 +394,0 @@ * Ensures that the given index is created for the collection

@@ -439,2 +439,4 @@ "use strict";

return reject(new Error("Expected a non-inline mapReduce output mode for this method signature"));
if (!instanceType.mapReduceOptions)
return reject(new Error("Expected mapReduceOptions to be specified on the instance type"));
let opts = options;

@@ -441,0 +443,0 @@ let out = {};

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -26,2 +32,15 @@ const Iridium = require("../iridium");

};
let DecoratedMapReducedInstance = class DecoratedMapReducedInstance extends Iridium.Instance {
};
DecoratedMapReducedInstance.collection = "decoratedMapReduced";
DecoratedMapReducedInstance = __decorate([
Iridium.MapReduce(function () {
emit(this.cust_id, this.amount);
}, function (key, values) {
return values.reduce((sum, val) => sum + val, 0);
})
], DecoratedMapReducedInstance);
class NotMapReducedInstance extends Iridium.Instance {
}
NotMapReducedInstance.collection = "notMapReduced";
describe("Model", () => {

@@ -40,2 +59,9 @@ let core = new Iridium.Core({ database: "test" });

});
it("should correctly map and reduce with model and decorator", () => {
let reducedModel = new Iridium.Model(core, DecoratedMapReducedInstance);
let t = reducedModel.remove().then(() => model.mapReduce(DecoratedMapReducedInstance, {
out: "replace", query: { status: "A" }
}).then(() => reducedModel.find().toArray()));
return chai.expect(t).to.eventually.exist.and.have.length(2);
});
it("should correctly map and reduce with model", () => {

@@ -74,4 +100,10 @@ let reducedModel = new Iridium.Model(core, MapReducedInstance);

});
it("should reject with no mapReduce info in Instance type", () => {
let t = model.mapReduce(NotMapReducedInstance, {
out: "replace", query: { status: "A" }
});
return chai.expect(t).to.eventually.be.rejected;
});
});
});
//# sourceMappingURL=MapReduce.js.map
{
"name": "iridium",
"version": "7.2.0",
"version": "7.2.1",
"author": "Benjamin Pannell <admin@sierrasoftworks.com>",

@@ -5,0 +5,0 @@ "description": "A custom lightweight ORM for MongoDB designed for power-users",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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