@protontech/drive-sdk 0.7.0 → 0.7.2

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.
Files changed (99) hide show
  1. package/dist/interface/index.d.ts +1 -0
  2. package/dist/interface/index.js.map +1 -1
  3. package/dist/interface/nodes.d.ts +14 -10
  4. package/dist/interface/nodes.js +5 -8
  5. package/dist/interface/nodes.js.map +1 -1
  6. package/dist/interface/photos.d.ts +62 -0
  7. package/dist/interface/photos.js +3 -0
  8. package/dist/interface/photos.js.map +1 -0
  9. package/dist/internal/apiService/driveTypes.d.ts +1294 -517
  10. package/dist/internal/errors.d.ts +1 -0
  11. package/dist/internal/errors.js +4 -0
  12. package/dist/internal/errors.js.map +1 -1
  13. package/dist/internal/nodes/apiService.d.ts +60 -9
  14. package/dist/internal/nodes/apiService.js +125 -81
  15. package/dist/internal/nodes/apiService.js.map +1 -1
  16. package/dist/internal/nodes/apiService.test.js +2 -0
  17. package/dist/internal/nodes/apiService.test.js.map +1 -1
  18. package/dist/internal/nodes/cache.d.ts +16 -8
  19. package/dist/internal/nodes/cache.js +19 -5
  20. package/dist/internal/nodes/cache.js.map +1 -1
  21. package/dist/internal/nodes/cache.test.js +1 -0
  22. package/dist/internal/nodes/cache.test.js.map +1 -1
  23. package/dist/internal/nodes/cryptoService.d.ts +1 -1
  24. package/dist/internal/nodes/cryptoService.js +4 -4
  25. package/dist/internal/nodes/cryptoService.js.map +1 -1
  26. package/dist/internal/nodes/cryptoService.test.js +3 -3
  27. package/dist/internal/nodes/cryptoService.test.js.map +1 -1
  28. package/dist/internal/nodes/events.d.ts +2 -2
  29. package/dist/internal/nodes/events.js.map +1 -1
  30. package/dist/internal/nodes/index.test.js +1 -0
  31. package/dist/internal/nodes/index.test.js.map +1 -1
  32. package/dist/internal/nodes/interface.d.ts +1 -0
  33. package/dist/internal/nodes/nodesAccess.d.ts +29 -20
  34. package/dist/internal/nodes/nodesAccess.js +41 -29
  35. package/dist/internal/nodes/nodesAccess.js.map +1 -1
  36. package/dist/internal/nodes/nodesManagement.d.ts +32 -12
  37. package/dist/internal/nodes/nodesManagement.js +30 -13
  38. package/dist/internal/nodes/nodesManagement.js.map +1 -1
  39. package/dist/internal/nodes/nodesManagement.test.js +39 -4
  40. package/dist/internal/nodes/nodesManagement.test.js.map +1 -1
  41. package/dist/internal/nodes/nodesRevisions.d.ts +2 -2
  42. package/dist/internal/nodes/nodesRevisions.js.map +1 -1
  43. package/dist/internal/photos/albums.d.ts +2 -2
  44. package/dist/internal/photos/albums.js.map +1 -1
  45. package/dist/internal/photos/index.d.ts +19 -3
  46. package/dist/internal/photos/index.js +38 -8
  47. package/dist/internal/photos/index.js.map +1 -1
  48. package/dist/internal/photos/interface.d.ts +18 -9
  49. package/dist/internal/photos/nodes.d.ts +57 -0
  50. package/dist/internal/photos/nodes.js +166 -0
  51. package/dist/internal/photos/nodes.js.map +1 -0
  52. package/dist/internal/photos/nodes.test.d.ts +1 -0
  53. package/dist/internal/photos/nodes.test.js +233 -0
  54. package/dist/internal/photos/nodes.test.js.map +1 -0
  55. package/dist/internal/photos/timeline.d.ts +2 -2
  56. package/dist/internal/photos/timeline.js.map +1 -1
  57. package/dist/internal/photos/timeline.test.js.map +1 -1
  58. package/dist/protonDriveClient.d.ts +10 -1
  59. package/dist/protonDriveClient.js +18 -3
  60. package/dist/protonDriveClient.js.map +1 -1
  61. package/dist/protonDrivePhotosClient.d.ts +12 -8
  62. package/dist/protonDrivePhotosClient.js +15 -9
  63. package/dist/protonDrivePhotosClient.js.map +1 -1
  64. package/dist/protonDrivePublicLinkClient.d.ts +7 -1
  65. package/dist/protonDrivePublicLinkClient.js +9 -0
  66. package/dist/protonDrivePublicLinkClient.js.map +1 -1
  67. package/dist/transformers.d.ts +7 -2
  68. package/dist/transformers.js +37 -0
  69. package/dist/transformers.js.map +1 -1
  70. package/package.json +1 -1
  71. package/src/interface/index.ts +1 -0
  72. package/src/interface/nodes.ts +14 -11
  73. package/src/interface/photos.ts +67 -0
  74. package/src/internal/apiService/driveTypes.ts +1294 -517
  75. package/src/internal/errors.ts +4 -0
  76. package/src/internal/nodes/apiService.test.ts +2 -0
  77. package/src/internal/nodes/apiService.ts +187 -114
  78. package/src/internal/nodes/cache.test.ts +1 -0
  79. package/src/internal/nodes/cache.ts +32 -13
  80. package/src/internal/nodes/cryptoService.test.ts +13 -3
  81. package/src/internal/nodes/cryptoService.ts +4 -4
  82. package/src/internal/nodes/events.ts +2 -2
  83. package/src/internal/nodes/index.test.ts +1 -0
  84. package/src/internal/nodes/interface.ts +1 -0
  85. package/src/internal/nodes/nodesAccess.ts +82 -54
  86. package/src/internal/nodes/nodesManagement.test.ts +48 -4
  87. package/src/internal/nodes/nodesManagement.ts +76 -26
  88. package/src/internal/nodes/nodesRevisions.ts +3 -3
  89. package/src/internal/photos/albums.ts +2 -2
  90. package/src/internal/photos/index.ts +45 -3
  91. package/src/internal/photos/interface.ts +21 -9
  92. package/src/internal/photos/nodes.test.ts +258 -0
  93. package/src/internal/photos/nodes.ts +234 -0
  94. package/src/internal/photos/timeline.test.ts +2 -2
  95. package/src/internal/photos/timeline.ts +2 -2
  96. package/src/protonDriveClient.ts +20 -3
  97. package/src/protonDrivePhotosClient.ts +31 -23
  98. package/src/protonDrivePublicLinkClient.ts +11 -0
  99. 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;AAoB5C,qCAAqD;AAA5C,mHAAA,wBAAwB,OAAA;AAiBjC,yCAA+C;AAAtC,6GAAA,gBAAgB,OAAA;AAGzB,yCAA4C;AAAnC,0GAAA,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 a special type available only in Photos section.
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: string;
231
+ error: Error;
228
232
  };
@@ -6,16 +6,13 @@ var NodeType;
6
6
  NodeType["File"] = "file";
7
7
  NodeType["Folder"] = "folder";
8
8
  /**
9
- * Album is a special type available only in Photos section.
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":";;;AA6JA,IAAY,QAcX;AAdD,WAAY,QAAQ;IAChB,yBAAa,CAAA;IACb,6BAAiB,CAAA;IACjB;;;;;;;;;OASG;IACH,2BAAe,CAAA;AACnB,CAAC,EAdW,QAAQ,wBAAR,QAAQ,QAcnB;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;AAsBD,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,kCAAiB,CAAA;IACjB,0CAAyB,CAAA;AAC7B,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB"}
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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=photos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"photos.js","sourceRoot":"","sources":["../../src/interface/photos.ts"],"names":[],"mappings":""}