🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

cube

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cube - npm Package Compare versions

Comparing version

to
0.0.13

42

lib/cube/client/board.js

@@ -27,6 +27,6 @@ cube.board = function(url, id) {

event.size.add(resize);
event.squareSize.add(resize);
event.squareRadius.add(resize);
event.padding.add(resize);
event.on("size.board", resize);
event.on("squareSize.board", resize);
event.on("squareRadius.board", resize);
event.on("padding.board", resize);

@@ -37,3 +37,3 @@ function message(message) {

case "view": {
event.view.dispatch.call(board, e);
event.view.call(board, e);
break;

@@ -44,4 +44,3 @@ }

.fromJSON(e.piece)
.off("move", add)
.on("move", move);
.on("move.board", move);

@@ -61,3 +60,3 @@ d3.select(piece.node())

piece
.off("move", move)
.on("move.board", null)
.transition(d3.transition().duration(500))

@@ -67,3 +66,3 @@ .fromJSON(e.piece);

// Renable events after transition starts.
d3.timer(function() { piece.on("move", move); }, 250);
d3.timer(function() { piece.on("move.board", move); }, 250);
return true;

@@ -78,3 +77,3 @@ }

piece
.off("move", move)
.on("move.board", null)
.transition(d3.transition().duration(500))

@@ -88,3 +87,3 @@ .size(e.piece.size)

// Renable events after transition starts.
d3.timer(function() { piece.on("move", move); }, 250);
d3.timer(function() { piece.on("move.board", move); }, 250);
return true;

@@ -135,3 +134,3 @@ }

socket.send(JSON.stringify({type: "add", id: id, piece: this}));
this.off("move", add).on("move", move);
this.on("move.board", move);
}

@@ -164,14 +163,9 @@

board.on = function(type, listener) {
event[type].add(listener);
event.on(type, listener);
return board;
};
board.off = function(type, listener) {
event[type].remove(listener);
return board;
};
board.size = function(x) {
if (!arguments.length) return size;
event.size.dispatch.call(board, size = x);
event.size.call(board, size = x);
return board;

@@ -182,3 +176,3 @@ };

if (!arguments.length) return squareSize;
event.squareSize.dispatch.call(board, squareSize = x);
event.squareSize.call(board, squareSize = x);
return board;

@@ -189,3 +183,3 @@ };

if (!arguments.length) return squareRadius;
event.squareRadius.dispatch.call(board, squareRadius = x);
event.squareRadius.call(board, squareRadius = x);
return board;

@@ -196,3 +190,3 @@ };

if (!arguments.length) return padding;
event.padding.dispatch.call(board, padding = x);
event.padding.call(board, padding = x);
return board;

@@ -204,3 +198,3 @@ };

piece.id = ++pieceId;
piece.on("move", add).on("edit", edit);
piece.on("move.board", add).on("edit.board", edit);
svg.parentNode.appendChild(piece.node());

@@ -212,3 +206,3 @@ pieces.push(piece);

board.remove = function(piece, silent) {
piece.off("move", move).off("edit", edit);
piece.on("move.board", null).on("edit.board", null);
if (silent) {

@@ -215,0 +209,0 @@ d3.select(piece.node())

@@ -41,8 +41,8 @@ cube.piece = function(board) {

board
.on("padding", resize)
.on("squareSize", resize);
.on("padding.piece", resize)
.on("squareSize.piece", resize);
event.position.add(resize);
event.size.add(resize);
event.deserialize.add(deserialize);
event.on("position.piece", resize);
event.on("size.piece", resize);
event.on("deserialize.piece", deserialize);

@@ -80,14 +80,9 @@ function resize() {

piece.on = function(type, listener) {
event[type].add(listener);
event.on(type, listener);
return piece;
};
piece.off = function(type, listener) {
event[type].remove(listener);
return piece;
};
piece.size = function(x) {
if (!arguments.length) return size;
event.size.dispatch.call(piece, size = x);
event.size.call(piece, size = x);
return piece;

@@ -106,3 +101,3 @@ };

if (!arguments.length) return position;
event.position.dispatch.call(piece, position = x);
event.position.call(piece, position = x);
return piece;

@@ -113,3 +108,3 @@ };

var x = {id: piece.id, size: size, position: position};
event.serialize.dispatch.call(piece, x);
event.serialize.call(piece, x);
return x;

@@ -119,3 +114,3 @@ };

piece.fromJSON = function(x) {
event.deserialize.dispatch.call(piece, x);
event.deserialize.call(piece, x);
return piece;

@@ -125,3 +120,3 @@ };

piece.edit = function() {
event.edit.dispatch.call(piece);
event.edit.call(piece);
return piece;

@@ -158,3 +153,3 @@ };

d3.timer(function() {
event.move.dispatch.call(piece);
event.move.call(piece);
return transition = selection;

@@ -161,0 +156,0 @@ });

@@ -19,2 +19,9 @@ var util = require("util"),

function closeWhenDone() {
if (socket) {
if (!socket.bytesWaitingToFlush) close();
else setTimeout(closeWhenDone, 1000);
}
}
function open() {

@@ -63,3 +70,3 @@ timeout = 0;

emitter.close = function() {
close();
closeWhenDone();
return emitter;

@@ -66,0 +73,0 @@ };

@@ -15,6 +15,8 @@ // TODO report failures?

multi = {multi: true},
event_options = {sort: {t: -1}, batchSize: 1000};
event_options = {sort: {t: -1}, batchSize: 1000},
type_options = {safe: true};
exports.putter = function(db) {
var collection = types(db),
eventsByType = {},
flushInterval,

@@ -26,3 +28,4 @@ flushTypes = {},

var time = new Date(request.time),
type = request.type;
type = request.type,
events = eventsByType[type];

@@ -33,15 +36,25 @@ // Validate the date and type.

// Create the event object, to control which fields are addressible.
var event = {t: time, d: request.data};
// If this is a known event type, save immediately.
if (events) return save(events);
// If an id is specified, promote it to Mongo's primary key.
if ("id" in request) event._id = request.id;
// Otherwise, verify that the collection exists before saving.
db.collection(type + "_events", type_options, function(error, events) {
if (error) return util.log("unknown type: " + type);
save(eventsByType[type] = events);
});
// Save the event.
collection(type).events.save(event);
// Create and save the event object.
function save(events) {
var event = {t: time, d: request.data};
// Queue invalidation of metrics for this type.
var times = flushTypes[type] || (flushTypes[type] = [time, time]);
if (time < times[0]) times[0] = time;
if (time > times[1]) times[1] = time;
// If an id is specified, promote it to Mongo's primary key.
if ("id" in request) event._id = request.id;
events.save(event);
// Queue invalidation of metrics for this type.
var times = flushTypes[type] || (flushTypes[type] = [time, time]);
if (time < times[0]) times[0] = time;
if (time > times[1]) times[1] = time;
}
}

@@ -48,0 +61,0 @@

{
"name": "cube",
"version": "0.0.9",
"version": "0.0.13",
"description": "A system for time series visualization using MongoDB, Node and D3.",

@@ -11,9 +11,9 @@ "keywords": ["time series", "visualization"],

"dependencies": {
"d3": "2.4.2",
"mongodb": "0.9.6-15",
"d3": "2.6.0",
"mongodb": "0.9.7-1.3",
"pegjs": "0.6.2",
"vows": "0.5.11",
"websocket": "0.0.16",
"websocket": "1.0.2",
"websocket-server": "1.4.04"
}
}

@@ -23,3 +23,3 @@ # Cube

* [Vows](http://vowsjs.org/)
* [websocket-client](/pgriess/node-websocket-client)
* [websocket](/Worlize/WebSocket-Node)
* [websocket-server](/miksago/node-websocket-server)

@@ -26,0 +26,0 @@

@@ -200,2 +200,7 @@ var vows = require("vows"),

assert.deepEqual(filter, {"d.i": {$regex: "foo"}});
},
"the in filter results in a $in query filter": function(e) {
var filter = {};
parser.parse("test.in(i, [\"foo\", 42])").filter(filter);
assert.deepEqual(filter, {"d.i": {$in: ["foo", 42]}});
}

@@ -202,0 +207,0 @@ }

@@ -286,2 +286,7 @@ var vows = require("vows"),

assert.deepEqual(filter, {"d.i": {$regex: "foo"}});
},
"the in filter results in a $in query filter": function(e) {
var filter = {};
parser.parse("sum(test.in(i, [\"foo\", 42]))").filter(filter);
assert.deepEqual(filter, {"d.i": {$in: ["foo", 42]}});
}

@@ -288,0 +293,0 @@ }

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 too big to display

Sorry, the diff of this file is not supported yet