celitech-sdk 1.3.46 → 1.3.47
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/README.md +7 -4
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Celitech TypeScript SDK 1.3.
|
1
|
+
# Celitech TypeScript SDK 1.3.47
|
2
2
|
|
3
3
|
Welcome to the Celitech SDK documentation. This guide will help you get started with integrating and using the Celitech SDK in your project.
|
4
4
|
|
@@ -6,8 +6,8 @@ Welcome to the Celitech SDK documentation. This guide will help you get started
|
|
6
6
|
|
7
7
|
## Versions
|
8
8
|
|
9
|
-
- API version: `1.3.
|
10
|
-
- SDK version: `1.3.
|
9
|
+
- API version: `1.3.47`
|
10
|
+
- SDK version: `1.3.47`
|
11
11
|
|
12
12
|
## About the API
|
13
13
|
|
@@ -92,7 +92,10 @@ Below is a comprehensive example demonstrating how to authenticate and call a si
|
|
92
92
|
import { Celitech } from 'celitech-sdk';
|
93
93
|
|
94
94
|
(async () => {
|
95
|
-
const celitech = new Celitech({
|
95
|
+
const celitech = new Celitech({
|
96
|
+
clientId: 'CLIENT_ID',
|
97
|
+
clientSecret: 'CLIENT_SECRET',
|
98
|
+
});
|
96
99
|
|
97
100
|
const { data } = await celitech.destinations.listDestinations();
|
98
101
|
|
package/dist/index.js
CHANGED
@@ -1446,14 +1446,14 @@ var OAuthToken = class {
|
|
1446
1446
|
};
|
1447
1447
|
var OAuthTokenManager = class {
|
1448
1448
|
async getToken(scopes, config) {
|
1449
|
-
var _a, _b, _c, _d, _e;
|
1450
|
-
if ((_a = this.token) == null ? void 0 : _a.hasAllScopes(scopes)) {
|
1449
|
+
var _a, _b, _c, _d, _e, _f;
|
1450
|
+
if (((_a = this.token) == null ? void 0 : _a.hasAllScopes(scopes)) && ((_b = this.token) == null ? void 0 : _b.expiresAt) && this.token.expiresAt >= Math.floor(Date.now() / 1e3)) {
|
1451
1451
|
return this.token;
|
1452
1452
|
}
|
1453
1453
|
if (!config.clientId || !config.clientSecret) {
|
1454
1454
|
throw new Error("OAuthError: clientId and clientSecret are required for token management.");
|
1455
1455
|
}
|
1456
|
-
const updatedScopes = /* @__PURE__ */ new Set([...scopes, ...((
|
1456
|
+
const updatedScopes = /* @__PURE__ */ new Set([...scopes, ...((_c = this.token) == null ? void 0 : _c.scopes) || []]);
|
1457
1457
|
const oAuth = new OAuthService(
|
1458
1458
|
{
|
1459
1459
|
...config,
|
@@ -1469,7 +1469,7 @@ var OAuthTokenManager = class {
|
|
1469
1469
|
},
|
1470
1470
|
{}
|
1471
1471
|
);
|
1472
|
-
if (!((
|
1472
|
+
if (!((_d = response.data) == null ? void 0 : _d.accessToken)) {
|
1473
1473
|
throw new Error(
|
1474
1474
|
`OAuthError: token endpoint response did not return access token. Response: ${JSON.stringify(response), void 0, 2}.`
|
1475
1475
|
);
|
@@ -1477,7 +1477,7 @@ var OAuthTokenManager = class {
|
|
1477
1477
|
this.token = new OAuthToken(
|
1478
1478
|
response.data.accessToken,
|
1479
1479
|
updatedScopes,
|
1480
|
-
((
|
1480
|
+
((_e = response.data) == null ? void 0 : _e.expiresIn) ? ((_f = response.data) == null ? void 0 : _f.expiresIn) + Math.floor(Date.now() / 1e3) : null
|
1481
1481
|
);
|
1482
1482
|
return this.token;
|
1483
1483
|
}
|
package/dist/index.mjs
CHANGED
@@ -1402,14 +1402,14 @@ var OAuthToken = class {
|
|
1402
1402
|
};
|
1403
1403
|
var OAuthTokenManager = class {
|
1404
1404
|
async getToken(scopes, config) {
|
1405
|
-
var _a, _b, _c, _d, _e;
|
1406
|
-
if ((_a = this.token) == null ? void 0 : _a.hasAllScopes(scopes)) {
|
1405
|
+
var _a, _b, _c, _d, _e, _f;
|
1406
|
+
if (((_a = this.token) == null ? void 0 : _a.hasAllScopes(scopes)) && ((_b = this.token) == null ? void 0 : _b.expiresAt) && this.token.expiresAt >= Math.floor(Date.now() / 1e3)) {
|
1407
1407
|
return this.token;
|
1408
1408
|
}
|
1409
1409
|
if (!config.clientId || !config.clientSecret) {
|
1410
1410
|
throw new Error("OAuthError: clientId and clientSecret are required for token management.");
|
1411
1411
|
}
|
1412
|
-
const updatedScopes = /* @__PURE__ */ new Set([...scopes, ...((
|
1412
|
+
const updatedScopes = /* @__PURE__ */ new Set([...scopes, ...((_c = this.token) == null ? void 0 : _c.scopes) || []]);
|
1413
1413
|
const oAuth = new OAuthService(
|
1414
1414
|
{
|
1415
1415
|
...config,
|
@@ -1425,7 +1425,7 @@ var OAuthTokenManager = class {
|
|
1425
1425
|
},
|
1426
1426
|
{}
|
1427
1427
|
);
|
1428
|
-
if (!((
|
1428
|
+
if (!((_d = response.data) == null ? void 0 : _d.accessToken)) {
|
1429
1429
|
throw new Error(
|
1430
1430
|
`OAuthError: token endpoint response did not return access token. Response: ${JSON.stringify(response), void 0, 2}.`
|
1431
1431
|
);
|
@@ -1433,7 +1433,7 @@ var OAuthTokenManager = class {
|
|
1433
1433
|
this.token = new OAuthToken(
|
1434
1434
|
response.data.accessToken,
|
1435
1435
|
updatedScopes,
|
1436
|
-
((
|
1436
|
+
((_e = response.data) == null ? void 0 : _e.expiresIn) ? ((_f = response.data) == null ? void 0 : _f.expiresIn) + Math.floor(Date.now() / 1e3) : null
|
1437
1437
|
);
|
1438
1438
|
return this.token;
|
1439
1439
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "celitech-sdk",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.47",
|
4
4
|
"description": "Welcome to the CELITECH API documentation! Useful links: [Homepage](https://www.celitech.com) | [Support email](mailto:support@celitech.com) | [Blog](https://www.celitech.com/blog/)",
|
5
5
|
"source": "./src/index.ts",
|
6
6
|
"main": "./dist/index.js",
|