@protontech/drive-sdk 0.0.13 → 0.1.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.
- package/dist/cache/index.d.ts +1 -0
- package/dist/cache/index.js +3 -1
- package/dist/cache/index.js.map +1 -1
- package/dist/cache/memoryCache.d.ts +1 -1
- package/dist/cache/memoryCache.js +0 -1
- package/dist/cache/memoryCache.js.map +1 -1
- package/dist/cache/memoryCache.test.js +2 -4
- package/dist/cache/memoryCache.test.js.map +1 -1
- package/dist/cache/nullCache.d.ts +14 -0
- package/dist/cache/nullCache.js +36 -0
- package/dist/cache/nullCache.js.map +1 -0
- package/dist/config.d.ts +16 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/crypto/driveCrypto.d.ts +2 -5
- package/dist/crypto/driveCrypto.js +7 -12
- package/dist/crypto/driveCrypto.js.map +1 -1
- package/dist/crypto/driveCrypto.test.js +14 -14
- package/dist/crypto/openPGPCrypto.js +5 -3
- package/dist/crypto/openPGPCrypto.js.map +1 -1
- package/dist/diagnostic/eventsGenerator.d.ts +14 -0
- package/dist/diagnostic/eventsGenerator.js +49 -0
- package/dist/diagnostic/eventsGenerator.js.map +1 -0
- package/dist/diagnostic/httpClient.d.ts +16 -0
- package/dist/diagnostic/httpClient.js +81 -0
- package/dist/diagnostic/httpClient.js.map +1 -0
- package/dist/diagnostic/index.d.ts +10 -0
- package/dist/diagnostic/index.js +35 -0
- package/dist/diagnostic/index.js.map +1 -0
- package/dist/diagnostic/integrityVerificationStream.d.ts +21 -0
- package/dist/diagnostic/integrityVerificationStream.js +56 -0
- package/dist/diagnostic/integrityVerificationStream.js.map +1 -0
- package/dist/diagnostic/interface.d.ts +102 -0
- package/dist/diagnostic/interface.js +3 -0
- package/dist/diagnostic/interface.js.map +1 -0
- package/dist/diagnostic/sdkDiagnostic.d.ts +22 -0
- package/dist/diagnostic/sdkDiagnostic.js +222 -0
- package/dist/diagnostic/sdkDiagnostic.js.map +1 -0
- package/dist/diagnostic/sdkDiagnosticFull.d.ts +18 -0
- package/dist/diagnostic/sdkDiagnosticFull.js +35 -0
- package/dist/diagnostic/sdkDiagnosticFull.js.map +1 -0
- package/dist/diagnostic/telemetry.d.ts +25 -0
- package/dist/diagnostic/telemetry.js +70 -0
- package/dist/diagnostic/telemetry.js.map +1 -0
- package/dist/diagnostic/zipGenerators.d.ts +9 -0
- package/dist/diagnostic/zipGenerators.js +64 -0
- package/dist/diagnostic/zipGenerators.js.map +1 -0
- package/dist/diagnostic/zipGenerators.test.js +144 -0
- package/dist/diagnostic/zipGenerators.test.js.map +1 -0
- package/dist/errors.d.ts +2 -1
- package/dist/errors.js +3 -1
- package/dist/errors.js.map +1 -1
- package/dist/interface/config.d.ts +26 -0
- package/dist/interface/config.js +3 -0
- package/dist/interface/config.js.map +1 -0
- package/dist/interface/download.d.ts +2 -2
- package/dist/interface/events.d.ts +58 -20
- package/dist/interface/events.js +11 -1
- package/dist/interface/events.js.map +1 -1
- package/dist/interface/httpClient.d.ts +0 -14
- package/dist/interface/index.d.ts +11 -7
- package/dist/interface/index.js +2 -2
- package/dist/interface/index.js.map +1 -1
- package/dist/interface/nodes.d.ts +9 -0
- package/dist/interface/nodes.js.map +1 -1
- package/dist/interface/result.js.map +1 -1
- package/dist/interface/sharing.d.ts +2 -0
- package/dist/interface/sharing.js.map +1 -1
- package/dist/interface/telemetry.js +0 -8
- package/dist/interface/telemetry.js.map +1 -1
- package/dist/interface/thumbnail.js.map +1 -1
- package/dist/interface/upload.d.ts +7 -1
- package/dist/internal/apiService/apiService.d.ts +1 -1
- package/dist/internal/apiService/apiService.js +7 -11
- package/dist/internal/apiService/apiService.js.map +1 -1
- package/dist/internal/apiService/apiService.test.js +55 -48
- package/dist/internal/apiService/apiService.test.js.map +1 -1
- package/dist/internal/apiService/coreTypes.d.ts +2356 -2356
- package/dist/internal/apiService/driveTypes.d.ts +1680 -1680
- package/dist/internal/apiService/errors.js +14 -8
- package/dist/internal/apiService/errors.js.map +1 -1
- package/dist/internal/apiService/errors.test.js +17 -12
- package/dist/internal/apiService/errors.test.js.map +1 -1
- package/dist/internal/apiService/transformers.d.ts +1 -1
- package/dist/internal/apiService/transformers.js +1 -1
- package/dist/internal/asyncIteratorMap.test.js +2 -2
- package/dist/internal/asyncIteratorMap.test.js.map +1 -1
- package/dist/internal/asyncIteratorRace.d.ts +13 -0
- package/dist/internal/asyncIteratorRace.js +59 -0
- package/dist/internal/asyncIteratorRace.js.map +1 -0
- package/dist/internal/asyncIteratorRace.test.d.ts +1 -0
- package/dist/internal/asyncIteratorRace.test.js +119 -0
- package/dist/internal/asyncIteratorRace.test.js.map +1 -0
- package/dist/internal/batch.d.ts +1 -0
- package/dist/internal/batch.js +12 -0
- package/dist/internal/batch.js.map +1 -0
- package/dist/internal/batch.test.d.ts +1 -0
- package/dist/internal/batch.test.js +41 -0
- package/dist/internal/batch.test.js.map +1 -0
- package/dist/internal/batchLoading.js.map +1 -1
- package/dist/internal/batchLoading.test.js +13 -13
- package/dist/internal/batchLoading.test.js.map +1 -1
- package/dist/internal/devices/apiService.d.ts +3 -3
- package/dist/internal/devices/apiService.js +2 -2
- package/dist/internal/devices/apiService.js.map +1 -1
- package/dist/internal/devices/cryptoService.js +1 -2
- package/dist/internal/devices/cryptoService.js.map +1 -1
- package/dist/internal/devices/index.d.ts +5 -5
- package/dist/internal/devices/index.js.map +1 -1
- package/dist/internal/devices/interface.d.ts +3 -3
- package/dist/internal/devices/manager.js +2 -2
- package/dist/internal/devices/manager.js.map +1 -1
- package/dist/internal/devices/manager.test.js +38 -7
- package/dist/internal/devices/manager.test.js.map +1 -1
- package/dist/internal/download/apiService.d.ts +4 -4
- package/dist/internal/download/apiService.js +32 -32
- package/dist/internal/download/apiService.js.map +1 -1
- package/dist/internal/download/cryptoService.d.ts +4 -4
- package/dist/internal/download/cryptoService.js +6 -5
- package/dist/internal/download/cryptoService.js.map +1 -1
- package/dist/internal/download/fileDownloader.d.ts +6 -6
- package/dist/internal/download/fileDownloader.js +3 -2
- package/dist/internal/download/fileDownloader.js.map +1 -1
- package/dist/internal/download/fileDownloader.test.js +1 -1
- package/dist/internal/download/fileDownloader.test.js.map +1 -1
- package/dist/internal/download/index.d.ts +5 -5
- package/dist/internal/download/index.js +5 -5
- package/dist/internal/download/index.js.map +1 -1
- package/dist/internal/download/interface.d.ts +3 -4
- package/dist/internal/download/telemetry.d.ts +3 -3
- package/dist/internal/download/telemetry.js +4 -2
- package/dist/internal/download/telemetry.js.map +1 -1
- package/dist/internal/download/telemetry.test.js +8 -8
- package/dist/internal/download/telemetry.test.js.map +1 -1
- package/dist/internal/download/thumbnailDownloader.d.ts +4 -4
- package/dist/internal/download/thumbnailDownloader.js +6 -6
- package/dist/internal/download/thumbnailDownloader.js.map +1 -1
- package/dist/internal/download/thumbnailDownloader.test.js.map +1 -1
- package/dist/internal/errors.d.ts +1 -1
- package/dist/internal/errors.js +1 -3
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/events/apiService.d.ts +5 -7
- package/dist/internal/events/apiService.js +19 -22
- package/dist/internal/events/apiService.js.map +1 -1
- package/dist/internal/events/coreEventManager.d.ts +9 -12
- package/dist/internal/events/coreEventManager.js +19 -36
- package/dist/internal/events/coreEventManager.js.map +1 -1
- package/dist/internal/events/coreEventManager.test.d.ts +1 -0
- package/dist/internal/events/coreEventManager.test.js +87 -0
- package/dist/internal/events/coreEventManager.test.js.map +1 -0
- package/dist/internal/events/eventManager.d.ts +11 -36
- package/dist/internal/events/eventManager.js +59 -106
- package/dist/internal/events/eventManager.js.map +1 -1
- package/dist/internal/events/eventManager.test.js +177 -83
- package/dist/internal/events/eventManager.test.js.map +1 -1
- package/dist/internal/events/index.d.ts +16 -36
- package/dist/internal/events/index.js +56 -72
- package/dist/internal/events/index.js.map +1 -1
- package/dist/internal/events/interface.d.ts +59 -14
- package/dist/internal/events/interface.js +12 -3
- package/dist/internal/events/interface.js.map +1 -1
- package/dist/internal/events/volumeEventManager.d.ts +9 -19
- package/dist/internal/events/volumeEventManager.js +58 -45
- package/dist/internal/events/volumeEventManager.js.map +1 -1
- package/dist/internal/events/volumeEventManager.test.d.ts +1 -0
- package/dist/internal/events/volumeEventManager.test.js +203 -0
- package/dist/internal/events/volumeEventManager.test.js.map +1 -0
- package/dist/internal/nodes/apiService.d.ts +4 -3
- package/dist/internal/nodes/apiService.js +36 -15
- package/dist/internal/nodes/apiService.js.map +1 -1
- package/dist/internal/nodes/apiService.test.js +60 -41
- package/dist/internal/nodes/apiService.test.js.map +1 -1
- package/dist/internal/nodes/cache.d.ts +14 -5
- package/dist/internal/nodes/cache.js +31 -7
- package/dist/internal/nodes/cache.js.map +1 -1
- package/dist/internal/nodes/cache.test.js +31 -9
- package/dist/internal/nodes/cache.test.js.map +1 -1
- package/dist/internal/nodes/cryptoCache.d.ts +2 -2
- package/dist/internal/nodes/cryptoCache.js.map +1 -1
- package/dist/internal/nodes/cryptoCache.test.js +24 -4
- package/dist/internal/nodes/cryptoCache.test.js.map +1 -1
- package/dist/internal/nodes/cryptoService.d.ts +4 -4
- package/dist/internal/nodes/cryptoService.js +11 -17
- package/dist/internal/nodes/cryptoService.js.map +1 -1
- package/dist/internal/nodes/cryptoService.test.js +320 -241
- package/dist/internal/nodes/cryptoService.test.js.map +1 -1
- package/dist/internal/nodes/events.d.ts +8 -84
- package/dist/internal/nodes/events.js +43 -217
- package/dist/internal/nodes/events.js.map +1 -1
- package/dist/internal/nodes/events.test.js +35 -279
- package/dist/internal/nodes/events.test.js.map +1 -1
- package/dist/internal/nodes/extendedAttributes.d.ts +1 -1
- package/dist/internal/nodes/extendedAttributes.js +3 -1
- package/dist/internal/nodes/extendedAttributes.js.map +1 -1
- package/dist/internal/nodes/extendedAttributes.test.js +7 -10
- package/dist/internal/nodes/extendedAttributes.test.js.map +1 -1
- package/dist/internal/nodes/index.d.ts +12 -13
- package/dist/internal/nodes/index.js +5 -5
- package/dist/internal/nodes/index.js.map +1 -1
- package/dist/internal/nodes/index.test.js +24 -32
- package/dist/internal/nodes/index.test.js.map +1 -1
- package/dist/internal/nodes/interface.d.ts +2 -2
- package/dist/internal/nodes/nodesAccess.d.ts +22 -7
- package/dist/internal/nodes/nodesAccess.js +65 -16
- package/dist/internal/nodes/nodesAccess.js.map +1 -1
- package/dist/internal/nodes/nodesAccess.test.js +165 -101
- package/dist/internal/nodes/nodesAccess.test.js.map +1 -1
- package/dist/internal/nodes/nodesManagement.d.ts +7 -9
- package/dist/internal/nodes/nodesManagement.js +21 -33
- package/dist/internal/nodes/nodesManagement.js.map +1 -1
- package/dist/internal/nodes/nodesManagement.test.js +42 -21
- package/dist/internal/nodes/nodesManagement.test.js.map +1 -1
- package/dist/internal/nodes/nodesRevisions.d.ts +4 -4
- package/dist/internal/nodes/nodesRevisions.js.map +1 -1
- package/dist/internal/photos/albums.d.ts +3 -3
- package/dist/internal/photos/albums.js.map +1 -1
- package/dist/internal/photos/apiService.d.ts +1 -1
- package/dist/internal/photos/apiService.js +3 -6
- package/dist/internal/photos/apiService.js.map +1 -1
- package/dist/internal/photos/cache.d.ts +1 -1
- package/dist/internal/photos/index.d.ts +5 -5
- package/dist/internal/photos/index.js.map +1 -1
- package/dist/internal/photos/interface.d.ts +2 -2
- package/dist/internal/photos/photosTimeline.d.ts +3 -3
- package/dist/internal/photos/photosTimeline.js +1 -2
- package/dist/internal/photos/photosTimeline.js.map +1 -1
- package/dist/internal/sdkEvents.d.ts +1 -1
- package/dist/internal/sdkEvents.js +2 -7
- package/dist/internal/sdkEvents.js.map +1 -1
- package/dist/internal/sdkEvents.test.js +8 -8
- package/dist/internal/shares/apiService.d.ts +2 -2
- package/dist/internal/shares/apiService.js +5 -3
- package/dist/internal/shares/apiService.js.map +1 -1
- package/dist/internal/shares/cache.d.ts +4 -2
- package/dist/internal/shares/cache.js +14 -6
- package/dist/internal/shares/cache.js.map +1 -1
- package/dist/internal/shares/cache.test.js.map +1 -1
- package/dist/internal/shares/cryptoCache.d.ts +2 -2
- package/dist/internal/shares/cryptoCache.test.js +8 -2
- package/dist/internal/shares/cryptoCache.test.js.map +1 -1
- package/dist/internal/shares/cryptoService.d.ts +3 -3
- package/dist/internal/shares/cryptoService.js.map +1 -1
- package/dist/internal/shares/cryptoService.test.js +42 -42
- package/dist/internal/shares/cryptoService.test.js.map +1 -1
- package/dist/internal/shares/index.d.ts +4 -4
- package/dist/internal/shares/index.js.map +1 -1
- package/dist/internal/shares/interface.d.ts +2 -2
- package/dist/internal/shares/manager.d.ts +8 -7
- package/dist/internal/shares/manager.js +3 -0
- package/dist/internal/shares/manager.js.map +1 -1
- package/dist/internal/shares/manager.test.js +71 -63
- package/dist/internal/shares/manager.test.js.map +1 -1
- package/dist/internal/sharing/apiService.d.ts +4 -4
- package/dist/internal/sharing/apiService.js +5 -3
- package/dist/internal/sharing/apiService.js.map +1 -1
- package/dist/internal/sharing/cache.d.ts +1 -1
- package/dist/internal/sharing/cache.test.js +33 -33
- package/dist/internal/sharing/cryptoService.d.ts +3 -3
- package/dist/internal/sharing/cryptoService.js +3 -4
- package/dist/internal/sharing/cryptoService.js.map +1 -1
- package/dist/internal/sharing/cryptoService.test.js +39 -39
- package/dist/internal/sharing/cryptoService.test.js.map +1 -1
- package/dist/internal/sharing/events.d.ts +24 -56
- package/dist/internal/sharing/events.js +45 -138
- package/dist/internal/sharing/events.js.map +1 -1
- package/dist/internal/sharing/events.test.js +85 -189
- package/dist/internal/sharing/events.test.js.map +1 -1
- package/dist/internal/sharing/index.d.ts +8 -9
- package/dist/internal/sharing/index.js +5 -5
- package/dist/internal/sharing/index.js.map +1 -1
- package/dist/internal/sharing/interface.d.ts +8 -4
- package/dist/internal/sharing/sharingAccess.d.ts +6 -6
- package/dist/internal/sharing/sharingAccess.js +8 -4
- package/dist/internal/sharing/sharingAccess.js.map +1 -1
- package/dist/internal/sharing/sharingAccess.test.js +45 -39
- package/dist/internal/sharing/sharingAccess.test.js.map +1 -1
- package/dist/internal/sharing/sharingManagement.d.ts +5 -6
- package/dist/internal/sharing/sharingManagement.js +12 -16
- package/dist/internal/sharing/sharingManagement.js.map +1 -1
- package/dist/internal/sharing/sharingManagement.test.js +305 -286
- package/dist/internal/sharing/sharingManagement.test.js.map +1 -1
- package/dist/internal/uids.js.map +1 -1
- package/dist/internal/upload/apiService.d.ts +5 -6
- package/dist/internal/upload/apiService.js +8 -5
- package/dist/internal/upload/apiService.js.map +1 -1
- package/dist/internal/upload/blockVerifier.d.ts +3 -3
- package/dist/internal/upload/blockVerifier.js +1 -1
- package/dist/internal/upload/blockVerifier.js.map +1 -1
- package/dist/internal/upload/chunkStreamReader.test.js +6 -6
- package/dist/internal/upload/cryptoService.d.ts +4 -4
- package/dist/internal/upload/cryptoService.js +4 -4
- package/dist/internal/upload/cryptoService.js.map +1 -1
- package/dist/internal/upload/digests.js.map +1 -1
- package/dist/internal/upload/fileUploader.d.ts +6 -6
- package/dist/internal/upload/fileUploader.js.map +1 -1
- package/dist/internal/upload/fileUploader.test.js.map +1 -1
- package/dist/internal/upload/index.d.ts +6 -6
- package/dist/internal/upload/index.js +3 -3
- package/dist/internal/upload/index.js.map +1 -1
- package/dist/internal/upload/interface.d.ts +5 -3
- package/dist/internal/upload/manager.d.ts +8 -8
- package/dist/internal/upload/manager.js +23 -52
- package/dist/internal/upload/manager.js.map +1 -1
- package/dist/internal/upload/manager.test.js +185 -147
- package/dist/internal/upload/manager.test.js.map +1 -1
- package/dist/internal/upload/streamUploader.d.ts +6 -6
- package/dist/internal/upload/streamUploader.js +9 -8
- package/dist/internal/upload/streamUploader.js.map +1 -1
- package/dist/internal/upload/streamUploader.test.js +17 -12
- package/dist/internal/upload/streamUploader.test.js.map +1 -1
- package/dist/internal/upload/telemetry.d.ts +3 -3
- package/dist/internal/upload/telemetry.js +5 -3
- package/dist/internal/upload/telemetry.js.map +1 -1
- package/dist/internal/upload/telemetry.test.js +8 -8
- package/dist/internal/upload/telemetry.test.js.map +1 -1
- package/dist/protonDriveClient.d.ts +27 -170
- package/dist/protonDriveClient.js +37 -198
- package/dist/protonDriveClient.js.map +1 -1
- package/dist/protonDrivePhotosClient.js +3 -2
- package/dist/protonDrivePhotosClient.js.map +1 -1
- package/dist/telemetry.js +18 -15
- package/dist/telemetry.js.map +1 -1
- package/dist/tests/logger.js.map +1 -1
- package/dist/tests/telemetry.d.ts +1 -1
- package/dist/transformers.js +4 -2
- package/dist/transformers.js.map +1 -1
- package/package.json +3 -3
- package/src/cache/index.ts +1 -0
- package/src/cache/interface.ts +22 -22
- package/src/cache/memoryCache.test.ts +7 -7
- package/src/cache/memoryCache.ts +5 -5
- package/src/cache/nullCache.ts +38 -0
- package/src/config.ts +17 -2
- package/src/crypto/driveCrypto.test.ts +15 -15
- package/src/crypto/driveCrypto.ts +120 -156
- package/src/crypto/hmac.ts +1 -1
- package/src/crypto/interface.ts +63 -72
- package/src/crypto/openPGPCrypto.ts +76 -94
- package/src/crypto/utils.ts +1 -1
- package/src/diagnostic/eventsGenerator.ts +48 -0
- package/src/diagnostic/httpClient.ts +84 -0
- package/src/diagnostic/index.ts +40 -0
- package/src/diagnostic/integrityVerificationStream.ts +55 -0
- package/src/diagnostic/interface.ts +158 -0
- package/src/diagnostic/sdkDiagnostic.ts +249 -0
- package/src/diagnostic/sdkDiagnosticFull.ts +37 -0
- package/src/diagnostic/telemetry.ts +74 -0
- package/src/diagnostic/zipGenerators.test.ts +177 -0
- package/src/diagnostic/zipGenerators.ts +70 -0
- package/src/errors.ts +25 -22
- package/src/index.ts +3 -3
- package/src/interface/account.ts +10 -10
- package/src/interface/author.ts +6 -6
- package/src/interface/config.ts +28 -0
- package/src/interface/devices.ts +6 -6
- package/src/interface/download.ts +12 -9
- package/src/interface/events.ts +76 -25
- package/src/interface/httpClient.ts +11 -27
- package/src/interface/index.ts +81 -20
- package/src/interface/nodes.ts +67 -60
- package/src/interface/result.ts +1 -3
- package/src/interface/sharing.ts +60 -56
- package/src/interface/telemetry.ts +74 -74
- package/src/interface/thumbnail.ts +5 -6
- package/src/interface/upload.ts +25 -11
- package/src/internal/apiService/apiService.test.ts +109 -76
- package/src/internal/apiService/apiService.ts +40 -26
- package/src/internal/apiService/coreTypes.ts +2474 -2463
- package/src/internal/apiService/driveTypes.ts +1868 -1822
- package/src/internal/apiService/errorCodes.ts +4 -4
- package/src/internal/apiService/errors.test.ts +25 -23
- package/src/internal/apiService/errors.ts +15 -9
- package/src/internal/apiService/index.ts +1 -1
- package/src/internal/apiService/transformers.ts +2 -2
- package/src/internal/asyncIteratorMap.test.ts +4 -4
- package/src/internal/asyncIteratorMap.ts +1 -1
- package/src/internal/asyncIteratorRace.test.ts +149 -0
- package/src/internal/asyncIteratorRace.ts +79 -0
- package/src/internal/batch.test.ts +50 -0
- package/src/internal/batch.ts +9 -0
- package/src/internal/batchLoading.test.ts +13 -14
- package/src/internal/batchLoading.ts +8 -8
- package/src/internal/devices/apiService.ts +58 -51
- package/src/internal/devices/cryptoService.ts +22 -17
- package/src/internal/devices/index.ts +17 -10
- package/src/internal/devices/interface.ts +21 -12
- package/src/internal/devices/manager.test.ts +40 -9
- package/src/internal/devices/manager.ts +3 -3
- package/src/internal/download/apiService.ts +72 -52
- package/src/internal/download/cryptoService.ts +34 -18
- package/src/internal/download/fileDownloader.test.ts +25 -9
- package/src/internal/download/fileDownloader.ts +38 -20
- package/src/internal/download/index.ts +19 -19
- package/src/internal/download/interface.ts +19 -20
- package/src/internal/download/queue.ts +3 -3
- package/src/internal/download/telemetry.test.ts +11 -11
- package/src/internal/download/telemetry.ts +24 -14
- package/src/internal/download/thumbnailDownloader.test.ts +11 -6
- package/src/internal/download/thumbnailDownloader.ts +43 -32
- package/src/internal/errors.ts +7 -5
- package/src/internal/events/apiService.ts +46 -36
- package/src/internal/events/coreEventManager.test.ts +101 -0
- package/src/internal/events/coreEventManager.ts +26 -48
- package/src/internal/events/eventManager.test.ts +211 -93
- package/src/internal/events/eventManager.ts +72 -117
- package/src/internal/events/index.ts +71 -91
- package/src/internal/events/interface.ts +92 -29
- package/src/internal/events/volumeEventManager.test.ts +239 -0
- package/src/internal/events/volumeEventManager.ts +68 -57
- package/src/internal/nodes/apiService.test.ts +197 -147
- package/src/internal/nodes/apiService.ts +288 -174
- package/src/internal/nodes/cache.test.ts +48 -20
- package/src/internal/nodes/cache.ts +79 -45
- package/src/internal/nodes/cryptoCache.test.ts +34 -14
- package/src/internal/nodes/cryptoCache.ts +10 -5
- package/src/internal/nodes/cryptoService.test.ts +492 -351
- package/src/internal/nodes/cryptoService.ts +171 -89
- package/src/internal/nodes/events.test.ts +48 -344
- package/src/internal/nodes/events.ts +48 -254
- package/src/internal/nodes/extendedAttributes.test.ts +28 -24
- package/src/internal/nodes/extendedAttributes.ts +20 -15
- package/src/internal/nodes/index.test.ts +51 -55
- package/src/internal/nodes/index.ts +32 -22
- package/src/internal/nodes/interface.ts +44 -31
- package/src/internal/nodes/nodesAccess.test.ts +237 -130
- package/src/internal/nodes/nodesAccess.ts +113 -50
- package/src/internal/nodes/nodesManagement.test.ts +64 -39
- package/src/internal/nodes/nodesManagement.ts +51 -62
- package/src/internal/nodes/nodesRevisions.ts +7 -7
- package/src/internal/nodes/validations.ts +2 -2
- package/src/internal/photos/albums.ts +5 -5
- package/src/internal/photos/apiService.ts +4 -7
- package/src/internal/photos/cache.ts +1 -1
- package/src/internal/photos/index.ts +8 -8
- package/src/internal/photos/interface.ts +2 -2
- package/src/internal/photos/photosTimeline.ts +4 -5
- package/src/internal/sdkEvents.test.ts +10 -10
- package/src/internal/sdkEvents.ts +5 -13
- package/src/internal/shares/apiService.ts +44 -33
- package/src/internal/shares/cache.test.ts +6 -4
- package/src/internal/shares/cache.ts +25 -14
- package/src/internal/shares/cryptoCache.test.ts +17 -11
- package/src/internal/shares/cryptoCache.ts +4 -4
- package/src/internal/shares/cryptoService.test.ts +72 -74
- package/src/internal/shares/cryptoService.ts +48 -23
- package/src/internal/shares/index.ts +23 -11
- package/src/internal/shares/interface.ts +8 -8
- package/src/internal/shares/manager.test.ts +88 -80
- package/src/internal/shares/manager.ts +27 -23
- package/src/internal/sharing/apiService.ts +283 -175
- package/src/internal/sharing/cache.test.ts +35 -35
- package/src/internal/sharing/cache.ts +3 -3
- package/src/internal/sharing/cryptoService.test.ts +58 -46
- package/src/internal/sharing/cryptoService.ts +121 -83
- package/src/internal/sharing/events.test.ts +97 -207
- package/src/internal/sharing/events.ts +46 -157
- package/src/internal/sharing/index.ts +24 -16
- package/src/internal/sharing/interface.ts +46 -42
- package/src/internal/sharing/sharingAccess.test.ts +71 -65
- package/src/internal/sharing/sharingAccess.ts +39 -21
- package/src/internal/sharing/sharingManagement.test.ts +405 -335
- package/src/internal/sharing/sharingManagement.ts +144 -75
- package/src/internal/uids.ts +1 -1
- package/src/internal/upload/apiService.ts +168 -119
- package/src/internal/upload/blockVerifier.ts +8 -6
- package/src/internal/upload/chunkStreamReader.test.ts +7 -7
- package/src/internal/upload/cryptoService.ts +42 -36
- package/src/internal/upload/digests.ts +2 -2
- package/src/internal/upload/fileUploader.test.ts +15 -3
- package/src/internal/upload/fileUploader.ts +39 -17
- package/src/internal/upload/index.ts +17 -18
- package/src/internal/upload/interface.ts +79 -77
- package/src/internal/upload/manager.test.ts +222 -175
- package/src/internal/upload/manager.ts +74 -80
- package/src/internal/upload/queue.ts +3 -3
- package/src/internal/upload/streamUploader.test.ts +40 -27
- package/src/internal/upload/streamUploader.ts +87 -71
- package/src/internal/upload/telemetry.test.ts +11 -11
- package/src/internal/upload/telemetry.ts +25 -15
- package/src/internal/wait.test.ts +1 -1
- package/src/internal/wait.ts +3 -3
- package/src/protonDriveClient.ts +189 -276
- package/src/protonDrivePhotosClient.ts +20 -13
- package/src/telemetry.ts +60 -52
- package/src/tests/logger.ts +1 -1
- package/src/tests/telemetry.ts +2 -2
- package/src/transformers.ts +27 -21
- package/src/version.ts +0 -1
- package/dist/internal/events/cache.d.ts +0 -28
- package/dist/internal/events/cache.js +0 -67
- package/dist/internal/events/cache.js.map +0 -1
- package/dist/internal/events/cache.test.js +0 -43
- package/dist/internal/events/cache.test.js.map +0 -1
- package/src/internal/events/cache.test.ts +0 -47
- package/src/internal/events/cache.ts +0 -80
- /package/dist/{internal/events/cache.test.d.ts → diagnostic/zipGenerators.test.d.ts} +0 -0
package/src/protonDriveClient.ts
CHANGED
|
@@ -24,8 +24,6 @@ import {
|
|
|
24
24
|
ThumbnailType,
|
|
25
25
|
ThumbnailResult,
|
|
26
26
|
SDKEvent,
|
|
27
|
-
DeviceEventCallback,
|
|
28
|
-
NodeEventCallback,
|
|
29
27
|
} from './interface';
|
|
30
28
|
import { DriveCrypto, SessionKey } from './crypto';
|
|
31
29
|
import { DriveAPIService } from './internal/apiService';
|
|
@@ -34,17 +32,25 @@ import { initNodesModule } from './internal/nodes';
|
|
|
34
32
|
import { initSharingModule } from './internal/sharing';
|
|
35
33
|
import { initDownloadModule } from './internal/download';
|
|
36
34
|
import { initUploadModule } from './internal/upload';
|
|
37
|
-
import { DriveEventsService } from './internal/events';
|
|
35
|
+
import { DriveEventsService, DriveListener } from './internal/events';
|
|
38
36
|
import { SDKEvents } from './internal/sdkEvents';
|
|
39
37
|
import { getConfig } from './config';
|
|
40
|
-
import {
|
|
38
|
+
import {
|
|
39
|
+
getUid,
|
|
40
|
+
getUids,
|
|
41
|
+
convertInternalNodePromise,
|
|
42
|
+
convertInternalNodeIterator,
|
|
43
|
+
convertInternalMissingNodeIterator,
|
|
44
|
+
convertInternalNode,
|
|
45
|
+
} from './transformers';
|
|
41
46
|
import { Telemetry } from './telemetry';
|
|
42
47
|
import { initDevicesModule } from './internal/devices';
|
|
43
|
-
import { makeNodeUid
|
|
48
|
+
import { makeNodeUid } from './internal/uids';
|
|
49
|
+
import { EventSubscription } from './internal/events/interface';
|
|
44
50
|
|
|
45
51
|
/**
|
|
46
52
|
* ProtonDriveClient is the main interface for the ProtonDrive SDK.
|
|
47
|
-
*
|
|
53
|
+
*
|
|
48
54
|
* The client provides high-level operations for managing nodes, sharing,
|
|
49
55
|
* and downloading/uploading files. It is the main entry point for using
|
|
50
56
|
* the ProtonDrive SDK.
|
|
@@ -63,9 +69,9 @@ export class ProtonDriveClient {
|
|
|
63
69
|
public experimental: {
|
|
64
70
|
/**
|
|
65
71
|
* Experimental feature to return the URL of the node.
|
|
66
|
-
*
|
|
72
|
+
*
|
|
67
73
|
* Use it when you want to open the node in the ProtonDrive web app.
|
|
68
|
-
*
|
|
74
|
+
*
|
|
69
75
|
* It has hardcoded URLs to open in production client only.
|
|
70
76
|
*/
|
|
71
77
|
getNodeUrl: (nodeUid: NodeOrUid) => Promise<string>;
|
|
@@ -86,6 +92,7 @@ export class ProtonDriveClient {
|
|
|
86
92
|
srpModule,
|
|
87
93
|
config,
|
|
88
94
|
telemetry,
|
|
95
|
+
latestEventIdProvider,
|
|
89
96
|
}: ProtonDriveClientContructorParameters) {
|
|
90
97
|
if (!telemetry) {
|
|
91
98
|
telemetry = new Telemetry();
|
|
@@ -95,14 +102,70 @@ export class ProtonDriveClient {
|
|
|
95
102
|
const fullConfig = getConfig(config);
|
|
96
103
|
this.sdkEvents = new SDKEvents(telemetry);
|
|
97
104
|
const cryptoModule = new DriveCrypto(openPGPCryptoModule, srpModule);
|
|
98
|
-
const apiService = new DriveAPIService(
|
|
99
|
-
|
|
105
|
+
const apiService = new DriveAPIService(
|
|
106
|
+
telemetry,
|
|
107
|
+
this.sdkEvents,
|
|
108
|
+
httpClient,
|
|
109
|
+
fullConfig.baseUrl,
|
|
110
|
+
fullConfig.language,
|
|
111
|
+
);
|
|
100
112
|
this.shares = initSharesModule(telemetry, apiService, entitiesCache, cryptoCache, account, cryptoModule);
|
|
101
|
-
this.nodes = initNodesModule(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
113
|
+
this.nodes = initNodesModule(
|
|
114
|
+
telemetry,
|
|
115
|
+
apiService,
|
|
116
|
+
entitiesCache,
|
|
117
|
+
cryptoCache,
|
|
118
|
+
account,
|
|
119
|
+
cryptoModule,
|
|
120
|
+
this.shares,
|
|
121
|
+
);
|
|
122
|
+
this.sharing = initSharingModule(
|
|
123
|
+
telemetry,
|
|
124
|
+
apiService,
|
|
125
|
+
entitiesCache,
|
|
126
|
+
account,
|
|
127
|
+
cryptoModule,
|
|
128
|
+
this.shares,
|
|
129
|
+
this.nodes.access,
|
|
130
|
+
);
|
|
131
|
+
this.download = initDownloadModule(
|
|
132
|
+
telemetry,
|
|
133
|
+
apiService,
|
|
134
|
+
cryptoModule,
|
|
135
|
+
account,
|
|
136
|
+
this.shares,
|
|
137
|
+
this.nodes.access,
|
|
138
|
+
this.nodes.revisions,
|
|
139
|
+
);
|
|
140
|
+
this.upload = initUploadModule(
|
|
141
|
+
telemetry,
|
|
142
|
+
apiService,
|
|
143
|
+
cryptoModule,
|
|
144
|
+
this.shares,
|
|
145
|
+
this.nodes.access,
|
|
146
|
+
fullConfig.clientUid,
|
|
147
|
+
);
|
|
148
|
+
this.devices = initDevicesModule(
|
|
149
|
+
telemetry,
|
|
150
|
+
apiService,
|
|
151
|
+
cryptoModule,
|
|
152
|
+
this.shares,
|
|
153
|
+
this.nodes.access,
|
|
154
|
+
this.nodes.management,
|
|
155
|
+
);
|
|
156
|
+
// These are used to keep the internal cache up to date
|
|
157
|
+
const cacheEventListeners: DriveListener[] = [
|
|
158
|
+
this.nodes.eventHandler.updateNodesCacheOnEvent,
|
|
159
|
+
this.sharing.eventHandler.handleDriveEvent,
|
|
160
|
+
];
|
|
161
|
+
this.events = new DriveEventsService(
|
|
162
|
+
telemetry,
|
|
163
|
+
apiService,
|
|
164
|
+
this.shares,
|
|
165
|
+
cacheEventListeners,
|
|
166
|
+
latestEventIdProvider,
|
|
167
|
+
);
|
|
168
|
+
|
|
106
169
|
this.experimental = {
|
|
107
170
|
getNodeUrl: async (nodeUid: NodeOrUid) => {
|
|
108
171
|
this.logger.debug(`Getting node URL for ${getUid(nodeUid)}`);
|
|
@@ -116,12 +179,12 @@ export class ProtonDriveClient {
|
|
|
116
179
|
}
|
|
117
180
|
return keys.contentKeyPacketSessionKey;
|
|
118
181
|
},
|
|
119
|
-
}
|
|
182
|
+
};
|
|
120
183
|
}
|
|
121
184
|
|
|
122
185
|
/**
|
|
123
186
|
* Subscribes to the general SDK events.
|
|
124
|
-
*
|
|
187
|
+
*
|
|
125
188
|
* This is not connected to the remote data updates. For that, use
|
|
126
189
|
* and see `subscribeToRemoteDataUpdates`.
|
|
127
190
|
*
|
|
@@ -135,197 +198,39 @@ export class ProtonDriveClient {
|
|
|
135
198
|
}
|
|
136
199
|
|
|
137
200
|
/**
|
|
138
|
-
* Subscribes to the remote data updates
|
|
139
|
-
*
|
|
140
|
-
* By default, SDK doesn't subscribe to remote data updates. If you
|
|
141
|
-
* cache the data locally, you need to call this method so the SDK
|
|
142
|
-
* keeps the local cache in sync with the remote data.
|
|
143
|
-
*
|
|
144
|
-
* Only one instance of the SDK should subscribe to remote data updates.
|
|
201
|
+
* Subscribes to the remote data updates for all files and folders in a
|
|
202
|
+
* tree.
|
|
145
203
|
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* with lower frequency depending on the number of subscriptions, and only
|
|
149
|
-
* after accessing them for the first time via `iterateSharedNodesWithMe`.
|
|
150
|
-
*/
|
|
151
|
-
async subscribeToRemoteDataUpdates(): Promise<void> {
|
|
152
|
-
this.logger.debug('Subscribing to remote data updates');
|
|
153
|
-
await this.events.subscribeToRemoteDataUpdates();
|
|
154
|
-
|
|
155
|
-
const { volumeId } = await this.shares.getMyFilesIDs();
|
|
156
|
-
await this.events.listenToVolume(volumeId, true);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Subscribe to updates of the devices.
|
|
161
|
-
*
|
|
162
|
-
* Clients should subscribe to this before beginning to list devices
|
|
163
|
-
* to ensure that updates are reflected once a device is in the cache.
|
|
164
|
-
* Subscribing before listing is also required to ensure that devices
|
|
165
|
-
* that are created during the listing will be recognized.
|
|
166
|
-
*
|
|
167
|
-
* ```typescript
|
|
168
|
-
* const unsubscribe = sdk.subscribeToDevices((event) => {
|
|
169
|
-
* if (event.type === 'update') {
|
|
170
|
-
* // Update the device in the UI
|
|
171
|
-
* } else if (event.type === 'remove') {
|
|
172
|
-
* // Remove the device from the UI
|
|
173
|
-
* }
|
|
174
|
-
* });
|
|
175
|
-
*
|
|
176
|
-
* const devices = await Array.fromAsync(sdk.iterateDevices());
|
|
177
|
-
* // Render the devices in the UI
|
|
178
|
-
*
|
|
179
|
-
* // Unsubscribe from the updates when the component is unmounted
|
|
180
|
-
* unsubscribe();
|
|
181
|
-
* ```
|
|
204
|
+
* In order to keep local data up to date, the client must call this method
|
|
205
|
+
* to receive events on update and to keep the SDK cache in sync.
|
|
182
206
|
*
|
|
183
|
-
*
|
|
184
|
-
* @returns Callback to unsubscribe from the event.
|
|
185
|
-
*/
|
|
186
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
187
|
-
subscribeToDevices(callback: DeviceEventCallback): () => void {
|
|
188
|
-
this.logger.debug('Subscribing to devices');
|
|
189
|
-
throw new Error('Method not implemented');
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Subscribe to updates of the children of the given parent node.
|
|
194
|
-
*
|
|
195
|
-
* Clients should subscribe to this before beginning to list children
|
|
196
|
-
* to ensure that updates are reflected once a node is in the cache.
|
|
197
|
-
* Subscribing before listing is also required to ensure that nodes
|
|
198
|
-
* that are created during the listing will be recognized.
|
|
199
|
-
*
|
|
200
|
-
* ```typescript
|
|
201
|
-
* const unsubscribe = sdk.subscribeToChildren(parentNodeUid, (event) => {
|
|
202
|
-
* if (event.type === 'update') {
|
|
203
|
-
* // Update the node in the UI
|
|
204
|
-
* } else if (event.type === 'remove') {
|
|
205
|
-
* // Remove the node from the UI
|
|
206
|
-
* }
|
|
207
|
-
* });
|
|
208
|
-
*
|
|
209
|
-
* const nodes = await Array.fromAsync(sdk.iterateChildren(parentNodeUid));
|
|
210
|
-
* // Render the nodes in the UI
|
|
211
|
-
*
|
|
212
|
-
* // Unsubscribe from the updates when the component is unmounted
|
|
213
|
-
* unsubscribe();
|
|
214
|
-
* ```
|
|
207
|
+
* The `treeEventScopeId` can be obtained from node properties.
|
|
215
208
|
*
|
|
216
|
-
*
|
|
217
|
-
* @param callback - Callback to be called when the event is emitted.
|
|
218
|
-
* @returns Callback to unsubscribe from the event.
|
|
209
|
+
* Only one instance of the SDK should subscribe to updates.
|
|
219
210
|
*/
|
|
220
|
-
|
|
221
|
-
this.logger.debug(
|
|
222
|
-
return this.
|
|
211
|
+
async subscribeToTreeEvents(treeEventScopeId: string, callback: DriveListener): Promise<EventSubscription> {
|
|
212
|
+
this.logger.debug('Subscribing to node updates');
|
|
213
|
+
return this.events.subscribeToTreeEvents(treeEventScopeId, callback);
|
|
223
214
|
}
|
|
224
215
|
|
|
225
216
|
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
* Clients should subscribe to this before beginning to list trashed
|
|
229
|
-
* nodes to ensure that updates are reflected once a node is in the cache.
|
|
230
|
-
* Subscribing before listing is also required to ensure that nodes
|
|
231
|
-
* that are trashed during the listing will be recognized.
|
|
232
|
-
*
|
|
233
|
-
* ```typescript
|
|
234
|
-
* const unsubscribe = sdk.subscribeToTrashedNodes((event) => {
|
|
235
|
-
* if (event.type === 'update') {
|
|
236
|
-
* // Update the node in the UI
|
|
237
|
-
* } else if (event.type === 'remove') {
|
|
238
|
-
* // Remove the node from the UI
|
|
239
|
-
* }
|
|
240
|
-
* });
|
|
241
|
-
*
|
|
242
|
-
* const nodes = await Array.fromAsync(sdk.iterateTrashedNodes());
|
|
243
|
-
* // Render the nodes in the UI
|
|
244
|
-
*
|
|
245
|
-
* // Unsubscribe from the updates when the component is unmounted
|
|
246
|
-
* unsubscribe();
|
|
247
|
-
* ```
|
|
217
|
+
* Subscribes to sharing updates.
|
|
248
218
|
*
|
|
249
|
-
*
|
|
250
|
-
* @returns Callback to unsubscribe from the event.
|
|
251
|
-
*/
|
|
252
|
-
subscribeToTrashedNodes(callback: NodeEventCallback): () => void {
|
|
253
|
-
this.logger.debug('Subscribing to trashed nodes');
|
|
254
|
-
return this.nodes.events.subscribeToTrashedNodes(callback);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Subscribe to updates of the nodes shared by the user.
|
|
259
|
-
*
|
|
260
|
-
* Clients should subscribe to this before beginning to list shared
|
|
261
|
-
* nodes to ensure that updates are reflected once a node is in the cache.
|
|
262
|
-
* Subscribing before listing is also required to ensure that nodes
|
|
263
|
-
* that are shared during the listing will be recognized.
|
|
264
|
-
*
|
|
265
|
-
* ```typescript
|
|
266
|
-
* const unsubscribe = sdk.subscribeToSharedNodesByMe((event) => {
|
|
267
|
-
* if (event.type === 'update') {
|
|
268
|
-
* // Update the node in the UI
|
|
269
|
-
* } else if (event.type === 'remove') {
|
|
270
|
-
* // Remove the node from the UI
|
|
271
|
-
* }
|
|
272
|
-
* });
|
|
273
|
-
*
|
|
274
|
-
* const nodes = await Array.fromAsync(sdk.iterateSharedNodes());
|
|
275
|
-
* // Render the nodes in the UI
|
|
276
|
-
*
|
|
277
|
-
* // Unsubscribe from the updates when the component is unmounted
|
|
278
|
-
* unsubscribe();
|
|
279
|
-
* ```
|
|
280
|
-
*
|
|
281
|
-
* @param callback - Callback to be called when the event is emitted.
|
|
282
|
-
* @returns Callback to unsubscribe from the event.
|
|
283
|
-
*/
|
|
284
|
-
subscribeToSharedNodesByMe(callback: NodeEventCallback): () => void {
|
|
285
|
-
this.logger.debug('Subscribing to shared nodes by me');
|
|
286
|
-
return this.sharing.events.subscribeToSharedNodesByMe(callback);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Subscribe to updates of the nodes shared with the user.
|
|
291
|
-
*
|
|
292
|
-
* Clients should subscribe to this before beginning to list shared
|
|
293
|
-
* nodes to ensure that updates are reflected once a node is in the cache.
|
|
294
|
-
* Subscribing before listing is also required to ensure that nodes
|
|
295
|
-
* that are shared during the listing will be recognized.
|
|
296
|
-
*
|
|
297
|
-
* ```typescript
|
|
298
|
-
* const unsubscribe = sdk.subscribeToSharedNodesWithMe((event) => {
|
|
299
|
-
* if (event.type === 'update') {
|
|
300
|
-
* // Update the node in the UI
|
|
301
|
-
* } else if (event.type === 'remove') {
|
|
302
|
-
* // Remove the node from the UI
|
|
303
|
-
* }
|
|
304
|
-
* });
|
|
305
|
-
*
|
|
306
|
-
* const nodes = await Array.fromAsync(sdk.iterateSharedNodesWithMe());
|
|
307
|
-
* // Render the nodes in the UI
|
|
308
|
-
*
|
|
309
|
-
* // Unsubscribe from the updates when the component is unmounted
|
|
310
|
-
* unsubscribe();
|
|
311
|
-
* ```
|
|
312
|
-
*
|
|
313
|
-
* @param callback - Callback to be called when the event is emitted.
|
|
314
|
-
* @returns Callback to unsubscribe from the event.
|
|
219
|
+
* Only one instance of the SDK should subscribe to updates.
|
|
315
220
|
*/
|
|
316
|
-
|
|
317
|
-
this.logger.debug('Subscribing to
|
|
318
|
-
return this.
|
|
221
|
+
async subscribeToDriveEvents(callback: DriveListener): Promise<EventSubscription> {
|
|
222
|
+
this.logger.debug('Subscribing to core updates');
|
|
223
|
+
return this.events.subscribeToCoreEvents(callback);
|
|
319
224
|
}
|
|
320
225
|
|
|
321
226
|
/**
|
|
322
227
|
* Provides the node UID for the given raw share and node IDs.
|
|
323
|
-
*
|
|
228
|
+
*
|
|
324
229
|
* This is required only for the internal implementation to provide
|
|
325
230
|
* backward compatibility with the old Drive web setup.
|
|
326
|
-
*
|
|
231
|
+
*
|
|
327
232
|
* If you are having volume ID, use `generateNodeUid` instead.
|
|
328
|
-
*
|
|
233
|
+
*
|
|
329
234
|
* @deprecated This method is not part of the public API.
|
|
330
235
|
* @param shareId - Context share of the node.
|
|
331
236
|
* @param nodeId - Node/link ID (not UID).
|
|
@@ -347,48 +252,44 @@ export class ProtonDriveClient {
|
|
|
347
252
|
|
|
348
253
|
/**
|
|
349
254
|
* Iterates the children of the given parent node.
|
|
350
|
-
*
|
|
351
|
-
* The output is not sorted and the order of the children is not guaranteed.
|
|
352
255
|
*
|
|
353
|
-
*
|
|
256
|
+
* The output is not sorted and the order of the children is not guaranteed.
|
|
354
257
|
*
|
|
355
258
|
* @param parentNodeUid - Node entity or its UID string.
|
|
356
259
|
* @param signal - Signal to abort the operation.
|
|
357
260
|
* @returns An async generator of the children of the given parent node.
|
|
358
261
|
*/
|
|
359
|
-
async*
|
|
262
|
+
async *iterateFolderChildren(parentNodeUid: NodeOrUid, signal?: AbortSignal): AsyncGenerator<MaybeNode> {
|
|
360
263
|
this.logger.info(`Iterating children of ${getUid(parentNodeUid)}`);
|
|
361
264
|
yield* convertInternalNodeIterator(this.nodes.access.iterateFolderChildren(getUid(parentNodeUid), signal));
|
|
362
265
|
}
|
|
363
266
|
|
|
364
267
|
/**
|
|
365
268
|
* Iterates the trashed nodes.
|
|
366
|
-
*
|
|
269
|
+
*
|
|
367
270
|
* The list of trashed nodes is not cached and is fetched from the server
|
|
368
271
|
* on each call. The node data itself are served from cached if available.
|
|
369
|
-
*
|
|
370
|
-
* The output is not sorted and the order of the trashed nodes is not guaranteed.
|
|
371
272
|
*
|
|
372
|
-
*
|
|
273
|
+
* The output is not sorted and the order of the trashed nodes is not guaranteed.
|
|
373
274
|
*
|
|
374
275
|
* @param signal - Signal to abort the operation.
|
|
375
276
|
* @returns An async generator of the trashed nodes.
|
|
376
277
|
*/
|
|
377
|
-
async*
|
|
278
|
+
async *iterateTrashedNodes(signal?: AbortSignal): AsyncGenerator<MaybeNode> {
|
|
378
279
|
this.logger.info('Iterating trashed nodes');
|
|
379
280
|
yield* convertInternalNodeIterator(this.nodes.access.iterateTrashedNodes(signal));
|
|
380
281
|
}
|
|
381
282
|
|
|
382
283
|
/**
|
|
383
284
|
* Iterates the nodes by their UIDs.
|
|
384
|
-
*
|
|
285
|
+
*
|
|
385
286
|
* The output is not sorted and the order of the nodes is not guaranteed.
|
|
386
287
|
*
|
|
387
288
|
* @param nodeUids - List of node entities or their UIDs.
|
|
388
289
|
* @param signal - Signal to abort the operation.
|
|
389
290
|
* @returns An async generator of the nodes.
|
|
390
291
|
*/
|
|
391
|
-
async*
|
|
292
|
+
async *iterateNodes(nodeUids: NodeOrUid[], signal?: AbortSignal): AsyncGenerator<MaybeMissingNode> {
|
|
392
293
|
this.logger.info(`Iterating ${nodeUids.length} nodes`);
|
|
393
294
|
yield* convertInternalMissingNodeIterator(this.nodes.access.iterateNodes(getUids(nodeUids), signal));
|
|
394
295
|
}
|
|
@@ -419,13 +320,13 @@ export class ProtonDriveClient {
|
|
|
419
320
|
|
|
420
321
|
/**
|
|
421
322
|
* Move the nodes to a new parent node.
|
|
422
|
-
*
|
|
323
|
+
*
|
|
423
324
|
* The operation is performed node by node and the results are yielded
|
|
424
325
|
* as they are available. Order of the results is not guaranteed.
|
|
425
|
-
*
|
|
326
|
+
*
|
|
426
327
|
* If one of the nodes fails to move, the operation continues with the
|
|
427
328
|
* rest of the nodes. Use `NodeResult` to check the status of the action.
|
|
428
|
-
*
|
|
329
|
+
*
|
|
429
330
|
* Only move withing the same section is supported at this moment.
|
|
430
331
|
* That means that the new parent node must be in the same section
|
|
431
332
|
* as the nodes being moved. E.g., moving from My files to Shared with
|
|
@@ -436,17 +337,21 @@ export class ProtonDriveClient {
|
|
|
436
337
|
* @param signal - Signal to abort the operation.
|
|
437
338
|
* @returns An async generator of the results of the move operation
|
|
438
339
|
*/
|
|
439
|
-
async*
|
|
340
|
+
async *moveNodes(
|
|
341
|
+
nodeUids: NodeOrUid[],
|
|
342
|
+
newParentNodeUid: NodeOrUid,
|
|
343
|
+
signal?: AbortSignal,
|
|
344
|
+
): AsyncGenerator<NodeResult> {
|
|
440
345
|
this.logger.info(`Moving ${nodeUids.length} nodes to ${newParentNodeUid}`);
|
|
441
346
|
yield* this.nodes.management.moveNodes(getUids(nodeUids), getUid(newParentNodeUid), signal);
|
|
442
347
|
}
|
|
443
348
|
|
|
444
349
|
/**
|
|
445
350
|
* Trash the nodes.
|
|
446
|
-
*
|
|
351
|
+
*
|
|
447
352
|
* The operation is performed in batches and the results are yielded
|
|
448
353
|
* as they are available. Order of the results is not guaranteed.
|
|
449
|
-
*
|
|
354
|
+
*
|
|
450
355
|
* If one of the nodes fails to trash, the operation continues with the
|
|
451
356
|
* rest of the nodes. Use `NodeResult` to check the status of the action.
|
|
452
357
|
*
|
|
@@ -454,17 +359,17 @@ export class ProtonDriveClient {
|
|
|
454
359
|
* @param signal - Signal to abort the operation.
|
|
455
360
|
* @returns An async generator of the results of the trash operation
|
|
456
361
|
*/
|
|
457
|
-
async*
|
|
362
|
+
async *trashNodes(nodeUids: NodeOrUid[], signal?: AbortSignal): AsyncGenerator<NodeResult> {
|
|
458
363
|
this.logger.info(`Trashing ${nodeUids.length} nodes`);
|
|
459
364
|
yield* this.nodes.management.trashNodes(getUids(nodeUids), signal);
|
|
460
365
|
}
|
|
461
366
|
|
|
462
367
|
/**
|
|
463
368
|
* Restore the nodes from the trash to their original place.
|
|
464
|
-
*
|
|
369
|
+
*
|
|
465
370
|
* The operation is performed in batches and the results are yielded
|
|
466
371
|
* as they are available. Order of the results is not guaranteed.
|
|
467
|
-
*
|
|
372
|
+
*
|
|
468
373
|
* If one of the nodes fails to restore, the operation continues with the
|
|
469
374
|
* rest of the nodes. Use `NodeResult` to check the status of the action.
|
|
470
375
|
*
|
|
@@ -472,17 +377,17 @@ export class ProtonDriveClient {
|
|
|
472
377
|
* @param signal - Signal to abort the operation.
|
|
473
378
|
* @returns An async generator of the results of the restore operation
|
|
474
379
|
*/
|
|
475
|
-
async*
|
|
380
|
+
async *restoreNodes(nodeUids: NodeOrUid[], signal?: AbortSignal): AsyncGenerator<NodeResult> {
|
|
476
381
|
this.logger.info(`Restoring ${nodeUids.length} nodes`);
|
|
477
382
|
yield* this.nodes.management.restoreNodes(getUids(nodeUids), signal);
|
|
478
383
|
}
|
|
479
384
|
|
|
480
385
|
/**
|
|
481
386
|
* Delete the nodes permanently.
|
|
482
|
-
*
|
|
387
|
+
*
|
|
483
388
|
* The operation is performed in batches and the results are yielded
|
|
484
389
|
* as they are available. Order of the results is not guaranteed.
|
|
485
|
-
*
|
|
390
|
+
*
|
|
486
391
|
* If one of the nodes fails to delete, the operation continues with the
|
|
487
392
|
* rest of the nodes. Use `NodeResult` to check the status of the action.
|
|
488
393
|
*
|
|
@@ -490,7 +395,7 @@ export class ProtonDriveClient {
|
|
|
490
395
|
* @param signal - Signal to abort the operation.
|
|
491
396
|
* @returns An async generator of the results of the delete operation
|
|
492
397
|
*/
|
|
493
|
-
async*
|
|
398
|
+
async *deleteNodes(nodeUids: NodeOrUid[], signal?: AbortSignal): AsyncGenerator<NodeResult> {
|
|
494
399
|
this.logger.info(`Deleting ${nodeUids.length} nodes`);
|
|
495
400
|
yield* this.nodes.management.deleteNodes(getUids(nodeUids), signal);
|
|
496
401
|
}
|
|
@@ -502,7 +407,7 @@ export class ProtonDriveClient {
|
|
|
502
407
|
|
|
503
408
|
/**
|
|
504
409
|
* Create a new folder.
|
|
505
|
-
*
|
|
410
|
+
*
|
|
506
411
|
* The folder is created in the given parent node.
|
|
507
412
|
*
|
|
508
413
|
* @param parentNodeUid - Node entity or its UID string of the parent folder.
|
|
@@ -515,15 +420,17 @@ export class ProtonDriveClient {
|
|
|
515
420
|
*/
|
|
516
421
|
async createFolder(parentNodeUid: NodeOrUid, name: string, modificationTime?: Date): Promise<MaybeNode> {
|
|
517
422
|
this.logger.info(`Creating folder in ${getUid(parentNodeUid)}`);
|
|
518
|
-
return convertInternalNodePromise(
|
|
423
|
+
return convertInternalNodePromise(
|
|
424
|
+
this.nodes.management.createFolder(getUid(parentNodeUid), name, modificationTime),
|
|
425
|
+
);
|
|
519
426
|
}
|
|
520
427
|
|
|
521
428
|
/**
|
|
522
429
|
* Iterates the revisions of given node.
|
|
523
|
-
*
|
|
430
|
+
*
|
|
524
431
|
* The list of node revisions is not cached and is fetched and decrypted
|
|
525
432
|
* from the server on each call.
|
|
526
|
-
*
|
|
433
|
+
*
|
|
527
434
|
* The output is sorted by the revision date in descending order (newest
|
|
528
435
|
* first).
|
|
529
436
|
*
|
|
@@ -531,7 +438,7 @@ export class ProtonDriveClient {
|
|
|
531
438
|
* @param signal - Signal to abort the operation.
|
|
532
439
|
* @returns An async generator of the node revisions.
|
|
533
440
|
*/
|
|
534
|
-
async*
|
|
441
|
+
async *iterateRevisions(nodeUid: NodeOrUid, signal?: AbortSignal): AsyncGenerator<Revision> {
|
|
535
442
|
this.logger.info(`Iterating revisions of ${getUid(nodeUid)}`);
|
|
536
443
|
yield* this.nodes.revisions.iterateRevisions(getUid(nodeUid), signal);
|
|
537
444
|
}
|
|
@@ -565,13 +472,11 @@ export class ProtonDriveClient {
|
|
|
565
472
|
* Iterates the nodes shared by the user.
|
|
566
473
|
*
|
|
567
474
|
* The output is not sorted and the order of the shared nodes is not guaranteed.
|
|
568
|
-
*
|
|
569
|
-
* You can listen to updates via `subscribeToSharedNodesByMe`.
|
|
570
475
|
*
|
|
571
476
|
* @param signal - Signal to abort the operation.
|
|
572
477
|
* @returns An async generator of the shared nodes.
|
|
573
478
|
*/
|
|
574
|
-
async*
|
|
479
|
+
async *iterateSharedNodes(signal?: AbortSignal): AsyncGenerator<MaybeNode> {
|
|
575
480
|
this.logger.info('Iterating shared nodes by me');
|
|
576
481
|
yield* convertInternalNodeIterator(this.sharing.access.iterateSharedNodes(signal));
|
|
577
482
|
}
|
|
@@ -580,28 +485,19 @@ export class ProtonDriveClient {
|
|
|
580
485
|
* Iterates the nodes shared with the user.
|
|
581
486
|
*
|
|
582
487
|
* The output is not sorted and the order of the shared nodes is not guaranteed.
|
|
583
|
-
*
|
|
584
|
-
*
|
|
585
|
-
*
|
|
586
|
-
*
|
|
587
|
-
*
|
|
588
|
-
* You can listen to updates via `subscribeToSharedNodesWithMe`.
|
|
488
|
+
*
|
|
489
|
+
* Clients can subscribe to drive events in order to receive a
|
|
490
|
+
* `SharedWithMeUpdated` event when there are changes to the user's
|
|
491
|
+
* access to shared nodes.
|
|
589
492
|
*
|
|
590
493
|
* @param signal - Signal to abort the operation.
|
|
591
494
|
* @returns An async generator of the shared nodes.
|
|
592
495
|
*/
|
|
593
|
-
async*
|
|
496
|
+
async *iterateSharedNodesWithMe(signal?: AbortSignal): AsyncGenerator<MaybeNode> {
|
|
594
497
|
this.logger.info('Iterating shared nodes with me');
|
|
595
498
|
|
|
596
|
-
const uniqueVolumeIds = new Set<string>();
|
|
597
499
|
for await (const node of this.sharing.access.iterateSharedNodesWithMe(signal)) {
|
|
598
500
|
yield convertInternalNode(node);
|
|
599
|
-
const { volumeId } = splitNodeUid(node.uid);
|
|
600
|
-
uniqueVolumeIds.add(volumeId);
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
for (const volumeId of uniqueVolumeIds) {
|
|
604
|
-
await this.events.listenToVolume(volumeId, false);
|
|
605
501
|
}
|
|
606
502
|
}
|
|
607
503
|
|
|
@@ -623,7 +519,7 @@ export class ProtonDriveClient {
|
|
|
623
519
|
* @param signal - Signal to abort the operation.
|
|
624
520
|
* @returns An async generator of the invitations.
|
|
625
521
|
*/
|
|
626
|
-
async*
|
|
522
|
+
async *iterateInvitations(signal?: AbortSignal): AsyncGenerator<ProtonInvitationWithNode> {
|
|
627
523
|
this.logger.info('Iterating invitations');
|
|
628
524
|
yield* this.sharing.access.iterateInvitations(signal);
|
|
629
525
|
}
|
|
@@ -656,7 +552,7 @@ export class ProtonDriveClient {
|
|
|
656
552
|
* @param signal - Signal to abort the operation.
|
|
657
553
|
* @returns An async generator of the shared bookmarks.
|
|
658
554
|
*/
|
|
659
|
-
async*
|
|
555
|
+
async *iterateBookmarks(signal?: AbortSignal): AsyncGenerator<MaybeBookmark> {
|
|
660
556
|
this.logger.info('Iterating shared bookmarks');
|
|
661
557
|
yield* this.sharing.access.iterateBookmarks(signal);
|
|
662
558
|
}
|
|
@@ -673,7 +569,7 @@ export class ProtonDriveClient {
|
|
|
673
569
|
|
|
674
570
|
/**
|
|
675
571
|
* Get sharing info of the node.
|
|
676
|
-
*
|
|
572
|
+
*
|
|
677
573
|
* The sharing info contains the list of invitations, members,
|
|
678
574
|
* public link and permission for each.
|
|
679
575
|
*
|
|
@@ -690,7 +586,7 @@ export class ProtonDriveClient {
|
|
|
690
586
|
|
|
691
587
|
/**
|
|
692
588
|
* Share or update sharing of the node.
|
|
693
|
-
*
|
|
589
|
+
*
|
|
694
590
|
* If the node is already shared, the sharing settings are updated.
|
|
695
591
|
* If the member is already present but with different role, the role
|
|
696
592
|
* is updated. If the sharing settings is identical, the sharing info
|
|
@@ -722,46 +618,49 @@ export class ProtonDriveClient {
|
|
|
722
618
|
return this.sharing.management.unshareNode(getUid(nodeUid), settings);
|
|
723
619
|
}
|
|
724
620
|
|
|
725
|
-
async resendInvitation(
|
|
621
|
+
async resendInvitation(
|
|
622
|
+
nodeUid: NodeOrUid,
|
|
623
|
+
invitationUid: ProtonInvitationOrUid | NonProtonInvitationOrUid,
|
|
624
|
+
): Promise<void> {
|
|
726
625
|
this.logger.info(`Resending invitation ${getUid(invitationUid)}`);
|
|
727
|
-
return this.sharing.management.resendInvitationEmail(getUid(nodeUid), getUid(invitationUid))
|
|
626
|
+
return this.sharing.management.resendInvitationEmail(getUid(nodeUid), getUid(invitationUid));
|
|
728
627
|
}
|
|
729
628
|
|
|
730
629
|
/**
|
|
731
630
|
* Get the file downloader to download the node content of the active
|
|
732
631
|
* revision. For downloading specific revision of the file, use
|
|
733
632
|
* `getFileRevisionDownloader`.
|
|
734
|
-
*
|
|
633
|
+
*
|
|
735
634
|
* The number of ongoing downloads is limited. If the limit is reached,
|
|
736
635
|
* the download is queued and started when the slot is available. It is
|
|
737
636
|
* recommended to not start too many downloads at once to avoid having
|
|
738
637
|
* many open promises.
|
|
739
|
-
*
|
|
638
|
+
*
|
|
740
639
|
* The file downloader is not reusable. If the download is interrupted,
|
|
741
640
|
* a new file downloader must be created.
|
|
742
|
-
*
|
|
641
|
+
*
|
|
743
642
|
* Before download, the authorship of the node should be checked and
|
|
744
643
|
* reported to the user if there is any signature issue, notably on the
|
|
745
644
|
* content author on the revision.
|
|
746
|
-
*
|
|
645
|
+
*
|
|
747
646
|
* Client should not automatically retry the download if it fails. The
|
|
748
647
|
* download should be initiated by the user again. The downloader does
|
|
749
648
|
* automatically retry the download if it fails due to network issues,
|
|
750
|
-
* or if the server is temporarily unavailable.
|
|
751
|
-
*
|
|
649
|
+
* or if the server is temporarily unavailable.
|
|
650
|
+
*
|
|
752
651
|
* Once download is initiated, the download can fail, besides network
|
|
753
652
|
* issues etc., only when there is integrity error. It should be considered
|
|
754
653
|
* a bug and reported to the Drive developers. The SDK provides option
|
|
755
654
|
* to bypass integrity checks, but that should be used only for debugging
|
|
756
655
|
* purposes, not available to the end users.
|
|
757
|
-
*
|
|
656
|
+
*
|
|
758
657
|
* Example usage:
|
|
759
|
-
*
|
|
658
|
+
*
|
|
760
659
|
* ```typescript
|
|
761
660
|
* const downloader = await client.getFileDownloader(nodeUid, signal);
|
|
762
661
|
* const claimedSize = fileDownloader.getClaimedSizeInBytes();
|
|
763
662
|
* const downloadController = fileDownloader.writeToStream(stream, (downloadedBytes) => { ... });
|
|
764
|
-
*
|
|
663
|
+
*
|
|
765
664
|
* signalController.abort(); // to cancel
|
|
766
665
|
* downloadController.pause(); // to pause
|
|
767
666
|
* downloadController.resume(); // to resume
|
|
@@ -782,15 +681,19 @@ export class ProtonDriveClient {
|
|
|
782
681
|
}
|
|
783
682
|
|
|
784
683
|
/**
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
async *iterateThumbnails(
|
|
684
|
+
* Iterates the thumbnails of the given nodes.
|
|
685
|
+
*
|
|
686
|
+
* The output is not sorted and the order of the nodes is not guaranteed.
|
|
687
|
+
*
|
|
688
|
+
* @param nodeUids - List of node entities or their UIDs.
|
|
689
|
+
* @param thumbnailType - Type of the thumbnail to download.
|
|
690
|
+
* @returns An async generator of the results of the restore operation
|
|
691
|
+
*/
|
|
692
|
+
async *iterateThumbnails(
|
|
693
|
+
nodeUids: NodeOrUid[],
|
|
694
|
+
thumbnailType?: ThumbnailType,
|
|
695
|
+
signal?: AbortSignal,
|
|
696
|
+
): AsyncGenerator<ThumbnailResult> {
|
|
794
697
|
this.logger.info(`Iterating ${nodeUids.length} thumbnails`);
|
|
795
698
|
yield* this.download.iterateThumbnails(getUids(nodeUids), thumbnailType, signal);
|
|
796
699
|
}
|
|
@@ -798,33 +701,38 @@ export class ProtonDriveClient {
|
|
|
798
701
|
/**
|
|
799
702
|
* Get the file uploader to upload a new file. For uploading a new
|
|
800
703
|
* revision, use `getFileRevisionUploader` instead.
|
|
801
|
-
*
|
|
704
|
+
*
|
|
802
705
|
* The number of ongoing uploads is limited. If the limit is reached,
|
|
803
706
|
* the upload is queued and started when the slot is available. It is
|
|
804
707
|
* recommended to not start too many uploads at once to avoid having
|
|
805
708
|
* many open promises.
|
|
806
|
-
*
|
|
709
|
+
*
|
|
807
710
|
* The file uploader is not reusable. If the upload is interrupted,
|
|
808
711
|
* a new file uploader must be created.
|
|
809
|
-
*
|
|
712
|
+
*
|
|
810
713
|
* Client should not automatically retry the upload if it fails. The
|
|
811
714
|
* upload should be initiated by the user again. The uploader does
|
|
812
715
|
* automatically retry the upload if it fails due to network issues,
|
|
813
716
|
* or if the server is temporarily unavailable.
|
|
814
|
-
*
|
|
717
|
+
*
|
|
815
718
|
* Example usage:
|
|
816
|
-
*
|
|
719
|
+
*
|
|
817
720
|
* ```typescript
|
|
818
721
|
* const uploader = await client.getFileUploader(parentFolderUid, name, metadata, signal);
|
|
819
722
|
* const uploadController = await uploader.writeStream(stream, thumbnails, (uploadedBytes) => { ... });
|
|
820
|
-
*
|
|
723
|
+
*
|
|
821
724
|
* signalController.abort(); // to cancel
|
|
822
725
|
* uploadController.pause(); // to pause
|
|
823
726
|
* uploadController.resume(); // to resume
|
|
824
727
|
* const nodeUid = await uploadController.completion(); // to await completion
|
|
825
728
|
* ```
|
|
826
729
|
*/
|
|
827
|
-
async getFileUploader(
|
|
730
|
+
async getFileUploader(
|
|
731
|
+
parentFolderUid: NodeOrUid,
|
|
732
|
+
name: string,
|
|
733
|
+
metadata: UploadMetadata,
|
|
734
|
+
signal?: AbortSignal,
|
|
735
|
+
): Promise<FileUploader> {
|
|
828
736
|
this.logger.info(`Getting file uploader for parent ${getUid(parentFolderUid)}`);
|
|
829
737
|
return this.upload.getFileUploader(getUid(parentFolderUid), name, metadata, signal);
|
|
830
738
|
}
|
|
@@ -832,28 +740,33 @@ export class ProtonDriveClient {
|
|
|
832
740
|
/**
|
|
833
741
|
* Same as `getFileUploader`, but for a uploading new revision of the file.
|
|
834
742
|
*/
|
|
835
|
-
async getFileRevisionUploader(
|
|
743
|
+
async getFileRevisionUploader(
|
|
744
|
+
nodeUid: NodeOrUid,
|
|
745
|
+
metadata: UploadMetadata,
|
|
746
|
+
signal?: AbortSignal,
|
|
747
|
+
): Promise<FileRevisionUploader> {
|
|
836
748
|
this.logger.info(`Getting file revision uploader for ${getUid(nodeUid)}`);
|
|
837
749
|
return this.upload.getFileRevisionUploader(getUid(nodeUid), metadata, signal);
|
|
838
750
|
}
|
|
839
751
|
|
|
840
752
|
/**
|
|
841
753
|
* Iterates the devices of the user.
|
|
842
|
-
*
|
|
754
|
+
*
|
|
843
755
|
* The output is not sorted and the order of the devices is not guaranteed.
|
|
844
756
|
*
|
|
845
|
-
*
|
|
757
|
+
* New devices can be registered by listening to events in the
|
|
758
|
+
* event scope of "My Files" and filtering on nodes with null `ParentLinkId`.
|
|
846
759
|
*
|
|
847
760
|
* @returns An async generator of devices.
|
|
848
761
|
*/
|
|
849
|
-
async*
|
|
762
|
+
async *iterateDevices(signal?: AbortSignal): AsyncGenerator<Device> {
|
|
850
763
|
this.logger.info('Iterating devices');
|
|
851
764
|
yield* this.devices.iterateDevices(signal);
|
|
852
765
|
}
|
|
853
766
|
|
|
854
767
|
/**
|
|
855
768
|
* Creates a new device.
|
|
856
|
-
*
|
|
769
|
+
*
|
|
857
770
|
* @param nodeUid - Device entity or its UID string.
|
|
858
771
|
* @returns The created device entity.
|
|
859
772
|
* @throws {@link ValidationError} If the name is empty, too long, or contains a slash.
|
|
@@ -865,7 +778,7 @@ export class ProtonDriveClient {
|
|
|
865
778
|
|
|
866
779
|
/**
|
|
867
780
|
* Renames a device.
|
|
868
|
-
*
|
|
781
|
+
*
|
|
869
782
|
* @param deviceOrUid - Device entity or its UID string.
|
|
870
783
|
* @returns The updated device entity.
|
|
871
784
|
* @throws {@link ValidationError} If the name is empty, too long, or contains a slash.
|
|
@@ -877,7 +790,7 @@ export class ProtonDriveClient {
|
|
|
877
790
|
|
|
878
791
|
/**
|
|
879
792
|
* Deletes a device.
|
|
880
|
-
*
|
|
793
|
+
*
|
|
881
794
|
* @param deviceOrUid - Device entity or its UID string.
|
|
882
795
|
*/
|
|
883
796
|
async deleteDevice(deviceOrUid: DeviceOrUid): Promise<void> {
|