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

cool-data-manager

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cool-data-manager - npm Package Compare versions

Comparing version 1.0.14 to 1.0.16

license

2

package.json
{
"name": "cool-data-manager",
"version": "1.0.14",
"version": "1.0.16",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -24,4 +24,2 @@ clog = require('fbkt-clog');

) {
console.log('options', options);
console.log('this.options', this.options);
clog('EXECUTING GRAPH COOL MUTATION', mutation);

@@ -28,0 +26,0 @@ }

@@ -40,10 +40,9 @@ const Promise = require('bluebird');

return `
create${this.entityInfo.entityName}(
${fields.input}
) {
id,
createdAt,
updatedAt,
${fields.output}
},
create${this.entityInfo.entityName}(${fields.input}
) {
id,
createdAt,
updatedAt,
${fields.output}
},
`

@@ -50,0 +49,0 @@ })

@@ -7,2 +7,70 @@ const Promise = require('bluebird');

/**
*
* @param relation
* @param relationEntity
* @param fieldName
* @param parentQuery
*/
function buildCoolRelationInputList(relation, relationEntity, fieldName, parentQuery){
const subEntityInfo = relation.coolDataManager.entityInfo;
return buildInputList(subEntityInfo.fields, relationEntity)
.then(subQuery => {
return parentQuery.concat(`
${fieldName}: { ${subQuery}
},
`);
})
}
/**
*
* @param collection
* @param relationCollection
* @param fieldName
* @param parentQuery
* @returns {Bluebird<U2|U1>|Bluebird<U>|Thenable<U>|Bluebird<U[]>}
*/
function buildCoolCollectionInputList(collection, relationCollection, fieldName, parentQuery){
const subEntityInfo = collection.coolDataManager.entityInfo;
return Promise.mapSeries(
relationCollection,
subEntity => {
return buildInputList(subEntityInfo.fields, subEntity)
.then(subEntity => {
return `{
${subEntity}
}`
})
}
)
.then(subQuery => {
return parentQuery.concat(`${fieldName}: [
${subQuery}
],
`);
});
}
/**
*
* @param type
* @param entity
* @param fieldName
* @param parentQuery
* @returns {Promise.<T>}
*/
function buildEntityInputList(type, entity, fieldName, parentQuery){
const value = valueWrappers[type](entity[fieldName]);
return Promise.resolve(parentQuery.concat(`
${fieldName}: ${value},`))
}
/**
*
* @param fields
* @param entity
* @returns {*}
*/
function buildInputList(fields, entity) {

@@ -19,3 +87,2 @@ return validateRequiredFields(fields, entity)

if (entity[fieldName] !== undefined) {
const field = fields[fieldName];

@@ -25,33 +92,7 @@ const type = field.type;

if (type instanceof CoolRelation){
const subEntityInfo = type.coolDataManager.entityInfo;
return buildInputList(subEntityInfo.fields, entity[fieldName])
.then(subQuery => {
return acc.concat(`${fieldName}: {
${subQuery}
},
`);
})
return buildCoolRelationInputList(type, entity[fieldName], fieldName, acc);
} else if (type instanceof CoolCollection) {
const subEntityInfo = type.coolDataManager.entityInfo;
return Promise.mapSeries(
entity[fieldName],
subEntity => {
return buildInputList(subEntityInfo.fields, subEntity)
.then(subEntity => {
return `{
${subEntity}
},`
})
}
)
.then(subQuery => {
return acc.concat(`${fieldName}: [
${subQuery}
],
`);
});
return buildCoolCollectionInputList(type, entity[fieldName], fieldName, acc);
} else {
const value = valueWrappers[type](entity[fieldName]);
return Promise.resolve(acc.concat(`${fieldName}: ${value},
`))
return buildEntityInputList(type, entity, fieldName, acc);
}

@@ -58,0 +99,0 @@ } else {

@@ -6,2 +6,26 @@ const Promise = require('bluebird');

/**
*
* @param fieldName
* @param type
* @param options
* @param parentQuery
*/
function buildRelationOrCollectionOutputList(fieldName, type, options, parentQuery){
const subEntityInfo = type.coolDataManager.entityInfo;
return buildOutputList(subEntityInfo.fields, options)
.then(subQuery => {
return parentQuery.concat(`${fieldName} {
${subQuery}
},
`);
})
}
/**
*
* @param fields
* @param options
* @returns {Bluebird<string>|Bluebird<function(*=, *=)>}
*/
function buildOutputList(fields, options)

@@ -21,12 +45,3 @@ {

if (field.type instanceof CoolRelation || field.type instanceof CoolCollection) {
const subEntityInfo = field.type.coolDataManager.entityInfo;
return buildOutputList(subEntityInfo.fields, options)
.then(subQuery => {
return acc.concat(`${fieldName} {
${subQuery}
},
`);
})
// } else if (field.type instanceof CoolCollection) {
//
return buildRelationOrCollectionOutputList(fieldName, field.type, options, acc);
} else {

@@ -33,0 +48,0 @@ return Promise.resolve(acc.concat(` ${fieldName},

@@ -53,2 +53,7 @@ 'use strict';

expect(thing.otherThing.stringData).to.equal(testEntity.otherThing.stringData);
expect(thing.yetAnotherThings).to.be.an('array');
expect(thing.yetAnotherThings.length).to.equal(testEntity.yetAnotherThings.length);
expect(thing.yetAnotherThings[0]).to.be.an('object');
expect(thing.yetAnotherThings[0].stringData).to.equal(testEntity.yetAnotherThings[0].stringData);
expect(thing.yetAnotherThings[1].stringData).to.equal(testEntity.yetAnotherThings[1].stringData);
// expect(thing.jsonData.id).to.equal(testEntity.jsonData.id);

@@ -55,0 +60,0 @@ // expect(thing.jsonData.child.id).to.equal(testEntity.jsonData.child.id);

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