@internxt/sdk 1.11.17 → 1.11.18

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.
@@ -3,7 +3,7 @@ import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
3
3
  import { RequestCanceler } from '../../shared/http/client';
4
4
  import { UUID } from '../../shared/types/userSettings';
5
5
  import { ItemType } from './../../workspaces/types';
6
- import { AddItemsToTrashPayload, CheckDuplicatedFilesPayload, CheckDuplicatedFilesResponse, CheckDuplicatedFolderPayload, CheckDuplicatedFoldersResponse, CreateFolderByUuidPayload, CreateFolderPayload, CreateFolderResponse, CreateThumbnailEntryPayload, 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, UsageResponseV2 } from './types';
6
+ import { AddItemsToTrashPayload, CheckDuplicatedFilesPayload, CheckDuplicatedFilesResponse, CheckDuplicatedFolderPayload, CheckDuplicatedFoldersResponse, CreateFolderByUuidPayload, CreateFolderPayload, CreateFolderResponse, CreateThumbnailEntryPayload, DeleteFilePayload, DriveFileData, FetchFolderContentResponse, FetchLimitResponse, FetchPaginatedFilesContent, FetchPaginatedFolderContentResponse, FetchPaginatedFoldersContent, FileEntry, FileEntryByUuid, FileMeta, FileVersion, FolderAncestor, FolderAncestorWorkspace, FolderMeta, FolderTreeResponse, MoveFilePayload, MoveFileResponse, MoveFileUuidPayload, MoveFolderPayload, MoveFolderResponse, MoveFolderUuidPayload, ReplaceFile, SearchResultData, Thumbnail, ThumbnailEntry, UpdateFilePayload, UpdateFolderMetadataPayload, UsageResponse, UsageResponseV2 } from './types';
7
7
  export * as StorageTypes from './types';
8
8
  export declare class Storage {
9
9
  private readonly client;
@@ -364,4 +364,27 @@ export declare class Storage {
364
364
  * @returns {Promise<FileMeta>} A promise that resolves the file on that path.
365
365
  */
366
366
  getFileByPath(filePath: string): Promise<FileMeta>;
367
+ /**
368
+ * Gets all versions of a file
369
+ *
370
+ * @param {string} uuid - The UUID of the file.
371
+ * @returns {Promise<FileVersion[]>} A promise that resolves with an array of file versions.
372
+ */
373
+ getFileVersions(uuid: string): Promise<FileVersion[]>;
374
+ /**
375
+ * Deletes a specific version of a file
376
+ *
377
+ * @param {string} uuid - The UUID of the file.
378
+ * @param {string} versionId - The UUID of the version to delete.
379
+ * @returns {Promise<void>} A promise that resolves when the version is deleted.
380
+ */
381
+ deleteFileVersion(uuid: string, versionId: string): Promise<void>;
382
+ /**
383
+ * Restores a file to a specific version
384
+ *
385
+ * @param {string} uuid - The UUID of the file.
386
+ * @param {string} versionId - The UUID of the version to restore.
387
+ * @returns {Promise<FileVersion>} A promise that resolves with the restored version.
388
+ */
389
+ restoreFileVersion(uuid: string, versionId: string): Promise<FileVersion>;
367
390
  }
@@ -702,6 +702,35 @@ var Storage = /** @class */ (function () {
702
702
  Storage.prototype.getFileByPath = function (filePath) {
703
703
  return this.client.get("files/meta?path=".concat(filePath), this.headers());
704
704
  };
705
+ /**
706
+ * Gets all versions of a file
707
+ *
708
+ * @param {string} uuid - The UUID of the file.
709
+ * @returns {Promise<FileVersion[]>} A promise that resolves with an array of file versions.
710
+ */
711
+ Storage.prototype.getFileVersions = function (uuid) {
712
+ return this.client.get("/files/".concat(uuid, "/versions"), this.headers());
713
+ };
714
+ /**
715
+ * Deletes a specific version of a file
716
+ *
717
+ * @param {string} uuid - The UUID of the file.
718
+ * @param {string} versionId - The UUID of the version to delete.
719
+ * @returns {Promise<void>} A promise that resolves when the version is deleted.
720
+ */
721
+ Storage.prototype.deleteFileVersion = function (uuid, versionId) {
722
+ return this.client.delete("/files/".concat(uuid, "/versions/").concat(versionId), this.headers());
723
+ };
724
+ /**
725
+ * Restores a file to a specific version
726
+ *
727
+ * @param {string} uuid - The UUID of the file.
728
+ * @param {string} versionId - The UUID of the version to restore.
729
+ * @returns {Promise<FileVersion>} A promise that resolves with the restored version.
730
+ */
731
+ Storage.prototype.restoreFileVersion = function (uuid, versionId) {
732
+ return this.client.post("/files/".concat(uuid, "/versions/").concat(versionId, "/restore"), {}, this.headers());
733
+ };
705
734
  return Storage;
706
735
  }());
707
736
  exports.Storage = Storage;
@@ -419,3 +419,16 @@ export interface CheckDuplicatedFolderPayload {
419
419
  export interface CheckDuplicatedFoldersResponse {
420
420
  existentFolders: DriveFolderData[];
421
421
  }
422
+ export declare enum FileVersionStatus {
423
+ EXISTS = "EXISTS",
424
+ DELETED = "DELETED"
425
+ }
426
+ export interface FileVersion {
427
+ id: string;
428
+ fileId: string;
429
+ networkFileId: string;
430
+ size: bigint;
431
+ status: FileVersionStatus;
432
+ createdAt: Date;
433
+ updatedAt: Date;
434
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EncryptionVersion = exports.FileStatus = void 0;
3
+ exports.FileVersionStatus = exports.EncryptionVersion = exports.FileStatus = void 0;
4
4
  var FileStatus;
5
5
  (function (FileStatus) {
6
6
  FileStatus["EXISTS"] = "EXISTS";
@@ -11,3 +11,8 @@ var EncryptionVersion;
11
11
  (function (EncryptionVersion) {
12
12
  EncryptionVersion["Aes03"] = "03-aes";
13
13
  })(EncryptionVersion || (exports.EncryptionVersion = EncryptionVersion = {}));
14
+ var FileVersionStatus;
15
+ (function (FileVersionStatus) {
16
+ FileVersionStatus["EXISTS"] = "EXISTS";
17
+ FileVersionStatus["DELETED"] = "DELETED";
18
+ })(FileVersionStatus || (exports.FileVersionStatus = FileVersionStatus = {}));
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.11.17",
4
+ "version": "1.11.18",
5
5
  "description": "An sdk for interacting with Internxt's services",
6
6
  "repository": {
7
7
  "type": "git",