From bbd2f6d21bf9990ccf811835b4457c947a83d83c Mon Sep 17 00:00:00 2001 From: Luca Micieli Date: Mon, 14 Aug 2023 14:47:36 +0200 Subject: [PATCH] feat: add login functionality --- bin/dev | 3 +- package.json | 6 +- pnpm-lock.yaml | 779 ++++++++++++++++++++++-- src/application/cloud/auth.ts | 156 +++++ src/application/cloud/firebase.ts | 7 + src/application/cloud/firebaseConfig.ts | 8 + src/commands/login.ts | 15 + src/index.ts | 16 + tsconfig.json | 1 + 9 files changed, 947 insertions(+), 44 deletions(-) create mode 100644 src/application/cloud/auth.ts create mode 100644 src/application/cloud/firebase.ts create mode 100644 src/application/cloud/firebaseConfig.ts create mode 100644 src/commands/login.ts diff --git a/bin/dev b/bin/dev index bbc3f51..dd6bef5 100755 --- a/bin/dev +++ b/bin/dev @@ -1,8 +1,9 @@ #!/usr/bin/env node +const path = require('node:path') +require('dotenv').config({path: path.join(__dirname, '../.env')}) const oclif = require('@oclif/core') -const path = require('path') const project = path.join(__dirname, '..', 'tsconfig.json') // In dev mode -> use ts-node and dev plugins diff --git a/package.json b/package.json index f261d27..0658218 100644 --- a/package.json +++ b/package.json @@ -22,16 +22,20 @@ "/uber-apk-signer.jar" ], "dependencies": { + "@firebase/auth": "^1.1.0", "@oclif/core": "^2", "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^2.3.2", - "@react-native-community/cli-platform-ios": "10.2.0", "@react-native-community/cli-platform-android": "10.2.0", + "@react-native-community/cli-platform-ios": "10.2.0", "@react-native-community/cli-tools": "10.1.1", "axios": "^1.3.4", "chalk": "^4.1.2", + "dotenv": "^16.3.1", + "firebase": "^10.1.0", "ios-deploy": "^1.12.1", "lint-staged": "^13.1.2", + "open": "^8.4.2", "prompts": "^2.4.2" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2a357af..6e0f01e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,15 +1,16 @@ lockfileVersion: 5.4 specifiers: + '@firebase/auth': ^1.1.0 '@oclif/core': ^2 '@oclif/plugin-help': ^5 '@oclif/plugin-plugins': ^2.3.2 '@oclif/test': ^2.3.7 '@react-native-community/cli': ^10.2.0 '@react-native-community/cli-config': ^10.1.1 - '@react-native-community/cli-platform-android': ^10.2.0 - '@react-native-community/cli-platform-ios': ^10.2.0 - '@react-native-community/cli-tools': ^10.1.1 + '@react-native-community/cli-platform-android': 10.2.0 + '@react-native-community/cli-platform-ios': 10.2.0 + '@react-native-community/cli-tools': 10.1.1 '@types/chai': ^4 '@types/mocha': ^9.0.0 '@types/node': ^16.18.12 @@ -17,16 +18,19 @@ specifiers: axios: ^1.3.4 chai: ^4 chalk: ^4.1.2 + dotenv: ^16.3.1 eslint: ^7.32.0 eslint-config-oclif: ^4 eslint-config-oclif-typescript: ^1.0.3 eslint-config-prettier: ^8.6.0 eslint-plugin-prettier: ^4.2.1 + firebase: ^10.1.0 husky: ^8.0.0 ios-deploy: ^1.12.1 lint-staged: ^13.1.2 mocha: ^10.2.0 oclif: ^3 + open: ^8.4.2 prettier: ^2.8.4 prompts: ^2.4.2 shx: ^0.3.3 @@ -35,22 +39,26 @@ specifiers: typescript: ^4.9.5 dependencies: + '@firebase/auth': 1.1.0 '@oclif/core': 2.4.0 '@oclif/plugin-help': 5.2.7 '@oclif/plugin-plugins': 2.3.2 + '@react-native-community/cli-platform-android': 10.2.0 '@react-native-community/cli-platform-ios': 10.2.0 + '@react-native-community/cli-tools': 10.1.1 axios: 1.3.4 chalk: 4.1.2 + dotenv: 16.3.1 + firebase: 10.1.0 ios-deploy: 1.12.1 lint-staged: 13.1.2 + open: 8.4.2 prompts: 2.4.2 devDependencies: '@oclif/test': 2.3.9 '@react-native-community/cli': 10.2.0 '@react-native-community/cli-config': 10.1.1 - '@react-native-community/cli-platform-android': 10.2.0 - '@react-native-community/cli-tools': 10.1.1 '@types/chai': 4.3.4 '@types/mocha': 9.1.1 '@types/node': 16.18.14 @@ -963,10 +971,510 @@ packages: - supports-color dev: true + /@firebase/analytics-compat/0.2.6_pnak6bkhyfsnlfsmqleqiquuiq: + resolution: {integrity: sha512-4MqpVLFkGK7NJf/5wPEEP7ePBJatwYpyjgJ+wQHQGHfzaCDgntOnl9rL2vbVGGKCnRqWtZDIWhctB86UWXaX2Q==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/analytics': 0.10.0_@firebase+app@0.9.15 + '@firebase/analytics-types': 0.8.0 + '@firebase/app-compat': 0.2.15 + '@firebase/component': 0.6.4 + '@firebase/util': 1.9.3 + tslib: 2.5.0 + transitivePeerDependencies: + - '@firebase/app' + dev: false + + /@firebase/analytics-types/0.8.0: + resolution: {integrity: sha512-iRP+QKI2+oz3UAh4nPEq14CsEjrjD6a5+fuypjScisAh9kXKFvdJOZJDwk7kikLvWVLGEs9+kIUS4LPQV7VZVw==} + dev: false + + /@firebase/analytics/0.10.0_@firebase+app@0.9.15: + resolution: {integrity: sha512-Locv8gAqx0e+GX/0SI3dzmBY5e9kjVDtD+3zCFLJ0tH2hJwuCAiL+5WkHuxKj92rqQj/rvkBUCfA1ewlX2hehg==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.15 + '@firebase/component': 0.6.4 + '@firebase/installations': 0.6.4_@firebase+app@0.9.15 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + tslib: 2.5.0 + dev: false + + /@firebase/app-check-compat/0.3.7_pnak6bkhyfsnlfsmqleqiquuiq: + resolution: {integrity: sha512-cW682AxsyP1G+Z0/P7pO/WT2CzYlNxoNe5QejVarW2o5ZxeWSSPAiVEwpEpQR/bUlUmdeWThYTMvBWaopdBsqw==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-check': 0.8.0_@firebase+app@0.9.15 + '@firebase/app-check-types': 0.5.0 + '@firebase/app-compat': 0.2.15 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + tslib: 2.5.0 + transitivePeerDependencies: + - '@firebase/app' + dev: false + + /@firebase/app-check-interop-types/0.3.0: + resolution: {integrity: sha512-xAxHPZPIgFXnI+vb4sbBjZcde7ZluzPPaSK7Lx3/nmuVk4TjZvnL8ONnkd4ERQKL8WePQySU+pRcWkh8rDf5Sg==} + dev: false + + /@firebase/app-check-types/0.5.0: + resolution: {integrity: sha512-uwSUj32Mlubybw7tedRzR24RP8M8JUVR3NPiMk3/Z4bCmgEKTlQBwMXrehDAZ2wF+TsBq0SN1c6ema71U/JPyQ==} + dev: false + + /@firebase/app-check/0.8.0_@firebase+app@0.9.15: + resolution: {integrity: sha512-dRDnhkcaC2FspMiRK/Vbp+PfsOAEP6ZElGm9iGFJ9fDqHoPs0HOPn7dwpJ51lCFi1+2/7n5pRPGhqF/F03I97g==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.15 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + tslib: 2.5.0 + dev: false + + /@firebase/app-compat/0.2.15: + resolution: {integrity: sha512-ttEbOEtO1SSz27cRPrwXAmrqDjdQ33sQc7rqqQuSMUuPRdYCQEcYdqzpkbvqgdkzGksx2kfH4JqQ6R/hI12nDw==} + dependencies: + '@firebase/app': 0.9.15 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + tslib: 2.5.0 + dev: false + + /@firebase/app-types/0.9.0: + resolution: {integrity: sha512-AeweANOIo0Mb8GiYm3xhTEBVCmPwTYAu9Hcd2qSkLuga/6+j9b1Jskl5bpiSQWy9eJ/j5pavxj6eYogmnuzm+Q==} + dev: false + + /@firebase/app/0.9.15: + resolution: {integrity: sha512-xxQi6mkhRjtXeFUwleSF4zU7lwEH+beNhLE7VmkzEzjEsjAS14QPQPZ35gpgSD+/NigOeho7wgEXd4C/bOkRfA==} + dependencies: + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + idb: 7.1.1 + tslib: 2.5.0 + dev: false + + /@firebase/auth-compat/0.4.4_sebcs7nyywpzhjzdr6lzgdy2qe: + resolution: {integrity: sha512-B2DctJDJ05djBwebNEdC3zbKWzKdIdxpbca8u9P/NSjqaJNSFq3fhz8h8bjlS9ufSrxaQWFSJMMH3dRmx3FlEA==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.15 + '@firebase/auth': 1.1.0_@firebase+app@0.9.15 + '@firebase/auth-types': 0.12.0_pe7cbgjgh7vzd7cjsjzacprt4m + '@firebase/component': 0.6.4 + '@firebase/util': 1.9.3 + node-fetch: 2.6.7 + tslib: 2.5.0 + transitivePeerDependencies: + - '@firebase/app' + - '@firebase/app-types' + - encoding + - react-native + dev: false + + /@firebase/auth-interop-types/0.2.1: + resolution: {integrity: sha512-VOaGzKp65MY6P5FI84TfYKBXEPi6LmOCSMMzys6o2BN2LOsqy7pCuZCup7NYnfbk5OkkQKzvIfHOzTm0UDpkyg==} + dev: false + + /@firebase/auth-types/0.12.0_pe7cbgjgh7vzd7cjsjzacprt4m: + resolution: {integrity: sha512-pPwaZt+SPOshK8xNoiQlK5XIrS97kFYc3Rc7xmy373QsOJ9MmqXxLaYssP5Kcds4wd2qK//amx/c+A8O2fVeZA==} + peerDependencies: + '@firebase/app-types': 0.x + '@firebase/util': 1.x + dependencies: + '@firebase/app-types': 0.9.0 + '@firebase/util': 1.9.3 + dev: false + + /@firebase/auth/1.1.0: + resolution: {integrity: sha512-5RJQMXG0p/tSvtqpfM8jA+heELjVCgHHASq3F7NglAa/CWUGCAE4g2F4YDPW5stDkvtKKRez0WYAWnbcuQ5P4w==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + '@react-native-async-storage/async-storage': 1.19.2 + node-fetch: 2.6.7 + tslib: 2.5.0 + transitivePeerDependencies: + - encoding + - react-native + dev: false + + /@firebase/auth/1.1.0_@firebase+app@0.9.15: + resolution: {integrity: sha512-5RJQMXG0p/tSvtqpfM8jA+heELjVCgHHASq3F7NglAa/CWUGCAE4g2F4YDPW5stDkvtKKRez0WYAWnbcuQ5P4w==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.15 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + '@react-native-async-storage/async-storage': 1.19.2 + node-fetch: 2.6.7 + tslib: 2.5.0 + transitivePeerDependencies: + - encoding + - react-native + dev: false + + /@firebase/component/0.6.4: + resolution: {integrity: sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==} + dependencies: + '@firebase/util': 1.9.3 + tslib: 2.5.0 + dev: false + + /@firebase/database-compat/1.0.1: + resolution: {integrity: sha512-ky82yLIboLxtAIWyW/52a6HLMVTzD2kpZlEilVDok73pNPLjkJYowj8iaIWK5nTy7+6Gxt7d00zfjL6zckGdXQ==} + dependencies: + '@firebase/component': 0.6.4 + '@firebase/database': 1.0.1 + '@firebase/database-types': 1.0.0 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + tslib: 2.5.0 + dev: false + + /@firebase/database-types/1.0.0: + resolution: {integrity: sha512-SjnXStoE0Q56HcFgNQ+9SsmJc0c8TqGARdI/T44KXy+Ets3r6x/ivhQozT66bMnCEjJRywYoxNurRTMlZF8VNg==} + dependencies: + '@firebase/app-types': 0.9.0 + '@firebase/util': 1.9.3 + dev: false + + /@firebase/database/1.0.1: + resolution: {integrity: sha512-VAhF7gYwunW4Lw/+RQZvW8dlsf2r0YYqV9W0Gi2Mz8+0TGg1mBJWoUtsHfOr8kPJXhcLsC4eP/z3x6L/Fvjk/A==} + dependencies: + '@firebase/auth-interop-types': 0.2.1 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + faye-websocket: 0.11.4 + tslib: 2.5.0 + dev: false + + /@firebase/firestore-compat/0.3.14_sebcs7nyywpzhjzdr6lzgdy2qe: + resolution: {integrity: sha512-sOjaYefSPXJXdFH6qyxSwJVakEqAAote6jjrJk/ZCoiX90rs9r3yYV90wP4gmaTKyXjkt8EMlwuapekgGsE5Tw==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.15 + '@firebase/component': 0.6.4 + '@firebase/firestore': 4.1.0_@firebase+app@0.9.15 + '@firebase/firestore-types': 3.0.0_pe7cbgjgh7vzd7cjsjzacprt4m + '@firebase/util': 1.9.3 + tslib: 2.5.0 + transitivePeerDependencies: + - '@firebase/app' + - '@firebase/app-types' + - encoding + dev: false + + /@firebase/firestore-types/3.0.0_pe7cbgjgh7vzd7cjsjzacprt4m: + resolution: {integrity: sha512-Meg4cIezHo9zLamw0ymFYBD4SMjLb+ZXIbuN7T7ddXN6MGoICmOTq3/ltdCGoDCS2u+H1XJs2u/cYp75jsX9Qw==} + peerDependencies: + '@firebase/app-types': 0.x + '@firebase/util': 1.x + dependencies: + '@firebase/app-types': 0.9.0 + '@firebase/util': 1.9.3 + dev: false + + /@firebase/firestore/4.1.0_@firebase+app@0.9.15: + resolution: {integrity: sha512-FEd+4R0QL9RAJVcdqXgbdIuQYpvzkeKNBVxNM5qcWDPMurjNpja8VaWpVZmT3JXG8FfO+NGTnHJtsW/nWO7XiQ==} + engines: {node: '>=10.10.0'} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.15 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + '@firebase/webchannel-wrapper': 0.10.1 + '@grpc/grpc-js': 1.8.21 + '@grpc/proto-loader': 0.6.13 + node-fetch: 2.6.7 + tslib: 2.5.0 + transitivePeerDependencies: + - encoding + dev: false + + /@firebase/functions-compat/0.3.5_pnak6bkhyfsnlfsmqleqiquuiq: + resolution: {integrity: sha512-uD4jwgwVqdWf6uc3NRKF8cSZ0JwGqSlyhPgackyUPe+GAtnERpS4+Vr66g0b3Gge0ezG4iyHo/EXW/Hjx7QhHw==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.15 + '@firebase/component': 0.6.4 + '@firebase/functions': 0.10.0_@firebase+app@0.9.15 + '@firebase/functions-types': 0.6.0 + '@firebase/util': 1.9.3 + tslib: 2.5.0 + transitivePeerDependencies: + - '@firebase/app' + - encoding + dev: false + + /@firebase/functions-types/0.6.0: + resolution: {integrity: sha512-hfEw5VJtgWXIRf92ImLkgENqpL6IWpYaXVYiRkFY1jJ9+6tIhWM7IzzwbevwIIud/jaxKVdRzD7QBWfPmkwCYw==} + dev: false + + /@firebase/functions/0.10.0_@firebase+app@0.9.15: + resolution: {integrity: sha512-2U+fMNxTYhtwSpkkR6WbBcuNMOVaI7MaH3cZ6UAeNfj7AgEwHwMIFLPpC13YNZhno219F0lfxzTAA0N62ndWzA==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.15 + '@firebase/app-check-interop-types': 0.3.0 + '@firebase/auth-interop-types': 0.2.1 + '@firebase/component': 0.6.4 + '@firebase/messaging-interop-types': 0.2.0 + '@firebase/util': 1.9.3 + node-fetch: 2.6.7 + tslib: 2.5.0 + transitivePeerDependencies: + - encoding + dev: false + + /@firebase/installations-compat/0.2.4_sebcs7nyywpzhjzdr6lzgdy2qe: + resolution: {integrity: sha512-LI9dYjp0aT9Njkn9U4JRrDqQ6KXeAmFbRC0E7jI7+hxl5YmRWysq5qgQl22hcWpTk+cm3es66d/apoDU/A9n6Q==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.15 + '@firebase/component': 0.6.4 + '@firebase/installations': 0.6.4_@firebase+app@0.9.15 + '@firebase/installations-types': 0.5.0_@firebase+app-types@0.9.0 + '@firebase/util': 1.9.3 + tslib: 2.5.0 + transitivePeerDependencies: + - '@firebase/app' + - '@firebase/app-types' + dev: false + + /@firebase/installations-types/0.5.0_@firebase+app-types@0.9.0: + resolution: {integrity: sha512-9DP+RGfzoI2jH7gY4SlzqvZ+hr7gYzPODrbzVD82Y12kScZ6ZpRg/i3j6rleto8vTFC8n6Len4560FnV1w2IRg==} + peerDependencies: + '@firebase/app-types': 0.x + dependencies: + '@firebase/app-types': 0.9.0 + dev: false + + /@firebase/installations/0.6.4_@firebase+app@0.9.15: + resolution: {integrity: sha512-u5y88rtsp7NYkCHC3ElbFBrPtieUybZluXyzl7+4BsIz4sqb4vSAuwHEUgCgCeaQhvsnxDEU6icly8U9zsJigA==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.15 + '@firebase/component': 0.6.4 + '@firebase/util': 1.9.3 + idb: 7.0.1 + tslib: 2.5.0 + dev: false + + /@firebase/logger/0.4.0: + resolution: {integrity: sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==} + dependencies: + tslib: 2.5.0 + dev: false + + /@firebase/messaging-compat/0.2.4_pnak6bkhyfsnlfsmqleqiquuiq: + resolution: {integrity: sha512-lyFjeUhIsPRYDPNIkYX1LcZMpoVbBWXX4rPl7c/rqc7G+EUea7IEtSt4MxTvh6fDfPuzLn7+FZADfscC+tNMfg==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.15 + '@firebase/component': 0.6.4 + '@firebase/messaging': 0.12.4_@firebase+app@0.9.15 + '@firebase/util': 1.9.3 + tslib: 2.5.0 + transitivePeerDependencies: + - '@firebase/app' + dev: false + + /@firebase/messaging-interop-types/0.2.0: + resolution: {integrity: sha512-ujA8dcRuVeBixGR9CtegfpU4YmZf3Lt7QYkcj693FFannwNuZgfAYaTmbJ40dtjB81SAu6tbFPL9YLNT15KmOQ==} + dev: false + + /@firebase/messaging/0.12.4_@firebase+app@0.9.15: + resolution: {integrity: sha512-6JLZct6zUaex4g7HI3QbzeUrg9xcnmDAPTWpkoMpd/GoSVWH98zDoWXMGrcvHeCAIsLpFMe4MPoZkJbrPhaASw==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.15 + '@firebase/component': 0.6.4 + '@firebase/installations': 0.6.4_@firebase+app@0.9.15 + '@firebase/messaging-interop-types': 0.2.0 + '@firebase/util': 1.9.3 + idb: 7.0.1 + tslib: 2.5.0 + dev: false + + /@firebase/performance-compat/0.2.4_pnak6bkhyfsnlfsmqleqiquuiq: + resolution: {integrity: sha512-nnHUb8uP9G8islzcld/k6Bg5RhX62VpbAb/Anj7IXs/hp32Eb2LqFPZK4sy3pKkBUO5wcrlRWQa6wKOxqlUqsg==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.15 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/performance': 0.6.4_@firebase+app@0.9.15 + '@firebase/performance-types': 0.2.0 + '@firebase/util': 1.9.3 + tslib: 2.5.0 + transitivePeerDependencies: + - '@firebase/app' + dev: false + + /@firebase/performance-types/0.2.0: + resolution: {integrity: sha512-kYrbr8e/CYr1KLrLYZZt2noNnf+pRwDq2KK9Au9jHrBMnb0/C9X9yWSXmZkFt4UIdsQknBq8uBB7fsybZdOBTA==} + dev: false + + /@firebase/performance/0.6.4_@firebase+app@0.9.15: + resolution: {integrity: sha512-HfTn/bd8mfy/61vEqaBelNiNnvAbUtME2S25A67Nb34zVuCSCRIX4SseXY6zBnOFj3oLisaEqhVcJmVPAej67g==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.15 + '@firebase/component': 0.6.4 + '@firebase/installations': 0.6.4_@firebase+app@0.9.15 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + tslib: 2.5.0 + dev: false + + /@firebase/remote-config-compat/0.2.4_pnak6bkhyfsnlfsmqleqiquuiq: + resolution: {integrity: sha512-FKiki53jZirrDFkBHglB3C07j5wBpitAaj8kLME6g8Mx+aq7u9P7qfmuSRytiOItADhWUj7O1JIv7n9q87SuwA==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.15 + '@firebase/component': 0.6.4 + '@firebase/logger': 0.4.0 + '@firebase/remote-config': 0.4.4_@firebase+app@0.9.15 + '@firebase/remote-config-types': 0.3.0 + '@firebase/util': 1.9.3 + tslib: 2.5.0 + transitivePeerDependencies: + - '@firebase/app' + dev: false + + /@firebase/remote-config-types/0.3.0: + resolution: {integrity: sha512-RtEH4vdcbXZuZWRZbIRmQVBNsE7VDQpet2qFvq6vwKLBIQRQR5Kh58M4ok3A3US8Sr3rubYnaGqZSurCwI8uMA==} + dev: false + + /@firebase/remote-config/0.4.4_@firebase+app@0.9.15: + resolution: {integrity: sha512-x1ioTHGX8ZwDSTOVp8PBLv2/wfwKzb4pxi0gFezS5GCJwbLlloUH4YYZHHS83IPxnua8b6l0IXUaWd0RgbWwzQ==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.15 + '@firebase/component': 0.6.4 + '@firebase/installations': 0.6.4_@firebase+app@0.9.15 + '@firebase/logger': 0.4.0 + '@firebase/util': 1.9.3 + tslib: 2.5.0 + dev: false + + /@firebase/storage-compat/0.3.2_sebcs7nyywpzhjzdr6lzgdy2qe: + resolution: {integrity: sha512-wvsXlLa9DVOMQJckbDNhXKKxRNNewyUhhbXev3t8kSgoCotd1v3MmqhKKz93ePhDnhHnDs7bYHy+Qa8dRY6BXw==} + peerDependencies: + '@firebase/app-compat': 0.x + dependencies: + '@firebase/app-compat': 0.2.15 + '@firebase/component': 0.6.4 + '@firebase/storage': 0.11.2_@firebase+app@0.9.15 + '@firebase/storage-types': 0.8.0_pe7cbgjgh7vzd7cjsjzacprt4m + '@firebase/util': 1.9.3 + tslib: 2.5.0 + transitivePeerDependencies: + - '@firebase/app' + - '@firebase/app-types' + - encoding + dev: false + + /@firebase/storage-types/0.8.0_pe7cbgjgh7vzd7cjsjzacprt4m: + resolution: {integrity: sha512-isRHcGrTs9kITJC0AVehHfpraWFui39MPaU7Eo8QfWlqW7YPymBmRgjDrlOgFdURh6Cdeg07zmkLP5tzTKRSpg==} + peerDependencies: + '@firebase/app-types': 0.x + '@firebase/util': 1.x + dependencies: + '@firebase/app-types': 0.9.0 + '@firebase/util': 1.9.3 + dev: false + + /@firebase/storage/0.11.2_@firebase+app@0.9.15: + resolution: {integrity: sha512-CtvoFaBI4hGXlXbaCHf8humajkbXhs39Nbh6MbNxtwJiCqxPy9iH3D3CCfXAvP0QvAAwmJUTK3+z9a++Kc4nkA==} + peerDependencies: + '@firebase/app': 0.x + dependencies: + '@firebase/app': 0.9.15 + '@firebase/component': 0.6.4 + '@firebase/util': 1.9.3 + node-fetch: 2.6.7 + tslib: 2.5.0 + transitivePeerDependencies: + - encoding + dev: false + + /@firebase/util/1.9.3: + resolution: {integrity: sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==} + dependencies: + tslib: 2.5.0 + dev: false + + /@firebase/webchannel-wrapper/0.10.1: + resolution: {integrity: sha512-Dq5rYfEpdeel0bLVN+nfD1VWmzCkK+pJbSjIawGE+RY4+NIJqhbUDDQjvV0NUK84fMfwxvtFoCtEe70HfZjFcw==} + dev: false + /@gar/promisify/1.1.3: resolution: {integrity: sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==} dev: true + /@grpc/grpc-js/1.8.21: + resolution: {integrity: sha512-KeyQeZpxeEBSqFVTi3q2K7PiPXmgBfECc4updA1ejCLjYmoAlvvM3ZMp5ztTDUCUQmoY3CpDxvchjO1+rFkoHg==} + engines: {node: ^8.13.0 || >=10.10.0} + dependencies: + '@grpc/proto-loader': 0.7.8 + '@types/node': 16.18.14 + dev: false + + /@grpc/proto-loader/0.6.13: + resolution: {integrity: sha512-FjxPYDRTn6Ec3V0arm1FtSpmP6V50wuph2yILpyvTKzjc76oDdoihXqM1DzOW5ubvCC8GivfCnNtfaRE8myJ7g==} + engines: {node: '>=6'} + hasBin: true + dependencies: + '@types/long': 4.0.2 + lodash.camelcase: 4.3.0 + long: 4.0.0 + protobufjs: 6.11.4 + yargs: 16.2.0 + dev: false + + /@grpc/proto-loader/0.7.8: + resolution: {integrity: sha512-GU12e2c8dmdXb7XUlOgYWZ2o2i+z9/VeACkxTA/zzAe2IjclC5PnVL0lpgjhrqfpDYHzM8B1TF6pqWegMYAzlA==} + engines: {node: '>=6'} + hasBin: true + dependencies: + '@types/long': 4.0.2 + lodash.camelcase: 4.3.0 + long: 4.0.0 + protobufjs: 7.2.4 + yargs: 17.7.2 + dev: false + /@hapi/hoek/9.3.0: resolution: {integrity: sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==} dev: true @@ -1458,6 +1966,57 @@ packages: '@octokit/openapi-types': 12.11.0 dev: true + /@protobufjs/aspromise/1.1.2: + resolution: {integrity: sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==} + dev: false + + /@protobufjs/base64/1.1.2: + resolution: {integrity: sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==} + dev: false + + /@protobufjs/codegen/2.0.4: + resolution: {integrity: sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==} + dev: false + + /@protobufjs/eventemitter/1.1.0: + resolution: {integrity: sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==} + dev: false + + /@protobufjs/fetch/1.1.0: + resolution: {integrity: sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==} + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/inquire': 1.1.0 + dev: false + + /@protobufjs/float/1.0.2: + resolution: {integrity: sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==} + dev: false + + /@protobufjs/inquire/1.1.0: + resolution: {integrity: sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==} + dev: false + + /@protobufjs/path/1.1.2: + resolution: {integrity: sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==} + dev: false + + /@protobufjs/pool/1.1.0: + resolution: {integrity: sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==} + dev: false + + /@protobufjs/utf8/1.1.0: + resolution: {integrity: sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==} + dev: false + + /@react-native-async-storage/async-storage/1.19.2: + resolution: {integrity: sha512-7jTQKbT3BdhFHQMnfElsLeeyVqNICv72lPKbeNHnNgLP9eH3+Yk1GFMWWb7A8qRMYianSmwmx1cYofNe9H9hLQ==} + peerDependencies: + react-native: ^0.0.0-0 || 0.60 - 0.72 || 1000.0.0 + dependencies: + merge-options: 3.0.4 + dev: false + /@react-native-community/cli-clean/10.1.1: resolution: {integrity: sha512-iNsrjzjIRv9yb5y309SWJ8NDHdwYtnCpmxZouQDyOljUdC9MwdZ4ChbtA4rwQyAwgOVfS9F/j56ML3Cslmvrxg==} dependencies: @@ -1535,7 +2094,6 @@ packages: logkitty: 0.7.1 transitivePeerDependencies: - encoding - dev: true /@react-native-community/cli-platform-ios/10.2.0: resolution: {integrity: sha512-hIPK3iL/mL+0ChXmQ9uqqzNOKA48H+TAzg+hrxQLll/6dNMxDeK9/wZpktcsh8w+CyhqzKqVernGcQs7tPeKGw==} @@ -1747,6 +2305,10 @@ packages: resolution: {integrity: sha512-BdZ5BCCvho3EIXw6wUCXHe7rS53AIDPLE+JzwgT+OsJk53oBfbSmZZ7CX4VaRoN78N+TJpFi9QPlfIVNmJYWxQ==} dev: true + /@types/long/4.0.2: + resolution: {integrity: sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==} + dev: false + /@types/minimatch/3.0.5: resolution: {integrity: sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==} dev: true @@ -2037,7 +2599,6 @@ packages: colorette: 1.4.0 slice-ansi: 2.1.0 strip-ansi: 5.2.0 - dev: true /ansi-regex/2.1.1: resolution: {integrity: sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==} @@ -2052,7 +2613,6 @@ packages: /ansi-regex/4.1.1: resolution: {integrity: sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==} engines: {node: '>=6'} - dev: true /ansi-regex/5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} @@ -2073,7 +2633,6 @@ packages: engines: {node: '>=4'} dependencies: color-convert: 1.9.3 - dev: true /ansi-styles/4.3.0: resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} @@ -2158,7 +2717,6 @@ packages: /astral-regex/1.0.0: resolution: {integrity: sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==} engines: {node: '>=4'} - dev: true /astral-regex/2.0.0: resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==} @@ -2496,7 +3054,6 @@ packages: /camelcase/5.3.1: resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==} engines: {node: '>=6'} - dev: true /camelcase/6.3.0: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} @@ -2663,7 +3220,6 @@ packages: string-width: 4.2.3 strip-ansi: 6.0.1 wrap-ansi: 6.2.0 - dev: true /cliui/7.0.4: resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} @@ -2671,7 +3227,6 @@ packages: string-width: 4.2.3 strip-ansi: 6.0.1 wrap-ansi: 7.0.0 - dev: true /cliui/8.0.1: resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} @@ -2680,7 +3235,6 @@ packages: string-width: 4.2.3 strip-ansi: 6.0.1 wrap-ansi: 7.0.0 - dev: true /clone-buffer/1.0.0: resolution: {integrity: sha512-KLLTJWrvwIP+OPfMn0x2PheDEP20RPUcGXj/ERegTgdmPEZylALQldygiqrPPu8P45uNuPs7ckmReLY6v/iA5g==} @@ -2730,7 +3284,6 @@ packages: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} dependencies: color-name: 1.1.3 - dev: true /color-convert/2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} @@ -2740,7 +3293,6 @@ packages: /color-name/1.1.3: resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} - dev: true /color-name/1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} @@ -2752,7 +3304,6 @@ packages: /colorette/1.4.0: resolution: {integrity: sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==} - dev: true /colorette/2.0.19: resolution: {integrity: sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==} @@ -2926,7 +3477,6 @@ packages: /dayjs/1.11.7: resolution: {integrity: sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==} - dev: true /debug/2.6.9: resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} @@ -2969,7 +3519,6 @@ packages: /decamelize/1.2.0: resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==} engines: {node: '>=0.10.0'} - dev: true /decamelize/4.0.0: resolution: {integrity: sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==} @@ -3014,6 +3563,11 @@ packages: engines: {node: '>=10'} dev: true + /define-lazy-prop/2.0.0: + resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==} + engines: {node: '>=8'} + dev: false + /delayed-stream/1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} @@ -3081,6 +3635,11 @@ packages: esutils: 2.0.3 dev: true + /dotenv/16.3.1: + resolution: {integrity: sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==} + engines: {node: '>=12'} + dev: false + /eastasianwidth/0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} dev: false @@ -3173,7 +3732,6 @@ packages: /escalade/3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} - dev: true /escape-html/1.0.3: resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} @@ -3618,6 +4176,13 @@ packages: dependencies: reusify: 1.0.4 + /faye-websocket/0.11.4: + resolution: {integrity: sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g==} + engines: {node: '>=0.8.0'} + dependencies: + websocket-driver: 0.7.4 + dev: false + /fb-watchman/2.0.2: resolution: {integrity: sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==} dependencies: @@ -3670,7 +4235,6 @@ packages: dependencies: locate-path: 5.0.0 path-exists: 4.0.0 - dev: true /find-up/5.0.0: resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} @@ -3692,6 +4256,40 @@ packages: pkg-dir: 4.2.0 dev: true + /firebase/10.1.0: + resolution: {integrity: sha512-ghcdCe2G9DeGmLOrBgR7XPswuc9BFUfjnU93ABopIisMfbJFzoqpSp4emwNiZt+vVGZV1ifeU3DLfhxlujxhCg==} + dependencies: + '@firebase/analytics': 0.10.0_@firebase+app@0.9.15 + '@firebase/analytics-compat': 0.2.6_pnak6bkhyfsnlfsmqleqiquuiq + '@firebase/app': 0.9.15 + '@firebase/app-check': 0.8.0_@firebase+app@0.9.15 + '@firebase/app-check-compat': 0.3.7_pnak6bkhyfsnlfsmqleqiquuiq + '@firebase/app-compat': 0.2.15 + '@firebase/app-types': 0.9.0 + '@firebase/auth': 1.1.0_@firebase+app@0.9.15 + '@firebase/auth-compat': 0.4.4_sebcs7nyywpzhjzdr6lzgdy2qe + '@firebase/database': 1.0.1 + '@firebase/database-compat': 1.0.1 + '@firebase/firestore': 4.1.0_@firebase+app@0.9.15 + '@firebase/firestore-compat': 0.3.14_sebcs7nyywpzhjzdr6lzgdy2qe + '@firebase/functions': 0.10.0_@firebase+app@0.9.15 + '@firebase/functions-compat': 0.3.5_pnak6bkhyfsnlfsmqleqiquuiq + '@firebase/installations': 0.6.4_@firebase+app@0.9.15 + '@firebase/installations-compat': 0.2.4_sebcs7nyywpzhjzdr6lzgdy2qe + '@firebase/messaging': 0.12.4_@firebase+app@0.9.15 + '@firebase/messaging-compat': 0.2.4_pnak6bkhyfsnlfsmqleqiquuiq + '@firebase/performance': 0.6.4_@firebase+app@0.9.15 + '@firebase/performance-compat': 0.2.4_pnak6bkhyfsnlfsmqleqiquuiq + '@firebase/remote-config': 0.4.4_@firebase+app@0.9.15 + '@firebase/remote-config-compat': 0.2.4_pnak6bkhyfsnlfsmqleqiquuiq + '@firebase/storage': 0.11.2_@firebase+app@0.9.15 + '@firebase/storage-compat': 0.3.2_sebcs7nyywpzhjzdr6lzgdy2qe + '@firebase/util': 1.9.3 + transitivePeerDependencies: + - encoding + - react-native + dev: false + /first-chunk-stream/2.0.0: resolution: {integrity: sha512-X8Z+b/0L4lToKYq+lwnKqi9X/Zek0NibLpsJgVsSxpoYq7JtiCtRb5HqKVEjEw/qAb/4AKKRLOwwKHlWNpm2Eg==} engines: {node: '>=0.10.0'} @@ -3827,7 +4425,6 @@ packages: /get-caller-file/2.0.5: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} - dev: true /get-func-name/2.0.0: resolution: {integrity: sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==} @@ -4072,6 +4669,10 @@ packages: toidentifier: 1.0.1 dev: true + /http-parser-js/0.5.8: + resolution: {integrity: sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q==} + dev: false + /http-proxy-agent/4.0.1: resolution: {integrity: sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==} engines: {node: '>= 6'} @@ -4153,6 +4754,14 @@ packages: dev: true optional: true + /idb/7.0.1: + resolution: {integrity: sha512-UUxlE7vGWK5RfB/fDwEGgRf84DY/ieqNha6msMV99UsEMQhJ1RwbCd8AYBj3QMgnE3VZnfQvm4oKVCJTYlqIgg==} + dev: false + + /idb/7.1.1: + resolution: {integrity: sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==} + dev: false + /ieee754/1.1.13: resolution: {integrity: sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==} dev: true @@ -4327,7 +4936,6 @@ packages: /is-fullwidth-code-point/2.0.0: resolution: {integrity: sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==} engines: {node: '>=4'} - dev: true /is-fullwidth-code-point/3.0.0: resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} @@ -4366,7 +4974,6 @@ packages: /is-plain-obj/2.1.0: resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} engines: {node: '>=8'} - dev: true /is-plain-object/5.0.0: resolution: {integrity: sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==} @@ -4711,7 +5318,6 @@ packages: engines: {node: '>=8'} dependencies: p-locate: 4.1.0 - dev: true /locate-path/6.0.0: resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} @@ -4719,6 +5325,10 @@ packages: dependencies: p-locate: 5.0.0 + /lodash.camelcase/4.3.0: + resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==} + dev: false + /lodash.debounce/4.0.8: resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==} dev: true @@ -4763,7 +5373,14 @@ packages: ansi-fragments: 0.2.1 dayjs: 1.11.7 yargs: 15.4.1 - dev: true + + /long/4.0.0: + resolution: {integrity: sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==} + dev: false + + /long/5.2.3: + resolution: {integrity: sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==} + dev: false /loose-envify/1.4.0: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} @@ -4913,6 +5530,13 @@ packages: vinyl-file: 3.0.0 dev: true + /merge-options/3.0.4: + resolution: {integrity: sha512-2Sug1+knBjkaMsMgf1ctR1Ujx+Ayku4EdJN4Z+C2+JzoeF7A3OZ9KM2GY0CpQS51NR61LTurMJrRKPhSs3ZRTQ==} + engines: {node: '>=10'} + dependencies: + is-plain-obj: 2.1.0 + dev: false + /merge-stream/2.0.0: resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} @@ -5483,6 +6107,18 @@ packages: - supports-color dev: true + /node-fetch/2.6.7: + resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + dependencies: + whatwg-url: 5.0.0 + dev: false + /node-fetch/2.6.9: resolution: {integrity: sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==} engines: {node: 4.x || >=6.0.0} @@ -5767,6 +6403,15 @@ packages: dependencies: is-wsl: 1.1.0 + /open/8.4.2: + resolution: {integrity: sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==} + engines: {node: '>=12'} + dependencies: + define-lazy-prop: 2.0.0 + is-docker: 2.2.1 + is-wsl: 2.2.0 + dev: false + /optionator/0.9.1: resolution: {integrity: sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==} engines: {node: '>= 0.8.0'} @@ -5812,7 +6457,6 @@ packages: engines: {node: '>=6'} dependencies: p-try: 2.2.0 - dev: true /p-limit/3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} @@ -5825,7 +6469,6 @@ packages: engines: {node: '>=8'} dependencies: p-limit: 2.3.0 - dev: true /p-locate/5.0.0: resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} @@ -5867,7 +6510,6 @@ packages: /p-try/2.2.0: resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} engines: {node: '>=6'} - dev: true /pacote/12.0.3: resolution: {integrity: sha512-CdYEl03JDrRO3x18uHjBYA9TyoW8gy+ThVcypcDkxPtKlw76e4ejhYB6i9lJ+/cebbjpqPW/CijjqxwDTts8Ow==} @@ -6107,6 +6749,45 @@ packages: engines: {node: '>= 8'} dev: true + /protobufjs/6.11.4: + resolution: {integrity: sha512-5kQWPaJHi1WoCpjTGszzQ32PG2F4+wRY6BmAT4Vfw56Q2FZ4YZzK20xUYQH4YkfehY1e6QSICrJquM6xXZNcrw==} + hasBin: true + requiresBuild: true + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/base64': 1.1.2 + '@protobufjs/codegen': 2.0.4 + '@protobufjs/eventemitter': 1.1.0 + '@protobufjs/fetch': 1.1.0 + '@protobufjs/float': 1.0.2 + '@protobufjs/inquire': 1.1.0 + '@protobufjs/path': 1.1.2 + '@protobufjs/pool': 1.1.0 + '@protobufjs/utf8': 1.1.0 + '@types/long': 4.0.2 + '@types/node': 16.18.14 + long: 4.0.0 + dev: false + + /protobufjs/7.2.4: + resolution: {integrity: sha512-AT+RJgD2sH8phPmCf7OUZR8xGdcJRga4+1cOaXJ64hvcSkVhNcRHOwIxUatPH15+nj59WAGTDv3LSGZPEQbJaQ==} + engines: {node: '>=12.0.0'} + requiresBuild: true + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/base64': 1.1.2 + '@protobufjs/codegen': 2.0.4 + '@protobufjs/eventemitter': 1.1.0 + '@protobufjs/fetch': 1.1.0 + '@protobufjs/float': 1.0.2 + '@protobufjs/inquire': 1.1.0 + '@protobufjs/path': 1.1.2 + '@protobufjs/pool': 1.1.0 + '@protobufjs/utf8': 1.1.0 + '@types/node': 16.18.14 + long: 5.2.3 + dev: false + /proxy-from-env/1.1.0: resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} dev: false @@ -6305,7 +6986,6 @@ packages: /require-directory/2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} - dev: true /require-from-string/2.0.2: resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} @@ -6314,7 +6994,6 @@ packages: /require-main-filename/2.0.0: resolution: {integrity: sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==} - dev: true /resolve-alpn/1.2.1: resolution: {integrity: sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==} @@ -6479,7 +7158,6 @@ packages: /set-blocking/2.0.0: resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} - dev: true /setprototypeof/1.2.0: resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} @@ -6544,7 +7222,6 @@ packages: ansi-styles: 3.2.1 astral-regex: 1.0.0 is-fullwidth-code-point: 2.0.0 - dev: true /slice-ansi/3.0.0: resolution: {integrity: sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==} @@ -6771,7 +7448,6 @@ packages: engines: {node: '>=6'} dependencies: ansi-regex: 4.1.1 - dev: true /strip-ansi/6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} @@ -7280,6 +7956,20 @@ packages: /webidl-conversions/3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + /websocket-driver/0.7.4: + resolution: {integrity: sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==} + engines: {node: '>=0.8.0'} + dependencies: + http-parser-js: 0.5.8 + safe-buffer: 5.2.1 + websocket-extensions: 0.1.4 + dev: false + + /websocket-extensions/0.1.4: + resolution: {integrity: sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==} + engines: {node: '>=0.8.0'} + dev: false + /whatwg-url/5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} dependencies: @@ -7288,7 +7978,6 @@ packages: /which-module/2.0.0: resolution: {integrity: sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==} - dev: true /which-pm/2.0.0: resolution: {integrity: sha512-Lhs9Pmyph0p5n5Z3mVnN0yWcbQYUAD7rbQUiMsQxOJ3T57k7RFe35SUwWMf7dsbDZks1uOmw4AecB/JMDj3v/w==} @@ -7414,12 +8103,10 @@ packages: /y18n/4.0.3: resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==} - dev: true /y18n/5.0.8: resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} engines: {node: '>=10'} - dev: true /yallist/3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} @@ -7439,17 +8126,14 @@ packages: dependencies: camelcase: 5.3.1 decamelize: 1.2.0 - dev: true /yargs-parser/20.2.4: resolution: {integrity: sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==} engines: {node: '>=10'} - dev: true /yargs-parser/21.1.1: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} - dev: true /yargs-unparser/2.0.0: resolution: {integrity: sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==} @@ -7476,7 +8160,6 @@ packages: which-module: 2.0.0 y18n: 4.0.3 yargs-parser: 18.1.3 - dev: true /yargs/16.2.0: resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} @@ -7489,7 +8172,6 @@ packages: string-width: 4.2.3 y18n: 5.0.8 yargs-parser: 20.2.4 - dev: true /yargs/17.7.1: resolution: {integrity: sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==} @@ -7504,6 +8186,19 @@ packages: yargs-parser: 21.1.1 dev: true + /yargs/17.7.2: + resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} + engines: {node: '>=12'} + dependencies: + cliui: 8.0.1 + escalade: 3.1.1 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 21.1.1 + dev: false + /yarn/1.22.19: resolution: {integrity: sha512-/0V5q0WbslqnwP91tirOvldvYISzaqhClxzyUKXYxs07yUILIs5jx/k6CFe8bvKSkds5w+eiOqta39Wk3WxdcQ==} engines: {node: '>=4.0.0'} diff --git a/src/application/cloud/auth.ts b/src/application/cloud/auth.ts new file mode 100644 index 0000000..e7b5457 --- /dev/null +++ b/src/application/cloud/auth.ts @@ -0,0 +1,156 @@ +import * as fs from 'node:fs'; +import path from 'node:path'; +import http from 'node:http'; +import https from 'node:https'; +import querystring from 'node:querystring'; +import open from 'open'; +import './firebase'; + +import { getAuth, GoogleAuthProvider, signInWithCredential, User } from 'firebase/auth'; +import { getRootDestinationFolder } from '../utils'; +import { UserImpl } from '@firebase/auth/internal'; + +function fetchWithFormData(url: string, formData: string): Promise { + return new Promise((resolve, reject) => { + const requestOptions: http.RequestOptions = { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + }; + + const req = https.request(url, requestOptions, res => { + let data = ''; + + res.on('data', chunk => { + data += chunk; + }); + + res.on('end', () => { + const responseData = JSON.parse(data); + resolve(responseData); + }); + }); + + req.on('error', error => { + reject(error); + }); + + req.write(formData); + req.end(); + }); +} + +const CLIENT_ID = process.env.GOOGLE_CLIENT_ID; +const PORT = 3004; // Change this to the desired port number +const redirectUri = 'http://localhost:3004'; // This should be a page in your application that handles the authentication response. + +async function getAuthTokensFromFile() { + if (fs.existsSync(getTokenCacheFile())) { + const tokens = JSON.parse(fs.readFileSync(getTokenCacheFile(), 'utf-8')); + return tokens; + } + return null; +} + +function getTokenCacheFile() { + return path.join(getRootDestinationFolder(), 'auth-tokens.json'); +} + +async function saveTokensToFile(tokens: any) { + fs.writeFileSync(getTokenCacheFile(), JSON.stringify(tokens)); +} + +export async function restoreUser() { + const userData = await getAuthTokensFromFile(); + if (userData) { + const user: User = UserImpl._fromJSON(getAuth() as any, userData); + await getAuth().updateCurrentUser(user); + + await getAuth().currentUser?.reload(); + console.log('userCredential', user); + } else { + throw new Error('No tokens found'); + } +} + +async function handleLoginWithCode(code: string, res: http.ServerResponse, server: http.Server, resolve: () => void) { + const tokenUrl = 'https://oauth2.googleapis.com/token'; + + const tokenRequestBody = querystring.stringify({ + code, + client_id: CLIENT_ID, + client_secret: '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', + redirect_uri: 'http://localhost:3004', + grant_type: 'authorization_code', + }); + + fetchWithFormData(tokenUrl, tokenRequestBody) + .then(data => { + if (data.id_token) { + const idToken = data.id_token; + console.log('Received ID token:', idToken); + + // Build Firebase credential with the Google ID token. + const credential = GoogleAuthProvider.credential(idToken); + + // Sign in with credential from the Google user. + const auth = getAuth(); + signInWithCredential(auth, credential) + .then(userCredential => { + console.log('userCredential', userCredential); + res.writeHead(200, { 'Content-Type': 'text/html' }); + res.end(`Signed in, go back to the cli`); + server.close(); + saveTokensToFile(userCredential.user.toJSON()); + resolve(); + }) + .catch(error => { + // Handle Errors here. + const errorCode = error.code; + const errorMessage = error.message; + // The email of the user's account used. + const email = error.customData.email; + // The AuthCredential type that was used. + const credential = GoogleAuthProvider.credentialFromError(error); + // ... + }); + } else { + console.error('Error fetching ID token:', data.error); + } + }) + .catch((error: any) => { + console.error('Error fetching ID token:', error.message); + }); +} + +export function startListenOnRedirect(resolve: () => void, reject: (err: any) => void) { + const server = http.createServer((req, res) => { + const url = new URL(req.url!, `http://localhost:${PORT}`); + const code = url.searchParams.get('code'); + + if (code) { + handleLoginWithCode(code, res, server, resolve); + } else { + res.writeHead(200, { 'Content-Type': 'text/html' }); + res.end(`Signed in, go back to the cli`); + } + }); + + server.listen(PORT, () => { + console.log(`Server listening on port ${PORT}`); + }); +} + +async function openOauthLogin() { + const googleLoginUrl = `https://accounts.google.com/o/oauth2/auth?client_id=${CLIENT_ID}&redirect_uri=${redirectUri}&response_type=code&scope=profile email`; + + open(googleLoginUrl); +} + +export async function signIn() { + return new Promise((resolve, reject) => { + startListenOnRedirect(resolve, reject); + openOauthLogin(); + }); +} diff --git a/src/application/cloud/firebase.ts b/src/application/cloud/firebase.ts new file mode 100644 index 0000000..2104312 --- /dev/null +++ b/src/application/cloud/firebase.ts @@ -0,0 +1,7 @@ +import { initializeApp } from 'firebase/app'; +import { firebaseConfig } from './firebaseConfig'; + +// Initialize Firebase +const app = initializeApp(firebaseConfig); + +export default app; diff --git a/src/application/cloud/firebaseConfig.ts b/src/application/cloud/firebaseConfig.ts new file mode 100644 index 0000000..6d11132 --- /dev/null +++ b/src/application/cloud/firebaseConfig.ts @@ -0,0 +1,8 @@ +export const firebaseConfig = { + apiKey: process.env.FIREBASE_API_KEY, + authDomain: process.env.FIREBASE_AUTH_DOMAIN, + projectId: process.env.FIREBASE_PROJECT_ID, + storageBucket: process.env.FIREBASE_STORAGE_BUCKET, + messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID, + appId: process.env.FIREBASE_APP_ID, +}; diff --git a/src/commands/login.ts b/src/commands/login.ts new file mode 100644 index 0000000..338b510 --- /dev/null +++ b/src/commands/login.ts @@ -0,0 +1,15 @@ +import { Command } from '@oclif/core'; +import { restoreUser, signIn } from '../application/cloud/auth'; + +export default class Login extends Command { + static description = 'Login to use cloud services'; + + public async run(): Promise { + try { + await restoreUser(); + } catch (ex) { + console.log('Failed to restore user', ex); + await signIn(); + } + } +} diff --git a/src/index.ts b/src/index.ts index d620e70..7f6cb10 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1,17 @@ +import 'dotenv/config'; export { run } from '@oclif/core'; + +declare global { + namespace NodeJS { + interface ProcessEnv { + NODE_ENV: 'development' | 'production' | 'test'; + FIREBASE_API_KEY: string; + FIREBASE_AUTH_DOMAIN: string; + FIREBASE_PROJECT_ID: string; + FIREBASE_STORAGE_BUCKET: string; + FIREBASE_MESSAGING_SENDER_ID: string; + FIREBASE_APP_ID: string; + GOOGLE_CLIENT_ID: string; + } + } +} diff --git a/tsconfig.json b/tsconfig.json index de614dc..6bb8d93 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "declaration": true, + "lib": [], "importHelpers": true, "module": "commonjs", "outDir": "dist",