@protontech/drive-sdk 0.13.1 → 0.14.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/telemetry.d.ts +5 -4
- package/dist/interface/telemetry.js +1 -0
- package/dist/interface/telemetry.js.map +1 -1
- package/dist/internal/download/telemetry.js +2 -1
- package/dist/internal/download/telemetry.js.map +1 -1
- package/dist/internal/nodes/cryptoReporter.js +2 -2
- package/dist/internal/nodes/cryptoReporter.js.map +1 -1
- package/dist/internal/photos/addToAlbum.d.ts +6 -0
- package/dist/internal/photos/addToAlbum.js +1 -0
- package/dist/internal/photos/addToAlbum.js.map +1 -1
- package/dist/internal/photos/albumsManager.d.ts +4 -1
- package/dist/internal/photos/albumsManager.js +22 -2
- package/dist/internal/photos/albumsManager.js.map +1 -1
- package/dist/internal/photos/albumsManager.test.js +41 -1
- package/dist/internal/photos/albumsManager.test.js.map +1 -1
- package/dist/internal/photos/apiService.d.ts +1 -0
- package/dist/internal/photos/apiService.js +59 -5
- package/dist/internal/photos/apiService.js.map +1 -1
- package/dist/internal/photos/apiService.test.js +137 -0
- package/dist/internal/photos/apiService.test.js.map +1 -1
- package/dist/internal/photos/errors.d.ts +5 -0
- package/dist/internal/photos/errors.js +10 -1
- package/dist/internal/photos/errors.js.map +1 -1
- package/dist/internal/photos/index.js +1 -1
- package/dist/internal/photos/index.js.map +1 -1
- package/dist/internal/photos/photosManager.d.ts +1 -0
- package/dist/internal/photos/photosManager.js +42 -4
- package/dist/internal/photos/photosManager.js.map +1 -1
- package/dist/internal/photos/photosManager.test.js +35 -0
- package/dist/internal/photos/photosManager.test.js.map +1 -1
- package/dist/internal/photos/photosTransferPayloadBuilder.d.ts +1 -0
- package/dist/internal/photos/photosTransferPayloadBuilder.js +1 -0
- package/dist/internal/photos/photosTransferPayloadBuilder.js.map +1 -1
- package/dist/internal/sharingPublic/session/index.d.ts +1 -0
- package/dist/internal/sharingPublic/session/index.js +3 -1
- package/dist/internal/sharingPublic/session/index.js.map +1 -1
- package/dist/internal/sharingPublic/session/manager.d.ts +2 -0
- package/dist/internal/sharingPublic/session/manager.js +1 -0
- package/dist/internal/sharingPublic/session/manager.js.map +1 -1
- package/dist/internal/upload/telemetry.js +2 -1
- package/dist/internal/upload/telemetry.js.map +1 -1
- package/dist/protonDriveClient.js +2 -1
- package/dist/protonDriveClient.js.map +1 -1
- package/dist/protonDrivePhotosClient.d.ts +4 -3
- package/dist/protonDrivePhotosClient.js +3 -3
- package/dist/protonDrivePhotosClient.js.map +1 -1
- package/dist/protonDrivePublicLinkClient.d.ts +15 -1
- package/dist/protonDrivePublicLinkClient.js +7 -1
- package/dist/protonDrivePublicLinkClient.js.map +1 -1
- package/package.json +1 -1
- package/src/interface/telemetry.ts +5 -4
- package/src/internal/download/telemetry.ts +2 -2
- package/src/internal/nodes/cryptoReporter.ts +4 -2
- package/src/internal/photos/addToAlbum.ts +1 -1
- package/src/internal/photos/albumsManager.test.ts +61 -1
- package/src/internal/photos/albumsManager.ts +23 -3
- package/src/internal/photos/apiService.test.ts +155 -0
- package/src/internal/photos/apiService.ts +92 -3
- package/src/internal/photos/errors.ts +11 -0
- package/src/internal/photos/index.ts +1 -1
- package/src/internal/photos/photosManager.test.ts +43 -1
- package/src/internal/photos/photosManager.ts +61 -3
- package/src/internal/photos/photosTransferPayloadBuilder.ts +3 -1
- package/src/internal/sharingPublic/session/index.ts +1 -0
- package/src/internal/sharingPublic/session/manager.ts +2 -0
- package/src/internal/upload/telemetry.ts +2 -2
- package/src/protonDriveClient.ts +2 -1
- package/src/protonDrivePhotosClient.ts +4 -4
- package/src/protonDrivePublicLinkClient.ts +23 -2
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
import { initDownloadModule } from './internal/download';
|
|
34
34
|
import { SDKEvents } from './internal/sdkEvents';
|
|
35
35
|
import { initSharingPublicModule, UnauthDriveAPIService } from './internal/sharingPublic';
|
|
36
|
+
import { SharingPublicLinkSession } from './internal/sharingPublic/session';
|
|
36
37
|
import { initUploadModule } from './internal/upload';
|
|
37
38
|
import { NullFeatureFlagProvider } from './featureFlags';
|
|
38
39
|
import { NodesSecurityScanResult } from './internal/sharingPublic/nodesSecurity';
|
|
@@ -56,6 +57,7 @@ export class ProtonDrivePublicLinkClient {
|
|
|
56
57
|
private sharingPublic: ReturnType<typeof initSharingPublicModule>;
|
|
57
58
|
private download: ReturnType<typeof initDownloadModule>;
|
|
58
59
|
private upload: ReturnType<typeof initUploadModule>;
|
|
60
|
+
private session: SharingPublicLinkSession;
|
|
59
61
|
|
|
60
62
|
public experimental: {
|
|
61
63
|
/**
|
|
@@ -86,6 +88,14 @@ export class ProtonDrivePublicLinkClient {
|
|
|
86
88
|
* Experimental feature to create a document (Proton Docs or Proton Sheets) in the public link.
|
|
87
89
|
*/
|
|
88
90
|
createDocument: (parentNodeUid: NodeOrUid, documentName: string, documentType: 1 | 2) => Promise<MaybeNode>;
|
|
91
|
+
/**
|
|
92
|
+
* Experimental feature to get the session info for the public link.
|
|
93
|
+
*
|
|
94
|
+
* This helper is used to set the session for metrics requests.
|
|
95
|
+
* Returns the session UID and access token that were obtained during
|
|
96
|
+
* authentication.
|
|
97
|
+
*/
|
|
98
|
+
getSessionInfo: () => { uid: string; accessToken: string | undefined };
|
|
89
99
|
};
|
|
90
100
|
|
|
91
101
|
constructor({
|
|
@@ -102,6 +112,7 @@ export class ProtonDrivePublicLinkClient {
|
|
|
102
112
|
publicRootNodeUid,
|
|
103
113
|
isAnonymousContext,
|
|
104
114
|
publicRole,
|
|
115
|
+
session,
|
|
105
116
|
}: {
|
|
106
117
|
httpClient: ProtonDriveHTTPClient;
|
|
107
118
|
account: ProtonDriveAccount;
|
|
@@ -116,6 +127,7 @@ export class ProtonDrivePublicLinkClient {
|
|
|
116
127
|
publicRootNodeUid: string;
|
|
117
128
|
isAnonymousContext: boolean;
|
|
118
129
|
publicRole: MemberRole;
|
|
130
|
+
session: SharingPublicLinkSession;
|
|
119
131
|
}) {
|
|
120
132
|
if (!telemetry) {
|
|
121
133
|
telemetry = new Telemetry();
|
|
@@ -124,6 +136,7 @@ export class ProtonDrivePublicLinkClient {
|
|
|
124
136
|
featureFlagProvider = new NullFeatureFlagProvider();
|
|
125
137
|
}
|
|
126
138
|
this.logger = telemetry.getLogger('publicLink-interface');
|
|
139
|
+
this.session = session;
|
|
127
140
|
|
|
128
141
|
// Use only in memory cache for public link as there are no events to keep it up to date if persisted.
|
|
129
142
|
const entitiesCache = new MemoryCache<string>();
|
|
@@ -197,7 +210,7 @@ export class ProtonDrivePublicLinkClient {
|
|
|
197
210
|
if (!keys.passphrase) {
|
|
198
211
|
throw new Error('Node does not have a passphrase');
|
|
199
212
|
}
|
|
200
|
-
return keys.passphrase
|
|
213
|
+
return keys.passphrase;
|
|
201
214
|
},
|
|
202
215
|
scanHashes: async (hashes: string[]): Promise<NodesSecurityScanResult> => {
|
|
203
216
|
this.logger.debug(`Scanning ${hashes.length} hashes`);
|
|
@@ -210,9 +223,17 @@ export class ProtonDrivePublicLinkClient {
|
|
|
210
223
|
): Promise<MaybeNode> => {
|
|
211
224
|
this.logger.debug(`Creating document in ${getUid(parentNodeUid)}`);
|
|
212
225
|
return convertInternalNodePromise(
|
|
213
|
-
this.sharingPublic.nodes.management.createDocument(
|
|
226
|
+
this.sharingPublic.nodes.management.createDocument(
|
|
227
|
+
getUid(parentNodeUid),
|
|
228
|
+
documentName,
|
|
229
|
+
documentType,
|
|
230
|
+
),
|
|
214
231
|
);
|
|
215
232
|
},
|
|
233
|
+
getSessionInfo: (): { uid: string; accessToken: string | undefined } => {
|
|
234
|
+
this.logger.debug(`Getting session info`);
|
|
235
|
+
return this.session.session;
|
|
236
|
+
},
|
|
216
237
|
};
|
|
217
238
|
}
|
|
218
239
|
|