functional-firestore v0.6.7
functional-firestore
Index
Modules
functional-firestore
Modules
functional-firestore › "Arbitraries"
Module: "Arbitraries"
Index
Functions
- condition
- id
- model
- modelAndConditions
- modelAndUpdate
- modelBase
- modelData
- models
- nonEmptyString
- nonModelObject
- operation
- table
Functions
Const
condition
▸ condition(): Arbitrary‹Condition›
Defined in src/Arbitraries.ts:40
Returns: Arbitrary‹Condition›
Const
id
▸ id(): Arbitrary‹string›
Defined in src/Arbitraries.ts:7
Returns: Arbitrary‹string›
Const
model
▸ model(): Arbitrary‹Model›
Defined in src/Arbitraries.ts:24
Returns: Arbitrary‹Model›
Const
modelAndConditions
▸ modelAndConditions(): Arbitrary‹[Model, Condition[]]›
Defined in src/Arbitraries.ts:43
Returns: Arbitrary‹[Model, Condition[]]›
Const
modelAndUpdate
▸ modelAndUpdate(): Arbitrary‹[Model, Model]›
Defined in src/Arbitraries.ts:29
Returns: Arbitrary‹[Model, Model]›
Const
modelBase
▸ modelBase(): Arbitrary‹Model›
Defined in src/Arbitraries.ts:12
Returns: Arbitrary‹Model›
Const
modelData
▸ modelData(): Arbitrary‹object›
Defined in src/Arbitraries.ts:17
Returns: Arbitrary‹object›
Const
models
▸ models(): Arbitrary‹Model[]›
Defined in src/Arbitraries.ts:57
Returns: Arbitrary‹Model[]›
Const
nonEmptyString
▸ nonEmptyString(): Arbitrary‹string›
Defined in src/Arbitraries.ts:5
Returns: Arbitrary‹string›
Const
nonModelObject
▸ nonModelObject(): Arbitrary‹unknown›
Defined in src/Arbitraries.ts:9
Returns: Arbitrary‹unknown›
Const
operation
▸ operation(): Arbitrary‹Operation›
Defined in src/Arbitraries.ts:38
Returns: Arbitrary‹Operation›
Const
table
▸ table(): Arbitrary‹string›
Defined in src/Arbitraries.ts:59
Returns: Arbitrary‹string›
functional-firestore › "Emulator"
Module: "Emulator"
Index
Functions
Functions
Const
clearCollection
▸ clearCollection(parentCollection
: CollectionReference‹object›): Promise‹void›
Defined in src/Emulator.ts:25
clearCollection :: Collection -> Promise
Parameters:
Name | Type |
---|---|
parentCollection | CollectionReference‹object› |
Returns: Promise‹void›
Const
clearEmulator
▸ clearEmulator(): Promise‹void›
Defined in src/Emulator.ts:56
clearFirebase :: () -> Promise
Returns: Promise‹void›
Const
clearFirestore
▸ clearFirestore(): Promise‹void›
Defined in src/Emulator.ts:46
clearFirestore :: () -> Promise
Returns: Promise‹void›
Const
getFirestore
▸ getFirestore(): Firestore‹›
Defined in src/Emulator.ts:16
getFirestore :: () -> Firestore
Returns: Firestore‹›
functional-firestore › "Firestore"
Module: "Firestore"
Index
Type aliases
Variables
- getDocumentSnapshotsFromQuerySnapshot
- getModelFromCollection
- getModelFromDocument
- getModelFromFirestore
- getModelsFromQuery
- getModelsFromQuerySnapshot
- getModelsInCollection
- getModelsInCollectionWhere
- getModelsInFirestore
- getModelsInFirestoreWhere
- getSnapshotFromDocument
- getSnapshotFromQuery
- serialize
- serializeTimestampModel
- storeModelToCollection
- storeModelToDocument
- storeModelToFirestore
- updateModelInDocument
- validateModel
- validateSnapshotExistence
Functions
- fromDateModel
- fromTimestampModel
- getCollectionFromDocument
- getCollectionFromFirestore
- getDocumentFromCollection
- getQueryFromCollection
- getSnapshotFromDocumentTask
- getSnapshotFromQueryTask
- isDateModel
- isDateString
- isModel
- isSerializedModel
- isTimestampModel
- listCollectionsInFirestore
- listDocumentsInCollection
- serializeDateModel
- storeModelToFirestoreWith
- updateModelInDocumentTask
Type aliases
Condition
Ƭ Condition: [string, Operation, unknown]
Defined in src/Firestore.ts:57
DateModel
Ƭ DateModel: Model‹A› & object
Defined in src/Firestore.ts:45
Model
Ƭ Model: object & A
Defined in src/Firestore.ts:36
Operation
Ƭ Operation: WhereFilterOp
Defined in src/Firestore.ts:55
SerializedModel
Ƭ SerializedModel: Model‹A› & object
Defined in src/Firestore.ts:50
TimestampModel
Ƭ TimestampModel: Model‹A› & object
Defined in src/Firestore.ts:40
Variables
Const
getDocumentSnapshotsFromQuerySnapshot
• getDocumentSnapshotsFromQuerySnapshot: function = prop('docs')
Defined in src/Firestore.ts:516
getDocumentSnapshotsFromQuerySnapshot :: QuerySnapshot -> [DocumentSnapshot]
Type declaration:
▸ (snapshot
: QuerySnapshot): QueryDocumentSnapshot[]
Parameters:
Name | Type |
---|---|
snapshot | QuerySnapshot |
Const
getModelFromCollection
• getModelFromCollection: function = pipe( getSnapshotFromCollection, RTE.chainEitherK(getModelFromDocumentSnapshot) )
Defined in src/Firestore.ts:436
getModelFromCollection :: Collection -> ReaderTaskEither Model Model Error
Type declaration:
▸ (collection
: CollectionReference): ReaderTaskEither‹Model, Error, Model›
Parameters:
Name | Type |
---|---|
collection | CollectionReference |
Const
getModelFromDocument
• getModelFromDocument: function = pipe( getSnapshotFromDocument, TE.chainEitherK(getModelFromDocumentSnapshot) )
Defined in src/Firestore.ts:482
getModelFromDocument :: Document -> TaskEither Model Error
Type declaration:
▸ (document
: DocumentReference): TaskEither‹Error, Model›
Parameters:
Name | Type |
---|---|
document | DocumentReference |
Const
getModelFromFirestore
• getModelFromFirestore: function = pipe( getCollectionFromFirestore, R.map(getModelFromCollection) )
Defined in src/Firestore.ts:448
getModelFromFirestore :: Firestore -> Reader String (ReaderTaskEither Model Model Error)
Type declaration:
▸ (firestore
: Firestore): Reader‹string, ReaderTaskEither‹Model, Error, Model››
Parameters:
Name | Type |
---|---|
firestore | Firestore |
Const
getModelsFromQuery
• getModelsFromQuery: function = pipe( getSnapshotFromQuery, TE.chainEitherK(getModelsFromQuerySnapshot) )
Defined in src/Firestore.ts:538
getModelsFromQuery :: Query -> TaskEither [Model] Error
Type declaration:
▸ (query
: Query): TaskEither‹Error, Model[]›
Parameters:
Name | Type |
---|---|
query | Query |
Const
getModelsFromQuerySnapshot
• getModelsFromQuerySnapshot: function = pipe( getDocumentSnapshotsFromQuerySnapshot, map(getModelFromDocumentSnapshot), A.array.sequence(E.either) )
Defined in src/Firestore.ts:525
getModelsFromQuerySnapshot :: QuerySnapshot -> Either [Model] Error
Type declaration:
▸ (snapshot
: QuerySnapshot): E.Either‹Error, Model[]›
Parameters:
Name | Type |
---|---|
snapshot | QuerySnapshot |
Const
getModelsInCollection
• getModelsInCollection: function = pipe( listDocumentsInCollection, TEUtils.fromTask, TE.chain(pipe(map(getModelFromDocument), A.array.sequence(TE.taskEither))) )
Defined in src/Firestore.ts:575
getModelsInCollection :: Collection -> TaskEither [Model] Error
Type declaration:
▸ (collection
: CollectionReference): TaskEither‹Error, Model[]›
Parameters:
Name | Type |
---|---|
collection | CollectionReference |
Const
getModelsInCollectionWhere
• getModelsInCollectionWhere: function = pipe( getQueryFromCollection, RTE.fromReaderEither, RTE.chainTaskEitherK(getModelsFromQuery) )
Defined in src/Firestore.ts:550
getModelsInCollectionWhere :: Collection -> ReaderTaskEither [Condition] [Model] Error
Type declaration:
▸ (collection
: CollectionReference): ReaderTaskEither‹Condition[], Error, Model[]›
Parameters:
Name | Type |
---|---|
collection | CollectionReference |
Const
getModelsInFirestore
• getModelsInFirestore: function = pipe( getCollectionFromFirestore, R.map(getModelsInCollection) )
Defined in src/Firestore.ts:588
getModelsInFirestore :: Firestore -> ReaderTaskEither String [Model] Error
Type declaration:
▸ (firestore
: Firestore): ReaderTaskEither‹string, Error, Model[]›
Parameters:
Name | Type |
---|---|
firestore | Firestore |
Const
getModelsInFirestoreWhere
• getModelsInFirestoreWhere: function = pipe( getCollectionFromFirestore, R.map(getModelsInCollectionWhere) )
Defined in src/Firestore.ts:563
getModelsInFirestoreWhere :: Firestore -> Reader String (ReaderTaskEither [Condition] [Model] Error)
Type declaration:
▸ (firestore
: Firestore): Reader‹string, ReaderTaskEither‹Condition[], Error, Model[]››
Parameters:
Name | Type |
---|---|
firestore | Firestore |
Const
getSnapshotFromDocument
• getSnapshotFromDocument: function = pipe( getSnapshotFromDocumentTask, TEUtils.fromTask )
Defined in src/Firestore.ts:366
getSnapshotFromDocument :: Document -> TaskEither Snapshot Error
Type declaration:
▸ (document
: DocumentReference): TaskEither‹Error, DocumentSnapshot›
Parameters:
Name | Type |
---|---|
document | DocumentReference |
Const
getSnapshotFromQuery
• getSnapshotFromQuery: function = pipe( getSnapshotFromQueryTask, TEUtils.fromTask )
Defined in src/Firestore.ts:504
getSnapshotFromQuery :: Query -> TaskEither Snapshot Error
Type declaration:
▸ (query
: Query): TaskEither‹Error, QuerySnapshot›
Parameters:
Name | Type |
---|---|
query | Query |
Const
serialize
• serialize: function = ifElse( isSerializedModel, E.right, pipe( ifElse( isDateModel, E.right, pipe( E.fromPredicate( isTimestampModel, () => new Error('Model is not a TimestampModel.') ), fromTimestampModel ) ), E.map(serializeDateModel) ) )
Defined in src/Firestore.ts:183
serialize :: Model -> Either SerializedModel Error
Type declaration:
▸ <A>(model
: Model‹A›): E.Either‹Error, SerializedModel‹A››
Type parameters:
▪ A
Parameters:
Name | Type |
---|---|
model | Model‹A› |
Const
serializeTimestampModel
• serializeTimestampModel: function = pipe(fromTimestampModel, serializeDateModel)
Defined in src/Firestore.ts:174
serializeTimestampModel :: TimestampModel -> SerializedModel
Type declaration:
▸ <A>(model
: TimestampModel‹A›): SerializedModel‹A›
Type parameters:
▪ A
Parameters:
Name | Type |
---|---|
model | TimestampModel‹A› |
Const
storeModelToCollection
• storeModelToCollection: function = pipe( getDocumentFromCollection, R.chain(storeModelToDocument) )
Defined in src/Firestore.ts:291
storeModelToCollection :: Collection -> String -> ReaderTaskEither Model Model Error
Type declaration:
▸ (collection
: CollectionReference): ReaderTaskEither‹Model, Error, Model›
Parameters:
Name | Type |
---|---|
collection | CollectionReference |
Const
storeModelToDocument
• storeModelToDocument: function = pipe( storeModelToDocumentTask, R.map(TEUtils.fromTask) )
Defined in src/Firestore.ts:279
storeModelToDocument :: Document -> ReaderTaskEither Model Model Error
Type declaration:
▸ (document
: DocumentReference): ReaderTaskEither‹Model, Error, Model›
Parameters:
Name | Type |
---|---|
document | DocumentReference |
Const
storeModelToFirestore
• storeModelToFirestore: function = pipe( getCollectionFromFirestore, R.map(storeModelToCollection) )
Defined in src/Firestore.ts:303
storeModelToFirestore :: Firestore -> Reader String (ReaderTaskEither Model Model Error)
Type declaration:
▸ (firestore
: Firestore): Reader‹string, ReaderTaskEither‹Model, Error, Model››
Parameters:
Name | Type |
---|---|
firestore | Firestore |
Const
updateModelInDocument
• updateModelInDocument: function = pipe( updateModelInDocumentTask, R.map(TEUtils.fromTask) )
Defined in src/Firestore.ts:344
updateModelInDocument :: Collection -> ReaderTaskEither Model Model Error
Type declaration:
▸ (document
: DocumentReference): ReaderTaskEither‹Model, Error, Model›
Parameters:
Name | Type |
---|---|
document | DocumentReference |
Const
validateModel
• validateModel: function = ifElse(isModel, E.right, () => E.left(new Error('Item is not a valid model.')) )
Defined in src/Firestore.ts:412
validateModel :: a -> Either Model Error
Type declaration:
▸ (a
: unknown): E.Either‹Error, Model›
Parameters:
Name | Type |
---|---|
a | unknown |
Const
validateSnapshotExistence
• validateSnapshotExistence: function = ifElse(prop('exists'), E.right, () => E.left(new Error('Item does not exist.')) )
Defined in src/Firestore.ts:401
validateSnapshotExistence :: snapshot -> Either a Error
Type declaration:
▸ (snapshot
: DocumentSnapshot): E.Either‹Error, DocumentSnapshot›
Parameters:
Name | Type |
---|---|
snapshot | DocumentSnapshot |
Functions
Const
fromDateModel
▸ fromDateModel(model
: object & A & object): object & A & object & object
Defined in src/Firestore.ts:150
fromDateModel :: DateModel -> TimestampModel
Parameters:
Name | Type |
---|---|
model | object & A & object |
Returns: object & A & object & object
Const
fromTimestampModel
▸ fromTimestampModel(model
: object & A & object): object & A & object & object
Defined in src/Firestore.ts:137
fromTimestampModel :: TimestampModel -> DateModel
Parameters:
Name | Type |
---|---|
model | object & A & object |
Returns: object & A & object & object
Const
getCollectionFromDocument
▸ getCollectionFromDocument(document
: DocumentReference‹object›): (Anonymous function)
Defined in src/Firestore.ts:255
getCollectionFromDocument :: Document -> Reader String Collection
Parameters:
Name | Type |
---|---|
document | DocumentReference‹object› |
Returns: (Anonymous function)
Const
getCollectionFromFirestore
▸ getCollectionFromFirestore(firestore
: Firestore‹›): (Anonymous function)
Defined in src/Firestore.ts:211
getCollectionFromFirestore :: Firestore -> Reader String Collection
Parameters:
Name | Type |
---|---|
firestore | Firestore‹› |
Returns: (Anonymous function)
Const
getDocumentFromCollection
▸ getDocumentFromCollection(collection
: CollectionReference‹object›): (Anonymous function)
Defined in src/Firestore.ts:222
getDocumentFromCollection :: Collection -> Reader Model Document
Parameters:
Name | Type |
---|---|
collection | CollectionReference‹object› |
Returns: (Anonymous function)
Const
getQueryFromCollection
▸ getQueryFromCollection(collection
: CollectionReference‹object›): function
Defined in src/Firestore.ts:233
getQueryFromCollection :: Collection -> Reader [Condition] Document Error
Parameters:
Name | Type |
---|---|
collection | CollectionReference‹object› |
Returns: function
▸ (x0
: V0): T2
Parameters:
Name | Type |
---|---|
x0 | V0 |
Const
getSnapshotFromDocumentTask
▸ getSnapshotFromDocumentTask(document
: DocumentReference‹object›): (Anonymous function)
Defined in src/Firestore.ts:358
getSnapshotFromDocumentTask :: Document -> Task Snapshot
Parameters:
Name | Type |
---|---|
document | DocumentReference‹object› |
Returns: (Anonymous function)
Const
getSnapshotFromQueryTask
▸ getSnapshotFromQueryTask(query
: Query‹object›): (Anonymous function)
Defined in src/Firestore.ts:496
getSnapshotFromQueryTask :: Query -> Task Snapshot
Parameters:
Name | Type |
---|---|
query | Query‹object› |
Returns: (Anonymous function)
Const
isDateModel
▸ isDateModel(a
: unknown): a is DateModel
Defined in src/Firestore.ts:84
isDateModel :: a -> bool
Parameters:
Name | Type |
---|---|
a | unknown |
Returns: a is DateModel
Const
isDateString
▸ isDateString(a
: unknown): a is string
Defined in src/Firestore.ts:92
isDateString :: a -> bool
Parameters:
Name | Type |
---|---|
a | unknown |
Returns: a is string
Const
isModel
▸ isModel(a
: unknown): a is Model
Defined in src/Firestore.ts:64
isModel :: a -> bool
Parameters:
Name | Type |
---|---|
a | unknown |
Returns: a is Model
Const
isSerializedModel
▸ isSerializedModel(a
: unknown): a is SerializedModel
Defined in src/Firestore.ts:100
isSerializedModel :: a -> bool
Parameters:
Name | Type |
---|---|
a | unknown |
Returns: a is SerializedModel
Const
isTimestampModel
▸ isTimestampModel(a
: unknown): a is TimestampModel
Defined in src/Firestore.ts:72
isTimestampModel :: a -> bool
Parameters:
Name | Type |
---|---|
a | unknown |
Returns: a is TimestampModel
Const
listCollectionsInFirestore
▸ listCollectionsInFirestore(firestore
: Firestore‹›): (Anonymous function)
Defined in src/Firestore.ts:462
listCollectionsInFirestore :: Firestore -> Task [Collection]
Parameters:
Name | Type |
---|---|
firestore | Firestore‹› |
Returns: (Anonymous function)
Const
listDocumentsInCollection
▸ listDocumentsInCollection(collection
: CollectionReference‹object›): (Anonymous function)
Defined in src/Firestore.ts:473
listDocumentsInCollection :: Collection -> Task [Document]
Parameters:
Name | Type |
---|---|
collection | CollectionReference‹object› |
Returns: (Anonymous function)
Const
serializeDateModel
▸ serializeDateModel(model
: object & A & object): object & A & object & object
Defined in src/Firestore.ts:163
serializeDateModel :: DateModel -> SerializedModel
Parameters:
Name | Type |
---|---|
model | object & A & object |
Returns: object & A & object & object
Const
storeModelToFirestoreWith
▸ storeModelToFirestoreWith(firestore
: Firestore‹›): (Anonymous function)
Defined in src/Firestore.ts:320
storeModelToFirestoreWith :: Firestore -> Reader String (ReaderTaskEither (() -> Model) Model Error)
Parameters:
Name | Type |
---|---|
firestore | Firestore‹› |
Returns: (Anonymous function)
Const
updateModelInDocumentTask
▸ updateModelInDocumentTask(document
: DocumentReference‹object›): (Anonymous function)
Defined in src/Firestore.ts:332
updateModelInDocumentTask :: Collection -> ReaderTask Model Model
Parameters:
Name | Type |
---|---|
document | DocumentReference‹object› |
Returns: (Anonymous function)
functional-firestore › "index"
Module: "index"
Index
References
- Condition
- DateModel
- Model
- Operation
- SerializedModel
- TimestampModel
- fromDateModel
- fromTimestampModel
- getCollectionFromDocument
- getCollectionFromFirestore
- getDocumentFromCollection
- getDocumentSnapshotsFromQuerySnapshot
- getModelFromCollection
- getModelFromDocument
- getModelFromFirestore
- getModelsFromQuery
- getModelsFromQuerySnapshot
- getModelsInCollection
- getModelsInCollectionWhere
- getModelsInFirestore
- getModelsInFirestoreWhere
- getQueryFromCollection
- getSnapshotFromDocument
- getSnapshotFromDocumentTask
- getSnapshotFromQuery
- getSnapshotFromQueryTask
- isDateModel
- isDateString
- isModel
- isSerializedModel
- isTimestampModel
- listCollectionsInFirestore
- listDocumentsInCollection
- serialize
- serializeDateModel
- serializeTimestampModel
- storeModelToCollection
- storeModelToDocument
- storeModelToFirestore
- storeModelToFirestoreWith
- updateModelInDocument
- updateModelInDocumentTask
- validateModel
- validateSnapshotExistence
References
Condition
• Condition:
DateModel
• DateModel:
Model
• Model:
Operation
• Operation:
SerializedModel
• SerializedModel:
TimestampModel
• TimestampModel:
fromDateModel
• fromDateModel:
fromTimestampModel
• fromTimestampModel:
getCollectionFromDocument
• getCollectionFromDocument:
getCollectionFromFirestore
• getCollectionFromFirestore:
getDocumentFromCollection
• getDocumentFromCollection:
getDocumentSnapshotsFromQuerySnapshot
• getDocumentSnapshotsFromQuerySnapshot:
getModelFromCollection
• getModelFromCollection:
getModelFromDocument
• getModelFromDocument:
getModelFromFirestore
• getModelFromFirestore:
getModelsFromQuery
• getModelsFromQuery:
getModelsFromQuerySnapshot
• getModelsFromQuerySnapshot:
getModelsInCollection
• getModelsInCollection:
getModelsInCollectionWhere
• getModelsInCollectionWhere:
getModelsInFirestore
• getModelsInFirestore:
getModelsInFirestoreWhere
• getModelsInFirestoreWhere:
getQueryFromCollection
• getQueryFromCollection:
getSnapshotFromDocument
• getSnapshotFromDocument:
getSnapshotFromDocumentTask
• getSnapshotFromDocumentTask:
getSnapshotFromQuery
• getSnapshotFromQuery:
getSnapshotFromQueryTask
• getSnapshotFromQueryTask:
isDateModel
• isDateModel:
isDateString
• isDateString:
isModel
• isModel:
isSerializedModel
• isSerializedModel:
isTimestampModel
• isTimestampModel:
listCollectionsInFirestore
• listCollectionsInFirestore:
listDocumentsInCollection
• listDocumentsInCollection:
serialize
• serialize:
serializeDateModel
• serializeDateModel:
serializeTimestampModel
• serializeTimestampModel:
storeModelToCollection
• storeModelToCollection:
storeModelToDocument
• storeModelToDocument:
storeModelToFirestore
• storeModelToFirestore:
storeModelToFirestoreWith
• storeModelToFirestoreWith:
updateModelInDocument
• updateModelInDocument:
updateModelInDocumentTask
• updateModelInDocumentTask:
validateModel
• validateModel:
validateSnapshotExistence
• validateSnapshotExistence:
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago