@8base/utils
Advanced tools
Comparing version 0.1.5 to 0.2.5
@@ -1,2 +0,2 @@ | ||
var FIELD_TYPE = { | ||
export var FIELD_TYPE = { | ||
DATE: 'DATE', | ||
@@ -8,6 +8,16 @@ FILE: 'FILE', | ||
SWITCH: 'SWITCH', | ||
TEXT: 'TEXT' | ||
TEXT: 'TEXT', | ||
CUSTOM: 'CUSTOM' | ||
}; | ||
var FORMAT = { | ||
export var SWITCH_FORMATS = { | ||
ON_OFF: 'ON_OFF', | ||
YES_NO: 'YES_NO', | ||
TRUE_FALSE: 'TRUE_FALSE', | ||
ACTIVE_INACTIVE: 'ACTIVE_INACTIVE', | ||
HIGH_LOW: 'HIGH_LOW', | ||
CUSTOM: 'CUSTOM' | ||
}; | ||
export var TEXT_FORMATS = { | ||
UNFORMATTED: 'UNFORMATTED', | ||
@@ -19,12 +29,26 @@ NAME: 'NAME', | ||
PHONE: 'PHONE', | ||
EMAIL: 'EMAIL', | ||
EMAIL: 'EMAIL' | ||
}; | ||
export var NUMBER_FORMATS = { | ||
NUMBER: 'NUMBER', | ||
CURRENCY: 'CURRENCY', | ||
PERCENTAGE: 'PERCENTAGE', | ||
FRACTION: 'FRACTION', | ||
SCIENTIFIC: 'SCIENTIFIC' | ||
}; | ||
export var FILE_FORMATS = { | ||
FILE: 'FILE', | ||
IMAGE: 'IMAGE' | ||
}; | ||
export var DATE_FORMATS = { | ||
DATE: 'DATE', | ||
DATETIME: 'DATETIME' | ||
DATETIME: 'DATE/TIME' | ||
}; | ||
var MUTATION_TYPE = { | ||
export var MUTATION_TYPE = { | ||
CREATE: 'CREATE', | ||
UPDATE: 'UPDATE' | ||
}; | ||
export { FORMAT, FIELD_TYPE, MUTATION_TYPE }; | ||
}; |
@@ -1,4 +0,5 @@ | ||
import { isRelationReference, isRelationInstance } from '../verifiers'; | ||
import { isRelationReference, isRelationInstance, isFileReference, isFileInstance } from '../verifiers'; | ||
import { formatRelationReferenceForMutation } from './formatRelationReferenceForMutation'; | ||
import { formatRelationInstanceForMutation } from './formatRelationInstanceForMutation'; | ||
import { formatFileInstanceForMutation } from './formatFileInstanceForMutation'; | ||
@@ -9,6 +10,8 @@ | ||
if (isRelationReference(fieldSchema, data)) { | ||
if (isRelationReference(fieldSchema, data) || isFileReference(fieldSchema, data)) { | ||
formatedData = formatRelationReferenceForMutation(type, data); | ||
} else if (isRelationInstance(fieldSchema, data)) { | ||
formatedData = formatRelationInstanceForMutation(type, fieldSchema, data, schema); | ||
} else if (isFileInstance(fieldSchema, data)) { | ||
formatedData = formatFileInstanceForMutation(type, data); | ||
} | ||
@@ -15,0 +18,0 @@ |
@@ -1,1 +0,1 @@ | ||
import { FIELD_TYPE, FORMAT } from './constants'; | ||
import { FIELD_TYPE, SWITCH_FORMATS, TEXT_FORMATS, NUMBER_FORMATS, FILE_FORMATS, DATE_FORMATS } from './constants'; |
@@ -0,1 +1,4 @@ | ||
export { isFileField } from './isFileField'; | ||
export { isFileInstance } from './isFileInstance'; | ||
export { isFileReference } from './isFileReference'; | ||
export { isListField } from './isListField'; | ||
@@ -2,0 +5,0 @@ export { isRelationField } from './isRelationField'; |
{ | ||
"name": "@8base/utils", | ||
"version": "0.1.5", | ||
"version": "0.2.5", | ||
"main": "es/index.js", | ||
@@ -5,0 +5,0 @@ "module": "es/index.js", |
//@flow | ||
const FIELD_TYPE = { | ||
export const FIELD_TYPE = { | ||
DATE: 'DATE', | ||
@@ -11,5 +11,15 @@ FILE: 'FILE', | ||
TEXT: 'TEXT', | ||
CUSTOM: 'CUSTOM', | ||
}; | ||
const FORMAT = { | ||
export const SWITCH_FORMATS = { | ||
ON_OFF: 'ON_OFF', | ||
YES_NO: 'YES_NO', | ||
TRUE_FALSE: 'TRUE_FALSE', | ||
ACTIVE_INACTIVE: 'ACTIVE_INACTIVE', | ||
HIGH_LOW: 'HIGH_LOW', | ||
CUSTOM: 'CUSTOM', | ||
}; | ||
export const TEXT_FORMATS = { | ||
UNFORMATTED: 'UNFORMATTED', | ||
@@ -22,15 +32,25 @@ NAME: 'NAME', | ||
EMAIL: 'EMAIL', | ||
}; | ||
export const NUMBER_FORMATS = { | ||
NUMBER: 'NUMBER', | ||
CURRENCY: 'CURRENCY', | ||
PERCENTAGE: 'PERCENTAGE', | ||
FRACTION: 'FRACTION', | ||
SCIENTIFIC: 'SCIENTIFIC', | ||
}; | ||
export const FILE_FORMATS = { | ||
FILE: 'FILE', | ||
IMAGE: 'IMAGE', | ||
}; | ||
export const DATE_FORMATS = { | ||
DATE: 'DATE', | ||
DATETIME: 'DATETIME', | ||
DATETIME: 'DATE/TIME', | ||
}; | ||
const MUTATION_TYPE = { | ||
export const MUTATION_TYPE = { | ||
CREATE: 'CREATE', | ||
UPDATE: 'UPDATE', | ||
}; | ||
export { | ||
FORMAT, | ||
FIELD_TYPE, | ||
MUTATION_TYPE, | ||
}; |
//@flow | ||
import { isRelationReference, isRelationInstance } from '../verifiers'; | ||
import { isRelationReference, isRelationInstance, isFileReference, isFileInstance } from '../verifiers'; | ||
import { formatRelationReferenceForMutation } from './formatRelationReferenceForMutation'; | ||
import { formatRelationInstanceForMutation } from './formatRelationInstanceForMutation'; | ||
import { formatFileInstanceForMutation } from './formatFileInstanceForMutation'; | ||
import type { MutationType, FieldSchema, Schema } from '../types'; | ||
@@ -10,6 +11,8 @@ | ||
if (isRelationReference(fieldSchema, data)) { | ||
if (isRelationReference(fieldSchema, data) || isFileReference(fieldSchema, data)) { | ||
formatedData = formatRelationReferenceForMutation(type, data); | ||
} else if (isRelationInstance(fieldSchema, data)) { | ||
formatedData = formatRelationInstanceForMutation(type, fieldSchema, data, schema); | ||
} else if (isFileInstance(fieldSchema, data)) { | ||
formatedData = formatFileInstanceForMutation(type, data); | ||
} | ||
@@ -16,0 +19,0 @@ |
// @flow | ||
import { FIELD_TYPE, FORMAT } from './constants'; | ||
import { | ||
FIELD_TYPE, | ||
SWITCH_FORMATS, | ||
TEXT_FORMATS, | ||
NUMBER_FORMATS, | ||
FILE_FORMATS, | ||
DATE_FORMATS, | ||
} from './constants'; | ||
@@ -8,3 +15,7 @@ type MutationType = 'CREATE' | 'UPDATE'; | ||
type Format = $Values<typeof FORMAT>; | ||
type Format = $Values<typeof SWITCH_FORMATS> | ||
| $Values<typeof TEXT_FORMATS> | ||
| $Values<typeof NUMBER_FORMATS> | ||
| $Values<typeof FILE_FORMATS> | ||
| $Values<typeof DATE_FORMATS>; | ||
@@ -11,0 +22,0 @@ type FieldSchema = { |
@@ -0,1 +1,4 @@ | ||
export { isFileField } from './isFileField'; | ||
export { isFileInstance } from './isFileInstance'; | ||
export { isFileReference } from './isFileReference'; | ||
export { isListField } from './isListField'; | ||
@@ -2,0 +5,0 @@ export { isRelationField } from './isRelationField'; |
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
221682
46
456