Skip to content

Commit 9a26ca9

Browse files
committed
Address PR comments
1 parent 1f00469 commit 9a26ca9

File tree

5 files changed

+12
-18
lines changed

5 files changed

+12
-18
lines changed

packages-exp/functions-exp/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = {
2929
'import/no-extraneous-dependencies': [
3030
'error',
3131
{
32-
'packageDir': [path.resolve(__dirname, '../../'), './'],
32+
'packageDir': [path.resolve(__dirname, '../../'), __dirname],
3333
devDependencies: true,
3434
peerDependencies: true
3535
}

packages-exp/functions-exp/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
1616
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
1717
"build": "rollup -c && yarn api-report",
18-
"build:deps": "lerna run --scope @firebase/'{app-exp,functions-exp}' --include-dependencies build",
18+
"build:deps": "lerna run --scope @firebase/functions-exp --include-dependencies build",
1919
"dev": "rollup -c -w",
2020
"test": "yarn type-check && run-p lint test:browser test:node",
2121
"test:ci": "node ../../scripts/run_tests_in_ci.js",
@@ -32,11 +32,13 @@
3232
},
3333
"license": "Apache-2.0",
3434
"peerDependencies": {
35+
"@firebase/app-exp": "0.x",
3536
"@firebase/app-exp-types": "0.x"
3637
},
3738
"devDependencies": {
38-
"@firebase/app-exp": "0.x",
39+
"@firebase/app-exp": "0.0.800",
3940
"@firebase/messaging": "0.6.15",
41+
"@firebase/util": "0.2.46",
4042
"rollup": "2.7.6",
4143
"rollup-plugin-typescript2": "0.27.0",
4244
"typescript": "3.8.3"

packages-exp/functions-exp/src/callable.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
*/
1717
import { expect } from 'chai';
1818
import * as sinon from 'sinon';
19-
import { FirebaseApp } from '@firebase/app-types';
20-
import { _FirebaseApp } from '@firebase/app-types/private';
19+
import { FirebaseApp } from '@firebase/app-types-exp';
2120
import { FunctionsErrorCode } from '@firebase/functions-types-exp';
2221
import {
2322
Provider,

packages-exp/functions-exp/src/service.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
2929
import { FirebaseMessagingName } from '@firebase/messaging-types';
3030

3131
export const DEFAULT_REGION = 'us-central1';
32+
const serializer = new Serializer();
3233

3334
/**
3435
* The response to an http request.
@@ -72,7 +73,6 @@ function failAfter(millis: number): Promise<never> {
7273
*/
7374
export class FunctionsService {
7475
readonly contextProvider: ContextProvider;
75-
readonly serializer = new Serializer();
7676
emulatorOrigin: string | null = null;
7777
cancelAllRequests: Promise<void>;
7878
deleteService!: Function;
@@ -205,7 +205,7 @@ async function call(
205205
const url = functionsInstance._url(name);
206206

207207
// Encode any special types, such as dates, in the input data.
208-
data = functionsInstance.serializer.encode(data);
208+
data = serializer.encode(data);
209209
const body = { data };
210210

211211
// Add a header for the authToken.
@@ -236,11 +236,7 @@ async function call(
236236
}
237237

238238
// Check for an error status, regardless of http status.
239-
const error = _errorForResponse(
240-
response.status,
241-
response.json,
242-
functionsInstance.serializer
243-
);
239+
const error = _errorForResponse(response.status, response.json, serializer);
244240
if (error) {
245241
throw error;
246242
}
@@ -261,9 +257,7 @@ async function call(
261257
}
262258

263259
// Decode any special types, such as dates, in the returned data.
264-
const decodedData = functionsInstance.serializer.decode(
265-
responseData as {} | null
266-
);
260+
const decodedData = serializer.decode(responseData as {} | null);
267261

268262
return { data: decodedData };
269263
}

packages-exp/functions-exp/test/utils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { FirebaseOptions, FirebaseApp } from '@firebase/app-types';
18+
import { FirebaseOptions, FirebaseApp } from '@firebase/app-types-exp';
1919
import { Provider, ComponentContainer } from '@firebase/component';
2020
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
2121
import { FirebaseMessagingName } from '@firebase/messaging-types';
@@ -36,8 +36,7 @@ export function makeFakeApp(options: FirebaseOptions = {}): FirebaseApp {
3636
return {
3737
name: 'appName',
3838
options,
39-
automaticDataCollectionEnabled: true,
40-
delete: async () => {}
39+
automaticDataCollectionEnabled: true
4140
};
4241
}
4342

0 commit comments

Comments
 (0)