@chaosity/location-client 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClientConfig
|
|
1
|
+
import type { ClientConfig } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* GeoPlacesClient - AWS Location Service compatible client with custom auth
|
|
4
4
|
*
|
|
@@ -13,6 +13,6 @@ export declare class GeoPlacesClient {
|
|
|
13
13
|
serviceId: string;
|
|
14
14
|
};
|
|
15
15
|
constructor(config: ClientConfig);
|
|
16
|
-
send<TOutput>(command:
|
|
16
|
+
send<TInput, TOutput>(command: TInput): Promise<TOutput>;
|
|
17
17
|
private getEndpoint;
|
|
18
18
|
}
|
|
@@ -28,10 +28,11 @@ export class GeoPlacesClient {
|
|
|
28
28
|
this.config = { serviceId: 'Geo Places' };
|
|
29
29
|
}
|
|
30
30
|
async send(command) {
|
|
31
|
-
const
|
|
31
|
+
const cmd = command;
|
|
32
|
+
const endpoint = this.getEndpoint(cmd);
|
|
32
33
|
const url = `${this.clientConfig.apiUrl}${endpoint}`;
|
|
33
|
-
const commandName =
|
|
34
|
-
const input = roundPositionFields(
|
|
34
|
+
const commandName = cmd.constructor.name;
|
|
35
|
+
const input = roundPositionFields(cmd.input);
|
|
35
36
|
// Prefer getToken callback (live ref) over static token string
|
|
36
37
|
const token = this.clientConfig.getToken?.() ?? this.clientConfig.token;
|
|
37
38
|
log('Sending %s to %s', commandName, endpoint);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { GeoPlacesCommand } from '../types';
|
|
2
1
|
export interface ConnectorConfig {
|
|
3
2
|
apiUrl?: string;
|
|
4
3
|
token?: string;
|
|
@@ -42,6 +41,6 @@ export declare class LocationServiceConnector {
|
|
|
42
41
|
private configPromise;
|
|
43
42
|
readonly serviceId: string;
|
|
44
43
|
constructor(config?: ConnectorConfig);
|
|
45
|
-
send<TOutput>(command:
|
|
44
|
+
send<TInput, TOutput>(command: TInput, options?: SendOptions): Promise<TOutput>;
|
|
46
45
|
private getEndpoint;
|
|
47
46
|
}
|
|
@@ -56,10 +56,11 @@ export class LocationServiceConnector {
|
|
|
56
56
|
if (!token) {
|
|
57
57
|
throw new Error('No token available');
|
|
58
58
|
}
|
|
59
|
-
const
|
|
59
|
+
const cmd = command;
|
|
60
|
+
const endpoint = this.getEndpoint(cmd);
|
|
60
61
|
const url = `${config.apiUrl}${endpoint}`;
|
|
61
|
-
const commandName =
|
|
62
|
-
const input = roundPositionFields(
|
|
62
|
+
const commandName = cmd.constructor.name;
|
|
63
|
+
const input = roundPositionFields(cmd.input);
|
|
63
64
|
log('Sending %s request to %s', commandName, endpoint);
|
|
64
65
|
const startTime = Date.now();
|
|
65
66
|
// Merge headers: user headers, then system headers override
|