Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@atlaskit/media-store

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atlaskit/media-store - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

3

CHANGELOG.md
# @atlaskit/media-store
## 2.1.0
- [minor] Use id upfront in Uploader [f13d79e](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/f13d79e)
## 2.0.0

@@ -4,0 +7,0 @@ - [major] FileDetails' `id` property is now mandatory\nAuth interfaces moves from media-core to media-store, though still exported from media-core\nNew Interfaces (UploadableFile, UploadFileCallbacks) are exported from media-store\nMediaStore calls fixed with collection supplied during auth-provider call [d7b5021](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/d7b5021)

@@ -14,2 +14,3 @@ import { MediaFile, MediaCollection, MediaCollectionItems, MediaUpload, MediaChunksProbe } from './models/media';

createFileFromUpload(body: MediaStoreCreateFileFromUploadBody, params?: MediaStoreCreateFileFromUploadParams): Promise<MediaStoreResponse<MediaFile>>;
createFile(): Promise<MediaStoreResponse<EmptyFile>>;
getFile: (fileId: string, params?: MediaStoreGetFileParams) => Promise<MediaStoreResponse<MediaFile>>;

@@ -72,1 +73,5 @@ getFileImageURL: (id: string, params?: MediaStoreGetFileImageParams | undefined) => Promise<string>;

};
export interface EmptyFile {
readonly id: string;
readonly createdAt: number;
}

@@ -15,6 +15,13 @@ import * as tslib_1 from "tslib";

this.getFileImageURL = function (id, params) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var auth;
return tslib_1.__generator(this, function (_a) {
return [2 /*return*/, createUrl(this.config.serviceHost + "/file/" + id + "/image", {
params: params,
})];
switch (_a.label) {
case 0: return [4 /*yield*/, this.config.authProvider()];
case 1:
auth = _a.sent();
return [2 /*return*/, createUrl(this.config.serviceHost + "/file/" + id + "/image", {
params: params,
auth: auth,
})];
}
});

@@ -94,2 +101,10 @@ }); };

};
MediaStore.prototype.createFile = function () {
return this.request('/file', {
method: 'POST',
headers: {
Accept: 'application/json',
},
}).then(mapResponseToJson);
};
MediaStore.prototype.appendChunksToUpload = function (uploadId, body) {

@@ -96,0 +111,0 @@ return this.request("/upload/" + uploadId + "/chunks", {

11

dist/es2015/uploader.js

@@ -35,3 +35,3 @@ var _this = this;

var _this = this;
var content, collection, name, mimeType, store, deferredUploadId, uploadingFunction, offset, processingFunction, uploadId, fileId;
var content, collection, name, mimeType, store, deferredUploadId, uploadingFunction, offset, processingFunction, emptyFile, uploadId, fileId;
return tslib_1.__generator(this, function (_a) {

@@ -67,2 +67,3 @@ switch (_a.label) {

}); };
emptyFile = store.createFile();
return [4 /*yield*/, chunkinator(content, {

@@ -90,7 +91,11 @@ hashingFunction: hashingFunction,

uploadId = _a.sent();
return [4 /*yield*/, emptyFile];
case 3:
fileId = (_a.sent()).data.id;
return [4 /*yield*/, store.createFileFromUpload({ uploadId: uploadId, name: name, mimeType: mimeType }, {
collection: collection,
replaceFileId: fileId,
})];
case 3:
fileId = (_a.sent()).data.id;
case 4:
_a.sent();
return [2 /*return*/, fileId];

@@ -97,0 +102,0 @@ }

@@ -14,2 +14,3 @@ import { MediaFile, MediaCollection, MediaCollectionItems, MediaUpload, MediaChunksProbe } from './models/media';

createFileFromUpload(body: MediaStoreCreateFileFromUploadBody, params?: MediaStoreCreateFileFromUploadParams): Promise<MediaStoreResponse<MediaFile>>;
createFile(): Promise<MediaStoreResponse<EmptyFile>>;
getFile: (fileId: string, params?: MediaStoreGetFileParams) => Promise<MediaStoreResponse<MediaFile>>;

@@ -72,1 +73,5 @@ getFileImageURL: (id: string, params?: MediaStoreGetFileImageParams | undefined) => Promise<string>;

};
export interface EmptyFile {
readonly id: string;
readonly createdAt: number;
}

@@ -17,6 +17,13 @@ "use strict";

this.getFileImageURL = function (id, params) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var auth;
return tslib_1.__generator(this, function (_a) {
return [2 /*return*/, request_1.createUrl(this.config.serviceHost + "/file/" + id + "/image", {
params: params,
})];
switch (_a.label) {
case 0: return [4 /*yield*/, this.config.authProvider()];
case 1:
auth = _a.sent();
return [2 /*return*/, request_1.createUrl(this.config.serviceHost + "/file/" + id + "/image", {
params: params,
auth: auth,
})];
}
});

@@ -96,2 +103,10 @@ }); };

};
MediaStore.prototype.createFile = function () {
return this.request('/file', {
method: 'POST',
headers: {
Accept: 'application/json',
},
}).then(request_1.mapResponseToJson);
};
MediaStore.prototype.appendChunksToUpload = function (uploadId, body) {

@@ -98,0 +113,0 @@ return this.request("/upload/" + uploadId + "/chunks", {

@@ -37,3 +37,3 @@ "use strict";

var _this = this;
var content, collection, name, mimeType, store, deferredUploadId, uploadingFunction, offset, processingFunction, uploadId, fileId;
var content, collection, name, mimeType, store, deferredUploadId, uploadingFunction, offset, processingFunction, emptyFile, uploadId, fileId;
return tslib_1.__generator(this, function (_a) {

@@ -69,2 +69,3 @@ switch (_a.label) {

}); };
emptyFile = store.createFile();
return [4 /*yield*/, chunkinator_1.default(content, {

@@ -92,7 +93,11 @@ hashingFunction: hashingFunction,

uploadId = _a.sent();
return [4 /*yield*/, emptyFile];
case 3:
fileId = (_a.sent()).data.id;
return [4 /*yield*/, store.createFileFromUpload({ uploadId: uploadId, name: name, mimeType: mimeType }, {
collection: collection,
replaceFileId: fileId,
})];
case 3:
fileId = (_a.sent()).data.id;
case 4:
_a.sent();
return [2 /*return*/, fileId];

@@ -99,0 +104,0 @@ }

{
"name": "@atlaskit/media-store",
"version": "1.0.8",
"version": "2.0.0",
"sideEffects": false
}
{
"name": "@atlaskit/media-store",
"version": "2.0.0",
"version": "2.1.0",
"description": "Media Store API Web Client Library",

@@ -34,2 +34,2 @@ "license": "Apache-2.0",

}
}
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc