@8base/utils
Advanced tools
Comparing version 1.4.5 to 1.5.0
@@ -94,2 +94,8 @@ "use strict"; | ||
} | ||
if (typeof formatedFieldData === 'string' && formatedFieldData === initialFieldData) { | ||
return result; | ||
} | ||
if (Array.isArray(formatedFieldData) && R.equals(formatedFieldData, initialFieldData)) { | ||
return result; | ||
} | ||
return Object.assign({}, result, { [fieldName]: formatedFieldData }); | ||
@@ -96,0 +102,0 @@ }, {}, dataKeys); |
@@ -45,3 +45,4 @@ "use strict"; | ||
initialData: item.initialData, | ||
initialListData: initialData, | ||
}, options)), R.filter((item) => Boolean(item)), R.groupBy(R.prop('type')), R.mapObjIndexed(R.map(R.prop('data'))))(data); | ||
//# sourceMappingURL=formatFieldDataList.js.map |
@@ -6,4 +6,5 @@ import { FieldSchema, Schema, FormatDataForMutationOptions } from '../types'; | ||
initialData?: any; | ||
initialListData?: any; | ||
} | ||
export declare const formatFieldDataListItem: (type: "CREATE" | "UPDATE", data: any, { fieldSchema, schema, initialData }: IFormatFieldDataListItemMeta, options?: FormatDataForMutationOptions | undefined) => { | ||
export declare const formatFieldDataListItem: (type: "CREATE" | "UPDATE", data: any, { fieldSchema, schema, initialData, initialListData }: IFormatFieldDataListItemMeta, options?: FormatDataForMutationOptions | undefined) => { | ||
type: string; | ||
@@ -10,0 +11,0 @@ data: unknown; |
@@ -16,3 +16,3 @@ "use strict"; | ||
const errors_1 = require("../errors"); | ||
exports.formatFieldDataListItem = (type, data, { fieldSchema, schema, initialData }, options) => { | ||
exports.formatFieldDataListItem = (type, data, { fieldSchema, schema, initialData, initialListData }, options) => { | ||
let nextData = data; | ||
@@ -35,2 +35,5 @@ if (R.isNil(nextData)) { | ||
if (typeof nextData === 'string') { | ||
if (Array.isArray(initialListData) && initialListData.includes(nextData)) { | ||
return null; | ||
} | ||
return { | ||
@@ -37,0 +40,0 @@ data: { id: nextData }, |
{ | ||
"name": "@8base/utils", | ||
"version": "1.4.5", | ||
"version": "1.5.0", | ||
"repository": "https://github.com/8base/sdk", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/8base/sdk/tree/master/packages/utils#readme", |
@@ -137,2 +137,10 @@ import * as R from 'ramda'; | ||
if (typeof formatedFieldData === 'string' && formatedFieldData === initialFieldData) { | ||
return result; | ||
} | ||
if (Array.isArray(formatedFieldData) && R.equals(formatedFieldData, initialFieldData)) { | ||
return result; | ||
} | ||
return { | ||
@@ -139,0 +147,0 @@ ...result, |
@@ -66,2 +66,3 @@ import * as R from 'ramda'; | ||
initialData: item.initialData, | ||
initialListData: initialData, | ||
}, | ||
@@ -68,0 +69,0 @@ options, |
@@ -14,2 +14,3 @@ import * as R from 'ramda'; | ||
initialData?: any; | ||
initialListData?: any; | ||
} | ||
@@ -20,3 +21,3 @@ | ||
data: any, | ||
{ fieldSchema, schema, initialData }: IFormatFieldDataListItemMeta, | ||
{ fieldSchema, schema, initialData, initialListData }: IFormatFieldDataListItemMeta, | ||
options?: FormatDataForMutationOptions, | ||
@@ -45,2 +46,6 @@ ) => { | ||
if (typeof nextData === 'string') { | ||
if (Array.isArray(initialListData) && initialListData.includes(nextData)) { | ||
return null; | ||
} | ||
return { | ||
@@ -47,0 +52,0 @@ data: { id: nextData }, |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
300299
4948