From b336c8b04e82d0a45099b19a691c0ac11b84d5d8 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 9 Jul 2020 11:15:15 -0400 Subject: [PATCH 01/18] Migrate testing to rules-unit-testing --- .github/CODEOWNERS | 2 +- .../.firebaserc | 0 .../{testing => rules-unit-testing}/README.md | 4 +- .../firebase.json | 0 .../{testing => rules-unit-testing}/index.ts | 2 +- .../package.json | 14 +++-- .../rollup.config.js | 0 .../src/api/index.ts | 61 +++++++++++++++---- .../test/database.test.ts | 19 ++++-- .../tsconfig.json | 0 10 files changed, 78 insertions(+), 24 deletions(-) rename packages/{testing => rules-unit-testing}/.firebaserc (100%) rename packages/{testing => rules-unit-testing}/README.md (90%) rename packages/{testing => rules-unit-testing}/firebase.json (100%) rename packages/{testing => rules-unit-testing}/index.ts (94%) rename packages/{testing => rules-unit-testing}/package.json (79%) rename packages/{testing => rules-unit-testing}/rollup.config.js (100%) rename packages/{testing => rules-unit-testing}/src/api/index.ts (87%) rename packages/{testing => rules-unit-testing}/test/database.test.ts (91%) rename packages/{testing => rules-unit-testing}/tsconfig.json (100%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8b053d57735..b8deabaad13 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -59,7 +59,7 @@ packages/auth @bojeil-google @avolkovi @samhorlbeck @scottcrossen @firebase/jss packages/auth-types @bojeil-google @avolkovi @samhorlbeck @scottcrossen @firebase/jssdk-global-approvers # Testing Code -packages/testing @avolkovi @samhorlbeck @scottcrossen @yuchenshi @firebase/jssdk-global-approvers +packages/rules-unit-testing @avolkovi @samhorlbeck @scottcrossen @yuchenshi @firebase/jssdk-global-approvers # RxFire Code packages/rxfire @davideast @jamesdaniels @firebase/jssdk-global-approvers diff --git a/packages/testing/.firebaserc b/packages/rules-unit-testing/.firebaserc similarity index 100% rename from packages/testing/.firebaserc rename to packages/rules-unit-testing/.firebaserc diff --git a/packages/testing/README.md b/packages/rules-unit-testing/README.md similarity index 90% rename from packages/testing/README.md rename to packages/rules-unit-testing/README.md index 40a72bb086d..a5715e094d4 100644 --- a/packages/testing/README.md +++ b/packages/rules-unit-testing/README.md @@ -1,4 +1,4 @@ -# @firebase/testing +# @firebase/rules-unit-testing A set of utilities useful for testing Security Rules with the Realtime Database or Cloud Firestore emulators. @@ -6,4 +6,4 @@ emulators. See: * [Test your Cloud Firestore Security Rules](https://firebase.google.com/docs/firestore/security/test-rules-emulator) - * [Testing Security Rules with the Realtime Database Emulator](https://firebase.google.com/docs/database/security/test-rules-emulator) \ No newline at end of file + * [Testing Security Rules with the Realtime Database Emulator](https://firebase.google.com/docs/database/security/test-rules-emulator) diff --git a/packages/testing/firebase.json b/packages/rules-unit-testing/firebase.json similarity index 100% rename from packages/testing/firebase.json rename to packages/rules-unit-testing/firebase.json diff --git a/packages/testing/index.ts b/packages/rules-unit-testing/index.ts similarity index 94% rename from packages/testing/index.ts rename to packages/rules-unit-testing/index.ts index 4c5c8a27bac..953477f842d 100644 --- a/packages/testing/index.ts +++ b/packages/rules-unit-testing/index.ts @@ -18,7 +18,7 @@ /* * The testing module does not need to be registered since it should not ever * come by default. The only way to use the testing module is by explicitly - * creating a dependency on @firebase/testing. + * creating a dependency on @firebase/rules-unit-testing. */ export { diff --git a/packages/testing/package.json b/packages/rules-unit-testing/package.json similarity index 79% rename from packages/testing/package.json rename to packages/rules-unit-testing/package.json index 9b0fba74817..d4e38766f1c 100644 --- a/packages/testing/package.json +++ b/packages/rules-unit-testing/package.json @@ -1,6 +1,6 @@ { - "name": "@firebase/testing", - "version": "0.20.5", + "name": "@firebase/rules-unit-testing", + "version": "0.30.0", "description": "", "author": "Firebase (https://firebase.google.com/)", "main": "dist/index.cjs.js", @@ -12,7 +12,7 @@ ], "scripts": { "build": "rollup -c", - "build:deps": "lerna run --scope @firebase/testing --include-dependencies build", + "build:deps": "lerna run --scope @firebase/rules-unit-testing --include-dependencies build", "dev": "rollup -c -w", "test:nyc": "TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --config ../../config/mocharc.node.js", "test": "firebase emulators:exec 'yarn test:nyc'", @@ -21,9 +21,10 @@ }, "license": "Apache-2.0", "dependencies": { - "firebase": "7.15.5", "@firebase/logger": "0.2.5", "@firebase/util": "0.2.50", + "firebase": "7.15.5", + "firebase-admin": "^8.13.0", "request": "2.88.2" }, "devDependencies": { @@ -32,8 +33,11 @@ "rollup": "2.7.6", "rollup-plugin-typescript2": "0.27.0" }, + "peerDependencies": { + "firebase-admin": "^8.13.0" + }, "repository": { - "directory": "packages/testing", + "directory": "packages/rules-unit-testing", "type": "git", "url": "https://github.com/firebase/firebase-js-sdk.git" }, diff --git a/packages/testing/rollup.config.js b/packages/rules-unit-testing/rollup.config.js similarity index 100% rename from packages/testing/rollup.config.js rename to packages/rules-unit-testing/rollup.config.js diff --git a/packages/testing/src/api/index.ts b/packages/rules-unit-testing/src/api/index.ts similarity index 87% rename from packages/testing/src/api/index.ts rename to packages/rules-unit-testing/src/api/index.ts index c5207de5b17..469674679f0 100644 --- a/packages/testing/src/api/index.ts +++ b/packages/rules-unit-testing/src/api/index.ts @@ -46,8 +46,6 @@ const FIRESTORE_ADDRESS: string = FIRESTORE_ADDRESS_ENVS.reduce( FIRESTORE_ADDRESS_DEFAULT ); -/** Passing this in tells the emulator to treat you as an admin. */ -const ADMIN_TOKEN = 'owner'; /** Create an unsecured JWT for the given auth payload. See https://tools.ietf.org/html/rfc7519#section-6. */ function createUnsecuredJwt(auth: object): string { // Unsecured JWTs use "none" as the algorithm. @@ -95,23 +93,50 @@ export type AdminAppOptions = { }; /** Construct an App authenticated as an admin user. */ export function initializeAdminApp(options: AdminAppOptions): firebase.app.App { - return initializeApp(ADMIN_TOKEN, options.databaseName, options.projectId); + const admin = require('firebase-admin'); + + const app = admin.initializeApp( + getAppOptions(options.databaseName, options.projectId), + getRandomAppName() + ); + + if (options.projectId) { + app.firestore().settings({ + host: FIRESTORE_ADDRESS, + ssl: false + }); + } + + return app; } -function initializeApp( - accessToken?: string, +function getRandomAppName(): string { + return 'app-' + new Date().getTime() + '-' + Math.random(); +} + +function getAppOptions( databaseName?: string, projectId?: string -): firebase.app.App { +): { [key: string]: string } { let appOptions: { [key: string]: string } = {}; + if (databaseName) { appOptions['databaseURL'] = `http://${DATABASE_ADDRESS}?ns=${databaseName}`; } if (projectId) { appOptions['projectId'] = projectId; } - const appName = 'app-' + new Date().getTime() + '-' + Math.random(); - let app = firebase.initializeApp(appOptions, appName); + + return appOptions; +} + +function initializeApp( + accessToken?: string, + databaseName?: string, + projectId?: string +): firebase.app.App { + const appOptions = getAppOptions(databaseName, projectId); + const app = firebase.initializeApp(appOptions, getRandomAppName()); if (accessToken) { const mockAuthComponent = new Component( 'auth-internal', @@ -261,9 +286,23 @@ export function clearFirestoreData( export function assertFails(pr: Promise): any { return pr.then( - v => - Promise.reject(new Error('Expected request to fail, but it succeeded.')), - err => err + (v: any) => { + return Promise.reject( + new Error('Expected request to fail, but it succeeded.') + ); + }, + (err: any) => { + const isPermissionDenied = + err && err.message && err.message.indexOf('PERMISSION_DENIED') >= 0; + if (!isPermissionDenied) { + return Promise.reject( + new Error( + `Expected PERMISSION_DENIED but got unexpected error: ${err}` + ) + ); + } + return err; + } ); } diff --git a/packages/testing/test/database.test.ts b/packages/rules-unit-testing/test/database.test.ts similarity index 91% rename from packages/testing/test/database.test.ts rename to packages/rules-unit-testing/test/database.test.ts index 3e17335b53a..761a8109122 100644 --- a/packages/testing/test/database.test.ts +++ b/packages/rules-unit-testing/test/database.test.ts @@ -42,18 +42,29 @@ describe('Testing Module Tests', function() { .catch(() => {}); }); - it('assertFails() iff failure', async function() { + it('assertFails() iff PERMISSION_DENIED', async function() { const success = Promise.resolve('success'); - const failure = Promise.reject('failure'); + const permissionDenied = Promise.reject({ + message: 'PERMISSION_DENIED' + }); + const otherFailure = Promise.reject('failure'); await firebase .assertFails(success) .then(() => { throw new Error('Expected success to fail.'); }) .catch(() => {}); - await firebase.assertFails(failure).catch(() => { - throw new Error('Expected failure to succeed.'); + + await firebase.assertFails(permissionDenied).catch(() => { + throw new Error('Expected permissionDenied to succeed.'); }); + + await firebase + .assertFails(otherFailure) + .then(() => { + throw new Error('Expected otherFailure to fail.'); + }) + .catch(() => {}); }); it('initializeTestApp() with auth=null does not set access token', async function() { diff --git a/packages/testing/tsconfig.json b/packages/rules-unit-testing/tsconfig.json similarity index 100% rename from packages/testing/tsconfig.json rename to packages/rules-unit-testing/tsconfig.json From ff83ad670b3ebb499c0ece4e5f4ade11cc5a1bf6 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 9 Jul 2020 11:18:54 -0400 Subject: [PATCH 02/18] Remove bad dep --- packages/rules-unit-testing/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/rules-unit-testing/package.json b/packages/rules-unit-testing/package.json index d4e38766f1c..5cd2b8fee08 100644 --- a/packages/rules-unit-testing/package.json +++ b/packages/rules-unit-testing/package.json @@ -24,7 +24,6 @@ "@firebase/logger": "0.2.5", "@firebase/util": "0.2.50", "firebase": "7.15.5", - "firebase-admin": "^8.13.0", "request": "2.88.2" }, "devDependencies": { From 60381b3f1a4444bfb72bbfd7c48e8e20ce0e8797 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 17 Jul 2020 10:09:17 +0100 Subject: [PATCH 03/18] Fix dev dependency --- packages/rules-unit-testing/package.json | 3 +- yarn.lock | 415 ++++++++++++++++++++++- 2 files changed, 406 insertions(+), 12 deletions(-) diff --git a/packages/rules-unit-testing/package.json b/packages/rules-unit-testing/package.json index b8a58ff7e77..8d154432b09 100644 --- a/packages/rules-unit-testing/package.json +++ b/packages/rules-unit-testing/package.json @@ -26,7 +26,8 @@ }, "devDependencies": { "@types/request": "2.48.5", - "firebase-tools": "8.5.0", + "firebase-tools": "^8.5.0", + "firebase-admin": "^9.0.0", "rollup": "2.21.0", "rollup-plugin-typescript2": "0.27.1" }, diff --git a/yarn.lock b/yarn.lock index a8923b24a96..234e19f46a0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1314,6 +1314,30 @@ unique-filename "^1.1.1" which "^1.3.1" +"@google-cloud/common@^3.0.0": + version "3.3.2" + resolved "https://registry.npmjs.org/@google-cloud/common/-/common-3.3.2.tgz#595ce85ebbcaa8b38519336bf6747e32e7706df7" + integrity sha512-W7JRLBEJWYtZQQuGQX06U6GBOSLrSrlvZxv6kGNwJtFrusu6AVgZltQ9Pajuz9Dh9aSXy9aTnBcyxn2/O0EGUw== + dependencies: + "@google-cloud/projectify" "^2.0.0" + "@google-cloud/promisify" "^2.0.0" + arrify "^2.0.1" + duplexify "^4.1.1" + ent "^2.2.0" + extend "^3.0.2" + google-auth-library "^6.0.0" + retry-request "^4.1.1" + teeny-request "^7.0.0" + +"@google-cloud/firestore@^4.0.0": + version "4.1.1" + resolved "https://registry.npmjs.org/@google-cloud/firestore/-/firestore-4.1.1.tgz#bd7478cbead2d516cc8d173339198180ad7f6e35" + integrity sha512-HFy2OEOrYJ7jYUir90Kg7+AWM6fsFoWYiHiryoseHfkL9//AnXm2sn0CiaOhsTsxphc69G8LBBvUj6ws0QDa7g== + dependencies: + fast-deep-equal "^3.1.1" + functional-red-black-tree "^1.0.1" + google-gax "^2.2.0" + "@google-cloud/paginator@^2.0.0": version "2.0.3" resolved "https://registry.npmjs.org/@google-cloud/paginator/-/paginator-2.0.3.tgz#c7987ad05d1c3ebcef554381be80e9e8da4e4882" @@ -1322,6 +1346,14 @@ arrify "^2.0.0" extend "^3.0.2" +"@google-cloud/paginator@^3.0.0": + version "3.0.2" + resolved "https://registry.npmjs.org/@google-cloud/paginator/-/paginator-3.0.2.tgz#7d103f0dac00c7c46050f31cb8b524696b03135e" + integrity sha512-kXK+Dbz4pNvv8bKU80Aw5HsIdgOe0WuMTd8/fI6tkANUxzvJOVJQQRsWVqcHSWK2RXHPTA9WBniUCwY6gAJDXw== + dependencies: + arrify "^2.0.0" + extend "^3.0.2" + "@google-cloud/precise-date@^1.0.0": version "1.0.3" resolved "https://registry.npmjs.org/@google-cloud/precise-date/-/precise-date-1.0.3.tgz#39c600ed52213f4158692a72c90d13b2162a93d2" @@ -1332,11 +1364,21 @@ resolved "https://registry.npmjs.org/@google-cloud/projectify/-/projectify-1.0.4.tgz#28daabebba6579ed998edcadf1a8f3be17f3b5f0" integrity sha512-ZdzQUN02eRsmTKfBj9FDL0KNDIFNjBn/d6tHQmA/+FImH5DO6ZV8E7FzxMgAUiVAUq41RFAkb25p1oHOZ8psfg== +"@google-cloud/projectify@^2.0.0": + version "2.0.1" + resolved "https://registry.npmjs.org/@google-cloud/projectify/-/projectify-2.0.1.tgz#13350ee609346435c795bbfe133a08dfeab78d65" + integrity sha512-ZDG38U/Yy6Zr21LaR3BTiiLtpJl6RkPS/JwoRT453G+6Q1DhlV0waNf8Lfu+YVYGIIxgKnLayJRfYlFJfiI8iQ== + "@google-cloud/promisify@^1.0.0": version "1.0.4" resolved "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-1.0.4.tgz#ce86ffa94f9cfafa2e68f7b3e4a7fad194189723" integrity sha512-VccZDcOql77obTnFh0TbNED/6ZbbmHDf8UMNnzO1d5g9V0Htfm4k5cllY8P1tJsRKC3zWYGRLaViiupcgVjBoQ== +"@google-cloud/promisify@^2.0.0": + version "2.0.2" + resolved "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-2.0.2.tgz#81d654b4cb227c65c7ad2f9a7715262febd409ed" + integrity sha512-EvuabjzzZ9E2+OaYf+7P9OAiiwbTxKYL0oGLnREQd+Su2NTQBpomkdlkBowFvyWsaV0d1sSGxrKpSNcrhPqbxg== + "@google-cloud/pubsub@^1.7.0": version "1.7.3" resolved "https://registry.npmjs.org/@google-cloud/pubsub/-/pubsub-1.7.3.tgz#0fa51d67eb4db979a66b05738d81c3cef992b5bf" @@ -1358,6 +1400,34 @@ p-defer "^3.0.0" protobufjs "^6.8.1" +"@google-cloud/storage@^5.0.0": + version "5.1.2" + resolved "https://registry.npmjs.org/@google-cloud/storage/-/storage-5.1.2.tgz#e80cc3922046facf3e278daa90f43cda31745cdc" + integrity sha512-j2blsBVv6Tt5Z7ff6kOSIg5zVQPdlcTQh/4zMb9h7xMj4ekwndQA60le8c1KEa+Y6SR3EM6ER2AvKYK53P7vdQ== + dependencies: + "@google-cloud/common" "^3.0.0" + "@google-cloud/paginator" "^3.0.0" + "@google-cloud/promisify" "^2.0.0" + arrify "^2.0.0" + compressible "^2.0.12" + concat-stream "^2.0.0" + date-and-time "^0.13.0" + duplexify "^3.5.0" + extend "^3.0.2" + gaxios "^3.0.0" + gcs-resumable-upload "^3.0.0" + hash-stream-validation "^0.2.2" + mime "^2.2.0" + mime-types "^2.0.8" + onetime "^5.1.0" + p-limit "^3.0.1" + pumpify "^2.0.0" + readable-stream "^3.4.0" + snakeize "^0.1.0" + stream-events "^1.0.1" + through2 "^4.0.0" + xdg-basedir "^4.0.0" + "@grpc/grpc-js@^0.6.12": version "0.6.18" resolved "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-0.6.18.tgz#ba3b3dfef869533161d192a385412a4abd0db127" @@ -1379,6 +1449,13 @@ dependencies: semver "^6.2.0" +"@grpc/grpc-js@~1.1.1": + version "1.1.2" + resolved "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.1.2.tgz#3125484c19fd1c9e3f4dc7a880f9fa1b872b46c8" + integrity sha512-k2u86Bkm/3xrjUaSWeIyzXScBt/cC8uE7BznR0cpueQi11R33W6qfJdMrkrsmSHirp5likR55JSXUrcWG6ybHA== + dependencies: + semver "^6.2.0" + "@grpc/proto-loader@^0.5.0", "@grpc/proto-loader@^0.5.1": version "0.5.4" resolved "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.4.tgz#038a3820540f621eeb1b05d81fbedfb045e14de0" @@ -2460,6 +2537,11 @@ resolved "https://registry.npmjs.org/@testim/chrome-version/-/chrome-version-1.0.7.tgz#0cd915785ec4190f08a3a6acc9b61fc38fb5f1a9" integrity sha512-8UT/J+xqCYfn3fKtOznAibsHpiuDshCb0fwgWxRazTT19Igp9ovoXMPhXyLD6m3CKQGTMHgqoxaFfMWaL40Rnw== +"@tootallnate/once@1": + version "1.1.2" + resolved "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" + integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== + "@types/argparse@1.0.38": version "1.0.38" resolved "https://registry.npmjs.org/@types/argparse/-/argparse-1.0.38.tgz#a81fd8606d481f873a3800c6ebae4f1d768a56a9" @@ -2640,6 +2722,11 @@ resolved "https://registry.npmjs.org/@types/node/-/node-10.17.18.tgz#ae364d97382aacdebf583fa4e7132af2dfe56a0c" integrity sha512-DQ2hl/Jl3g33KuAUOcMrcAOtsbzb+y/ufakzAdeK9z/H/xsvkpbETZZbPNMIiQuk24f5ZRMCcZIViAwyFIiKmg== +"@types/node@^10.10.0": + version "10.17.27" + resolved "https://registry.npmjs.org/@types/node/-/node-10.17.27.tgz#391cb391c75646c8ad2a7b6ed3bbcee52d1bdf19" + integrity sha512-J0oqm9ZfAXaPdwNXMMgAhylw5fhmXkToJd06vuDUSAgEDZ/n/69/69UmyBZbc+zT34UnShuDSBqvim3SPnozJg== + "@types/node@^12.7.1": version "12.12.40" resolved "https://registry.npmjs.org/@types/node/-/node-12.12.40.tgz#f6fdf7d6675ee9eb7b8931d3fff8c1f163464ea9" @@ -3844,6 +3931,11 @@ bignumber.js@^7.0.0: resolved "https://registry.npmjs.org/bignumber.js/-/bignumber.js-7.2.1.tgz#80c048759d826800807c4bfd521e50edbba57a5f" integrity sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ== +bignumber.js@^9.0.0: + version "9.0.0" + resolved "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz#805880f84a329b5eac6e7cb6f8274b6d82bdf075" + integrity sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A== + binary-extensions@^1.0.0: version "1.13.1" resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" @@ -4935,7 +5027,7 @@ compress-commons@^2.1.1: normalize-path "^3.0.0" readable-stream "^2.3.6" -compressible@~2.0.16: +compressible@^2.0.12, compressible@~2.0.16: version "2.0.18" resolved "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba" integrity sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg== @@ -5007,7 +5099,7 @@ configstore@^3.0.0: write-file-atomic "^2.0.0" xdg-basedir "^3.0.0" -configstore@^5.0.1: +configstore@^5.0.0, configstore@^5.0.1: version "5.0.1" resolved "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz#d365021b5df4b98cdd187d6a3b0e3f6a7cc5ed96" integrity sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA== @@ -5500,6 +5592,11 @@ dataloader@^1.4.0: resolved "https://registry.npmjs.org/dataloader/-/dataloader-1.4.0.tgz#bca11d867f5d3f1b9ed9f737bd15970c65dff5c8" integrity sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw== +date-and-time@^0.13.0: + version "0.13.1" + resolved "https://registry.npmjs.org/date-and-time/-/date-and-time-0.13.1.tgz#d12ba07ac840d5b112dc4c83f8a03e8a51f78dd6" + integrity sha512-/Uge9DJAT+s+oAcDxtBhyR8+sKjUnZbYmyhbmWjTHNtX7B7oWD8YyYdeXcBRbwSj6hVvj+IQegJam7m7czhbFw== + date-fns@^1.27.2: version "1.30.1" resolved "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" @@ -5814,6 +5911,13 @@ diagnostics@^1.1.1: enabled "1.0.x" kuler "1.0.x" +dicer@^0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/dicer/-/dicer-0.3.0.tgz#eacd98b3bfbf92e8ab5c2fdb71aaac44bb06b872" + integrity sha512-MdceRRWqltEG2dZqO769g27N/3PXfcKl04VhYnBlo2YhH7zPi88VebsjTKclaOyiuMaGU72hTfw3VkUitGcVCA== + dependencies: + streamsearch "0.1.2" + diff@3.5.0: version "3.5.0" resolved "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" @@ -5940,7 +6044,7 @@ duplexer@^0.1.1: resolved "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" integrity sha1-rOb/gIwc5mtX0ev5eXessCM0z8E= -duplexify@^3.4.2, duplexify@^3.6.0: +duplexify@^3.4.2, duplexify@^3.5.0, duplexify@^3.6.0: version "3.7.1" resolved "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz#2a4df5317f6ccfd91f86d6fd25d8d8a103b88309" integrity sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g== @@ -5950,6 +6054,16 @@ duplexify@^3.4.2, duplexify@^3.6.0: readable-stream "^2.0.0" stream-shift "^1.0.0" +duplexify@^4.1.1: + version "4.1.1" + resolved "https://registry.npmjs.org/duplexify/-/duplexify-4.1.1.tgz#7027dc374f157b122a8ae08c2d3ea4d2d953aa61" + integrity sha512-DY3xVEmVHTv1wSzKNbwoU6nVjzI369Y6sPoqfYr0/xlx3IdX2n94xIszTcjPO8W8ZIv0Wb0PXNcjuZyT4wiICA== + dependencies: + end-of-stream "^1.4.1" + inherits "^2.0.3" + readable-stream "^3.1.1" + stream-shift "^1.0.0" + each-props@^1.3.0: version "1.3.2" resolved "https://registry.npmjs.org/each-props/-/each-props-1.3.2.tgz#ea45a414d16dd5cfa419b1a81720d5ca06892333" @@ -6127,7 +6241,7 @@ enquirer@^2.3.0, enquirer@^2.3.5: dependencies: ansi-colors "^3.2.1" -ent@~2.2.0: +ent@^2.2.0, ent@~2.2.0: version "2.2.0" resolved "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz#e964219325a21d05f44466a2f686ed6ce5f5dd1d" integrity sha1-6WQhkyWiHQX0RGai9obtbOX13R0= @@ -6932,6 +7046,20 @@ fined@^1.0.1: object.pick "^1.2.0" parse-filepath "^1.0.1" +firebase-admin@^9.0.0: + version "9.0.0" + resolved "https://registry.npmjs.org/firebase-admin/-/firebase-admin-9.0.0.tgz#d68551a33e9c14252453743cd6ef9e5ad3251816" + integrity sha512-LP4xD+JxfEZ+e1kBIKT2kbDa9UFChwgL4488NexvTjhynNcJsKCGmawl2FMvZ2UPwXKgWBpLXJ07cYp6gk5lcw== + dependencies: + "@firebase/database" "^0.6.0" + "@types/node" "^10.10.0" + dicer "^0.3.0" + jsonwebtoken "^8.5.1" + node-forge "^0.9.1" + optionalDependencies: + "@google-cloud/firestore" "^4.0.0" + "@google-cloud/storage" "^5.0.0" + firebase-functions@3.7.0: version "3.7.0" resolved "https://registry.npmjs.org/firebase-functions/-/firebase-functions-3.7.0.tgz#e9df62f2a46775eb887835839d8b3f39139ba113" @@ -6998,6 +7126,62 @@ firebase-tools@8.5.0: winston "^3.0.0" ws "^7.2.3" +firebase-tools@^8.5.0: + version "8.6.0" + resolved "https://registry.npmjs.org/firebase-tools/-/firebase-tools-8.6.0.tgz#c18533131170d2e9d069d50ed83ff62d49209e50" + integrity sha512-8w4vIe7LIMltnxqUyYeZ55YPA+fvmIh0P75ML+b8lt5XT0C1MIs/y2ft4Zh6SetKLTyB3wjz0btdf6MeUkRsbQ== + dependencies: + "@google-cloud/pubsub" "^1.7.0" + JSONStream "^1.2.1" + archiver "^3.0.0" + body-parser "^1.19.0" + chokidar "^3.0.2" + cjson "^0.3.1" + cli-color "^1.2.0" + cli-table "^0.3.1" + commander "^4.0.1" + configstore "^5.0.1" + cross-env "^5.1.3" + cross-spawn "^7.0.1" + csv-streamify "^3.0.4" + dotenv "^6.1.0" + exit-code "^1.0.2" + express "^4.16.4" + filesize "^3.1.3" + fs-extra "^0.23.1" + glob "^7.1.2" + google-auth-library "^5.5.0" + google-gax "~1.12.0" + inquirer "~6.3.1" + js-yaml "^3.13.1" + jsonschema "^1.0.2" + jsonwebtoken "^8.2.1" + leven "^3.1.0" + lodash "^4.17.14" + marked "^0.7.0" + marked-terminal "^3.3.0" + minimatch "^3.0.4" + morgan "^1.10.0" + open "^6.3.0" + ora "^3.4.0" + plist "^3.0.1" + portfinder "^1.0.23" + progress "^2.0.3" + request "^2.87.0" + rimraf "^3.0.0" + semver "^5.7.1" + superstatic "^6.0.1" + tar "^4.3.0" + tcp-port-used "^1.0.1" + tmp "0.0.33" + triple-beam "^1.3.0" + universal-analytics "^0.4.16" + unzipper "^0.10.10" + update-notifier "^2.5.0" + uuid "^3.0.0" + winston "^3.0.0" + ws "^7.2.3" + flagged-respawn@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.1.tgz#e7de6f1279ddd9ca9aac8a5971d618606b3aab41" @@ -7270,6 +7454,17 @@ gaxios@^2.1.0: is-stream "^2.0.0" node-fetch "^2.3.0" +gaxios@^3.0.0: + version "3.0.4" + resolved "https://registry.npmjs.org/gaxios/-/gaxios-3.0.4.tgz#4714fbb003d6f6f08a297f772284463e041e04db" + integrity sha512-97NmFuMETFQh6gqPUxkqjxRMjmY8aRKRMphIkgO/b90AbCt5wAVuXsp8oWjIXlLN2pIK/fsXD8edcM7ULkFMLg== + dependencies: + abort-controller "^3.0.0" + extend "^3.0.2" + https-proxy-agent "^5.0.0" + is-stream "^2.0.0" + node-fetch "^2.3.0" + gcp-metadata@^3.4.0: version "3.5.0" resolved "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-3.5.0.tgz#6d28343f65a6bbf8449886a0c0e4a71c77577055" @@ -7278,6 +7473,27 @@ gcp-metadata@^3.4.0: gaxios "^2.1.0" json-bigint "^0.3.0" +gcp-metadata@^4.1.0: + version "4.1.4" + resolved "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-4.1.4.tgz#3adadb9158c716c325849ee893741721a3c09e7e" + integrity sha512-5J/GIH0yWt/56R3dNaNWPGQ/zXsZOddYECfJaqxFWgrZ9HC2Kvc5vl9upOgUUHKzURjAVf2N+f6tEJiojqXUuA== + dependencies: + gaxios "^3.0.0" + json-bigint "^1.0.0" + +gcs-resumable-upload@^3.0.0: + version "3.1.1" + resolved "https://registry.npmjs.org/gcs-resumable-upload/-/gcs-resumable-upload-3.1.1.tgz#67c766a0555d6a352f9651b7603337207167d0de" + integrity sha512-RS1osvAicj9+MjCc6jAcVL1Pt3tg7NK2C2gXM5nqD1Gs0klF2kj5nnAFSBy97JrtslMIQzpb7iSuxaG8rFWd2A== + dependencies: + abort-controller "^3.0.0" + configstore "^5.0.0" + extend "^3.0.2" + gaxios "^3.0.0" + google-auth-library "^6.0.0" + pumpify "^2.0.0" + stream-events "^1.0.4" + geckodriver@1.19.1: version "1.19.1" resolved "https://registry.npmjs.org/geckodriver/-/geckodriver-1.19.1.tgz#556f95fd6451b553cec89f81f81abbefce10d6e5" @@ -7654,6 +7870,21 @@ google-auth-library@^5.0.0, google-auth-library@^5.5.0: jws "^4.0.0" lru-cache "^5.0.0" +google-auth-library@^6.0.0: + version "6.0.5" + resolved "https://registry.npmjs.org/google-auth-library/-/google-auth-library-6.0.5.tgz#f7266859dbb02dadf92af479272fb1e344635cb5" + integrity sha512-Wj31lfTm2yR4g3WfOOB1Am1tt478Xq9OvzTPQJi17tn/I9R5IcsxjANBsE93nYmxYxtwDedhOdIb8l3vSPG49Q== + dependencies: + arrify "^2.0.0" + base64-js "^1.3.0" + ecdsa-sig-formatter "^1.0.11" + fast-text-encoding "^1.0.0" + gaxios "^3.0.0" + gcp-metadata "^4.1.0" + gtoken "^5.0.0" + jws "^4.0.0" + lru-cache "^6.0.0" + google-closure-compiler-java@^20200112.0.0: version "20200112.0.0" resolved "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20200112.0.0.tgz#2b99f5e2869a573a1b35558ff3b6e6bc054a116f" @@ -7767,6 +7998,26 @@ google-gax@^1.14.2: semver "^6.0.0" walkdir "^0.4.0" +google-gax@^2.2.0: + version "2.6.3" + resolved "https://registry.npmjs.org/google-gax/-/google-gax-2.6.3.tgz#81510dfd44f7827937d0b81ae6d9f96d85a247f1" + integrity sha512-hqY6H53Qmaku8rE8dGAM89RSUc1nc4JYG81whrVJRmDQZ2jhJK8AwCd3pJQ3V48rgp9xiWBzBQsyeaxnb3Eikw== + dependencies: + "@grpc/grpc-js" "~1.1.1" + "@grpc/proto-loader" "^0.5.1" + "@types/long" "^4.0.0" + abort-controller "^3.0.0" + duplexify "^3.6.0" + google-auth-library "^6.0.0" + is-stream-ended "^0.1.4" + lodash.at "^4.6.0" + lodash.has "^4.5.2" + node-fetch "^2.6.0" + protobufjs "^6.9.0" + retry-request "^4.0.0" + semver "^6.0.0" + walkdir "^0.4.0" + google-gax@~1.12.0: version "1.12.0" resolved "https://registry.npmjs.org/google-gax/-/google-gax-1.12.0.tgz#f926f7e6abda245db38ecbebbbf58daaf3a8f687" @@ -7794,6 +8045,13 @@ google-p12-pem@^2.0.0: dependencies: node-forge "^0.9.0" +google-p12-pem@^3.0.0: + version "3.0.2" + resolved "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.0.2.tgz#12d443994b6f4cd8c9e4ac479f2f18d4694cbdb8" + integrity sha512-tbjzndQvSIHGBLzHnhDs3cL4RBjLbLXc2pYvGH+imGVu5b4RMAttUTdnmW2UH0t11QeBTXZ7wlXPS7hrypO/tg== + dependencies: + node-forge "^0.9.0" + got@5.6.0: version "5.6.0" resolved "https://registry.npmjs.org/got/-/got-5.6.0.tgz#bb1d7ee163b78082bbc8eb836f3f395004ea6fbf" @@ -7868,6 +8126,16 @@ gtoken@^4.1.0: jws "^4.0.0" mime "^2.2.0" +gtoken@^5.0.0: + version "5.0.2" + resolved "https://registry.npmjs.org/gtoken/-/gtoken-5.0.2.tgz#688e4334b99378b4d4a67add19e1680f411ba74d" + integrity sha512-lull70rHCTvRTmAt+R/6W5bTtx4MjHku7AwJwK5fGqhOmygcZud0nrZcX+QUNfBJwCzqy7S5i1Bc4NYnr5PMMA== + dependencies: + gaxios "^3.0.0" + google-p12-pem "^3.0.0" + jws "^4.0.0" + mime "^2.2.0" + gulp-cli@^2.2.0: version "2.2.0" resolved "https://registry.npmjs.org/gulp-cli/-/gulp-cli-2.2.0.tgz#5533126eeb7fe415a7e3e84a297d334d5cf70ebc" @@ -8068,6 +8336,13 @@ hash-base@^3.0.0: inherits "^2.0.1" safe-buffer "^5.0.1" +hash-stream-validation@^0.2.2: + version "0.2.3" + resolved "https://registry.npmjs.org/hash-stream-validation/-/hash-stream-validation-0.2.3.tgz#44e3479d1767c4f1d6924cc2da61eca08ebba8af" + integrity sha512-OEohGLoUOh+bwsIpHpdvhIXFyRGjeLqJbT8Yc5QTZPbRM7LKywagTQxnX/6mghLDOrD9YGz88hy5mLN2eKflYQ== + dependencies: + through2 "^2.0.0" + hash.js@^1.0.0, hash.js@^1.0.3: version "1.1.7" resolved "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" @@ -8170,6 +8445,15 @@ http-proxy-agent@^2.1.0: agent-base "4" debug "3.1.0" +http-proxy-agent@^4.0.0: + version "4.0.1" + resolved "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz#8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a" + integrity sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg== + dependencies: + "@tootallnate/once" "1" + agent-base "6" + debug "4" + http-proxy@^1.18.0: version "1.18.0" resolved "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.0.tgz#dbe55f63e75a347db7f3d99974f2692a314a6a3a" @@ -9262,6 +9546,13 @@ json-bigint@^0.3.0: dependencies: bignumber.js "^7.0.0" +json-bigint@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1" + integrity sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ== + dependencies: + bignumber.js "^9.0.0" + json-parse-better-errors@^1.0.0, json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" @@ -9356,7 +9647,7 @@ jsonschema@^1.0.2: resolved "https://registry.npmjs.org/jsonschema/-/jsonschema-1.2.6.tgz#52b0a8e9dc06bbae7295249d03e4b9faee8a0c0b" integrity sha512-SqhURKZG07JyKKeo/ir24QnS4/BV7a6gQy93bUSe4lUdNp0QNpIz2c9elWJQ9dpc5cQYY6cvCzgRwy0MQCLyqA== -jsonwebtoken@^8.2.1: +jsonwebtoken@^8.2.1, jsonwebtoken@^8.5.1: version "8.5.1" resolved "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz#00e71e0b8df54c2121a1f26137df2280673bcc0d" integrity sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w== @@ -10258,6 +10549,13 @@ lru-cache@^5.0.0, lru-cache@^5.1.1: dependencies: yallist "^3.0.2" +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + lru-queue@0.1: version "0.1.0" resolved "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" @@ -10552,6 +10850,18 @@ mime-db@1.43.0, "mime-db@>= 1.43.0 < 2": resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz#0a12e0502650e473d735535050e7c8f4eb4fae58" integrity sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ== +mime-db@1.44.0: + version "1.44.0" + resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92" + integrity sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg== + +mime-types@^2.0.8: + version "2.1.27" + resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f" + integrity sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w== + dependencies: + mime-db "1.44.0" + mime-types@^2.1.12, mime-types@^2.1.16, mime-types@~2.1.19, mime-types@~2.1.24: version "2.1.26" resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz#9c921fc09b7e149a65dfdc0da4d20997200b0a06" @@ -10937,7 +11247,7 @@ node-fetch-npm@^2.0.2: json-parse-better-errors "^1.0.0" safe-buffer "^5.1.1" -node-fetch@2.6.0, node-fetch@^2.3.0, node-fetch@^2.5.0, node-fetch@^2.6.0: +node-fetch@2.6.0, node-fetch@^2.2.0, node-fetch@^2.3.0, node-fetch@^2.5.0, node-fetch@^2.6.0: version "2.6.0" resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== @@ -10950,7 +11260,7 @@ node-fetch@^1.0.1: encoding "^0.1.11" is-stream "^1.0.1" -node-forge@^0.9.0: +node-forge@^0.9.0, node-forge@^0.9.1: version "0.9.1" resolved "https://registry.npmjs.org/node-forge/-/node-forge-0.9.1.tgz#775368e6846558ab6676858a4d8c6e8d16c677b5" integrity sha512-G6RlQt5Sb4GMBzXvhfkeFmbqR6MzhtnT7VTHuLadjkii3rdYHNdw0m8zA4BTxVIh68FicCQ2NSUANpsqkr9jvQ== @@ -11523,6 +11833,13 @@ p-limit@^2.0.0, p-limit@^2.2.0: dependencies: p-try "^2.0.0" +p-limit@^3.0.1: + version "3.0.2" + resolved "https://registry.npmjs.org/p-limit/-/p-limit-3.0.2.tgz#1664e010af3cadc681baafd3e2a437be7b0fb5fe" + integrity sha512-iwqZSOoWIW+Ew4kAGUlN16J4M7OB3ysMLSZtnhmqx7njIHFPlxWBX8xo3lVTyFVq6mI/lL9qt2IsN1sHwaxJkg== + dependencies: + p-try "^2.0.0" + p-locate@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" @@ -12154,6 +12471,25 @@ protobufjs@^6.8.1, protobufjs@^6.8.6, protobufjs@^6.8.8, protobufjs@^6.8.9: "@types/node" "^10.1.0" long "^4.0.0" +protobufjs@^6.9.0: + version "6.10.1" + resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-6.10.1.tgz#e6a484dd8f04b29629e9053344e3970cccf13cd2" + integrity sha512-pb8kTchL+1Ceg4lFd5XUpK8PdWacbvV5SK2ULH2ebrYtl4GjJmS24m6CKME67jzV53tbJxHlnNOSqQHbTsR9JQ== + 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.1" + "@types/node" "^13.7.0" + long "^4.0.0" + protocols@^1.1.0, protocols@^1.4.0: version "1.4.7" resolved "https://registry.npmjs.org/protocols/-/protocols-1.4.7.tgz#95f788a4f0e979b291ffefcf5636ad113d037d32" @@ -12247,6 +12583,15 @@ pumpify@^1.3.3, pumpify@^1.3.5: inherits "^2.0.3" pump "^2.0.0" +pumpify@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/pumpify/-/pumpify-2.0.1.tgz#abfc7b5a621307c728b551decbbefb51f0e4aa1e" + integrity sha512-m7KOje7jZxrmutanlkS1daj1dS6z6BgslzOXmcSEpIlCxM3VJH7lG5QLeck/6hgF6F4crFf01UtQmNsJfweTAw== + dependencies: + duplexify "^4.1.1" + inherits "^2.0.3" + pump "^3.0.0" + punycode@1.3.2: version "1.3.2" resolved "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" @@ -12476,7 +12821,7 @@ read@1, read@~1.0.1: string_decoder "~1.1.1" util-deprecate "~1.0.1" -"readable-stream@2 || 3", readable-stream@^3.0.2, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0: +"readable-stream@2 || 3", readable-stream@3, readable-stream@^3.0.2, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0: version "3.6.0" resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== @@ -12865,7 +13210,7 @@ ret@~0.1.10: resolved "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== -retry-request@^4.0.0: +retry-request@^4.0.0, retry-request@^4.1.1: version "4.1.1" resolved "https://registry.npmjs.org/retry-request/-/retry-request-4.1.1.tgz#f676d0db0de7a6f122c048626ce7ce12101d2bd8" integrity sha512-BINDzVtLI2BDukjWmjAIRZ0oglnCAkpP2vQjM3jdLhmT62h0xnQgciPwBRDAvHqpkPT2Wo1XuUyLyn6nbGrZQQ== @@ -13468,6 +13813,11 @@ smartwrap@^1.2.3: wcwidth "^1.0.1" yargs "^15.1.0" +snakeize@^0.1.0: + version "0.1.0" + resolved "https://registry.npmjs.org/snakeize/-/snakeize-0.1.0.tgz#10c088d8b58eb076b3229bb5a04e232ce126422d" + integrity sha1-EMCI2LWOsHazIpu1oE4jLOEmQi0= + snapdragon-node@^2.0.1: version "2.1.1" resolved "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" @@ -13836,6 +14186,13 @@ stream-each@^1.1.0: end-of-stream "^1.1.0" stream-shift "^1.0.0" +stream-events@^1.0.1, stream-events@^1.0.4, stream-events@^1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/stream-events/-/stream-events-1.0.5.tgz#bbc898ec4df33a4902d892333d47da9bf1c406d5" + integrity sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg== + dependencies: + stubs "^3.0.0" + stream-exhaust@^1.0.1: version "1.0.2" resolved "https://registry.npmjs.org/stream-exhaust/-/stream-exhaust-1.0.2.tgz#acdac8da59ef2bc1e17a2c0ccf6c320d120e555d" @@ -13907,6 +14264,11 @@ streamroller@^2.2.4: debug "^4.1.1" fs-extra "^8.1.0" +streamsearch@0.1.2: + version "0.1.2" + resolved "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz#808b9d0e56fc273d809ba57338e929919a1a9f1a" + integrity sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo= + string-length@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/string-length/-/string-length-1.0.1.tgz#56970fb1c38558e9e70b728bf3de269ac45adfac" @@ -14096,6 +14458,11 @@ strong-log-transformer@^2.0.0: minimist "^1.2.0" through "^2.3.4" +stubs@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz#e8d2ba1fa9c90570303c030b6900f7d5f89abe5b" + integrity sha1-6NK6H6nJBXAwPAMLaQD31fiavls= + subarg@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz#f62cf17581e996b48fc965699f54c06ae268b8d2" @@ -14195,7 +14562,6 @@ symbol-observable@^1.1.0: "sync-promise@git+https://github.com/brettz9/sync-promise.git#full-sync-missing-promise-features": version "1.0.1" - uid "25845a49a00aa2d2c985a5149b97c86a1fcdc75a" resolved "git+https://github.com/brettz9/sync-promise.git#25845a49a00aa2d2c985a5149b97c86a1fcdc75a" syntax-error@^1.1.1: @@ -14265,6 +14631,17 @@ tcp-port-used@^1.0.1: debug "4.1.0" is2 "2.0.1" +teeny-request@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/teeny-request/-/teeny-request-7.0.0.tgz#0e5c090bd9102ed559ffc8c9ddb00fbe1256db30" + integrity sha512-kWD3sdGmIix6w7c8ZdVKxWq+3YwVPGWz+Mq0wRZXayEKY/YHb63b8uphfBzcFDmyq8frD9+UTc3wLyOhltRbtg== + dependencies: + http-proxy-agent "^4.0.0" + https-proxy-agent "^5.0.0" + node-fetch "^2.2.0" + stream-events "^1.0.5" + uuid "^8.0.0" + temp-dir@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz#0a7c0ea26d3a39afa7e0ebea9c1fc0bc4daa011d" @@ -14401,6 +14778,13 @@ through2@^3.0.0, through2@^3.0.1: dependencies: readable-stream "2 || 3" +through2@^4.0.0: + version "4.0.2" + resolved "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz#a7ce3ac2a7a8b0b966c80e7c49f0484c3b239764" + integrity sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw== + dependencies: + readable-stream "3" + through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@^2.3.8: version "2.3.8" resolved "https://registry.npmjs.org/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" @@ -15173,6 +15557,11 @@ uuid@^3.0.0, uuid@^3.0.1, uuid@^3.3.2, uuid@^3.3.3: resolved "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +uuid@^8.0.0: + version "8.2.0" + resolved "https://registry.npmjs.org/uuid/-/uuid-8.2.0.tgz#cb10dd6b118e2dada7d0cd9730ba7417c93d920e" + integrity sha512-CYpGiFTUrmI6OBMkAdjSDM0k5h8SkkiTP4WAjQgDgNB1S3Ou9VBEvr6q0Kv2H1mMk7IWfxYGpMH5sd5AvcIV2Q== + v8-compile-cache@^2.0.3: version "2.1.0" resolved "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" @@ -15509,7 +15898,6 @@ websocket-extensions@>=0.1.1: "websql@git+https://github.com/brettz9/node-websql.git#configurable-secure2": version "1.0.0" - uid "5149bc0763376ca757fc32dc74345ada0467bfbb" resolved "git+https://github.com/brettz9/node-websql.git#5149bc0763376ca757fc32dc74345ada0467bfbb" dependencies: argsarray "^0.0.1" @@ -15833,6 +16221,11 @@ yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: resolved "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + yaml@^1.7.2: version "1.8.3" resolved "https://registry.npmjs.org/yaml/-/yaml-1.8.3.tgz#2f420fca58b68ce3a332d0ca64be1d191dd3f87a" From 318ecca5f4d0ec15b0c1740ec1c792daa99e26ce Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 17 Jul 2020 11:07:24 +0100 Subject: [PATCH 04/18] Fix how env is checked --- packages/rules-unit-testing/src/api/index.ts | 71 +++++++++++++++----- 1 file changed, 53 insertions(+), 18 deletions(-) diff --git a/packages/rules-unit-testing/src/api/index.ts b/packages/rules-unit-testing/src/api/index.ts index 469674679f0..d3670cf3188 100644 --- a/packages/rules-unit-testing/src/api/index.ts +++ b/packages/rules-unit-testing/src/api/index.ts @@ -26,25 +26,20 @@ import { Component, ComponentType } from '@firebase/component'; export { database, firestore } from 'firebase'; /** If this environment variable is set, use it for the database emulator's address. */ -const DATABASE_ADDRESS_ENV: string = 'FIREBASE_DATABASE_EMULATOR_ADDRESS'; +const DATABASE_ADDRESS_ENV: string = 'FIREBASE_DATABASE_EMULATOR_HOST'; /** The default address for the local database emulator. */ const DATABASE_ADDRESS_DEFAULT: string = 'localhost:9000'; -/** The actual address for the database emulator */ -const DATABASE_ADDRESS: string = - process.env[DATABASE_ADDRESS_ENV] || DATABASE_ADDRESS_DEFAULT; /** If any of environment variable is set, use it for the Firestore emulator. */ -const FIRESTORE_ADDRESS_ENVS: string[] = [ - 'FIRESTORE_EMULATOR_HOST', - 'FIREBASE_FIRESTORE_EMULATOR_ADDRESS' -]; +const FIRESTORE_ADDRESS_ENV: string = 'FIRESTORE_EMULATOR_HOST'; /** The default address for the local Firestore emulator. */ const FIRESTORE_ADDRESS_DEFAULT: string = 'localhost:8080'; + +/** The actual address for the database emulator */ +let _databaseAddress: string | undefined = undefined; + /** The actual address for the Firestore emulator */ -const FIRESTORE_ADDRESS: string = FIRESTORE_ADDRESS_ENVS.reduce( - (addr, name) => process.env[name] || addr, - FIRESTORE_ADDRESS_DEFAULT -); +let _firestoreAddress: string | undefined = undefined; /** Create an unsecured JWT for the given auth payload. See https://tools.ietf.org/html/rfc7519#section-6. */ function createUnsecuredJwt(auth: object): string { @@ -102,7 +97,7 @@ export function initializeAdminApp(options: AdminAppOptions): firebase.app.App { if (options.projectId) { app.firestore().settings({ - host: FIRESTORE_ADDRESS, + host: getFirestoreHost(), ssl: false }); } @@ -110,6 +105,38 @@ export function initializeAdminApp(options: AdminAppOptions): firebase.app.App { return app; } +function getDatabaseHost() { + if (!_databaseAddress) { + const fromEnv = process.env[DATABASE_ADDRESS_ENV]; + if (fromEnv) { + _databaseAddress = fromEnv; + } else { + console.warn( + `Warning: ${DATABASE_ADDRESS_ENV} not set, using default value ${DATABASE_ADDRESS_DEFAULT}` + ); + _databaseAddress = DATABASE_ADDRESS_DEFAULT; + } + } + + return _databaseAddress; +} + +function getFirestoreHost() { + if (!_firestoreAddress) { + const fromEnv = process.env[FIRESTORE_ADDRESS_ENV]; + if (fromEnv) { + _firestoreAddress = fromEnv; + } else { + console.warn( + `Warning: ${FIRESTORE_ADDRESS_ENV} not set, using default value ${FIRESTORE_ADDRESS_DEFAULT}` + ); + _firestoreAddress = FIRESTORE_ADDRESS_DEFAULT; + } + } + + return _firestoreAddress; +} + function getRandomAppName(): string { return 'app-' + new Date().getTime() + '-' + Math.random(); } @@ -121,7 +148,9 @@ function getAppOptions( let appOptions: { [key: string]: string } = {}; if (databaseName) { - appOptions['databaseURL'] = `http://${DATABASE_ADDRESS}?ns=${databaseName}`; + appOptions[ + 'databaseURL' + ] = `http://${getDatabaseHost()}?ns=${databaseName}`; } if (projectId) { appOptions['projectId'] = projectId; @@ -166,7 +195,7 @@ function initializeApp( } if (projectId) { app.firestore().settings({ - host: FIRESTORE_ADDRESS, + host: getFirestoreHost(), ssl: false }); } @@ -196,7 +225,9 @@ export function loadDatabaseRules( return new Promise((resolve, reject) => { request.put( { - uri: `http://${DATABASE_ADDRESS}/.settings/rules.json?ns=${options.databaseName}`, + uri: `http://${getDatabaseHost()}/.settings/rules.json?ns=${ + options.databaseName + }`, headers: { Authorization: 'Bearer owner' }, body: options.rules }, @@ -231,7 +262,9 @@ export function loadFirestoreRules( return new Promise((resolve, reject) => { request.put( { - uri: `http://${FIRESTORE_ADDRESS}/emulator/v1/projects/${options.projectId}:securityRules`, + uri: `http://${getFirestoreHost()}/emulator/v1/projects/${ + options.projectId + }:securityRules`, body: JSON.stringify({ rules: { files: [{ content: options.rules }] @@ -265,7 +298,9 @@ export function clearFirestoreData( return new Promise((resolve, reject) => { request.delete( { - uri: `http://${FIRESTORE_ADDRESS}/emulator/v1/projects/${options.projectId}/databases/(default)/documents`, + uri: `http://${getFirestoreHost()}/emulator/v1/projects/${ + options.projectId + }/databases/(default)/documents`, body: JSON.stringify({ database: `projects/${options.projectId}/databases/(default)` }) From 6b85198a26395b5f0144ae1d090c696721578712 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 17 Jul 2020 11:17:41 +0100 Subject: [PATCH 05/18] var name --- packages/rules-unit-testing/src/api/index.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/rules-unit-testing/src/api/index.ts b/packages/rules-unit-testing/src/api/index.ts index d3670cf3188..18cb2993d2b 100644 --- a/packages/rules-unit-testing/src/api/index.ts +++ b/packages/rules-unit-testing/src/api/index.ts @@ -36,10 +36,10 @@ const FIRESTORE_ADDRESS_ENV: string = 'FIRESTORE_EMULATOR_HOST'; const FIRESTORE_ADDRESS_DEFAULT: string = 'localhost:8080'; /** The actual address for the database emulator */ -let _databaseAddress: string | undefined = undefined; +let _databaseHost: string | undefined = undefined; /** The actual address for the Firestore emulator */ -let _firestoreAddress: string | undefined = undefined; +let _firestoreHost: string | undefined = undefined; /** Create an unsecured JWT for the given auth payload. See https://tools.ietf.org/html/rfc7519#section-6. */ function createUnsecuredJwt(auth: object): string { @@ -106,35 +106,35 @@ export function initializeAdminApp(options: AdminAppOptions): firebase.app.App { } function getDatabaseHost() { - if (!_databaseAddress) { + if (!_databaseHost) { const fromEnv = process.env[DATABASE_ADDRESS_ENV]; if (fromEnv) { - _databaseAddress = fromEnv; + _databaseHost = fromEnv; } else { console.warn( `Warning: ${DATABASE_ADDRESS_ENV} not set, using default value ${DATABASE_ADDRESS_DEFAULT}` ); - _databaseAddress = DATABASE_ADDRESS_DEFAULT; + _databaseHost = DATABASE_ADDRESS_DEFAULT; } } - return _databaseAddress; + return _databaseHost; } function getFirestoreHost() { - if (!_firestoreAddress) { + if (!_firestoreHost) { const fromEnv = process.env[FIRESTORE_ADDRESS_ENV]; if (fromEnv) { - _firestoreAddress = fromEnv; + _firestoreHost = fromEnv; } else { console.warn( `Warning: ${FIRESTORE_ADDRESS_ENV} not set, using default value ${FIRESTORE_ADDRESS_DEFAULT}` ); - _firestoreAddress = FIRESTORE_ADDRESS_DEFAULT; + _firestoreHost = FIRESTORE_ADDRESS_DEFAULT; } } - return _firestoreAddress; + return _firestoreHost; } function getRandomAppName(): string { From a7351d8cd2130ad7295c31a5ae247cdfa7d8d24a Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 3 Aug 2020 11:27:47 +0100 Subject: [PATCH 06/18] Deps --- packages/rules-unit-testing/package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/rules-unit-testing/package.json b/packages/rules-unit-testing/package.json index ac441f2fc9e..370169fc86c 100644 --- a/packages/rules-unit-testing/package.json +++ b/packages/rules-unit-testing/package.json @@ -7,7 +7,9 @@ "engines": { "node": "^8.13.0 || >=10.10.0" }, - "files": ["dist"], + "files": [ + "dist" + ], "scripts": { "build": "rollup -c", "build:deps": "lerna run --scope @firebase/rules-unit-testing --include-dependencies build", @@ -26,8 +28,8 @@ }, "devDependencies": { "@types/request": "2.48.5", - "firebase-tools": "^8.5.0", "firebase-admin": "^9.0.0", + "firebase-tools": "^8.6.0", "rollup": "2.23.0", "rollup-plugin-typescript2": "0.27.1" }, From f4864f0f05676ff5fb32aab4a972e9442ed7e315 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 3 Aug 2020 18:59:20 +0100 Subject: [PATCH 07/18] Update Firestore dep --- packages/rules-unit-testing/package.json | 2 + yarn.lock | 205 ++--------------------- 2 files changed, 14 insertions(+), 193 deletions(-) diff --git a/packages/rules-unit-testing/package.json b/packages/rules-unit-testing/package.json index 370169fc86c..25cdd830cab 100644 --- a/packages/rules-unit-testing/package.json +++ b/packages/rules-unit-testing/package.json @@ -27,6 +27,7 @@ "request": "2.88.2" }, "devDependencies": { + "@google-cloud/firestore": "^4.2.0", "@types/request": "2.48.5", "firebase-admin": "^9.0.0", "firebase-tools": "^8.6.0", @@ -34,6 +35,7 @@ "rollup-plugin-typescript2": "0.27.1" }, "peerDependencies": { + "@google-cloud/firestore": "^4.2.0", "firebase-admin": "^9.0.0" }, "repository": { diff --git a/yarn.lock b/yarn.lock index e041ab83e70..221419e7eaf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1068,7 +1068,6 @@ unique-filename "^1.1.1" which "^1.3.1" -<<<<<<< HEAD "@google-cloud/common@^3.0.0": version "3.3.2" resolved "https://registry.npmjs.org/@google-cloud/common/-/common-3.3.2.tgz#595ce85ebbcaa8b38519336bf6747e32e7706df7" @@ -1092,36 +1091,15 @@ fast-deep-equal "^3.1.1" functional-red-black-tree "^1.0.1" google-gax "^2.2.0" -======= -"@firebase/component@0.1.16": - version "0.1.16" - resolved "https://registry.npmjs.org/@firebase/component/-/component-0.1.16.tgz#7a0dbdfff1485d45b8485db87a982f053e68761a" - integrity sha512-FvffvFN0LWgv1H/FIyruTECOL69Dhy+JfwoTq+mV39V8Mz9lNpo41etonL5AOr7KmXxYJVbNwkx0L9Ei88i7JA== - dependencies: - "@firebase/util" "0.2.50" - tslib "^1.11.1" -"@firebase/firestore@1.16.1": - version "1.16.1" - resolved "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.16.1.tgz#ddf4e357b4d847abe6a57a89d3e2d5b950339176" - integrity sha512-TGtvNIGHMEFFEuOSsRswou576GPZY39vXIsenn0B1Dqz9ACpyDtvAT9YdbG38srlPq7ZKwsP5x04LB43zZ6eAg== - dependencies: - "@firebase/component" "0.1.16" - "@firebase/firestore-types" "1.12.0" - "@firebase/logger" "0.2.6" - "@firebase/util" "0.2.50" - "@firebase/webchannel-wrapper" "0.2.41" - "@grpc/grpc-js" "^1.0.0" - "@grpc/proto-loader" "^0.5.0" - tslib "^1.11.1" - -"@firebase/util@0.2.50": - version "0.2.50" - resolved "https://registry.npmjs.org/@firebase/util/-/util-0.2.50.tgz#77666b845dcb49bc217650aa296a7a8986c06b44" - integrity sha512-vFE6+Jfc25u0ViSpFxxq0q5s+XmuJ/y7CL3ud79RQe+WLFFg+j0eH1t23k0yNSG9vZNM7h3uHRIXbV97sYLAyw== - dependencies: - tslib "^1.11.1" ->>>>>>> origin/master +"@google-cloud/firestore@^4.2.0": + version "4.2.0" + resolved "https://registry.npmjs.org/@google-cloud/firestore/-/firestore-4.2.0.tgz#5ff83838076972b86c16ae64d35429c190c69ea9" + integrity sha512-YCiKaTYCbXSoEvZ8cTmpgg4ebAvmFUOu3hj/aX+lHiOK7LsoFVi4jgNknogSqIiv04bxAysTBodpgn8XoZ4l5g== + dependencies: + fast-deep-equal "^3.1.1" + functional-red-black-tree "^1.0.1" + google-gax "^2.2.0" "@google-cloud/paginator@^2.0.0": version "2.0.3" @@ -3743,11 +3721,6 @@ bignumber.js@^9.0.0: resolved "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz#805880f84a329b5eac6e7cb6f8274b6d82bdf075" integrity sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A== -bignumber.js@^9.0.0: - version "9.0.0" - resolved "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz#805880f84a329b5eac6e7cb6f8274b6d82bdf075" - integrity sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A== - binary-extensions@^1.0.0: version "1.13.1" resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" @@ -5702,16 +5675,6 @@ di@^0.0.1: resolved "https://registry.npmjs.org/di/-/di-0.0.1.tgz#806649326ceaa7caa3306d75d985ea2748ba913c" integrity sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw= -<<<<<<< HEAD -diagnostics@^1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/diagnostics/-/diagnostics-1.1.1.tgz#cab6ac33df70c9d9a727490ae43ac995a769b22a" - integrity sha512-8wn1PmdunLJ9Tqbx+Fx/ZEuHfJf4NKSN2ZBj7SJC/OWRWha843+WsTjqMe1B5E3p28jqBlp+mJ2fPVxPyNgYKQ== - dependencies: - colorspace "1.1.x" - enabled "1.0.x" - kuler "1.0.x" - dicer@^0.3.0: version "0.3.0" resolved "https://registry.npmjs.org/dicer/-/dicer-0.3.0.tgz#eacd98b3bfbf92e8ab5c2fdb71aaac44bb06b872" @@ -5719,8 +5682,6 @@ dicer@^0.3.0: dependencies: streamsearch "0.1.2" -======= ->>>>>>> origin/master diff@3.5.0: version "3.5.0" resolved "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" @@ -6823,7 +6784,6 @@ fined@^1.0.1: object.pick "^1.2.0" parse-filepath "^1.0.1" -<<<<<<< HEAD firebase-admin@^9.0.0: version "9.0.0" resolved "https://registry.npmjs.org/firebase-admin/-/firebase-admin-9.0.0.tgz#d68551a33e9c14252453743cd6ef9e5ad3251816" @@ -6838,79 +6798,17 @@ firebase-admin@^9.0.0: "@google-cloud/firestore" "^4.0.0" "@google-cloud/storage" "^5.0.0" -firebase-functions@3.7.0: - version "3.7.0" - resolved "https://registry.npmjs.org/firebase-functions/-/firebase-functions-3.7.0.tgz#e9df62f2a46775eb887835839d8b3f39139ba113" - integrity sha512-+ROj2Gs2/KyM+T8jYo7AKaHynFsN49sXbgZMll3zuGa9/8oiDsXp9e1Iy2JMkFmSZg67jeYw5Ue2OSpz0XiqFQ== -======= firebase-functions@3.8.0: version "3.8.0" resolved "https://registry.npmjs.org/firebase-functions/-/firebase-functions-3.8.0.tgz#ac53c615ef365cd9a19604f84ec9835a340c7b76" integrity sha512-RFvoS7ZcXrk2sQ918czsjv94p4hnSoD0/e4cZ86XFpa1HbNZBI7ZuSgBCzRvlv6dJ1ArytAL13NpB1Bp2tJ6Yg== ->>>>>>> origin/master dependencies: "@types/express" "4.17.3" cors "^2.8.5" express "^4.17.1" lodash "^4.17.14" -firebase-tools@8.6.0: - version "8.6.0" - resolved "https://registry.npmjs.org/firebase-tools/-/firebase-tools-8.6.0.tgz#c18533131170d2e9d069d50ed83ff62d49209e50" - integrity sha512-8w4vIe7LIMltnxqUyYeZ55YPA+fvmIh0P75ML+b8lt5XT0C1MIs/y2ft4Zh6SetKLTyB3wjz0btdf6MeUkRsbQ== - dependencies: - "@google-cloud/pubsub" "^1.7.0" - JSONStream "^1.2.1" - archiver "^3.0.0" - body-parser "^1.19.0" - chokidar "^3.0.2" - cjson "^0.3.1" - cli-color "^1.2.0" - cli-table "^0.3.1" - commander "^4.0.1" - configstore "^5.0.1" - cross-env "^5.1.3" - cross-spawn "^7.0.1" - csv-streamify "^3.0.4" - dotenv "^6.1.0" - exit-code "^1.0.2" - express "^4.16.4" - filesize "^3.1.3" - fs-extra "^0.23.1" - glob "^7.1.2" - google-auth-library "^5.5.0" - google-gax "~1.12.0" - inquirer "~6.3.1" - js-yaml "^3.13.1" - jsonschema "^1.0.2" - jsonwebtoken "^8.2.1" - leven "^3.1.0" - lodash "^4.17.14" - marked "^0.7.0" - marked-terminal "^3.3.0" - minimatch "^3.0.4" - morgan "^1.10.0" - open "^6.3.0" - ora "^3.4.0" - plist "^3.0.1" - portfinder "^1.0.23" - progress "^2.0.3" - request "^2.87.0" - rimraf "^3.0.0" - semver "^5.7.1" - superstatic "^6.0.1" - tar "^4.3.0" - tcp-port-used "^1.0.1" - tmp "0.0.33" - triple-beam "^1.3.0" - universal-analytics "^0.4.16" - unzipper "^0.10.10" - update-notifier "^2.5.0" - uuid "^3.0.0" - winston "^3.0.0" - ws "^7.2.3" - -firebase-tools@^8.5.0: +firebase-tools@8.6.0, firebase-tools@^8.6.0: version "8.6.0" resolved "https://registry.npmjs.org/firebase-tools/-/firebase-tools-8.6.0.tgz#c18533131170d2e9d069d50ed83ff62d49209e50" integrity sha512-8w4vIe7LIMltnxqUyYeZ55YPA+fvmIh0P75ML+b8lt5XT0C1MIs/y2ft4Zh6SetKLTyB3wjz0btdf6MeUkRsbQ== @@ -8248,7 +8146,6 @@ http-proxy-agent@^2.1.0: agent-base "4" debug "3.1.0" -<<<<<<< HEAD http-proxy-agent@^4.0.0: version "4.0.1" resolved "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz#8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a" @@ -8258,19 +8155,7 @@ http-proxy-agent@^4.0.0: agent-base "6" debug "4" -http-proxy@^1.18.0: - version "1.18.0" - resolved "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.0.tgz#dbe55f63e75a347db7f3d99974f2692a314a6a3a" - integrity sha512-84I2iJM/n1d4Hdgc6y2+qY5mDaz2PUVjlg9znE9byl+q0uC3DeByqBGReQu5tpLK0TAqTIXScRUV+dg7+bUPpQ== - dependencies: - eventemitter3 "^4.0.0" - follow-redirects "^1.0.0" - requires-port "^1.0.0" - -http-proxy@^1.18.1: -======= http-proxy@^1.18.0, http-proxy@^1.18.1: ->>>>>>> origin/master version "1.18.1" resolved "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz#401541f0534884bbf95260334e72f88ee3976549" integrity sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ== @@ -10740,19 +10625,7 @@ mime-db@1.44.0, "mime-db@>= 1.43.0 < 2": resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92" integrity sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg== -mime-db@1.44.0: - version "1.44.0" - resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92" - integrity sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg== - -mime-types@^2.0.8: - version "2.1.27" - resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f" - integrity sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w== - dependencies: - mime-db "1.44.0" - -mime-types@^2.1.12, mime-types@^2.1.16, mime-types@~2.1.19, mime-types@~2.1.24: +mime-types@^2.0.8, mime-types@^2.1.12, mime-types@^2.1.16, mime-types@~2.1.19, mime-types@~2.1.24: version "2.1.27" resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f" integrity sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w== @@ -12311,46 +12184,7 @@ proto-list@~1.2.1: resolved "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk= -protobufjs@6.10.1, protobufjs@^6.8.1, protobufjs@^6.8.6, protobufjs@^6.8.8, protobufjs@^6.8.9: - version "6.10.1" - resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-6.10.1.tgz#e6a484dd8f04b29629e9053344e3970cccf13cd2" - integrity sha512-pb8kTchL+1Ceg4lFd5XUpK8PdWacbvV5SK2ULH2ebrYtl4GjJmS24m6CKME67jzV53tbJxHlnNOSqQHbTsR9JQ== - 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.1" - "@types/node" "^13.7.0" - long "^4.0.0" - -<<<<<<< HEAD -protobufjs@^6.8.1, protobufjs@^6.8.6, protobufjs@^6.8.8, protobufjs@^6.8.9: - version "6.8.9" - resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.9.tgz#0b1adbcdaa983d369c3d9108a97c814edc030754" - integrity sha512-j2JlRdUeL/f4Z6x4aU4gj9I2LECglC+5qR2TrWb193Tla1qfdaNQTZ8I27Pt7K0Ajmvjjpft7O3KWTGciz4gpw== - 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.0" - "@types/node" "^10.1.0" - long "^4.0.0" - -protobufjs@^6.9.0: +protobufjs@6.10.1, protobufjs@^6.8.1, protobufjs@^6.8.6, protobufjs@^6.8.8, protobufjs@^6.8.9, protobufjs@^6.9.0: version "6.10.1" resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-6.10.1.tgz#e6a484dd8f04b29629e9053344e3970cccf13cd2" integrity sha512-pb8kTchL+1Ceg4lFd5XUpK8PdWacbvV5SK2ULH2ebrYtl4GjJmS24m6CKME67jzV53tbJxHlnNOSqQHbTsR9JQ== @@ -12369,8 +12203,6 @@ protobufjs@^6.9.0: "@types/node" "^13.7.0" long "^4.0.0" -======= ->>>>>>> origin/master protocols@^1.1.0, protocols@^1.4.0: version "1.4.7" resolved "https://registry.npmjs.org/protocols/-/protocols-1.4.7.tgz#95f788a4f0e979b291ffefcf5636ad113d037d32" @@ -12726,11 +12558,7 @@ read@1, read@~1.0.1: string_decoder "~1.1.1" util-deprecate "~1.0.1" -<<<<<<< HEAD -"readable-stream@2 || 3", readable-stream@3, readable-stream@^3.0.2, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0: -======= -"readable-stream@2 || 3", readable-stream@^3.0.2, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: ->>>>>>> origin/master +"readable-stream@2 || 3", readable-stream@3, readable-stream@^3.0.2, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: version "3.6.0" resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== @@ -15451,21 +15279,12 @@ uuid@^3.0.0, uuid@^3.0.1, uuid@^3.3.2, uuid@^3.3.3: resolved "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -<<<<<<< HEAD uuid@^8.0.0: version "8.2.0" resolved "https://registry.npmjs.org/uuid/-/uuid-8.2.0.tgz#cb10dd6b118e2dada7d0cd9730ba7417c93d920e" integrity sha512-CYpGiFTUrmI6OBMkAdjSDM0k5h8SkkiTP4WAjQgDgNB1S3Ou9VBEvr6q0Kv2H1mMk7IWfxYGpMH5sd5AvcIV2Q== -v8-compile-cache@^2.0.3: - version "2.1.0" - resolved "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" - integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== - -v8-compile-cache@^2.1.1: -======= v8-compile-cache@^2.0.3, v8-compile-cache@^2.1.1: ->>>>>>> origin/master version "2.1.1" resolved "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745" integrity sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ== From d1ac304693db10f498c84ee73250cc8914c4a6eb Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 4 Aug 2020 11:22:25 +0100 Subject: [PATCH 08/18] Fix yarn.lock --- yarn.lock | 108 +++++++++++++++++++++++++++++------------------------- 1 file changed, 59 insertions(+), 49 deletions(-) diff --git a/yarn.lock b/yarn.lock index 221419e7eaf..18a37303e10 100644 --- a/yarn.lock +++ b/yarn.lock @@ -211,6 +211,13 @@ "@babel/template" "^7.10.4" "@babel/types" "^7.10.4" +"@babel/helper-skip-transparent-expression-wrappers@^7.11.0": + version "7.11.0" + resolved "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.11.0.tgz#eec162f112c2f58d3af0af125e3bb57665146729" + integrity sha512-0XIdiQln4Elglgjbwo9wuJpL/K7AGCY26kmEt0+pRP0TAj4jjyNq1MjoRvikrTVqKcx4Gysxt4cXvVFXP/JO2Q== + dependencies: + "@babel/types" "^7.11.0" + "@babel/helper-split-export-declaration@^7.10.4": version "7.10.4" resolved "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.10.4.tgz#2c70576eaa3b5609b24cb99db2888cc3fc4251d1" @@ -306,9 +313,9 @@ "@babel/plugin-syntax-numeric-separator" "^7.10.4" "@babel/plugin-proposal-object-rest-spread@^7.10.4": - version "7.10.4" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.10.4.tgz#50129ac216b9a6a55b3853fdd923e74bf553a4c0" - integrity sha512-6vh4SqRuLLarjgeOf4EaROJAHjvu9Gl+/346PbDH9yWbJyfnJ/ah3jmYKYtswEyCoWZiidvVHjHshd4WgjB9BA== + version "7.11.0" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.11.0.tgz#bd81f95a1f746760ea43b6c2d3d62b11790ad0af" + integrity sha512-wzch41N4yztwoRw0ak+37wxwJM2oiIiy6huGCoqkvSTA9acYWcPfn9Y4aJqmFFJ70KTJUu29f3DQ43uJ9HXzEA== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-object-rest-spread" "^7.8.0" @@ -323,11 +330,12 @@ "@babel/plugin-syntax-optional-catch-binding" "^7.8.0" "@babel/plugin-proposal-optional-chaining@^7.10.4": - version "7.10.4" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.10.4.tgz#750f1255e930a1f82d8cdde45031f81a0d0adff7" - integrity sha512-ZIhQIEeavTgouyMSdZRap4VPPHqJJ3NEs2cuHs5p0erH+iz6khB0qfgU8g7UuJkG88+fBMy23ZiU+nuHvekJeQ== + version "7.11.0" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.11.0.tgz#de5866d0646f6afdaab8a566382fe3a221755076" + integrity sha512-v9fZIu3Y8562RRwhm1BbMRxtqZNFmFA2EG+pT2diuU8PT3H6T/KXoZ54KgYisfOFZHV6PfvAiBIZ9Rcz+/JCxA== dependencies: "@babel/helper-plugin-utils" "^7.10.4" + "@babel/helper-skip-transparent-expression-wrappers" "^7.11.0" "@babel/plugin-syntax-optional-chaining" "^7.8.0" "@babel/plugin-proposal-private-methods@^7.10.4": @@ -622,11 +630,12 @@ "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-transform-spread@^7.10.4": - version "7.10.4" - resolved "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.10.4.tgz#4e2c85ea0d6abaee1b24dcfbbae426fe8d674cff" - integrity sha512-1e/51G/Ni+7uH5gktbWv+eCED9pP8ZpRhZB3jOaI3mmzfvJTWHkuyYTv0Z5PYtyM+Tr2Ccr9kUdQxn60fI5WuQ== + version "7.11.0" + resolved "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.11.0.tgz#fa84d300f5e4f57752fe41a6d1b3c554f13f17cc" + integrity sha512-UwQYGOqIdQJe4aWNyS7noqAnN2VbaczPLiEtln+zPowRNlD+79w3oi2TWfYe0eZgd+gjZCbsydN7lzWysDt+gw== dependencies: "@babel/helper-plugin-utils" "^7.10.4" + "@babel/helper-skip-transparent-expression-wrappers" "^7.11.0" "@babel/plugin-transform-sticky-regex@^7.10.4": version "7.10.4" @@ -787,6 +796,15 @@ lodash "^4.17.19" to-fast-properties "^2.0.0" +"@babel/types@^7.11.0": + version "7.11.0" + resolved "https://registry.npmjs.org/@babel/types/-/types-7.11.0.tgz#2ae6bf1ba9ae8c3c43824e5861269871b206e90d" + integrity sha512-O53yME4ZZI0jO1EVGtF1ePGl0LHirG4P1ibcD80XyzZcKhcMFeCXmh4Xb1ifGBIV233Qg12x4rBfQgA+tmOukA== + dependencies: + "@babel/helper-validator-identifier" "^7.10.4" + lodash "^4.17.19" + to-fast-properties "^2.0.0" + "@changesets/apply-release-plan@^4.0.0": version "4.0.0" resolved "https://registry.npmjs.org/@changesets/apply-release-plan/-/apply-release-plan-4.0.0.tgz#e78efb56a4e459a8dab814ba43045f2ace0f27c9" @@ -1083,16 +1101,7 @@ retry-request "^4.1.1" teeny-request "^7.0.0" -"@google-cloud/firestore@^4.0.0": - version "4.1.1" - resolved "https://registry.npmjs.org/@google-cloud/firestore/-/firestore-4.1.1.tgz#bd7478cbead2d516cc8d173339198180ad7f6e35" - integrity sha512-HFy2OEOrYJ7jYUir90Kg7+AWM6fsFoWYiHiryoseHfkL9//AnXm2sn0CiaOhsTsxphc69G8LBBvUj6ws0QDa7g== - dependencies: - fast-deep-equal "^3.1.1" - functional-red-black-tree "^1.0.1" - google-gax "^2.2.0" - -"@google-cloud/firestore@^4.2.0": +"@google-cloud/firestore@^4.0.0", "@google-cloud/firestore@^4.2.0": version "4.2.0" resolved "https://registry.npmjs.org/@google-cloud/firestore/-/firestore-4.2.0.tgz#5ff83838076972b86c16ae64d35429c190c69ea9" integrity sha512-YCiKaTYCbXSoEvZ8cTmpgg4ebAvmFUOu3hj/aX+lHiOK7LsoFVi4jgNknogSqIiv04bxAysTBodpgn8XoZ4l5g== @@ -1110,9 +1119,9 @@ extend "^3.0.2" "@google-cloud/paginator@^3.0.0": - version "3.0.2" - resolved "https://registry.npmjs.org/@google-cloud/paginator/-/paginator-3.0.2.tgz#7d103f0dac00c7c46050f31cb8b524696b03135e" - integrity sha512-kXK+Dbz4pNvv8bKU80Aw5HsIdgOe0WuMTd8/fI6tkANUxzvJOVJQQRsWVqcHSWK2RXHPTA9WBniUCwY6gAJDXw== + version "3.0.3" + resolved "https://registry.npmjs.org/@google-cloud/paginator/-/paginator-3.0.3.tgz#23e0cd4c84a2f9332817dce572ab665c9eebefce" + integrity sha512-bu9AUf6TvDOtA6z5Su+kRLmMTNEA23QFjr41lH/7UpcEjGoLmXxEiJIU1hwfiiBi9c6IrgtpTsA89Zy7gjxw3w== dependencies: arrify "^2.0.0" extend "^3.0.2" @@ -1198,7 +1207,7 @@ dependencies: semver "^6.2.0" -"@grpc/grpc-js@^1.0.0": +"@grpc/grpc-js@^1.0.0", "@grpc/grpc-js@~1.1.1": version "1.1.3" resolved "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.1.3.tgz#0b91b166d744b6a43b00430dceff0f0ff88c98d5" integrity sha512-HtOsk2YUofBcm1GkPqGzb6pwHhv+74eC2CUO229USIDKRtg30ycbZmqC+HdNtY3nHqoc9IgcRlntFgopyQoYCA== @@ -1212,13 +1221,6 @@ dependencies: semver "^6.2.0" -"@grpc/grpc-js@~1.1.1": - version "1.1.2" - resolved "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.1.2.tgz#3125484c19fd1c9e3f4dc7a880f9fa1b872b46c8" - integrity sha512-k2u86Bkm/3xrjUaSWeIyzXScBt/cC8uE7BznR0cpueQi11R33W6qfJdMrkrsmSHirp5likR55JSXUrcWG6ybHA== - dependencies: - semver "^6.2.0" - "@grpc/proto-loader@^0.5.0", "@grpc/proto-loader@^0.5.1": version "0.5.5" resolved "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.5.tgz#6725e7a1827bdf8e92e29fbf4e9ef0203c0906a9" @@ -2486,9 +2488,9 @@ integrity sha512-51MYTDTyCziHb70wtGNFRwB4l+5JNvdqzFSkbDvpbftEgVUBEE+T5f7pROhWMp/fxp07oNIEQZd5bbfAH22ohQ== "@types/node@^10.10.0": - version "10.17.27" - resolved "https://registry.npmjs.org/@types/node/-/node-10.17.27.tgz#391cb391c75646c8ad2a7b6ed3bbcee52d1bdf19" - integrity sha512-J0oqm9ZfAXaPdwNXMMgAhylw5fhmXkToJd06vuDUSAgEDZ/n/69/69UmyBZbc+zT34UnShuDSBqvim3SPnozJg== + version "10.17.28" + resolved "https://registry.npmjs.org/@types/node/-/node-10.17.28.tgz#0e36d718a29355ee51cec83b42d921299200f6d9" + integrity sha512-dzjES1Egb4c1a89C7lKwQh8pwjYmlOAG9dW1pBgxEk57tMrLnssOfEthz8kdkNaBd7lIqQx7APm5+mZ619IiCQ== "@types/node@^12.7.1": version "12.12.52" @@ -7154,9 +7156,9 @@ gaxios@^2.1.0: node-fetch "^2.3.0" gaxios@^3.0.0: - version "3.0.4" - resolved "https://registry.npmjs.org/gaxios/-/gaxios-3.0.4.tgz#4714fbb003d6f6f08a297f772284463e041e04db" - integrity sha512-97NmFuMETFQh6gqPUxkqjxRMjmY8aRKRMphIkgO/b90AbCt5wAVuXsp8oWjIXlLN2pIK/fsXD8edcM7ULkFMLg== + version "3.1.0" + resolved "https://registry.npmjs.org/gaxios/-/gaxios-3.1.0.tgz#95f65f5a335f61aff602fe124cfdba8524f765fa" + integrity sha512-DDTn3KXVJJigtz+g0J3vhcfbDbKtAroSTxauWsdnP57sM5KZ3d2c/3D9RKFJ86s43hfw6WULg6TXYw/AYiBlpA== dependencies: abort-controller "^3.0.0" extend "^3.0.2" @@ -7571,9 +7573,9 @@ google-auth-library@^5.0.0, google-auth-library@^5.5.0: lru-cache "^5.0.0" google-auth-library@^6.0.0: - version "6.0.5" - resolved "https://registry.npmjs.org/google-auth-library/-/google-auth-library-6.0.5.tgz#f7266859dbb02dadf92af479272fb1e344635cb5" - integrity sha512-Wj31lfTm2yR4g3WfOOB1Am1tt478Xq9OvzTPQJi17tn/I9R5IcsxjANBsE93nYmxYxtwDedhOdIb8l3vSPG49Q== + version "6.0.6" + resolved "https://registry.npmjs.org/google-auth-library/-/google-auth-library-6.0.6.tgz#5102e5c643baab45b4c16e9752cd56b8861f3a82" + integrity sha512-fWYdRdg55HSJoRq9k568jJA1lrhg9i2xgfhVIMJbskUmbDpJGHsbv9l41DGhCDXM21F9Kn4kUwdysgxSYBYJUw== dependencies: arrify "^2.0.0" base64-js "^1.3.0" @@ -7699,9 +7701,9 @@ google-gax@^1.14.2: walkdir "^0.4.0" google-gax@^2.2.0: - version "2.6.3" - resolved "https://registry.npmjs.org/google-gax/-/google-gax-2.6.3.tgz#81510dfd44f7827937d0b81ae6d9f96d85a247f1" - integrity sha512-hqY6H53Qmaku8rE8dGAM89RSUc1nc4JYG81whrVJRmDQZ2jhJK8AwCd3pJQ3V48rgp9xiWBzBQsyeaxnb3Eikw== + version "2.7.0" + resolved "https://registry.npmjs.org/google-gax/-/google-gax-2.7.0.tgz#5aaff7bdbe32730f975f416dd4897c558c89ab84" + integrity sha512-0dBATy8mMVlfOBrT85Q+NzBpZ4OJZUMrPI9wJULpiIDq2w1zlN30Duor+fQUcMEjanYEc72G58M4iUVve0jfXw== dependencies: "@grpc/grpc-js" "~1.1.1" "@grpc/proto-loader" "^0.5.1" @@ -7822,9 +7824,9 @@ gtoken@^4.1.0: mime "^2.2.0" gtoken@^5.0.0: - version "5.0.2" - resolved "https://registry.npmjs.org/gtoken/-/gtoken-5.0.2.tgz#688e4334b99378b4d4a67add19e1680f411ba74d" - integrity sha512-lull70rHCTvRTmAt+R/6W5bTtx4MjHku7AwJwK5fGqhOmygcZud0nrZcX+QUNfBJwCzqy7S5i1Bc4NYnr5PMMA== + version "5.0.3" + resolved "https://registry.npmjs.org/gtoken/-/gtoken-5.0.3.tgz#b76ef8e9a2fed6fef165e47f7d05b60c498e4d05" + integrity sha512-Nyd1wZCMRc2dj/mAD0LlfQLcAO06uKdpKJXvK85SGrF5+5+Bpfil9u/2aw35ltvEHjvl0h5FMKN5knEU+9JrOg== dependencies: gaxios "^3.0.0" google-p12-pem "^3.0.0" @@ -12954,7 +12956,7 @@ ret@~0.1.10: resolved "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== -retry-request@^4.0.0, retry-request@^4.1.1: +retry-request@^4.0.0: version "4.1.1" resolved "https://registry.npmjs.org/retry-request/-/retry-request-4.1.1.tgz#f676d0db0de7a6f122c048626ce7ce12101d2bd8" integrity sha512-BINDzVtLI2BDukjWmjAIRZ0oglnCAkpP2vQjM3jdLhmT62h0xnQgciPwBRDAvHqpkPT2Wo1XuUyLyn6nbGrZQQ== @@ -12962,6 +12964,14 @@ retry-request@^4.0.0, retry-request@^4.1.1: debug "^4.1.1" through2 "^3.0.1" +retry-request@^4.1.1: + version "4.1.2" + resolved "https://registry.npmjs.org/retry-request/-/retry-request-4.1.2.tgz#88eb28ba5b0b81c3692f03dd9f2f91868be2a30b" + integrity sha512-fa4OwUcplhOYIhTm7zt6xsUfoApWo+auhvxbpPR4XLxHj0k67MhPItpCzYWzOEjtJlCH4MJ5V0qUrXiu/pOpag== + dependencies: + debug "^4.1.1" + through2 "^3.0.1" + retry@^0.10.0: version "0.10.1" resolved "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz#e76388d217992c252750241d3d3956fed98d8ff4" @@ -15280,9 +15290,9 @@ uuid@^3.0.0, uuid@^3.0.1, uuid@^3.3.2, uuid@^3.3.3: integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== uuid@^8.0.0: - version "8.2.0" - resolved "https://registry.npmjs.org/uuid/-/uuid-8.2.0.tgz#cb10dd6b118e2dada7d0cd9730ba7417c93d920e" - integrity sha512-CYpGiFTUrmI6OBMkAdjSDM0k5h8SkkiTP4WAjQgDgNB1S3Ou9VBEvr6q0Kv2H1mMk7IWfxYGpMH5sd5AvcIV2Q== + version "8.3.0" + resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz#ab738085ca22dc9a8c92725e459b1d507df5d6ea" + integrity sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ== v8-compile-cache@^2.0.3, v8-compile-cache@^2.1.1: version "2.1.1" From ab2352b2166b8bb8b4228fbd8e028f0220e1fd85 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 4 Aug 2020 11:29:13 +0100 Subject: [PATCH 09/18] Make tests pass --- .../rules-unit-testing/test/database.test.ts | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/packages/rules-unit-testing/test/database.test.ts b/packages/rules-unit-testing/test/database.test.ts index c679e9814b7..a5c4da013c1 100644 --- a/packages/rules-unit-testing/test/database.test.ts +++ b/packages/rules-unit-testing/test/database.test.ts @@ -99,15 +99,32 @@ describe('Testing Module Tests', function () { expect(claims).to.deep.equal({ uid: auth.uid, iat: 0, sub: auth.uid }); }); - it('initializeAdminApp() sets the access token to "owner"', async function () { - const app = firebase.initializeAdminApp({ projectId: 'foo' }); - const authInternal = ((app as unknown) as _FirebaseApp).container - .getProvider('auth-internal') - .getImmediate(); + it('initializeAdminApp() has admin access', async function () { + await firebase.loadFirestoreRules({ + projectId: 'foo', + rules: `service cloud.firestore { + match /databases/{db}/documents/{doc=**} { + allow read, write: if false; + } + }` + }); - const token = await authInternal.getToken(); - expect(token).to.have.keys('accessToken'); - expect(token!.accessToken).to.be.string('owner'); + await firebase.loadDatabaseRules({ + databaseName: 'foo', + rules: '{ "rules": {".read": false, ".write": false} }' + }); + + const app = firebase.initializeAdminApp({ + projectId: 'foo', + databaseName: 'foo' + }); + + await firebase.assertSucceeds( + app.firestore().doc('/foo/bar').set({ hello: 'world' }) + ); + await firebase.assertSucceeds( + app.database().ref().child('/foo/bar').set({ hello: 'world' }) + ); }); it('loadDatabaseRules() throws if no databaseName or rules', async function () { From 8f54ed5fe2e97659f3d5e02c918d259858e417c3 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 4 Aug 2020 11:59:31 +0100 Subject: [PATCH 10/18] Add changeset --- .changeset/cold-bats-hammer.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .changeset/cold-bats-hammer.md diff --git a/.changeset/cold-bats-hammer.md b/.changeset/cold-bats-hammer.md new file mode 100644 index 00000000000..21ff1674261 --- /dev/null +++ b/.changeset/cold-bats-hammer.md @@ -0,0 +1,9 @@ +--- +'@firebase/rules-unit-testing': minor +--- + +Release `@firebase/rules-unit-testing` to replace the `@firebase/testing` package. The new +package is API compatible but has the following breaking behavior changes: + + * `assertFails()` will now only fail on `PERMISSION DENIED` errors, not any error. + * `initializeAdminApp()` now relies on `firebase-admin` rather than imitating the Admin SDK. From 3e2b49981cf8d8b4cf80916c89c605e8fb7faf76 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 6 Aug 2020 20:20:44 +0100 Subject: [PATCH 11/18] Update versions and changeset --- .changeset/cold-bats-hammer.md | 2 +- packages/rules-unit-testing/package.json | 8 +- yarn.lock | 322 ++++++++++++++++++++++- 3 files changed, 321 insertions(+), 11 deletions(-) diff --git a/.changeset/cold-bats-hammer.md b/.changeset/cold-bats-hammer.md index 21ff1674261..f17d0fade8d 100644 --- a/.changeset/cold-bats-hammer.md +++ b/.changeset/cold-bats-hammer.md @@ -1,5 +1,5 @@ --- -'@firebase/rules-unit-testing': minor +'@firebase/rules-unit-testing': major --- Release `@firebase/rules-unit-testing` to replace the `@firebase/testing` package. The new diff --git a/packages/rules-unit-testing/package.json b/packages/rules-unit-testing/package.json index 25cdd830cab..8eed1ba9ca9 100644 --- a/packages/rules-unit-testing/package.json +++ b/packages/rules-unit-testing/package.json @@ -1,6 +1,6 @@ { "name": "@firebase/rules-unit-testing", - "version": "0.30.0", + "version": "0.1.0", "description": "", "author": "Firebase (https://firebase.google.com/)", "main": "dist/index.cjs.js", @@ -27,10 +27,10 @@ "request": "2.88.2" }, "devDependencies": { - "@google-cloud/firestore": "^4.2.0", + "@google-cloud/firestore": "4.2.0", "@types/request": "2.48.5", - "firebase-admin": "^9.0.0", - "firebase-tools": "^8.6.0", + "firebase-admin": "9.0.0", + "firebase-tools": "8.7.0", "rollup": "2.23.0", "rollup-plugin-typescript2": "0.27.1" }, diff --git a/yarn.lock b/yarn.lock index 389b5864d20..ce85c6b8ef4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1215,7 +1215,7 @@ retry-request "^4.1.1" teeny-request "^7.0.0" -"@google-cloud/firestore@^4.0.0", "@google-cloud/firestore@^4.2.0": +"@google-cloud/firestore@4.2.0", "@google-cloud/firestore@^4.0.0": version "4.2.0" resolved "https://registry.npmjs.org/@google-cloud/firestore/-/firestore-4.2.0.tgz#5ff83838076972b86c16ae64d35429c190c69ea9" integrity sha512-YCiKaTYCbXSoEvZ8cTmpgg4ebAvmFUOu3hj/aX+lHiOK7LsoFVi4jgNknogSqIiv04bxAysTBodpgn8XoZ4l5g== @@ -2367,6 +2367,11 @@ dependencies: any-observable "^0.3.0" +"@sindresorhus/is@^0.14.0": + version "0.14.0" + resolved "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" + integrity sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ== + "@sinonjs/commons@^1", "@sinonjs/commons@^1.6.0", "@sinonjs/commons@^1.7.0", "@sinonjs/commons@^1.7.2": version "1.8.1" resolved "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.1.tgz#e7df00f98a203324f6dc7cc606cad9d4a8ab2217" @@ -2403,6 +2408,13 @@ resolved "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz#8da5c6530915653f3a1f38fd5f101d8c3f8079c5" integrity sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ== +"@szmarczak/http-timer@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421" + integrity sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA== + dependencies: + defer-to-connect "^1.0.1" + "@testim/chrome-version@^1.0.7": version "1.0.7" resolved "https://registry.npmjs.org/@testim/chrome-version/-/chrome-version-1.0.7.tgz#0cd915785ec4190f08a3a6acc9b61fc38fb5f1a9" @@ -3097,6 +3109,13 @@ ansi-align@^2.0.0: dependencies: string-width "^2.0.0" +ansi-align@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz#b536b371cf687caaef236c18d3e21fe3797467cb" + integrity sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw== + dependencies: + string-width "^3.0.0" + ansi-colors@3.2.3: version "3.2.3" resolved "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813" @@ -3932,6 +3951,20 @@ boxen@^1.2.1, boxen@^1.3.0: term-size "^1.2.0" widest-line "^2.0.0" +boxen@^4.2.0: + version "4.2.0" + resolved "https://registry.npmjs.org/boxen/-/boxen-4.2.0.tgz#e411b62357d6d6d36587c8ac3d5d974daa070e64" + integrity sha512-eB4uT9RGzg2odpER62bBwSLvUeGC+WbRjjyyFhGsKnc8wp/m0+hQsMUvUe3H2V0D5vw0nBdO1hCJoZo5mKeuIQ== + dependencies: + ansi-align "^3.0.0" + camelcase "^5.3.1" + chalk "^3.0.0" + cli-boxes "^2.2.0" + string-width "^4.1.0" + term-size "^2.1.0" + type-fest "^0.8.1" + widest-line "^3.1.0" + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -4272,6 +4305,19 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" +cacheable-request@^6.0.0: + version "6.1.0" + resolved "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz#20ffb8bd162ba4be11e9567d823db651052ca912" + integrity sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg== + dependencies: + clone-response "^1.0.2" + get-stream "^5.1.0" + http-cache-semantics "^4.0.0" + keyv "^3.0.0" + lowercase-keys "^2.0.0" + normalize-url "^4.1.0" + responselike "^1.0.2" + cached-path-relative@^1.0.0, cached-path-relative@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/cached-path-relative/-/cached-path-relative-1.0.2.tgz#a13df4196d26776220cc3356eb147a52dba2c6db" @@ -4605,6 +4651,11 @@ cli-boxes@^1.0.0: resolved "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" integrity sha1-T6kXw+WclKAEzWH47lCdplFocUM= +cli-boxes@^2.2.0: + version "2.2.0" + resolved "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.0.tgz#538ecae8f9c6ca508e3c3c95b453fe93cb4c168d" + integrity sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w== + cli-color@^1.2.0: version "1.4.0" resolved "https://registry.npmjs.org/cli-color/-/cli-color-1.4.0.tgz#7d10738f48526824f8fe7da51857cb0f572fe01f" @@ -4702,6 +4753,13 @@ clone-deep@^4.0.1: kind-of "^6.0.2" shallow-clone "^3.0.0" +clone-response@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz#d1dc973920314df67fbeb94223b4ee350239e96b" + integrity sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws= + dependencies: + mimic-response "^1.0.0" + clone-stats@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz#b3782dff8bb5474e18b9b6bf0fdfe782f8777680" @@ -5568,6 +5626,13 @@ decode-uri-component@^0.2.0: resolved "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= +decompress-response@^3.3.0: + version "3.3.0" + resolved "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3" + integrity sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M= + dependencies: + mimic-response "^1.0.0" + dedent@^0.7.0: version "0.7.0" resolved "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" @@ -5623,6 +5688,11 @@ defaults@^1.0.3: dependencies: clone "^1.0.2" +defer-to-connect@^1.0.1: + version "1.1.3" + resolved "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz#331ae050c08dcf789f8c83a7b81f0ed94f4ac591" + integrity sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ== + define-properties@^1.1.2, define-properties@^1.1.3: version "1.1.3" resolved "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" @@ -6223,6 +6293,11 @@ escalade@^3.0.1: resolved "https://registry.npmjs.org/escalade/-/escalade-3.0.2.tgz#6a580d70edb87880f22b4c91d0d56078df6962c4" integrity sha512-gPYAU37hYCUhW5euPeR+Y74F7BL+IBsV93j5cvGriSaD1aG6MGsqsV1yamRdrWrb2j3aiZvb0X+UBOWpx3JWtQ== +escape-goat@^2.0.0: + version "2.1.1" + resolved "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz#1b2dc77003676c457ec760b2dc68edb648188675" + integrity sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q== + escape-html@~1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" @@ -6895,7 +6970,7 @@ fined@^1.0.1: object.pick "^1.2.0" parse-filepath "^1.0.1" -firebase-admin@^9.0.0: +firebase-admin@9.0.0: version "9.0.0" resolved "https://registry.npmjs.org/firebase-admin/-/firebase-admin-9.0.0.tgz#d68551a33e9c14252453743cd6ef9e5ad3251816" integrity sha512-LP4xD+JxfEZ+e1kBIKT2kbDa9UFChwgL4488NexvTjhynNcJsKCGmawl2FMvZ2UPwXKgWBpLXJ07cYp6gk5lcw== @@ -6919,7 +6994,7 @@ firebase-functions@3.9.0: express "^4.17.1" lodash "^4.17.14" -firebase-tools@8.6.0, firebase-tools@^8.6.0: +firebase-tools@8.6.0: version "8.6.0" resolved "https://registry.npmjs.org/firebase-tools/-/firebase-tools-8.6.0.tgz#c18533131170d2e9d069d50ed83ff62d49209e50" integrity sha512-8w4vIe7LIMltnxqUyYeZ55YPA+fvmIh0P75ML+b8lt5XT0C1MIs/y2ft4Zh6SetKLTyB3wjz0btdf6MeUkRsbQ== @@ -6975,6 +7050,62 @@ firebase-tools@8.6.0, firebase-tools@^8.6.0: winston "^3.0.0" ws "^7.2.3" +firebase-tools@8.7.0: + version "8.7.0" + resolved "https://registry.npmjs.org/firebase-tools/-/firebase-tools-8.7.0.tgz#04e25db7c6266190f3f903ea0e461ec3b0e893c0" + integrity sha512-pBl8WVbBnGKKp5pql/AD9BhmGEWajCccPeWsfwAzcdk0oJQlW0aAp1IO9c8mvamsDqdTny8PXIfm2U3iCcZpQw== + dependencies: + "@google-cloud/pubsub" "^1.7.0" + JSONStream "^1.2.1" + archiver "^3.0.0" + body-parser "^1.19.0" + chokidar "^3.0.2" + cjson "^0.3.1" + cli-color "^1.2.0" + cli-table "^0.3.1" + commander "^4.0.1" + configstore "^5.0.1" + cross-env "^5.1.3" + cross-spawn "^7.0.1" + csv-streamify "^3.0.4" + dotenv "^6.1.0" + exit-code "^1.0.2" + express "^4.16.4" + filesize "^3.1.3" + fs-extra "^0.23.1" + glob "^7.1.2" + google-auth-library "^5.5.0" + google-gax "~1.12.0" + inquirer "~6.3.1" + js-yaml "^3.13.1" + jsonschema "^1.0.2" + jsonwebtoken "^8.2.1" + leven "^3.1.0" + lodash "^4.17.19" + marked "^0.7.0" + marked-terminal "^3.3.0" + minimatch "^3.0.4" + morgan "^1.10.0" + open "^6.3.0" + ora "^3.4.0" + plist "^3.0.1" + portfinder "^1.0.23" + progress "^2.0.3" + request "^2.87.0" + rimraf "^3.0.0" + semver "^5.7.1" + superstatic "^6.0.1" + tar "^4.3.0" + tcp-port-used "^1.0.1" + tmp "0.0.33" + triple-beam "^1.3.0" + universal-analytics "^0.4.16" + unzipper "^0.10.10" + update-notifier "^4.1.0" + uuid "^3.0.0" + winston "^3.0.0" + ws "^7.2.3" + flagged-respawn@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.1.tgz#e7de6f1279ddd9ca9aac8a5971d618606b3aab41" @@ -7561,6 +7692,13 @@ global-dirs@^0.1.0: dependencies: ini "^1.3.4" +global-dirs@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/global-dirs/-/global-dirs-2.0.1.tgz#acdf3bb6685bcd55cb35e8a052266569e9469201" + integrity sha512-5HqUqdhkEovj2Of/ms3IeS/EekcO54ytHRLV4PEY2rhRwrHXLQjeVEES0Lhka0xwNDtGYn58wyC4s5+MHsOO6A== + dependencies: + ini "^1.3.5" + global-modules@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz#6d770f0eb523ac78164d72b5e71a8877265cc3ea" @@ -7909,6 +8047,23 @@ got@^6.7.1: unzip-response "^2.0.1" url-parse-lax "^1.0.0" +got@^9.6.0: + version "9.6.0" + resolved "https://registry.npmjs.org/got/-/got-9.6.0.tgz#edf45e7d67f99545705de1f7bbeeeb121765ed85" + integrity sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q== + dependencies: + "@sindresorhus/is" "^0.14.0" + "@szmarczak/http-timer" "^1.1.2" + cacheable-request "^6.0.0" + decompress-response "^3.3.0" + duplexer3 "^0.1.4" + get-stream "^4.1.0" + lowercase-keys "^1.0.1" + mimic-response "^1.0.1" + p-cancelable "^1.0.0" + to-readable-stream "^1.0.0" + url-parse-lax "^3.0.0" + graceful-fs@4.1.15: version "4.1.15" resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" @@ -8139,6 +8294,11 @@ has-values@^1.0.0: is-number "^3.0.0" kind-of "^4.0.0" +has-yarn@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz#137e11354a7b5bf11aa5cb649cf0c6f3ff2b2e77" + integrity sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw== + has@^1.0.0, has@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" @@ -8229,6 +8389,11 @@ http-cache-semantics@^3.8.1: resolved "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz#39b0e16add9b605bf0a9ef3d9daaf4843b4cacd2" integrity sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w== +http-cache-semantics@^4.0.0: + version "4.1.0" + resolved "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390" + integrity sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ== + http-errors@1.7.2: version "1.7.2" resolved "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz#4f5029cf13239f31036e5b2e55292bcfbcc85c8f" @@ -8839,6 +9004,14 @@ is-installed-globally@^0.1.0: global-dirs "^0.1.0" is-path-inside "^1.0.0" +is-installed-globally@^0.3.1: + version "0.3.2" + resolved "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.3.2.tgz#fd3efa79ee670d1187233182d5b0a1dd00313141" + integrity sha512-wZ8x1js7Ia0kecP/CHM/3ABkAmujX7WPvQk6uu3Fly/Mk44pySulQpnHG46OMjHGXApINnV4QhY3SWnECO2z5g== + dependencies: + global-dirs "^2.0.1" + is-path-inside "^3.0.1" + is-interactive@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e" @@ -8866,6 +9039,11 @@ is-npm@^1.0.0: resolved "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4" integrity sha1-8vtjpl5JBbQGyGBydloaTceTufQ= +is-npm@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/is-npm/-/is-npm-4.0.0.tgz#c90dd8380696df87a7a6d823c20d0b12bbe3c84d" + integrity sha512-96ECIfh9xtDDlPylNPXhzjsykHsMJZ18ASpaWzQyBr4YRTcVjUvzaHayDAES2oU/3KpljhHUjtSRNiDwi0F0ig== + is-number@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" @@ -9084,6 +9262,11 @@ is-wsl@^2.1.0: dependencies: is-docker "^2.0.0" +is-yarn-global@^0.3.0: + version "0.3.0" + resolved "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz#d502d3382590ea3004893746754c89139973e232" + integrity sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw== + is2@2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/is2/-/is2-2.0.1.tgz#8ac355644840921ce435d94f05d3a94634d3481a" @@ -9426,6 +9609,11 @@ json-bigint@^1.0.0: dependencies: bignumber.js "^9.0.0" +json-buffer@3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898" + integrity sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg= + json-parse-better-errors@^1.0.0, json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" @@ -9777,6 +9965,13 @@ karma@5.1.1: ua-parser-js "0.7.21" yargs "^15.3.1" +keyv@^3.0.0: + version "3.1.0" + resolved "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz#ecc228486f69991e49e9476485a5be1e8fc5c4d9" + integrity sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA== + dependencies: + json-buffer "3.0.0" + kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" @@ -9836,6 +10031,13 @@ latest-version@^3.0.0: dependencies: package-json "^4.0.0" +latest-version@^5.0.0: + version "5.1.0" + resolved "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz#119dfe908fe38d15dfa43ecd13fa12ec8832face" + integrity sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA== + dependencies: + package-json "^6.3.0" + lazystream@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz#f6995fe0f820392f61396be89462407bb77168e4" @@ -10395,11 +10597,16 @@ loud-rejection@^1.0.0: currently-unhandled "^0.4.1" signal-exit "^3.0.0" -lowercase-keys@^1.0.0: +lowercase-keys@^1.0.0, lowercase-keys@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" integrity sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA== +lowercase-keys@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" + integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== + lru-cache@^4.0.1: version "4.1.5" resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" @@ -10762,6 +10969,11 @@ mimic-fn@^2.1.0: resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== +mimic-response@^1.0.0, mimic-response@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" + integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== + min-indent@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" @@ -11293,6 +11505,11 @@ normalize-url@^3.3.0: resolved "https://registry.npmjs.org/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559" integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg== +normalize-url@^4.1.0: + version "4.5.0" + resolved "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz#453354087e6ca96957bd8f5baf753f5982142129" + integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ== + now-and-later@^2.0.0: version "2.0.1" resolved "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.1.tgz#8e579c8685764a7cc02cb680380e94f43ccb1f7c" @@ -11699,6 +11916,11 @@ outdent@^0.5.0: resolved "https://registry.npmjs.org/outdent/-/outdent-0.5.0.tgz#9e10982fdc41492bb473ad13840d22f9655be2ff" integrity sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q== +p-cancelable@^1.0.0: + version "1.1.0" + resolved "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz#d078d15a3af409220c886f1d9a0ca2e441ab26cc" + integrity sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw== + p-defer@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/p-defer/-/p-defer-3.0.0.tgz#d1dceb4ee9b2b604b1d94ffec83760175d4e6f83" @@ -11831,6 +12053,16 @@ package-json@^4.0.0: registry-url "^3.0.3" semver "^5.1.0" +package-json@^6.3.0: + version "6.5.0" + resolved "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz#6feedaca35e75725876d0b0e64974697fed145b0" + integrity sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ== + dependencies: + got "^9.6.0" + registry-auth-token "^4.0.0" + registry-url "^5.0.0" + semver "^6.2.0" + package-name-regex@1.0.8: version "1.0.8" resolved "https://registry.npmjs.org/package-name-regex/-/package-name-regex-1.0.8.tgz#4b8388cace6cc415f462ab4a269583d9a2d9f131" @@ -12232,6 +12464,11 @@ prepend-http@^1.0.1: resolved "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= +prepend-http@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" + integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= + prettier@2.0.5: version "2.0.5" resolved "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4" @@ -12445,6 +12682,13 @@ punycode@^2.1.0, punycode@^2.1.1: resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +pupa@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/pupa/-/pupa-2.0.1.tgz#dbdc9ff48ffbea4a26a069b6f9f7abb051008726" + integrity sha512-hEJH0s8PXLY/cdXh66tNEQGndDrIKNqNC5xmrysZy3i5C3oEoLna7YAOad+7u125+zH1HNXUmGEkrhb3c2VriA== + dependencies: + escape-goat "^2.0.0" + q@1.4.1: version "1.4.1" resolved "https://registry.npmjs.org/q/-/q-1.4.1.tgz#55705bcd93c5f3673530c2c2cbc0c2b3addc286e" @@ -12530,7 +12774,7 @@ raw-body@2.4.0: iconv-lite "0.4.24" unpipe "1.0.0" -rc@^1.0.1, rc@^1.1.6, rc@^1.2.7: +rc@^1.0.1, rc@^1.1.6, rc@^1.2.7, rc@^1.2.8: version "1.2.8" resolved "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== @@ -12837,6 +13081,13 @@ registry-auth-token@^3.0.1: rc "^1.1.6" safe-buffer "^5.0.1" +registry-auth-token@^4.0.0: + version "4.2.0" + resolved "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.0.tgz#1d37dffda72bbecd0f581e4715540213a65eb7da" + integrity sha512-P+lWzPrsgfN+UEpDS3U8AQKg/UjZX6mQSJueZj3EK+vNESoqBSpBUD3gmu4sF9lOsjXWjF11dQKUqemf3veq1w== + dependencies: + rc "^1.2.8" + registry-url@^3.0.3: version "3.1.0" resolved "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz#3d4ef870f73dde1d77f0cf9a381432444e174942" @@ -12844,6 +13095,13 @@ registry-url@^3.0.3: dependencies: rc "^1.0.1" +registry-url@^5.0.0: + version "5.1.0" + resolved "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz#e98334b50d5434b81136b44ec638d9c2009c5009" + integrity sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw== + dependencies: + rc "^1.2.8" + regjsgen@^0.5.1: version "0.5.2" resolved "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz#92ff295fb1deecbf6ecdab2543d207e91aa33733" @@ -13058,6 +13316,13 @@ resolve@^1.1.4, resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.11.0 dependencies: path-parse "^1.0.6" +responselike@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz#918720ef3b631c5642be068f15ade5a46f4ba1e7" + integrity sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec= + dependencies: + lowercase-keys "^1.0.0" + restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" @@ -13423,6 +13688,13 @@ semver-diff@^2.0.0: dependencies: semver "^5.0.3" +semver-diff@^3.1.1: + version "3.1.1" + resolved "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz#05f77ce59f325e00e2706afd67bb506ddb1ca32b" + integrity sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg== + dependencies: + semver "^6.3.0" + semver-greatest-satisfied-range@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/semver-greatest-satisfied-range/-/semver-greatest-satisfied-range-1.1.0.tgz#13e8c2658ab9691cb0cd71093240280d36f77a5b" @@ -14169,7 +14441,7 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" -string-width@^4.1.0, string-width@^4.2.0: +string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0: version "4.2.0" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== @@ -14747,6 +15019,11 @@ to-object-path@^0.3.0: dependencies: kind-of "^3.0.2" +to-readable-stream@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz#ce0aa0c2f3df6adf852efb404a783e77c0475771" + integrity sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q== + to-regex-range@^2.1.0: version "2.1.1" resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" @@ -15321,6 +15598,25 @@ update-notifier@^2.5.0: semver-diff "^2.0.0" xdg-basedir "^3.0.0" +update-notifier@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.0.tgz#4866b98c3bc5b5473c020b1250583628f9a328f3" + integrity sha512-w3doE1qtI0/ZmgeoDoARmI5fjDoT93IfKgEGqm26dGUOh8oNpaSTsGNdYRN/SjOuo10jcJGwkEL3mroKzktkew== + dependencies: + boxen "^4.2.0" + chalk "^3.0.0" + configstore "^5.0.1" + has-yarn "^2.1.0" + import-lazy "^2.1.0" + is-ci "^2.0.0" + is-installed-globally "^0.3.1" + is-npm "^4.0.0" + is-yarn-global "^0.3.0" + latest-version "^5.0.0" + pupa "^2.0.1" + semver-diff "^3.1.1" + xdg-basedir "^4.0.0" + uri-js@^4.2.2: version "4.2.2" resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" @@ -15350,6 +15646,13 @@ url-parse-lax@^1.0.0: dependencies: prepend-http "^1.0.1" +url-parse-lax@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz#16b5cafc07dbe3676c1b1999177823d6503acb0c" + integrity sha1-FrXK/Afb42dsGxmZF3gj1lA6yww= + dependencies: + prepend-http "^2.0.0" + url@^0.11.0, url@~0.11.0: version "0.11.0" resolved "https://registry.npmjs.org/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" @@ -15872,6 +16175,13 @@ widest-line@^2.0.0: dependencies: string-width "^2.1.1" +widest-line@^3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz#8292333bbf66cb45ff0de1603b136b7ae1496eca" + integrity sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg== + dependencies: + string-width "^4.0.0" + windows-release@^3.1.0: version "3.3.1" resolved "https://registry.npmjs.org/windows-release/-/windows-release-3.3.1.tgz#cb4e80385f8550f709727287bf71035e209c4ace" From c5b7268fc27039386fbf7656105464cb5fe87d7b Mon Sep 17 00:00:00 2001 From: Sam Stern Date: Tue, 11 Aug 2020 11:36:32 -0400 Subject: [PATCH 12/18] Restore testing package (#3556) --- .github/CODEOWNERS | 1 + packages/testing/.firebaserc | 1 + packages/testing/CHANGELOG.md | 31 +++ packages/testing/README.md | 9 + packages/testing/firebase.json | 13 ++ packages/testing/index.ts | 35 ++++ packages/testing/package.json | 42 ++++ packages/testing/rollup.config.js | 37 ++++ packages/testing/src/api/index.ts | 272 +++++++++++++++++++++++++ packages/testing/test/database.test.ts | 160 +++++++++++++++ packages/testing/tsconfig.json | 9 + 11 files changed, 610 insertions(+) create mode 100644 packages/testing/.firebaserc create mode 100644 packages/testing/CHANGELOG.md create mode 100644 packages/testing/README.md create mode 100644 packages/testing/firebase.json create mode 100644 packages/testing/index.ts create mode 100644 packages/testing/package.json create mode 100644 packages/testing/rollup.config.js create mode 100644 packages/testing/src/api/index.ts create mode 100644 packages/testing/test/database.test.ts create mode 100644 packages/testing/tsconfig.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b8deabaad13..72077cf6760 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -59,6 +59,7 @@ packages/auth @bojeil-google @avolkovi @samhorlbeck @scottcrossen @firebase/jss packages/auth-types @bojeil-google @avolkovi @samhorlbeck @scottcrossen @firebase/jssdk-global-approvers # Testing Code +packages/testing @avolkovi @samhorlbeck @scottcrossen @yuchenshi @firebase/jssdk-global-approvers packages/rules-unit-testing @avolkovi @samhorlbeck @scottcrossen @yuchenshi @firebase/jssdk-global-approvers # RxFire Code diff --git a/packages/testing/.firebaserc b/packages/testing/.firebaserc new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/packages/testing/.firebaserc @@ -0,0 +1 @@ +{} diff --git a/packages/testing/CHANGELOG.md b/packages/testing/CHANGELOG.md new file mode 100644 index 00000000000..99a599c19a5 --- /dev/null +++ b/packages/testing/CHANGELOG.md @@ -0,0 +1,31 @@ +# @firebase/testing + +## 0.20.9 + +### Patch Changes + +- Updated dependencies [[`a87676b8`](https://github.com/firebase/firebase-js-sdk/commit/a87676b84b78ccc2f057a22eb947a5d13402949c)]: + - @firebase/util@0.3.0 + - firebase@7.17.1 + +## 0.20.8 + +### Patch Changes + +- Updated dependencies [[`02419ce8`](https://github.com/firebase/firebase-js-sdk/commit/02419ce8470141f012d9ce425a6a4a4aa912e480)]: + - firebase@7.17.0 + +## 0.20.7 + +### Patch Changes + +- Updated dependencies [[`9c409ea7`](https://github.com/firebase/firebase-js-sdk/commit/9c409ea74efd00fe17058c5c8b74450fae67e9ee), [`5a355360`](https://github.com/firebase/firebase-js-sdk/commit/5a3553609da893d45f7fe1897387f72eaedf2fe0), [`c2b737b2`](https://github.com/firebase/firebase-js-sdk/commit/c2b737b2187cb525af4d926ca477102db7835420), [`9a9a81fe`](https://github.com/firebase/firebase-js-sdk/commit/9a9a81fe4f001f23e9fe1db054c2e7159fca3ae3)]: + - firebase@7.16.1 + +## 0.20.6 + +### Patch Changes + +- Updated dependencies [[`a754645e`](https://github.com/firebase/firebase-js-sdk/commit/a754645ec2be1b8c205f25f510196eee298b0d6e), [`17c628eb`](https://github.com/firebase/firebase-js-sdk/commit/17c628eb228c21ad1d4db83fdae08d1142a2b902), [`bb740836`](https://github.com/firebase/firebase-js-sdk/commit/bb7408361519aa9a58c8256ae01914cf2830e118), [`39ca8ecf`](https://github.com/firebase/firebase-js-sdk/commit/39ca8ecf940472159d0bc58212f34a70146da60c), [`877c060c`](https://github.com/firebase/firebase-js-sdk/commit/877c060c47bb29a8efbd2b96d35d3334fd9d9a98), [`e90304c8`](https://github.com/firebase/firebase-js-sdk/commit/e90304c8ac4341d8b23b55da784eb21348b04025), [`469c8bdf`](https://github.com/firebase/firebase-js-sdk/commit/469c8bdf18c4a22e99d595a9896af2f934df20fd)]: + - firebase@7.16.0 + - @firebase/logger@0.2.6 diff --git a/packages/testing/README.md b/packages/testing/README.md new file mode 100644 index 00000000000..40a72bb086d --- /dev/null +++ b/packages/testing/README.md @@ -0,0 +1,9 @@ +# @firebase/testing + +A set of utilities useful for testing Security Rules with the Realtime Database or Cloud Firestore +emulators. + +See: + + * [Test your Cloud Firestore Security Rules](https://firebase.google.com/docs/firestore/security/test-rules-emulator) + * [Testing Security Rules with the Realtime Database Emulator](https://firebase.google.com/docs/database/security/test-rules-emulator) \ No newline at end of file diff --git a/packages/testing/firebase.json b/packages/testing/firebase.json new file mode 100644 index 00000000000..b2ba04fe7ea --- /dev/null +++ b/packages/testing/firebase.json @@ -0,0 +1,13 @@ +{ + "emulators": { + "firestore": { + "port": 9001 + }, + "database": { + "port": 9000 + }, + "ui": { + "enabled": false + } + } +} diff --git a/packages/testing/index.ts b/packages/testing/index.ts new file mode 100644 index 00000000000..4c5c8a27bac --- /dev/null +++ b/packages/testing/index.ts @@ -0,0 +1,35 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * The testing module does not need to be registered since it should not ever + * come by default. The only way to use the testing module is by explicitly + * creating a dependency on @firebase/testing. + */ + +export { + apps, + assertFails, + assertSucceeds, + clearFirestoreData, + database, + firestore, + initializeAdminApp, + initializeTestApp, + loadDatabaseRules, + loadFirestoreRules +} from './src/api'; diff --git a/packages/testing/package.json b/packages/testing/package.json new file mode 100644 index 00000000000..8007fd4504e --- /dev/null +++ b/packages/testing/package.json @@ -0,0 +1,42 @@ +{ + "name": "@firebase/testing", + "version": "0.20.9", + "description": "", + "author": "Firebase (https://firebase.google.com/)", + "main": "dist/index.cjs.js", + "engines": { + "node": "^8.13.0 || >=10.10.0" + }, + "files": ["dist"], + "scripts": { + "build": "rollup -c", + "build:deps": "lerna run --scope @firebase/testing --include-dependencies build", + "dev": "rollup -c -w", + "test:nyc": "TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --config ../../config/mocharc.node.js", + "test": "firebase emulators:exec 'yarn test:nyc'", + "test:ci": "node ../../scripts/run_tests_in_ci.js", + "prepare": "yarn build" + }, + "license": "Apache-2.0", + "dependencies": { + "firebase": "7.17.1", + "@firebase/logger": "0.2.6", + "@firebase/util": "0.3.0", + "request": "2.88.2" + }, + "devDependencies": { + "@types/request": "2.48.5", + "firebase-tools": "8.6.0", + "rollup": "2.23.0", + "rollup-plugin-typescript2": "0.27.1" + }, + "repository": { + "directory": "packages/testing", + "type": "git", + "url": "https://github.com/firebase/firebase-js-sdk.git" + }, + "typings": "dist/index.d.ts", + "bugs": { + "url": "https://github.com/firebase/firebase-js-sdk/issues" + } +} diff --git a/packages/testing/rollup.config.js b/packages/testing/rollup.config.js new file mode 100644 index 00000000000..d1399baf786 --- /dev/null +++ b/packages/testing/rollup.config.js @@ -0,0 +1,37 @@ +/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import typescriptPlugin from 'rollup-plugin-typescript2'; +import pkg from './package.json'; +import typescript from 'typescript'; + +const plugins = [ + typescriptPlugin({ + typescript + }) +]; + +const deps = Object.keys( + Object.assign({}, pkg.peerDependencies, pkg.dependencies) +); + +export default { + input: 'index.ts', + output: [{ file: pkg.main, format: 'cjs', sourcemap: true }], + plugins: [...plugins], + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) +}; diff --git a/packages/testing/src/api/index.ts b/packages/testing/src/api/index.ts new file mode 100644 index 00000000000..c5207de5b17 --- /dev/null +++ b/packages/testing/src/api/index.ts @@ -0,0 +1,272 @@ +/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as firebase from 'firebase'; +import { _FirebaseApp } from '@firebase/app-types/private'; +import { FirebaseAuthInternal } from '@firebase/auth-interop-types'; +import * as request from 'request'; +import { base64 } from '@firebase/util'; +import { setLogLevel, LogLevel } from '@firebase/logger'; +import { Component, ComponentType } from '@firebase/component'; + +export { database, firestore } from 'firebase'; + +/** If this environment variable is set, use it for the database emulator's address. */ +const DATABASE_ADDRESS_ENV: string = 'FIREBASE_DATABASE_EMULATOR_ADDRESS'; +/** The default address for the local database emulator. */ +const DATABASE_ADDRESS_DEFAULT: string = 'localhost:9000'; +/** The actual address for the database emulator */ +const DATABASE_ADDRESS: string = + process.env[DATABASE_ADDRESS_ENV] || DATABASE_ADDRESS_DEFAULT; + +/** If any of environment variable is set, use it for the Firestore emulator. */ +const FIRESTORE_ADDRESS_ENVS: string[] = [ + 'FIRESTORE_EMULATOR_HOST', + 'FIREBASE_FIRESTORE_EMULATOR_ADDRESS' +]; +/** The default address for the local Firestore emulator. */ +const FIRESTORE_ADDRESS_DEFAULT: string = 'localhost:8080'; +/** The actual address for the Firestore emulator */ +const FIRESTORE_ADDRESS: string = FIRESTORE_ADDRESS_ENVS.reduce( + (addr, name) => process.env[name] || addr, + FIRESTORE_ADDRESS_DEFAULT +); + +/** Passing this in tells the emulator to treat you as an admin. */ +const ADMIN_TOKEN = 'owner'; +/** Create an unsecured JWT for the given auth payload. See https://tools.ietf.org/html/rfc7519#section-6. */ +function createUnsecuredJwt(auth: object): string { + // Unsecured JWTs use "none" as the algorithm. + const header = { + alg: 'none', + kid: 'fakekid' + }; + // Ensure that the auth payload has a value for 'iat'. + (auth as any).iat = (auth as any).iat || 0; + // Use `uid` field as a backup when `sub` is missing. + (auth as any).sub = (auth as any).sub || (auth as any).uid; + if (!(auth as any).sub) { + throw new Error("auth must be an object with a 'sub' or 'uid' field"); + } + // Unsecured JWTs use the empty string as a signature. + const signature = ''; + return [ + base64.encodeString(JSON.stringify(header), /*webSafe=*/ false), + base64.encodeString(JSON.stringify(auth), /*webSafe=*/ false), + signature + ].join('.'); +} + +export function apps(): firebase.app.App[] { + return firebase.apps; +} + +export type AppOptions = { + databaseName?: string; + projectId?: string; + auth?: object; +}; +/** Construct an App authenticated with options.auth. */ +export function initializeTestApp(options: AppOptions): firebase.app.App { + return initializeApp( + options.auth ? createUnsecuredJwt(options.auth) : undefined, + options.databaseName, + options.projectId + ); +} + +export type AdminAppOptions = { + databaseName?: string; + projectId?: string; +}; +/** Construct an App authenticated as an admin user. */ +export function initializeAdminApp(options: AdminAppOptions): firebase.app.App { + return initializeApp(ADMIN_TOKEN, options.databaseName, options.projectId); +} + +function initializeApp( + accessToken?: string, + databaseName?: string, + projectId?: string +): firebase.app.App { + let appOptions: { [key: string]: string } = {}; + if (databaseName) { + appOptions['databaseURL'] = `http://${DATABASE_ADDRESS}?ns=${databaseName}`; + } + if (projectId) { + appOptions['projectId'] = projectId; + } + const appName = 'app-' + new Date().getTime() + '-' + Math.random(); + let app = firebase.initializeApp(appOptions, appName); + if (accessToken) { + const mockAuthComponent = new Component( + 'auth-internal', + () => + ({ + getToken: async () => ({ accessToken: accessToken }), + getUid: () => null, + addAuthTokenListener: listener => { + // Call listener once immediately with predefined accessToken. + listener(accessToken); + }, + removeAuthTokenListener: () => {} + } as FirebaseAuthInternal), + ComponentType.PRIVATE + ); + + ((app as unknown) as _FirebaseApp)._addOrOverwriteComponent( + mockAuthComponent + ); + } + if (databaseName) { + // Toggle network connectivity to force a reauthentication attempt. + // This mitigates a minor race condition where the client can send the + // first database request before authenticating. + app.database().goOffline(); + app.database().goOnline(); + } + if (projectId) { + app.firestore().settings({ + host: FIRESTORE_ADDRESS, + ssl: false + }); + } + /** + Mute warnings for the previously-created database and whatever other + objects were just created. + */ + setLogLevel(LogLevel.ERROR); + return app; +} + +export type LoadDatabaseRulesOptions = { + databaseName: string; + rules: string; +}; +export function loadDatabaseRules( + options: LoadDatabaseRulesOptions +): Promise { + if (!options.databaseName) { + throw Error('databaseName not specified'); + } + + if (!options.rules) { + throw Error('must provide rules to loadDatabaseRules'); + } + + return new Promise((resolve, reject) => { + request.put( + { + uri: `http://${DATABASE_ADDRESS}/.settings/rules.json?ns=${options.databaseName}`, + headers: { Authorization: 'Bearer owner' }, + body: options.rules + }, + (err, resp, body) => { + if (err) { + reject(err); + } else if (resp.statusCode !== 200) { + reject(JSON.parse(body).error); + } else { + resolve(); + } + } + ); + }); +} + +export type LoadFirestoreRulesOptions = { + projectId: string; + rules: string; +}; +export function loadFirestoreRules( + options: LoadFirestoreRulesOptions +): Promise { + if (!options.projectId) { + throw new Error('projectId not specified'); + } + + if (!options.rules) { + throw new Error('must provide rules to loadFirestoreRules'); + } + + return new Promise((resolve, reject) => { + request.put( + { + uri: `http://${FIRESTORE_ADDRESS}/emulator/v1/projects/${options.projectId}:securityRules`, + body: JSON.stringify({ + rules: { + files: [{ content: options.rules }] + } + }) + }, + (err, resp, body) => { + if (err) { + reject(err); + } else if (resp.statusCode !== 200) { + console.log('body', body); + reject(JSON.parse(body).error); + } else { + resolve(); + } + } + ); + }); +} + +export type ClearFirestoreDataOptions = { + projectId: string; +}; +export function clearFirestoreData( + options: ClearFirestoreDataOptions +): Promise { + if (!options.projectId) { + throw new Error('projectId not specified'); + } + + return new Promise((resolve, reject) => { + request.delete( + { + uri: `http://${FIRESTORE_ADDRESS}/emulator/v1/projects/${options.projectId}/databases/(default)/documents`, + body: JSON.stringify({ + database: `projects/${options.projectId}/databases/(default)` + }) + }, + (err, resp, body) => { + if (err) { + reject(err); + } else if (resp.statusCode !== 200) { + console.log('body', body); + reject(JSON.parse(body).error); + } else { + resolve(); + } + } + ); + }); +} + +export function assertFails(pr: Promise): any { + return pr.then( + v => + Promise.reject(new Error('Expected request to fail, but it succeeded.')), + err => err + ); +} + +export function assertSucceeds(pr: Promise): any { + return pr; +} diff --git a/packages/testing/test/database.test.ts b/packages/testing/test/database.test.ts new file mode 100644 index 00000000000..034d941a6a8 --- /dev/null +++ b/packages/testing/test/database.test.ts @@ -0,0 +1,160 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as chai from 'chai'; +import * as chaiAsPromised from 'chai-as-promised'; +import * as firebase from '../src/api'; +import { base64 } from '@firebase/util'; +import { _FirebaseApp } from '@firebase/app-types/private'; + +const expect = chai.expect; + +before(() => { + chai.use(chaiAsPromised); +}); + +describe('Testing Module Tests', function () { + it('assertSucceeds() iff success', async function () { + const success = Promise.resolve('success'); + const failure = Promise.reject('failure'); + await firebase.assertSucceeds(success).catch(() => { + throw new Error('Expected success to succeed.'); + }); + await firebase + .assertSucceeds(failure) + .then(() => { + throw new Error('Expected failure to fail.'); + }) + .catch(() => {}); + }); + + it('assertFails() iff failure', async function () { + const success = Promise.resolve('success'); + const failure = Promise.reject('failure'); + await firebase + .assertFails(success) + .then(() => { + throw new Error('Expected success to fail.'); + }) + .catch(() => {}); + await firebase.assertFails(failure).catch(() => { + throw new Error('Expected failure to succeed.'); + }); + }); + + it('initializeTestApp() with auth=null does not set access token', async function () { + const app = firebase.initializeTestApp({ + projectId: 'foo', + auth: undefined + }); + + const authInternal = ((app as unknown) as _FirebaseApp).container + .getProvider('auth-internal') + .getImmediate({ optional: true }); + // Auth instance will not be available because no API Key is provided + expect(authInternal).to.be.null; + }); + + it('initializeTestApp() with auth sets the correct access token', async function () { + const auth = { uid: 'alice' }; + const app = firebase.initializeTestApp({ + projectId: 'foo', + auth: auth + }); + const authInternal = ((app as unknown) as _FirebaseApp).container + .getProvider('auth-internal') + .getImmediate(); + + const token = await authInternal.getToken(); + expect(token).to.have.keys('accessToken'); + const claims = JSON.parse( + base64.decodeString(token!.accessToken.split('.')[1], /*webSafe=*/ false) + ); + // We add an 'iat' field. + expect(claims).to.deep.equal({ uid: auth.uid, iat: 0, sub: auth.uid }); + }); + + it('initializeAdminApp() sets the access token to "owner"', async function () { + const app = firebase.initializeAdminApp({ projectId: 'foo' }); + const authInternal = ((app as unknown) as _FirebaseApp).container + .getProvider('auth-internal') + .getImmediate(); + + const token = await authInternal.getToken(); + expect(token).to.have.keys('accessToken'); + expect(token!.accessToken).to.be.string('owner'); + }); + + it('loadDatabaseRules() throws if no databaseName or rules', async function () { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + await expect((firebase as any).loadDatabaseRules.bind(null, {})).to.throw( + /databaseName not specified/ + ); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + await expect( + (firebase as any).loadDatabaseRules.bind(null, { + databaseName: 'foo' + }) as Promise + ).to.throw(/must provide rules/); + await expect( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (firebase as any).loadDatabaseRules.bind(null, { rules: '{}' }) + ).to.throw(/databaseName not specified/); + }); + + it('loadDatabaseRules() succeeds on valid input', async function () { + await firebase.loadDatabaseRules({ + databaseName: 'foo', + rules: '{ "rules": {} }' + }); + }); + + it('loadFirestoreRules() succeeds on valid input', async function () { + await firebase.loadFirestoreRules({ + projectId: 'foo', + rules: `service cloud.firestore { + match /databases/{db}/documents/{doc=**} { + allow read, write; + } + }` + }); + }); + + it('clearFirestoreData() succeeds on valid input', async function () { + await firebase.clearFirestoreData({ + projectId: 'foo' + }); + }); + + it('apps() returns apps created with initializeTestApp', async function () { + const numApps = firebase.apps().length; + await firebase.initializeTestApp({ databaseName: 'foo', auth: undefined }); + expect(firebase.apps().length).to.equal(numApps + 1); + await firebase.initializeTestApp({ databaseName: 'bar', auth: undefined }); + expect(firebase.apps().length).to.equal(numApps + 2); + }); + + it('there is a way to get database timestamps', function () { + expect(firebase.database.ServerValue.TIMESTAMP).to.deep.equal({ + '.sv': 'timestamp' + }); + }); + + it('there is a way to get firestore timestamps', function () { + expect(firebase.firestore.FieldValue.serverTimestamp()).not.to.be.null; + }); +}); diff --git a/packages/testing/tsconfig.json b/packages/testing/tsconfig.json new file mode 100644 index 00000000000..09f747b4d46 --- /dev/null +++ b/packages/testing/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../config/tsconfig.base.json", + "compilerOptions": { + "outDir": "dist" + }, + "exclude": [ + "dist/**/*" + ] +} From d9bdde68d5348717f3791ed53935726fe797db1d Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 11 Aug 2020 17:59:00 +0100 Subject: [PATCH 13/18] Update changeset ignore config --- .changeset/config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.changeset/config.json b/.changeset/config.json index 1646a33836b..012712ce75b 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -17,10 +17,11 @@ "@firebase/app-types-exp", "@firebase/functions-exp", "@firebase/functions-types-exp", + "@firebase/testing", "firebase-exp" ], "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": { "onlyUpdatePeerDependentsWhenOutOfRange": true, "useCalculatedVersionForSnapshots": true } -} \ No newline at end of file +} From 9ee4bf91f5ce58a34d8b37cf79779f152e31f338 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 11 Aug 2020 18:01:28 +0100 Subject: [PATCH 14/18] Revert some changes --- packages/testing/CHANGELOG.md | 23 ----------------------- packages/testing/package.json | 10 +++++----- 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/packages/testing/CHANGELOG.md b/packages/testing/CHANGELOG.md index 99a599c19a5..4a1b957d15c 100644 --- a/packages/testing/CHANGELOG.md +++ b/packages/testing/CHANGELOG.md @@ -1,29 +1,6 @@ # @firebase/testing -## 0.20.9 - -### Patch Changes - -- Updated dependencies [[`a87676b8`](https://github.com/firebase/firebase-js-sdk/commit/a87676b84b78ccc2f057a22eb947a5d13402949c)]: - - @firebase/util@0.3.0 - - firebase@7.17.1 - -## 0.20.8 - -### Patch Changes - -- Updated dependencies [[`02419ce8`](https://github.com/firebase/firebase-js-sdk/commit/02419ce8470141f012d9ce425a6a4a4aa912e480)]: - - firebase@7.17.0 - -## 0.20.7 - -### Patch Changes - -- Updated dependencies [[`9c409ea7`](https://github.com/firebase/firebase-js-sdk/commit/9c409ea74efd00fe17058c5c8b74450fae67e9ee), [`5a355360`](https://github.com/firebase/firebase-js-sdk/commit/5a3553609da893d45f7fe1897387f72eaedf2fe0), [`c2b737b2`](https://github.com/firebase/firebase-js-sdk/commit/c2b737b2187cb525af4d926ca477102db7835420), [`9a9a81fe`](https://github.com/firebase/firebase-js-sdk/commit/9a9a81fe4f001f23e9fe1db054c2e7159fca3ae3)]: - - firebase@7.16.1 - ## 0.20.6 - ### Patch Changes - Updated dependencies [[`a754645e`](https://github.com/firebase/firebase-js-sdk/commit/a754645ec2be1b8c205f25f510196eee298b0d6e), [`17c628eb`](https://github.com/firebase/firebase-js-sdk/commit/17c628eb228c21ad1d4db83fdae08d1142a2b902), [`bb740836`](https://github.com/firebase/firebase-js-sdk/commit/bb7408361519aa9a58c8256ae01914cf2830e118), [`39ca8ecf`](https://github.com/firebase/firebase-js-sdk/commit/39ca8ecf940472159d0bc58212f34a70146da60c), [`877c060c`](https://github.com/firebase/firebase-js-sdk/commit/877c060c47bb29a8efbd2b96d35d3334fd9d9a98), [`e90304c8`](https://github.com/firebase/firebase-js-sdk/commit/e90304c8ac4341d8b23b55da784eb21348b04025), [`469c8bdf`](https://github.com/firebase/firebase-js-sdk/commit/469c8bdf18c4a22e99d595a9896af2f934df20fd)]: diff --git a/packages/testing/package.json b/packages/testing/package.json index 8007fd4504e..3717808bd6e 100644 --- a/packages/testing/package.json +++ b/packages/testing/package.json @@ -1,6 +1,6 @@ { "name": "@firebase/testing", - "version": "0.20.9", + "version": "0.20.6", "description": "", "author": "Firebase (https://firebase.google.com/)", "main": "dist/index.cjs.js", @@ -19,15 +19,15 @@ }, "license": "Apache-2.0", "dependencies": { - "firebase": "7.17.1", + "firebase": "7.16.0", "@firebase/logger": "0.2.6", - "@firebase/util": "0.3.0", + "@firebase/util": "0.2.50", "request": "2.88.2" }, "devDependencies": { "@types/request": "2.48.5", - "firebase-tools": "8.6.0", - "rollup": "2.23.0", + "firebase-tools": "8.5.0", + "rollup": "2.21.0", "rollup-plugin-typescript2": "0.27.1" }, "repository": { From 23fc04a922041f542e33aa9da352b779f9027e50 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 11 Aug 2020 18:02:20 +0100 Subject: [PATCH 15/18] Revert some changes --- packages/testing/CHANGELOG.md | 30 ++++++++++++++++++++++++++++++ packages/testing/package.json | 10 +++++----- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/packages/testing/CHANGELOG.md b/packages/testing/CHANGELOG.md index 4a1b957d15c..eed908837d2 100644 --- a/packages/testing/CHANGELOG.md +++ b/packages/testing/CHANGELOG.md @@ -1,6 +1,36 @@ # @firebase/testing +## 0.20.10 + +### Patch Changes + +- Updated dependencies []: + - firebase@7.17.2 + +## 0.20.9 + +### Patch Changes + +- Updated dependencies [[`a87676b8`](https://github.com/firebase/firebase-js-sdk/commit/a87676b84b78ccc2f057a22eb947a5d13402949c)]: + - @firebase/util@0.3.0 + - firebase@7.17.1 + +## 0.20.8 + +### Patch Changes + +- Updated dependencies [[`02419ce8`](https://github.com/firebase/firebase-js-sdk/commit/02419ce8470141f012d9ce425a6a4a4aa912e480)]: + - firebase@7.17.0 + +## 0.20.7 + +### Patch Changes + +- Updated dependencies [[`9c409ea7`](https://github.com/firebase/firebase-js-sdk/commit/9c409ea74efd00fe17058c5c8b74450fae67e9ee), [`5a355360`](https://github.com/firebase/firebase-js-sdk/commit/5a3553609da893d45f7fe1897387f72eaedf2fe0), [`c2b737b2`](https://github.com/firebase/firebase-js-sdk/commit/c2b737b2187cb525af4d926ca477102db7835420), [`9a9a81fe`](https://github.com/firebase/firebase-js-sdk/commit/9a9a81fe4f001f23e9fe1db054c2e7159fca3ae3)]: + - firebase@7.16.1 + ## 0.20.6 + ### Patch Changes - Updated dependencies [[`a754645e`](https://github.com/firebase/firebase-js-sdk/commit/a754645ec2be1b8c205f25f510196eee298b0d6e), [`17c628eb`](https://github.com/firebase/firebase-js-sdk/commit/17c628eb228c21ad1d4db83fdae08d1142a2b902), [`bb740836`](https://github.com/firebase/firebase-js-sdk/commit/bb7408361519aa9a58c8256ae01914cf2830e118), [`39ca8ecf`](https://github.com/firebase/firebase-js-sdk/commit/39ca8ecf940472159d0bc58212f34a70146da60c), [`877c060c`](https://github.com/firebase/firebase-js-sdk/commit/877c060c47bb29a8efbd2b96d35d3334fd9d9a98), [`e90304c8`](https://github.com/firebase/firebase-js-sdk/commit/e90304c8ac4341d8b23b55da784eb21348b04025), [`469c8bdf`](https://github.com/firebase/firebase-js-sdk/commit/469c8bdf18c4a22e99d595a9896af2f934df20fd)]: diff --git a/packages/testing/package.json b/packages/testing/package.json index 3717808bd6e..ee9780ce96c 100644 --- a/packages/testing/package.json +++ b/packages/testing/package.json @@ -1,6 +1,6 @@ { "name": "@firebase/testing", - "version": "0.20.6", + "version": "0.20.10", "description": "", "author": "Firebase (https://firebase.google.com/)", "main": "dist/index.cjs.js", @@ -19,15 +19,15 @@ }, "license": "Apache-2.0", "dependencies": { - "firebase": "7.16.0", + "firebase": "7.17.2", "@firebase/logger": "0.2.6", - "@firebase/util": "0.2.50", + "@firebase/util": "0.3.0", "request": "2.88.2" }, "devDependencies": { "@types/request": "2.48.5", - "firebase-tools": "8.5.0", - "rollup": "2.21.0", + "firebase-tools": "8.6.0", + "rollup": "2.23.0", "rollup-plugin-typescript2": "0.27.1" }, "repository": { From be695ee22ca95b9e41b89bb2d2ac2cda0d6db1a4 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 11 Aug 2020 18:05:34 +0100 Subject: [PATCH 16/18] No changelog --- packages/rules-unit-testing/CHANGELOG.md | 38 ------------------------ 1 file changed, 38 deletions(-) delete mode 100644 packages/rules-unit-testing/CHANGELOG.md diff --git a/packages/rules-unit-testing/CHANGELOG.md b/packages/rules-unit-testing/CHANGELOG.md deleted file mode 100644 index eed908837d2..00000000000 --- a/packages/rules-unit-testing/CHANGELOG.md +++ /dev/null @@ -1,38 +0,0 @@ -# @firebase/testing - -## 0.20.10 - -### Patch Changes - -- Updated dependencies []: - - firebase@7.17.2 - -## 0.20.9 - -### Patch Changes - -- Updated dependencies [[`a87676b8`](https://github.com/firebase/firebase-js-sdk/commit/a87676b84b78ccc2f057a22eb947a5d13402949c)]: - - @firebase/util@0.3.0 - - firebase@7.17.1 - -## 0.20.8 - -### Patch Changes - -- Updated dependencies [[`02419ce8`](https://github.com/firebase/firebase-js-sdk/commit/02419ce8470141f012d9ce425a6a4a4aa912e480)]: - - firebase@7.17.0 - -## 0.20.7 - -### Patch Changes - -- Updated dependencies [[`9c409ea7`](https://github.com/firebase/firebase-js-sdk/commit/9c409ea74efd00fe17058c5c8b74450fae67e9ee), [`5a355360`](https://github.com/firebase/firebase-js-sdk/commit/5a3553609da893d45f7fe1897387f72eaedf2fe0), [`c2b737b2`](https://github.com/firebase/firebase-js-sdk/commit/c2b737b2187cb525af4d926ca477102db7835420), [`9a9a81fe`](https://github.com/firebase/firebase-js-sdk/commit/9a9a81fe4f001f23e9fe1db054c2e7159fca3ae3)]: - - firebase@7.16.1 - -## 0.20.6 - -### Patch Changes - -- Updated dependencies [[`a754645e`](https://github.com/firebase/firebase-js-sdk/commit/a754645ec2be1b8c205f25f510196eee298b0d6e), [`17c628eb`](https://github.com/firebase/firebase-js-sdk/commit/17c628eb228c21ad1d4db83fdae08d1142a2b902), [`bb740836`](https://github.com/firebase/firebase-js-sdk/commit/bb7408361519aa9a58c8256ae01914cf2830e118), [`39ca8ecf`](https://github.com/firebase/firebase-js-sdk/commit/39ca8ecf940472159d0bc58212f34a70146da60c), [`877c060c`](https://github.com/firebase/firebase-js-sdk/commit/877c060c47bb29a8efbd2b96d35d3334fd9d9a98), [`e90304c8`](https://github.com/firebase/firebase-js-sdk/commit/e90304c8ac4341d8b23b55da784eb21348b04025), [`469c8bdf`](https://github.com/firebase/firebase-js-sdk/commit/469c8bdf18c4a22e99d595a9896af2f934df20fd)]: - - firebase@7.16.0 - - @firebase/logger@0.2.6 From 9993f0d8f81ecfa7325c5b0cbbadb6c5209fc344 Mon Sep 17 00:00:00 2001 From: Sam Stern Date: Wed, 12 Aug 2020 07:22:01 -0400 Subject: [PATCH 17/18] Update package.json --- packages/rules-unit-testing/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rules-unit-testing/package.json b/packages/rules-unit-testing/package.json index f67933659e1..80dd8381a29 100644 --- a/packages/rules-unit-testing/package.json +++ b/packages/rules-unit-testing/package.json @@ -15,7 +15,7 @@ "build:deps": "lerna run --scope @firebase/rules-unit-testing --include-dependencies build", "dev": "rollup -c -w", "test:nyc": "TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --config ../../config/mocharc.node.js", - "test": "firebase emulators:exec 'yarn test:nyc'", + "test": "firebase --debug emulators:exec 'yarn test:nyc'", "test:ci": "node ../../scripts/run_tests_in_ci.js", "prepare": "yarn build" }, From cb122611f92830688d64b22a783fc6d1e1a7bab3 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 12 Aug 2020 13:01:59 +0100 Subject: [PATCH 18/18] No port conflict --- packages/rules-unit-testing/firebase.json | 4 ++-- packages/testing/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/rules-unit-testing/firebase.json b/packages/rules-unit-testing/firebase.json index b2ba04fe7ea..a5b6bcc199c 100644 --- a/packages/rules-unit-testing/firebase.json +++ b/packages/rules-unit-testing/firebase.json @@ -1,10 +1,10 @@ { "emulators": { "firestore": { - "port": 9001 + "port": 9003 }, "database": { - "port": 9000 + "port": 9002 }, "ui": { "enabled": false diff --git a/packages/testing/package.json b/packages/testing/package.json index ee9780ce96c..21ec0736090 100644 --- a/packages/testing/package.json +++ b/packages/testing/package.json @@ -13,7 +13,7 @@ "build:deps": "lerna run --scope @firebase/testing --include-dependencies build", "dev": "rollup -c -w", "test:nyc": "TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --config ../../config/mocharc.node.js", - "test": "firebase emulators:exec 'yarn test:nyc'", + "test": "firebase --debug emulators:exec 'yarn test:nyc'", "test:ci": "node ../../scripts/run_tests_in_ci.js", "prepare": "yarn build" },