@internxt/sdk 1.15.14 → 1.16.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 +180 -262
- package/dist/auth/types.js +2 -22
- package/dist/drive/backups/index.js +34 -32
- package/dist/drive/payments/index.js +96 -149
- package/dist/drive/payments/object-storage.js +34 -36
- package/dist/drive/referrals/index.js +19 -17
- package/dist/drive/share/index.js +168 -235
- package/dist/drive/storage/index.js +213 -302
- package/dist/drive/trash/index.js +40 -84
- package/dist/drive/users/index.js +95 -140
- package/dist/mail/index.d.ts +124 -2
- package/dist/mail/index.js +170 -16
- package/dist/mail/types.d.ts +50 -0
- package/dist/mail/types.js +6 -0
- package/dist/meet/index.js +31 -99
- package/dist/misc/location/index.js +10 -50
- package/dist/network/download.js +38 -107
- package/dist/network/errors/codes.js +8 -24
- package/dist/network/errors/context.js +9 -26
- package/dist/network/errors/download.js +6 -24
- package/dist/network/errors/upload.js +21 -48
- package/dist/network/index.js +120 -277
- package/dist/network/types.js +3 -4
- package/dist/network/upload.js +63 -133
- package/dist/payments/checkout.js +57 -69
- package/dist/send/send.js +17 -27
- package/dist/shared/headers/index.js +56 -42
- package/dist/shared/http/client.js +95 -207
- package/dist/shared/http/retryWithBackoff.js +36 -110
- package/dist/shared/types/errors.js +37 -51
- package/dist/workspaces/index.js +224 -264
- package/package.json +14 -15
- package/dist/mail/api.d.ts +0 -126
- package/dist/mail/api.js +0 -288
- package/dist/mail/crypto.d.ts +0 -66
- package/dist/mail/crypto.js +0 -156
- package/dist/mail/mail.d.ts +0 -162
- package/dist/mail/mail.js +0 -382
package/dist/network/index.js
CHANGED
|
@@ -1,30 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __assign = (this && this.__assign) || function () {
|
|
18
|
-
__assign = Object.assign || function(t) {
|
|
19
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
-
s = arguments[i];
|
|
21
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
-
t[p] = s[p];
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
};
|
|
26
|
-
return __assign.apply(this, arguments);
|
|
27
|
-
};
|
|
28
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
29
3
|
if (k2 === undefined) k2 = k;
|
|
30
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -39,92 +13,50 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
39
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
40
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
41
15
|
};
|
|
42
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
43
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
44
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
45
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
46
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
47
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
48
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
52
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
53
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
54
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
55
|
-
function step(op) {
|
|
56
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
58
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
59
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
60
|
-
switch (op[0]) {
|
|
61
|
-
case 0: case 1: t = op; break;
|
|
62
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
63
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
64
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
65
|
-
default:
|
|
66
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
67
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
68
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
69
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
70
|
-
if (t[2]) _.ops.pop();
|
|
71
|
-
_.trys.pop(); continue;
|
|
72
|
-
}
|
|
73
|
-
op = body.call(thisArg, _);
|
|
74
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
75
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
79
17
|
exports.Network = exports.InvalidMultipartValueError = exports.FileTooSmallForMultipartError = exports.InvalidUploadSizeError = exports.InvalidFileIndexError = void 0;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
18
|
+
const index_1 = require("../shared/headers/index");
|
|
19
|
+
const client_1 = require("../shared/http/client");
|
|
20
|
+
const utils_1 = require("../utils");
|
|
21
|
+
const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
22
|
+
const uuidValidate = (str) => UUID_REGEX.test(str);
|
|
85
23
|
__exportStar(require("./types"), exports);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
Object.setPrototypeOf(_this, InvalidFileIndexError.prototype);
|
|
91
|
-
return _this;
|
|
24
|
+
class InvalidFileIndexError extends Error {
|
|
25
|
+
constructor() {
|
|
26
|
+
super('Invalid file index');
|
|
27
|
+
Object.setPrototypeOf(this, InvalidFileIndexError.prototype);
|
|
92
28
|
}
|
|
93
|
-
|
|
94
|
-
}(Error));
|
|
29
|
+
}
|
|
95
30
|
exports.InvalidFileIndexError = InvalidFileIndexError;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
Object.setPrototypeOf(_this, InvalidUploadSizeError.prototype);
|
|
101
|
-
return _this;
|
|
31
|
+
class InvalidUploadSizeError extends Error {
|
|
32
|
+
constructor() {
|
|
33
|
+
super('Invalid size');
|
|
34
|
+
Object.setPrototypeOf(this, InvalidUploadSizeError.prototype);
|
|
102
35
|
}
|
|
103
|
-
|
|
104
|
-
}(Error));
|
|
36
|
+
}
|
|
105
37
|
exports.InvalidUploadSizeError = InvalidUploadSizeError;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
Object.setPrototypeOf(_this, FileTooSmallForMultipartError.prototype);
|
|
111
|
-
return _this;
|
|
38
|
+
class FileTooSmallForMultipartError extends Error {
|
|
39
|
+
constructor() {
|
|
40
|
+
super('File is too small for multipart upload');
|
|
41
|
+
Object.setPrototypeOf(this, FileTooSmallForMultipartError.prototype);
|
|
112
42
|
}
|
|
113
|
-
|
|
114
|
-
}(Error));
|
|
43
|
+
}
|
|
115
44
|
exports.FileTooSmallForMultipartError = FileTooSmallForMultipartError;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
Object.setPrototypeOf(_this, InvalidMultipartValueError.prototype);
|
|
121
|
-
return _this;
|
|
45
|
+
class InvalidMultipartValueError extends Error {
|
|
46
|
+
constructor() {
|
|
47
|
+
super('Invalid multipart value');
|
|
48
|
+
Object.setPrototypeOf(this, InvalidMultipartValueError.prototype);
|
|
122
49
|
}
|
|
123
|
-
|
|
124
|
-
}(Error));
|
|
50
|
+
}
|
|
125
51
|
exports.InvalidMultipartValueError = InvalidMultipartValueError;
|
|
126
|
-
|
|
127
|
-
|
|
52
|
+
class Network {
|
|
53
|
+
client;
|
|
54
|
+
appDetails;
|
|
55
|
+
auth;
|
|
56
|
+
static client(apiUrl, appDetails, opts) {
|
|
57
|
+
return new Network(apiUrl, appDetails, opts);
|
|
58
|
+
}
|
|
59
|
+
constructor(apiUrl, appDetails, opts) {
|
|
128
60
|
this.client = client_1.HttpClient.create(apiUrl);
|
|
129
61
|
this.appDetails = appDetails;
|
|
130
62
|
this.auth = {
|
|
@@ -132,220 +64,131 @@ var Network = /** @class */ (function () {
|
|
|
132
64
|
password: opts.userId,
|
|
133
65
|
};
|
|
134
66
|
}
|
|
135
|
-
|
|
136
|
-
return
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return __generator(this, function (_a) {
|
|
194
|
-
switch (_a.label) {
|
|
195
|
-
case 0:
|
|
196
|
-
index = payload.index, shards = payload.shards;
|
|
197
|
-
if (!(0, utils_1.isHexString)(index) || index.length !== 64) {
|
|
198
|
-
throw new InvalidFileIndexError();
|
|
199
|
-
}
|
|
200
|
-
for (_i = 0, shards_2 = shards; _i < shards_2.length; _i++) {
|
|
201
|
-
shard = shards_2[_i];
|
|
202
|
-
if (!uuidValidate(shard.uuid)) {
|
|
203
|
-
throw new Error('Invalid UUID');
|
|
204
|
-
}
|
|
205
|
-
if (!shard.UploadId) {
|
|
206
|
-
throw new Error('Missing UploadId');
|
|
207
|
-
}
|
|
208
|
-
if (!shard.parts) {
|
|
209
|
-
throw new Error('Missing parts');
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
return [4 /*yield*/, this.finishUploadRequest(bucketId, payload, signal)];
|
|
213
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
};
|
|
218
|
-
Network.prototype.getDownloadLinks = function (bucketId, fileId, token) {
|
|
219
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
220
|
-
return __generator(this, function (_a) {
|
|
221
|
-
switch (_a.label) {
|
|
222
|
-
case 0: return [4 /*yield*/, Network.getDownloadLinks(bucketId, fileId, {
|
|
223
|
-
client: this.client,
|
|
224
|
-
appDetails: this.appDetails,
|
|
225
|
-
auth: this.auth,
|
|
226
|
-
}, token)];
|
|
227
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
};
|
|
232
|
-
Network.prototype.deleteFile = function (bucketId, fileId) {
|
|
233
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
234
|
-
return __generator(this, function (_a) {
|
|
235
|
-
switch (_a.label) {
|
|
236
|
-
case 0: return [4 /*yield*/, Network.deleteFile(bucketId, fileId, {
|
|
237
|
-
client: this.client,
|
|
238
|
-
appDetails: this.appDetails,
|
|
239
|
-
auth: this.auth,
|
|
240
|
-
})];
|
|
241
|
-
case 1:
|
|
242
|
-
_a.sent();
|
|
243
|
-
return [2 /*return*/];
|
|
244
|
-
}
|
|
245
|
-
});
|
|
67
|
+
get credentials() {
|
|
68
|
+
return this.auth;
|
|
69
|
+
}
|
|
70
|
+
async startUpload(bucketId, fileSize, signal, parts = 1) {
|
|
71
|
+
if (fileSize <= 0) {
|
|
72
|
+
throw new InvalidUploadSizeError();
|
|
73
|
+
}
|
|
74
|
+
const MB100 = 100 * 1024 * 1024;
|
|
75
|
+
if (fileSize < MB100 && parts > 1) {
|
|
76
|
+
throw new FileTooSmallForMultipartError();
|
|
77
|
+
}
|
|
78
|
+
if (!Number.isInteger(parts) || parts < 1) {
|
|
79
|
+
throw new InvalidMultipartValueError();
|
|
80
|
+
}
|
|
81
|
+
return await this.startUploadRequest(bucketId, { uploads: [{ index: 0, size: fileSize }] }, signal, parts);
|
|
82
|
+
}
|
|
83
|
+
async finishUpload(bucketId, payload, signal) {
|
|
84
|
+
const { index, shards } = payload;
|
|
85
|
+
if (!(0, utils_1.isHexString)(index) || index.length !== 64) {
|
|
86
|
+
throw new InvalidFileIndexError();
|
|
87
|
+
}
|
|
88
|
+
for (const shard of shards) {
|
|
89
|
+
if (!uuidValidate(shard.uuid)) {
|
|
90
|
+
throw new Error('Invalid UUID');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return await this.finishUploadRequest(bucketId, payload, signal);
|
|
94
|
+
}
|
|
95
|
+
async finishMultipartUpload(bucketId, payload, signal) {
|
|
96
|
+
const { index, shards } = payload;
|
|
97
|
+
if (!(0, utils_1.isHexString)(index) || index.length !== 64) {
|
|
98
|
+
throw new InvalidFileIndexError();
|
|
99
|
+
}
|
|
100
|
+
for (const shard of shards) {
|
|
101
|
+
if (!uuidValidate(shard.uuid)) {
|
|
102
|
+
throw new Error('Invalid UUID');
|
|
103
|
+
}
|
|
104
|
+
if (!shard.UploadId) {
|
|
105
|
+
throw new Error('Missing UploadId');
|
|
106
|
+
}
|
|
107
|
+
if (!shard.parts) {
|
|
108
|
+
throw new Error('Missing parts');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return await this.finishUploadRequest(bucketId, payload, signal);
|
|
112
|
+
}
|
|
113
|
+
async getDownloadLinks(bucketId, fileId, token) {
|
|
114
|
+
return await Network.getDownloadLinks(bucketId, fileId, {
|
|
115
|
+
client: this.client,
|
|
116
|
+
appDetails: this.appDetails,
|
|
117
|
+
auth: this.auth,
|
|
118
|
+
}, token);
|
|
119
|
+
}
|
|
120
|
+
async deleteFile(bucketId, fileId) {
|
|
121
|
+
await Network.deleteFile(bucketId, fileId, {
|
|
122
|
+
client: this.client,
|
|
123
|
+
appDetails: this.appDetails,
|
|
124
|
+
auth: this.auth,
|
|
246
125
|
});
|
|
247
|
-
}
|
|
126
|
+
}
|
|
248
127
|
/**
|
|
249
128
|
* Creates entries for every upload in the request, returns the urls to upload
|
|
250
129
|
* @param bucketId
|
|
251
130
|
* @param uploads
|
|
252
131
|
*/
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
return __generator(this, function (_a) {
|
|
258
|
-
switch (_a.label) {
|
|
259
|
-
case 0:
|
|
260
|
-
headers = Network.headersWithBasicAuth(this.appDetails, this.auth);
|
|
261
|
-
return [4 /*yield*/, this.client.post("/v2/buckets/".concat(bucketId, "/files/start?multiparts=").concat(parts), payload, headers, signal)];
|
|
262
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
};
|
|
132
|
+
async startUploadRequest(bucketId, payload, signal, parts = 1) {
|
|
133
|
+
const headers = Network.headersWithBasicAuth(this.appDetails, this.auth);
|
|
134
|
+
return await this.client.post(`/v2/buckets/${bucketId}/files/start?multiparts=${parts}`, payload, headers, signal);
|
|
135
|
+
}
|
|
267
136
|
/**
|
|
268
137
|
* Finishes the upload of a file
|
|
269
138
|
* @param bucketId
|
|
270
139
|
* @param index
|
|
271
140
|
* @param shards
|
|
272
141
|
*/
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
switch (_a.label) {
|
|
278
|
-
case 0:
|
|
279
|
-
headers = Network.headersWithBasicAuth(this.appDetails, this.auth);
|
|
280
|
-
return [4 /*yield*/, this.client.post("/v2/buckets/".concat(bucketId, "/files/finish"), payload, headers, signal)];
|
|
281
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
});
|
|
285
|
-
};
|
|
142
|
+
async finishUploadRequest(bucketId, payload, signal) {
|
|
143
|
+
const headers = Network.headersWithBasicAuth(this.appDetails, this.auth);
|
|
144
|
+
return await this.client.post(`/v2/buckets/${bucketId}/files/finish`, payload, headers, signal);
|
|
145
|
+
}
|
|
286
146
|
/**
|
|
287
147
|
* Gets the download links for a file
|
|
288
148
|
* @param bucketId
|
|
289
149
|
* @param file
|
|
290
150
|
*/
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
? Network.headersWithAuthToken(appDetails, token)
|
|
300
|
-
: Network.headersWithBasicAuth(appDetails, auth);
|
|
301
|
-
return [4 /*yield*/, client.get("/buckets/".concat(bucketId, "/files/").concat(fileId, "/info"), __assign(__assign({}, headers), { 'x-api-version': '2' }))];
|
|
302
|
-
case 1: return [2 /*return*/, _c.sent()];
|
|
303
|
-
}
|
|
304
|
-
});
|
|
151
|
+
static async getDownloadLinks(bucketId, fileId, { client, appDetails, auth }, token) {
|
|
152
|
+
// ES ESTE EL QUE FALLA AL INTENTAR DESCARGAR UN FILE
|
|
153
|
+
const headers = token
|
|
154
|
+
? Network.headersWithAuthToken(appDetails, token)
|
|
155
|
+
: Network.headersWithBasicAuth(appDetails, auth);
|
|
156
|
+
return await client.get(`/buckets/${bucketId}/files/${fileId}/info`, {
|
|
157
|
+
...headers,
|
|
158
|
+
'x-api-version': '2',
|
|
305
159
|
});
|
|
306
|
-
}
|
|
160
|
+
}
|
|
307
161
|
/**
|
|
308
162
|
* Deletes a file
|
|
309
163
|
* @param bucketId
|
|
310
164
|
* @param file
|
|
311
165
|
*/
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
return __generator(this, function (_c) {
|
|
317
|
-
switch (_c.label) {
|
|
318
|
-
case 0:
|
|
319
|
-
headers = Network.headersWithBasicAuth(appDetails, auth);
|
|
320
|
-
return [4 /*yield*/, client.delete("/v2/buckets/".concat(bucketId, "/files/").concat(fileId), headers)];
|
|
321
|
-
case 1: return [2 /*return*/, _c.sent()];
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
});
|
|
325
|
-
};
|
|
166
|
+
static async deleteFile(bucketId, fileId, { client, appDetails, auth }) {
|
|
167
|
+
const headers = Network.headersWithBasicAuth(appDetails, auth);
|
|
168
|
+
return await client.delete(`/v2/buckets/${bucketId}/files/${fileId}`, headers);
|
|
169
|
+
}
|
|
326
170
|
/**
|
|
327
171
|
* Gets headers with basic auth
|
|
328
172
|
* @param appDetails
|
|
329
173
|
* @param auth
|
|
330
174
|
*/
|
|
331
|
-
|
|
175
|
+
static headersWithBasicAuth(appDetails, auth) {
|
|
332
176
|
return (0, index_1.headersWithBasicAuth)({
|
|
333
177
|
clientName: appDetails.clientName,
|
|
334
178
|
clientVersion: appDetails.clientVersion,
|
|
335
|
-
auth
|
|
179
|
+
auth,
|
|
336
180
|
desktopToken: appDetails.desktopHeader,
|
|
337
181
|
customHeaders: appDetails.customHeaders,
|
|
338
182
|
});
|
|
339
|
-
}
|
|
340
|
-
|
|
183
|
+
}
|
|
184
|
+
static headersWithAuthToken(appDetails, token) {
|
|
341
185
|
return (0, index_1.headersWithAuthToken)({
|
|
342
186
|
clientName: appDetails.clientName,
|
|
343
187
|
clientVersion: appDetails.clientVersion,
|
|
344
|
-
token
|
|
188
|
+
token,
|
|
345
189
|
desktopToken: appDetails.desktopHeader,
|
|
346
190
|
customHeaders: appDetails.customHeaders,
|
|
347
191
|
});
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
}());
|
|
192
|
+
}
|
|
193
|
+
}
|
|
351
194
|
exports.Network = Network;
|
package/dist/network/types.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.ALGORITHMS = exports.SymmetricCryptoAlgorithm = exports.BinaryDataEncoding = void 0;
|
|
5
4
|
var BinaryDataEncoding;
|
|
@@ -10,9 +9,9 @@ var SymmetricCryptoAlgorithm;
|
|
|
10
9
|
(function (SymmetricCryptoAlgorithm) {
|
|
11
10
|
SymmetricCryptoAlgorithm["AES256CTR"] = "AES256CTR";
|
|
12
11
|
})(SymmetricCryptoAlgorithm || (exports.SymmetricCryptoAlgorithm = SymmetricCryptoAlgorithm = {}));
|
|
13
|
-
exports.ALGORITHMS =
|
|
14
|
-
|
|
12
|
+
exports.ALGORITHMS = {
|
|
13
|
+
[SymmetricCryptoAlgorithm.AES256CTR]: {
|
|
15
14
|
type: SymmetricCryptoAlgorithm.AES256CTR,
|
|
16
15
|
ivSize: 32,
|
|
17
16
|
},
|
|
18
|
-
|
|
17
|
+
};
|