...
 
Commits (6)
......@@ -7,4 +7,3 @@
node_modules/*
lint
package-lock.json
*
!dist/jio-latest-node.js
!dist/jio-latest.js
!README.md
!COPYING
!package.json
......@@ -150,7 +150,8 @@ ${JIOVERSION}: ${EXTERNALDIR}/URI.js \
${SRCDIR}/jio.storage/cryptstorage.js \
${SRCDIR}/jio.storage/websqlstorage.js \
${SRCDIR}/jio.storage/fbstorage.js \
${SRCDIR}/jio.storage/cloudooostorage.js
${SRCDIR}/jio.storage/cloudooostorage.js \
${SRCDIR}/jio.storage/mappingstorage.js
@mkdir -p $(@D)
cat $^ > $@
......@@ -162,13 +163,7 @@ ${JIONODELATEST}: ${JIONODEVERSION}
cp $< $@
${JIONODEVERSION}: ${SRCDIR}/node/jio-start.js \
${EXTERNALDIR}/rsvp-2.0.4.js \
${EXTERNALDIR}/moment.js \
${EXTERNALDIR}/URI.js \
${EXTERNALDIR}/uritemplate.js \
${EXTERNALDIR}/rusha.js \
${SRCDIR}/node/jio-external.js \
${EXTERNALDIR}/xhr2.js \
${SRCDIR}/queries/parser-begin.js \
${SRCDIR}/queries/build/parser.js \
${SRCDIR}/queries/parser-end.js \
......@@ -189,6 +184,7 @@ ${JIONODEVERSION}: ${SRCDIR}/node/jio-start.js \
${SRCDIR}/jio.storage/drivetojiomapping.js \
${SRCDIR}/jio.storage/documentstorage.js \
${SRCDIR}/jio.storage/fbstorage.js \
${SRCDIR}/jio.storage/mappingstorage.js \
${SRCDIR}/node/jio-end.js
@mkdir -p $(@D)
cat $^ > $@
......
This diff could not be displayed because it is too large.
// Generated by CoffeeScript 1.12.2
// Generated by CoffeeScript 1.12.7
(function() {
var InvalidStateError, NetworkError, ProgressEvent, SecurityError, SyntaxError, XMLHttpRequest, XMLHttpRequestEventTarget, XMLHttpRequestUpload, http, https, os, url,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
......@@ -323,7 +323,7 @@
'access-control-request-method': true,
connection: true,
'content-length': true,
// cookie: true,
cookie: true,
cookie2: true,
date: true,
dnt: true,
......@@ -341,7 +341,7 @@
};
XMLHttpRequest.prototype._privateHeaders = {
// 'set-cookie': true,
'set-cookie': true,
'set-cookie2': true
};
......@@ -363,6 +363,7 @@
};
XMLHttpRequest.prototype._sendHttp = function(data) {
var that;
if (this._sync) {
throw new Error("Synchronous XHR processing not implemented");
}
......@@ -372,9 +373,11 @@
} else {
data || (data = '');
}
this.upload._setData(data);
this._finalizeHeaders();
this._sendHxxpRequest();
that = this;
this.upload._setData(data, function() {
that._finalizeHeaders();
return that._sendHxxpRequest();
});
return void 0;
};
......@@ -709,11 +712,13 @@
XMLHttpRequest.XMLHttpRequest = XMLHttpRequest;
XMLHttpRequest.FormData = FormData;
SecurityError = (function(superClass) {
extend(SecurityError, superClass);
function SecurityError() {
SecurityError.__super__.constructor.apply(this, arguments);
SecurityError.__super__.constructor.call(this);
}
return SecurityError;
......@@ -726,7 +731,7 @@
extend(InvalidStateError, superClass);
function InvalidStateError() {
InvalidStateError.__super__.constructor.apply(this, arguments);
InvalidStateError.__super__.constructor.call(this);
}
return InvalidStateError;
......@@ -750,7 +755,7 @@
extend(NetworkError, superClass);
function NetworkError() {
NetworkError.__super__.constructor.apply(this, arguments);
NetworkError.__super__.constructor.call(this);
}
return NetworkError;
......@@ -763,7 +768,7 @@
extend(SyntaxError, superClass);
function SyntaxError() {
SyntaxError.__super__.constructor.apply(this, arguments);
SyntaxError.__super__.constructor.call(this);
}
return SyntaxError;
......@@ -813,10 +818,10 @@
return void 0;
};
XMLHttpRequestUpload.prototype._setData = function(data) {
var body, i, j, k, offset, ref, ref1, view;
XMLHttpRequestUpload.prototype._setData = function(data, cb) {
var body, i, j, k, offset, ref, ref1, that, view;
if (typeof data === 'undefined' || data === null) {
return;
return cb();
}
if (typeof data === 'string') {
if (data.length !== 0) {
......@@ -840,10 +845,23 @@
body[i] = view[i + offset];
}
this._body = body;
} else if (data instanceof FormData) {
body = '';
this._contentType = data.getHeaders()['content-type'];
data.on('data', function(data) {
return body += data.toString();
});
that = this;
data.on('end', function() {
that._body = body;
return cb();
});
data.resume();
return;
} else {
throw new Error("Unsupported send() data " + data);
}
return void 0;
return cb();
};
XMLHttpRequestUpload.prototype._finalizeHeaders = function(headers, loweredHeaders) {
......@@ -872,4 +890,4 @@
XMLHttpRequest.XMLHttpRequestUpload = XMLHttpRequestUpload;
}).call(this);
\ No newline at end of file
}).call(this);
{
"name": "jio",
"version": "v3.35.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"combined-stream": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz",
"integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=",
"requires": {
"delayed-stream": "~1.0.0"
}
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
},
"form-data": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz",
"integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "1.0.6",
"mime-types": "^2.1.12"
}
},
"mime-db": {
"version": "1.35.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz",
"integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg=="
},
"mime-types": {
"version": "2.1.19",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz",
"integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==",
"requires": {
"mime-db": "~1.35.0"
}
},
"moment": {
"version": "2.21.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.21.0.tgz",
"integrity": "sha512-TCZ36BjURTeFTM/CwRcViQlfkMvL1/vFISuNLO5GkcVm1+QHfbSiNqZuWeMFjj1/3+uAjXswgRk30j1kkLYJBQ=="
},
"rsvp": {
"version": "git+https://lab.nexedi.com/nexedi/rsvp.js.git#cde40f5c0eab3167964423cc6030fac080ea46c4",
"from": "git+https://lab.nexedi.com/nexedi/rsvp.js.git"
},
"rusha": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/rusha/-/rusha-0.8.2.tgz",
"integrity": "sha1-BfMZbfN7FmvAgNsbvWnITWT6HB8="
},
"urijs": {
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.1.tgz",
"integrity": "sha512-xVrGVi94ueCJNrBSTjWqjvtgvl3cyOTThp2zaMaFNGp3F542TR6sM3f2o8RqZl+AwteClSVmoCyt0ka4RjQOQg=="
},
"uritemplate": {
"version": "git+https://lab.nexedi.com/nexedi/uritemplate-js.git#69c0af3da5299ac216a0d437fac6dd621ccf9af8",
"from": "git+https://lab.nexedi.com/nexedi/uritemplate-js.git"
},
"xhr2": {
"version": "git+https://github.com/clearroad/node-xhr2.git#5f8895ab8962c6b6664f4f2b88db0eac001d54e0",
"from": "git+https://github.com/clearroad/node-xhr2.git",
"requires": {
"form-data": "^2.3.2"
}
}
}
}
......@@ -20,6 +20,15 @@
"output",
"cloud"
],
"dependencies": {
"form-data": "^2.3.2",
"moment": "^2.21.0",
"rsvp": "git+https://lab.nexedi.com/nexedi/rsvp.js.git",
"rusha": "0.8.2",
"urijs": "^1.19.1",
"uritemplate": "git+https://lab.nexedi.com/nexedi/uritemplate-js.git",
"xhr2": "git+https://github.com/clearroad/node-xhr2.git"
},
"engines": {
"npm": ">=1.3"
}
......
......@@ -42,6 +42,7 @@
if (options.headers === undefined) {
options.headers = {};
}
options.headers.Accept = "*/*";
options.headers['X-ACCESS-TOKEN'] = storage._access_token;
options.xhrFields.withCredentials = false;
} else {
......
......@@ -128,7 +128,7 @@
});
};
window.Blob = Blob;//window.Blob || Blob;
window.Blob = window.Blob || Blob;
function FileReader() {
EventTarget.call(this);
......@@ -220,8 +220,7 @@
}(window, WeakMap, ArrayBuffer, Uint8Array));
var XMLHttpRequest = global.XMLHttpRequest || module.exports,
Blob = window.Blob,
var Blob = window.Blob,
atob = window.atob,
btoa = window.btoa,
FileReader = window.FileReader,
......
module = node_module;
jIO.node_env = window;
module.exports = jIO;
} ({}));
\ No newline at end of file
module.exports = window;
}({}));
var RSVP = window.RSVP,
moment = global.moment,
UriTemplate = window.UriTemplate,
Rusha = window.Rusha;
var RSVP = require('rsvp'),
moment = require('moment'),
Rusha = require('rusha'),
XMLHttpRequest = require('xhr2'),
FormData = require('form-data'),
URI = require('urijs'),
UriTemplate = require('uritemplate'),
process = require('process');
// Allow xhr2 to export XMLHttpRequest
module = {};
window.moment = moment;
window.FormData = window.FormData || FormData;
window.XMLHttpRequest = window.XMLHttpRequest || XMLHttpRequest;
(function (define, exports) {
var navigator = null,
window = {},
node_module = module;
module = undefined;
(function (window) {
var navigator = {};
......@@ -18,57 +18,41 @@
* See https://www.nexedi.com/licensing for rationale and options.
*/
/*global window */
(function (window, jIO, Blob) {
/*global window, ArrayBuffer */
(function (jIO, Blob, ArrayBuffer) {
"use strict";
var FormData,
originalAjax;
var originalAjax;
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/
// Using_XMLHttpRequest#Submitting_forms_and_uploading_files
FormData = function FormData() {
this.boundary = "---------------------------" + Date.now().toString(16);
this.body = '';
};
FormData.prototype.append = function (name, value, filename) {
this.body += '--' + this.boundary +
'\r\nContent-Disposition: form-data; name="' + name;
if (filename !== undefined) {
this.body += '"; filename="' + filename;
function convertToBlob(evt, convert) {
if (convert && evt.target.response instanceof ArrayBuffer) {
evt.target.response = new Blob([evt.target.response]);
}
this.body += '"\r\n\r\n' + value + '\r\n';
};
window.FormData = FormData;
return evt;
}
originalAjax = jIO.util.ajax;
jIO.util.ajax = function ajax(param) {
var convertToArrayBuffer = param.dataType === 'blob';
if (convertToArrayBuffer) {
param.dataType = 'arraybuffer';
}
if (param.data instanceof Blob) {
// Blob is not supported by xhr2, so convert to ArrayBuffer instead
return jIO.util.readBlobAsArrayBuffer(param.data).then(function (data) {
param.data = data.target.result;
return originalAjax(param);
return originalAjax(param).then(function (evt) {
return convertToBlob(evt, convertToArrayBuffer);
});
});
}
if (param.data instanceof FormData) {
// Implement minimal FormData for erp5storage
if (!param.hasOwnProperty('headers')) {
param.headers = {};
}
param.headers["Content-Type"] = "multipart\/form-data; boundary=" +
param.data.boundary;
param.data.body += '--' + param.data.boundary + '--\r\n';
param.data = param.data.body;
return originalAjax(param);
}
return originalAjax(param);
return originalAjax(param).then(function (evt) {
return convertToBlob(evt, convertToArrayBuffer);
});
};
}(window, window.jIO, window.Blob));
}(window.jIO, window.Blob, ArrayBuffer));
// Define a global variable to allow storages to access jIO
var jIO = window.jIO,
FormData = window.FormData,
jiodate = window.jiodate;
......@@ -162,7 +162,6 @@ parse: function parse(input) {
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
_token_stack:
var lex = function () {
var token;
token = lexer.lex() || EOF;
......
......@@ -332,7 +332,7 @@
}
}
if (option.sort_on) {
if (option.sort_on && option.sort_on.length) {
sortOn(option.sort_on, item_list, this._key_schema);
}
......