nice setup with v2 with typescript and now ready to just hound out functions

This commit is contained in:
Arjun Patel
2022-01-27 17:56:20 -08:00
parent 36092e8af7
commit 1ac2dcc3a6
25 changed files with 14020 additions and 2684 deletions
-5
View File
@@ -1,5 +0,0 @@
{
"projects": {
"default": "nirvana-ccf04"
}
}
-2670
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -0,0 +1,7 @@
{
"projects": {
"default": "nirvana-ccf04",
"nirvana-for-business-dev": "nirvana-for-business"
},
"targets": {}
}
View File
View File
@@ -4,10 +4,7 @@ module.exports = {
es6: true,
node: true,
},
extends: [
"eslint:recommended",
"google",
],
extends: ["eslint:recommended", "google"],
rules: {
quotes: ["error", "double"],
},
+5 -5
View File
@@ -1,16 +1,16 @@
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const functions = require("firebase-functions");
const admin = require("firebase-admin");
var express = require('express');
var express = require("express");
const app = express();
admin.initializeApp();
app.get('/', (req, res) => res.send('Hello World!'));
app.get("/", (req, res) => res.send("Hello World!"));
exports.helloworld = functions.https.onRequest(app);
const agora = require('./agora');
const agora = require("./agora");
exports.agoraToken = functions.https.onCall((data, context) => {
console.log(data);
+6070
View File
File diff suppressed because it is too large Load Diff
+6
View File
@@ -0,0 +1,6 @@
{
"name": "nirvana-cloud-function",
"lockfileVersion": 2,
"requires": true,
"packages": {}
}
+5
View File
@@ -0,0 +1,5 @@
{
"projects": {
"default": "nirvana-for-business"
}
}
+66
View File
@@ -0,0 +1,66 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
firebase-debug.log*
firebase-debug.*.log*
# Firebase cache
.firebase/
# Firebase config
# Uncomment this if you'd like others to create their own Firebase project.
# For a team working on the same Firebase project(s), it is recommended to leave
# it commented so all members can deploy to the same project(s) in .firebaserc.
# .firebaserc
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
+13
View File
@@ -0,0 +1,13 @@
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"functions": {
"predeploy": [
"npm --prefix functions run build",
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
}
}
+83
View File
@@ -0,0 +1,83 @@
{
"indexes": [
{
"collectionGroup": "announcements",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "teamId",
"order": "ASCENDING"
},
{
"fieldPath": "createdDate",
"order": "ASCENDING"
}
]
},
{
"collectionGroup": "audioMessages",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "senderReceiver",
"arrayConfig": "CONTAINS"
},
{
"fieldPath": "createdDate",
"order": "ASCENDING"
}
]
},
{
"collectionGroup": "links",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "teamId",
"order": "ASCENDING"
},
{
"fieldPath": "createdDate",
"order": "DESCENDING"
}
]
},
{
"collectionGroup": "rooms",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "teamId",
"order": "ASCENDING"
},
{
"fieldPath": "type",
"order": "ASCENDING"
},
{
"fieldPath": "createdDate",
"order": "ASCENDING"
}
]
},
{
"collectionGroup": "rooms",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "teamId",
"order": "ASCENDING"
},
{
"fieldPath": "type",
"order": "ASCENDING"
},
{
"fieldPath": "scheduledDateTime",
"order": "ASCENDING"
}
]
}
],
"fieldOverrides": []
}
+9
View File
@@ -0,0 +1,9 @@
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if
request.time < timestamp.date(2022, 2, 12);
}
}
}
+29
View File
@@ -0,0 +1,29 @@
module.exports = {
root: true,
env: {
es6: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"google",
"plugin:@typescript-eslint/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["tsconfig.json", "tsconfig.dev.json"],
sourceType: "module",
tsconfigRootDir: __dirname,
},
ignorePatterns: [
"/lib/**/*", // Ignore built files.
],
plugins: ["@typescript-eslint", "import"],
rules: {
"quotes": ["error", "double"],
"import/no-unresolved": 0,
},
};
+9
View File
@@ -0,0 +1,9 @@
# Compiled JavaScript files
lib/**/*.js
lib/**/*.js.map
# TypeScript v1 declaration files
typings/
# Node.js dependency directory
node_modules/
+7644
View File
File diff suppressed because it is too large Load Diff
+32
View File
@@ -0,0 +1,32 @@
{
"name": "functions",
"scripts": {
"lint": "eslint --ext .js,.ts .",
"build": "npm run lint && tsc",
"serve": "npm run build && firebase emulators:start --only functions & tsc --watch",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log",
"hotReload": "tsc --watch"
},
"engines": {
"node": "16"
},
"main": "lib/index.js",
"dependencies": {
"agora-access-token": "^2.0.4",
"firebase-admin": "^9.8.0",
"firebase-functions": "^3.14.1"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/parser": "^3.8.0",
"eslint": "^7.6.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.22.0",
"firebase-functions-test": "^0.2.0",
"typescript": "^3.8.0"
},
"private": true
}
+23
View File
@@ -0,0 +1,23 @@
import * as functions from "firebase-functions";
import * as admin from "firebase-admin";
admin.initializeApp();
// // Start writing Firebase Functions
// // https://firebase.google.com/docs/functions/typescript
//
export const helloWorld = functions.https.onRequest((request, response) => {
functions.logger.info("Hello no!", {structuredData: true});
response.send("Hello from woahhhhhh!");
});
// exports.agoraToken = functions.https.onCall((data, context) => {
// console.log(data);
// console.log("user's id: " + context.auth?.uid);
// const channelName = data.channelName;
// let token = agora.getAgoraToken(channelName);
// return { token };
// });
+3
View File
@@ -0,0 +1,3 @@
{
"include": [".eslintrc.js"]
}
+15
View File
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2017"
},
"compileOnSave": true,
"include": [
"src"
]
}