@internxt/sdk 1.9.30 → 1.10.1

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.
Files changed (44) hide show
  1. package/dist/auth/index.js +2 -2
  2. package/dist/drive/payments/index.js +2 -2
  3. package/dist/drive/payments/object-storage.js +6 -2
  4. package/dist/drive/payments/types/tiers.js +1 -1
  5. package/dist/drive/payments/types/types.js +6 -6
  6. package/dist/drive/referrals/index.js +17 -7
  7. package/dist/drive/referrals/types.js +2 -2
  8. package/dist/drive/share/index.js +19 -9
  9. package/dist/drive/share/types.d.ts +0 -2
  10. package/dist/drive/storage/index.d.ts +6 -0
  11. package/dist/drive/storage/index.js +25 -9
  12. package/dist/drive/storage/types.js +2 -2
  13. package/dist/drive/trash/index.js +19 -9
  14. package/dist/drive/users/index.js +17 -7
  15. package/dist/index.d.ts +0 -1
  16. package/dist/index.js +18 -9
  17. package/dist/meet/index.js +5 -5
  18. package/dist/meet/index.test.js +2 -2
  19. package/dist/misc/location/index.js +2 -2
  20. package/dist/network/download.js +6 -9
  21. package/dist/network/errors/context.js +2 -2
  22. package/dist/network/errors/download.js +17 -7
  23. package/dist/network/errors/upload.js +17 -7
  24. package/dist/network/index.js +2 -2
  25. package/dist/network/types.js +2 -2
  26. package/dist/network/upload.js +15 -17
  27. package/dist/shared/headers/index.js +7 -8
  28. package/dist/shared/types/appsumo.js +1 -1
  29. package/dist/utils.js +2 -3
  30. package/dist/workspaces/index.test.js +2 -2
  31. package/dist/workspaces/types.js +3 -3
  32. package/package.json +23 -18
  33. package/dist/photos/devices/index.d.ts +0 -10
  34. package/dist/photos/devices/index.js +0 -79
  35. package/dist/photos/index.d.ts +0 -17
  36. package/dist/photos/index.js +0 -56
  37. package/dist/photos/photos/index.d.ts +0 -60
  38. package/dist/photos/photos/index.js +0 -225
  39. package/dist/photos/shares/index.d.ts +0 -8
  40. package/dist/photos/shares/index.js +0 -34
  41. package/dist/photos/types.d.ts +0 -154
  42. package/dist/photos/types.js +0 -19
  43. package/dist/photos/users/index.d.ts +0 -7
  44. package/dist/photos/users/index.js +0 -46
@@ -1,225 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- var axios_1 = __importDefault(require("axios"));
18
- var query_string_1 = __importDefault(require("query-string"));
19
- var utils_1 = require("../../utils");
20
- var PhotosSubmodule = /** @class */ (function () {
21
- function PhotosSubmodule(model) {
22
- this.model = model;
23
- }
24
- PhotosSubmodule.prototype.getPhotoById = function (photoId) {
25
- var _this = this;
26
- return axios_1.default
27
- .get("".concat(this.model.baseUrl, "/photos/").concat(photoId), {
28
- headers: {
29
- Authorization: "Bearer ".concat(this.model.accessToken),
30
- },
31
- })
32
- .then(function (res) { return _this.parse(res.data); })
33
- .catch(function (err) {
34
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
35
- });
36
- };
37
- PhotosSubmodule.prototype.getPhotosSorted = function (filter, sort, skip, limit, includeDownloadLinks) {
38
- var _this = this;
39
- var query = query_string_1.default.stringify(__assign(__assign(__assign(__assign({}, filter), { skip: skip, limit: limit }), sort), { includeDownloadLinks: includeDownloadLinks === true }));
40
- if (skip < 0) {
41
- throw new Error('Invalid skip. Skip should be positive. Provided skip was: ' + skip);
42
- }
43
- return axios_1.default
44
- .get("".concat(this.model.baseUrl, "/photos/sorted?").concat(query), {
45
- headers: {
46
- Authorization: "Bearer ".concat(this.model.accessToken),
47
- },
48
- })
49
- .then(function (res) { return ({
50
- results: res.data.results.map(function (photoJson) { return _this.parse(photoJson); }),
51
- bucketId: res.data.bucketId,
52
- }); })
53
- .catch(function (err) {
54
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
55
- });
56
- };
57
- PhotosSubmodule.prototype.getPhotos = function (filter, skip, limit, includeDownloadLinks) {
58
- var _this = this;
59
- if (skip === void 0) { skip = 0; }
60
- if (limit === void 0) { limit = 1; }
61
- var query = query_string_1.default.stringify(__assign(__assign({}, filter), { skip: skip, limit: limit, includeDownloadLinks: includeDownloadLinks }));
62
- if (skip < 0) {
63
- throw new Error('Invalid skip. Skip should be positive. Provided skip was: ' + skip);
64
- }
65
- return axios_1.default
66
- .get("".concat(this.model.baseUrl, "/photos/?").concat(query), {
67
- headers: {
68
- Authorization: "Bearer ".concat(this.model.accessToken),
69
- },
70
- })
71
- .then(function (res) { return ({
72
- results: res.data.results.map(function (photoJson) { return _this.parse(photoJson); }),
73
- bucketId: res.data.bucketId,
74
- }); })
75
- .catch(function (err) {
76
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
77
- });
78
- };
79
- PhotosSubmodule.prototype.createPhoto = function (data) {
80
- var _this = this;
81
- return axios_1.default
82
- .post("".concat(this.model.baseUrl, "/photos"), data, {
83
- headers: {
84
- Authorization: "Bearer ".concat(this.model.accessToken),
85
- },
86
- })
87
- .then(function (res) { return _this.parse(res.data); })
88
- .catch(function (err) {
89
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
90
- });
91
- };
92
- PhotosSubmodule.prototype.findOrCreatePhoto = function (data) {
93
- var _this = this;
94
- return axios_1.default
95
- .post("".concat(this.model.baseUrl, "/photos/photo/exists"), data, {
96
- headers: {
97
- Authorization: "Bearer ".concat(this.model.accessToken),
98
- },
99
- })
100
- .then(function (res) { return _this.parse(res.data); })
101
- .catch(function (err) {
102
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
103
- });
104
- };
105
- PhotosSubmodule.prototype.deletePhotosById = function (photos) {
106
- return axios_1.default
107
- .delete("".concat(this.model.baseUrl, "/photos/photos"), {
108
- headers: {
109
- Authorization: "Bearer ".concat(this.model.accessToken),
110
- },
111
- data: {
112
- photos: photos,
113
- },
114
- })
115
- .then(function () { return undefined; })
116
- .catch(function (err) {
117
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
118
- });
119
- };
120
- PhotosSubmodule.prototype.deletePhotoById = function (photoId) {
121
- return axios_1.default
122
- .delete("".concat(this.model.baseUrl, "/photos/").concat(photoId), {
123
- headers: {
124
- Authorization: "Bearer ".concat(this.model.accessToken),
125
- },
126
- })
127
- .then(function () { return undefined; })
128
- .catch(function (err) {
129
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
130
- });
131
- };
132
- PhotosSubmodule.prototype.trashPhotosById = function (photos) {
133
- return axios_1.default
134
- .post("".concat(this.model.baseUrl, "/photos/photos/trash"), {
135
- photos: photos,
136
- }, {
137
- headers: {
138
- Authorization: "Bearer ".concat(this.model.accessToken),
139
- },
140
- })
141
- .then(function () { return undefined; })
142
- .catch(function (err) {
143
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
144
- });
145
- };
146
- PhotosSubmodule.prototype.trashPhotoById = function (photoId) {
147
- return axios_1.default
148
- .post("".concat(this.model.baseUrl, "/photos/").concat(photoId, "/trash"), {}, {
149
- headers: {
150
- Authorization: "Bearer ".concat(this.model.accessToken),
151
- },
152
- })
153
- .then(function () { return undefined; })
154
- .catch(function (err) {
155
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
156
- });
157
- };
158
- PhotosSubmodule.prototype.getUsage = function () {
159
- return axios_1.default
160
- .get("".concat(this.model.baseUrl, "/photos/usage"), {
161
- headers: {
162
- Authorization: "Bearer ".concat(this.model.accessToken),
163
- },
164
- })
165
- .then(function (result) {
166
- return result.data;
167
- })
168
- .catch(function (err) {
169
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
170
- });
171
- };
172
- PhotosSubmodule.prototype.photosExists = function (photosExistPayload) {
173
- var _this = this;
174
- return axios_1.default
175
- .post("".concat(this.model.baseUrl, "/photos/exists"), { photos: photosExistPayload }, {
176
- headers: {
177
- Authorization: "Bearer ".concat(this.model.accessToken),
178
- },
179
- })
180
- .then(function (res) {
181
- return res.data.photos.map(function (result) {
182
- if ('id' in result) {
183
- return __assign(__assign({}, _this.parse(result)), { exists: true });
184
- }
185
- else {
186
- return __assign(__assign({}, result), { takenAt: new Date(result.takenAt) });
187
- }
188
- });
189
- })
190
- .catch(function (err) {
191
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
192
- });
193
- };
194
- PhotosSubmodule.prototype.updatePhoto = function (photoId, data) {
195
- return axios_1.default
196
- .patch("".concat(this.model.baseUrl, "/photos/").concat(photoId), data, {
197
- headers: {
198
- Authorization: "Bearer ".concat(this.model.accessToken),
199
- },
200
- })
201
- .then(function (result) {
202
- return result.data;
203
- })
204
- .catch(function (err) {
205
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
206
- });
207
- };
208
- PhotosSubmodule.prototype.getCount = function () {
209
- return axios_1.default
210
- .get("".concat(this.model.baseUrl, "/photos/count"), {
211
- headers: {
212
- Authorization: "Bearer ".concat(this.model.accessToken),
213
- },
214
- })
215
- .then(function (result) { return result.data; })
216
- .catch(function (err) {
217
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
218
- });
219
- };
220
- PhotosSubmodule.prototype.parse = function (json) {
221
- return __assign(__assign({}, json), { takenAt: new Date(json.takenAt), statusChangedAt: new Date(json.statusChangedAt), createdAt: new Date(json.createdAt), updatedAt: new Date(json.updatedAt) });
222
- };
223
- return PhotosSubmodule;
224
- }());
225
- exports.default = PhotosSubmodule;
@@ -1,8 +0,0 @@
1
- import { CreatePhotoShareBody, PhotosSdkModel } from '..';
2
- import { GetPhotoShareResponse, Share } from '../types';
3
- export default class SharesSubmodule {
4
- private model;
5
- constructor(model: PhotosSdkModel);
6
- getShare(id: string, code: string): Promise<GetPhotoShareResponse>;
7
- createShare(body: CreatePhotoShareBody): Promise<Share>;
8
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var axios_1 = __importDefault(require("axios"));
7
- var utils_1 = require("../../utils");
8
- var SharesSubmodule = /** @class */ (function () {
9
- function SharesSubmodule(model) {
10
- this.model = model;
11
- }
12
- SharesSubmodule.prototype.getShare = function (id, code) {
13
- return axios_1.default
14
- .get("".concat(this.model.baseUrl, "/shares/").concat(id, "?code=").concat(code))
15
- .then(function (response) { return response.data; })
16
- .catch(function (err) {
17
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
18
- });
19
- };
20
- SharesSubmodule.prototype.createShare = function (body) {
21
- return axios_1.default
22
- .post("".concat(this.model.baseUrl, "/shares"), body, {
23
- headers: {
24
- Authorization: "Bearer ".concat(this.model.accessToken),
25
- },
26
- })
27
- .then(function (response) { return response.data; })
28
- .catch(function (err) {
29
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
30
- });
31
- };
32
- return SharesSubmodule;
33
- }());
34
- exports.default = SharesSubmodule;
@@ -1,154 +0,0 @@
1
- export interface PhotosSdkModel {
2
- baseUrl: string;
3
- accessToken?: string;
4
- }
5
- export type UserId = string;
6
- export interface User {
7
- id: UserId;
8
- uuid: string;
9
- bucketId: string;
10
- createdAt: Date;
11
- updatedAt: Date;
12
- }
13
- export interface UserJSON extends Omit<User, 'createdAt' | 'updatedAt'> {
14
- createdAt: string;
15
- updatedAt: string;
16
- }
17
- export interface InitializeUserData {
18
- mac: string;
19
- name: string;
20
- bridgeUser: string;
21
- bridgePassword: string;
22
- }
23
- export type DeviceId = string;
24
- export interface Device {
25
- id: DeviceId;
26
- mac: string;
27
- name: string;
28
- userId: string;
29
- newestDate: Date;
30
- oldestDate: Date | null;
31
- createdAt: Date;
32
- updatedAt: Date;
33
- }
34
- export interface DeviceJSON extends Omit<Device, 'newestDate' | 'oldestDate' | 'createdAt' | 'updatedAt'> {
35
- newestDate: string;
36
- oldestDate: string | null;
37
- createdAt: string;
38
- updatedAt: string;
39
- }
40
- export interface CreateDeviceData {
41
- mac: string;
42
- name: string;
43
- userId: string;
44
- }
45
- export declare enum PhotoStatus {
46
- Exists = "EXISTS",
47
- Trashed = "TRASHED",
48
- Deleted = "DELETED"
49
- }
50
- export declare enum PhotosSortBy {
51
- UpdatedAt = "updatedAt",
52
- TakenAt = "takenAt"
53
- }
54
- export type FileId = string;
55
- export type PhotoId = string;
56
- export type PhotoPreviewType = 'PNG' | 'JPEG';
57
- export declare enum PhotosItemType {
58
- PHOTO = "PHOTO",
59
- VIDEO = "VIDEO"
60
- }
61
- export interface Photo {
62
- id: PhotoId;
63
- name: string;
64
- type: string;
65
- size: number;
66
- width: number;
67
- height: number;
68
- fileId: FileId;
69
- previewId: FileId;
70
- previews?: {
71
- width: number;
72
- height: number;
73
- size: number;
74
- fileId: FileId;
75
- type: PhotoPreviewType;
76
- }[];
77
- deviceId: DeviceId;
78
- userId: string;
79
- status: PhotoStatus;
80
- statusChangedAt: Date;
81
- hash: string;
82
- takenAt: Date;
83
- createdAt: Date;
84
- updatedAt: Date;
85
- duration?: number;
86
- itemType: PhotosItemType;
87
- networkBucketId?: string;
88
- }
89
- export interface UpdatePhotoPayload {
90
- previews?: {
91
- width: number;
92
- height: number;
93
- size: number;
94
- fileId: FileId;
95
- type: PhotoPreviewType;
96
- }[];
97
- }
98
- export interface PhotoWithDownloadLink extends Photo {
99
- previewLink: string;
100
- previewIndex: string;
101
- }
102
- export interface PhotoJSON extends Omit<Photo, 'statusChangedAt' | 'takenAt' | 'createdAt' | 'updatedAt'> {
103
- statusChangedAt: string;
104
- takenAt: string;
105
- createdAt: string;
106
- updatedAt: string;
107
- }
108
- export type CreatePhotoData = Omit<Photo, 'id' | 'status' | 'statusChangedAt' | 'createdAt' | 'updatedAt'> & {
109
- networkBucketId: string;
110
- };
111
- export type ShareId = string;
112
- export interface Share {
113
- id: ShareId;
114
- bucket: string;
115
- photoIds: PhotoId[];
116
- token: string;
117
- views: number;
118
- createdAt: Date;
119
- updatedAt: Date;
120
- }
121
- export interface ShareJSON extends Omit<Share, 'createdAt' | 'updatedAt'> {
122
- createdAt: string;
123
- updatedAt: string;
124
- }
125
- export type CreatePhotoShareBody = Pick<Share, 'views' | 'photoIds' | 'bucket' | 'token'> & {
126
- encryptedMnemonic: string;
127
- };
128
- export type GetPhotoShareResponse = Share & {
129
- photos: (Pick<Photo, 'fileId' | 'name' | 'size' | 'type'> & {
130
- decryptionKey: string;
131
- })[];
132
- };
133
- export type PhotoExistsPayload = {
134
- hash: string;
135
- name: string;
136
- takenAt: string;
137
- };
138
- export type PhotoExistsDataJSON = (PhotoExistsPayload | PhotoJSON) & {
139
- exists: boolean;
140
- };
141
- export type PhotoExistsData = ((Omit<PhotoExistsPayload, 'takenAt'> & {
142
- takenAt: Date;
143
- }) | Photo) & {
144
- exists: boolean;
145
- };
146
- export type PhotosUsage = {
147
- usage: number;
148
- };
149
- export type PhotosCount = {
150
- existent: number;
151
- trashed: number;
152
- deleted: number;
153
- total: number;
154
- };
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PhotosItemType = exports.PhotosSortBy = exports.PhotoStatus = void 0;
4
- var PhotoStatus;
5
- (function (PhotoStatus) {
6
- PhotoStatus["Exists"] = "EXISTS";
7
- PhotoStatus["Trashed"] = "TRASHED";
8
- PhotoStatus["Deleted"] = "DELETED";
9
- })(PhotoStatus = exports.PhotoStatus || (exports.PhotoStatus = {}));
10
- var PhotosSortBy;
11
- (function (PhotosSortBy) {
12
- PhotosSortBy["UpdatedAt"] = "updatedAt";
13
- PhotosSortBy["TakenAt"] = "takenAt";
14
- })(PhotosSortBy = exports.PhotosSortBy || (exports.PhotosSortBy = {}));
15
- var PhotosItemType;
16
- (function (PhotosItemType) {
17
- PhotosItemType["PHOTO"] = "PHOTO";
18
- PhotosItemType["VIDEO"] = "VIDEO";
19
- })(PhotosItemType = exports.PhotosItemType || (exports.PhotosItemType = {}));
@@ -1,7 +0,0 @@
1
- import { InitializeUserData, PhotosSdkModel, User } from '..';
2
- export default class UsersSubmodule {
3
- private model;
4
- constructor(model: PhotosSdkModel);
5
- initialize(data: InitializeUserData): Promise<User>;
6
- private parse;
7
- }
@@ -1,46 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- var axios_1 = __importDefault(require("axios"));
18
- var utils_1 = require("../../utils");
19
- var UsersSubmodule = /** @class */ (function () {
20
- function UsersSubmodule(model) {
21
- this.model = model;
22
- }
23
- UsersSubmodule.prototype.initialize = function (data) {
24
- var _this = this;
25
- return axios_1.default
26
- .post("".concat(this.model.baseUrl, "/users"), {
27
- mac: data.mac,
28
- name: data.name,
29
- }, {
30
- headers: {
31
- Authorization: "Bearer ".concat(this.model.accessToken),
32
- 'internxt-network-pass': data.bridgePassword,
33
- 'internxt-network-user': data.bridgeUser,
34
- },
35
- })
36
- .then(function (res) { return _this.parse(res.data); })
37
- .catch(function (err) {
38
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
39
- });
40
- };
41
- UsersSubmodule.prototype.parse = function (json) {
42
- return __assign(__assign({}, json), { createdAt: new Date(json.createdAt), updatedAt: new Date(json.updatedAt) });
43
- };
44
- return UsersSubmodule;
45
- }());
46
- exports.default = UsersSubmodule;