@8base/utils
Advanced tools
Comparing version 0.32.3 to 0.33.0
@@ -19,4 +19,4 @@ import { Schema } from '../types'; | ||
*/ | ||
declare const formatDataForMutation: (type: "CREATE" | "UPDATE", data: any, { tableName, schema }: IFormatDataForMutationMeta, options?: IOptions) => any; | ||
declare const formatDataForMutation: (type: "CREATE" | "UPDATE", data: any, { tableName, appName, schema }: IFormatDataForMutationMeta, options?: IOptions) => any; | ||
export { formatDataForMutation }; | ||
//# sourceMappingURL=formatDataForMutation.d.ts.map |
@@ -24,3 +24,3 @@ "use strict"; | ||
*/ | ||
const formatDataForMutation = (type, data, { tableName, schema }, options = {}) => { | ||
const formatDataForMutation = (type, data, { tableName, appName, schema }, options = {}) => { | ||
if (R.not(type in constants_1.MUTATION_TYPE)) { | ||
@@ -32,3 +32,3 @@ throw new errors_1.SDKError(errors_1.ERROR_CODES.INVALID_ARGUMENT, errors_1.PACKAGES.UTILS, `Invalid mutation type: ${type}`); | ||
} | ||
const tableSchema = selectors_1.tablesListSelectors.getTableByName(schema, tableName); | ||
const tableSchema = selectors_1.tablesListSelectors.getTableByName(schema, tableName, appName); | ||
if (!tableSchema) { | ||
@@ -35,0 +35,0 @@ throw new errors_1.SDKError(errors_1.ERROR_CODES.TABLE_NOT_FOUND, errors_1.PACKAGES.UTILS, `Table schema with ${tableName} name not found in schema.`); |
export { formatDataForMutation } from './formatDataForMutation'; | ||
export { formatDataAfterQuery } from './formatDataAfterQuery'; | ||
export { formatOptimisticResponse } from './formatOptimisticResponse'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,2 +7,4 @@ "use strict"; | ||
exports.formatDataAfterQuery = formatDataAfterQuery_1.formatDataAfterQuery; | ||
var formatOptimisticResponse_1 = require("./formatOptimisticResponse"); | ||
exports.formatOptimisticResponse = formatOptimisticResponse_1.formatOptimisticResponse; | ||
//# sourceMappingURL=index.js.map |
import { ParametricSelector } from 'reselect'; | ||
import { FieldSchema } from '../types'; | ||
export declare const getTableField: (tableField: FieldSchema) => FieldSchema; | ||
export declare const getTableField: (tableField: void | FieldSchema) => void | FieldSchema; | ||
export declare const getFieldType: any; | ||
export declare const getFieldTypesAttributes: import("reselect").OutputSelector<FieldSchema, { | ||
[key: string]: any; | ||
}, (res: FieldSchema) => { | ||
[key: string]: any; | ||
}>; | ||
export declare const getFieldTypesAttributes: import("reselect").OutputSelector<void | FieldSchema, unknown, (res: void | FieldSchema) => unknown>; | ||
export declare const isRelationField: import("reselect").OutputSelector<unknown, boolean, (res: "RELATION") => boolean>; | ||
@@ -14,11 +10,11 @@ export declare const isFileField: import("reselect").OutputSelector<unknown, boolean, (res: "FILE") => boolean>; | ||
export declare const isIdField: import("reselect").OutputSelector<unknown, boolean, (res: "ID") => boolean>; | ||
export declare const isMetaField: import("reselect").OutputSelector<FieldSchema, boolean, (res: FieldSchema) => boolean>; | ||
export declare const isListField: import("reselect").OutputSelector<FieldSchema, boolean, (res: FieldSchema) => boolean>; | ||
export declare const isSystemField: import("reselect").OutputSelector<FieldSchema, boolean, (res: FieldSchema) => boolean>; | ||
export declare const getFieldId: import("reselect").OutputSelector<FieldSchema, string, (res: FieldSchema) => string>; | ||
export declare const getFieldName: import("reselect").OutputSelector<FieldSchema, string, (res: FieldSchema) => string>; | ||
export declare const getFieldDisplayName: import("reselect").OutputSelector<FieldSchema, string, (res: FieldSchema) => string>; | ||
export declare const getTableId: import("reselect").OutputSelector<FieldSchema, any, (res: FieldSchema) => any>; | ||
export declare const getTableName: import("reselect").OutputSelector<FieldSchema, any, (res: FieldSchema) => any>; | ||
export declare const getTableDisplayName: import("reselect").OutputSelector<FieldSchema, any, (res: FieldSchema) => any>; | ||
export declare const isMetaField: import("reselect").OutputSelector<void | FieldSchema, boolean, (res: void | FieldSchema) => boolean>; | ||
export declare const isListField: import("reselect").OutputSelector<void | FieldSchema, boolean, (res: void | FieldSchema) => boolean>; | ||
export declare const isSystemField: import("reselect").OutputSelector<void | FieldSchema, boolean, (res: void | FieldSchema) => boolean>; | ||
export declare const getFieldId: import("reselect").OutputSelector<void | FieldSchema, unknown, (res: void | FieldSchema) => unknown>; | ||
export declare const getFieldName: import("reselect").OutputSelector<void | FieldSchema, string, (res: void | FieldSchema) => string>; | ||
export declare const getFieldDisplayName: import("reselect").OutputSelector<void | FieldSchema, unknown, (res: void | FieldSchema) => unknown>; | ||
export declare const getTableId: import("reselect").OutputSelector<void | FieldSchema, any, (res: void | FieldSchema) => any>; | ||
export declare const getTableName: import("reselect").OutputSelector<void | FieldSchema, any, (res: void | FieldSchema) => any>; | ||
export declare const getTableDisplayName: import("reselect").OutputSelector<void | FieldSchema, any, (res: void | FieldSchema) => any>; | ||
export declare const getRelationTableId: ParametricSelector<FieldSchema, void, string>; | ||
@@ -25,0 +21,0 @@ export declare const getRelationTableName: ParametricSelector<FieldSchema, void, string>; |
@@ -14,4 +14,4 @@ "use strict"; | ||
exports.getTableField = (tableField) => tableField; | ||
exports.getFieldType = reselect_1.createSelector(exports.getTableField, R.prop('fieldType')); | ||
exports.getFieldTypesAttributes = reselect_1.createSelector(exports.getTableField, R.prop('fieldTypeAttributes')); | ||
exports.getFieldType = reselect_1.createSelector(exports.getTableField, R.propOr('', 'fieldType')); | ||
exports.getFieldTypesAttributes = reselect_1.createSelector(exports.getTableField, R.propOr(null, 'fieldTypeAttributes')); | ||
exports.isRelationField = reselect_1.createSelector(exports.getFieldType, R.equals(constants_1.FIELD_TYPE.RELATION)); | ||
@@ -24,5 +24,5 @@ exports.isFileField = reselect_1.createSelector(exports.getFieldType, R.equals(constants_1.FIELD_TYPE.FILE)); | ||
exports.isSystemField = reselect_1.createSelector(exports.getTableField, R.propEq('isSystem', true)); | ||
exports.getFieldId = reselect_1.createSelector(exports.getTableField, R.prop('id')); | ||
exports.getFieldName = reselect_1.createSelector(exports.getTableField, R.prop('name')); | ||
exports.getFieldDisplayName = reselect_1.createSelector(exports.getTableField, R.prop('displayName')); | ||
exports.getFieldId = reselect_1.createSelector(exports.getTableField, R.propOr('', 'id')); | ||
exports.getFieldName = reselect_1.createSelector(exports.getTableField, fieldSchema => (fieldSchema ? fieldSchema.name : '')); | ||
exports.getFieldDisplayName = reselect_1.createSelector(exports.getTableField, R.propOr('', 'displayName')); | ||
exports.getTableId = reselect_1.createSelector(exports.getTableField, R.path(['table', 'id'])); | ||
@@ -29,0 +29,0 @@ exports.getTableName = reselect_1.createSelector(exports.getTableField, R.path(['table', 'name'])); |
{ | ||
"name": "@8base/utils", | ||
"version": "0.32.3", | ||
"version": "0.33.0", | ||
"repository": "https://github.com/8base/sdk", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/8base/sdk/tree/master/packages/utils#readme", |
@@ -33,3 +33,3 @@ import * as R from 'ramda'; | ||
data: any, | ||
{ tableName, schema }: IFormatDataForMutationMeta, | ||
{ tableName, appName, schema }: IFormatDataForMutationMeta, | ||
options: IOptions = {}, | ||
@@ -45,3 +45,3 @@ ) => { | ||
const tableSchema = tablesListSelectors.getTableByName(schema, tableName); | ||
const tableSchema = tablesListSelectors.getTableByName(schema, tableName, appName); | ||
@@ -48,0 +48,0 @@ if (!tableSchema) { |
export { formatDataForMutation } from './formatDataForMutation'; | ||
export { formatDataAfterQuery } from './formatDataAfterQuery'; | ||
export { formatOptimisticResponse } from './formatOptimisticResponse'; |
@@ -6,7 +6,7 @@ import * as R from 'ramda'; | ||
export const getTableField = (tableField: FieldSchema) => tableField; | ||
export const getTableField = (tableField: FieldSchema | void) => tableField; | ||
export const getFieldType: any = createSelector( | ||
getTableField, | ||
R.prop('fieldType'), | ||
R.propOr('', 'fieldType'), | ||
); | ||
@@ -16,3 +16,3 @@ | ||
getTableField, | ||
R.prop('fieldTypeAttributes'), | ||
R.propOr(null, 'fieldTypeAttributes'), | ||
); | ||
@@ -57,3 +57,3 @@ | ||
getTableField, | ||
R.prop('id'), | ||
R.propOr('', 'id'), | ||
); | ||
@@ -63,3 +63,3 @@ | ||
getTableField, | ||
R.prop('name'), | ||
fieldSchema => (fieldSchema ? fieldSchema.name : ''), | ||
); | ||
@@ -69,3 +69,3 @@ | ||
getTableField, | ||
R.prop('displayName'), | ||
R.propOr('', 'displayName'), | ||
); | ||
@@ -72,0 +72,0 @@ |
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
248311
219
3950