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

@atombender/hydrant-api

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atombender/hydrant-api - npm Package Compare versions

Comparing version 0.0.26 to 0.0.27

54

dist/json.js

@@ -15,3 +15,4 @@ 'use strict';

exports.deserializeTopKQuery = deserializeTopKQuery;
exports.serializeResults = serializeResults;
exports.serializeResultSet = serializeResultSet;
exports.deserializeResultSet = deserializeResultSet;
exports.serializeTable = serializeTable;

@@ -41,2 +42,4 @@ exports.deserializeTable = deserializeTable;

var _results = require('./results');
var _schemas = require('./schemas');

@@ -324,6 +327,51 @@

function serializeResults(results) {
return results;
function serializeResultSet(resultSet) {
return {
group: serializeGroup(resultSet.group)
};
function serializeGroup(group) {
if (!group) {
return null;
}
return {
id: group.dimension.id,
buckets: group.buckets.map(serializeBucket)
};
}
function serializeBucket(bucket) {
return {
key: bucket.key,
count: bucket.count,
buckets: (bucket.buckets || []).map(serializeBucket)
};
}
}
function deserializeResultSet(raw, schema) {
if (raw.group) {
return new _results.ResultSet(parseGroup(raw.group));
}
return null;
function parseGroup(rawGroup) {
var dimension = (0, _underscore.find)(schema.dimensions, function (d) {
return d.id == rawGroup.id;
});
if (!dimension) {
throw new Error('Could not find dimension: ' + rawGroup.id);
}
var buckets = _immutable2['default'].Set((rawGroup.buckets || []).map(parseBucket));
return new _results.ResultGroup(dimension, buckets);
}
function parseBucket(rawBucket) {
var bucket = new _results.ResultBucket(rawBucket.key);
bucket.count = rawBucket.count;
bucket.buckets = _immutable2['default'].Set((rawBucket.buckets || []).map(parseBucket));
return bucket;
}
}
function serializeTable(table) {

@@ -330,0 +378,0 @@ return {

@@ -86,9 +86,31 @@ 'use strict';

var ResultGroup = (function () {
function ResultGroup(dimension) {
var buckets = arguments[1] === undefined ? null : arguments[1];
_classCallCheck(this, ResultGroup);
this.dimension = dimension;
this.buckets = buckets ? _immutable2['default'].Set(buckets) : _immutable2['default'].Set();
}
_createClass(ResultGroup, [{
key: 'toString',
value: function toString() {
return 'ResultGroup dimension={this.dimension.toString()}';
}
}]);
return ResultGroup;
})();
exports.ResultGroup = ResultGroup;
var ResultSet = (function () {
function ResultSet() {
var buckets = arguments[0] === undefined ? null : arguments[0];
var group = arguments[0] === undefined ? null : arguments[0];
_classCallCheck(this, ResultSet);
this.buckets = buckets ? _immutable2['default'].Set(buckets) : _immutable2['default'].Set();
this.group = group;
}

@@ -95,0 +117,0 @@

2

package.json
{
"name": "@atombender/hydrant-api",
"version": "0.0.26",
"version": "0.0.27",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

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