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

@8base/utils

Package Overview
Dependencies
Maintainers
2
Versions
235
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@8base/utils - npm Package Compare versions

Comparing version 0.4.18 to 0.4.19

23

lib/utils.js

@@ -404,2 +404,4 @@ (function webpackUniversalModuleDefinition(root, factory) {

var formatDataForMutation_formatDataForMutation = function formatDataForMutation(type, tableName, data, schema) {
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
if (external_ramda_["not"](type in MUTATION_TYPE)) {

@@ -423,5 +425,13 @@ throw new Error('Invalid mutation type: ' + type);

if (!fieldSchema) {
throw new Error('Field schema with ' + fieldName + ' name not found in table schema with ' + tableSchema.name + ' name.');
// throw new Error(`Field schema with ${fieldName} name not found in table schema with ${tableSchema.name} name.`);
return result;
}
var skip = options.skip;
if (typeof skip === 'function' && skip(data[fieldName], fieldSchema)) {
return result;
}
if (isMetaField(fieldSchema)) {

@@ -431,3 +441,12 @@ return result;

return Object.assign({}, result, _defineProperty({}, fieldName, formatFieldDataForMutation_formatFieldDataForMutation(type, fieldSchema, data[fieldName], schema)));
var formatedFieldData = formatFieldDataForMutation_formatFieldDataForMutation(type, fieldSchema, data[fieldName], schema);
var mutate = options.mutate;
if (typeof mutate === 'function') {
formatedFieldData = mutate(formatedFieldData, data[fieldName], fieldSchema);
}
return Object.assign({}, result, _defineProperty({}, fieldName, formatedFieldData));
}, {}, external_ramda_["keys"](data));

@@ -434,0 +453,0 @@

6

package.json
{
"name": "@8base/utils",
"version": "0.4.18",
"version": "0.4.19",
"main": "lib/utils.js",

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

"test": "NPM_ENV=test jest",
"watch": "NODE_ENV=development babel src -d es --watch --ignore __tests__"
"watch": "webpack --progress --colors --watch --env dev"
},

@@ -23,3 +23,3 @@ "jest": {

"devDependencies": {
"@8base/webpack-configuration": "^0.4.18",
"@8base/webpack-configuration": "^0.4.19",
"babel-cli": "^6.26.0",

@@ -26,0 +26,0 @@ "babel-core": "^6.26.3",

@@ -17,3 +17,3 @@ //@flow

*/
const formatDataForMutation = (type: MutationType, tableName: string, data: Object, schema: Schema) => {
const formatDataForMutation = (type: MutationType, tableName: string, data: Object, schema: Schema, options: Object = {}) => {
if (R.not(type in MUTATION_TYPE)) {

@@ -37,5 +37,12 @@ throw new Error(`Invalid mutation type: ${type}`);

if (!fieldSchema) {
throw new Error(`Field schema with ${fieldName} name not found in table schema with ${tableSchema.name} name.`);
// throw new Error(`Field schema with ${fieldName} name not found in table schema with ${tableSchema.name} name.`);
return result;
}
const { skip } = options;
if (typeof skip === 'function' && skip(data[fieldName], fieldSchema)) {
return result;
}
if (isMetaField(fieldSchema)) {

@@ -45,5 +52,13 @@ return result;

let formatedFieldData = formatFieldDataForMutation(type, fieldSchema, data[fieldName], schema);
const { mutate } = options;
if (typeof mutate === 'function') {
formatedFieldData = mutate(formatedFieldData, data[fieldName], fieldSchema);
}
return {
...result,
[fieldName]: formatFieldDataForMutation(type, fieldSchema, data[fieldName], schema),
[fieldName]: formatedFieldData,
};

@@ -50,0 +65,0 @@ }, {}, R.keys(data));

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