-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add .idea to .gitignore * feat: Initial implementation * chore: run prettier * feat: types from new interfaces * feat: update firebase-functions to latest version (4.9.0) * feat: fix types from latest functions SDK
- Loading branch information
Showing
9 changed files
with
151 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ lib | |
.vscode | ||
*.tgz | ||
.tmp | ||
*.log | ||
*.log | ||
.idea |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/cloudevent/mocks/firestore/firestore-on-document-created-with-auth-context.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { MockCloudEventAbstractFactory } from '../../types'; | ||
import { CloudEvent, CloudFunction, firestore } from 'firebase-functions/v2'; | ||
import { getEventType } from '../helpers'; | ||
import { QueryDocumentSnapshot } from 'firebase-admin/firestore'; | ||
import { getDocumentSnapshotCloudEventWithAuthContext } from './helpers'; | ||
|
||
export const firestoreOnDocumentCreatedWithAuthContext: MockCloudEventAbstractFactory<firestore.FirestoreAuthEvent< | ||
QueryDocumentSnapshot | ||
>> = { | ||
generateMock: getDocumentSnapshotCloudEventWithAuthContext, | ||
match(cloudFunction: CloudFunction<CloudEvent<unknown>>): boolean { | ||
return ( | ||
getEventType(cloudFunction) === | ||
'google.cloud.firestore.document.v1.created.withAuthContext' | ||
); | ||
}, | ||
}; |
17 changes: 17 additions & 0 deletions
17
src/cloudevent/mocks/firestore/firestore-on-document-deleted-with-auth-context.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { MockCloudEventAbstractFactory } from '../../types'; | ||
import { CloudEvent, CloudFunction, firestore } from 'firebase-functions/v2'; | ||
import { getEventType } from '../helpers'; | ||
import { QueryDocumentSnapshot } from 'firebase-admin/firestore'; | ||
import { getDocumentSnapshotCloudEventWithAuthContext } from './helpers'; | ||
|
||
export const firestoreOnDocumentDeletedWithAuthContext: MockCloudEventAbstractFactory<firestore.FirestoreAuthEvent< | ||
QueryDocumentSnapshot | ||
>> = { | ||
generateMock: getDocumentSnapshotCloudEventWithAuthContext, | ||
match(cloudFunction: CloudFunction<CloudEvent<unknown>>): boolean { | ||
return ( | ||
getEventType(cloudFunction) === | ||
'google.cloud.firestore.document.v1.deleted.withAuthContext' | ||
); | ||
}, | ||
}; |
22 changes: 22 additions & 0 deletions
22
src/cloudevent/mocks/firestore/firestore-on-document-updated-with-auth-context.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { MockCloudEventAbstractFactory } from '../../types'; | ||
import { | ||
Change, | ||
CloudEvent, | ||
CloudFunction, | ||
firestore, | ||
} from 'firebase-functions/v2'; | ||
import { getEventType } from '../helpers'; | ||
import { QueryDocumentSnapshot } from 'firebase-admin/firestore'; | ||
import { getDocumentSnapshotChangeCloudEventWithAuthContext } from './helpers'; | ||
|
||
export const firestoreOnDocumentUpdatedWithAuthContext: MockCloudEventAbstractFactory<firestore.FirestoreAuthEvent< | ||
Change<QueryDocumentSnapshot> | ||
>> = { | ||
generateMock: getDocumentSnapshotChangeCloudEventWithAuthContext, | ||
match(cloudFunction: CloudFunction<CloudEvent<unknown>>): boolean { | ||
return ( | ||
getEventType(cloudFunction) === | ||
'google.cloud.firestore.document.v1.updated.withAuthContext' | ||
); | ||
}, | ||
}; |
22 changes: 22 additions & 0 deletions
22
src/cloudevent/mocks/firestore/firestore-on-document-written-with-auth-context.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { MockCloudEventAbstractFactory } from '../../types'; | ||
import { | ||
Change, | ||
CloudEvent, | ||
CloudFunction, | ||
firestore, | ||
} from 'firebase-functions/v2'; | ||
import { getEventType } from '../helpers'; | ||
import { DocumentSnapshot } from 'firebase-admin/firestore'; | ||
import { getDocumentSnapshotChangeCloudEventWithAuthContext } from './helpers'; | ||
|
||
export const firestoreOnDocumentWrittenWithAuthContext: MockCloudEventAbstractFactory<firestore.FirestoreAuthEvent< | ||
Change<DocumentSnapshot> | ||
>> = { | ||
generateMock: getDocumentSnapshotChangeCloudEventWithAuthContext, | ||
match(cloudFunction: CloudFunction<CloudEvent<unknown>>): boolean { | ||
return ( | ||
getEventType(cloudFunction) === | ||
'google.cloud.firestore.document.v1.written.withAuthContext' | ||
); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters