-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
63 lines (60 loc) · 1.4 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* @overview Documentation for firebase-admin-util
* @author Krishnan Rajiyah <[email protected]>
*/
// DEPENDENCIES
const db = require("./util/db.js");
const auth = require("./util/auth.js");
const storage = require("./util/storage.js");
const fcm = require("./util/fcm.js");
/**
* Main entry point for firebase-admin-util
* @module index
*/
/**
* Firebase Admin Util
* @param {object} firebase - Firebase Admin SDK instance
* @param {object} schema - Database schema for object mapping
* @example
* // Example schema (showing usage of all types)
* let schema = {
"User": {
"path": "Users",
"fields": {
"name": "string",
"image": "link",
"age": "number",
"isAdmin": "boolean",
"meta": "object",
"dogs": "array:Dogs", // array of keys to Dog objects
"cat": "string:Cats" // key to Cat object
}
}
};
* @example
* // Example schema (showing nested nodes as path)
* let schema = {
"Dog": {
"path": "SomeNode/SomeNode/Dogs",
"fields": {
"name": "string",
"user": "string:Users"
}
},
"Cat": {
"path": "SomeNode/Cats",
"fields": {
"name": "string",
"user": "string:Users"
}
}
};
*/
module.exports = (firebase, schema) => {
return {
db: db(firebase, schema),
auth: auth(firebase),
storage: storage(firebase),
fcm: fcm(firebase)
}
}