@atlaskit/media-store
Advanced tools
Comparing version 5.0.0 to 5.1.0
# @atlaskit/media-store | ||
## 5.1.0 | ||
- [minor] use context.getFile in media-card [fad25ec](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/fad25ec) | ||
- [minor] Updated dependencies [fad25ec](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/fad25ec) | ||
- @atlaskit/media-test-helpers@15.2.0 | ||
## 5.0.0 | ||
@@ -4,0 +9,0 @@ |
@@ -18,2 +18,3 @@ import { MediaFile, MediaCollection, MediaCollectionItems, MediaUpload, MediaChunksProbe } from './models/media'; | ||
getFileImageURL: (id: string, params?: MediaStoreGetFileImageParams | undefined) => Promise<string>; | ||
getImage: (id: string, params?: MediaStoreGetFileImageParams | undefined) => Promise<Blob>; | ||
appendChunksToUpload(uploadId: string, body: AppendChunksToUploadRequestBody): Promise<void>; | ||
@@ -67,2 +68,3 @@ copyFileWithToken(body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams): Promise<void>; | ||
export declare type MediaStoreGetFileImageParams = { | ||
readonly allowAnimated?: boolean; | ||
readonly version?: number; | ||
@@ -74,4 +76,3 @@ readonly collection?: string; | ||
readonly upscale?: boolean; | ||
readonly 'max-age': number; | ||
readonly allowAnimated: boolean; | ||
readonly 'max-age'?: number; | ||
}; | ||
@@ -78,0 +79,0 @@ export declare type MediaStoreGetCollectionItemsPrams = { |
import * as tslib_1 from "tslib"; | ||
import { request, createUrl, mapResponseToJson, mapResponseToVoid, } from './utils/request'; | ||
import { request, createUrl, mapResponseToJson, mapResponseToVoid, mapResponseToBlob, } from './utils/request'; | ||
var defaultImageOptions = { | ||
'max-age': 3600, | ||
allowAnimated: true, | ||
mode: 'crop', | ||
}; | ||
var extendImageParams = function (params) { | ||
return tslib_1.__assign({}, defaultImageOptions, params); | ||
}; | ||
var MediaStore = /** @class */ (function () { | ||
@@ -22,3 +30,3 @@ function MediaStore(config) { | ||
return [2 /*return*/, createUrl(this.config.serviceHost + "/file/" + id + "/image", { | ||
params: params, | ||
params: extendImageParams(params), | ||
auth: auth, | ||
@@ -29,2 +37,8 @@ })]; | ||
}); }; | ||
this.getImage = function (id, params) { | ||
return _this.request("/file/" + id + "/image", { | ||
params: extendImageParams(params), | ||
authContext: { collectionName: params && params.collection }, | ||
}).then(mapResponseToBlob); | ||
}; | ||
} | ||
@@ -31,0 +45,0 @@ MediaStore.prototype.createCollection = function (collectionName) { |
@@ -8,8 +8,9 @@ export declare type MediaFileArtifacts = { | ||
export declare type MediaFileProcessingStatus = 'pending' | 'succeeded' | 'failed'; | ||
export declare type MediaType = 'doc' | 'audio' | 'video' | 'image' | 'unknown'; | ||
export declare type MediaFile = { | ||
readonly id: string; | ||
readonly mediaType: string; | ||
readonly mediaType: MediaType; | ||
readonly mimeType: string; | ||
readonly name: string; | ||
readonly processingStatus: MediaFileProcessingStatus; | ||
readonly processingStatus?: MediaFileProcessingStatus; | ||
readonly size: number; | ||
@@ -16,0 +17,0 @@ readonly artifacts: MediaFileArtifacts; |
@@ -18,2 +18,3 @@ import { Auth } from '../models/auth'; | ||
export declare function mapResponseToJson(response: Response): Promise<any>; | ||
export declare function mapResponseToBlob(response: Response): Promise<Blob>; | ||
export declare function mapResponseToVoid(_response: Response): Promise<void>; | ||
@@ -20,0 +21,0 @@ export declare type CreateUrlOptions = { |
@@ -34,2 +34,5 @@ import * as tslib_1 from "tslib"; | ||
} | ||
export function mapResponseToBlob(response) { | ||
return response.blob(); | ||
} | ||
export function mapResponseToVoid(_response) { | ||
@@ -36,0 +39,0 @@ return Promise.resolve(); |
@@ -18,2 +18,3 @@ import { MediaFile, MediaCollection, MediaCollectionItems, MediaUpload, MediaChunksProbe } from './models/media'; | ||
getFileImageURL: (id: string, params?: MediaStoreGetFileImageParams | undefined) => Promise<string>; | ||
getImage: (id: string, params?: MediaStoreGetFileImageParams | undefined) => Promise<Blob>; | ||
appendChunksToUpload(uploadId: string, body: AppendChunksToUploadRequestBody): Promise<void>; | ||
@@ -67,2 +68,3 @@ copyFileWithToken(body: MediaStoreCopyFileWithTokenBody, params: MediaStoreCopyFileWithTokenParams): Promise<void>; | ||
export declare type MediaStoreGetFileImageParams = { | ||
readonly allowAnimated?: boolean; | ||
readonly version?: number; | ||
@@ -74,4 +76,3 @@ readonly collection?: string; | ||
readonly upscale?: boolean; | ||
readonly 'max-age': number; | ||
readonly allowAnimated: boolean; | ||
readonly 'max-age'?: number; | ||
}; | ||
@@ -78,0 +79,0 @@ export declare type MediaStoreGetCollectionItemsPrams = { |
@@ -5,2 +5,10 @@ "use strict"; | ||
var request_1 = require("./utils/request"); | ||
var defaultImageOptions = { | ||
'max-age': 3600, | ||
allowAnimated: true, | ||
mode: 'crop', | ||
}; | ||
var extendImageParams = function (params) { | ||
return tslib_1.__assign({}, defaultImageOptions, params); | ||
}; | ||
var MediaStore = /** @class */ (function () { | ||
@@ -25,3 +33,3 @@ function MediaStore(config) { | ||
return [2 /*return*/, request_1.createUrl(this.config.serviceHost + "/file/" + id + "/image", { | ||
params: params, | ||
params: extendImageParams(params), | ||
auth: auth, | ||
@@ -32,2 +40,8 @@ })]; | ||
}); }; | ||
this.getImage = function (id, params) { | ||
return _this.request("/file/" + id + "/image", { | ||
params: extendImageParams(params), | ||
authContext: { collectionName: params && params.collection }, | ||
}).then(request_1.mapResponseToBlob); | ||
}; | ||
} | ||
@@ -34,0 +48,0 @@ MediaStore.prototype.createCollection = function (collectionName) { |
@@ -8,8 +8,9 @@ export declare type MediaFileArtifacts = { | ||
export declare type MediaFileProcessingStatus = 'pending' | 'succeeded' | 'failed'; | ||
export declare type MediaType = 'doc' | 'audio' | 'video' | 'image' | 'unknown'; | ||
export declare type MediaFile = { | ||
readonly id: string; | ||
readonly mediaType: string; | ||
readonly mediaType: MediaType; | ||
readonly mimeType: string; | ||
readonly name: string; | ||
readonly processingStatus: MediaFileProcessingStatus; | ||
readonly processingStatus?: MediaFileProcessingStatus; | ||
readonly size: number; | ||
@@ -16,0 +17,0 @@ readonly artifacts: MediaFileArtifacts; |
@@ -18,2 +18,3 @@ import { Auth } from '../models/auth'; | ||
export declare function mapResponseToJson(response: Response): Promise<any>; | ||
export declare function mapResponseToBlob(response: Response): Promise<Blob>; | ||
export declare function mapResponseToVoid(_response: Response): Promise<void>; | ||
@@ -20,0 +21,0 @@ export declare type CreateUrlOptions = { |
@@ -38,2 +38,6 @@ "use strict"; | ||
exports.mapResponseToJson = mapResponseToJson; | ||
function mapResponseToBlob(response) { | ||
return response.blob(); | ||
} | ||
exports.mapResponseToBlob = mapResponseToBlob; | ||
function mapResponseToVoid(_response) { | ||
@@ -40,0 +44,0 @@ return Promise.resolve(); |
{ | ||
"name": "@atlaskit/media-store", | ||
"version": "4.2.1", | ||
"version": "5.0.0", | ||
"sideEffects": false | ||
} |
{ | ||
"name": "@atlaskit/media-store", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "Media Store API Web Client Library", | ||
@@ -28,3 +28,3 @@ "license": "Apache-2.0", | ||
"devDependencies": { | ||
"@atlaskit/media-test-helpers": "^15.0.0", | ||
"@atlaskit/media-test-helpers": "^15.2.0", | ||
"@types/fetch-mock": "^5.12.1", | ||
@@ -31,0 +31,0 @@ "fetch-mock": "^5.12.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
101868
1678