New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@saulx/selva

Package Overview
Dependencies
Maintainers
1
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@saulx/selva - npm Package Compare versions

Comparing version 0.2.3 to 0.2.5

4

dist/lua/src/get/index.js

@@ -32,7 +32,7 @@ "use strict";

}
if (props.$list && ignore !== '$list' && ignore !== '$') {
if ((props.$list || props.$find) && ignore !== '$list' && ignore !== '$') {
// field that needs to get the result
if (field) {
let sourceField = field;
if (!props.$list.$find && props.$field) {
if (!(props.$list && props.$list.$find) && props.$field) {
sourceField = field_1.resolveAll(id, schema, util_1.ensureArray(props.$field), language, version);

@@ -39,0 +39,0 @@ }

@@ -6,8 +6,15 @@ "use strict";

function createSearchArgs(getOptions, query, fork) {
const $list = getOptions.$list;
let $list = getOptions.$list;
let isNoList = false;
if (!$list) {
return [];
if (getOptions.$find) {
isNoList = true;
$list = { $find: getOptions.$find };
}
else {
return [];
}
}
let offset = 0;
let limit = 99999;
let limit = isNoList ? 1 : 99999;
if ($list.$limit) {

@@ -14,0 +21,0 @@ limit = $list.$limit;

"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -13,3 +6,2 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

Object.defineProperty(exports, "__esModule", { value: true });
const logger = __importStar(require("../../logger"));
const createSearchString_1 = __importDefault(require("./createSearchString"));

@@ -24,3 +16,2 @@ const index_1 = __importDefault(require("./parseFind/index"));

const parseNested = (opts, ids, meta, traverse) => {
logger.info("!!!!!!!!!!!!!!!!!!!!!");
if (opts.$list) {

@@ -45,3 +36,9 @@ if (opts.$list.$find) {

else if (opts.$find) {
return [{ isFork: true }, 'Find outside of a list not supported'];
// return [{ isFork: true }, 'Find outside of a list not supported']
// TODO: disallow $range
if (!opts.$find.$traverse) {
opts.$find.$traverse = traverse;
}
const result = index_1.default(opts.$find, ids, meta);
return result;
}

@@ -121,3 +118,2 @@ return [{ isFork: true }, 'Not a valid query'];

const find = util_1.getFind(getOptions);
logger.info(getOptions.$meta);
// need to do something here for nested queries

@@ -147,15 +143,17 @@ if (find && find.$find) {

}
const [{ results: nestedResults }, err] = parseQuery(getField, schema, opts, resultIds, undefined, language, version, includeMeta, getResult);
if (err) {
return [{ results }, err];
}
const nestedMap = {};
for (let i = 0; i < nestedResults.length; i++) {
const item = nestedResults[i];
if (!nestedMap[item.id]) {
nestedMap[item.id] = true;
if (!getOptions.id) {
delete item.id;
if (resultIds.length !== 0) {
const [{ results: nestedResults }, err] = parseQuery(getField, schema, opts, resultIds, undefined, language, version, includeMeta, getResult);
if (err) {
return [{ results }, err];
}
const nestedMap = {};
for (let i = 0; i < nestedResults.length; i++) {
const item = nestedResults[i];
if (!nestedMap[item.id]) {
nestedMap[item.id] = true;
if (!getOptions.id) {
delete item.id;
}
results[results.length] = item;
}
results[results.length] = item;
}

@@ -186,2 +184,5 @@ }

}
else if (getOptions.$find && getOptions.$find.$traverse) {
meta.traverse = getOptions.$find.$traverse;
}
return [{ results, meta }, null];

@@ -204,3 +205,9 @@ };

}
result[resultField] = results;
// hey smurky boys
if (getOptions.$find) {
result[resultField] = results.length ? results[0] : {};
}
else {
result[resultField] = results;
}
if (err) {

@@ -207,0 +214,0 @@ return err;

@@ -9,2 +9,5 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -15,2 +18,3 @@ const id_1 = require("../id");

const delete_1 = require("./delete");
const events_1 = __importDefault(require("./events"));
function getSetKey(id, field) {

@@ -91,2 +95,3 @@ return id + '.' + field;

redis.sadd(parent + '.children', id);
events_1.default(parent, 'children', 'update');
// recurse if necessary

@@ -104,2 +109,3 @@ if (redis.exists(parent)) {

redis.sadd(childrenKey, id);
events_1.default(parent, 'children', 'update');
if (!redis.exists(parent)) {

@@ -146,2 +152,3 @@ modify({ $id: parent });

redis.sadd(child + '.parents', id);
events_1.default(child, 'parents', 'update');
ancestors_1.markForAncestorRecalculation(child);

@@ -148,0 +155,0 @@ }

@@ -25,2 +25,3 @@ import { default as RedisClient, ConnectOptions } from './redis';

constructor(opts: ConnectOptions | (() => Promise<ConnectOptions>), selvaOpts?: SelvaOptions);
conformToSchema(props: SetOptions): Promise<SetOptions>;
digest(payload: string): string;

@@ -27,0 +28,0 @@ destroy(): Promise<void>;

@@ -57,2 +57,93 @@ "use strict";

}
async conformToSchema(props) {
if (!props.$id && !props.type && !props.$alias) {
return null;
}
if (!props.type) {
if (props.$id) {
props.type = await getTypeFromId_1.default(this, props.$id);
}
else {
const typePayload = await this.get({
$alias: props.$alias,
type: true,
id: true
});
props.type = typePayload.type;
props.$id = typePayload.id;
}
}
if (!props.type) {
return null;
}
const typeSchema = props.type === 'root'
? this.schema.rootType
: this.schema.types[props.type];
const newProps = {
type: props.type
};
if (props.$id) {
newProps.$id = props.$id;
}
if (props.$alias) {
newProps.$alias = props.$alias;
}
const mergeObject = (oldObj, schema) => {
const newObj = {};
for (const key in oldObj) {
if (schema.properties[key]) {
if (schema.properties[key].type === 'object') {
newObj[key] = mergeObject(oldObj[key], schema.properties[key]);
}
else if (schema.properties[key].type === 'array' &&
// @ts-ignore
schema.properties[key].items.type === 'object') {
newObj[key] = oldObj[key].map(x => {
// @ts-ignore
return mergeObject(x, schema.properties[key].items);
});
}
else if (schema.properties[key].type === 'set' &&
// @ts-ignore
schema.properties[key].items.type === 'object') {
newObj[key] = oldObj[key].map(x => {
// @ts-ignore
return mergeObject(x, schema.properties[key].items);
});
}
else {
newObj[key] = oldObj[key];
}
}
}
return newObj;
};
for (const key in props) {
if (typeSchema.fields[key]) {
if (typeSchema.fields[key].type === 'object') {
newProps[key] = mergeObject(props[key], typeSchema.fields[key]);
}
else if (typeSchema.fields[key].type === 'array' &&
// @ts-ignore
typeSchema.fields[key].items.type === 'object') {
newProps[key] = props[key].map(x => {
// @ts-ignore
return mergeObject(x, typeSchema.fields[key].items);
});
}
else if (typeSchema.fields[key].type === 'set' &&
// @ts-ignore
typeSchema.fields[key].items.type === 'object') {
newProps[key] = props[key].map(x => {
// @ts-ignore
return mergeObject(x, typeSchema.fields[key].items);
});
}
else {
newProps[key] = props[key];
}
}
}
return newProps;
}
digest(payload) {

@@ -59,0 +150,0 @@ return digest_1.default(payload);

@@ -99,3 +99,4 @@ "use strict";

return () => {
this.sub.unsubscribe('channel');
console.log('REMOVE', channel);
this.sub.unsubscribe(channel);
delete this.subscriptions[channel];

@@ -164,2 +165,4 @@ delete this.lastHeartbeat[channel];

}
// public async unsubscribe (channel: string) {
// }
async setSubcriptionData(channel) {

@@ -166,0 +169,0 @@ try {

{
"name": "@saulx/selva",
"version": "0.2.3",
"version": "0.2.5",
"main": "dist/src/index.js",

@@ -75,3 +75,3 @@ "scripts": {

"typescript-to-lua": "^0.30.1",
"@saulx/selva-server": "0.2.1"
"@saulx/selva-server": "0.2.2"
},

@@ -78,0 +78,0 @@ "dependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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