@edgedev/firebase 2.1.46 → 2.1.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/config.js +10 -13
- package/src/package.json +16 -9
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
-
/* eslint-disable no-undef */
|
|
3
1
|
const functions = require('firebase-functions')
|
|
4
2
|
const { PubSub } = require('@google-cloud/pubsub')
|
|
5
3
|
const admin = require('firebase-admin')
|
|
@@ -22,18 +20,18 @@ const {
|
|
|
22
20
|
FirestoreEvent,
|
|
23
21
|
} = require('firebase-functions/v2/firestore')
|
|
24
22
|
const { logger } = require('firebase-functions/v2')
|
|
25
|
-
const { getFirestore } = require('firebase-admin/firestore')
|
|
23
|
+
const { Firestore, getFirestore } = require('firebase-admin/firestore')
|
|
26
24
|
const twilio = require('twilio')
|
|
27
25
|
const db = getFirestore()
|
|
28
26
|
|
|
29
27
|
// The permissionCheck function
|
|
30
28
|
|
|
31
29
|
const permissions = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
30
|
+
admin: { assign: true, delete: true, read: true, write: true },
|
|
31
|
+
editor: { assign: false, delete: true, read: true, write: true },
|
|
32
|
+
user: { assign: false, delete: false, read: true, write: false },
|
|
33
|
+
writer: { assign: false, delete: false, read: true, write: true },
|
|
34
|
+
}
|
|
37
35
|
|
|
38
36
|
const permissionCheck = async (userId, action, originalFilePath) => {
|
|
39
37
|
// Fetch user document
|
|
@@ -52,16 +50,17 @@ const permissionCheck = async (userId, action, originalFilePath) => {
|
|
|
52
50
|
// Check if the role's collectionPath is a prefix of the collectionPath
|
|
53
51
|
if (collectionPath.startsWith(role.collectionPath)) {
|
|
54
52
|
// Use permissions object instead of fetching collection data
|
|
55
|
-
const rolePermissions = permissions[role.role]
|
|
53
|
+
const rolePermissions = permissions[role.role]
|
|
56
54
|
if (rolePermissions && rolePermissions[action]) {
|
|
57
|
-
return true
|
|
55
|
+
return true
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
}
|
|
61
|
-
return false
|
|
59
|
+
return false
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
module.exports = {
|
|
63
|
+
Firestore,
|
|
65
64
|
pubsub,
|
|
66
65
|
onMessagePublished,
|
|
67
66
|
onRequest,
|
|
@@ -83,5 +82,3 @@ module.exports = {
|
|
|
83
82
|
Storage,
|
|
84
83
|
permissionCheck,
|
|
85
84
|
}
|
|
86
|
-
|
|
87
|
-
|
package/src/package.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "functions",
|
|
3
|
+
"private": true,
|
|
3
4
|
"description": "Cloud Functions for Firebase",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": "18"
|
|
8
|
+
},
|
|
4
9
|
"scripts": {
|
|
5
10
|
"serve": "firebase emulators:start --only functions",
|
|
6
11
|
"shell": "firebase functions:shell",
|
|
@@ -8,19 +13,21 @@
|
|
|
8
13
|
"deploy": "firebase deploy --only functions",
|
|
9
14
|
"logs": "firebase functions:log"
|
|
10
15
|
},
|
|
11
|
-
"engines": {
|
|
12
|
-
"node": "16"
|
|
13
|
-
},
|
|
14
|
-
"main": "index.js",
|
|
15
16
|
"dependencies": {
|
|
16
|
-
"@google-cloud/pubsub": "^4.0
|
|
17
|
+
"@google-cloud/pubsub": "^4.9.0",
|
|
18
|
+
"crypto": "^1.0.1",
|
|
17
19
|
"dotenv": "^16.3.1",
|
|
18
|
-
"
|
|
19
|
-
"firebase-
|
|
20
|
+
"exceljs": "^4.4.0",
|
|
21
|
+
"firebase-admin": "^13.0.2",
|
|
22
|
+
"firebase-functions": "^6.2.0",
|
|
23
|
+
"form-data": "^4.0.0",
|
|
24
|
+
"formidable-serverless": "^1.1.1",
|
|
25
|
+
"moment-timezone": "^0.5.43",
|
|
26
|
+
"openai": "^4.11.1",
|
|
27
|
+
"stripe": "^13.8.0",
|
|
20
28
|
"twilio": "^4.18.0"
|
|
21
29
|
},
|
|
22
30
|
"devDependencies": {
|
|
23
31
|
"firebase-functions-test": "^0.2.0"
|
|
24
|
-
}
|
|
25
|
-
"private": true
|
|
32
|
+
}
|
|
26
33
|
}
|