@protontech/drive-sdk 0.7.0 → 0.7.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/interface/index.d.ts +1 -0
- package/dist/interface/index.js.map +1 -1
- package/dist/interface/nodes.d.ts +14 -10
- package/dist/interface/nodes.js +5 -8
- package/dist/interface/nodes.js.map +1 -1
- package/dist/interface/photos.d.ts +62 -0
- package/dist/interface/photos.js +3 -0
- package/dist/interface/photos.js.map +1 -0
- package/dist/internal/apiService/driveTypes.d.ts +1294 -517
- package/dist/internal/errors.d.ts +1 -0
- package/dist/internal/errors.js +4 -0
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/nodes/apiService.d.ts +60 -9
- package/dist/internal/nodes/apiService.js +125 -81
- package/dist/internal/nodes/apiService.js.map +1 -1
- package/dist/internal/nodes/apiService.test.js +2 -0
- package/dist/internal/nodes/apiService.test.js.map +1 -1
- package/dist/internal/nodes/cache.d.ts +16 -8
- package/dist/internal/nodes/cache.js +19 -5
- package/dist/internal/nodes/cache.js.map +1 -1
- package/dist/internal/nodes/cache.test.js +1 -0
- package/dist/internal/nodes/cache.test.js.map +1 -1
- package/dist/internal/nodes/cryptoService.d.ts +1 -1
- package/dist/internal/nodes/cryptoService.js +4 -4
- package/dist/internal/nodes/cryptoService.js.map +1 -1
- package/dist/internal/nodes/cryptoService.test.js +3 -3
- package/dist/internal/nodes/cryptoService.test.js.map +1 -1
- package/dist/internal/nodes/events.d.ts +2 -2
- package/dist/internal/nodes/events.js.map +1 -1
- package/dist/internal/nodes/index.test.js +1 -0
- package/dist/internal/nodes/index.test.js.map +1 -1
- package/dist/internal/nodes/interface.d.ts +1 -0
- package/dist/internal/nodes/nodesAccess.d.ts +29 -20
- package/dist/internal/nodes/nodesAccess.js +41 -29
- package/dist/internal/nodes/nodesAccess.js.map +1 -1
- package/dist/internal/nodes/nodesManagement.d.ts +32 -12
- package/dist/internal/nodes/nodesManagement.js +30 -13
- package/dist/internal/nodes/nodesManagement.js.map +1 -1
- package/dist/internal/nodes/nodesManagement.test.js +39 -4
- package/dist/internal/nodes/nodesManagement.test.js.map +1 -1
- package/dist/internal/nodes/nodesRevisions.d.ts +2 -2
- package/dist/internal/nodes/nodesRevisions.js.map +1 -1
- package/dist/internal/photos/albums.d.ts +2 -2
- package/dist/internal/photos/albums.js.map +1 -1
- package/dist/internal/photos/index.d.ts +19 -3
- package/dist/internal/photos/index.js +38 -8
- package/dist/internal/photos/index.js.map +1 -1
- package/dist/internal/photos/interface.d.ts +18 -9
- package/dist/internal/photos/nodes.d.ts +57 -0
- package/dist/internal/photos/nodes.js +165 -0
- package/dist/internal/photos/nodes.js.map +1 -0
- package/dist/internal/photos/timeline.d.ts +2 -2
- package/dist/internal/photos/timeline.js.map +1 -1
- package/dist/internal/photos/timeline.test.js.map +1 -1
- package/dist/protonDriveClient.d.ts +10 -1
- package/dist/protonDriveClient.js +18 -3
- package/dist/protonDriveClient.js.map +1 -1
- package/dist/protonDrivePhotosClient.d.ts +8 -8
- package/dist/protonDrivePhotosClient.js +8 -9
- package/dist/protonDrivePhotosClient.js.map +1 -1
- package/dist/protonDrivePublicLinkClient.d.ts +7 -1
- package/dist/protonDrivePublicLinkClient.js +9 -0
- package/dist/protonDrivePublicLinkClient.js.map +1 -1
- package/dist/transformers.d.ts +7 -2
- package/dist/transformers.js +37 -0
- package/dist/transformers.js.map +1 -1
- package/package.json +1 -1
- package/src/interface/index.ts +1 -0
- package/src/interface/nodes.ts +14 -11
- package/src/interface/photos.ts +67 -0
- package/src/internal/apiService/driveTypes.ts +1294 -517
- package/src/internal/errors.ts +4 -0
- package/src/internal/nodes/apiService.test.ts +2 -0
- package/src/internal/nodes/apiService.ts +187 -114
- package/src/internal/nodes/cache.test.ts +1 -0
- package/src/internal/nodes/cache.ts +32 -13
- package/src/internal/nodes/cryptoService.test.ts +13 -3
- package/src/internal/nodes/cryptoService.ts +4 -4
- package/src/internal/nodes/events.ts +2 -2
- package/src/internal/nodes/index.test.ts +1 -0
- package/src/internal/nodes/interface.ts +1 -0
- package/src/internal/nodes/nodesAccess.ts +82 -54
- package/src/internal/nodes/nodesManagement.test.ts +48 -4
- package/src/internal/nodes/nodesManagement.ts +76 -26
- package/src/internal/nodes/nodesRevisions.ts +3 -3
- package/src/internal/photos/albums.ts +2 -2
- package/src/internal/photos/index.ts +45 -3
- package/src/internal/photos/interface.ts +21 -9
- package/src/internal/photos/nodes.ts +233 -0
- package/src/internal/photos/timeline.test.ts +2 -2
- package/src/internal/photos/timeline.ts +2 -2
- package/src/protonDriveClient.ts +20 -3
- package/src/protonDrivePhotosClient.ts +23 -23
- package/src/protonDrivePublicLinkClient.ts +11 -0
- package/src/transformers.ts +49 -2
|
@@ -20,6 +20,7 @@ export { DriveEventType, SDKEvent } from './events';
|
|
|
20
20
|
export type { ProtonDriveHTTPClient, ProtonDriveHTTPClientJsonRequest, ProtonDriveHTTPClientBlobRequest, } from './httpClient';
|
|
21
21
|
export type { MaybeNode, NodeEntity, DegradedNode, MaybeMissingNode, MissingNode, InvalidNameError, Revision, NodeOrUid, RevisionOrUid, NodeResult, NodeResultWithNewUid, Membership, } from './nodes';
|
|
22
22
|
export { NodeType, MemberRole, RevisionState } from './nodes';
|
|
23
|
+
export type { MaybePhotoNode, MaybeMissingPhotoNode, PhotoNode, DegradedPhotoNode, PhotoAttributes } from './photos';
|
|
23
24
|
export type { ProtonInvitation, ProtonInvitationWithNode, NonProtonInvitation, Member, PublicLink, MaybeBookmark, Bookmark, DegradedBookmark, ProtonInvitationOrUid, NonProtonInvitationOrUid, BookmarkOrUid, ShareNodeSettings, UnshareNodeSettings, ShareMembersSettings, SharePublicLinkSettings, SharePublicLinkSettingsObject, ShareResult, } from './sharing';
|
|
24
25
|
export { NonProtonInvitationState } from './sharing';
|
|
25
26
|
export type { Telemetry, Logger, MetricAPIRetrySucceededEvent, MetricUploadEvent, MetricsUploadErrorType, MetricDownloadEvent, MetricsDownloadErrorType, MetricDecryptionErrorEvent, MetricsDecryptionErrorField, MetricVerificationErrorEvent, MetricVerificationErrorField, MetricBlockVerificationErrorEvent, MetricVolumeEventsSubscriptionsChangedEvent, MetricEvent, } from './telemetry';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interface/index.ts"],"names":[],"mappings":";;;AAUA,mCAAiD;AAAxC,kGAAA,QAAQ,OAAA;AAAE,qGAAA,WAAW,OAAA;AAM9B,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AAYnB,mCAAoD;AAA3C,wGAAA,cAAc,OAAA;AAAE,kGAAA,QAAQ,OAAA;AAoBjC,iCAA8D;AAArD,iGAAA,QAAQ,OAAA;AAAE,mGAAA,UAAU,OAAA;AAAE,sGAAA,aAAa,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interface/index.ts"],"names":[],"mappings":";;;AAUA,mCAAiD;AAAxC,kGAAA,QAAQ,OAAA;AAAE,qGAAA,WAAW,OAAA;AAM9B,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AAYnB,mCAAoD;AAA3C,wGAAA,cAAc,OAAA;AAAE,kGAAA,QAAQ,OAAA;AAoBjC,iCAA8D;AAArD,iGAAA,QAAQ,OAAA;AAAE,mGAAA,UAAU,OAAA;AAAE,sGAAA,aAAa,OAAA;AAqB5C,qCAAqD;AAA5C,mHAAA,wBAAwB,OAAA;AAiBjC,yCAA+C;AAAtC,6GAAA,gBAAgB,OAAA;AAGzB,yCAA4C;AAAnC,0GAAA,aAAa,OAAA"}
|
|
@@ -88,6 +88,10 @@ export type NodeEntity = {
|
|
|
88
88
|
* Created on server date.
|
|
89
89
|
*/
|
|
90
90
|
creationTime: Date;
|
|
91
|
+
/**
|
|
92
|
+
* Modified on server (renamed, moved, etc.).
|
|
93
|
+
*/
|
|
94
|
+
modificationTime: Date;
|
|
91
95
|
trashTime?: Date;
|
|
92
96
|
/**
|
|
93
97
|
* Total size of all revisions, encrypted size on the server.
|
|
@@ -152,16 +156,13 @@ export declare enum NodeType {
|
|
|
152
156
|
File = "file",
|
|
153
157
|
Folder = "folder",
|
|
154
158
|
/**
|
|
155
|
-
* Album is
|
|
156
|
-
*
|
|
157
|
-
* The SDK does not support any album-specific actions, but it can load
|
|
158
|
-
* the node and do general operations on it, such as sharing. However,
|
|
159
|
-
* you should not rely that anything can work. It is not guaranteed that
|
|
160
|
-
* and in the future specific Photos SDK will support albums.
|
|
161
|
-
*
|
|
162
|
-
* @deprecated This type is not part of the public API.
|
|
159
|
+
* Album is returned only by `ProtonDrivePhotosClient`.
|
|
163
160
|
*/
|
|
164
|
-
Album = "album"
|
|
161
|
+
Album = "album",
|
|
162
|
+
/**
|
|
163
|
+
* Photo is returned only by `ProtonDrivePhotosClient`.
|
|
164
|
+
*/
|
|
165
|
+
Photo = "photo"
|
|
165
166
|
}
|
|
166
167
|
export type Membership = {
|
|
167
168
|
role: MemberRole;
|
|
@@ -197,6 +198,9 @@ export type Revision = {
|
|
|
197
198
|
* Raw size of the revision, as stored in extended attributes.
|
|
198
199
|
*/
|
|
199
200
|
claimedSize?: number;
|
|
201
|
+
/**
|
|
202
|
+
* Modification time on the file system.
|
|
203
|
+
*/
|
|
200
204
|
claimedModificationTime?: Date;
|
|
201
205
|
claimedDigests?: {
|
|
202
206
|
sha1?: string;
|
|
@@ -224,5 +228,5 @@ export type NodeResultWithNewUid = {
|
|
|
224
228
|
} | {
|
|
225
229
|
uid: string;
|
|
226
230
|
ok: false;
|
|
227
|
-
error:
|
|
231
|
+
error: Error;
|
|
228
232
|
};
|
package/dist/interface/nodes.js
CHANGED
|
@@ -6,16 +6,13 @@ var NodeType;
|
|
|
6
6
|
NodeType["File"] = "file";
|
|
7
7
|
NodeType["Folder"] = "folder";
|
|
8
8
|
/**
|
|
9
|
-
* Album is
|
|
10
|
-
*
|
|
11
|
-
* The SDK does not support any album-specific actions, but it can load
|
|
12
|
-
* the node and do general operations on it, such as sharing. However,
|
|
13
|
-
* you should not rely that anything can work. It is not guaranteed that
|
|
14
|
-
* and in the future specific Photos SDK will support albums.
|
|
15
|
-
*
|
|
16
|
-
* @deprecated This type is not part of the public API.
|
|
9
|
+
* Album is returned only by `ProtonDrivePhotosClient`.
|
|
17
10
|
*/
|
|
18
11
|
NodeType["Album"] = "album";
|
|
12
|
+
/**
|
|
13
|
+
* Photo is returned only by `ProtonDrivePhotosClient`.
|
|
14
|
+
*/
|
|
15
|
+
NodeType["Photo"] = "photo";
|
|
19
16
|
})(NodeType || (exports.NodeType = NodeType = {}));
|
|
20
17
|
var MemberRole;
|
|
21
18
|
(function (MemberRole) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../src/interface/nodes.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../src/interface/nodes.ts"],"names":[],"mappings":";;;AAiKA,IAAY,QAWX;AAXD,WAAY,QAAQ;IAChB,yBAAa,CAAA;IACb,6BAAiB,CAAA;IACjB;;OAEG;IACH,2BAAe,CAAA;IACf;;OAEG;IACH,2BAAe,CAAA;AACnB,CAAC,EAXW,QAAQ,wBAAR,QAAQ,QAWnB;AAmBD,IAAY,UAKX;AALD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,6BAAe,CAAA;IACf,qCAAuB,CAAA;AAC3B,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAyBD,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,kCAAiB,CAAA;IACjB,0CAAyB,CAAA;AAC7B,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Result } from "./result";
|
|
2
|
+
import { DegradedNode, NodeEntity, NodeType, MissingNode } from "./nodes";
|
|
3
|
+
/**
|
|
4
|
+
* Node representing a photo or album for Photos SDK.
|
|
5
|
+
*
|
|
6
|
+
* See `MaybeNode` for more information.
|
|
7
|
+
*/
|
|
8
|
+
export type MaybePhotoNode = Result<PhotoNode, DegradedPhotoNode>;
|
|
9
|
+
/**
|
|
10
|
+
* Node representing a photo or album, or missing node for Photos SDK.
|
|
11
|
+
*
|
|
12
|
+
* See `MaybeMissingNode` for more information.
|
|
13
|
+
*/
|
|
14
|
+
export type MaybeMissingPhotoNode = Result<PhotoNode, DegradedPhotoNode | MissingNode>;
|
|
15
|
+
/**
|
|
16
|
+
* Node representing a photo or album for Photos SDK.
|
|
17
|
+
*
|
|
18
|
+
* See `NodeEntity` for more information.
|
|
19
|
+
*/
|
|
20
|
+
export type PhotoNode = NodeEntity & {
|
|
21
|
+
type: NodeType.Photo;
|
|
22
|
+
photo?: PhotoAttributes;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Degraded node representing a photo or album for Photos SDK.
|
|
26
|
+
*
|
|
27
|
+
* See `DegradedNode` for more information.
|
|
28
|
+
*/
|
|
29
|
+
export type DegradedPhotoNode = DegradedNode & {
|
|
30
|
+
photo?: PhotoAttributes;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Attributes of a photo.
|
|
34
|
+
*
|
|
35
|
+
* Only nodes of type `NodeType.Photo` have property of this type.
|
|
36
|
+
*/
|
|
37
|
+
export type PhotoAttributes = {
|
|
38
|
+
/**
|
|
39
|
+
* Date used for sorting in the photo timeline.
|
|
40
|
+
*/
|
|
41
|
+
captureTime: Date;
|
|
42
|
+
/**
|
|
43
|
+
* Photo can consist of multiple photos or vidoes (e.g., live photo).
|
|
44
|
+
* Only the main photos are iterated and each main photo will have
|
|
45
|
+
* set the list of related photo UIDs that client can use to load
|
|
46
|
+
* the related photos. All the related photos will have set the
|
|
47
|
+
* main photo UID.
|
|
48
|
+
*/
|
|
49
|
+
mainPhotoNodeUid?: string;
|
|
50
|
+
relatedPhotoNodeUids: string[];
|
|
51
|
+
/**
|
|
52
|
+
* List of albums in which the photo is included.
|
|
53
|
+
*/
|
|
54
|
+
albums: {
|
|
55
|
+
nodeUid: string;
|
|
56
|
+
additionTime: Date;
|
|
57
|
+
}[];
|
|
58
|
+
/**
|
|
59
|
+
* List of tags assigned to the photo.
|
|
60
|
+
*/
|
|
61
|
+
tags: number[];
|
|
62
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"photos.js","sourceRoot":"","sources":["../../src/interface/photos.ts"],"names":[],"mappings":""}
|