@atlaskit/media-client 26.2.0 → 26.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/media-client
2
2
 
3
+ ## 26.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#77668](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77668) [`c8a08df51a9f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c8a08df51a9f) - Add password protected pdf support for media viewer
8
+
3
9
  ## 26.2.0
4
10
 
5
11
  ### Minor Changes
@@ -226,8 +226,8 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
226
226
  }
227
227
  }, {
228
228
  key: "getFileBinaryURL",
229
- value: function getFileBinaryURL(id, collectionName) {
230
- return this.mediaApi.getFileBinaryURL(id, collectionName);
229
+ value: function getFileBinaryURL(id, collectionName, maxAge) {
230
+ return this.mediaApi.getFileBinaryURL(id, collectionName, maxAge);
231
231
  }
232
232
  }, {
233
233
  key: "touchFiles",
@@ -296,26 +296,30 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
296
296
  key: "getFileBinaryURL",
297
297
  value: function () {
298
298
  var _getFileBinaryURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(id, collectionName) {
299
- var auth, options;
299
+ var maxAge,
300
+ auth,
301
+ options,
302
+ _args5 = arguments;
300
303
  return _regenerator.default.wrap(function _callee5$(_context5) {
301
304
  while (1) switch (_context5.prev = _context5.next) {
302
305
  case 0:
303
- _context5.next = 2;
306
+ maxAge = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : _constants.FILE_CACHE_MAX_AGE;
307
+ _context5.next = 3;
304
308
  return this.resolveAuth({
305
309
  collectionName: collectionName
306
310
  });
307
- case 2:
311
+ case 3:
308
312
  auth = _context5.sent;
309
313
  options = {
310
314
  params: {
311
315
  dl: true,
312
316
  collection: collectionName,
313
- 'max-age': _constants.FILE_CACHE_MAX_AGE
317
+ 'max-age': maxAge
314
318
  },
315
319
  auth: auth
316
320
  };
317
321
  return _context5.abrupt("return", (0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/binary"), options));
318
- case 5:
322
+ case 6:
319
323
  case "end":
320
324
  return _context5.stop();
321
325
  }
@@ -172,8 +172,8 @@ export class FileFetcherImpl {
172
172
  getArtifactURL(artifacts, artifactName, collectionName) {
173
173
  return this.mediaApi.getArtifactURL(artifacts, artifactName, collectionName);
174
174
  }
175
- getFileBinaryURL(id, collectionName) {
176
- return this.mediaApi.getFileBinaryURL(id, collectionName);
175
+ getFileBinaryURL(id, collectionName, maxAge) {
176
+ return this.mediaApi.getFileBinaryURL(id, collectionName, maxAge);
177
177
  }
178
178
  touchFiles(descriptors, collection, traceContext) {
179
179
  return this.mediaApi.touchFiles({
@@ -186,7 +186,7 @@ export class MediaStore {
186
186
  };
187
187
  return createUrl(`${auth.baseUrl}/file/${id}/image`, options);
188
188
  }
189
- async getFileBinaryURL(id, collectionName) {
189
+ async getFileBinaryURL(id, collectionName, maxAge = FILE_CACHE_MAX_AGE) {
190
190
  const auth = await this.resolveAuth({
191
191
  collectionName
192
192
  });
@@ -194,7 +194,7 @@ export class MediaStore {
194
194
  params: {
195
195
  dl: true,
196
196
  collection: collectionName,
197
- 'max-age': FILE_CACHE_MAX_AGE
197
+ 'max-age': maxAge
198
198
  },
199
199
  auth
200
200
  };
@@ -209,8 +209,8 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
209
209
  }
210
210
  }, {
211
211
  key: "getFileBinaryURL",
212
- value: function getFileBinaryURL(id, collectionName) {
213
- return this.mediaApi.getFileBinaryURL(id, collectionName);
212
+ value: function getFileBinaryURL(id, collectionName, maxAge) {
213
+ return this.mediaApi.getFileBinaryURL(id, collectionName, maxAge);
214
214
  }
215
215
  }, {
216
216
  key: "touchFiles",
@@ -289,26 +289,30 @@ export var MediaStore = /*#__PURE__*/function () {
289
289
  key: "getFileBinaryURL",
290
290
  value: function () {
291
291
  var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id, collectionName) {
292
- var auth, options;
292
+ var maxAge,
293
+ auth,
294
+ options,
295
+ _args5 = arguments;
293
296
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
294
297
  while (1) switch (_context5.prev = _context5.next) {
295
298
  case 0:
296
- _context5.next = 2;
299
+ maxAge = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : FILE_CACHE_MAX_AGE;
300
+ _context5.next = 3;
297
301
  return this.resolveAuth({
298
302
  collectionName: collectionName
299
303
  });
300
- case 2:
304
+ case 3:
301
305
  auth = _context5.sent;
302
306
  options = {
303
307
  params: {
304
308
  dl: true,
305
309
  collection: collectionName,
306
- 'max-age': FILE_CACHE_MAX_AGE
310
+ 'max-age': maxAge
307
311
  },
308
312
  auth: auth
309
313
  };
310
314
  return _context5.abrupt("return", createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/binary"), options));
311
- case 5:
315
+ case 6:
312
316
  case "end":
313
317
  return _context5.stop();
314
318
  }
@@ -38,7 +38,7 @@ export interface FileFetcher {
38
38
  downloadBinary(id: string, name?: string, collectionName?: string): Promise<void>;
39
39
  getCurrentState(id: string, options?: GetFileOptions): Promise<FileState>;
40
40
  copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions, traceContext?: MediaTraceContext): Promise<MediaFile>;
41
- getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
41
+ getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
42
42
  }
43
43
  export declare class FileFetcherImpl implements FileFetcher {
44
44
  private readonly mediaApi;
@@ -50,7 +50,7 @@ export declare class FileFetcherImpl implements FileFetcher {
50
50
  getFileState(id: string, options?: GetFileOptions): MediaSubscribable;
51
51
  getCurrentState(id: string, options?: GetFileOptions): Promise<FileState>;
52
52
  getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
53
- getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
53
+ getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
54
54
  private createDownloadFileStream;
55
55
  touchFiles(descriptors: TouchFileDescriptor[], collection?: string, traceContext?: MediaTraceContext): Promise<TouchedFiles>;
56
56
  private generateUploadableFileUpfrontIds;
@@ -18,7 +18,7 @@ export declare class MediaStore implements MediaApi {
18
18
  getFileImageURL(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
19
19
  getFileImageURLSync(id: string, params?: MediaStoreGetFileImageParams): string;
20
20
  private createFileImageURL;
21
- getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
21
+ getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
22
22
  getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
23
23
  getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
24
24
  getItems(ids: string[], collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<ItemsPayload>>;
@@ -38,7 +38,7 @@ export interface FileFetcher {
38
38
  downloadBinary(id: string, name?: string, collectionName?: string): Promise<void>;
39
39
  getCurrentState(id: string, options?: GetFileOptions): Promise<FileState>;
40
40
  copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions, traceContext?: MediaTraceContext): Promise<MediaFile>;
41
- getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
41
+ getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
42
42
  }
43
43
  export declare class FileFetcherImpl implements FileFetcher {
44
44
  private readonly mediaApi;
@@ -50,7 +50,7 @@ export declare class FileFetcherImpl implements FileFetcher {
50
50
  getFileState(id: string, options?: GetFileOptions): MediaSubscribable;
51
51
  getCurrentState(id: string, options?: GetFileOptions): Promise<FileState>;
52
52
  getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
53
- getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
53
+ getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
54
54
  private createDownloadFileStream;
55
55
  touchFiles(descriptors: TouchFileDescriptor[], collection?: string, traceContext?: MediaTraceContext): Promise<TouchedFiles>;
56
56
  private generateUploadableFileUpfrontIds;
@@ -18,7 +18,7 @@ export declare class MediaStore implements MediaApi {
18
18
  getFileImageURL(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
19
19
  getFileImageURLSync(id: string, params?: MediaStoreGetFileImageParams): string;
20
20
  private createFileImageURL;
21
- getFileBinaryURL(id: string, collectionName?: string): Promise<string>;
21
+ getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
22
22
  getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
23
23
  getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
24
24
  getItems(ids: string[], collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<ItemsPayload>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "26.2.0",
3
+ "version": "26.2.1",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -59,7 +59,7 @@
59
59
  "@atlaskit/media-core": "^34.2.0",
60
60
  "@atlaskit/media-state": "^1.0.0",
61
61
  "@atlaskit/ssr": "*",
62
- "@atlaskit/tokens": "^1.36.0",
62
+ "@atlaskit/tokens": "^1.38.0",
63
63
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
64
64
  "@emotion/react": "^11.7.1",
65
65
  "@types/deep-equal": "^1.0.1",
@@ -69,7 +69,6 @@
69
69
  "react-dom": "^16.8.0",
70
70
  "typescript": "~4.9.5"
71
71
  },
72
- "resolutions": {},
73
72
  "techstack": {
74
73
  "@atlassian/frontend": {
75
74
  "circular-dependencies": [