Skip to content

Commit

Permalink
Merge branch 'master' into mrschmidt/fixauth
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidt-sebastian committed Jun 9, 2021
2 parents 701ef07 + ed4f95c commit 79f0a00
Show file tree
Hide file tree
Showing 82 changed files with 485 additions and 167 deletions.
5 changes: 0 additions & 5 deletions .changeset/blue-hairs-scream.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/fuzzy-teachers-guess.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/rotten-wombats-shop.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/twenty-scissors-exist.md

This file was deleted.

3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
- name: Install Dependencies
run: yarn

- name: Add a changeset for @firebase/app
run: yarn ts-node-script scripts/add_changeset.ts

- name: Create Release Pull Request
uses: changesets/action@master
env:
Expand Down
56 changes: 28 additions & 28 deletions integration/compat-interop/package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"name": "firebase-compat-interop-test",
"private": true,
"version": "0.1.0",
"scripts": {
"test": "karma start --single-run",
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test",
"test:debug": "karma start --browsers Chrome --auto-watch"
},
"dependencies": {
"@firebase/app-exp": "0.0.900",
"@firebase/app-compat": "0.0.900",
"@firebase/analytics-exp": "0.0.900",
"@firebase/analytics-compat": "0.0.900",
"@firebase/auth-exp": "0.0.900",
"@firebase/auth-compat": "0.0.900",
"@firebase/functions-exp": "0.0.900",
"@firebase/functions-compat": "0.0.900",
"@firebase/messaging-exp": "0.0.900",
"@firebase/messaging-compat": "0.0.900",
"@firebase/performance-exp": "0.0.900",
"@firebase/performance-compat": "0.0.900",
"@firebase/remote-config-exp": "0.0.900",
"@firebase/remote-config-compat": "0.0.900"
},
"devDependencies": {
"typescript": "4.2.2"
}
}
"name": "firebase-compat-interop-test",
"private": true,
"version": "0.1.0",
"scripts": {
"test": "karma start --single-run",
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test",
"test:debug": "karma start --browsers Chrome --auto-watch"
},
"dependencies": {
"@firebase/app-exp": "0.0.900",
"@firebase/app-compat": "0.0.900",
"@firebase/analytics-exp": "0.0.900",
"@firebase/analytics-compat": "0.0.900",
"@firebase/auth-exp": "0.0.900",
"@firebase/auth-compat": "0.0.900",
"@firebase/functions-exp": "0.0.900",
"@firebase/functions-compat": "0.0.900",
"@firebase/messaging-exp": "0.0.900",
"@firebase/messaging-compat": "0.0.900",
"@firebase/performance-exp": "0.0.900",
"@firebase/performance-compat": "0.0.900",
"@firebase/remote-config-exp": "0.0.900",
"@firebase/remote-config-compat": "0.0.900"
},
"devDependencies": {
"typescript": "4.2.2"
}
}
2 changes: 1 addition & 1 deletion integration/firebase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test"
},
"devDependencies": {
"firebase": "8.6.2",
"firebase": "8.6.5",
"@types/chai": "4.2.14",
"@types/mocha": "7.0.2",
"chai": "4.2.0",
Expand Down
4 changes: 2 additions & 2 deletions integration/firestore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"test:memory:debug": "yarn build:memory; karma start --auto-watch --browsers Chrome"
},
"devDependencies": {
"@firebase/app": "0.6.22",
"@firebase/firestore": "2.3.1",
"@firebase/app": "0.6.24",
"@firebase/firestore": "2.3.4",
"@types/mocha": "7.0.2",
"gulp": "4.0.2",
"gulp-filter": "6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion integration/messaging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"test:manual": "mocha --exit"
},
"devDependencies": {
"firebase": "8.6.2",
"firebase": "8.6.5",
"chai": "4.2.0",
"chromedriver": "89.0.0",
"express": "4.17.1",
Expand Down
2 changes: 1 addition & 1 deletion packages-exp/analytics-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"typings": "dist/src/index.d.ts",
"dependencies": {
"@firebase/component": "0.5.0",
"@firebase/component": "0.5.1",
"@firebase/analytics-exp": "0.0.900",
"@firebase/analytics-types": "0.4.0",
"@firebase/util": "1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages-exp/analytics-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@firebase/installations-exp": "0.0.900",
"@firebase/logger": "0.2.6",
"@firebase/util": "1.1.0",
"@firebase/component": "0.5.0",
"@firebase/component": "0.5.1",
"tslib": "^2.1.0"
},
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages-exp/app-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@firebase/app-exp": "0.0.900",
"@firebase/util": "1.1.0",
"@firebase/logger": "0.2.6",
"@firebase/component": "0.5.0",
"@firebase/component": "0.5.1",
"tslib": "^2.1.0",
"dom-storage": "2.1.0",
"xmlhttprequest": "1.8.0"
Expand Down
2 changes: 1 addition & 1 deletion packages-exp/app-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dependencies": {
"@firebase/util": "1.1.0",
"@firebase/logger": "0.2.6",
"@firebase/component": "0.5.0",
"@firebase/component": "0.5.1",
"tslib": "^2.1.0"
},
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages-exp/auth-compat-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"dependencies": {
"@firebase/auth-exp": "0.0.900",
"@firebase/auth-types": "0.10.3",
"@firebase/component": "0.5.0",
"@firebase/component": "0.5.1",
"@firebase/util": "1.1.0",
"node-fetch": "2.6.1",
"selenium-webdriver": "^4.0.0-beta.2",
Expand Down
2 changes: 1 addition & 1 deletion packages-exp/auth-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@firebase/app-exp": "0.x"
},
"dependencies": {
"@firebase/component": "0.5.0",
"@firebase/component": "0.5.1",
"@firebase/logger": "0.2.6",
"@firebase/util": "1.1.0",
"node-fetch": "2.6.1",
Expand Down
2 changes: 1 addition & 1 deletion packages-exp/auth-exp/src/api/authentication/mfa.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ describe('api/authentication/finalizeSignInPhoneMfa', () => {

await expect(finalizeSignInPhoneMfa(auth, request)).to.be.rejectedWith(
FirebaseError,
'Firebase: The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure use the verification code provided by the user. (auth/invalid-verification-code).'
'Firebase: The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure to use the verification code provided by the user. (auth/invalid-verification-code).'
);
expect(mock.calls[0].request).to.eql({
tenantId: null,
Expand Down
4 changes: 2 additions & 2 deletions packages-exp/auth-exp/src/api/authentication/sms.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ describe('api/authentication/signInWithPhoneNumber', () => {

await expect(signInWithPhoneNumber(auth, request)).to.be.rejectedWith(
FirebaseError,
'Firebase: The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure use the verification code provided by the user. (auth/invalid-verification-code).'
'Firebase: The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure to use the verification code provided by the user. (auth/invalid-verification-code).'
);
expect(mock.calls[0].request).to.eql(request);
});
Expand Down Expand Up @@ -222,7 +222,7 @@ describe('api/authentication/linkWithPhoneNumber', () => {

await expect(linkWithPhoneNumber(auth, request)).to.be.rejectedWith(
FirebaseError,
'Firebase: The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure use the verification code provided by the user. (auth/invalid-verification-code).'
'Firebase: The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure to use the verification code provided by the user. (auth/invalid-verification-code).'
);
expect(mock.calls[0].request).to.eql(request);
});
Expand Down
2 changes: 1 addition & 1 deletion packages-exp/auth-exp/src/core/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ function _debugErrorMap(): ErrorMap<AuthErrorCode> {
[AuthErrorCode.INVALID_AUTH_EVENT]: 'An internal AuthError has occurred.',
[AuthErrorCode.INVALID_CODE]:
'The SMS verification code used to create the phone auth credential is ' +
'invalid. Please resend the verification code sms and be sure use the ' +
'invalid. Please resend the verification code sms and be sure to use the ' +
'verification code provided by the user.',
[AuthErrorCode.INVALID_CONTINUE_URI]:
'The continue URL provided in the request is invalid.',
Expand Down
1 change: 1 addition & 0 deletions packages-exp/auth-exp/src/core/strategies/anonymous.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { _castAuth } from '../auth/auth_impl';
*/
export async function signInAnonymously(auth: Auth): Promise<UserCredential> {
const authInternal = _castAuth(auth);
await authInternal._initializationPromise;
if (authInternal.currentUser?.isAnonymous) {
// If an anonymous user is already signed in, no need to sign them in again.
return new UserCredentialImpl({
Expand Down
15 changes: 15 additions & 0 deletions packages-exp/auth-exp/test/integration/webdriver/anonymous.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,19 @@ browserDescribe('WebDriver anonymous auth test', driver => {
);
expect(after.uid).to.eq(before.uid);
});

it('user persists after refresh and sign in (no init wait)', async () => {
const { user: before }: UserCredential = await driver.call(
AnonFunction.SIGN_IN_ANONYMOUSLY
);
await driver.webDriver.navigate().refresh();
await driver.injectConfigAndInitAuth();

// At this point we aren't waiting for auth to "settle"
// Sign in before the first onAuthStateChanged has occurred
const { user: after }: UserCredential = await driver.call(
AnonFunction.SIGN_IN_ANONYMOUSLY
);
expect(after.uid).to.eq(before.uid);
});
});
8 changes: 4 additions & 4 deletions packages-exp/firebase-exp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "firebase-exp",
"version": "9.0.0-beta.2",
"version": "9.0.0-beta.3",
"private": true,
"description": "Firebase JavaScript library for web and Node.js",
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
Expand Down Expand Up @@ -129,11 +129,11 @@
"@firebase/app-compat": "0.0.900",
"@firebase/auth-exp": "0.0.900",
"@firebase/auth-compat": "0.0.900",
"@firebase/database": "0.10.1",
"@firebase/database": "0.10.3",
"@firebase/functions-exp": "0.0.900",
"@firebase/functions-compat": "0.0.900",
"@firebase/firestore": "2.3.1",
"@firebase/storage": "0.5.2",
"@firebase/firestore": "2.3.4",
"@firebase/storage": "0.5.3",
"@firebase/performance-exp": "0.0.900",
"@firebase/performance-compat": "0.0.900",
"@firebase/remote-config-exp": "0.0.900",
Expand Down
2 changes: 1 addition & 1 deletion packages-exp/functions-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"typings": "dist/src/index.d.ts",
"dependencies": {
"@firebase/component": "0.5.0",
"@firebase/component": "0.5.1",
"@firebase/functions-exp": "0.0.900",
"@firebase/functions-types": "0.4.0",
"@firebase/messaging-types": "0.5.0",
Expand Down
2 changes: 1 addition & 1 deletion packages-exp/functions-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
"typings": "dist/functions-exp-public.d.ts",
"dependencies": {
"@firebase/component": "0.5.0",
"@firebase/component": "0.5.1",
"@firebase/messaging-types": "0.5.0",
"@firebase/util": "1.1.0",
"node-fetch": "2.6.1",
Expand Down
24 changes: 20 additions & 4 deletions packages-exp/functions-exp/src/serializer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ describe('Serializer', () => {
expect(decode('hello')).to.equal('hello');
});

it('encodes date to ISO string', () => {
expect(encode(new Date(1620666095891))).to.equal(
'2021-05-10T17:01:35.891Z'
);
});

it('decodes date string without modifying it', () => {
expect(decode('2021-05-10T17:01:35.891Z')).to.equal(
'2021-05-10T17:01:35.891Z'
);
});

// TODO(klimt): Make this test more interesting once we have a complex type
// that can be created in JavaScript.
it('encodes array', () => {
Expand Down Expand Up @@ -111,12 +123,14 @@ describe('Serializer', () => {
encode({
foo: 1,
bar: 'hello',
baz: [1, 2, 3]
baz: [1, 2, 3],
date: new Date(1620666095891)
})
).to.deep.equal({
foo: 1,
bar: 'hello',
baz: [1, 2, 3]
baz: [1, 2, 3],
date: '2021-05-10T17:01:35.891Z'
});
});

Expand All @@ -132,12 +146,14 @@ describe('Serializer', () => {
value: '1099511627776',
'@type': 'type.googleapis.com/google.protobuf.Int64Value'
}
]
],
date: '2021-05-10T17:01:35.891Z'
})
).to.deep.equal({
foo: 1,
bar: 'hello',
baz: [1, 2, 1099511627776]
baz: [1, 2, 1099511627776],
date: '2021-05-10T17:01:35.891Z'
});
});

Expand Down
3 changes: 3 additions & 0 deletions packages-exp/functions-exp/src/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ export function encode(data: unknown): unknown {
if (Object.prototype.toString.call(data) === '[object String]') {
return data;
}
if (data instanceof Date) {
return data.toISOString();
}
if (Array.isArray(data)) {
return data.map(x => encode(x));
}
Expand Down
2 changes: 1 addition & 1 deletion packages-exp/installations-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@firebase/installations-exp": "0.0.900",
"@firebase/installations-types": "0.3.4",
"@firebase/util": "1.1.0",
"@firebase/component": "0.5.0",
"@firebase/component": "0.5.1",
"idb": "3.0.2",
"tslib": "^2.1.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages-exp/installations-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
},
"dependencies": {
"@firebase/util": "1.1.0",
"@firebase/component": "0.5.0",
"@firebase/component": "0.5.1",
"idb": "3.0.2",
"tslib": "^2.1.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages-exp/messaging-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
"test:karma": "karma start --single-run",
"test:debug": "karma start --browsers=Chrome --auto-watch",
"type-check": "tsc --noEmit",
"add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../messaging-exp/dist/messaging-exp-public.d.ts -o dist/src/index.d.ts -a -r FirebaseMessaging:MessagingCompat -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/messaging"
"add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../messaging-exp/dist/index-public.d.ts -o dist/src/index.d.ts -a -r FirebaseMessaging:MessagingCompat -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/messaging"
},
"peerDependencies": {
"@firebase/app-compat": "0.x"
},
"dependencies": {
"@firebase/messaging-exp": "0.0.900",
"@firebase/component": "0.5.0",
"@firebase/component": "0.5.1",
"@firebase/installations-exp": "0.0.900",
"@firebase/util": "1.1.0",
"tslib": "^2.1.0"
Expand Down
11 changes: 9 additions & 2 deletions packages-exp/messaging-exp/api-extractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@
}],
"dtsRollup": {
/**
* rollup is not supported when multiple entry points are present
* rollup is not supported when multiple entry points are present.
* npm script api-report:rollup is used to generate dts rollup.
*/
"enabled": false
}
},
"apiReport": {
/**
* apiReport is handled by npm script api-report:rollup
*/
"enabled": false
}
}
Loading

0 comments on commit 79f0a00

Please sign in to comment.