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.2.5 to 0.2.6

es/verifiers/isMetaField.js

17

es/formatters/formatDataForMutation.js

@@ -0,1 +1,3 @@

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import * as R from 'ramda';

@@ -5,2 +7,3 @@

import { getFieldSchemaByName, getTableSchemaByName } from '../selectors';
import { isMetaField } from '../verifiers';
import { formatFieldDataForMutation } from './formatFieldDataForMutation';

@@ -27,3 +30,7 @@

var formatedData = R.mapObjIndexed(function (data, fieldName) {
var formatedData = R.reduce(function (result, fieldName) {
if (fieldName === '_description' || fieldName === '__typename') {
return result;
}
var fieldSchema = getFieldSchemaByName(fieldName, tableSchema);

@@ -35,5 +42,9 @@

return formatFieldDataForMutation(type, fieldSchema, data, schema);
}, data);
if (isMetaField(fieldSchema)) {
return result;
}
return Object.assign({}, result, _defineProperty({}, fieldName, formatFieldDataForMutation(type, fieldSchema, data[fieldName], schema)));
}, {}, R.keys(data));
return formatedData;

@@ -40,0 +51,0 @@ };

@@ -5,4 +5,5 @@ export { isFileField } from './isFileField';

export { isListField } from './isListField';
export { isMetaField } from './isMetaField';
export { isRelationField } from './isRelationField';
export { isRelationInstance } from './isRelationInstance';
export { isRelationReference } from './isRelationReference';

2

package.json
{
"name": "@8base/utils",
"version": "0.2.5",
"version": "0.2.6",
"main": "es/index.js",

@@ -5,0 +5,0 @@ "module": "es/index.js",

@@ -6,2 +6,3 @@ //@flow

import { getFieldSchemaByName, getTableSchemaByName } from '../selectors';
import { isMetaField } from '../verifiers';
import { formatFieldDataForMutation } from './formatFieldDataForMutation';

@@ -28,15 +29,23 @@ import type { MutationType, FieldSchema, TableSchema, Schema } from '../types';

const formatedData = R.mapObjIndexed(
(data: Object, fieldName: string) => {
const fieldSchema: ?FieldSchema = getFieldSchemaByName(fieldName, tableSchema);
const formatedData = R.reduce((result: Object, fieldName: string) => {
if (fieldName === '_description' || fieldName === '__typename') {
return result;
}
if (!fieldSchema) {
throw new Error(`Field schema with ${fieldName} name not found in table schema with ${tableSchema.name} name.`);
}
const fieldSchema: ?FieldSchema = getFieldSchemaByName(fieldName, tableSchema);
return formatFieldDataForMutation(type, fieldSchema, data, schema);
},
data,
);
if (!fieldSchema) {
throw new Error(`Field schema with ${fieldName} name not found in table schema with ${tableSchema.name} name.`);
}
if (isMetaField(fieldSchema)) {
return result;
}
return {
...result,
[fieldName]: formatFieldDataForMutation(type, fieldSchema, data[fieldName], schema),
};
}, {}, R.keys(data));
return formatedData;

@@ -43,0 +52,0 @@ };

@@ -5,4 +5,5 @@ export { isFileField } from './isFileField';

export { isListField } from './isListField';
export { isMetaField } from './isMetaField';
export { isRelationField } from './isRelationField';
export { isRelationInstance } from './isRelationInstance';
export { isRelationReference } from './isRelationReference';
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