flamestore
v1.0.87
Published
firestore trigger generator
Downloads
22
Readme
flamestore
Firebase Utility Wrapper & File Generators
Getting Started
npx flamestore
Flamestore JSON Schema
$schema
: Json schema for flamestore.json. Set it to https://raw.githubusercontent.com/aabccd021/flamestore/master/flamestore-schema/v1.jsonflutterOutputPath
: Relative path where flutter file generatedregion
: Firebase region codeproject
: Firebase project configuration. You can set multiple projects in key-value pairs with project ID as key.collections
: Firestore collections definitions in key-value pairs with collection name as key.
Collection
rule
:{get
|list
|create
|update
|delete
}`: Granular update rules for the collection. Avaliable options:all
: Allow any requestsauthenticated
: Allow authenticated userowner
: Allow owner of the documentnone
: Disallow any requests
ownerField
: Name of field defines ownerfields
: Fields definition as key-value pair with field name as key.
Field Properties
property
: Field can have properties, which can be assigned as string or array. Available options:isUnique
: Field value is unique across documents in the same collectionsisOptional
: The field is optionalisNotUpdatable
: The field is not updatable
Field Types
Path Field path
Firestore Document Reference (Path) Field
collection
: Name of referenced document's collectionsyncFields
: Array or name of field synced from reference document
Example:
{
"owner": {
"type": "path",
"collection": "users",
"syncField": "userName"
}
}
String Field string
minLength
: Minimum length of the stringmaxLength
: Maximum length of the string
Example:
{
"tweetText": {
"type": "string",
"minLength": 1,
"maxLength": 280
}
}
Integer Field int
min
: Minimum value of the integermax
: Maximum length of the integerdeleteDocWhen
: The document will be deleted if the integer equals to this value
Example:
{
"likeValue": {
"type": "int",
"max": 5,
"min": 0,
"deleteDocWhen": 0
}
}
Float Field float
min
: Minimum value of the integermax
: Maximum length of the integerdeleteDocWhen
: The document will be deleted if the integer equals to this value
Example:
{
"likeValue": {
"type": "float",
"max": 5,
"min": 0,
"deleteDocWhen": 0
}
}
Image Field image
metadata
: Array of values of image metadata nameheight
: Height of imagewidth
: Width of imagesize
: Size of image in bytes
Example:
{
"image": {
"type": "image",
"metadata": [
"height",
"width"
]
}
}
Dynamic Link Field dynamicLink
title
: String of field used as dynamic link datafield
: Use value of the field as dynamic link data
description
: String of field used as dynamic link datafield
: Use value of the field as dynamic link data
imageURL
: String of field used as dynamic link datafield
: Use value of the field as dynamic link data
isSuffixShort
: Use short suffix for dynamic Link
Example:
{
"dynamicLink": {
"type": "dynamicLink",
"isSuffixShort": true,
"title": {
"field": "tweetText"
},
"description": "tweet description"
}
}
Count Field count
Count certain field in documents with same reference.
collection
: Name of document's collection to be countedreference
: Name of reference field which points to counting document
Example:
{
"tweetsCount": {
"type": "count",
"collection": "tweets",
"reference": "owner"
}
}
Sum Field sum
Sums certain field in documents with same reference.
collection
: Name of document's collection to be summedreference
: Name of reference field which points to summing documentfield
: Name of field to be summed
Example:
{
"likesSum": {
"type": "sum",
"collection": "likes",
"field": "likeValue",
"reference": "tweet"
}
}
Computed Field compute
Computes field using custom function on firebase trigger.
compute
: Type of field to be computed. Available options areint
,float
,string
,timestamp
.
Example:
{
"hotness": {
"compute": "float"
},
}
Server Timestamp Field serverTimestamp
Records time when document created
Example:
{
"creationTime": "serverTimestamp",
}