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

@8base/utils

Package Overview
Dependencies
Maintainers
5
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 1.2.0 to 1.2.1

10

dist/formatters/formatDataForMutation.js

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

};
const isFieldRemoved = ({ initialValue, value }) => {
return !R.isNil(initialValue) && R.isNil(value);
};
/**

@@ -44,2 +47,3 @@ * Formats entity data for create or update mutation based on passed schema.

options = R.mergeDeepRight(DEFAULT_OPTIONS, options);
const dataKeys = R.pipe(R.mergeRight(data), R.keys)(initialData);
const formatedData = R.reduce((result, fieldName) => {

@@ -65,4 +69,6 @@ if (fieldName === '_description' ||

}
let formatedFieldData = data[fieldName];
const initialFieldData = R.path([fieldName], initialData);
let formatedFieldData = isFieldRemoved({ initialValue: initialFieldData, value: data[fieldName] })
? null
: data[fieldName];
if ((verifiers_1.isFileField(fieldSchema) || verifiers_1.isRelationField(fieldSchema)) && verifiers_1.isListField(fieldSchema)) {

@@ -88,3 +94,3 @@ if (R.isNil(formatedFieldData)) {

return Object.assign({}, result, { [fieldName]: formatedFieldData });
}, {}, R.keys(data));
}, {}, dataKeys);
return omitDeep_1.omitDeep(['_description', '__typename'], formatedData);

@@ -91,0 +97,0 @@ };

2

package.json
{
"name": "@8base/utils",
"version": "1.2.0",
"version": "1.2.1",
"repository": "https://github.com/8base/sdk",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/8base/sdk/tree/master/packages/utils#readme",

@@ -26,2 +26,6 @@ import * as R from 'ramda';

const isFieldRemoved = ({ initialValue, value }: { initialValue: any; value: any }) => {
return !R.isNil(initialValue) && R.isNil(value);
};
/**

@@ -61,2 +65,7 @@ * Formats entity data for create or update mutation based on passed schema.

const dataKeys = R.pipe(
R.mergeRight(data),
R.keys,
)(initialData);
const formatedData = R.reduce(

@@ -91,5 +100,8 @@ (result: { [key: string]: any }, fieldName: string) => {

let formatedFieldData = data[fieldName];
const initialFieldData = R.path([fieldName], initialData);
let formatedFieldData = isFieldRemoved({ initialValue: initialFieldData, value: data[fieldName] })
? null
: data[fieldName];
if ((isFileField(fieldSchema) || isRelationField(fieldSchema)) && isListField(fieldSchema)) {

@@ -127,3 +139,3 @@ if (R.isNil(formatedFieldData)) {

{},
R.keys(data) as string[],
dataKeys,
);

@@ -130,0 +142,0 @@

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