@chaosity/location-client 0.1.0 → 0.1.2
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chaosity/location-client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Client library for Chaosity Location Service with AWS Location Service compatibility",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,6 +20,14 @@
|
|
|
20
20
|
],
|
|
21
21
|
"author": "Chaosity",
|
|
22
22
|
"license": "MIT",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/chaosity-io/location-service-client.git"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/chaosity-io/location-service-client",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/chaosity-io/location-service-client/issues"
|
|
30
|
+
},
|
|
23
31
|
"dependencies": {
|
|
24
32
|
"@aws-sdk/client-geo-places": "^3.0.0",
|
|
25
33
|
"@aws/amazon-location-utilities-datatypes": "^1.0.0"
|
package/dist/auth/AuthClient.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export class AuthClient {
|
|
2
|
-
constructor(authEndpoint = 'https://api.locationservice.com/auth') {
|
|
3
|
-
this.authEndpoint = authEndpoint;
|
|
4
|
-
}
|
|
5
|
-
async fetchToken(credentials) {
|
|
6
|
-
const response = await fetch(`${this.authEndpoint}/token`, {
|
|
7
|
-
method: 'POST',
|
|
8
|
-
headers: {
|
|
9
|
-
'Content-Type': 'application/json'
|
|
10
|
-
},
|
|
11
|
-
body: JSON.stringify({
|
|
12
|
-
grant_type: 'client_credentials',
|
|
13
|
-
client_id: credentials.client_id,
|
|
14
|
-
client_secret: credentials.client_secret
|
|
15
|
-
})
|
|
16
|
-
});
|
|
17
|
-
if (!response.ok) {
|
|
18
|
-
const error = await response.json();
|
|
19
|
-
throw new Error(error.error_description || 'Failed to fetch token');
|
|
20
|
-
}
|
|
21
|
-
return await response.json();
|
|
22
|
-
}
|
|
23
|
-
}
|
package/dist/auth/AuthHelper.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export class AuthHelper {
|
|
2
|
-
constructor(token, apiUrl) {
|
|
3
|
-
this.token = token;
|
|
4
|
-
this.apiUrl = apiUrl;
|
|
5
|
-
}
|
|
6
|
-
setToken(token) {
|
|
7
|
-
this.token = token;
|
|
8
|
-
}
|
|
9
|
-
getToken() {
|
|
10
|
-
return this.token;
|
|
11
|
-
}
|
|
12
|
-
getClientConfig() {
|
|
13
|
-
return {
|
|
14
|
-
apiUrl: this.apiUrl,
|
|
15
|
-
token: this.token
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
}
|