@internxt/sdk 1.9.4 → 1.9.6

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.
@@ -86,11 +86,11 @@ var Auth = /** @class */ (function () {
86
86
  keys: {
87
87
  ecc: {
88
88
  publicKey: registerDetails.keys.ecc.publicKey,
89
- privateKeyEncrypted: registerDetails.keys.ecc.privateKeyEncrypted,
89
+ privateKey: registerDetails.keys.ecc.privateKeyEncrypted,
90
90
  },
91
91
  kyber: {
92
92
  publicKey: registerDetails.keys.kyber.publicKey,
93
- privateKeyEncrypted: registerDetails.keys.kyber.privateKeyEncrypted,
93
+ privateKey: registerDetails.keys.kyber.privateKeyEncrypted,
94
94
  },
95
95
  },
96
96
  referral: registerDetails.referral,
@@ -120,11 +120,11 @@ var Auth = /** @class */ (function () {
120
120
  keys: {
121
121
  ecc: {
122
122
  publicKey: registerDetails.keys.ecc.publicKey,
123
- privateKeyEncrypted: registerDetails.keys.ecc.privateKeyEncrypted,
123
+ privateKey: registerDetails.keys.ecc.privateKeyEncrypted,
124
124
  },
125
125
  kyber: {
126
126
  publicKey: registerDetails.keys.kyber.publicKey,
127
- privateKeyEncrypted: registerDetails.keys.kyber.privateKeyEncrypted,
127
+ privateKey: registerDetails.keys.kyber.privateKeyEncrypted,
128
128
  },
129
129
  },
130
130
  referral: registerDetails.referral,
@@ -184,11 +184,11 @@ var Auth = /** @class */ (function () {
184
184
  keys: {
185
185
  ecc: {
186
186
  publicKey: keys.ecc.publicKey,
187
- privateKeyEncrypted: keys.ecc.privateKeyEncrypted,
187
+ privateKey: keys.ecc.privateKeyEncrypted,
188
188
  },
189
189
  kyber: {
190
190
  publicKey: keys.kyber.publicKey,
191
- privateKeyEncrypted: keys.kyber.privateKeyEncrypted,
191
+ privateKey: keys.kyber.privateKeyEncrypted,
192
192
  },
193
193
  },
194
194
  }, this.basicHeaders())
@@ -217,11 +217,11 @@ var Auth = /** @class */ (function () {
217
217
  revocationKey: keys.revocationCertificate,
218
218
  ecc: {
219
219
  publicKey: keys.ecc.publicKey,
220
- privateKeyEncrypted: keys.ecc.privateKeyEncrypted,
220
+ privateKey: keys.ecc.privateKeyEncrypted,
221
221
  },
222
222
  kyber: {
223
223
  publicKey: keys.kyber.publicKey,
224
- privateKeyEncrypted: keys.kyber.privateKeyEncrypted,
224
+ privateKey: keys.kyber.privateKeyEncrypted,
225
225
  },
226
226
  }, this.headersWithToken(token));
227
227
  };
@@ -1,5 +1,6 @@
1
1
  import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
2
2
  import { AcceptInvitationToSharedFolderPayload, CreateSharingPayload, GenerateShareLinkPayload, GetShareLinkFolderSizePayload, GetSharedDirectoryPayload, ListAllSharedFoldersResponse, ListPrivateSharedFoldersResponse, ListShareLinksResponse, ListSharedItemsResponse, PublicSharedItemInfo, RemoveUserRolePayload, Role, ShareDomainsResponse, ShareFolderWithUserPayload, ShareLink, SharedFolderSize, SharedFolderUser, SharedFoldersInvitationsAsInvitedUserResponse, SharingInvite, SharingMeta, UpdateShareLinkPayload, UpdateUserRolePayload, UpdateUserRoleResponse } from './types';
3
+ import { ItemType } from 'src/workspaces';
3
4
  export * as ShareTypes from './types';
4
5
  export declare class Share {
5
6
  private readonly client;
@@ -158,9 +159,9 @@ export declare class Share {
158
159
  * @param {string} itemType - The itemType of the folder (file | folder).
159
160
  * @returns {Promise<{ data: SharingInvite[] }>} A promise containing the private folder data.
160
161
  */
161
- getSharedFolderInvitations({ itemId, itemType, }: {
162
+ getSharedFolderInvitations({ itemId, itemType }: {
162
163
  itemId: string;
163
- itemType: 'folder' | 'file';
164
+ itemType: ItemType;
164
165
  }): Promise<any[]>;
165
166
  /**
166
167
  * Get all invitations for a user.
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
3
  import { FolderChild } from '../storage/types';
4
+ import { ItemType } from './../../workspaces/types';
4
5
  export interface GenerateShareLinkPayload {
5
6
  itemId: string;
6
7
  type: string;
@@ -70,6 +71,20 @@ export interface SharedDirectoryFile {
70
71
  export interface ShareDomainsResponse {
71
72
  list: string[];
72
73
  }
74
+ export interface WorkspaceItemUser {
75
+ id: string;
76
+ itemId: string;
77
+ itemType: ItemType;
78
+ workspaceId: string;
79
+ createdAt: string | null;
80
+ updatedAt: string | null;
81
+ creator: {
82
+ uuid: string;
83
+ name: string;
84
+ lastname: string;
85
+ email: string;
86
+ };
87
+ }
73
88
  export type ListShareLinksItem = Pick<ShareLink, 'id' | 'token' | 'views' | 'timesValid' | 'active' | 'isFolder' | 'createdAt' | 'updatedAt' | 'fileSize'> & {
74
89
  item: unknown;
75
90
  };
@@ -118,6 +133,7 @@ export type SharedFolders = {
118
133
  };
119
134
  userId: number;
120
135
  uuid: string;
136
+ token: string | null;
121
137
  };
122
138
  export type SharedFiles = {
123
139
  bucket: string | null;
@@ -141,8 +157,16 @@ export type SharedFiles = {
141
157
  thumbnails: [];
142
158
  type: string;
143
159
  updatedAt: string;
160
+ user: {
161
+ avatar: string | null;
162
+ email: string;
163
+ lastname: string;
164
+ name: string;
165
+ uuid: string;
166
+ };
144
167
  userId: number;
145
168
  uuid: string;
169
+ token: string | null;
146
170
  };
147
171
  export type ListSharedItemsResponse = {
148
172
  credentials: {
@@ -165,7 +189,7 @@ export type ListAllSharedFoldersResponse = {
165
189
  };
166
190
  export type ShareFolderWithUserPayload = {
167
191
  itemId: string;
168
- itemType: 'folder' | 'file';
192
+ itemType: ItemType;
169
193
  notifyUser: boolean;
170
194
  notificationMessage?: string;
171
195
  sharedWith: string;
@@ -176,7 +200,7 @@ export type ShareFolderWithUserPayload = {
176
200
  };
177
201
  export type CreateSharingPayload = {
178
202
  itemId: string;
179
- itemType: 'folder' | 'file';
203
+ itemType: ItemType;
180
204
  encryptionKey: string;
181
205
  encryptionAlgorithm: string;
182
206
  encryptedCode: string;
@@ -326,7 +350,7 @@ export type SharingInvitation = {
326
350
  export type SharingInvite = {
327
351
  id: string;
328
352
  itemId: string;
329
- itemType: 'file' | 'folder';
353
+ itemType: ItemType;
330
354
  sharedWith: string;
331
355
  encryptionKey: string;
332
356
  encryptionAlgorithm: string;
@@ -338,7 +362,7 @@ export type SharingInvite = {
338
362
  export type SharingMeta = {
339
363
  id: string;
340
364
  itemId: string;
341
- itemType: 'file' | 'folder';
365
+ itemType: ItemType;
342
366
  ownerId: string;
343
367
  sharedWith: string;
344
368
  encryptionKey: string;
@@ -2,7 +2,8 @@ import { Token } from '../../auth';
2
2
  import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
3
3
  import { RequestCanceler } from '../../shared/http/client';
4
4
  import { UUID } from '../../shared/types/userSettings';
5
- import { AddItemsToTrashPayload, CheckDuplicatedFilesPayload, CheckDuplicatedFilesResponse, CheckDuplicatedFolderPayload, CheckDuplicatedFoldersResponse, CreateFolderByUuidPayload, CreateFolderPayload, CreateFolderResponse, DeleteFilePayload, DriveFileData, FetchFolderContentResponse, FetchLimitResponse, FetchPaginatedFilesContent, FetchPaginatedFolderContentResponse, FetchPaginatedFoldersContent, FileEntry, FileEntryByUuid, FileMeta, FolderAncestor, FolderMeta, FolderTreeResponse, MoveFilePayload, MoveFileResponse, MoveFileUuidPayload, MoveFolderPayload, MoveFolderResponse, MoveFolderUuidPayload, ReplaceFile, SearchResultData, Thumbnail, ThumbnailEntry, UpdateFilePayload, UpdateFolderMetadataPayload, UsageResponse } from './types';
5
+ import { ItemType } from './../../workspaces/types';
6
+ import { AddItemsToTrashPayload, CheckDuplicatedFilesPayload, CheckDuplicatedFilesResponse, CheckDuplicatedFolderPayload, CheckDuplicatedFoldersResponse, CreateFolderByUuidPayload, CreateFolderPayload, CreateFolderResponse, DeleteFilePayload, DriveFileData, FetchFolderContentResponse, FetchLimitResponse, FetchPaginatedFilesContent, FetchPaginatedFolderContentResponse, FetchPaginatedFoldersContent, FileEntry, FileEntryByUuid, FileMeta, FolderAncestor, FolderAncestorWorkspace, FolderMeta, FolderTreeResponse, MoveFilePayload, MoveFileResponse, MoveFileUuidPayload, MoveFolderPayload, MoveFolderResponse, MoveFolderUuidPayload, ReplaceFile, SearchResultData, Thumbnail, ThumbnailEntry, UpdateFilePayload, UpdateFolderMetadataPayload, UsageResponse } from './types';
6
7
  export * as StorageTypes from './types';
7
8
  export declare class Storage {
8
9
  private readonly client;
@@ -244,10 +245,18 @@ export declare class Storage {
244
245
  * Gets the ancestors of a given folder UUID
245
246
  *
246
247
  * @param {string} uuid - UUID of the folder.
247
- * @param {boolean} [isShared=false] - Whether the folder is a shared item or not.
248
248
  * @returns {Promise<FolderAncestor[]>} A promise that resolves with an array of ancestors of the given folder.
249
249
  */
250
- getFolderAncestors(uuid: string, isShared?: boolean): Promise<FolderAncestor[]>;
250
+ getFolderAncestors(uuid: string): Promise<FolderAncestor[]>;
251
+ /**
252
+ * Gets the ancestors of an item with the given UUID and type in a Workspace
253
+ *
254
+ * @param {string} workspaceId - UUID of the workspace.
255
+ * @param {string} itemType - itemType to know if the item is file or folder
256
+ * @param {string} uuid - UUID of the item.
257
+ * @returns {Promise<FolderAncestor[]>} A promise that resolves with an array of ancestors of the given folder.
258
+ */
259
+ getFolderAncestorsInWorkspace(workspaceId: string, itemType: ItemType, uuid: string, resourcesToken?: Token): Promise<FolderAncestorWorkspace[]>;
251
260
  /**
252
261
  * Gets the meta of a given folder UUID
253
262
  *
@@ -521,12 +521,21 @@ var Storage = /** @class */ (function () {
521
521
  * Gets the ancestors of a given folder UUID
522
522
  *
523
523
  * @param {string} uuid - UUID of the folder.
524
- * @param {boolean} [isShared=false] - Whether the folder is a shared item or not.
525
524
  * @returns {Promise<FolderAncestor[]>} A promise that resolves with an array of ancestors of the given folder.
526
525
  */
527
- Storage.prototype.getFolderAncestors = function (uuid, isShared) {
528
- if (isShared === void 0) { isShared = false; }
529
- return this.client.get("folders/".concat(uuid, "/ancestors?isSharedItem=").concat(isShared), this.headers());
526
+ Storage.prototype.getFolderAncestors = function (uuid) {
527
+ return this.client.get("folders/".concat(uuid, "/ancestors"), this.headers());
528
+ };
529
+ /**
530
+ * Gets the ancestors of an item with the given UUID and type in a Workspace
531
+ *
532
+ * @param {string} workspaceId - UUID of the workspace.
533
+ * @param {string} itemType - itemType to know if the item is file or folder
534
+ * @param {string} uuid - UUID of the item.
535
+ * @returns {Promise<FolderAncestor[]>} A promise that resolves with an array of ancestors of the given folder.
536
+ */
537
+ Storage.prototype.getFolderAncestorsInWorkspace = function (workspaceId, itemType, uuid, resourcesToken) {
538
+ return this.client.get("workspaces/".concat(workspaceId, "/").concat(itemType, "/").concat(uuid, "/ancestors"), (0, headers_1.addResourcesTokenToHeaders)(this.headers(), resourcesToken));
530
539
  };
531
540
  /**
532
541
  * Gets the meta of a given folder UUID
@@ -1,4 +1,5 @@
1
1
  import { SharingMeta } from '../share/types';
2
+ import { UserResumeData } from '../users/types';
2
3
  export interface DriveFolderData {
3
4
  id: number;
4
5
  bucket: string | null;
@@ -18,6 +19,7 @@ export interface DriveFolderData {
18
19
  userId: number;
19
20
  user_id: number;
20
21
  uuid: string;
22
+ user?: UserResumeData;
21
23
  }
22
24
  export interface DriveFileData {
23
25
  bucket: string;
@@ -46,6 +48,7 @@ export interface DriveFileData {
46
48
  id: string;
47
49
  }[];
48
50
  uuid: string;
51
+ user?: UserResumeData;
49
52
  }
50
53
  export interface Thumbnail {
51
54
  id: number;
@@ -402,6 +405,10 @@ export interface FolderAncestor {
402
405
  userId: number;
403
406
  uuid: string;
404
407
  }
408
+ export interface FolderAncestorWorkspace {
409
+ uuid: string;
410
+ plainName: string;
411
+ }
405
412
  export interface FolderMeta {
406
413
  id: number;
407
414
  uuid: string;
@@ -1,4 +1,11 @@
1
1
  import { UUID, UserSettings } from '../../shared/types/userSettings';
2
+ export interface UserResumeData {
3
+ avatar: string | null;
4
+ email: string;
5
+ lastname: string | null;
6
+ name: string;
7
+ uuid: string;
8
+ }
2
9
  export type Token = string;
3
10
  export interface InitializeUserResponse {
4
11
  email: string;
@@ -31,7 +38,10 @@ export interface ChangePasswordPayloadNew {
31
38
  export type UpdateProfilePayload = Partial<Pick<UserSettings, 'name' | 'lastname'>>;
32
39
  export type PreCreateUserResponse = {
33
40
  publicKey: string;
34
- publicKyberKey?: string;
41
+ keys?: {
42
+ ecc: string;
43
+ kyber: string;
44
+ };
35
45
  user: {
36
46
  uuid: UUID;
37
47
  email: string;
@@ -45,7 +55,10 @@ export type FriendInvite = {
45
55
  };
46
56
  export type UserPublicKeyResponse = {
47
57
  publicKey: string;
48
- publicKyberKey?: string;
58
+ keys?: {
59
+ ecc: string;
60
+ kyber: string;
61
+ };
49
62
  };
50
63
  export type VerifyEmailChangeResponse = {
51
64
  oldEmail: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@internxt/sdk",
3
3
  "author": "Internxt <hello@internxt.com>",
4
- "version": "1.9.4",
4
+ "version": "1.9.6",
5
5
  "description": "An sdk for interacting with Internxt's services",
6
6
  "repository": {
7
7
  "type": "git",