@singularlogic/coreplatts 0.0.22 → 0.0.24
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/index.d.ts +1 -1
- package/dist/index.js +204 -254
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -251,4 +251,4 @@ declare class Client implements IClient$1 {
|
|
|
251
251
|
|
|
252
252
|
type IClient = IClient$1;
|
|
253
253
|
|
|
254
|
-
export { type Bucket, Client, type DisplayGroup, type ErrorReport, type FileModel, type FolderList, type FolderModel, type Group, type IClient, type Meta, type MultipartWrapper, type OidcToken, type PartInfo, Role, type StatsPart, type TotalInfo, type Updated, type User, type UserRoles, type UsersPart, mergeGroupsByIdName };
|
|
254
|
+
export { type Bucket, Client, type DisplayGroup, type ErrorReport, File$1 as File, type FileModel, Folder, type FolderList, type FolderModel, type Group, type IClient, type Meta, type MultipartWrapper, type OidcToken, type PartInfo, Role, type StatsPart, type TotalInfo, type Updated, type User, type UserRoles, type UsersPart, mergeGroupsByIdName };
|
package/dist/index.js
CHANGED
|
@@ -68,6 +68,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
68
68
|
var index_exports = {};
|
|
69
69
|
__export(index_exports, {
|
|
70
70
|
Client: () => Client,
|
|
71
|
+
File: () => File,
|
|
72
|
+
Folder: () => Folder,
|
|
71
73
|
Role: () => Role,
|
|
72
74
|
mergeGroupsByIdName: () => mergeGroupsByIdName
|
|
73
75
|
});
|
|
@@ -100,9 +102,6 @@ var Role = /* @__PURE__ */ ((Role2) => {
|
|
|
100
102
|
return Role2;
|
|
101
103
|
})(Role || {});
|
|
102
104
|
|
|
103
|
-
// src/client.ts
|
|
104
|
-
var import_axios = __toESM(require("axios"));
|
|
105
|
-
|
|
106
105
|
// src/apis/base.consumer.ts
|
|
107
106
|
var BaseConsumer = class {
|
|
108
107
|
constructor(_httpClient, _requestPath) {
|
|
@@ -188,194 +187,103 @@ var BaseConsumer = class {
|
|
|
188
187
|
}
|
|
189
188
|
};
|
|
190
189
|
|
|
191
|
-
// src/apis/
|
|
192
|
-
var _namespace = "
|
|
193
|
-
var
|
|
194
|
-
// private _accountBase:string;
|
|
190
|
+
// src/apis/management/file.consumer.ts
|
|
191
|
+
var _namespace = "file";
|
|
192
|
+
var FileConsumer = class extends BaseConsumer {
|
|
195
193
|
constructor(_httpClient) {
|
|
196
194
|
super(_httpClient, _namespace);
|
|
197
|
-
this._client = _httpClient;
|
|
198
195
|
}
|
|
199
|
-
|
|
200
|
-
|
|
196
|
+
getFileByID(id, token) {
|
|
197
|
+
return this.getOne(`/info/${id}`, null, token).then(
|
|
198
|
+
(resp) => {
|
|
199
|
+
return new File(resp, this._httpClient);
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
initUpload(file, fileSize, chunckSize, token) {
|
|
204
|
+
const config = {
|
|
201
205
|
headers: {
|
|
202
|
-
"Content-Type": "application/
|
|
206
|
+
"Content-Type": "application/json",
|
|
207
|
+
"Authorization": `Bearer ${token}`,
|
|
208
|
+
"Chunk-Size": String(chunckSize),
|
|
209
|
+
"File-Size": String(fileSize)
|
|
203
210
|
}
|
|
204
211
|
};
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
};
|
|
209
|
-
return this._client.post(this.path, data, config).then((resp) => {
|
|
210
|
-
return resp.data;
|
|
212
|
+
return this._httpClient.post(this.path + "/upload/initialize", file, config).then((resp) => resp.data).catch((error) => {
|
|
213
|
+
console.error(`\u274C Error in posting:`, error);
|
|
214
|
+
return null;
|
|
211
215
|
});
|
|
212
216
|
}
|
|
213
|
-
|
|
214
|
-
return this.
|
|
217
|
+
closeUplaod(wrapper, token) {
|
|
218
|
+
return this.post("/upload/complete", wrapper, void 0, token);
|
|
215
219
|
}
|
|
216
|
-
|
|
217
|
-
|
|
220
|
+
initDownload(fileId, token) {
|
|
221
|
+
const config = {
|
|
218
222
|
headers: {
|
|
219
|
-
"
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
"password": password,
|
|
225
|
-
"last_name": lastName,
|
|
226
|
-
"first_name": firstName
|
|
223
|
+
"Authorization": `Bearer ${token}`,
|
|
224
|
+
"Content-Type": "application/json"
|
|
225
|
+
},
|
|
226
|
+
timeout: 0
|
|
227
|
+
// disables timeout
|
|
227
228
|
};
|
|
228
|
-
return this.
|
|
229
|
+
return this._httpClient.get(this.path + `/download/initialize/${fileId}`, config).then((resp) => {
|
|
230
|
+
if (resp.data && resp.data.internal_status) {
|
|
231
|
+
console.error(`\u274C Error in response:`, resp.data.internal_status);
|
|
232
|
+
throw new Error("Download initialization failed: " + resp.data.internal_status);
|
|
233
|
+
}
|
|
229
234
|
return resp.data;
|
|
230
|
-
}).catch((
|
|
231
|
-
console.
|
|
235
|
+
}).catch((error) => {
|
|
236
|
+
console.error(`\u274C Error in request:`, error);
|
|
237
|
+
throw new Error("Download initialization failed: " + error.message);
|
|
232
238
|
});
|
|
233
239
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
var _namespace2 = "group/";
|
|
238
|
-
var GroupConsumer = class extends BaseConsumer {
|
|
239
|
-
constructor(_httpClient) {
|
|
240
|
-
super(_httpClient, _namespace2);
|
|
241
|
-
this._client = _httpClient;
|
|
242
|
-
}
|
|
243
|
-
getAllGroups(token) {
|
|
244
|
-
return this.getMany("all", null, token);
|
|
245
|
-
}
|
|
246
|
-
getGroupUsers(gname, gid, token) {
|
|
247
|
-
let addPath = "";
|
|
248
|
-
addPath = addPath + (gname ? `?name=${gname}` : "") + (gid ? `?id=${gid}` : "");
|
|
249
|
-
return this._httpClient.get(this.path + "describe" + addPath, { headers: { "Authorization": "Bearer " + token } }).then((resp) => resp.data).catch((error) => {
|
|
250
|
-
console.error(`\u274C Error in posting:`, error);
|
|
251
|
-
return null;
|
|
240
|
+
download(concurrent_limit = 5) {
|
|
241
|
+
return __async(this, null, function* () {
|
|
242
|
+
return new Blob();
|
|
252
243
|
});
|
|
253
244
|
}
|
|
254
|
-
|
|
255
|
-
return this
|
|
256
|
-
|
|
257
|
-
getGroupByID(id, token) {
|
|
258
|
-
return this.getOne("id/" + id, null, token);
|
|
259
|
-
}
|
|
260
|
-
getGroupByName(name, token) {
|
|
261
|
-
return this.getOne("name/" + name, null, token);
|
|
262
|
-
}
|
|
263
|
-
postGroup(name, token) {
|
|
264
|
-
const postGroup = {
|
|
265
|
-
name,
|
|
266
|
-
path: "/",
|
|
267
|
-
subGroups: [],
|
|
268
|
-
attributes: {},
|
|
269
|
-
id: void 0
|
|
270
|
-
};
|
|
271
|
-
return this.post("", postGroup, void 0, token);
|
|
272
|
-
}
|
|
273
|
-
addUsers(group_name, input, token) {
|
|
274
|
-
let payload = {
|
|
275
|
-
users: Object.entries(input).map(([email, role]) => ({
|
|
276
|
-
[email]: { admin: role === "admin" /* ADMIN */ }
|
|
277
|
-
}))
|
|
278
|
-
};
|
|
279
|
-
let config = {
|
|
280
|
-
headers: {
|
|
281
|
-
"Content-Type": "application/json",
|
|
282
|
-
"Authorization": "Bearer " + token
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
this._client.post(this.path + "name/" + group_name, payload, config);
|
|
245
|
+
store(_0) {
|
|
246
|
+
return __async(this, arguments, function* (path, concurrent_limit = 5, chunk_size = 5 * 1024 * 1024) {
|
|
247
|
+
});
|
|
286
248
|
}
|
|
287
|
-
|
|
288
|
-
return this
|
|
249
|
+
rename(new_name) {
|
|
250
|
+
return __async(this, null, function* () {
|
|
251
|
+
});
|
|
289
252
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
var _namespace3 = "bucket";
|
|
294
|
-
var BucketConsumer = class extends BaseConsumer {
|
|
295
|
-
constructor(_httpClient) {
|
|
296
|
-
super(_httpClient, _namespace3);
|
|
253
|
+
changeType(new_type) {
|
|
254
|
+
return __async(this, null, function* () {
|
|
255
|
+
});
|
|
297
256
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
_id: id,
|
|
302
|
-
creation_date: void 0
|
|
303
|
-
};
|
|
304
|
-
return this.post("", postBucket, void 0, token);
|
|
257
|
+
updateDescription(new_description) {
|
|
258
|
+
return __async(this, null, function* () {
|
|
259
|
+
});
|
|
305
260
|
}
|
|
306
|
-
|
|
307
|
-
|
|
261
|
+
// async copyTo(destination_name?: string, destination_id?: string, new_name?: string): Promise<IFile | null> {
|
|
262
|
+
// // implement later
|
|
263
|
+
// return null;
|
|
264
|
+
// }
|
|
265
|
+
moveTo(destination_name, destination_id, new_name) {
|
|
266
|
+
return __async(this, null, function* () {
|
|
267
|
+
});
|
|
308
268
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
269
|
+
// async delete(): Promise<boolean> {
|
|
270
|
+
// // implement later
|
|
271
|
+
// return false;
|
|
272
|
+
// }
|
|
273
|
+
checkRequestStatus() {
|
|
274
|
+
return __async(this, null, function* () {
|
|
313
275
|
return null;
|
|
314
276
|
});
|
|
315
277
|
}
|
|
316
278
|
};
|
|
317
279
|
|
|
318
280
|
// src/utils/utils.ts
|
|
319
|
-
function withValidToken(fn,
|
|
281
|
+
function withValidToken(fn, _accountsAPI) {
|
|
320
282
|
return function(...args) {
|
|
321
283
|
return __async(this, null, function* () {
|
|
322
|
-
const
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
console.warn("\u26A0\uFE0F sessionStorage not available");
|
|
326
|
-
return fn.apply(this, args);
|
|
327
|
-
}
|
|
328
|
-
let token = storage.getItem("access_token");
|
|
329
|
-
let refreshToken = storage.getItem("refresh_token");
|
|
330
|
-
let exp = 0;
|
|
331
|
-
let refreshExp = 0;
|
|
332
|
-
const claimsRaw = storage.getItem("id_token_claims_obj");
|
|
333
|
-
if (claimsRaw) {
|
|
334
|
-
try {
|
|
335
|
-
const claims = JSON.parse(claimsRaw);
|
|
336
|
-
if (claims.exp) exp = claims.exp;
|
|
337
|
-
if (claims.iat && claims.exp) {
|
|
338
|
-
const duration = claims.exp - claims.iat;
|
|
339
|
-
refreshExp = claims.iat + 3 * duration;
|
|
340
|
-
}
|
|
341
|
-
} catch (e) {
|
|
342
|
-
console.warn("\u26A0\uFE0F Could not parse id_token_claims_obj:", e);
|
|
343
|
-
}
|
|
344
|
-
} else {
|
|
345
|
-
exp = Number(storage.getItem("refresh_expires_in") || "0");
|
|
346
|
-
refreshExp = Number(storage.getItem("refresh_exp") || "0");
|
|
347
|
-
}
|
|
348
|
-
if (!token || !refreshToken) {
|
|
349
|
-
console.warn("\u26A0\uFE0F No tokens found in sessionStorage.");
|
|
350
|
-
return fn.apply(this, args);
|
|
351
|
-
}
|
|
352
|
-
if (now >= exp) {
|
|
353
|
-
if (now >= refreshExp) {
|
|
354
|
-
console.warn("\u26A0\uFE0F Both access and refresh tokens expired.");
|
|
355
|
-
return fn.apply(this, args);
|
|
356
|
-
}
|
|
357
|
-
try {
|
|
358
|
-
const response = yield fetch(`${accountsAPI}/user/refresh`, {
|
|
359
|
-
method: "POST",
|
|
360
|
-
headers: { "Content-Type": "application/json" },
|
|
361
|
-
body: JSON.stringify({ refresh_token: refreshToken })
|
|
362
|
-
});
|
|
363
|
-
if (!response.ok) throw new Error("Token refresh failed");
|
|
364
|
-
const session = yield response.json();
|
|
365
|
-
token = session.access_token;
|
|
366
|
-
refreshToken = session.refresh_token;
|
|
367
|
-
const newExp = now + session.expires_in;
|
|
368
|
-
const newRefreshExp = now + session.refresh_expires_in;
|
|
369
|
-
storage.setItem("access_token", token);
|
|
370
|
-
storage.setItem("refresh_token", refreshToken);
|
|
371
|
-
storage.setItem("refresh_expires_in", String(newExp));
|
|
372
|
-
storage.setItem("refresh_exp", String(newRefreshExp));
|
|
373
|
-
} catch (err) {
|
|
374
|
-
console.error("\u{1F510} Token refresh failed:", err);
|
|
375
|
-
throw new Error("Could not refresh session.");
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
return yield fn.apply(this, [...args, token]);
|
|
284
|
+
const last = args[args.length - 1];
|
|
285
|
+
const hasToken = typeof last === "string" && last.length > 0;
|
|
286
|
+
return hasToken ? yield fn.apply(this, args) : yield fn.apply(this, args);
|
|
379
287
|
});
|
|
380
288
|
};
|
|
381
289
|
}
|
|
@@ -563,98 +471,8 @@ var File = class {
|
|
|
563
471
|
// }
|
|
564
472
|
};
|
|
565
473
|
|
|
566
|
-
// src/apis/management/file.consumer.ts
|
|
567
|
-
var _namespace4 = "file";
|
|
568
|
-
var FileConsumer = class extends BaseConsumer {
|
|
569
|
-
constructor(_httpClient) {
|
|
570
|
-
super(_httpClient, _namespace4);
|
|
571
|
-
}
|
|
572
|
-
getFileByID(id, token) {
|
|
573
|
-
return this.getOne(`/info/${id}`, null, token).then(
|
|
574
|
-
(resp) => {
|
|
575
|
-
return new File(resp, this._httpClient);
|
|
576
|
-
}
|
|
577
|
-
);
|
|
578
|
-
}
|
|
579
|
-
initUpload(file, fileSize, chunckSize, token) {
|
|
580
|
-
const config = {
|
|
581
|
-
headers: {
|
|
582
|
-
"Content-Type": "application/json",
|
|
583
|
-
"Authorization": `Bearer ${token}`,
|
|
584
|
-
"Chunk-Size": String(chunckSize),
|
|
585
|
-
"File-Size": String(fileSize)
|
|
586
|
-
}
|
|
587
|
-
};
|
|
588
|
-
return this._httpClient.post(this.path + "/upload/initialize", file, config).then((resp) => resp.data).catch((error) => {
|
|
589
|
-
console.error(`\u274C Error in posting:`, error);
|
|
590
|
-
return null;
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
closeUplaod(wrapper, token) {
|
|
594
|
-
return this.post("/upload/complete", wrapper, void 0, token);
|
|
595
|
-
}
|
|
596
|
-
initDownload(fileId, token) {
|
|
597
|
-
const config = {
|
|
598
|
-
headers: {
|
|
599
|
-
"Authorization": `Bearer ${token}`,
|
|
600
|
-
"Content-Type": "application/json"
|
|
601
|
-
},
|
|
602
|
-
timeout: 0
|
|
603
|
-
// disables timeout
|
|
604
|
-
};
|
|
605
|
-
return this._httpClient.get(this.path + `/download/initialize/${fileId}`, config).then((resp) => {
|
|
606
|
-
if (resp.data && resp.data.internal_status) {
|
|
607
|
-
console.error(`\u274C Error in response:`, resp.data.internal_status);
|
|
608
|
-
throw new Error("Download initialization failed: " + resp.data.internal_status);
|
|
609
|
-
}
|
|
610
|
-
return resp.data;
|
|
611
|
-
}).catch((error) => {
|
|
612
|
-
console.error(`\u274C Error in request:`, error);
|
|
613
|
-
throw new Error("Download initialization failed: " + error.message);
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
download(concurrent_limit = 5) {
|
|
617
|
-
return __async(this, null, function* () {
|
|
618
|
-
return new Blob();
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
store(_0) {
|
|
622
|
-
return __async(this, arguments, function* (path, concurrent_limit = 5, chunk_size = 5 * 1024 * 1024) {
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
rename(new_name) {
|
|
626
|
-
return __async(this, null, function* () {
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
changeType(new_type) {
|
|
630
|
-
return __async(this, null, function* () {
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
updateDescription(new_description) {
|
|
634
|
-
return __async(this, null, function* () {
|
|
635
|
-
});
|
|
636
|
-
}
|
|
637
|
-
// async copyTo(destination_name?: string, destination_id?: string, new_name?: string): Promise<IFile | null> {
|
|
638
|
-
// // implement later
|
|
639
|
-
// return null;
|
|
640
|
-
// }
|
|
641
|
-
moveTo(destination_name, destination_id, new_name) {
|
|
642
|
-
return __async(this, null, function* () {
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
// async delete(): Promise<boolean> {
|
|
646
|
-
// // implement later
|
|
647
|
-
// return false;
|
|
648
|
-
// }
|
|
649
|
-
checkRequestStatus() {
|
|
650
|
-
return __async(this, null, function* () {
|
|
651
|
-
return null;
|
|
652
|
-
});
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
|
|
656
474
|
// src/apis/management/folder.factory.ts
|
|
657
|
-
var
|
|
475
|
+
var _namespace2 = "folder";
|
|
658
476
|
var Folder = class {
|
|
659
477
|
constructor(struct, _httpClient) {
|
|
660
478
|
this._httpClient = _httpClient;
|
|
@@ -693,7 +511,7 @@ var Folder = class {
|
|
|
693
511
|
"Authorization": "Bearer " + token
|
|
694
512
|
}
|
|
695
513
|
};
|
|
696
|
-
return this._httpClient.get(this._managementURL + "/" +
|
|
514
|
+
return this._httpClient.get(this._managementURL + "/" + _namespace2 + "/list", config).then((resp) => {
|
|
697
515
|
return resp.data;
|
|
698
516
|
}).catch((error) => {
|
|
699
517
|
console.error(`\u274C Can't retrieve requsted entity:`, error);
|
|
@@ -804,6 +622,136 @@ var Folder = class {
|
|
|
804
622
|
// }
|
|
805
623
|
};
|
|
806
624
|
|
|
625
|
+
// src/client.ts
|
|
626
|
+
var import_axios = __toESM(require("axios"));
|
|
627
|
+
|
|
628
|
+
// src/apis/account/user.consumer.ts
|
|
629
|
+
var _namespace3 = "user/";
|
|
630
|
+
var UserConsumer = class extends BaseConsumer {
|
|
631
|
+
// private _accountBase:string;
|
|
632
|
+
constructor(_httpClient) {
|
|
633
|
+
super(_httpClient, _namespace3);
|
|
634
|
+
this._client = _httpClient;
|
|
635
|
+
}
|
|
636
|
+
login(email, password) {
|
|
637
|
+
let config = {
|
|
638
|
+
headers: {
|
|
639
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
let data = {
|
|
643
|
+
"username": email,
|
|
644
|
+
"password": password
|
|
645
|
+
};
|
|
646
|
+
return this._client.post(this.path, data, config).then((resp) => {
|
|
647
|
+
return resp.data;
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
getUser(token) {
|
|
651
|
+
return this.getOne("", null, token);
|
|
652
|
+
}
|
|
653
|
+
register(email, password, firstName, lastName) {
|
|
654
|
+
let config = {
|
|
655
|
+
headers: {
|
|
656
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
let data = {
|
|
660
|
+
"email": email,
|
|
661
|
+
"password": password,
|
|
662
|
+
"last_name": lastName,
|
|
663
|
+
"first_name": firstName
|
|
664
|
+
};
|
|
665
|
+
return this._client.post(this.path + "/register/", data, config).then((resp) => {
|
|
666
|
+
return resp.data;
|
|
667
|
+
}).catch((err) => {
|
|
668
|
+
console.log(err);
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
// src/apis/account/group.consumer.ts
|
|
674
|
+
var _namespace4 = "group/";
|
|
675
|
+
var GroupConsumer = class extends BaseConsumer {
|
|
676
|
+
constructor(_httpClient) {
|
|
677
|
+
super(_httpClient, _namespace4);
|
|
678
|
+
this._client = _httpClient;
|
|
679
|
+
}
|
|
680
|
+
getAllGroups(token) {
|
|
681
|
+
return this.getMany("all", null, token);
|
|
682
|
+
}
|
|
683
|
+
getGroupUsers(gname, gid, token) {
|
|
684
|
+
let addPath = "";
|
|
685
|
+
addPath = addPath + (gname ? `?name=${gname}` : "") + (gid ? `?id=${gid}` : "");
|
|
686
|
+
return this._httpClient.get(this.path + "describe" + addPath, { headers: { "Authorization": "Bearer " + token } }).then((resp) => resp.data).catch((error) => {
|
|
687
|
+
console.error(`\u274C Error in posting:`, error);
|
|
688
|
+
return null;
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
getUserGroups(token) {
|
|
692
|
+
return this.getMany("", null, token);
|
|
693
|
+
}
|
|
694
|
+
getGroupByID(id, token) {
|
|
695
|
+
return this.getOne("id/" + id, null, token);
|
|
696
|
+
}
|
|
697
|
+
getGroupByName(name, token) {
|
|
698
|
+
return this.getOne("name/" + name, null, token);
|
|
699
|
+
}
|
|
700
|
+
postGroup(name, token) {
|
|
701
|
+
const postGroup = {
|
|
702
|
+
name,
|
|
703
|
+
path: "/",
|
|
704
|
+
subGroups: [],
|
|
705
|
+
attributes: {},
|
|
706
|
+
id: void 0
|
|
707
|
+
};
|
|
708
|
+
return this.post("", postGroup, void 0, token);
|
|
709
|
+
}
|
|
710
|
+
addUsers(group_name, input, token) {
|
|
711
|
+
let payload = {
|
|
712
|
+
users: Object.entries(input).map(([email, role]) => ({
|
|
713
|
+
[email]: { admin: role === "admin" /* ADMIN */ }
|
|
714
|
+
}))
|
|
715
|
+
};
|
|
716
|
+
let config = {
|
|
717
|
+
headers: {
|
|
718
|
+
"Content-Type": "application/json",
|
|
719
|
+
"Authorization": "Bearer " + token
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
this._client.post(this.path + "name/" + group_name, payload, config);
|
|
723
|
+
}
|
|
724
|
+
deleteGroup(id, token) {
|
|
725
|
+
return this.delete("id/" + id, token);
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
|
|
729
|
+
// src/apis/management/bucket.consumer.ts
|
|
730
|
+
var _namespace5 = "bucket";
|
|
731
|
+
var BucketConsumer = class extends BaseConsumer {
|
|
732
|
+
constructor(_httpClient) {
|
|
733
|
+
super(_httpClient, _namespace5);
|
|
734
|
+
}
|
|
735
|
+
postBucket(id, name, token) {
|
|
736
|
+
const postBucket = {
|
|
737
|
+
name,
|
|
738
|
+
_id: id,
|
|
739
|
+
creation_date: void 0
|
|
740
|
+
};
|
|
741
|
+
return this.post("", postBucket, void 0, token);
|
|
742
|
+
}
|
|
743
|
+
deleteBucket(id, token) {
|
|
744
|
+
return this.delete("/" + id, token);
|
|
745
|
+
}
|
|
746
|
+
getBucketInfo(gid, token) {
|
|
747
|
+
let addPath = gid ? `?id=${gid}` : "";
|
|
748
|
+
return this._httpClient.get(this.path + addPath, { headers: { "Authorization": "Bearer " + token } }).then((resp) => resp.data).catch((error) => {
|
|
749
|
+
console.error(`\u274C Error in posting:`, error);
|
|
750
|
+
return null;
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
|
|
807
755
|
// src/apis/management/folder.consumer.ts
|
|
808
756
|
var _namespace6 = "folder";
|
|
809
757
|
var FolderConsumer = class extends BaseConsumer {
|
|
@@ -1007,6 +955,8 @@ var Client = class {
|
|
|
1007
955
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1008
956
|
0 && (module.exports = {
|
|
1009
957
|
Client,
|
|
958
|
+
File,
|
|
959
|
+
Folder,
|
|
1010
960
|
Role,
|
|
1011
961
|
mergeGroupsByIdName
|
|
1012
962
|
});
|