firex-store
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -410,11 +410,14 @@ ## Usage | ||
namespaced: true, | ||
state: {}, | ||
state: { | ||
comment: null | ||
}, | ||
getters: {}, | ||
mutations: {}, | ||
actions: { | ||
subscribeOnceComments: async ({ commit }) => { | ||
const ref = firestore.collection('/comments') | ||
subscribeOnceComments: async ({ commit }, { commentId }) => { | ||
const ref = firestore.collection('/comments').doc(commentId) | ||
await FirestoreSubscriber | ||
.from(ref) | ||
// .mapOf(Model) | ||
.bindTo('comment') | ||
.subscribeOnce(commit) | ||
@@ -421,0 +424,0 @@ } |
@@ -16,4 +16,4 @@ import { AppErrorOr } from '../../types'; | ||
constructor(ref: firebase.firestore.DocumentReference); | ||
readonly ref: firebase.firestore.DocumentReference; | ||
readonly isTransaction: boolean; | ||
get ref(): firebase.firestore.DocumentReference; | ||
get isTransaction(): boolean; | ||
/** | ||
@@ -20,0 +20,0 @@ * Call it if you wanna transaction |
@@ -10,5 +10,5 @@ import { Commit } from 'vuex'; | ||
subscribe: <T = any>(state: any, commit: Commit, options?: SubscribeOptionsParameter<T>) => void; | ||
subscribeOnce: <T = any>(commit: Commit, options?: SubscribeOptionsParameter<T>) => void; | ||
subscribeOnce: <T = any>(commit: Commit, options?: SubscribeOptionsParameter<T>) => Promise<void>; | ||
mapOf: <T extends FirestoreMapper>(className: T) => this; | ||
isDocumentRef(): boolean; | ||
} |
@@ -31,3 +31,3 @@ import { AppErrorOr, DocumentId } from '../types'; | ||
constructor(ref: firebase.firestore.CollectionReference); | ||
readonly ref: firebase.firestore.CollectionReference; | ||
get ref(): firebase.firestore.CollectionReference; | ||
/** | ||
@@ -34,0 +34,0 @@ * Convert data before registering data in Firestore with the results of calling a provided function(toJson) |
@@ -23,4 +23,4 @@ import { Deleter, Transaction } from '../models'; | ||
constructor(ref: firebase.firestore.DocumentReference); | ||
readonly ref: firebase.firestore.DocumentReference; | ||
readonly isTransaction: boolean; | ||
get ref(): firebase.firestore.DocumentReference; | ||
get isTransaction(): boolean; | ||
/** | ||
@@ -27,0 +27,0 @@ * Call this if you wanna use transaction |
@@ -37,3 +37,3 @@ import { Finder, FirestoreMapper, DocumentResult } from '../models'; | ||
constructor(ref: FirestoreRef); | ||
readonly ref: FirestoreRef; | ||
get ref(): FirestoreRef; | ||
/** | ||
@@ -40,0 +40,0 @@ * Convert new data with the results of calling a provided function(fromJson) |
@@ -38,4 +38,4 @@ import { AppErrorOr } from '../types'; | ||
constructor(ref: firebase.firestore.DocumentReference); | ||
readonly ref: firebase.firestore.DocumentReference; | ||
readonly isTransaction: boolean; | ||
get ref(): firebase.firestore.DocumentReference; | ||
get isTransaction(): boolean; | ||
/** | ||
@@ -42,0 +42,0 @@ * Call this if you wanna use transaction |
@@ -39,4 +39,4 @@ import { AppErrorOr } from '../types'; | ||
constructor(ref: firebase.firestore.DocumentReference); | ||
readonly ref: firebase.firestore.DocumentReference; | ||
readonly isTransaction: boolean; | ||
get ref(): firebase.firestore.DocumentReference; | ||
get isTransaction(): boolean; | ||
/** | ||
@@ -43,0 +43,0 @@ * Call this if you wanna use transaction |
@@ -48,4 +48,4 @@ import { Subscriber, FirestoreMapper } from '../models'; | ||
constructor(ref: FirestoreRef); | ||
readonly ref: FirestoreRef; | ||
readonly statePropName: string | undefined; | ||
get ref(): FirestoreRef; | ||
get statePropName(): string | undefined; | ||
/** | ||
@@ -52,0 +52,0 @@ * Set state property bound to firestore data |
@@ -19,3 +19,3 @@ import { Unsubscriber } from '../models'; | ||
constructor(statePropName: string); | ||
readonly statePropName: string; | ||
get statePropName(): string; | ||
/** | ||
@@ -22,0 +22,0 @@ * Unsubscribe firestore data |
import { FindCriteriaOptions } from './options'; | ||
import { NullOr } from './types'; | ||
import { FirestoreRef, NullOr } from './types'; | ||
interface Criteria<T, U> { | ||
@@ -16,3 +16,3 @@ ref: T; | ||
*/ | ||
export declare const findFirestore: <T = any>({ ref, options }: Criteria<import("../types").FirestoreRef, T>) => Promise<NullOr<T>>; | ||
export declare const findFirestore: <T = any>({ ref, options }: Criteria<FirestoreRef, T>) => Promise<NullOr<T>>; | ||
export {}; |
@@ -0,2 +1,3 @@ | ||
import { FirestoreRef } from '../../types'; | ||
import * as firebase from 'firebase'; | ||
export declare const isDocumentRef: (ref: import("../../../types").FirestoreRef) => ref is firebase.firestore.DocumentReference<firebase.firestore.DocumentData>; | ||
export declare const isDocumentRef: (ref: FirestoreRef) => ref is firebase.firestore.DocumentReference<firebase.firestore.DocumentData>; |
import { Commit } from 'vuex'; | ||
import { FirestoreRef } from '../../types'; | ||
import { SubscribeCriteriaOptions } from '../../options'; | ||
@@ -22,3 +23,3 @@ interface Criteria<T, U> { | ||
*/ | ||
export declare const subscribeFirestore: <T = any>({ state, commit, ref, options }: Criteria<import("../../../types").FirestoreRef, T>) => void; | ||
export declare const subscribeFirestore: <T = any>({ state, commit, ref, options }: Criteria<FirestoreRef, T>) => void; | ||
export {}; |
{ | ||
"name": "firex-store", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "Subscribe and write firestore data, easily", | ||
@@ -15,3 +15,2 @@ "main": "./lib/index.js", | ||
"test": "jest -w 1 --forceExit", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "npm test && npm run lint", | ||
@@ -41,5 +40,5 @@ "preversion": "npm run lint" | ||
"@babel/preset-typescript": "^7.7.7", | ||
"@types/jest": "^24.0.24", | ||
"@typescript-eslint/eslint-plugin": "^2.12.0", | ||
"@typescript-eslint/parser": "^2.12.0", | ||
"@types/jest": "^24.0.25", | ||
"@typescript-eslint/eslint-plugin": "^2.15.0", | ||
"@typescript-eslint/parser": "^2.15.0", | ||
"@vue/test-utils": "^1.0.0-beta.29", | ||
@@ -49,3 +48,3 @@ "babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.7.0", | ||
"eslint-config-prettier": "^6.9.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
@@ -56,4 +55,4 @@ "firebase": "^7.6.1", | ||
"prettier": "^1.19.1", | ||
"ts-jest": "^24.2.0", | ||
"typescript": "^3.6.4", | ||
"ts-jest": "^24.3.0", | ||
"typescript": "^3.7.4", | ||
"vue": "^2.6.11", | ||
@@ -60,0 +59,0 @@ "vue-template-compiler": "^2.6.11", |
@@ -5,6 +5,7 @@ # firex-store | ||
[![CircleCI](https://circleci.com/gh/nor-ko-hi-jp/firex-store.svg?style=svg)](https://circleci.com/gh/nor-ko-hi-jp/firex-store) | ||
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/nor-ko-hi-jp/firex-store/issues) | ||
- `If you use this npm, you can read and write firestore data, easily.` | ||
- `If you use this npm, you can read and write firestore data in Vuex, easily.` | ||
- It is inspired by [vuexfire](https://github.com/vuejs/vuefire) | ||
- With this NPM, you can read and write Firestore data like the following code | ||
- With this NPM, you can read and write Firestore data in Vuex like the following code | ||
```js | ||
@@ -62,3 +63,3 @@ import { FirestoreMapper } from 'firex-store' | ||
find: async (_, { commentId }) => { | ||
const ref = firestore.collection('comments').doc('commentId') | ||
const ref = firestore.collection('comments').doc(commentId) | ||
result = await from(ref) | ||
@@ -77,3 +78,3 @@ .once() | ||
set: (_, { data, commentId }) => { | ||
const ref = firestore.collection('comments').doc('commentId') | ||
const ref = firestore.collection('comments').doc(commentId) | ||
return to(ref) | ||
@@ -85,3 +86,3 @@ .mapOf(Model) // options. Model.toJson called | ||
mergeSet: (_, { data, commentId }) => { | ||
const ref = firestore.collection('comments').doc('commentId') | ||
const ref = firestore.collection('comments').doc(commentId) | ||
return to(ref) | ||
@@ -88,0 +89,0 @@ .mapOf(Model) // options. Model.toJson called |
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
175024
3388
130