Skip to content

Commit 8c7f285

Browse files
committed
Fixed parsing
1 parent 7d0ba34 commit 8c7f285

File tree

11 files changed

+5
-95
lines changed

11 files changed

+5
-95
lines changed

packages/data-connect/src/core/QueryManager.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,6 @@ export class QueryManager {
221221

222222
return newR;
223223
}
224-
enableEmulator(host: string, port: number): void {
225-
this.transport.useEmulator(host, port);
226-
}
227224
}
228225
function compareDates(str1: string, str2: string): boolean {
229226
const date1 = new Date(str1);

packages/data-connect/src/network/transport/rest.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import { CallerSdkType, CallerSdkTypeEnum, DataConnectTransport } from '.';
2727

2828
export class RESTTransport implements DataConnectTransport {
2929
private _host = '';
30-
private _port: number | undefined;
3130
private _location = 'l';
3231
private _connectorName = '';
3332
private _secure = true;
@@ -47,9 +46,6 @@ export class RESTTransport implements DataConnectTransport {
4746
private _callerSdkType: CallerSdkType = CallerSdkTypeEnum.Base
4847
) {
4948
if (transportOptions) {
50-
if (typeof transportOptions.port === 'number') {
51-
this._port = transportOptions.port;
52-
}
5349
if (typeof transportOptions.sslEnabled !== 'undefined') {
5450
this._secure = transportOptions.sslEnabled;
5551
}
@@ -88,14 +84,11 @@ export class RESTTransport implements DataConnectTransport {
8884
projectId: this._project,
8985
service: this._serviceName
9086
},
91-
{ host: this._host, sslEnabled: this._secure, port: this._port }
87+
{ host: this._host, sslEnabled: this._secure }
9288
);
9389
}
94-
useEmulator(host: string, port?: number, isSecure?: boolean): void {
90+
useEmulator(host: string, isSecure?: boolean): void {
9591
this._host = host;
96-
if (typeof port === 'number') {
97-
this._port = port;
98-
}
9992
if (typeof isSecure !== 'undefined') {
10093
this._secure = isSecure;
10194
}

packages/data-connect/src/util/url.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,16 @@
1616
*/
1717

1818
import { DataConnectOptions, TransportOptions } from '../api/DataConnect';
19-
import { Code, DataConnectError } from '../core/error';
20-
import { logError } from '../logger';
2119

2220
export function urlBuilder(
2321
projectConfig: DataConnectOptions,
2422
transportOptions: TransportOptions
2523
): string {
2624
const { connector, location, projectId: project, service } = projectConfig;
27-
const { host, sslEnabled, port } = transportOptions;
25+
const { host, sslEnabled } = transportOptions;
2826
const protocol = sslEnabled ? 'https' : 'http';
2927
const realHost = host || `firebasedataconnect.googleapis.com`;
30-
let baseUrl = `${protocol}://${realHost}`;
31-
if (typeof port === 'number') {
32-
baseUrl += `:${port}`;
33-
} else if (typeof port !== 'undefined') {
34-
logError('Port type is of an invalid type');
35-
throw new DataConnectError(
36-
Code.INVALID_ARGUMENT,
37-
'Incorrect type for port passed in!'
38-
);
39-
}
28+
const baseUrl = `${protocol}://${realHost}`;
4029
return `${baseUrl}/v1/projects/${project}/locations/${location}/services/${service}/connectors/${connector}`;
4130
}
4231
export function addToken(url: string, apiKey?: string): string {

packages/data-connect/test/dataconnect/index.esm.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

packages/data-connect/test/dataconnect/logAddMovieVariables.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/data-connect/test/dataconnect/logListAllMoviesMovies.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/data-connect/test/dataconnect/logListMovieIdsMovies.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/data-connect/test/dataconnect/movies.tools.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/data-connect/test/dataconnect/test.tools.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/data-connect/test/unit/dataconnect.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,16 @@ describe('Data Connect Test', () => {
6363
it('should parse env var correctly with http://', async () => {
6464
const parsedHost = parseOptions('http://localhost');
6565
expect(parsedHost.host).to.eq('localhost');
66-
expect(parsedHost.port).to.be.undefined;
6766
expect(parsedHost.sslEnabled).to.be.false;
6867
});
6968
it('should parse env var correctly with port', async () => {
7069
const parsedHost = parseOptions('localhost:8080');
71-
expect(parsedHost.host).to.eq('localhost');
72-
expect(parsedHost.port).to.eq(8080);
70+
expect(parsedHost.host).to.eq('localhost:8080');
7371
expect(parsedHost.sslEnabled).to.be.false;
7472
});
7573
it('should parse env var correctly with https://', async () => {
7674
const parsedHost = parseOptions('https://localhost');
7775
expect(parsedHost.host).to.eq('localhost');
78-
expect(parsedHost.port).to.be.undefined;
7976
expect(parsedHost.sslEnabled).to.be.true;
8077
});
8178
});

0 commit comments

Comments
 (0)