@internxt/sdk 1.10.13 → 1.11.0
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/dist/auth/index.js +15 -2
- package/dist/drive/backups/index.js +16 -17
- package/dist/drive/payments/index.js +8 -5
- package/dist/drive/payments/object-storage.js +6 -1
- package/dist/drive/referrals/index.js +8 -1
- package/dist/drive/share/index.js +28 -19
- package/dist/drive/storage/index.js +15 -2
- package/dist/drive/trash/index.js +8 -1
- package/dist/drive/users/index.js +22 -3
- package/dist/drive/users/inext.test.js +5 -1
- package/dist/meet/index.js +14 -2
- package/dist/meet/index.test.js +2 -2
- package/dist/network/index.d.ts +0 -1
- package/dist/network/index.js +14 -11
- package/dist/payments/checkout.js +13 -7
- package/dist/shared/headers/index.d.ts +45 -6
- package/dist/shared/headers/index.js +27 -18
- package/dist/workspaces/index.js +8 -1
- package/dist/workspaces/index.test.js +1 -1
- package/package.json +9 -9
package/dist/auth/index.js
CHANGED
|
@@ -479,10 +479,23 @@ var Auth = /** @class */ (function () {
|
|
|
479
479
|
}, this.basicHeaders());
|
|
480
480
|
};
|
|
481
481
|
Auth.prototype.basicHeaders = function () {
|
|
482
|
-
return (0, headers_1.basicHeaders)(
|
|
482
|
+
return (0, headers_1.basicHeaders)({
|
|
483
|
+
clientName: this.appDetails.clientName,
|
|
484
|
+
clientVersion: this.appDetails.clientVersion,
|
|
485
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
486
|
+
customHeaders: this.appDetails.customHeaders,
|
|
487
|
+
});
|
|
483
488
|
};
|
|
484
489
|
Auth.prototype.headersWithToken = function (token) {
|
|
485
|
-
|
|
490
|
+
var _a;
|
|
491
|
+
return (0, headers_1.headersWithToken)({
|
|
492
|
+
clientName: this.appDetails.clientName,
|
|
493
|
+
clientVersion: this.appDetails.clientVersion,
|
|
494
|
+
token: token,
|
|
495
|
+
workspaceToken: (_a = this.apiSecurity) === null || _a === void 0 ? void 0 : _a.workspaceToken,
|
|
496
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
497
|
+
customHeaders: this.appDetails.customHeaders,
|
|
498
|
+
});
|
|
486
499
|
};
|
|
487
500
|
return Auth;
|
|
488
501
|
}());
|
|
@@ -17,8 +17,7 @@ var Backups = /** @class */ (function () {
|
|
|
17
17
|
* This method uses the old drive backend, while `getBackupDevices` uses the new drive backend.
|
|
18
18
|
*/
|
|
19
19
|
Backups.prototype.getAllDevices = function () {
|
|
20
|
-
return this.client
|
|
21
|
-
.get('/backup/device', this.headers());
|
|
20
|
+
return this.client.get('/backup/device', this.headers());
|
|
22
21
|
};
|
|
23
22
|
/**
|
|
24
23
|
* Retrieves the list of backup devices associated with the user's account.
|
|
@@ -26,8 +25,7 @@ var Backups = /** @class */ (function () {
|
|
|
26
25
|
* @returns {Promise<Device[]>} A promise that resolves to an array of Devices.
|
|
27
26
|
*/
|
|
28
27
|
Backups.prototype.getBackupDevices = function () {
|
|
29
|
-
return this.client
|
|
30
|
-
.get('/backup/devices', this.headers());
|
|
28
|
+
return this.client.get('/backup/devices', this.headers());
|
|
31
29
|
};
|
|
32
30
|
/**
|
|
33
31
|
* Retrieves a list of all devices represented as folders.
|
|
@@ -39,8 +37,7 @@ var Backups = /** @class */ (function () {
|
|
|
39
37
|
* @returns {Promise<DriveFolderData[]>} A promise that resolves to an array of DriveFolderData.
|
|
40
38
|
*/
|
|
41
39
|
Backups.prototype.getAllDevicesAsFolder = function () {
|
|
42
|
-
return this.client
|
|
43
|
-
.get('/backup/deviceAsFolder', this.headers());
|
|
40
|
+
return this.client.get('/backup/deviceAsFolder', this.headers());
|
|
44
41
|
};
|
|
45
42
|
/**
|
|
46
43
|
* Retrieves all backups associated with a specific device identified by its mac ID.
|
|
@@ -49,8 +46,7 @@ var Backups = /** @class */ (function () {
|
|
|
49
46
|
* @returns A promise that resolves to an array of DeviceBackups.
|
|
50
47
|
*/
|
|
51
48
|
Backups.prototype.getAllBackups = function (mac) {
|
|
52
|
-
return this.client
|
|
53
|
-
.get("/backup/".concat(mac), this.headers());
|
|
49
|
+
return this.client.get("/backup/".concat(mac), this.headers());
|
|
54
50
|
};
|
|
55
51
|
/**
|
|
56
52
|
* Deletes a backup by its ID.
|
|
@@ -59,16 +55,14 @@ var Backups = /** @class */ (function () {
|
|
|
59
55
|
* @returns A promise that resolves when the backup is successfully deleted.
|
|
60
56
|
*/
|
|
61
57
|
Backups.prototype.deleteBackup = function (backupId) {
|
|
62
|
-
return this.client
|
|
63
|
-
.delete("/backup/".concat(backupId), this.headers());
|
|
58
|
+
return this.client.delete("/backup/".concat(backupId), this.headers());
|
|
64
59
|
};
|
|
65
60
|
/**
|
|
66
61
|
* @deprecated Use `deleteBackupDevice` instead.
|
|
67
62
|
* This method uses the old drive backend, while `deleteBackupDevice` uses the new drive backend.
|
|
68
63
|
*/
|
|
69
64
|
Backups.prototype.deleteDevice = function (deviceId) {
|
|
70
|
-
return this.client
|
|
71
|
-
.delete("/backup/device/".concat(deviceId), this.headers());
|
|
65
|
+
return this.client.delete("/backup/device/".concat(deviceId), this.headers());
|
|
72
66
|
};
|
|
73
67
|
/**
|
|
74
68
|
* Deletes a backup device by its ID.
|
|
@@ -77,8 +71,7 @@ var Backups = /** @class */ (function () {
|
|
|
77
71
|
* @returns A promise that resolves when the device is successfully deleted.
|
|
78
72
|
*/
|
|
79
73
|
Backups.prototype.deleteBackupDevice = function (deviceId) {
|
|
80
|
-
return this.client
|
|
81
|
-
.delete("/backup/devices/".concat(deviceId), this.headers());
|
|
74
|
+
return this.client.delete("/backup/devices/".concat(deviceId), this.headers());
|
|
82
75
|
};
|
|
83
76
|
/**
|
|
84
77
|
* Deletes a backup device by its folder ID.
|
|
@@ -87,15 +80,21 @@ var Backups = /** @class */ (function () {
|
|
|
87
80
|
* @returns A promise that resolves when the device is successfully deleted.
|
|
88
81
|
*/
|
|
89
82
|
Backups.prototype.deleteBackupDeviceAsFolder = function (folderId) {
|
|
90
|
-
return this.client
|
|
91
|
-
.delete("/backup/deviceAsFolder/".concat(folderId), this.headers());
|
|
83
|
+
return this.client.delete("/backup/deviceAsFolder/".concat(folderId), this.headers());
|
|
92
84
|
};
|
|
93
85
|
/**
|
|
94
86
|
* Returns the needed headers for the module requests
|
|
95
87
|
* @private
|
|
96
88
|
*/
|
|
97
89
|
Backups.prototype.headers = function () {
|
|
98
|
-
return (0, headers_1.headersWithToken)(
|
|
90
|
+
return (0, headers_1.headersWithToken)({
|
|
91
|
+
clientName: this.appDetails.clientName,
|
|
92
|
+
clientVersion: this.appDetails.clientVersion,
|
|
93
|
+
token: this.apiSecurity.token,
|
|
94
|
+
workspaceToken: this.apiSecurity.workspaceToken,
|
|
95
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
96
|
+
customHeaders: this.appDetails.customHeaders,
|
|
97
|
+
});
|
|
99
98
|
};
|
|
100
99
|
return Backups;
|
|
101
100
|
}());
|
|
@@ -234,11 +234,14 @@ var Payments = /** @class */ (function () {
|
|
|
234
234
|
* @private
|
|
235
235
|
*/
|
|
236
236
|
Payments.prototype.headers = function () {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
237
|
+
return (0, headers_1.headersWithToken)({
|
|
238
|
+
clientName: this.appDetails.clientName,
|
|
239
|
+
clientVersion: this.appDetails.clientVersion,
|
|
240
|
+
token: this.apiSecurity.token,
|
|
241
|
+
workspaceToken: this.apiSecurity.workspaceToken,
|
|
242
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
243
|
+
customHeaders: this.appDetails.customHeaders,
|
|
244
|
+
});
|
|
242
245
|
};
|
|
243
246
|
return Payments;
|
|
244
247
|
}());
|
|
@@ -52,7 +52,12 @@ var ObjectStorage = /** @class */ (function () {
|
|
|
52
52
|
}, this.headers());
|
|
53
53
|
};
|
|
54
54
|
ObjectStorage.prototype.headers = function () {
|
|
55
|
-
return (0, headers_1.basicHeaders)(
|
|
55
|
+
return (0, headers_1.basicHeaders)({
|
|
56
|
+
clientName: this.appDetails.clientName,
|
|
57
|
+
clientVersion: this.appDetails.clientVersion,
|
|
58
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
59
|
+
customHeaders: this.appDetails.customHeaders,
|
|
60
|
+
});
|
|
56
61
|
};
|
|
57
62
|
return ObjectStorage;
|
|
58
63
|
}());
|
|
@@ -57,7 +57,14 @@ var Referrals = /** @class */ (function () {
|
|
|
57
57
|
* @private
|
|
58
58
|
*/
|
|
59
59
|
Referrals.prototype.headers = function () {
|
|
60
|
-
return (0, headers_1.headersWithToken)(
|
|
60
|
+
return (0, headers_1.headersWithToken)({
|
|
61
|
+
clientName: this.appDetails.clientName,
|
|
62
|
+
clientVersion: this.appDetails.clientVersion,
|
|
63
|
+
token: this.apiSecurity.token,
|
|
64
|
+
workspaceToken: this.apiSecurity.workspaceToken,
|
|
65
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
66
|
+
customHeaders: this.appDetails.customHeaders,
|
|
67
|
+
});
|
|
61
68
|
};
|
|
62
69
|
return Referrals;
|
|
63
70
|
}());
|
|
@@ -79,15 +79,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
79
79
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
83
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
84
|
-
if (ar || !(i in from)) {
|
|
85
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
86
|
-
ar[i] = from[i];
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
90
|
-
};
|
|
91
82
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
92
83
|
exports.Share = exports.ShareTypes = void 0;
|
|
93
84
|
var headers_1 = require("../../shared/headers");
|
|
@@ -513,30 +504,48 @@ var Share = /** @class */ (function () {
|
|
|
513
504
|
* @private
|
|
514
505
|
*/
|
|
515
506
|
Share.prototype.headers = function (password) {
|
|
516
|
-
var args = [
|
|
517
|
-
this.appDetails.clientName,
|
|
518
|
-
this.appDetails.clientVersion,
|
|
519
|
-
this.apiSecurity.token,
|
|
520
|
-
this.apiSecurity.workspaceToken,
|
|
521
|
-
];
|
|
522
507
|
if (password) {
|
|
523
|
-
return
|
|
508
|
+
return (0, headers_1.headersWithTokenAndPassword)({
|
|
509
|
+
clientName: this.appDetails.clientName,
|
|
510
|
+
clientVersion: this.appDetails.clientVersion,
|
|
511
|
+
token: this.apiSecurity.token,
|
|
512
|
+
workspaceToken: this.apiSecurity.workspaceToken,
|
|
513
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
514
|
+
password: password,
|
|
515
|
+
});
|
|
524
516
|
}
|
|
525
|
-
return
|
|
517
|
+
return (0, headers_1.headersWithToken)({
|
|
518
|
+
clientName: this.appDetails.clientName,
|
|
519
|
+
clientVersion: this.appDetails.clientVersion,
|
|
520
|
+
token: this.apiSecurity.token,
|
|
521
|
+
workspaceToken: this.apiSecurity.workspaceToken,
|
|
522
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
523
|
+
customHeaders: this.appDetails.customHeaders,
|
|
524
|
+
});
|
|
526
525
|
};
|
|
527
526
|
/**
|
|
528
527
|
* Returns the needed headers for the module requests
|
|
529
528
|
* @private
|
|
530
529
|
*/
|
|
531
530
|
Share.prototype.basicHeaders = function () {
|
|
532
|
-
return (0, headers_1.basicHeaders)(
|
|
531
|
+
return (0, headers_1.basicHeaders)({
|
|
532
|
+
clientName: this.appDetails.clientName,
|
|
533
|
+
clientVersion: this.appDetails.clientVersion,
|
|
534
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
535
|
+
customHeaders: this.appDetails.customHeaders,
|
|
536
|
+
});
|
|
533
537
|
};
|
|
534
538
|
/**
|
|
535
539
|
* Used to send the password in shares
|
|
536
540
|
* @private
|
|
537
541
|
*/
|
|
538
542
|
Share.prototype.basicHeadersWithPassword = function (password) {
|
|
539
|
-
return (0, headers_1.basicHeadersWithPassword)(
|
|
543
|
+
return (0, headers_1.basicHeadersWithPassword)({
|
|
544
|
+
clientName: this.appDetails.clientName,
|
|
545
|
+
clientVersion: this.appDetails.clientVersion,
|
|
546
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
547
|
+
password: password,
|
|
548
|
+
});
|
|
540
549
|
};
|
|
541
550
|
/**
|
|
542
551
|
* Get request headers with optional authorization token.
|
|
@@ -575,8 +575,21 @@ var Storage = /** @class */ (function () {
|
|
|
575
575
|
* @private
|
|
576
576
|
*/
|
|
577
577
|
Storage.prototype.headers = function (customHeaders) {
|
|
578
|
-
var
|
|
579
|
-
|
|
578
|
+
var customExtraHeaders = {};
|
|
579
|
+
if (customHeaders) {
|
|
580
|
+
customExtraHeaders = customHeaders;
|
|
581
|
+
}
|
|
582
|
+
if (this.appDetails.customHeaders) {
|
|
583
|
+
customExtraHeaders = __assign(__assign({}, customExtraHeaders), this.appDetails.customHeaders);
|
|
584
|
+
}
|
|
585
|
+
return (0, headers_1.headersWithToken)({
|
|
586
|
+
clientName: this.appDetails.clientName,
|
|
587
|
+
clientVersion: this.appDetails.clientVersion,
|
|
588
|
+
token: this.apiSecurity.token,
|
|
589
|
+
workspaceToken: this.apiSecurity.workspaceToken,
|
|
590
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
591
|
+
customHeaders: customExtraHeaders,
|
|
592
|
+
});
|
|
580
593
|
};
|
|
581
594
|
/**
|
|
582
595
|
* Gets the ancestors of a given folder UUID
|
|
@@ -187,7 +187,14 @@ var Trash = /** @class */ (function () {
|
|
|
187
187
|
* @private
|
|
188
188
|
*/
|
|
189
189
|
Trash.prototype.headers = function () {
|
|
190
|
-
return (0, headers_1.headersWithToken)(
|
|
190
|
+
return (0, headers_1.headersWithToken)({
|
|
191
|
+
clientName: this.appDetails.clientName,
|
|
192
|
+
clientVersion: this.appDetails.clientVersion,
|
|
193
|
+
token: this.apiSecurity.token,
|
|
194
|
+
workspaceToken: this.apiSecurity.workspaceToken,
|
|
195
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
196
|
+
customHeaders: this.appDetails.customHeaders,
|
|
197
|
+
});
|
|
191
198
|
};
|
|
192
199
|
return Trash;
|
|
193
200
|
}());
|
|
@@ -303,13 +303,32 @@ var Users = /** @class */ (function () {
|
|
|
303
303
|
return this.client.get('/users/generate-mnemonic', this.basicHeaders());
|
|
304
304
|
};
|
|
305
305
|
Users.prototype.basicHeaders = function () {
|
|
306
|
-
return (0, headers_1.basicHeaders)(
|
|
306
|
+
return (0, headers_1.basicHeaders)({
|
|
307
|
+
clientName: this.appDetails.clientName,
|
|
308
|
+
clientVersion: this.appDetails.clientVersion,
|
|
309
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
310
|
+
customHeaders: this.appDetails.customHeaders,
|
|
311
|
+
});
|
|
307
312
|
};
|
|
308
313
|
Users.prototype.headers = function () {
|
|
309
|
-
return (0, headers_1.headersWithToken)(
|
|
314
|
+
return (0, headers_1.headersWithToken)({
|
|
315
|
+
clientName: this.appDetails.clientName,
|
|
316
|
+
clientVersion: this.appDetails.clientVersion,
|
|
317
|
+
token: this.apiSecurity.token,
|
|
318
|
+
workspaceToken: this.apiSecurity.workspaceToken,
|
|
319
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
320
|
+
customHeaders: this.appDetails.customHeaders,
|
|
321
|
+
});
|
|
310
322
|
};
|
|
311
323
|
Users.prototype.headersWithToken = function (token) {
|
|
312
|
-
return (0, headers_1.headersWithToken)(
|
|
324
|
+
return (0, headers_1.headersWithToken)({
|
|
325
|
+
clientName: this.appDetails.clientName,
|
|
326
|
+
clientVersion: this.appDetails.clientVersion,
|
|
327
|
+
token: token,
|
|
328
|
+
workspaceToken: this.apiSecurity.workspaceToken,
|
|
329
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
330
|
+
customHeaders: this.appDetails.customHeaders,
|
|
331
|
+
});
|
|
313
332
|
};
|
|
314
333
|
return Users;
|
|
315
334
|
}());
|
|
@@ -91,6 +91,10 @@ function clientAndHeaders(apiUrl, clientName, clientVersion, token) {
|
|
|
91
91
|
unauthorizedCallback: function () { },
|
|
92
92
|
};
|
|
93
93
|
var client = _1.Users.client(apiUrl, appDetails, apiSecurity);
|
|
94
|
-
var headers = (0, headers_1.headersWithToken)(
|
|
94
|
+
var headers = (0, headers_1.headersWithToken)({
|
|
95
|
+
clientName: clientName,
|
|
96
|
+
clientVersion: clientVersion,
|
|
97
|
+
token: token,
|
|
98
|
+
});
|
|
95
99
|
return { client: client, headers: headers };
|
|
96
100
|
}
|
package/dist/meet/index.js
CHANGED
|
@@ -101,10 +101,22 @@ var Meet = /** @class */ (function () {
|
|
|
101
101
|
if (!((_a = this.apiSecurity) === null || _a === void 0 ? void 0 : _a.token)) {
|
|
102
102
|
throw new Error('Token is required for Meet operations');
|
|
103
103
|
}
|
|
104
|
-
return (0, headers_1.headersWithToken)(
|
|
104
|
+
return (0, headers_1.headersWithToken)({
|
|
105
|
+
clientName: this.appDetails.clientName,
|
|
106
|
+
clientVersion: this.appDetails.clientVersion,
|
|
107
|
+
token: this.apiSecurity.token,
|
|
108
|
+
workspaceToken: this.apiSecurity.workspaceToken,
|
|
109
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
110
|
+
customHeaders: this.appDetails.customHeaders,
|
|
111
|
+
});
|
|
105
112
|
};
|
|
106
113
|
Meet.prototype.basicHeaders = function () {
|
|
107
|
-
return (0, headers_1.basicHeaders)(
|
|
114
|
+
return (0, headers_1.basicHeaders)({
|
|
115
|
+
clientName: this.appDetails.clientName,
|
|
116
|
+
clientVersion: this.appDetails.clientVersion,
|
|
117
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
118
|
+
customHeaders: this.appDetails.customHeaders,
|
|
119
|
+
});
|
|
108
120
|
};
|
|
109
121
|
return Meet;
|
|
110
122
|
}());
|
package/dist/meet/index.test.js
CHANGED
|
@@ -248,7 +248,7 @@ function clientAndHeadersWithToken(apiUrl, clientName, clientVersion, token) {
|
|
|
248
248
|
token: token,
|
|
249
249
|
};
|
|
250
250
|
var client = index_1.Meet.client(apiUrl, appDetails, apiSecurity);
|
|
251
|
-
var headers = (0, headers_1.headersWithToken)(clientName, clientVersion, token);
|
|
251
|
+
var headers = (0, headers_1.headersWithToken)({ clientName: clientName, clientVersion: clientVersion, token: token });
|
|
252
252
|
return { client: client, headers: headers };
|
|
253
253
|
}
|
|
254
254
|
function clientAndHeadersWithoutToken(apiUrl, clientName, clientVersion) {
|
|
@@ -260,6 +260,6 @@ function clientAndHeadersWithoutToken(apiUrl, clientName, clientVersion) {
|
|
|
260
260
|
clientVersion: clientVersion,
|
|
261
261
|
};
|
|
262
262
|
var client = index_1.Meet.client(apiUrl, appDetails);
|
|
263
|
-
var headers = (0, headers_1.basicHeaders)(clientName, clientVersion);
|
|
263
|
+
var headers = (0, headers_1.basicHeaders)({ clientName: clientName, clientVersion: clientVersion });
|
|
264
264
|
return { client: client, headers: headers };
|
|
265
265
|
}
|
package/dist/network/index.d.ts
CHANGED
package/dist/network/index.js
CHANGED
|
@@ -305,19 +305,22 @@ var Network = /** @class */ (function () {
|
|
|
305
305
|
* @param auth
|
|
306
306
|
*/
|
|
307
307
|
Network.headersWithBasicAuth = function (appDetails, auth) {
|
|
308
|
-
|
|
309
|
-
|
|
308
|
+
return (0, index_1.headersWithBasicAuth)({
|
|
309
|
+
clientName: appDetails.clientName,
|
|
310
|
+
clientVersion: appDetails.clientVersion,
|
|
311
|
+
auth: auth,
|
|
312
|
+
desktopToken: appDetails.desktopHeader,
|
|
313
|
+
customHeaders: appDetails.customHeaders,
|
|
314
|
+
});
|
|
310
315
|
};
|
|
311
316
|
Network.headersWithAuthToken = function (appDetails, token) {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
return additionalHeaders;
|
|
317
|
+
return (0, index_1.headersWithAuthToken)({
|
|
318
|
+
clientName: appDetails.clientName,
|
|
319
|
+
clientVersion: appDetails.clientVersion,
|
|
320
|
+
token: token,
|
|
321
|
+
desktopToken: appDetails.desktopHeader,
|
|
322
|
+
customHeaders: appDetails.customHeaders,
|
|
323
|
+
});
|
|
321
324
|
};
|
|
322
325
|
return Network;
|
|
323
326
|
}());
|
|
@@ -137,11 +137,13 @@ var Checkout = /** @class */ (function () {
|
|
|
137
137
|
* @private
|
|
138
138
|
*/
|
|
139
139
|
Checkout.prototype.authHeaders = function () {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
return (0, headers_1.headersWithToken)({
|
|
141
|
+
clientName: this.appDetails.clientName,
|
|
142
|
+
clientVersion: this.appDetails.clientVersion,
|
|
143
|
+
token: this.apiSecurity.token,
|
|
144
|
+
workspaceToken: this.apiSecurity.workspaceToken,
|
|
145
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
146
|
+
});
|
|
145
147
|
};
|
|
146
148
|
/**
|
|
147
149
|
* Returns the basic needed headers for the module requests
|
|
@@ -149,8 +151,12 @@ var Checkout = /** @class */ (function () {
|
|
|
149
151
|
*/
|
|
150
152
|
Checkout.prototype.headers = function () {
|
|
151
153
|
var _a;
|
|
152
|
-
var
|
|
153
|
-
return (0, headers_1.basicHeaders)(
|
|
154
|
+
var customHeaders = __assign({}, ((_a = this.appDetails.customHeaders) !== null && _a !== void 0 ? _a : {}));
|
|
155
|
+
return (0, headers_1.basicHeaders)({
|
|
156
|
+
clientName: this.appDetails.clientName,
|
|
157
|
+
clientVersion: this.appDetails.clientVersion,
|
|
158
|
+
customHeaders: customHeaders,
|
|
159
|
+
});
|
|
154
160
|
};
|
|
155
161
|
return Checkout;
|
|
156
162
|
}());
|
|
@@ -10,12 +10,51 @@ type InternxtHeaders = {
|
|
|
10
10
|
Authorization?: string;
|
|
11
11
|
'x-token'?: string;
|
|
12
12
|
'internxt-resources-token'?: string;
|
|
13
|
+
'x-internxt-desktop-header'?: string;
|
|
13
14
|
};
|
|
14
|
-
export declare function basicHeaders(clientName
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
export declare function basicHeaders({ clientName, clientVersion, customHeaders, desktopToken, }: {
|
|
16
|
+
clientName: string;
|
|
17
|
+
clientVersion: string;
|
|
18
|
+
customHeaders?: Record<string, string>;
|
|
19
|
+
desktopToken?: Token;
|
|
20
|
+
}): InternxtHeaders;
|
|
21
|
+
export declare function basicHeadersWithPassword({ clientName, clientVersion, password, desktopToken, }: {
|
|
22
|
+
clientName: string;
|
|
23
|
+
clientVersion: string;
|
|
24
|
+
password: string;
|
|
25
|
+
desktopToken?: Token;
|
|
26
|
+
}): InternxtHeaders;
|
|
27
|
+
export declare function headersWithToken({ clientName, clientVersion, token, workspaceToken, desktopToken, customHeaders, }: {
|
|
28
|
+
clientName: string;
|
|
29
|
+
clientVersion: string;
|
|
30
|
+
token: Token;
|
|
31
|
+
workspaceToken?: Token;
|
|
32
|
+
desktopToken?: Token;
|
|
33
|
+
customHeaders?: CustomHeaders;
|
|
34
|
+
}): InternxtHeaders;
|
|
35
|
+
export declare function headersWithTokenAndPassword({ clientName, clientVersion, token, workspaceToken, desktopToken, password, }: {
|
|
36
|
+
clientName: string;
|
|
37
|
+
clientVersion: string;
|
|
38
|
+
token: Token;
|
|
39
|
+
workspaceToken: Token | undefined;
|
|
40
|
+
desktopToken: Token | undefined;
|
|
41
|
+
password: string;
|
|
42
|
+
}): InternxtHeaders;
|
|
43
|
+
export declare function headersWithBasicAuth({ clientName, clientVersion, auth, workspaceToken, desktopToken, customHeaders, }: {
|
|
44
|
+
clientName: string;
|
|
45
|
+
clientVersion: string;
|
|
46
|
+
auth: BasicAuth;
|
|
47
|
+
workspaceToken?: Token;
|
|
48
|
+
desktopToken?: Token;
|
|
49
|
+
customHeaders?: CustomHeaders;
|
|
50
|
+
}): InternxtHeaders;
|
|
51
|
+
export declare function headersWithAuthToken({ clientName, clientVersion, token, workspaceToken, desktopToken, customHeaders, }: {
|
|
52
|
+
clientName: string;
|
|
53
|
+
clientVersion: string;
|
|
54
|
+
token: Token;
|
|
55
|
+
workspaceToken?: Token;
|
|
56
|
+
desktopToken?: Token;
|
|
57
|
+
customHeaders?: CustomHeaders;
|
|
58
|
+
}): InternxtHeaders;
|
|
20
59
|
export declare function addResourcesTokenToHeaders(headers: InternxtHeaders, resourcesToken?: Token): InternxtHeaders;
|
|
21
60
|
export {};
|
|
@@ -18,36 +18,44 @@ exports.headersWithTokenAndPassword = headersWithTokenAndPassword;
|
|
|
18
18
|
exports.headersWithBasicAuth = headersWithBasicAuth;
|
|
19
19
|
exports.headersWithAuthToken = headersWithAuthToken;
|
|
20
20
|
exports.addResourcesTokenToHeaders = addResourcesTokenToHeaders;
|
|
21
|
-
function basicHeaders(
|
|
22
|
-
|
|
21
|
+
function basicHeaders(_a) {
|
|
22
|
+
var clientName = _a.clientName, clientVersion = _a.clientVersion, customHeaders = _a.customHeaders, desktopToken = _a.desktopToken;
|
|
23
|
+
var extra = {};
|
|
24
|
+
if (desktopToken) {
|
|
25
|
+
extra['x-internxt-desktop-header'] = desktopToken;
|
|
26
|
+
}
|
|
27
|
+
return __assign(__assign({ 'content-type': 'application/json; charset=utf-8', 'internxt-version': clientVersion, 'internxt-client': clientName }, extra), customHeaders);
|
|
23
28
|
}
|
|
24
|
-
function basicHeadersWithPassword(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
'internxt-
|
|
29
|
-
|
|
30
|
-
};
|
|
29
|
+
function basicHeadersWithPassword(_a) {
|
|
30
|
+
var clientName = _a.clientName, clientVersion = _a.clientVersion, password = _a.password, desktopToken = _a.desktopToken;
|
|
31
|
+
var extra = {};
|
|
32
|
+
if (desktopToken) {
|
|
33
|
+
extra['x-internxt-desktop-header'] = desktopToken;
|
|
34
|
+
}
|
|
35
|
+
return __assign({ 'content-type': 'application/json; charset=utf-8', 'internxt-version': clientVersion, 'internxt-client': clientName, 'x-share-password': password }, extra);
|
|
31
36
|
}
|
|
32
|
-
function headersWithToken(
|
|
33
|
-
var
|
|
37
|
+
function headersWithToken(_a) {
|
|
38
|
+
var clientName = _a.clientName, clientVersion = _a.clientVersion, token = _a.token, workspaceToken = _a.workspaceToken, desktopToken = _a.desktopToken, customHeaders = _a.customHeaders;
|
|
39
|
+
var headers = basicHeaders({ clientName: clientName, clientVersion: clientVersion, desktopToken: desktopToken });
|
|
34
40
|
var extra = {
|
|
35
41
|
Authorization: 'Bearer ' + token,
|
|
36
42
|
};
|
|
37
|
-
if (workspaceToken
|
|
43
|
+
if (workspaceToken) {
|
|
38
44
|
extra['x-internxt-workspace'] = workspaceToken;
|
|
39
45
|
}
|
|
40
46
|
return __assign(__assign(__assign({}, headers), extra), customHeaders);
|
|
41
47
|
}
|
|
42
|
-
function headersWithTokenAndPassword(
|
|
43
|
-
var
|
|
48
|
+
function headersWithTokenAndPassword(_a) {
|
|
49
|
+
var clientName = _a.clientName, clientVersion = _a.clientVersion, token = _a.token, workspaceToken = _a.workspaceToken, desktopToken = _a.desktopToken, password = _a.password;
|
|
50
|
+
var headers = headersWithToken({ clientName: clientName, clientVersion: clientVersion, token: token, workspaceToken: workspaceToken, desktopToken: desktopToken });
|
|
44
51
|
var extra = {
|
|
45
52
|
'x-share-password': password,
|
|
46
53
|
};
|
|
47
54
|
return __assign(__assign({}, headers), extra);
|
|
48
55
|
}
|
|
49
|
-
function headersWithBasicAuth(
|
|
50
|
-
var
|
|
56
|
+
function headersWithBasicAuth(_a) {
|
|
57
|
+
var clientName = _a.clientName, clientVersion = _a.clientVersion, auth = _a.auth, workspaceToken = _a.workspaceToken, desktopToken = _a.desktopToken, customHeaders = _a.customHeaders;
|
|
58
|
+
var headers = basicHeaders({ clientName: clientName, clientVersion: clientVersion, desktopToken: desktopToken });
|
|
51
59
|
var token = "".concat(auth.username, ":").concat(auth.password);
|
|
52
60
|
var encodedToken = Buffer.from(token).toString('base64');
|
|
53
61
|
var extra = {
|
|
@@ -58,8 +66,9 @@ function headersWithBasicAuth(clientName, clientVersion, auth, workspaceToken, c
|
|
|
58
66
|
}
|
|
59
67
|
return __assign(__assign(__assign({}, headers), extra), customHeaders);
|
|
60
68
|
}
|
|
61
|
-
function headersWithAuthToken(
|
|
62
|
-
var
|
|
69
|
+
function headersWithAuthToken(_a) {
|
|
70
|
+
var clientName = _a.clientName, clientVersion = _a.clientVersion, token = _a.token, workspaceToken = _a.workspaceToken, desktopToken = _a.desktopToken, customHeaders = _a.customHeaders;
|
|
71
|
+
var headers = basicHeaders({ clientName: clientName, clientVersion: clientVersion, desktopToken: desktopToken });
|
|
63
72
|
var extra = {};
|
|
64
73
|
if (workspaceToken !== undefined) {
|
|
65
74
|
extra['x-internxt-workspace'] = workspaceToken;
|
package/dist/workspaces/index.js
CHANGED
|
@@ -53,7 +53,14 @@ var Workspaces = /** @class */ (function () {
|
|
|
53
53
|
* @private
|
|
54
54
|
*/
|
|
55
55
|
Workspaces.prototype.headers = function () {
|
|
56
|
-
return (0, headers_1.headersWithToken)(
|
|
56
|
+
return (0, headers_1.headersWithToken)({
|
|
57
|
+
clientName: this.appDetails.clientName,
|
|
58
|
+
clientVersion: this.appDetails.clientVersion,
|
|
59
|
+
token: this.apiSecurity.token,
|
|
60
|
+
workspaceToken: this.apiSecurity.workspaceToken,
|
|
61
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
62
|
+
customHeaders: this.appDetails.customHeaders,
|
|
63
|
+
});
|
|
57
64
|
};
|
|
58
65
|
Workspaces.prototype.getRequestHeaders = function (token) {
|
|
59
66
|
var headers = __assign({}, this.headers());
|
|
@@ -898,6 +898,6 @@ function clientAndHeaders(apiUrl, clientName, clientVersion, token, workspaceTok
|
|
|
898
898
|
workspaceToken: workspaceToken,
|
|
899
899
|
};
|
|
900
900
|
var client = index_1.Workspaces.client(apiUrl, appDetails, apiSecurity);
|
|
901
|
-
var headers = (0, headers_1.headersWithToken)(clientName, clientVersion, token, workspaceToken);
|
|
901
|
+
var headers = (0, headers_1.headersWithToken)({ clientName: clientName, clientVersion: clientVersion, token: token, workspaceToken: workspaceToken });
|
|
902
902
|
return { client: client, headers: headers };
|
|
903
903
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@internxt/sdk",
|
|
3
3
|
"author": "Internxt <hello@internxt.com>",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.11.0",
|
|
5
5
|
"description": "An sdk for interacting with Internxt's services",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -26,22 +26,22 @@
|
|
|
26
26
|
"format": "prettier src/**/*.ts"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@internxt/eslint-config-internxt": "2.0.
|
|
29
|
+
"@internxt/eslint-config-internxt": "2.0.1",
|
|
30
30
|
"@internxt/prettier-config": "1.0.2",
|
|
31
31
|
"@types/jest": "30.0.0",
|
|
32
32
|
"@types/sinon": "17.0.4",
|
|
33
33
|
"@types/uuid": "10.0.0",
|
|
34
|
-
"eslint": "9.
|
|
34
|
+
"eslint": "9.34.0",
|
|
35
35
|
"husky": "9.1.7",
|
|
36
|
-
"jest": "30.0.
|
|
37
|
-
"lint-staged": "16.1.
|
|
38
|
-
"prettier": "3.6.
|
|
36
|
+
"jest": "30.0.5",
|
|
37
|
+
"lint-staged": "16.1.5",
|
|
38
|
+
"prettier": "3.6.2",
|
|
39
39
|
"sinon": "21.0.0",
|
|
40
|
-
"ts-jest": "29.4.
|
|
41
|
-
"typescript": "5.
|
|
40
|
+
"ts-jest": "29.4.1",
|
|
41
|
+
"typescript": "5.9.2"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"axios": "1.
|
|
44
|
+
"axios": "1.11.0",
|
|
45
45
|
"uuid": "11.1.0"
|
|
46
46
|
},
|
|
47
47
|
"lint-staged": {
|