Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hsubox76 committed May 21, 2020
1 parent 1177fa6 commit c5ea05e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages-exp/functions-exp/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
'import/no-extraneous-dependencies': [
'error',
{
'packageDir': [path.resolve(__dirname, '../../'), './'],
'packageDir': [path.resolve(__dirname, '../../'), __dirname],
devDependencies: true,
peerDependencies: true
}
Expand Down
6 changes: 4 additions & 2 deletions packages-exp/functions-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"build": "rollup -c && yarn api-report",
"build:deps": "lerna run --scope @firebase/'{app-exp,functions-exp}' --include-dependencies build",
"build:deps": "lerna run --scope @firebase/functions-exp --include-dependencies build",
"dev": "rollup -c -w",
"test": "yarn type-check && run-p lint test:browser test:node",
"test:ci": "node ../../scripts/run_tests_in_ci.js",
Expand All @@ -32,11 +32,13 @@
},
"license": "Apache-2.0",
"peerDependencies": {
"@firebase/app-exp": "0.x",
"@firebase/app-exp-types": "0.x"
},
"devDependencies": {
"@firebase/app-exp": "0.x",
"@firebase/app-exp": "0.0.800",
"@firebase/messaging": "0.6.15",
"@firebase/util": "0.2.46",
"rollup": "2.7.6",
"rollup-plugin-typescript2": "0.27.0",
"typescript": "3.8.3"
Expand Down
3 changes: 1 addition & 2 deletions packages-exp/functions-exp/src/callable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
*/
import { expect } from 'chai';
import * as sinon from 'sinon';
import { FirebaseApp } from '@firebase/app-types';
import { _FirebaseApp } from '@firebase/app-types/private';
import { FirebaseApp } from '@firebase/app-types-exp';
import { FunctionsErrorCode } from '@firebase/functions-types-exp';
import {
Provider,
Expand Down
14 changes: 4 additions & 10 deletions packages-exp/functions-exp/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
import { FirebaseMessagingName } from '@firebase/messaging-types';

export const DEFAULT_REGION = 'us-central1';
const serializer = new Serializer();

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

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

// Add a header for the authToken.
Expand Down Expand Up @@ -236,11 +236,7 @@ async function call(
}

// Check for an error status, regardless of http status.
const error = _errorForResponse(
response.status,
response.json,
functionsInstance.serializer
);
const error = _errorForResponse(response.status, response.json, serializer);
if (error) {
throw error;
}
Expand All @@ -261,9 +257,7 @@ async function call(
}

// Decode any special types, such as dates, in the returned data.
const decodedData = functionsInstance.serializer.decode(
responseData as {} | null
);
const decodedData = serializer.decode(responseData as {} | null);

return { data: decodedData };
}
5 changes: 2 additions & 3 deletions packages-exp/functions-exp/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { FirebaseOptions, FirebaseApp } from '@firebase/app-types';
import { FirebaseOptions, FirebaseApp } from '@firebase/app-types-exp';
import { Provider, ComponentContainer } from '@firebase/component';
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
import { FirebaseMessagingName } from '@firebase/messaging-types';
Expand All @@ -36,8 +36,7 @@ export function makeFakeApp(options: FirebaseOptions = {}): FirebaseApp {
return {
name: 'appName',
options,
automaticDataCollectionEnabled: true,
delete: async () => {}
automaticDataCollectionEnabled: true
};
}

Expand Down

0 comments on commit c5ea05e

Please sign in to comment.