diff --git a/app/build.gradle b/app/build.gradle index f4b646d0..3aadfe29 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -71,7 +71,7 @@ dependencies { implementation 'androidx.core:core-ktx:1.7.0' implementation 'com.google.code.gson:gson:2.9.0' implementation 'androidx.appcompat:appcompat:1.4.1' - implementation 'com.google.android.material:material:1.5.0' + implementation 'com.google.android.material:material:1.6.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation 'com.google.android.gms:play-services-auth:20.2.0' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1' @@ -80,7 +80,7 @@ dependencies { implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2' implementation 'androidx.navigation:navigation-ui-ktx:2.4.2' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'androidx.databinding:databinding-runtime:7.1.3' + implementation 'androidx.databinding:databinding-runtime:7.2.0' implementation 'androidx.fragment:fragment-ktx:1.4.1' testImplementation 'junit:junit:4.13.2' testImplementation 'org.hamcrest:hamcrest:2.2' @@ -106,7 +106,7 @@ dependencies { } // Import the BoM for the Firebase platform - implementation platform('com.google.firebase:firebase-bom:29.3.0') + implementation platform('com.google.firebase:firebase-bom:30.0.1') // Declare the dependency for the Cloud Firestore library // When using the BoM, you don't specify versions in Firebase library dependencies @@ -135,7 +135,7 @@ dependencies { androidTestImplementation "io.mockk:mockk-android:1.12.2" //Declare the dependency for camera related functions - def camerax_version = "1.1.0-beta03" + def camerax_version = "1.1.0-rc01" implementation "androidx.camera:camera-core:${camerax_version}" implementation "androidx.camera:camera-camera2:${camerax_version}" implementation "androidx.camera:camera-lifecycle:${camerax_version}" @@ -148,8 +148,8 @@ dependencies { // For UI dependency implementation 'de.hdodenhof:circleimageview:3.1.0' - implementation("io.coil-kt:coil:2.0.0-rc03") - + implementation('io.coil-kt:coil:2.1.0') + implementation 'com.google.firebase:firebase-appcheck-safetynet:16.0.0' } diff --git a/app/src/main/java/ch/epfl/sweng/rps/LoadingActivity.kt b/app/src/main/java/ch/epfl/sweng/rps/LoadingActivity.kt index 6a57b750..586a8490 100644 --- a/app/src/main/java/ch/epfl/sweng/rps/LoadingActivity.kt +++ b/app/src/main/java/ch/epfl/sweng/rps/LoadingActivity.kt @@ -8,8 +8,11 @@ import android.util.Log import androidx.appcompat.app.AppCompatActivity import ch.epfl.sweng.rps.ui.onboarding.OnBoardingActivity import ch.epfl.sweng.rps.utils.FirebaseEmulatorsUtils +import com.google.firebase.appcheck.FirebaseAppCheck +import com.google.firebase.appcheck.safetynet.SafetyNetAppCheckProviderFactory import com.google.firebase.ktx.Firebase import com.google.firebase.ktx.initialize +import kotlinx.coroutines.delay import kotlinx.coroutines.runBlocking class LoadingActivity : AppCompatActivity() { @@ -19,6 +22,26 @@ class LoadingActivity : AppCompatActivity() { setupApp() } + /** + * Here logic to setup the app + */ + suspend fun logic() { + Log.w("LoadingPage", "logic") + + val isTest = intent.getBooleanExtra("isTest", false) + Firebase.initialize(this@LoadingActivity) + val firebaseAppCheck = FirebaseAppCheck.getInstance() + firebaseAppCheck.installAppCheckProviderFactory( + SafetyNetAppCheckProviderFactory.getInstance() + ) + useEmulatorsIfNeeded() + delay(1000) + if (!isTest) { + openLogin() + finish() + } + } + private fun openLogin() { val intent = Intent(this, LoginActivity::class.java) startActivity(intent) @@ -48,17 +71,6 @@ class LoadingActivity : AppCompatActivity() { } } - /** - * Here logic to setup the app - */ - suspend fun logic() { - Log.w("LoadingPage", "logic") - - Firebase.initialize(this@LoadingActivity) - useEmulatorsIfNeeded() - - - } fun nav() { Log.w("LoadingPage", "nav") @@ -73,7 +85,7 @@ class LoadingActivity : AppCompatActivity() { } } - + private val isTest get() = intent.getBooleanExtra("isTest", false) companion object { diff --git a/app/src/main/java/ch/epfl/sweng/rps/models/Game.kt b/app/src/main/java/ch/epfl/sweng/rps/models/Game.kt index 5da05795..811d82fc 100644 --- a/app/src/main/java/ch/epfl/sweng/rps/models/Game.kt +++ b/app/src/main/java/ch/epfl/sweng/rps/models/Game.kt @@ -1,6 +1,5 @@ package ch.epfl.sweng.rps.models -import android.util.Log import ch.epfl.sweng.rps.models.GameMode.GameEdition import com.google.firebase.Timestamp import com.google.firebase.firestore.DocumentSnapshot @@ -67,21 +66,22 @@ sealed class Game { } companion object { - fun DocumentSnapshot.toGame(): Game? { - val editionString = this["edition"] as String? - val gameMode = this["game_mode"] as String? + + fun fromDocumentSnapshot(document: DocumentSnapshot): Game? { + val editionString = document["edition"] as String? + val gameMode = document["game_mode"] as String? val edition = editionString?.let { GameEdition.valueOf(it) } - ?: gameMode?.let { GameMode.fromString(it).edition } ?: run { - Log.e("Game", "Could not parse edition from document: '${editionString}'") - return null - } + ?: gameMode?.let { GameMode.fromString(it).edition } + ?: throw IllegalArgumentException("Document has no edition or game mode") val type = when (edition) { GameEdition.RockPaperScissors -> Rps::class.java GameEdition.TicTacToe -> TicTacToe::class.java } - return toObject(type) + return document.toObject(type) } + + fun DocumentSnapshot.toGame(): Game? = fromDocumentSnapshot(this) } } diff --git a/app/src/main/java/ch/epfl/sweng/rps/services/FirebaseGameService.kt b/app/src/main/java/ch/epfl/sweng/rps/services/FirebaseGameService.kt index 31ec9c5b..fbbb1413 100644 --- a/app/src/main/java/ch/epfl/sweng/rps/services/FirebaseGameService.kt +++ b/app/src/main/java/ch/epfl/sweng/rps/services/FirebaseGameService.kt @@ -5,6 +5,7 @@ import androidx.annotation.VisibleForTesting import ch.epfl.sweng.rps.db.FirebaseReferences import ch.epfl.sweng.rps.db.FirebaseRepository import ch.epfl.sweng.rps.models.Game +import ch.epfl.sweng.rps.models.Game.Companion.toGame import ch.epfl.sweng.rps.models.Hand import ch.epfl.sweng.rps.models.Round import com.google.firebase.Timestamp @@ -38,7 +39,7 @@ class FirebaseGameService( Log.e("FirebaseGameService", "Error while listening to game $gameId", e) error = e } else { - game = value?.toObject() + game = value?.toGame() } } _active = true diff --git a/app/src/main/java/ch/epfl/sweng/rps/ui/settings/SettingsActivity.kt b/app/src/main/java/ch/epfl/sweng/rps/ui/settings/SettingsActivity.kt index 9167574a..c547c5ec 100644 --- a/app/src/main/java/ch/epfl/sweng/rps/ui/settings/SettingsActivity.kt +++ b/app/src/main/java/ch/epfl/sweng/rps/ui/settings/SettingsActivity.kt @@ -145,8 +145,9 @@ class SettingsActivity : AppCompatActivity(), } joinQueue?.setOnPreferenceClickListener { viewLifecycleOwner.lifecycleScope.launch { + val TAG = "Matchmaking" val games = ServiceLocator.getInstance().repository.myActiveGames() - Log.w("JOIN_QUEUE", "games: $games") + Log.w(TAG, "games: $games") if (games.isNotEmpty()) { Toast.makeText( context, @@ -155,7 +156,7 @@ class SettingsActivity : AppCompatActivity(), ).show() return@launch } - Log.d("JOIN_QUEUE", "Joining queue") + Log.d(TAG, "Joining queue") try { ServiceLocator.getInstance().matchmakingService.queue( GameMode( @@ -166,10 +167,10 @@ class SettingsActivity : AppCompatActivity(), GameMode.GameEdition.RockPaperScissors ) ).collect { - Log.i("QueueStatus", it.toString()) + Log.i(TAG, it.toString()) } } catch (e: Exception) { - Log.e("QueueStatus", e.toString(), e) + Log.e(TAG, e.toString(), e) } } true diff --git a/firebase/functions/.eslintrc.js b/firebase/functions/.eslintrc.js index f9e22b04..2ea65486 100644 --- a/firebase/functions/.eslintrc.js +++ b/firebase/functions/.eslintrc.js @@ -1,4 +1,4 @@ -export default { +module.exports = { "env": { "browser": true, "commonjs": true, diff --git a/firebase/functions/package-lock.json b/firebase/functions/package-lock.json index 9ebe4cdc..6eaa781e 100644 --- a/firebase/functions/package-lock.json +++ b/firebase/functions/package-lock.json @@ -6,16 +6,16 @@ "": { "name": "functions", "dependencies": { - "firebase-admin": "^10.1.0", - "firebase-functions": "^3.20.1" + "firebase-admin": "^10.2.0", + "firebase-functions": "^3.21.0" }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^5.22.0", "@typescript-eslint/parser": "^5.22.0", - "eslint": "^8.14.0", + "eslint": "^8.15.0", "eslint-config-google": "^0.14.0", "eslint-plugin-import": "^2.26.0", - "firebase-functions-test": "^0.3.3", + "firebase-functions-test": "^2.0.1", "typescript": "^4.6.4" }, "engines": { @@ -23,19 +23,19 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.2.tgz", - "integrity": "sha512-lTVWHs7O2hjBFZunXTZYnYqtB9GakA1lnxIf+gKq2nY5gxkkNi/lQvveW6t8gFdOHTg6nG50Xs95PrLqVpcaLg==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.3.tgz", + "integrity": "sha512-uGo44hIwoLGNyduRpjdEpovcbMdd+Nv7amtmJxnKmI8xj6yd5LncmSwDa5NgX/41lIFJtkjD6YdVfgEzPfJ5UA==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.3.1", + "espree": "^9.3.2", "globals": "^13.9.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", - "minimatch": "^3.0.4", + "minimatch": "^3.1.2", "strip-json-comments": "^3.1.1" }, "engines": { @@ -43,27 +43,27 @@ } }, "node_modules/@firebase/app": { - "version": "0.7.19", - "resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.7.19.tgz", - "integrity": "sha512-Xs8s3OF4Tn7Ls833TOTAUSMDq/pDs1fDsLRprR1+B4wyxyWCYBisgDMnPx25z9wKJESOWoZTDjyBVHrn6sG92w==", + "version": "0.7.22", + "resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.7.22.tgz", + "integrity": "sha512-v3AXSCwAvZyIFzOGgPAYtzjltm1M9R4U4yqsIBPf5B4ryaT1EGK+3ETZUOckNl5y2YwdKRJVPDDore+B2xg0Ug==", "peer": true, "dependencies": { - "@firebase/component": "0.5.11", + "@firebase/component": "0.5.13", "@firebase/logger": "0.3.2", - "@firebase/util": "1.5.0", + "@firebase/util": "1.5.2", "tslib": "^2.1.0" } }, "node_modules/@firebase/app-compat": { - "version": "0.1.20", - "resolved": "https://registry.npmjs.org/@firebase/app-compat/-/app-compat-0.1.20.tgz", - "integrity": "sha512-s+MQQv5acNZ2Mx/TNyr+B0XaqATq14hkAL9247exIvV0RBwP28THuadPVw99kjrwkHilQtBMFJmmCm1S5ZoktQ==", + "version": "0.1.23", + "resolved": "https://registry.npmjs.org/@firebase/app-compat/-/app-compat-0.1.23.tgz", + "integrity": "sha512-c0QOhU2UVxZ7N5++nLQgKZ899ZC8+/ESa8VCzsQDwBw1T3MFAD1cG40KhB+CGtp/uYk/w6Jtk8k0xyZu6O2LOg==", "peer": true, "dependencies": { - "@firebase/app": "0.7.19", - "@firebase/component": "0.5.11", + "@firebase/app": "0.7.22", + "@firebase/component": "0.5.13", "@firebase/logger": "0.3.2", - "@firebase/util": "1.5.0", + "@firebase/util": "1.5.2", "tslib": "^2.1.0" } }, @@ -82,37 +82,37 @@ } }, "node_modules/@firebase/component": { - "version": "0.5.11", - "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.5.11.tgz", - "integrity": "sha512-amtUrJxfJhJdjR3JzXqkHIoghJJ34o8OiSDj3gq96uKL4BRkSpmPaxi0+1r8DcDQ6bQxh3kDSoge8bRCDQCvsw==", + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.5.13.tgz", + "integrity": "sha512-hxhJtpD8Ppf/VU2Rlos6KFCEV77TGIGD5bJlkPK1+B/WUe0mC6dTjW7KhZtXTc+qRBp9nFHWcsIORnT8liHP9w==", "dependencies": { - "@firebase/util": "1.5.0", + "@firebase/util": "1.5.2", "tslib": "^2.1.0" } }, "node_modules/@firebase/database": { - "version": "0.12.6", - "resolved": "https://registry.npmjs.org/@firebase/database/-/database-0.12.6.tgz", - "integrity": "sha512-vokGkgpk+4bvy1d/s0lsPP9GmC1nrAtctQwEEDH5ZO4WCYPj16Y6rKILsOjrWwJ+Ih21ORnekxSzfpKyd1KHEg==", + "version": "0.12.8", + "resolved": "https://registry.npmjs.org/@firebase/database/-/database-0.12.8.tgz", + "integrity": "sha512-JBQVfFLzfhxlQbl4OU6ov9fdsddkytBQdtSSR49cz48homj38ccltAhK6seum+BI7f28cV2LFHF9672lcN+qxA==", "dependencies": { "@firebase/auth-interop-types": "0.1.6", - "@firebase/component": "0.5.11", + "@firebase/component": "0.5.13", "@firebase/logger": "0.3.2", - "@firebase/util": "1.5.0", + "@firebase/util": "1.5.2", "faye-websocket": "0.11.4", "tslib": "^2.1.0" } }, "node_modules/@firebase/database-compat": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/@firebase/database-compat/-/database-compat-0.1.6.tgz", - "integrity": "sha512-fDAJWI5ZdXPlS84NC87Et7pE6mJxF5uUoePCaQFpU56wrYVk58COomcSXtFrdX9U5/1FHjR3TaDWV5pJakv83g==", + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/@firebase/database-compat/-/database-compat-0.1.8.tgz", + "integrity": "sha512-dhXr5CSieBuKNdU96HgeewMQCT9EgOIkfF1GNy+iRrdl7BWLxmlKuvLfK319rmIytSs/vnCzcD9uqyxTeU/A3A==", "dependencies": { - "@firebase/component": "0.5.11", - "@firebase/database": "0.12.6", - "@firebase/database-types": "0.9.5", + "@firebase/component": "0.5.13", + "@firebase/database": "0.12.8", + "@firebase/database-types": "0.9.7", "@firebase/logger": "0.3.2", - "@firebase/util": "1.5.0", + "@firebase/util": "1.5.2", "tslib": "^2.1.0" }, "peerDependencies": { @@ -120,12 +120,12 @@ } }, "node_modules/@firebase/database-types": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/@firebase/database-types/-/database-types-0.9.5.tgz", - "integrity": "sha512-0p9BDmoZCbW5c//tl7IUn8hOIM4M6wCnLmVdbVUvD30V4hZT36phdhajf36pcMgE9suMsz4xtvWlngEy9FeHwA==", + "version": "0.9.7", + "resolved": "https://registry.npmjs.org/@firebase/database-types/-/database-types-0.9.7.tgz", + "integrity": "sha512-EFhgL89Fz6DY3kkB8TzdHvdu8XaqqvzcF2DLVOXEnQ3Ms7L755p5EO42LfxXoJqb9jKFvgLpFmKicyJG25WFWw==", "dependencies": { "@firebase/app-types": "0.7.0", - "@firebase/util": "1.5.0" + "@firebase/util": "1.5.2" } }, "node_modules/@firebase/logger": { @@ -137,9 +137,9 @@ } }, "node_modules/@firebase/util": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.5.0.tgz", - "integrity": "sha512-4w4OY3YJVHV/4UBZ8OcXb8BD8I83P5n2y+FW0dHhn9OLXdYDg8bvCTA08P0nszpZqBhwutKQ4OS7c530SGjeLg==", + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.5.2.tgz", + "integrity": "sha512-YvBH2UxFcdWG2HdFnhxZptPl2eVFlpOyTH66iDo13JPEYraWzWToZ5AMTtkyRHVmu7sssUpQlU9igy1KET7TOw==", "dependencies": { "tslib": "^2.1.0" } @@ -715,9 +715,9 @@ } }, "node_modules/acorn": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", - "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", + "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -1365,12 +1365,12 @@ } }, "node_modules/eslint": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.14.0.tgz", - "integrity": "sha512-3/CE4aJX7LNEiE3i6FeodHmI/38GZtWCsAtsymScmzYapx8q1nVVb+eLcLSzATmCPXw5pT4TqVs1E0OmxAd9tw==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.15.0.tgz", + "integrity": "sha512-GG5USZ1jhCu8HJkzGgeK8/+RGnHaNYZGrGDzUtigK3BsGESW/rs2az23XqE0WVwDxy1VRvvjSSGu5nB0Bu+6SA==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.2.2", + "@eslint/eslintrc": "^1.2.3", "@humanwhocodes/config-array": "^0.9.2", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -1381,7 +1381,7 @@ "eslint-scope": "^7.1.1", "eslint-utils": "^3.0.0", "eslint-visitor-keys": "^3.3.0", - "espree": "^9.3.1", + "espree": "^9.3.2", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -1397,7 +1397,7 @@ "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.1", "regexpp": "^3.2.0", @@ -1595,13 +1595,13 @@ } }, "node_modules/espree": { - "version": "9.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz", - "integrity": "sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==", + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz", + "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==", "dev": true, "dependencies": { - "acorn": "^8.7.0", - "acorn-jsx": "^5.3.1", + "acorn": "^8.7.1", + "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -1883,17 +1883,18 @@ } }, "node_modules/firebase-admin": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/firebase-admin/-/firebase-admin-10.1.0.tgz", - "integrity": "sha512-4i4wu+EFgNfY4+D4DxXkZcmbD832ozUMNvHMkOFQrf8upyp51n6jrDJS+wLok9sd62yeqcImbnsLOympGlISPA==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/firebase-admin/-/firebase-admin-10.2.0.tgz", + "integrity": "sha512-6ehn5J9UEFgi4+naqYvozmGpnZae3cJLdwSkSsDc8/Y0eTBjVMFdf9N2ft7N81UNHA0N5DknOyXhlsdAdyBLCA==", "dependencies": { - "@firebase/database-compat": "^0.1.1", - "@firebase/database-types": "^0.9.3", + "@firebase/database-compat": "^0.1.8", + "@firebase/database-types": "^0.9.7", "@types/node": ">=12.12.47", "dicer": "^0.3.0", "jsonwebtoken": "^8.5.1", "jwks-rsa": "^2.0.2", - "node-forge": "^1.3.1" + "node-forge": "^1.3.1", + "uuid": "^8.3.2" }, "engines": { "node": ">=12.7.0" @@ -1904,9 +1905,9 @@ } }, "node_modules/firebase-functions": { - "version": "3.20.1", - "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-3.20.1.tgz", - "integrity": "sha512-x8TEWOsaUnytsNBkrpraa2pOokdjMaGnOkcKdC6HDX/tvlBxrdNpvAMc+Vu/u0lzow9Hs+W+3jEe6Ss4duIz6g==", + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-3.21.0.tgz", + "integrity": "sha512-Xl0EFV05+RSB9hJHlo12LguoRqAmpSXmBnpI0MANeNj07dGW0QCWPHtaAewxYEzRS3RfSCL8WH12rjvo0PPKGw==", "dependencies": { "@types/cors": "^2.8.5", "@types/express": "4.17.3", @@ -1926,20 +1927,21 @@ } }, "node_modules/firebase-functions-test": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/firebase-functions-test/-/firebase-functions-test-0.3.3.tgz", - "integrity": "sha512-dCppF/2Ztv87IyyBaUQlT1Z05ial5v/3LB0huS2ktXz05yNiID5FVIKtO0/+w9Q7/SThJ8qIDG0hoGDPt4Xcug==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/firebase-functions-test/-/firebase-functions-test-2.0.1.tgz", + "integrity": "sha512-1B2UQUZ4I3dzIfyfSriUoDnqkt53iCrqoT/lwdJatmuakbTWbrexPFSLTM5haT7kVBnQBTfjRRO300mgFCw8+w==", "dev": true, "dependencies": { "@types/lodash": "^4.14.104", - "lodash": "^4.17.5" + "lodash": "^4.17.5", + "ts-deepmerge": "^2.0.1" }, "engines": { - "node": ">=8.0.0" + "node": ">=14.0.0" }, "peerDependencies": { "firebase-admin": ">=6.0.0", - "firebase-functions": ">=2.0.0" + "firebase-functions": ">=3.20.1" } }, "node_modules/flat-cache": { @@ -2108,9 +2110,9 @@ } }, "node_modules/globals": { - "version": "13.13.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", - "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", + "version": "13.14.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.14.0.tgz", + "integrity": "sha512-ERO68sOYwm5UuLvSJTY7w7NP2c8S4UcXs3X1GBX8cwOr+ShOcDBbCY5mH4zxz0jsYCdJ8ve8Mv9n2YGJMB1aeg==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -3954,6 +3956,12 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, + "node_modules/ts-deepmerge": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ts-deepmerge/-/ts-deepmerge-2.0.1.tgz", + "integrity": "sha512-2RpGIE0YVW6blKY756MP74czemC9x4XThhNCxq0A14Owm3ac8tZvigPbpZyZZQSyfOc7Qba5kG5xKBq74ihZfA==", + "dev": true + }, "node_modules/tsconfig-paths": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", @@ -3967,9 +3975,9 @@ } }, "node_modules/tslib": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", - "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "node_modules/tsutils": { "version": "3.21.0", @@ -4112,7 +4120,6 @@ "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "optional": true, "bin": { "uuid": "dist/bin/uuid" } @@ -4307,44 +4314,44 @@ }, "dependencies": { "@eslint/eslintrc": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.2.tgz", - "integrity": "sha512-lTVWHs7O2hjBFZunXTZYnYqtB9GakA1lnxIf+gKq2nY5gxkkNi/lQvveW6t8gFdOHTg6nG50Xs95PrLqVpcaLg==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.3.tgz", + "integrity": "sha512-uGo44hIwoLGNyduRpjdEpovcbMdd+Nv7amtmJxnKmI8xj6yd5LncmSwDa5NgX/41lIFJtkjD6YdVfgEzPfJ5UA==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.3.1", + "espree": "^9.3.2", "globals": "^13.9.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", - "minimatch": "^3.0.4", + "minimatch": "^3.1.2", "strip-json-comments": "^3.1.1" } }, "@firebase/app": { - "version": "0.7.19", - "resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.7.19.tgz", - "integrity": "sha512-Xs8s3OF4Tn7Ls833TOTAUSMDq/pDs1fDsLRprR1+B4wyxyWCYBisgDMnPx25z9wKJESOWoZTDjyBVHrn6sG92w==", + "version": "0.7.22", + "resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.7.22.tgz", + "integrity": "sha512-v3AXSCwAvZyIFzOGgPAYtzjltm1M9R4U4yqsIBPf5B4ryaT1EGK+3ETZUOckNl5y2YwdKRJVPDDore+B2xg0Ug==", "peer": true, "requires": { - "@firebase/component": "0.5.11", + "@firebase/component": "0.5.13", "@firebase/logger": "0.3.2", - "@firebase/util": "1.5.0", + "@firebase/util": "1.5.2", "tslib": "^2.1.0" } }, "@firebase/app-compat": { - "version": "0.1.20", - "resolved": "https://registry.npmjs.org/@firebase/app-compat/-/app-compat-0.1.20.tgz", - "integrity": "sha512-s+MQQv5acNZ2Mx/TNyr+B0XaqATq14hkAL9247exIvV0RBwP28THuadPVw99kjrwkHilQtBMFJmmCm1S5ZoktQ==", + "version": "0.1.23", + "resolved": "https://registry.npmjs.org/@firebase/app-compat/-/app-compat-0.1.23.tgz", + "integrity": "sha512-c0QOhU2UVxZ7N5++nLQgKZ899ZC8+/ESa8VCzsQDwBw1T3MFAD1cG40KhB+CGtp/uYk/w6Jtk8k0xyZu6O2LOg==", "peer": true, "requires": { - "@firebase/app": "0.7.19", - "@firebase/component": "0.5.11", + "@firebase/app": "0.7.22", + "@firebase/component": "0.5.13", "@firebase/logger": "0.3.2", - "@firebase/util": "1.5.0", + "@firebase/util": "1.5.2", "tslib": "^2.1.0" } }, @@ -4360,47 +4367,47 @@ "requires": {} }, "@firebase/component": { - "version": "0.5.11", - "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.5.11.tgz", - "integrity": "sha512-amtUrJxfJhJdjR3JzXqkHIoghJJ34o8OiSDj3gq96uKL4BRkSpmPaxi0+1r8DcDQ6bQxh3kDSoge8bRCDQCvsw==", + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.5.13.tgz", + "integrity": "sha512-hxhJtpD8Ppf/VU2Rlos6KFCEV77TGIGD5bJlkPK1+B/WUe0mC6dTjW7KhZtXTc+qRBp9nFHWcsIORnT8liHP9w==", "requires": { - "@firebase/util": "1.5.0", + "@firebase/util": "1.5.2", "tslib": "^2.1.0" } }, "@firebase/database": { - "version": "0.12.6", - "resolved": "https://registry.npmjs.org/@firebase/database/-/database-0.12.6.tgz", - "integrity": "sha512-vokGkgpk+4bvy1d/s0lsPP9GmC1nrAtctQwEEDH5ZO4WCYPj16Y6rKILsOjrWwJ+Ih21ORnekxSzfpKyd1KHEg==", + "version": "0.12.8", + "resolved": "https://registry.npmjs.org/@firebase/database/-/database-0.12.8.tgz", + "integrity": "sha512-JBQVfFLzfhxlQbl4OU6ov9fdsddkytBQdtSSR49cz48homj38ccltAhK6seum+BI7f28cV2LFHF9672lcN+qxA==", "requires": { "@firebase/auth-interop-types": "0.1.6", - "@firebase/component": "0.5.11", + "@firebase/component": "0.5.13", "@firebase/logger": "0.3.2", - "@firebase/util": "1.5.0", + "@firebase/util": "1.5.2", "faye-websocket": "0.11.4", "tslib": "^2.1.0" } }, "@firebase/database-compat": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/@firebase/database-compat/-/database-compat-0.1.6.tgz", - "integrity": "sha512-fDAJWI5ZdXPlS84NC87Et7pE6mJxF5uUoePCaQFpU56wrYVk58COomcSXtFrdX9U5/1FHjR3TaDWV5pJakv83g==", + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/@firebase/database-compat/-/database-compat-0.1.8.tgz", + "integrity": "sha512-dhXr5CSieBuKNdU96HgeewMQCT9EgOIkfF1GNy+iRrdl7BWLxmlKuvLfK319rmIytSs/vnCzcD9uqyxTeU/A3A==", "requires": { - "@firebase/component": "0.5.11", - "@firebase/database": "0.12.6", - "@firebase/database-types": "0.9.5", + "@firebase/component": "0.5.13", + "@firebase/database": "0.12.8", + "@firebase/database-types": "0.9.7", "@firebase/logger": "0.3.2", - "@firebase/util": "1.5.0", + "@firebase/util": "1.5.2", "tslib": "^2.1.0" } }, "@firebase/database-types": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/@firebase/database-types/-/database-types-0.9.5.tgz", - "integrity": "sha512-0p9BDmoZCbW5c//tl7IUn8hOIM4M6wCnLmVdbVUvD30V4hZT36phdhajf36pcMgE9suMsz4xtvWlngEy9FeHwA==", + "version": "0.9.7", + "resolved": "https://registry.npmjs.org/@firebase/database-types/-/database-types-0.9.7.tgz", + "integrity": "sha512-EFhgL89Fz6DY3kkB8TzdHvdu8XaqqvzcF2DLVOXEnQ3Ms7L755p5EO42LfxXoJqb9jKFvgLpFmKicyJG25WFWw==", "requires": { "@firebase/app-types": "0.7.0", - "@firebase/util": "1.5.0" + "@firebase/util": "1.5.2" } }, "@firebase/logger": { @@ -4412,9 +4419,9 @@ } }, "@firebase/util": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.5.0.tgz", - "integrity": "sha512-4w4OY3YJVHV/4UBZ8OcXb8BD8I83P5n2y+FW0dHhn9OLXdYDg8bvCTA08P0nszpZqBhwutKQ4OS7c530SGjeLg==", + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.5.2.tgz", + "integrity": "sha512-YvBH2UxFcdWG2HdFnhxZptPl2eVFlpOyTH66iDo13JPEYraWzWToZ5AMTtkyRHVmu7sssUpQlU9igy1KET7TOw==", "requires": { "tslib": "^2.1.0" } @@ -4853,9 +4860,9 @@ } }, "acorn": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", - "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", + "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", "dev": true }, "acorn-jsx": { @@ -5348,12 +5355,12 @@ "dev": true }, "eslint": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.14.0.tgz", - "integrity": "sha512-3/CE4aJX7LNEiE3i6FeodHmI/38GZtWCsAtsymScmzYapx8q1nVVb+eLcLSzATmCPXw5pT4TqVs1E0OmxAd9tw==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.15.0.tgz", + "integrity": "sha512-GG5USZ1jhCu8HJkzGgeK8/+RGnHaNYZGrGDzUtigK3BsGESW/rs2az23XqE0WVwDxy1VRvvjSSGu5nB0Bu+6SA==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.2.2", + "@eslint/eslintrc": "^1.2.3", "@humanwhocodes/config-array": "^0.9.2", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -5364,7 +5371,7 @@ "eslint-scope": "^7.1.1", "eslint-utils": "^3.0.0", "eslint-visitor-keys": "^3.3.0", - "espree": "^9.3.1", + "espree": "^9.3.2", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -5380,7 +5387,7 @@ "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.1", "regexpp": "^3.2.0", @@ -5538,13 +5545,13 @@ "dev": true }, "espree": { - "version": "9.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz", - "integrity": "sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==", + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz", + "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==", "dev": true, "requires": { - "acorn": "^8.7.0", - "acorn-jsx": "^5.3.1", + "acorn": "^8.7.1", + "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^3.3.0" } }, @@ -5785,25 +5792,26 @@ } }, "firebase-admin": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/firebase-admin/-/firebase-admin-10.1.0.tgz", - "integrity": "sha512-4i4wu+EFgNfY4+D4DxXkZcmbD832ozUMNvHMkOFQrf8upyp51n6jrDJS+wLok9sd62yeqcImbnsLOympGlISPA==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/firebase-admin/-/firebase-admin-10.2.0.tgz", + "integrity": "sha512-6ehn5J9UEFgi4+naqYvozmGpnZae3cJLdwSkSsDc8/Y0eTBjVMFdf9N2ft7N81UNHA0N5DknOyXhlsdAdyBLCA==", "requires": { - "@firebase/database-compat": "^0.1.1", - "@firebase/database-types": "^0.9.3", + "@firebase/database-compat": "^0.1.8", + "@firebase/database-types": "^0.9.7", "@google-cloud/firestore": "^4.15.1", "@google-cloud/storage": "^5.18.3", "@types/node": ">=12.12.47", "dicer": "^0.3.0", "jsonwebtoken": "^8.5.1", "jwks-rsa": "^2.0.2", - "node-forge": "^1.3.1" + "node-forge": "^1.3.1", + "uuid": "^8.3.2" } }, "firebase-functions": { - "version": "3.20.1", - "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-3.20.1.tgz", - "integrity": "sha512-x8TEWOsaUnytsNBkrpraa2pOokdjMaGnOkcKdC6HDX/tvlBxrdNpvAMc+Vu/u0lzow9Hs+W+3jEe6Ss4duIz6g==", + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/firebase-functions/-/firebase-functions-3.21.0.tgz", + "integrity": "sha512-Xl0EFV05+RSB9hJHlo12LguoRqAmpSXmBnpI0MANeNj07dGW0QCWPHtaAewxYEzRS3RfSCL8WH12rjvo0PPKGw==", "requires": { "@types/cors": "^2.8.5", "@types/express": "4.17.3", @@ -5814,13 +5822,14 @@ } }, "firebase-functions-test": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/firebase-functions-test/-/firebase-functions-test-0.3.3.tgz", - "integrity": "sha512-dCppF/2Ztv87IyyBaUQlT1Z05ial5v/3LB0huS2ktXz05yNiID5FVIKtO0/+w9Q7/SThJ8qIDG0hoGDPt4Xcug==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/firebase-functions-test/-/firebase-functions-test-2.0.1.tgz", + "integrity": "sha512-1B2UQUZ4I3dzIfyfSriUoDnqkt53iCrqoT/lwdJatmuakbTWbrexPFSLTM5haT7kVBnQBTfjRRO300mgFCw8+w==", "dev": true, "requires": { "@types/lodash": "^4.14.104", - "lodash": "^4.17.5" + "lodash": "^4.17.5", + "ts-deepmerge": "^2.0.1" } }, "flat-cache": { @@ -5947,9 +5956,9 @@ } }, "globals": { - "version": "13.13.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", - "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", + "version": "13.14.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.14.0.tgz", + "integrity": "sha512-ERO68sOYwm5UuLvSJTY7w7NP2c8S4UcXs3X1GBX8cwOr+ShOcDBbCY5mH4zxz0jsYCdJ8ve8Mv9n2YGJMB1aeg==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -7310,6 +7319,12 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, + "ts-deepmerge": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ts-deepmerge/-/ts-deepmerge-2.0.1.tgz", + "integrity": "sha512-2RpGIE0YVW6blKY756MP74czemC9x4XThhNCxq0A14Owm3ac8tZvigPbpZyZZQSyfOc7Qba5kG5xKBq74ihZfA==", + "dev": true + }, "tsconfig-paths": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz", @@ -7323,9 +7338,9 @@ } }, "tslib": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", - "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "tsutils": { "version": "3.21.0", @@ -7432,8 +7447,7 @@ "uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "optional": true + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" }, "v8-compile-cache": { "version": "2.3.0", diff --git a/firebase/functions/package.json b/firebase/functions/package.json index 3aadb4ed..0b0173c3 100644 --- a/firebase/functions/package.json +++ b/firebase/functions/package.json @@ -1,15 +1,15 @@ { "dependencies": { - "firebase-admin": "^10.1.0", - "firebase-functions": "^3.20.1" + "firebase-admin": "^10.2.0", + "firebase-functions": "^3.21.0" }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^5.22.0", "@typescript-eslint/parser": "^5.22.0", - "eslint": "^8.14.0", + "eslint": "^8.15.0", "eslint-config-google": "^0.14.0", "eslint-plugin-import": "^2.26.0", - "firebase-functions-test": "^0.3.3", + "firebase-functions-test": "^2.0.1", "typescript": "^4.6.4" }, "engines": { diff --git a/firebase/functions/src/index.ts b/firebase/functions/src/index.ts index 56eb3fd9..ce14155d 100644 --- a/firebase/functions/src/index.ts +++ b/firebase/functions/src/index.ts @@ -200,7 +200,6 @@ function createGame(game_mode: GameMode): Game { current_round: 0, started: false, done: false, - edition: undefined }; } @@ -220,7 +219,6 @@ interface Game { current_round: number; started: boolean; done: boolean; - edition: string | undefined; } // an interface with any key and any value diff --git a/firebase/functions/src/test_framework.ts b/firebase/functions/src/test_framework.ts index 0d2eff99..bb50d269 100644 --- a/firebase/functions/src/test_framework.ts +++ b/firebase/functions/src/test_framework.ts @@ -15,6 +15,6 @@ export function assertTrue(value: boolean) { export function assertEquals(expected: any, actual: any) { if (expected !== actual) { - throw new Error(`expected \'${expected}\', actual \'${actual}\'`) + throw new Error(`expected '${expected}', actual '${actual}'`) } } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..b58ffc8c --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "RockPaperScissors", + "lockfileVersion": 2, + "requires": true, + "packages": {} +}