@internxt/sdk 1.4.79 → 1.6.3
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.d.ts +5 -0
- package/dist/auth/index.js +80 -12
- package/dist/auth/types.d.ts +17 -4
- package/dist/drive/backups/index.js +3 -3
- package/dist/drive/index.js +5 -1
- package/dist/drive/payments/index.d.ts +30 -17
- package/dist/drive/payments/index.js +78 -25
- package/dist/drive/payments/types.d.ts +67 -1
- package/dist/drive/payments/types.js +11 -6
- package/dist/drive/referrals/index.js +5 -1
- package/dist/drive/referrals/types.js +2 -2
- package/dist/drive/share/index.d.ts +1 -1
- package/dist/drive/share/index.js +49 -44
- package/dist/drive/share/types.d.ts +31 -29
- package/dist/drive/storage/index.d.ts +130 -10
- package/dist/drive/storage/index.js +253 -53
- package/dist/drive/storage/types.d.ts +107 -21
- package/dist/drive/storage/types.js +2 -2
- package/dist/drive/trash/index.d.ts +22 -2
- package/dist/drive/trash/index.js +44 -9
- package/dist/drive/trash/types.d.ts +9 -0
- package/dist/drive/users/index.d.ts +30 -3
- package/dist/drive/users/index.js +40 -6
- package/dist/drive/users/types.d.ts +16 -6
- package/dist/index.d.ts +3 -2
- package/dist/index.js +12 -7
- package/dist/network/download.js +5 -5
- package/dist/network/errors/codes.d.ts +1 -1
- package/dist/network/errors/context.d.ts +4 -4
- package/dist/network/errors/context.js +2 -2
- package/dist/network/errors/download.js +5 -1
- package/dist/network/errors/index.js +5 -1
- package/dist/network/errors/upload.js +5 -1
- package/dist/network/index.d.ts +2 -3
- package/dist/network/index.js +14 -9
- package/dist/network/types.d.ts +16 -16
- package/dist/network/types.js +2 -2
- package/dist/network/upload.js +8 -9
- package/dist/photos/devices/index.js +8 -8
- package/dist/photos/index.js +5 -1
- package/dist/photos/photos/index.js +26 -26
- package/dist/photos/shares/index.js +3 -3
- package/dist/photos/types.d.ts +14 -14
- package/dist/photos/types.js +3 -3
- package/dist/photos/users/index.js +2 -2
- package/dist/shared/headers/index.d.ts +9 -6
- package/dist/shared/headers/index.js +27 -18
- package/dist/shared/http/client.d.ts +1 -1
- package/dist/shared/http/client.js +4 -13
- package/dist/shared/http/types.d.ts +4 -4
- package/dist/shared/index.js +5 -1
- package/dist/shared/types/apiConnection.d.ts +2 -1
- package/dist/shared/types/appsumo.js +1 -1
- package/dist/shared/types/errors.d.ts +2 -1
- package/dist/shared/types/errors.js +2 -1
- package/dist/shared/types/userSettings.d.ts +17 -1
- package/dist/utils.js +2 -3
- package/dist/workspaces/index.d.ts +176 -0
- package/dist/workspaces/index.js +419 -0
- package/dist/workspaces/index.test.d.ts +1 -0
- package/dist/workspaces/index.test.js +908 -0
- package/dist/workspaces/types.d.ts +294 -0
- package/dist/workspaces/types.js +2 -0
- package/package.json +13 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DownloadInvalidMnemonicError } from './download';
|
|
2
2
|
import { UploadInvalidMnemonicError } from './upload';
|
|
3
|
-
|
|
4
|
-
export
|
|
3
|
+
type NetworkError = UploadInvalidMnemonicError | DownloadInvalidMnemonicError | Error;
|
|
4
|
+
export type NetworkUploadContext = {
|
|
5
5
|
bucketId: string;
|
|
6
6
|
fileSize: number;
|
|
7
7
|
user: string;
|
|
@@ -13,7 +13,7 @@ export declare type NetworkUploadContext = {
|
|
|
13
13
|
iv: string;
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
|
-
export
|
|
16
|
+
export type NetworkDownloadContext = {
|
|
17
17
|
bucketId: string;
|
|
18
18
|
fileId: string;
|
|
19
19
|
user: string;
|
|
@@ -26,7 +26,7 @@ export declare type NetworkDownloadContext = {
|
|
|
26
26
|
iv: string;
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
-
export
|
|
29
|
+
export type NetworkContext = NetworkUploadContext | NetworkDownloadContext;
|
|
30
30
|
export declare class ErrorWithContext extends Error {
|
|
31
31
|
context: Partial<NetworkContext>;
|
|
32
32
|
constructor(context: Partial<NetworkContext>);
|
|
@@ -15,7 +15,8 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports.ErrorWithContext = void 0;
|
|
19
|
+
exports.getNetworkErrorContext = getNetworkErrorContext;
|
|
19
20
|
var download_1 = require("./download");
|
|
20
21
|
var upload_1 = require("./upload");
|
|
21
22
|
var ErrorWithContext = /** @class */ (function (_super) {
|
|
@@ -36,4 +37,3 @@ function getNetworkErrorContext(input, err) {
|
|
|
36
37
|
}
|
|
37
38
|
return output;
|
|
38
39
|
}
|
|
39
|
-
exports.getNetworkErrorContext = getNetworkErrorContext;
|
|
@@ -16,7 +16,11 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
18
|
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
20
24
|
}) : (function(o, m, k, k2) {
|
|
21
25
|
if (k2 === undefined) k2 = k;
|
|
22
26
|
o[k2] = m[k];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -16,7 +16,11 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
18
|
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.
|
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
+
}
|
|
23
|
+
Object.defineProperty(o, k2, desc);
|
|
20
24
|
}) : (function(o, m, k, k2) {
|
|
21
25
|
if (k2 === undefined) k2 = k;
|
|
22
26
|
o[k2] = m[k];
|
package/dist/network/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { BridgeUrl, StartUploadResponse, FinishUploadResponse, GetDownloadLinksResponse, NetworkRequestConfig, FinishUploadPayload, FinishMultipartUploadPayload } from './types';
|
|
2
|
-
import { AppDetails } from '../shared';
|
|
3
1
|
import { BasicAuth } from '../auth/types';
|
|
4
|
-
import {
|
|
2
|
+
import { AppDetails } from '../shared';
|
|
3
|
+
import { BridgeUrl, FinishMultipartUploadPayload, FinishUploadPayload, FinishUploadResponse, GetDownloadLinksResponse, NetworkRequestConfig, StartUploadPayload, StartUploadResponse } from './types';
|
|
5
4
|
export * from './types';
|
|
6
5
|
export declare class DuplicatedIndexesError extends Error {
|
|
7
6
|
constructor();
|
package/dist/network/index.js
CHANGED
|
@@ -27,7 +27,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
27
27
|
};
|
|
28
28
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
29
29
|
if (k2 === undefined) k2 = k;
|
|
30
|
-
Object.
|
|
30
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
31
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
32
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(o, k2, desc);
|
|
31
35
|
}) : (function(o, m, k, k2) {
|
|
32
36
|
if (k2 === undefined) k2 = k;
|
|
33
37
|
o[k2] = m[k];
|
|
@@ -45,12 +49,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
45
49
|
});
|
|
46
50
|
};
|
|
47
51
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
48
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
49
|
-
return g =
|
|
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;
|
|
50
54
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
51
55
|
function step(op) {
|
|
52
56
|
if (f) throw new TypeError("Generator is already executing.");
|
|
53
|
-
while (_) try {
|
|
57
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
54
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;
|
|
55
59
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
56
60
|
switch (op[0]) {
|
|
@@ -74,8 +78,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
74
78
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
79
|
exports.Network = exports.InvalidMultipartValueError = exports.FileTooSmallForMultipartError = exports.InvalidUploadSizeError = exports.InvalidUploadIndexError = exports.InvalidFileIndexError = exports.DuplicatedIndexesError = void 0;
|
|
76
80
|
var uuid_1 = require("uuid");
|
|
77
|
-
var client_1 = require("../shared/http/client");
|
|
78
81
|
var index_1 = require("../shared/headers/index");
|
|
82
|
+
var client_1 = require("../shared/http/client");
|
|
79
83
|
var utils_1 = require("../utils");
|
|
80
84
|
__exportStar(require("./types"), exports);
|
|
81
85
|
var DuplicatedIndexesError = /** @class */ (function (_super) {
|
|
@@ -259,7 +263,7 @@ var Network = /** @class */ (function () {
|
|
|
259
263
|
var client = _a.client, appDetails = _a.appDetails, auth = _a.auth;
|
|
260
264
|
if (parts === void 0) { parts = 1; }
|
|
261
265
|
var headers = Network.headersWithBasicAuth(appDetails, auth);
|
|
262
|
-
return client.post("/v2/buckets/"
|
|
266
|
+
return client.post("/v2/buckets/".concat(bucketId, "/files/start?multiparts=").concat(parts), payload, headers);
|
|
263
267
|
};
|
|
264
268
|
/**
|
|
265
269
|
* Finishes the upload of a file
|
|
@@ -270,7 +274,7 @@ var Network = /** @class */ (function () {
|
|
|
270
274
|
Network.finishUpload = function (bucketId, payload, _a) {
|
|
271
275
|
var client = _a.client, appDetails = _a.appDetails, auth = _a.auth;
|
|
272
276
|
var headers = Network.headersWithBasicAuth(appDetails, auth);
|
|
273
|
-
return client.post("/v2/buckets/"
|
|
277
|
+
return client.post("/v2/buckets/".concat(bucketId, "/files/finish"), payload, headers);
|
|
274
278
|
};
|
|
275
279
|
/**
|
|
276
280
|
* Gets the download links for a file
|
|
@@ -279,10 +283,11 @@ var Network = /** @class */ (function () {
|
|
|
279
283
|
*/
|
|
280
284
|
Network.getDownloadLinks = function (bucketId, fileId, _a, token) {
|
|
281
285
|
var client = _a.client, appDetails = _a.appDetails, auth = _a.auth;
|
|
286
|
+
// ES ESTE EL QUE FALLA AL INTENTAR DESCARGAR UN FILE
|
|
282
287
|
var headers = token
|
|
283
288
|
? Network.headersWithAuthToken(appDetails, token)
|
|
284
289
|
: Network.headersWithBasicAuth(appDetails, auth);
|
|
285
|
-
return client.get("/buckets/"
|
|
290
|
+
return client.get("/buckets/".concat(bucketId, "/files/").concat(fileId, "/info"), __assign(__assign({}, headers), { 'x-api-version': '2' }));
|
|
286
291
|
};
|
|
287
292
|
/**
|
|
288
293
|
* Deletes a file
|
|
@@ -292,7 +297,7 @@ var Network = /** @class */ (function () {
|
|
|
292
297
|
Network.deleteFile = function (bucketId, fileId, _a) {
|
|
293
298
|
var client = _a.client, appDetails = _a.appDetails, auth = _a.auth;
|
|
294
299
|
var headers = Network.headersWithBasicAuth(appDetails, auth);
|
|
295
|
-
return client.delete("/v2/buckets/"
|
|
300
|
+
return client.delete("/v2/buckets/".concat(bucketId, "/files/").concat(fileId), headers);
|
|
296
301
|
};
|
|
297
302
|
/**
|
|
298
303
|
* Gets headers with basic auth
|
package/dist/network/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AppDetails } from '../shared';
|
|
2
2
|
import { HttpClient } from '../shared/http/client';
|
|
3
3
|
import { BasicAuth } from '../auth/types';
|
|
4
|
-
|
|
5
|
-
export
|
|
4
|
+
type Hash = string;
|
|
5
|
+
export type BridgeUrl = string;
|
|
6
6
|
export interface Shard {
|
|
7
7
|
uuid: string;
|
|
8
8
|
hash: Hash;
|
|
@@ -23,7 +23,7 @@ export interface StartUploadResponse {
|
|
|
23
23
|
UploadId?: string;
|
|
24
24
|
}[];
|
|
25
25
|
}
|
|
26
|
-
export
|
|
26
|
+
export type FinishUploadResponse = BucketEntry;
|
|
27
27
|
export interface BucketEntry {
|
|
28
28
|
id: string;
|
|
29
29
|
index: string;
|
|
@@ -51,52 +51,52 @@ export interface NetworkRequestConfig {
|
|
|
51
51
|
appDetails: AppDetails;
|
|
52
52
|
auth: BasicAuth;
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
type UploadPayload = {
|
|
55
55
|
index: number;
|
|
56
56
|
size: number;
|
|
57
57
|
};
|
|
58
|
-
export
|
|
58
|
+
export type StartUploadPayload = {
|
|
59
59
|
uploads: UploadPayload[];
|
|
60
60
|
};
|
|
61
|
-
export
|
|
61
|
+
export type FinishUploadPayload = {
|
|
62
62
|
index: string;
|
|
63
63
|
shards: Shard[];
|
|
64
64
|
};
|
|
65
|
-
export
|
|
65
|
+
export type FinishMultipartUploadPayload = {
|
|
66
66
|
index: string;
|
|
67
67
|
shards: ShardForMultipart[];
|
|
68
68
|
};
|
|
69
|
-
export
|
|
70
|
-
export
|
|
69
|
+
export type UploadFileFunction = (url: string) => Promise<Hash>;
|
|
70
|
+
export type UploadFileMultipartFunction = (urls: string[]) => Promise<{
|
|
71
71
|
hash: Hash;
|
|
72
72
|
parts: {
|
|
73
73
|
PartNumber: number;
|
|
74
74
|
ETag: string;
|
|
75
75
|
}[];
|
|
76
76
|
}>;
|
|
77
|
-
export
|
|
78
|
-
export
|
|
77
|
+
export type DownloadFileFunction = (downloadables: DownloadableShard[], fileSize: number) => Promise<void>;
|
|
78
|
+
export type BinaryData = {
|
|
79
79
|
slice: (from: number, to: number) => BinaryData;
|
|
80
80
|
toString(encoding: 'hex'): string;
|
|
81
81
|
};
|
|
82
82
|
export declare enum BinaryDataEncoding {
|
|
83
83
|
HEX = "hex"
|
|
84
84
|
}
|
|
85
|
-
export
|
|
85
|
+
export type ToBinaryDataFunction = (input: string, encoding: BinaryDataEncoding) => BinaryData;
|
|
86
86
|
export declare enum SymmetricCryptoAlgorithm {
|
|
87
87
|
AES256CTR = "AES256CTR"
|
|
88
88
|
}
|
|
89
|
-
export
|
|
89
|
+
export type Algorithm = {
|
|
90
90
|
type: SymmetricCryptoAlgorithm;
|
|
91
91
|
ivSize: number;
|
|
92
92
|
};
|
|
93
93
|
export declare const ALGORITHMS: Record<SymmetricCryptoAlgorithm, Algorithm>;
|
|
94
|
-
export
|
|
94
|
+
export type Crypto = {
|
|
95
95
|
algorithm: Algorithm;
|
|
96
96
|
validateMnemonic: (mnemonic: string) => boolean;
|
|
97
97
|
randomBytes: (bytesLength: number) => BinaryData;
|
|
98
98
|
generateFileKey: (mnemonic: string, bucketId: string, index: BinaryData | string) => Promise<BinaryData>;
|
|
99
99
|
};
|
|
100
|
-
export
|
|
101
|
-
export
|
|
100
|
+
export type EncryptFileFunction = (algorithm: SymmetricCryptoAlgorithm, key: BinaryData, iv: BinaryData) => Promise<void>;
|
|
101
|
+
export type DecryptFileFunction = (algorithm: SymmetricCryptoAlgorithm, key: BinaryData, iv: BinaryData, fileSize: number) => Promise<void>;
|
|
102
102
|
export {};
|
package/dist/network/types.js
CHANGED
|
@@ -5,11 +5,11 @@ exports.ALGORITHMS = exports.SymmetricCryptoAlgorithm = exports.BinaryDataEncodi
|
|
|
5
5
|
var BinaryDataEncoding;
|
|
6
6
|
(function (BinaryDataEncoding) {
|
|
7
7
|
BinaryDataEncoding["HEX"] = "hex";
|
|
8
|
-
})(BinaryDataEncoding
|
|
8
|
+
})(BinaryDataEncoding || (exports.BinaryDataEncoding = BinaryDataEncoding = {}));
|
|
9
9
|
var SymmetricCryptoAlgorithm;
|
|
10
10
|
(function (SymmetricCryptoAlgorithm) {
|
|
11
11
|
SymmetricCryptoAlgorithm["AES256CTR"] = "AES256CTR";
|
|
12
|
-
})(SymmetricCryptoAlgorithm
|
|
12
|
+
})(SymmetricCryptoAlgorithm || (exports.SymmetricCryptoAlgorithm = SymmetricCryptoAlgorithm = {}));
|
|
13
13
|
exports.ALGORITHMS = (_a = {},
|
|
14
14
|
_a[SymmetricCryptoAlgorithm.AES256CTR] = {
|
|
15
15
|
type: SymmetricCryptoAlgorithm.AES256CTR,
|
package/dist/network/upload.js
CHANGED
|
@@ -9,12 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g =
|
|
12
|
+
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);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
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;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -36,7 +36,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.uploadFile = uploadFile;
|
|
40
|
+
exports.uploadMultipartFile = uploadMultipartFile;
|
|
40
41
|
var errors_1 = require("./errors");
|
|
41
42
|
function uploadFile(network, crypto, bucketId, mnemonic, fileSize, encryptFile, uploadFile) {
|
|
42
43
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -104,11 +105,10 @@ function uploadFile(network, crypto, bucketId, mnemonic, fileSize, encryptFile,
|
|
|
104
105
|
});
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
|
-
|
|
108
|
-
function
|
|
109
|
-
if (parts === void 0) { parts = 1; }
|
|
110
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
+
function uploadMultipartFile(network_1, crypto_1, bucketId_1, mnemonic_1, fileSize_1, encryptFile_1, uploadMultiparts_1) {
|
|
109
|
+
return __awaiter(this, arguments, void 0, function (network, crypto, bucketId, mnemonic, fileSize, encryptFile, uploadMultiparts, parts) {
|
|
111
110
|
var mnemonicIsValid, index, iv, key, uploads, _a, urls, uuid, UploadId, _b, hash, uploadedPartsReference, finishUploadPayload, finishUploadResponse;
|
|
111
|
+
if (parts === void 0) { parts = 1; }
|
|
112
112
|
return __generator(this, function (_c) {
|
|
113
113
|
switch (_c.label) {
|
|
114
114
|
case 0:
|
|
@@ -156,4 +156,3 @@ function uploadMultipartFile(network, crypto, bucketId, mnemonic, fileSize, encr
|
|
|
156
156
|
});
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
|
-
exports.uploadMultipartFile = uploadMultipartFile;
|
|
@@ -23,9 +23,9 @@ var DevicesSubmodule = /** @class */ (function () {
|
|
|
23
23
|
DevicesSubmodule.prototype.getDeviceById = function (deviceId) {
|
|
24
24
|
var _this = this;
|
|
25
25
|
return axios_1.default
|
|
26
|
-
.get(this.model.baseUrl
|
|
26
|
+
.get("".concat(this.model.baseUrl, "/devices/").concat(deviceId), {
|
|
27
27
|
headers: {
|
|
28
|
-
Authorization: "Bearer "
|
|
28
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
29
29
|
},
|
|
30
30
|
})
|
|
31
31
|
.then(function (res) { return _this.parse(res.data); })
|
|
@@ -36,9 +36,9 @@ var DevicesSubmodule = /** @class */ (function () {
|
|
|
36
36
|
DevicesSubmodule.prototype.getDevices = function () {
|
|
37
37
|
var _this = this;
|
|
38
38
|
return axios_1.default
|
|
39
|
-
.get(this.model.baseUrl
|
|
39
|
+
.get("".concat(this.model.baseUrl, "/devices"), {
|
|
40
40
|
headers: {
|
|
41
|
-
Authorization: "Bearer "
|
|
41
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
42
42
|
},
|
|
43
43
|
})
|
|
44
44
|
.then(function (res) { return res.data.results.map(function (json) { return _this.parse(json); }); })
|
|
@@ -49,9 +49,9 @@ var DevicesSubmodule = /** @class */ (function () {
|
|
|
49
49
|
DevicesSubmodule.prototype.createDevice = function (data) {
|
|
50
50
|
var _this = this;
|
|
51
51
|
return axios_1.default
|
|
52
|
-
.post(this.model.baseUrl
|
|
52
|
+
.post("".concat(this.model.baseUrl, "/devices"), data, {
|
|
53
53
|
headers: {
|
|
54
|
-
Authorization: "Bearer "
|
|
54
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
55
55
|
},
|
|
56
56
|
})
|
|
57
57
|
.then(function (res) { return _this.parse(res.data); })
|
|
@@ -61,9 +61,9 @@ var DevicesSubmodule = /** @class */ (function () {
|
|
|
61
61
|
};
|
|
62
62
|
DevicesSubmodule.prototype.deleteDevice = function (deviceId) {
|
|
63
63
|
return axios_1.default
|
|
64
|
-
.delete(this.model.baseUrl
|
|
64
|
+
.delete("".concat(this.model.baseUrl, "/devices/").concat(deviceId), {
|
|
65
65
|
headers: {
|
|
66
|
-
Authorization: "Bearer "
|
|
66
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
67
67
|
},
|
|
68
68
|
})
|
|
69
69
|
.then(function () { return undefined; })
|
package/dist/photos/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -24,9 +24,9 @@ var PhotosSubmodule = /** @class */ (function () {
|
|
|
24
24
|
PhotosSubmodule.prototype.getPhotoById = function (photoId) {
|
|
25
25
|
var _this = this;
|
|
26
26
|
return axios_1.default
|
|
27
|
-
.get(this.model.baseUrl
|
|
27
|
+
.get("".concat(this.model.baseUrl, "/photos/").concat(photoId), {
|
|
28
28
|
headers: {
|
|
29
|
-
Authorization: "Bearer "
|
|
29
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
30
30
|
},
|
|
31
31
|
})
|
|
32
32
|
.then(function (res) { return _this.parse(res.data); })
|
|
@@ -41,9 +41,9 @@ var PhotosSubmodule = /** @class */ (function () {
|
|
|
41
41
|
throw new Error('Invalid skip. Skip should be positive. Provided skip was: ' + skip);
|
|
42
42
|
}
|
|
43
43
|
return axios_1.default
|
|
44
|
-
.get(this.model.baseUrl
|
|
44
|
+
.get("".concat(this.model.baseUrl, "/photos/sorted?").concat(query), {
|
|
45
45
|
headers: {
|
|
46
|
-
Authorization: "Bearer "
|
|
46
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
47
47
|
},
|
|
48
48
|
})
|
|
49
49
|
.then(function (res) { return ({
|
|
@@ -63,9 +63,9 @@ var PhotosSubmodule = /** @class */ (function () {
|
|
|
63
63
|
throw new Error('Invalid skip. Skip should be positive. Provided skip was: ' + skip);
|
|
64
64
|
}
|
|
65
65
|
return axios_1.default
|
|
66
|
-
.get(this.model.baseUrl
|
|
66
|
+
.get("".concat(this.model.baseUrl, "/photos/?").concat(query), {
|
|
67
67
|
headers: {
|
|
68
|
-
Authorization: "Bearer "
|
|
68
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
69
69
|
},
|
|
70
70
|
})
|
|
71
71
|
.then(function (res) { return ({
|
|
@@ -79,9 +79,9 @@ var PhotosSubmodule = /** @class */ (function () {
|
|
|
79
79
|
PhotosSubmodule.prototype.createPhoto = function (data) {
|
|
80
80
|
var _this = this;
|
|
81
81
|
return axios_1.default
|
|
82
|
-
.post(this.model.baseUrl
|
|
82
|
+
.post("".concat(this.model.baseUrl, "/photos"), data, {
|
|
83
83
|
headers: {
|
|
84
|
-
Authorization: "Bearer "
|
|
84
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
85
85
|
},
|
|
86
86
|
})
|
|
87
87
|
.then(function (res) { return _this.parse(res.data); })
|
|
@@ -92,9 +92,9 @@ var PhotosSubmodule = /** @class */ (function () {
|
|
|
92
92
|
PhotosSubmodule.prototype.findOrCreatePhoto = function (data) {
|
|
93
93
|
var _this = this;
|
|
94
94
|
return axios_1.default
|
|
95
|
-
.post(this.model.baseUrl
|
|
95
|
+
.post("".concat(this.model.baseUrl, "/photos/photo/exists"), data, {
|
|
96
96
|
headers: {
|
|
97
|
-
Authorization: "Bearer "
|
|
97
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
98
98
|
},
|
|
99
99
|
})
|
|
100
100
|
.then(function (res) { return _this.parse(res.data); })
|
|
@@ -104,9 +104,9 @@ var PhotosSubmodule = /** @class */ (function () {
|
|
|
104
104
|
};
|
|
105
105
|
PhotosSubmodule.prototype.deletePhotosById = function (photos) {
|
|
106
106
|
return axios_1.default
|
|
107
|
-
.delete(this.model.baseUrl
|
|
107
|
+
.delete("".concat(this.model.baseUrl, "/photos/photos"), {
|
|
108
108
|
headers: {
|
|
109
|
-
Authorization: "Bearer "
|
|
109
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
110
110
|
},
|
|
111
111
|
data: {
|
|
112
112
|
photos: photos,
|
|
@@ -119,9 +119,9 @@ var PhotosSubmodule = /** @class */ (function () {
|
|
|
119
119
|
};
|
|
120
120
|
PhotosSubmodule.prototype.deletePhotoById = function (photoId) {
|
|
121
121
|
return axios_1.default
|
|
122
|
-
.delete(this.model.baseUrl
|
|
122
|
+
.delete("".concat(this.model.baseUrl, "/photos/").concat(photoId), {
|
|
123
123
|
headers: {
|
|
124
|
-
Authorization: "Bearer "
|
|
124
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
125
125
|
},
|
|
126
126
|
})
|
|
127
127
|
.then(function () { return undefined; })
|
|
@@ -131,11 +131,11 @@ var PhotosSubmodule = /** @class */ (function () {
|
|
|
131
131
|
};
|
|
132
132
|
PhotosSubmodule.prototype.trashPhotosById = function (photos) {
|
|
133
133
|
return axios_1.default
|
|
134
|
-
.post(this.model.baseUrl
|
|
134
|
+
.post("".concat(this.model.baseUrl, "/photos/photos/trash"), {
|
|
135
135
|
photos: photos,
|
|
136
136
|
}, {
|
|
137
137
|
headers: {
|
|
138
|
-
Authorization: "Bearer "
|
|
138
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
139
139
|
},
|
|
140
140
|
})
|
|
141
141
|
.then(function () { return undefined; })
|
|
@@ -145,9 +145,9 @@ var PhotosSubmodule = /** @class */ (function () {
|
|
|
145
145
|
};
|
|
146
146
|
PhotosSubmodule.prototype.trashPhotoById = function (photoId) {
|
|
147
147
|
return axios_1.default
|
|
148
|
-
.post(this.model.baseUrl
|
|
148
|
+
.post("".concat(this.model.baseUrl, "/photos/").concat(photoId, "/trash"), {}, {
|
|
149
149
|
headers: {
|
|
150
|
-
Authorization: "Bearer "
|
|
150
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
151
151
|
},
|
|
152
152
|
})
|
|
153
153
|
.then(function () { return undefined; })
|
|
@@ -157,9 +157,9 @@ var PhotosSubmodule = /** @class */ (function () {
|
|
|
157
157
|
};
|
|
158
158
|
PhotosSubmodule.prototype.getUsage = function () {
|
|
159
159
|
return axios_1.default
|
|
160
|
-
.get(this.model.baseUrl
|
|
160
|
+
.get("".concat(this.model.baseUrl, "/photos/usage"), {
|
|
161
161
|
headers: {
|
|
162
|
-
Authorization: "Bearer "
|
|
162
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
163
163
|
},
|
|
164
164
|
})
|
|
165
165
|
.then(function (result) {
|
|
@@ -172,9 +172,9 @@ var PhotosSubmodule = /** @class */ (function () {
|
|
|
172
172
|
PhotosSubmodule.prototype.photosExists = function (photosExistPayload) {
|
|
173
173
|
var _this = this;
|
|
174
174
|
return axios_1.default
|
|
175
|
-
.post(this.model.baseUrl
|
|
175
|
+
.post("".concat(this.model.baseUrl, "/photos/exists"), { photos: photosExistPayload }, {
|
|
176
176
|
headers: {
|
|
177
|
-
Authorization: "Bearer "
|
|
177
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
178
178
|
},
|
|
179
179
|
})
|
|
180
180
|
.then(function (res) {
|
|
@@ -193,9 +193,9 @@ var PhotosSubmodule = /** @class */ (function () {
|
|
|
193
193
|
};
|
|
194
194
|
PhotosSubmodule.prototype.updatePhoto = function (photoId, data) {
|
|
195
195
|
return axios_1.default
|
|
196
|
-
.patch(this.model.baseUrl
|
|
196
|
+
.patch("".concat(this.model.baseUrl, "/photos/").concat(photoId), data, {
|
|
197
197
|
headers: {
|
|
198
|
-
Authorization: "Bearer "
|
|
198
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
199
199
|
},
|
|
200
200
|
})
|
|
201
201
|
.then(function (result) {
|
|
@@ -207,9 +207,9 @@ var PhotosSubmodule = /** @class */ (function () {
|
|
|
207
207
|
};
|
|
208
208
|
PhotosSubmodule.prototype.getCount = function () {
|
|
209
209
|
return axios_1.default
|
|
210
|
-
.get(this.model.baseUrl
|
|
210
|
+
.get("".concat(this.model.baseUrl, "/photos/count"), {
|
|
211
211
|
headers: {
|
|
212
|
-
Authorization: "Bearer "
|
|
212
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
213
213
|
},
|
|
214
214
|
})
|
|
215
215
|
.then(function (result) { return result.data; })
|
|
@@ -11,7 +11,7 @@ var SharesSubmodule = /** @class */ (function () {
|
|
|
11
11
|
}
|
|
12
12
|
SharesSubmodule.prototype.getShare = function (id, code) {
|
|
13
13
|
return axios_1.default
|
|
14
|
-
.get(this.model.baseUrl
|
|
14
|
+
.get("".concat(this.model.baseUrl, "/shares/").concat(id, "?code=").concat(code))
|
|
15
15
|
.then(function (response) { return response.data; })
|
|
16
16
|
.catch(function (err) {
|
|
17
17
|
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
@@ -19,9 +19,9 @@ var SharesSubmodule = /** @class */ (function () {
|
|
|
19
19
|
};
|
|
20
20
|
SharesSubmodule.prototype.createShare = function (body) {
|
|
21
21
|
return axios_1.default
|
|
22
|
-
.post(this.model.baseUrl
|
|
22
|
+
.post("".concat(this.model.baseUrl, "/shares"), body, {
|
|
23
23
|
headers: {
|
|
24
|
-
Authorization: "Bearer "
|
|
24
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
25
25
|
},
|
|
26
26
|
})
|
|
27
27
|
.then(function (response) { return response.data; })
|
package/dist/photos/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export interface PhotosSdkModel {
|
|
|
2
2
|
baseUrl: string;
|
|
3
3
|
accessToken?: string;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export type UserId = string;
|
|
6
6
|
export interface User {
|
|
7
7
|
id: UserId;
|
|
8
8
|
uuid: string;
|
|
@@ -20,7 +20,7 @@ export interface InitializeUserData {
|
|
|
20
20
|
bridgeUser: string;
|
|
21
21
|
bridgePassword: string;
|
|
22
22
|
}
|
|
23
|
-
export
|
|
23
|
+
export type DeviceId = string;
|
|
24
24
|
export interface Device {
|
|
25
25
|
id: DeviceId;
|
|
26
26
|
mac: string;
|
|
@@ -51,9 +51,9 @@ export declare enum PhotosSortBy {
|
|
|
51
51
|
UpdatedAt = "updatedAt",
|
|
52
52
|
TakenAt = "takenAt"
|
|
53
53
|
}
|
|
54
|
-
export
|
|
55
|
-
export
|
|
56
|
-
export
|
|
54
|
+
export type FileId = string;
|
|
55
|
+
export type PhotoId = string;
|
|
56
|
+
export type PhotoPreviewType = 'PNG' | 'JPEG';
|
|
57
57
|
export declare enum PhotosItemType {
|
|
58
58
|
PHOTO = "PHOTO",
|
|
59
59
|
VIDEO = "VIDEO"
|
|
@@ -105,10 +105,10 @@ export interface PhotoJSON extends Omit<Photo, 'statusChangedAt' | 'takenAt' | '
|
|
|
105
105
|
createdAt: string;
|
|
106
106
|
updatedAt: string;
|
|
107
107
|
}
|
|
108
|
-
export
|
|
108
|
+
export type CreatePhotoData = Omit<Photo, 'id' | 'status' | 'statusChangedAt' | 'createdAt' | 'updatedAt'> & {
|
|
109
109
|
networkBucketId: string;
|
|
110
110
|
};
|
|
111
|
-
export
|
|
111
|
+
export type ShareId = string;
|
|
112
112
|
export interface Share {
|
|
113
113
|
id: ShareId;
|
|
114
114
|
bucket: string;
|
|
@@ -122,31 +122,31 @@ export interface ShareJSON extends Omit<Share, 'createdAt' | 'updatedAt'> {
|
|
|
122
122
|
createdAt: string;
|
|
123
123
|
updatedAt: string;
|
|
124
124
|
}
|
|
125
|
-
export
|
|
125
|
+
export type CreatePhotoShareBody = Pick<Share, 'views' | 'photoIds' | 'bucket' | 'token'> & {
|
|
126
126
|
encryptedMnemonic: string;
|
|
127
127
|
};
|
|
128
|
-
export
|
|
128
|
+
export type GetPhotoShareResponse = Share & {
|
|
129
129
|
photos: (Pick<Photo, 'fileId' | 'name' | 'size' | 'type'> & {
|
|
130
130
|
decryptionKey: string;
|
|
131
131
|
})[];
|
|
132
132
|
};
|
|
133
|
-
export
|
|
133
|
+
export type PhotoExistsPayload = {
|
|
134
134
|
hash: string;
|
|
135
135
|
name: string;
|
|
136
136
|
takenAt: string;
|
|
137
137
|
};
|
|
138
|
-
export
|
|
138
|
+
export type PhotoExistsDataJSON = (PhotoExistsPayload | PhotoJSON) & {
|
|
139
139
|
exists: boolean;
|
|
140
140
|
};
|
|
141
|
-
export
|
|
141
|
+
export type PhotoExistsData = ((Omit<PhotoExistsPayload, 'takenAt'> & {
|
|
142
142
|
takenAt: Date;
|
|
143
143
|
}) | Photo) & {
|
|
144
144
|
exists: boolean;
|
|
145
145
|
};
|
|
146
|
-
export
|
|
146
|
+
export type PhotosUsage = {
|
|
147
147
|
usage: number;
|
|
148
148
|
};
|
|
149
|
-
export
|
|
149
|
+
export type PhotosCount = {
|
|
150
150
|
existent: number;
|
|
151
151
|
trashed: number;
|
|
152
152
|
deleted: number;
|