@protontech/drive-sdk 0.2.1 → 0.3.0
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/diagnostic/interface.d.ts +26 -29
- package/dist/diagnostic/sdkDiagnostic.js +50 -24
- package/dist/diagnostic/sdkDiagnostic.js.map +1 -1
- package/dist/errors.d.ts +3 -3
- package/dist/errors.js +7 -7
- package/dist/errors.js.map +1 -1
- package/dist/interface/author.d.ts +1 -1
- package/dist/interface/events.d.ts +1 -1
- package/dist/interface/events.js.map +1 -1
- package/dist/internal/apiService/apiService.js +11 -3
- package/dist/internal/apiService/apiService.js.map +1 -1
- package/dist/internal/nodes/apiService.js +3 -0
- package/dist/internal/nodes/apiService.js.map +1 -1
- package/dist/internal/nodes/apiService.test.js +18 -0
- package/dist/internal/nodes/apiService.test.js.map +1 -1
- package/dist/internal/nodes/cryptoService.js +44 -20
- package/dist/internal/nodes/cryptoService.js.map +1 -1
- package/dist/internal/nodes/nodesAccess.js +2 -2
- package/dist/internal/nodes/nodesAccess.js.map +1 -1
- package/dist/internal/nodes/nodesManagement.js +0 -2
- package/dist/internal/nodes/nodesManagement.js.map +1 -1
- package/dist/internal/sharing/interface.d.ts +0 -4
- package/dist/internal/sharing/sharingAccess.d.ts +1 -0
- package/dist/internal/sharing/sharingAccess.js +6 -1
- package/dist/internal/sharing/sharingAccess.js.map +1 -1
- package/dist/internal/sharing/sharingAccess.test.js +3 -3
- package/dist/internal/sharing/sharingAccess.test.js.map +1 -1
- package/dist/internal/sharing/sharingManagement.js +27 -16
- package/dist/internal/sharing/sharingManagement.js.map +1 -1
- package/dist/internal/sharing/sharingManagement.test.js +29 -13
- package/dist/internal/sharing/sharingManagement.test.js.map +1 -1
- package/dist/internal/upload/manager.js +1 -3
- package/dist/internal/upload/manager.js.map +1 -1
- package/dist/internal/upload/manager.test.js +2 -2
- package/dist/internal/upload/manager.test.js.map +1 -1
- package/dist/protonDriveClient.d.ts +8 -8
- package/dist/protonDriveClient.js +14 -14
- package/dist/protonDriveClient.js.map +1 -1
- package/package.json +1 -1
- package/src/diagnostic/interface.ts +27 -29
- package/src/diagnostic/sdkDiagnostic.ts +58 -30
- package/src/errors.ts +5 -5
- package/src/interface/author.ts +1 -1
- package/src/interface/events.ts +1 -7
- package/src/internal/apiService/apiService.ts +12 -3
- package/src/internal/nodes/apiService.test.ts +28 -0
- package/src/internal/nodes/apiService.ts +3 -0
- package/src/internal/nodes/cryptoService.ts +68 -34
- package/src/internal/nodes/nodesAccess.ts +2 -2
- package/src/internal/nodes/nodesManagement.ts +0 -3
- package/src/internal/sharing/interface.ts +0 -4
- package/src/internal/sharing/sharingAccess.test.ts +4 -4
- package/src/internal/sharing/sharingAccess.ts +6 -0
- package/src/internal/sharing/sharingManagement.test.ts +54 -24
- package/src/internal/sharing/sharingManagement.ts +47 -16
- package/src/internal/upload/manager.test.ts +2 -2
- package/src/internal/upload/manager.ts +2 -4
- package/src/protonDriveClient.ts +17 -16
package/src/protonDriveClient.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
MaybeMissingNode,
|
|
7
7
|
NodeResult,
|
|
8
8
|
Revision,
|
|
9
|
+
RevisionOrUid,
|
|
9
10
|
ShareNodeSettings,
|
|
10
11
|
UnshareNodeSettings,
|
|
11
12
|
ProtonInvitationOrUid,
|
|
@@ -311,7 +312,7 @@ export class ProtonDriveClient {
|
|
|
311
312
|
* @param nodeUid - Node entity or its UID string.
|
|
312
313
|
* @returns The updated node entity.
|
|
313
314
|
* @throws {@link ValidationError} If the name is empty, too long, or contains a slash.
|
|
314
|
-
* @throws {@link
|
|
315
|
+
* @throws {@link ValidationError} If another node with the same name already exists.
|
|
315
316
|
*/
|
|
316
317
|
async renameNode(nodeUid: NodeOrUid, newName: string): Promise<MaybeNode> {
|
|
317
318
|
this.logger.info(`Renaming node ${getUid(nodeUid)}`);
|
|
@@ -342,7 +343,7 @@ export class ProtonDriveClient {
|
|
|
342
343
|
newParentNodeUid: NodeOrUid,
|
|
343
344
|
signal?: AbortSignal,
|
|
344
345
|
): AsyncGenerator<NodeResult> {
|
|
345
|
-
this.logger.info(`Moving ${nodeUids.length} nodes to ${newParentNodeUid}`);
|
|
346
|
+
this.logger.info(`Moving ${nodeUids.length} nodes to ${getUid(newParentNodeUid)}`);
|
|
346
347
|
yield* this.nodes.management.moveNodes(getUids(nodeUids), getUid(newParentNodeUid), signal);
|
|
347
348
|
}
|
|
348
349
|
|
|
@@ -453,9 +454,9 @@ export class ProtonDriveClient {
|
|
|
453
454
|
*
|
|
454
455
|
* @param revisionUid - UID of the revision to restore.
|
|
455
456
|
*/
|
|
456
|
-
async restoreRevision(revisionUid:
|
|
457
|
-
this.logger.info(`Restoring revision ${revisionUid}`);
|
|
458
|
-
await this.nodes.revisions.restoreRevision(revisionUid);
|
|
457
|
+
async restoreRevision(revisionUid: RevisionOrUid): Promise<void> {
|
|
458
|
+
this.logger.info(`Restoring revision ${getUid(revisionUid)}`);
|
|
459
|
+
await this.nodes.revisions.restoreRevision(getUid(revisionUid));
|
|
459
460
|
}
|
|
460
461
|
|
|
461
462
|
/**
|
|
@@ -463,9 +464,9 @@ export class ProtonDriveClient {
|
|
|
463
464
|
*
|
|
464
465
|
* @param revisionUid - UID of the revision to delete.
|
|
465
466
|
*/
|
|
466
|
-
async deleteRevision(revisionUid:
|
|
467
|
-
this.logger.info(`Deleting revision ${revisionUid}`);
|
|
468
|
-
await this.nodes.revisions.deleteRevision(revisionUid);
|
|
467
|
+
async deleteRevision(revisionUid: RevisionOrUid): Promise<void> {
|
|
468
|
+
this.logger.info(`Deleting revision ${getUid(revisionUid)}`);
|
|
469
|
+
await this.nodes.revisions.deleteRevision(getUid(revisionUid));
|
|
469
470
|
}
|
|
470
471
|
|
|
471
472
|
/**
|
|
@@ -527,21 +528,21 @@ export class ProtonDriveClient {
|
|
|
527
528
|
/**
|
|
528
529
|
* Accept the invitation to the shared node.
|
|
529
530
|
*
|
|
530
|
-
* @param
|
|
531
|
+
* @param invitationUid - Invitation entity or its UID string.
|
|
531
532
|
*/
|
|
532
|
-
async acceptInvitation(
|
|
533
|
-
this.logger.info(`Accepting invitation ${
|
|
534
|
-
await this.sharing.access.acceptInvitation(
|
|
533
|
+
async acceptInvitation(invitationUid: ProtonInvitationOrUid): Promise<void> {
|
|
534
|
+
this.logger.info(`Accepting invitation ${getUid(invitationUid)}`);
|
|
535
|
+
await this.sharing.access.acceptInvitation(getUid(invitationUid));
|
|
535
536
|
}
|
|
536
537
|
|
|
537
538
|
/**
|
|
538
539
|
* Reject the invitation to the shared node.
|
|
539
540
|
*
|
|
540
|
-
* @param
|
|
541
|
+
* @param invitationOrUid - Invitation entity or its UID string.
|
|
541
542
|
*/
|
|
542
|
-
async rejectInvitation(
|
|
543
|
-
this.logger.info(`Rejecting invitation ${
|
|
544
|
-
await this.sharing.access.rejectInvitation(
|
|
543
|
+
async rejectInvitation(invitationUid: ProtonInvitationOrUid): Promise<void> {
|
|
544
|
+
this.logger.info(`Rejecting invitation ${getUid(invitationUid)}`);
|
|
545
|
+
await this.sharing.access.rejectInvitation(getUid(invitationUid));
|
|
545
546
|
}
|
|
546
547
|
|
|
547
548
|
/**
|