Skip to content

Commit 0a85b49

Browse files
Merge pull request #34 from ritishgumber/master
path added and tests updated
2 parents 00441dd + f29d4f6 commit 0a85b49

File tree

5 files changed

+2795
-2538
lines changed

5 files changed

+2795
-2538
lines changed

dist/cloudboost.js

+37-29
Original file line numberDiff line numberDiff line change
@@ -15707,6 +15707,7 @@ return /******/ (function(modules) { // webpackBootstrap
1570715707
return this.document.defaultValue;
1570815708
},
1570915709
set: function set(defaultValue) {
15710+
1571015711
if (typeof defaultValue === 'string') {
1571115712
supportedStringDataTypes = ['Text', 'EncryptedText', 'DateTime'];
1571215713
if (supportedStringDataTypes.indexOf(this.document.dataType) > -1) {
@@ -16959,19 +16960,22 @@ return /******/ (function(modules) { // webpackBootstrap
1695916960
CloudFiles
1696016961
*/
1696116962

16962-
_CB2.default.CloudFile = _CB2.default.CloudFile || function (file, data, type) {
16963-
16963+
_CB2.default.CloudFile = _CB2.default.CloudFile || function (file, data, type, path) {
16964+
if (!path) path = '/home';
1696416965
if (Object.prototype.toString.call(file) === '[object File]' || Object.prototype.toString.call(file) === '[object Blob]') {
1696516966

1696616967
this.fileObj = file;
1696716968
this.document = {
1696816969
_id: null,
1696916970
_type: 'file',
1697016971
ACL: new _CB2.default.ACL(),
16971-
name: file && file.name && file.name !== "" ? file.name : 'unknown',
16972+
name: file && file.name && file.name !== "" ? file.name : 'default.file',
1697216973
size: file.size,
1697316974
url: null,
1697416975
expires: null,
16976+
path: path,
16977+
updatedAt: Date.now(),
16978+
createdAt: Date.now(),
1697516979
contentType: typeof file.type !== "undefined" && file.type !== "" ? file.type : 'unknown'
1697616980
};
1697716981
} else if (typeof file === "string") {
@@ -16985,6 +16989,9 @@ return /******/ (function(modules) { // webpackBootstrap
1698516989
size: '',
1698616990
url: file,
1698716991
expires: null,
16992+
path: path,
16993+
updatedAt: Date.now(),
16994+
createdAt: Date.now(),
1698816995
contentType: ''
1698916996
};
1699016997
} else {
@@ -17000,6 +17007,9 @@ return /******/ (function(modules) { // webpackBootstrap
1700017007
name: file,
1700117008
size: '',
1700217009
url: null,
17010+
path: path,
17011+
updatedAt: Date.now(),
17012+
createdAt: Date.now(),
1700317013
expires: null,
1700417014
contentType: type
1700517015
};
@@ -17036,9 +17046,6 @@ return /******/ (function(modules) { // webpackBootstrap
1703617046
Object.defineProperty(_CB2.default.CloudFile.prototype, 'size', {
1703717047
get: function get() {
1703817048
return this.document.size;
17039-
},
17040-
set: function set(size) {
17041-
this.document.size = size;
1704217049
}
1704317050
});
1704417051

@@ -17051,6 +17058,26 @@ return /******/ (function(modules) { // webpackBootstrap
1705117058
}
1705217059
});
1705317060

17061+
Object.defineProperty(_CB2.default.CloudFile.prototype, 'path', {
17062+
get: function get() {
17063+
return this.document.path;
17064+
},
17065+
set: function set(path) {
17066+
this.document.path = path;
17067+
}
17068+
});
17069+
17070+
Object.defineProperty(_CB2.default.CloudFile.prototype, 'createdAt', {
17071+
get: function get() {
17072+
return this.document.createdAt;
17073+
}
17074+
});
17075+
17076+
Object.defineProperty(_CB2.default.CloudFile.prototype, 'updatedAt', {
17077+
get: function get() {
17078+
return this.document.updatedAt;
17079+
}
17080+
});
1705417081
/**
1705517082
* Uploads File
1705617083
*
@@ -17068,7 +17095,7 @@ return /******/ (function(modules) { // webpackBootstrap
1706817095

1706917096
var thisObj = this;
1707017097

17071-
if (!this.fileObj && !this.data) throw "You cannot save a file which is null";
17098+
if (!this.fileObj && !this.data && this.type != 'folder') throw "You cannot save a file which is null";
1707217099

1707317100
if (!this.data) {
1707417101
var params = new FormData();
@@ -17099,11 +17126,7 @@ return /******/ (function(modules) { // webpackBootstrap
1709917126
});
1710017127
} else {
1710117128
var data = this.data;
17102-
var params = JSON.stringify({
17103-
data: data,
17104-
fileObj: _CB2.default.toJSON(this),
17105-
key: _CB2.default.appKey
17106-
});
17129+
var params = JSON.stringify({ data: data, fileObj: _CB2.default.toJSON(this), key: _CB2.default.appKey });
1710717130
var url = _CB2.default.apiUrl + '/file/' + _CB2.default.appId;
1710817131
var uploadProgressCallback = null;
1710917132

@@ -17151,11 +17174,7 @@ return /******/ (function(modules) { // webpackBootstrap
1715117174
}
1715217175
var thisObj = this;
1715317176

17154-
var params = JSON.stringify({
17155-
fileObj: _CB2.default.toJSON(thisObj),
17156-
key: _CB2.default.appKey,
17157-
method: "PUT"
17158-
});
17177+
var params = JSON.stringify({ fileObj: _CB2.default.toJSON(thisObj), key: _CB2.default.appKey, method: "PUT" });
1715917178
var url = _CB2.default.apiUrl + '/file/' + _CB2.default.appId + '/' + this.document._id;
1716017179

1716117180
_CB2.default._request('PUT', url, params).then(function (response) {
@@ -17189,9 +17208,7 @@ return /******/ (function(modules) { // webpackBootstrap
1718917208
def = new _CB2.default.Promise();
1719017209
}
1719117210

17192-
var params = JSON.stringify({
17193-
key: _CB2.default.appKey
17194-
});
17211+
var params = JSON.stringify({ key: _CB2.default.appKey });
1719517212
var url = this.url;
1719617213

1719717214
_CB2.default._request('GET', url, params).then(function (response) {
@@ -19759,11 +19776,6 @@ return /******/ (function(modules) { // webpackBootstrap
1975919776
}
1976019777

1976119778
this.query[columnName] = data;
19762-
//}else{
19763-
19764-
//This is for people who code : obj.equalTo('column', null);
19765-
// this.doesNotExists(columnName);
19766-
// }
1976719779

1976819780
return this;
1976919781
}
@@ -19827,10 +19839,6 @@ return /******/ (function(modules) { // webpackBootstrap
1982719839
this.query[columnName] = {
1982819840
$ne: data
1982919841
};
19830-
//else{
19831-
//This is for people who code : obj.notEqualTo('column', null);
19832-
// this.exists(columnName);
19833-
// }
1983419842

1983519843
return this;
1983619844
}

0 commit comments

Comments
 (0)