Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/bypatryk/firestore-schema-validator
/ functions
Functions
92 in github.com/bypatryk/firestore-schema-validator
⨍
Functions
92
◇
Types & classes
12
↓ 20 callers
Function
expectEachToBe
(array, cb, value)
test/validators.test.js:4
↓ 5 callers
Method
_add
* Adds filter to stack. * * @param {Function} filter * @returns {this} * @memberof Field
lib/Field.js:164
↓ 4 callers
Function
asyncForEach
(array, callback)
lib/helpers.js:7
↓ 3 callers
Method
_defineType
* Sets _isTypeDefined to true, so Field can only be of one type. * * @memberof Field
lib/Field.js:150
↓ 3 callers
Method
emit
* Emits event. * * @param {String} event - Event name. * @memberof Model
lib/Model.js:185
↓ 3 callers
Function
isData
(target, key)
lib/ModelProxy.js:8
↓ 3 callers
Function
isObject
(value)
lib/helpers.js:21
↓ 3 callers
Function
markAsChanged
(changedKeys, value, path = [])
lib/helpers.js:33
↓ 2 callers
Function
isNumber
lib/validators.js:62
↓ 2 callers
Function
isPrivate
(key)
lib/ModelProxy.js:4
↓ 2 callers
Function
nestedHandler
(model, path = [])
lib/ModelProxy.js:15
↓ 2 callers
Method
parseData
* Parses Document Data, running hooks and validating it. * * @param {*} [data=this._data] * @param {boolean} [all=false] * @returns Update
lib/Model.js:397
↓ 2 callers
Method
runHooks
* Runs hooks on Document Data. * * @param {Object} hooks * @param {Object} [data={}] * @returns Updated Document Data. * @memberof Mode
lib/Model.js:373
↓ 2 callers
Method
validate
* Validates Field Data against Field. * * @param {*} fieldData Field Data. * @returns Validated Field Data. * @memberof Field
lib/Field.js:49
↓ 1 callers
Function
isArray
lib/validators.js:29
↓ 1 callers
Function
isBoolean
lib/validators.js:35
↓ 1 callers
Function
isDocumentReference
lib/validators.js:38
↓ 1 callers
Function
isGeoPoint
lib/validators.js:41
↓ 1 callers
Function
isMap
lib/validators.js:51
↓ 1 callers
Function
isNull
lib/validators.js:59
↓ 1 callers
Function
isString
lib/validators.js:66
↓ 1 callers
Function
isTimestamp
lib/validators.js:69
↓ 1 callers
Method
validate
* Validates Document Data. * * @param {*} [data={}] * @param {boolean} [all=false] * @returns Validated Data. * @memberof Model
lib/Model.js:358
↓ 1 callers
Method
validate
* Validates Document Data agains Fields. * * @param {Object} [data={}] * @param {Object<Field>} [fields=this._fields] * @returns Validated
lib/Schema.js:27
↓ 1 callers
Method
validateArray
* Validates nested Fields of Array Field. * * @param {*} arrayData Array Data. * @returns Validated Array Data. * @memberof Field
lib/Field.js:129
↓ 1 callers
Method
validateField
* Validated Field Data at high level. * * @param {*} fieldData Field Data. * @returns Validated Field Data. * @memberof Field
lib/Field.js:84
↓ 1 callers
Method
validateObject
* Validates nested Fields of Object Field. * * @param {*} fieldData Field Data. * @returns Validated Field Data. * @memberof Field
lib/Field.js:106
↓ 1 callers
Method
validateSelected
* Validates Document Data against selected Fields. * * @param {Object} [data={}] Document Data * @param {Set} [changedKeys=new Set()] Set wit
lib/Schema.js:51
Function
ModelProxy
(model)
lib/ModelProxy.js:37
Method
_collectionPath
* Collection Path. * * @readonly * @type {String} * @memberof Model
lib/Model.js:111
Method
_collectionRef
* Collection Reference. * * @readonly * @static * @type {CollectionReference} * @memberof Model
lib/Model.js:123
Method
_createdAt
* Date of Document creation in ISO String format. * * @readonly * @type {String} * @memberof Model
lib/Model.js:74
Method
_docRef
* Document Reference. * * @readonly * @type {String} * @memberof Model
lib/Model.js:147
Method
_events
* Instance of EventEmitter used with this.on() and this.emit(). * * @readonly * @static * @type {EventEmitter} * @memberof Model
lib/Model.js:160
Method
_id
* ID of Document. * * @readonly * @type {String} * @memberof Model
lib/Model.js:63
Method
_updatedAt
* Date of Document update in ISO String format. * * @readonly * @type {String} * @memberof Model
lib/Model.js:93
Function
after
( date, errorMessage = `%s must be after ${date}.`, )
lib/filters.js:6
Function
allExcept
(except)
test/utils.js:96
Function
any
( errorMessage = `%s must be of one of the types accepted by Cloud Firestore: ${validators.FIRESTORE_TYPES.j
lib/filters.js:16
Function
array
( errorMessage = '%s must be an Array.', )
lib/filters.js:25
Method
arrayOf
* Defines Field as an Array with items defined by nested Field or Schema. * * @param {Field|Schema} fieldOrSchema Field or Schema. * @param {
lib/Field.js:226
Function
before
( date, errorMessage = `%s must be before ${date}.`, )
lib/filters.js:34
Function
boolean
( errorMessage = '%s must be a Boolean.', )
lib/filters.js:44
Method
constructor
* Creates an instance of Model. * * @param {DocumentSnapshot} _snapshot - Document Snapshot. * @param {Object} _data - Document Data. * @r
lib/Model.js:25
Method
constructor
* Creates an instance of Schema. * * @param {Object<Field>} _fields Object containing Field definitions. * @memberof Schema
lib/Schema.js:15
Method
constructor
* Creates an instance of Field. * * @param {String} _label Field's Label. * @memberof Field
lib/Field.js:21
Method
create
* Creates new Document. * * @static * @param {Object} [data={}] * @returns Instance of this. * @memberof Model
lib/Model.js:301
Method
custom
* Adds custom filter to stack. * * @param {Function} filter * @returns {this} * @memberof Field
lib/Field.js:177
Function
date
( format, errorMessage = format ? `%s must be a valid Date in ${format} format.` : '%s must be a v
lib/filters.js:53
Method
default
* Defines default value that will be returned if Field Data is undefined. * * @param {*} defaultValue * @returns {this} * @memberof Field
lib/Field.js:188
Method
delete
* Deletes Document. * * @memberof Model
lib/Model.js:323
Function
email
( errorMessage = '%s must be a valid email.', )
lib/filters.js:70
Function
equal
( compare, errorMessage = `%s must equal ${compare}.`, )
lib/filters.js:101
Function
field
(...args)
lib/index.js:8
Function
geopoint
( errorMessage = '% must be an instance of GeoPoint.', )
lib/filters.js:111
Function
get
(target, key)
lib/ModelProxy.js:17
Method
getAllBy
* Fetches all Documents by key and value pair. * * @static * @param {String} key * @param {*} value * @param {array} optionalModifiers
lib/Model.js:279
Method
getBy
* Fetches Document by key and value pair. * * @static * @param {String} key - Key. * @param {*} value - Value to compare. * @returns {t
lib/Model.js:255
Method
getById
* Fetches Document by ID. * * @static * @param {String} id * @returns {this|null} Instance of Model or null. * @memberof Model
lib/Model.js:235
Function
integer
( errorMessage = '%s must be an Integer Number.', )
lib/filters.js:120
Function
isAfter
(date, value)
lib/validators.js:15
Function
isAny
lib/validators.js:18
Function
isBefore
(date, value)
lib/validators.js:32
Function
isInRange
(min, max, value)
lib/validators.js:44
Function
isInteger
lib/validators.js:48
Function
isMatching
(regex, value)
lib/validators.js:56
Function
length
( length, errorMessage = `%s must have length of ${length}.`, )
lib/filters.js:129
Function
match
( regex, errorMessage = `%s must match ${regex} pattern.`, )
lib/filters.js:139
Function
max
( max, errorMessage = `%s must be a Number less than or equal to ${max}.`, )
lib/filters.js:149
Function
maxLength
( maxLength, errorMessage = `%s must have length of at most ${maxLength}.`, )
lib/filters.js:159
Function
min
( min, errorMessage = `%s must be a Number greater than or equal to ${min}.`, )
lib/filters.js:169
Function
minLength
( minLength, errorMessage = `%s must have length of at least ${minLength}.`, )
lib/filters.js:179
Method
nullable
* Allows Field Data to be null. * * @returns {this} * @memberof Field
lib/Field.js:200
Function
number
( errorMessage = '%s must be a Number.', )
lib/filters.js:189
Function
object
( errorMessage = '%s must be a Map.', )
lib/filters.js:198
Method
objectOf
* Defines Field as an Object with entries defined by nested object of Fields or Schema. * * @param {Object<Field>|Schema} objectOfFieldsOrSchema
lib/Field.js:241
Method
on
* Subsribes to event. * * @static * @param {String} event - Event name. * @param {Function} cb - Callback function. * @memberof Model
lib/Model.js:175
Function
oneOf
( acceptableValues, errorMessage = `%s must be one of the accepted values (${acceptableValues.join(', ')})
lib/filters.js:81
Method
optional
* Makes Field optional. * * @returns {this} * @memberof Field
lib/Field.js:212
Method
posthook
* Adds hook that will be fired after parsing data * if this[path] has changed. * * @static * @param {String} path - Path of property. *
lib/Model.js:217
Method
prehook
* Adds hook that will be fired before parsing data * if this[path] has changed. * * @static * @param {String} path - Path of property.
lib/Model.js:198
Function
range
( min, max, errorMessage = `%s must be a Number between ${min} and ${max}`, )
lib/filters.js:207
Function
reference
( errorMessage = '%s must be an instance of DocumentReference.', )
lib/filters.js:218
Method
save
* Saves changes made to Document. * * @param {*} options * @returns This. * @memberof Model
lib/Model.js:337
Function
schema
(...args)
lib/index.js:11
Function
set
(target, key, value)
lib/ModelProxy.js:30
Function
string
( errorMessage = '%s must be a String.', )
lib/filters.js:227
Function
timestamp
( errorMessage = '%s must be an instance of Timestamp.', )
lib/filters.js:236
Method
toJSON
* Exposes public data to be shown in API responses. * * @returns {Object} * @memberof Model
lib/Model.js:413
Function
toLowerCase
( errorMessage = 'Couldn\'t turn %s to lower case.', )
lib/filters.js:255
Function
toUpperCase
( errorMessage = 'Couldn\'t turn %s to upper case.', )
lib/filters.js:265
Function
trim
( errorMessage = 'Couldn\'t trim %s.', )
lib/filters.js:245