mirror of https://gitee.com/bigwinds/arangodb
Strict mode all the things.
This commit is contained in:
parent
e8ba1a1332
commit
69e63c2c64
|
@ -4,10 +4,12 @@
|
|||
"eqeqeq": true,
|
||||
"forin": true,
|
||||
"freeze": true,
|
||||
"globalstrict": true,
|
||||
"immed": true,
|
||||
"laxbreak": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"node": true,
|
||||
"noempty": true,
|
||||
"nonbsp": true,
|
||||
"nonew": true,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief administration actions
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief administration actions
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief administration actions
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint strict: false */
|
||||
/*global require, ArangoServerState */
|
||||
/*global ArangoServerState */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief administration actions
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief administration actions
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief querying and managing collections
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief foxx administration actions
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief user management
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief AQL user functions management
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint strict: false, unused: false */
|
||||
/*global require, AQL_EXECUTE, SYS_CLUSTER_TEST, UPGRADE_ARGS: true,
|
||||
/*global AQL_EXECUTE, SYS_CLUSTER_TEST, UPGRADE_ARGS: true,
|
||||
ArangoServerState, ArangoClusterComm, ArangoClusterInfo */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief global configuration
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint strict: false */
|
||||
/*global require, ArangoAgency */
|
||||
/*global ArangoAgency */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief database management
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief managing edges
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief endpoint management
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint strict: false */
|
||||
/*global require, AQL_EXPLAIN */
|
||||
/*global AQL_EXPLAIN */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief query explain actions
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint strict: false */
|
||||
/*global require, AQL_EXECUTE */
|
||||
/*global AQL_EXECUTE */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief graph api
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief querying and managing indexes
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief open actions
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint strict: false */
|
||||
/*global require, CREATE_CURSOR */
|
||||
/*global CREATE_CURSOR */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief simple queries
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief querying and managing structures
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief administration actions
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief querying and managing collections
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint strict: false */
|
||||
/*global require, TRANSACTION */
|
||||
/*global TRANSACTION */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief transaction actions
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jshint strict: false */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief traversal actions
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint globalstrict: true */
|
||||
/*global require, applicationContext*/
|
||||
/*global applicationContext*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief A Foxx.Controller to show all Foxx Applications
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global require, applicationContext*/
|
||||
/*global applicationContext*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief A Foxx.Controller to show all Foxx Applications
|
||||
|
|
|
@ -602,7 +602,7 @@ return returnVal;
|
|||
});
|
||||
}());
|
||||
|
||||
/*global require, exports, Backbone, window */
|
||||
/*global Backbone, window */
|
||||
window.ClusterStatisticsCollection = Backbone.Collection.extend({
|
||||
model: window.Statistics,
|
||||
|
||||
|
@ -1256,7 +1256,7 @@ window.StatisticsDescription = Backbone.Model.extend({
|
|||
|
||||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, exports, Backbone, window */
|
||||
/*global Backbone, window */
|
||||
window.StatisticsCollection = Backbone.Collection.extend({
|
||||
model: window.Statistics,
|
||||
url: "/_admin/statistics"
|
||||
|
@ -1264,7 +1264,7 @@ window.StatisticsCollection = Backbone.Collection.extend({
|
|||
|
||||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, exports, window, Backbone, arangoDocumentModel, _, arangoHelper, $*/
|
||||
/*global window, Backbone, arangoDocumentModel, _, arangoHelper, $*/
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
|
@ -1727,7 +1727,7 @@ window.StatisticsCollection = Backbone.Collection.extend({
|
|||
|
||||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, exports, Backbone, EJS, $, flush, window, arangoHelper, nv, d3, localStorage*/
|
||||
/*global Backbone, EJS, $, flush, window, arangoHelper, nv, d3, localStorage*/
|
||||
/*global document, console, Dygraph, _,templateEngine */
|
||||
|
||||
(function () {
|
||||
|
@ -2902,7 +2902,7 @@ window.StatisticsCollection = Backbone.Collection.extend({
|
|||
});
|
||||
}());
|
||||
|
||||
/*global require, _, Dygraph, window, document */
|
||||
/*global _, Dygraph, window, document */
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
@ -3196,7 +3196,7 @@ window.StatisticsCollection = Backbone.Collection.extend({
|
|||
|
||||
/*jshint browser: true */
|
||||
/*jshint strict: false, unused: false */
|
||||
/*global require, exports, Backbone, window */
|
||||
/*global Backbone, window */
|
||||
window.StatisticsDescriptionCollection = Backbone.Collection.extend({
|
||||
model: window.StatisticsDescription,
|
||||
url: "/_admin/statistics-description",
|
||||
|
@ -3383,7 +3383,7 @@ window.StatisticsDescriptionCollection = Backbone.Collection.extend({
|
|||
});
|
||||
}());
|
||||
|
||||
/*global require, exports, Backbone, EJS, $, flush, window, arangoHelper, nv, d3, localStorage*/
|
||||
/*global Backbone, EJS, $, flush, window, arangoHelper, nv, d3, localStorage*/
|
||||
/*global document, Dygraph, _,templateEngine */
|
||||
|
||||
(function() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global require, exports, Backbone, window */
|
||||
/*global Backbone, window */
|
||||
window.ClusterStatisticsCollection = Backbone.Collection.extend({
|
||||
model: window.Statistics,
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global require, exports, Backbone, EJS, $, flush, window, arangoHelper, nv, d3, localStorage*/
|
||||
/*global Backbone, EJS, $, flush, window, arangoHelper, nv, d3, localStorage*/
|
||||
/*global document, Dygraph, _,templateEngine */
|
||||
|
||||
(function() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global require, applicationContext*/
|
||||
/*global applicationContext*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief A Foxx.Controller to generate new FoxxApps
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global require, applicationContext */
|
||||
/*global applicationContext */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief A Foxx.Controller to show all Foxx Applications
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
/*jshint maxlen: 240 */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief auto-generated file generated from errors.dat
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
'use strict';
|
||||
var internal = require("internal");
|
||||
|
||||
internal.errors = {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*jshint -W051: true */
|
||||
/*global require, SYS_GETLINE, SYS_LOG, jqconsole, Symbol */
|
||||
/*jshint -W051:true */
|
||||
/*global jqconsole, Symbol */
|
||||
'use strict';
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief module "console"
|
||||
|
@ -28,38 +29,37 @@
|
|||
/// @author Copyright 2010-2013, triAGENS GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
(function () {
|
||||
/*jshint strict: false */
|
||||
var exports = require("console");
|
||||
|
||||
var sprintf = require("internal").sprintf;
|
||||
var inspect = require("internal").inspect;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- Module "console"
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
(function () {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
var exports = require("console");
|
||||
var sprintf = require("internal").sprintf;
|
||||
var inspect = require("internal").inspect;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief group level
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var groupLevel = "";
|
||||
var groupLevel = "";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief timers
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var timers;
|
||||
try {
|
||||
timers = Object.create(null);
|
||||
}
|
||||
catch (err) {
|
||||
timers = {};
|
||||
}
|
||||
var timers;
|
||||
try {
|
||||
timers = Object.create(null);
|
||||
}
|
||||
catch (e) {
|
||||
timers = {};
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private functions
|
||||
|
@ -69,69 +69,66 @@
|
|||
/// @brief internal logging
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var log;
|
||||
var log;
|
||||
|
||||
try {
|
||||
// this will work when we are in arangod but not in the browser / web interface
|
||||
log = SYS_LOG;
|
||||
delete SYS_LOG;
|
||||
}
|
||||
catch (err) {
|
||||
// this will work in the web interface
|
||||
log = function (level, message) {
|
||||
if (jqconsole) {
|
||||
jqconsole.Write(message + "\n", 'jssuccess');
|
||||
}
|
||||
};
|
||||
}
|
||||
if (global.SYS_LOG) {
|
||||
// this will work when we are in arangod but not in the browser / web interface
|
||||
log = global.SYS_LOG;
|
||||
delete global.SYS_LOG;
|
||||
}
|
||||
else {
|
||||
// this will work in the web interface
|
||||
log = function (level, message) {
|
||||
if (typeof jqconsole !== 'undefined') {
|
||||
jqconsole.Write(message + "\n", 'jssuccess');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief internal logging with group level
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function logGroup (level, msg) {
|
||||
'use strict';
|
||||
|
||||
log(level, groupLevel + msg);
|
||||
}
|
||||
function logGroup (level, msg) {
|
||||
log(level, groupLevel + msg);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief try to prettify
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function prepareArgs (args) {
|
||||
var ShapedJson = require("internal").ShapedJson;
|
||||
var result = [];
|
||||
var i;
|
||||
function prepareArgs (args) {
|
||||
var ShapedJson = require("internal").ShapedJson;
|
||||
var result = [];
|
||||
|
||||
if (0 < args.length && typeof args[0] !== "string") {
|
||||
result.push("%s");
|
||||
}
|
||||
|
||||
for (i = 0; i < args.length; ++i) {
|
||||
var arg = args[i];
|
||||
|
||||
if (typeof arg === "object") {
|
||||
if (ShapedJson !== undefined && arg instanceof ShapedJson) {
|
||||
arg = inspect(arg, {prettyPrint: false});
|
||||
}
|
||||
else if (arg === null) {
|
||||
arg = "null";
|
||||
}
|
||||
else if (arg instanceof Date || arg instanceof RegExp) {
|
||||
arg = String(arg);
|
||||
}
|
||||
else if (Object.prototype.isPrototypeOf(arg) || Array.isArray(arg)) {
|
||||
arg = inspect(arg, {prettyPrint: false});
|
||||
}
|
||||
}
|
||||
|
||||
result.push(arg);
|
||||
}
|
||||
|
||||
return result;
|
||||
if (0 < args.length && typeof args[0] !== "string") {
|
||||
result.push("%s");
|
||||
}
|
||||
|
||||
for (var i = 0; i < args.length; ++i) {
|
||||
var arg = args[i];
|
||||
|
||||
if (typeof arg === "object") {
|
||||
if (ShapedJson !== undefined && arg instanceof ShapedJson) {
|
||||
arg = inspect(arg, {prettyPrint: false});
|
||||
}
|
||||
else if (arg === null) {
|
||||
arg = "null";
|
||||
}
|
||||
else if (arg instanceof Date || arg instanceof RegExp) {
|
||||
arg = String(arg);
|
||||
}
|
||||
else if (Object.prototype.isPrototypeOf(arg) || Array.isArray(arg)) {
|
||||
arg = inspect(arg, {prettyPrint: false});
|
||||
}
|
||||
}
|
||||
|
||||
result.push(arg);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -140,329 +137,297 @@
|
|||
/// @brief assert
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.assert = function (condition) {
|
||||
'use strict';
|
||||
exports.assert = function (condition) {
|
||||
if (condition) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (condition) {
|
||||
return;
|
||||
}
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
var msg;
|
||||
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
var msg;
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(args));
|
||||
}
|
||||
catch (e) {
|
||||
msg = e + ": " + args;
|
||||
}
|
||||
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(args));
|
||||
}
|
||||
catch (err) {
|
||||
msg = err + ": " + args;
|
||||
}
|
||||
logGroup("error", msg);
|
||||
|
||||
logGroup("error", msg);
|
||||
|
||||
require('assert').ok(condition, msg);
|
||||
};
|
||||
require('assert').ok(condition, msg);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief debug
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.debug = function () {
|
||||
'use strict';
|
||||
exports.debug = function () {
|
||||
var msg;
|
||||
|
||||
var msg;
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (e) {
|
||||
msg = e + ": " + arguments;
|
||||
}
|
||||
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (err) {
|
||||
msg = err + ": " + arguments;
|
||||
}
|
||||
|
||||
logGroup("debug", msg);
|
||||
};
|
||||
logGroup("debug", msg);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief debugLines
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.debugLines = function () {
|
||||
'use strict';
|
||||
exports.debugLines = function () {
|
||||
var msg;
|
||||
|
||||
var msg;
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (e) {
|
||||
msg = e + ": " + arguments;
|
||||
}
|
||||
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (err) {
|
||||
msg = err + ": " + arguments;
|
||||
}
|
||||
var a = msg.split("\n");
|
||||
var i;
|
||||
|
||||
var a = msg.split("\n");
|
||||
var i;
|
||||
|
||||
for (i = 0; i < a.length; ++i) {
|
||||
logGroup("debug", a[i]);
|
||||
}
|
||||
};
|
||||
for (i = 0; i < a.length; ++i) {
|
||||
logGroup("debug", a[i]);
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief dir
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.dir = function (object) {
|
||||
'use strict';
|
||||
|
||||
logGroup("info", inspect(object));
|
||||
};
|
||||
exports.dir = function (object) {
|
||||
logGroup("info", inspect(object));
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief error
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.error = function () {
|
||||
'use strict';
|
||||
exports.error = function () {
|
||||
var msg;
|
||||
|
||||
var msg;
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (e) {
|
||||
msg = e + ": " + arguments;
|
||||
}
|
||||
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (err) {
|
||||
msg = err + ": " + arguments;
|
||||
}
|
||||
|
||||
logGroup("error", msg);
|
||||
};
|
||||
logGroup("error", msg);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief errorLines
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.errorLines = function () {
|
||||
'use strict';
|
||||
exports.errorLines = function () {
|
||||
var msg;
|
||||
|
||||
var msg;
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (e) {
|
||||
msg = e + ": " + arguments;
|
||||
}
|
||||
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (err) {
|
||||
msg = err + ": " + arguments;
|
||||
}
|
||||
|
||||
var a = msg.split("\n");
|
||||
var i;
|
||||
|
||||
for (i = 0; i < a.length; ++i) {
|
||||
logGroup("error", a[i]);
|
||||
}
|
||||
};
|
||||
var a = msg.split("\n");
|
||||
for (var i = 0; i < a.length; ++i) {
|
||||
logGroup("error", a[i]);
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief getline
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (typeof SYS_GETLINE !== "undefined") {
|
||||
exports.getline = SYS_GETLINE;
|
||||
delete SYS_GETLINE;
|
||||
}
|
||||
if (global.SYS_GETLINE) {
|
||||
exports.getline = global.SYS_GETLINE;
|
||||
delete global.SYS_GETLINE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief group
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.group = function () {
|
||||
'use strict';
|
||||
exports.group = function () {
|
||||
var msg;
|
||||
|
||||
var msg;
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (e) {
|
||||
msg = e + ": " + arguments;
|
||||
}
|
||||
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (err) {
|
||||
msg = err + ": " + arguments;
|
||||
}
|
||||
|
||||
groupLevel = groupLevel + " ";
|
||||
logGroup("info", msg);
|
||||
};
|
||||
groupLevel = groupLevel + " ";
|
||||
logGroup("info", msg);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief groupCollapsed
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.groupCollapsed = function () {
|
||||
'use strict';
|
||||
exports.groupCollapsed = function () {
|
||||
var msg;
|
||||
|
||||
var msg;
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (e) {
|
||||
msg = e + ": " + arguments;
|
||||
}
|
||||
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (err) {
|
||||
msg = err + ": " + arguments;
|
||||
}
|
||||
|
||||
logGroup("info", msg);
|
||||
groupLevel = groupLevel + " ";
|
||||
};
|
||||
logGroup("info", msg);
|
||||
groupLevel = groupLevel + " ";
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief groupEnd
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.groupEnd = function () {
|
||||
'use strict';
|
||||
|
||||
groupLevel = groupLevel.substr(2);
|
||||
};
|
||||
exports.groupEnd = function () {
|
||||
groupLevel = groupLevel.substr(2);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief info
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.info = function () {
|
||||
'use strict';
|
||||
exports.info = function () {
|
||||
var msg;
|
||||
|
||||
var msg;
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (e) {
|
||||
msg = e + ": " + arguments;
|
||||
}
|
||||
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (err) {
|
||||
msg = err + ": " + arguments;
|
||||
}
|
||||
|
||||
logGroup("info", msg);
|
||||
};
|
||||
logGroup("info", msg);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief infoLines
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.infoLines = function () {
|
||||
'use strict';
|
||||
exports.infoLines = function () {
|
||||
var msg;
|
||||
|
||||
var msg;
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (e) {
|
||||
msg = e + ": " + arguments;
|
||||
}
|
||||
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (err) {
|
||||
msg = err + ": " + arguments;
|
||||
}
|
||||
var a = msg.split("\n");
|
||||
var i;
|
||||
|
||||
var a = msg.split("\n");
|
||||
var i;
|
||||
|
||||
for (i = 0; i < a.length; ++i) {
|
||||
logGroup("info", a[i]);
|
||||
}
|
||||
};
|
||||
for (i = 0; i < a.length; ++i) {
|
||||
logGroup("info", a[i]);
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief log
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.log = exports.info;
|
||||
exports.log = exports.info;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief logLines
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.logLines = exports.infoLines;
|
||||
exports.logLines = exports.infoLines;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief time
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.time = function (label) {
|
||||
'use strict';
|
||||
exports.time = function (label) {
|
||||
if (typeof label !== 'string') {
|
||||
throw new Error('label must be a string');
|
||||
}
|
||||
|
||||
if (typeof label !== 'string') {
|
||||
throw new Error('label must be a string');
|
||||
}
|
||||
var symbol = typeof Symbol === 'undefined' ? '%' + label : Symbol.for(label);
|
||||
|
||||
var symbol = typeof Symbol === 'undefined' ? '%' + label : Symbol.for(label);
|
||||
|
||||
timers[symbol] = Date.now();
|
||||
};
|
||||
timers[symbol] = Date.now();
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief timeEnd
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.timeEnd = function(label) {
|
||||
'use strict';
|
||||
exports.timeEnd = function(label) {
|
||||
var symbol = typeof Symbol === 'undefined' ? '%' + label : Symbol.for(label);
|
||||
var time = timers[symbol];
|
||||
|
||||
var symbol = typeof Symbol === 'undefined' ? '%' + label : Symbol.for(label);
|
||||
var time = timers[symbol];
|
||||
if (! time) {
|
||||
throw new Error('No such label: ' + label);
|
||||
}
|
||||
|
||||
if (! time) {
|
||||
throw new Error('No such label: ' + label);
|
||||
}
|
||||
var duration = Date.now() - time;
|
||||
|
||||
var duration = Date.now() - time;
|
||||
delete timers[symbol];
|
||||
|
||||
delete timers[symbol];
|
||||
|
||||
logGroup("info", sprintf('%s: %dms', label, duration));
|
||||
logGroup("info", sprintf('%s: %dms', label, duration));
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief trace
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.trace = function () {
|
||||
var err = new Error();
|
||||
err.name = 'trace';
|
||||
err.message = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
Error.captureStackTrace(err, exports.trace);
|
||||
logGroup("info", err.stack);
|
||||
};
|
||||
exports.trace = function () {
|
||||
var err = new Error();
|
||||
err.name = 'trace';
|
||||
err.message = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
Error.captureStackTrace(err, exports.trace);
|
||||
logGroup("info", err.stack);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief warn
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.warn = function () {
|
||||
'use strict';
|
||||
exports.warn = function () {
|
||||
var msg;
|
||||
|
||||
var msg;
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (e) {
|
||||
msg = e + ": " + arguments;
|
||||
}
|
||||
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (err) {
|
||||
msg = err + ": " + arguments;
|
||||
}
|
||||
|
||||
logGroup("warning", msg);
|
||||
};
|
||||
logGroup("warning", msg);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief warnLines
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.warnLines = function () {
|
||||
'use strict';
|
||||
exports.warnLines = function () {
|
||||
var msg;
|
||||
|
||||
var msg;
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (e) {
|
||||
msg = e + ": " + arguments;
|
||||
}
|
||||
|
||||
try {
|
||||
msg = sprintf.apply(sprintf, prepareArgs(arguments));
|
||||
}
|
||||
catch (err) {
|
||||
msg = err + ": " + arguments;
|
||||
}
|
||||
var a = msg.split("\n");
|
||||
var i;
|
||||
|
||||
var a = msg.split("\n");
|
||||
var i;
|
||||
|
||||
for (i = 0; i < a.length; ++i) {
|
||||
logGroup("warning", a[i]);
|
||||
}
|
||||
};
|
||||
for (i = 0; i < a.length; ++i) {
|
||||
logGroup("warning", a[i]);
|
||||
}
|
||||
};
|
||||
|
||||
}());
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,3 @@
|
|||
/*jshint globalstrict:true */
|
||||
'use strict';
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint strict: false, -W051: true */
|
||||
/*global require, ArangoConnection, SYS_ARANGO, window */
|
||||
/*jshint -W051:true */
|
||||
'use strict';
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief module "internal"
|
||||
|
@ -32,26 +32,23 @@
|
|||
// --SECTION-- Module "internal"
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
(function () {
|
||||
var internal = require("internal");
|
||||
|
||||
var exports = require("internal");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief hide global variables
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (typeof ArangoConnection !== "undefined") {
|
||||
internal.ArangoConnection = ArangoConnection;
|
||||
delete ArangoConnection;
|
||||
}
|
||||
if (global.ArangoConnection) {
|
||||
exports.ArangoConnection = global.ArangoConnection;
|
||||
delete global.ArangoConnection;
|
||||
}
|
||||
|
||||
if (typeof SYS_ARANGO !== "undefined") {
|
||||
internal.arango = SYS_ARANGO;
|
||||
delete SYS_ARANGO;
|
||||
}
|
||||
if (global.SYS_ARANGO) {
|
||||
exports.arango = global.SYS_ARANGO;
|
||||
delete global.SYS_ARANGO;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private functions
|
||||
|
@ -61,212 +58,212 @@
|
|||
/// @brief write-ahead log functionality
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
internal.wal = {
|
||||
flush: function (waitForSync, waitForCollector) {
|
||||
if (typeof internal.arango !== 'undefined') {
|
||||
var wfs = waitForSync ? "true" : "false";
|
||||
var wfc = waitForCollector ? "true" : "false";
|
||||
internal.arango.PUT("/_admin/wal/flush?waitForSync=" + wfs + "&waitForCollector=" + wfc, "");
|
||||
return;
|
||||
}
|
||||
|
||||
throw "not connected";
|
||||
},
|
||||
|
||||
properties: function (value) {
|
||||
if (typeof internal.arango !== 'undefined') {
|
||||
if (value !== undefined) {
|
||||
return internal.arango.PUT("/_admin/wal/properties", JSON.stringify(value));
|
||||
}
|
||||
|
||||
return internal.arango.GET("/_admin/wal/properties", "");
|
||||
}
|
||||
|
||||
throw "not connected";
|
||||
exports.wal = {
|
||||
flush: function (waitForSync, waitForCollector) {
|
||||
if (exports.arango) {
|
||||
var wfs = waitForSync ? "true" : "false";
|
||||
var wfc = waitForCollector ? "true" : "false";
|
||||
exports.arango.PUT("/_admin/wal/flush?waitForSync=" + wfs + "&waitForCollector=" + wfc, "");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
throw "not connected";
|
||||
},
|
||||
|
||||
properties: function (value) {
|
||||
if (exports.arango) {
|
||||
if (value !== undefined) {
|
||||
return exports.arango.PUT("/_admin/wal/properties", JSON.stringify(value));
|
||||
}
|
||||
|
||||
return exports.arango.GET("/_admin/wal/properties", "");
|
||||
}
|
||||
|
||||
throw "not connected";
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief reloads the AQL user functions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
internal.reloadAqlFunctions = function () {
|
||||
if (typeof internal.arango !== 'undefined') {
|
||||
internal.arango.POST("/_admin/aql/reload", "");
|
||||
return;
|
||||
}
|
||||
exports.reloadAqlFunctions = function () {
|
||||
if (exports.arango) {
|
||||
exports.arango.POST("/_admin/aql/reload", "");
|
||||
return;
|
||||
}
|
||||
|
||||
throw "not connected";
|
||||
};
|
||||
throw "not connected";
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief rebuilds the routing cache
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
internal.reloadRouting = function () {
|
||||
if (typeof internal.arango !== 'undefined') {
|
||||
internal.arango.POST("/_admin/routing/reload", "");
|
||||
return;
|
||||
}
|
||||
exports.reloadRouting = function () {
|
||||
if (exports.arango) {
|
||||
exports.arango.POST("/_admin/routing/reload", "");
|
||||
return;
|
||||
}
|
||||
|
||||
throw "not connected";
|
||||
};
|
||||
throw "not connected";
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief rebuilds the routing cache
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
internal.routingCache = function () {
|
||||
if (typeof internal.arango !== 'undefined') {
|
||||
return internal.arango.GET("/_admin/routing/routes", "");
|
||||
exports.routingCache = function () {
|
||||
if (exports.arango) {
|
||||
return exports.arango.GET("/_admin/routing/routes", "");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
throw "not connected";
|
||||
};
|
||||
throw "not connected";
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief rebuilds the authentication cache
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
internal.reloadAuth = function () {
|
||||
if (typeof internal.arango !== 'undefined') {
|
||||
internal.arango.POST("/_admin/auth/reload", "");
|
||||
return;
|
||||
}
|
||||
exports.reloadAuth = function () {
|
||||
if (exports.arango) {
|
||||
exports.arango.POST("/_admin/auth/reload", "");
|
||||
return;
|
||||
}
|
||||
|
||||
throw "not connected";
|
||||
};
|
||||
throw "not connected";
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief execute javascript file on the server
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
internal.executeServer = function (body) {
|
||||
if (typeof internal.arango !== 'undefined') {
|
||||
return internal.arango.POST("/_admin/execute", body);
|
||||
}
|
||||
exports.executeServer = function (body) {
|
||||
if (exports.arango) {
|
||||
return exports.arango.POST("/_admin/execute", body);
|
||||
}
|
||||
|
||||
throw "not connected";
|
||||
};
|
||||
throw "not connected";
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief logs a request in curl format
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
internal.appendCurlRequest = function (appender) {
|
||||
return function (method, url, body, headers) {
|
||||
var response;
|
||||
var curl;
|
||||
var i;
|
||||
exports.appendCurlRequest = function (appender) {
|
||||
return function (method, url, body, headers) {
|
||||
var response;
|
||||
var curl;
|
||||
var i;
|
||||
|
||||
if (typeof body !== 'string') {
|
||||
body = internal.inspect(body);
|
||||
}
|
||||
if (typeof body !== 'string') {
|
||||
body = exports.inspect(body);
|
||||
}
|
||||
|
||||
curl = "shell> curl ";
|
||||
curl = "shell> curl ";
|
||||
|
||||
if (method === 'POST') {
|
||||
response = internal.arango.POST_RAW(url, body, headers);
|
||||
curl += "-X " + method + " ";
|
||||
}
|
||||
else if (method === 'PUT') {
|
||||
response = internal.arango.PUT_RAW(url, body, headers);
|
||||
curl += "-X " + method + " ";
|
||||
}
|
||||
else if (method === 'GET') {
|
||||
response = internal.arango.GET_RAW(url, headers);
|
||||
}
|
||||
else if (method === 'DELETE') {
|
||||
response = internal.arango.DELETE_RAW(url, headers);
|
||||
curl += "-X " + method + " ";
|
||||
}
|
||||
else if (method === 'PATCH') {
|
||||
response = internal.arango.PATCH_RAW(url, body, headers);
|
||||
curl += "-X " + method + " ";
|
||||
}
|
||||
else if (method === 'HEAD') {
|
||||
response = internal.arango.HEAD_RAW(url, headers);
|
||||
curl += "-X " + method + " ";
|
||||
}
|
||||
else if (method === 'OPTION') {
|
||||
response = internal.arango.OPTION_RAW(url, body, headers);
|
||||
curl += "-X " + method + " ";
|
||||
}
|
||||
if (headers !== undefined && headers !== "") {
|
||||
for (i in headers) {
|
||||
if (headers.hasOwnProperty(i)) {
|
||||
curl += "--header \'" + i + ": " + headers[i] + "\' ";
|
||||
}
|
||||
if (method === 'POST') {
|
||||
response = exports.arango.POST_RAW(url, body, headers);
|
||||
curl += "-X " + method + " ";
|
||||
}
|
||||
else if (method === 'PUT') {
|
||||
response = exports.arango.PUT_RAW(url, body, headers);
|
||||
curl += "-X " + method + " ";
|
||||
}
|
||||
else if (method === 'GET') {
|
||||
response = exports.arango.GET_RAW(url, headers);
|
||||
}
|
||||
else if (method === 'DELETE') {
|
||||
response = exports.arango.DELETE_RAW(url, headers);
|
||||
curl += "-X " + method + " ";
|
||||
}
|
||||
else if (method === 'PATCH') {
|
||||
response = exports.arango.PATCH_RAW(url, body, headers);
|
||||
curl += "-X " + method + " ";
|
||||
}
|
||||
else if (method === 'HEAD') {
|
||||
response = exports.arango.HEAD_RAW(url, headers);
|
||||
curl += "-X " + method + " ";
|
||||
}
|
||||
else if (method === 'OPTION') {
|
||||
response = exports.arango.OPTION_RAW(url, body, headers);
|
||||
curl += "-X " + method + " ";
|
||||
}
|
||||
if (headers !== undefined && headers !== "") {
|
||||
for (i in headers) {
|
||||
if (headers.hasOwnProperty(i)) {
|
||||
curl += "--header \'" + i + ": " + headers[i] + "\' ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (body !== undefined && body !== "") {
|
||||
curl += "--data-binary @- ";
|
||||
}
|
||||
if (body !== undefined && body !== "") {
|
||||
curl += "--data-binary @- ";
|
||||
}
|
||||
|
||||
curl += "--dump - http://localhost:8529" + url;
|
||||
curl += "--dump - http://localhost:8529" + url;
|
||||
|
||||
appender(curl + "\n");
|
||||
appender(curl + "\n");
|
||||
|
||||
if (body !== undefined && body !== "" && body !== "undefined") {
|
||||
appender(body + "\n");
|
||||
}
|
||||
if (body !== undefined && body !== "" && body) {
|
||||
appender(body + "\n");
|
||||
}
|
||||
|
||||
appender("\n");
|
||||
appender("\n");
|
||||
|
||||
return response;
|
||||
};
|
||||
return response;
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief logs a raw response
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
internal.appendRawResponse = function (appender) {
|
||||
return function (response) {
|
||||
var key;
|
||||
var headers = response.headers;
|
||||
exports.appendRawResponse = function (appender) {
|
||||
return function (response) {
|
||||
var key;
|
||||
var headers = response.headers;
|
||||
|
||||
// generate header
|
||||
appender("HTTP/1.1 " + headers['http/1.1'] + "\n");
|
||||
// generate header
|
||||
appender("HTTP/1.1 " + headers['http/1.1'] + "\n");
|
||||
|
||||
for (key in headers) {
|
||||
if (headers.hasOwnProperty(key)) {
|
||||
if (key !== 'http/1.1' && key !== 'server' && key !== 'connection'
|
||||
&& key !== 'content-length') {
|
||||
appender(key + ": " + headers[key] + "\n");
|
||||
}
|
||||
for (key in headers) {
|
||||
if (headers.hasOwnProperty(key)) {
|
||||
if (key !== 'http/1.1' && key !== 'server' && key !== 'connection'
|
||||
&& key !== 'content-length') {
|
||||
appender(key + ": " + headers[key] + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
appender("\n");
|
||||
|
||||
// append body
|
||||
if (response.body !== undefined) {
|
||||
appender(exports.inspect(response.body));
|
||||
appender("\n");
|
||||
|
||||
// append body
|
||||
if (response.body !== undefined) {
|
||||
appender(internal.inspect(response.body));
|
||||
appender("\n");
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief logs a response in JSON
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
internal.appendJsonResponse = function (appender) {
|
||||
return function (response) {
|
||||
var rawAppend = internal.appendRawResponse(appender);
|
||||
exports.appendJsonResponse = function (appender) {
|
||||
return function (response) {
|
||||
var rawAppend = exports.appendRawResponse(appender);
|
||||
|
||||
// copy original body (this is necessary because "response" is passed by reference)
|
||||
var copy = response.body;
|
||||
// overwrite body with parsed JSON && append
|
||||
response.body = JSON.parse(response.body);
|
||||
rawAppend(response);
|
||||
// restore original body
|
||||
response.body = copy;
|
||||
};
|
||||
// copy original body (this is necessary because "response" is passed by reference)
|
||||
var copy = response.body;
|
||||
// overwrite body with parsed JSON && append
|
||||
response.body = JSON.parse(response.body);
|
||||
rawAppend(response);
|
||||
// restore original body
|
||||
response.body = copy;
|
||||
};
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions
|
||||
|
@ -276,40 +273,39 @@
|
|||
/// @brief log function
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
internal.log = function (level, msg) {
|
||||
internal.output(level, ": ", msg, "\n");
|
||||
};
|
||||
exports.log = function (level, msg) {
|
||||
exports.output(level, ": ", msg, "\n");
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sprintf wrapper
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
try {
|
||||
if (window) {
|
||||
internal.sprintf = function (format) {
|
||||
var n = arguments.length;
|
||||
if (n === 0) {
|
||||
return "";
|
||||
}
|
||||
if (n <= 1) {
|
||||
return String(format);
|
||||
}
|
||||
try {
|
||||
if (typeof window !== 'undefined') {
|
||||
exports.sprintf = function (format) {
|
||||
var n = arguments.length;
|
||||
if (n === 0) {
|
||||
return "";
|
||||
}
|
||||
if (n <= 1) {
|
||||
return String(format);
|
||||
}
|
||||
|
||||
var i;
|
||||
var args = [ ];
|
||||
for (i = 1; i < arguments.length; ++i) {
|
||||
args.push(arguments[i]);
|
||||
}
|
||||
i = 0;
|
||||
var i;
|
||||
var args = [ ];
|
||||
for (i = 1; i < arguments.length; ++i) {
|
||||
args.push(arguments[i]);
|
||||
}
|
||||
i = 0;
|
||||
|
||||
return format.replace(/%[dfs]/, function () {
|
||||
return String(args[i++]);
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
return format.replace(/%[dfs]/, function () {
|
||||
return String(args[i++]);
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
}());
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*jshint globalstrict:true, -W051:true */
|
||||
/*jshint -W051:true */
|
||||
/*global global:true, window, require */
|
||||
'use strict';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, exports, Backbone, window, arangoCollectionModel, $, arangoHelper, data, _ */
|
||||
/*global Backbone, window, arangoCollectionModel, $, arangoHelper, data, _ */
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint strict: false, unused: false */
|
||||
/*global require, exports, Backbone, window, arangoDocument, arangoDocumentModel, $, arangoHelper */
|
||||
/*global Backbone, window, arangoDocument, arangoDocumentModel, $, arangoHelper */
|
||||
|
||||
window.arangoDocument = Backbone.Collection.extend({
|
||||
url: '/_api/document/',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, exports, window, Backbone, arangoDocumentModel, _, arangoHelper, $*/
|
||||
/*global window, Backbone, arangoDocumentModel, _, arangoHelper, $*/
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, exports, Backbone, activeUser, window, ArangoQuery, $, data, _, arangoHelper*/
|
||||
/*global Backbone, activeUser, window, ArangoQuery, $, data, _, arangoHelper*/
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, exports, Backbone, window */
|
||||
/*global Backbone, window */
|
||||
window.StatisticsCollection = Backbone.Collection.extend({
|
||||
model: window.Statistics,
|
||||
url: "/_admin/statistics"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint strict: false, unused: false */
|
||||
/*global require, exports, Backbone, window */
|
||||
/*global Backbone, window */
|
||||
window.StatisticsDescriptionCollection = Backbone.Collection.extend({
|
||||
model: window.StatisticsDescription,
|
||||
url: "/_admin/statistics-description",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global require, _, Dygraph, window, document */
|
||||
/*global _, Dygraph, window, document */
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint browser: true */
|
||||
/*global require, SwaggerUi, $, hljs*/
|
||||
/*global SwaggerUi, $, hljs*/
|
||||
(function() {
|
||||
"use strict";
|
||||
var internal = require("internal");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.define("org/arangodb-common", function(exports, module) {
|
||||
/*global require, module, exports */
|
||||
'use strict';
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief JavaScript base module
|
||||
|
@ -46,17 +46,10 @@ var mimetypes = require("org/arangodb/mimetypes").mimeTypes;
|
|||
/// @brief errors
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var name;
|
||||
|
||||
for (name in internal.errors) {
|
||||
if (internal.errors.hasOwnProperty(name)) {
|
||||
exports[name] = internal.errors[name].code;
|
||||
}
|
||||
}
|
||||
}());
|
||||
Object.keys(internal.errors).forEach(function (key) {
|
||||
exports[key] = internal.errors[key].code;
|
||||
});
|
||||
|
||||
exports.errors = internal.errors;
|
||||
|
||||
|
@ -79,8 +72,6 @@ exports.ArangoError = internal.ArangoError;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.defineModule = function (path, file) {
|
||||
'use strict';
|
||||
|
||||
var content;
|
||||
var m;
|
||||
var mc;
|
||||
|
@ -109,8 +100,6 @@ exports.defineModule = function (path, file) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.guessContentType = function (filename, defaultValue) {
|
||||
'use strict';
|
||||
|
||||
var re = /\.([a-zA-Z0-9]+)$/;
|
||||
var match = re.exec(filename);
|
||||
|
||||
|
@ -149,8 +138,6 @@ exports.guessContentType = function (filename, defaultValue) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.normalizeURL = function (path) {
|
||||
'use strict';
|
||||
|
||||
var i;
|
||||
var n;
|
||||
var p;
|
||||
|
@ -231,8 +218,6 @@ exports.inspect = internal.inspect;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.output = function () {
|
||||
'use strict';
|
||||
|
||||
internal.output.apply(internal.output, arguments);
|
||||
};
|
||||
|
||||
|
@ -265,8 +250,6 @@ exports.printObject = internal.printObject;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.printTable = function (list, columns, options) {
|
||||
'use strict';
|
||||
|
||||
options = options || { };
|
||||
if (options.totalString === undefined) {
|
||||
options.totalString = "%s document(s)\n";
|
||||
|
@ -417,8 +400,6 @@ exports.printTable = function (list, columns, options) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.stringPadding = function (str, len, pad, dir) {
|
||||
'use strict';
|
||||
|
||||
// yes, this is more code than new Array(length).join(chr), but it makes jslint happy
|
||||
function fill (length, chr) {
|
||||
var result = '', i;
|
||||
|
@ -465,8 +446,6 @@ exports.stringPadding = function (str, len, pad, dir) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.throwDownloadError = function (msg) {
|
||||
'use strict';
|
||||
|
||||
throw new exports.ArangoError({
|
||||
errorNum: exports.errors.ERROR_APPLICATION_DOWNLOAD_FAILED.code,
|
||||
errorMessage: exports.errors.ERROR_APPLICATION_DOWNLOAD_FAILED.message + ': ' + String(msg)
|
||||
|
@ -478,8 +457,6 @@ exports.throwDownloadError = function (msg) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.throwFileNotFound = function (msg) {
|
||||
'use strict';
|
||||
|
||||
throw new exports.ArangoError({
|
||||
errorNum: exports.errors.ERROR_FILE_NOT_FOUND.code,
|
||||
errorMessage: exports.errors.ERROR_FILE_NOT_FOUND.message + ': ' + String(msg)
|
||||
|
@ -491,8 +468,6 @@ exports.throwFileNotFound = function (msg) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.throwBadParameter = function (msg) {
|
||||
'use strict';
|
||||
|
||||
throw new exports.ArangoError({
|
||||
errorNum: exports.errors.ERROR_BAD_PARAMETER.code,
|
||||
errorMessage: exports.errors.ERROR_BAD_PARAMETER.message + ': ' + String(msg)
|
||||
|
@ -504,8 +479,6 @@ exports.throwBadParameter = function (msg) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.checkParameter = function (usage, descs, vars) {
|
||||
'use strict';
|
||||
|
||||
var i;
|
||||
|
||||
for (i = 0; i < descs.length; ++i) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.define("org/arangodb", function(exports, module) {
|
||||
/*global require, exports */
|
||||
'use strict';
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief JavaScript base module
|
||||
|
@ -31,13 +31,9 @@ module.define("org/arangodb", function(exports, module) {
|
|||
var internal = require("internal");
|
||||
var common = require("org/arangodb-common");
|
||||
|
||||
var key;
|
||||
|
||||
for (key in common) {
|
||||
if (common.hasOwnProperty(key)) {
|
||||
exports[key] = common[key];
|
||||
}
|
||||
}
|
||||
Object.keys(common).forEach(function (key) {
|
||||
exports[key] = common[key];
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- MODULE EXPORTS
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module.define("org/arangodb/aql/explainer", function(exports, module) {
|
||||
/*jshint strict: false, maxlen: 300 */
|
||||
/*global require, exports */
|
||||
|
||||
var db = require("org/arangodb").db,
|
||||
internal = require("internal"),
|
||||
|
@ -14,7 +13,7 @@ if (typeof internal.printBrowser === "function") {
|
|||
|
||||
/* set colors for output */
|
||||
function setColors (useSystemColors) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
[ "COLOR_RESET",
|
||||
"COLOR_CYAN", "COLOR_BLUE", "COLOR_GREEN", "COLOR_MAGENTA", "COLOR_YELLOW", "COLOR_RED", "COLOR_WHITE",
|
||||
|
@ -27,27 +26,27 @@ function setColors (useSystemColors) {
|
|||
/* colorizer and output helper functions */
|
||||
|
||||
function passthru (v) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
return v;
|
||||
}
|
||||
|
||||
function keyword (v) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
return colors.COLOR_CYAN + v + colors.COLOR_RESET;
|
||||
}
|
||||
|
||||
function annotation (v) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
return colors.COLOR_BLUE + v + colors.COLOR_RESET;
|
||||
}
|
||||
|
||||
function value (v) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
return colors.COLOR_GREEN + v + colors.COLOR_RESET;
|
||||
}
|
||||
|
||||
function variable (v) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
if (v[0] === "#") {
|
||||
return colors.COLOR_MAGENTA + v + colors.COLOR_RESET;
|
||||
}
|
||||
|
@ -55,37 +54,37 @@ function variable (v) {
|
|||
}
|
||||
|
||||
function func (v) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
return colors.COLOR_GREEN + v + colors.COLOR_RESET;
|
||||
}
|
||||
|
||||
function collection (v) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
return colors.COLOR_RED + v + colors.COLOR_RESET;
|
||||
}
|
||||
|
||||
function attribute (v) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
return "`" + colors.COLOR_YELLOW + v + colors.COLOR_RESET + "`";
|
||||
}
|
||||
|
||||
function header (v) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
return colors.COLOR_MAGENTA + v + colors.COLOR_RESET;
|
||||
}
|
||||
|
||||
function section (v) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
return colors.COLOR_BOLD_BLUE + v + colors.COLOR_RESET;
|
||||
}
|
||||
|
||||
function pad (n) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
return new Array(n).join(" ");
|
||||
}
|
||||
|
||||
function wrap (str, width) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
var re = ".{1," + width + "}(\\s|$)|\\S+?(\\s|$)";
|
||||
return str.match(new RegExp(re, "g")).join("\n");
|
||||
}
|
||||
|
@ -95,7 +94,7 @@ function wrap (str, width) {
|
|||
|
||||
/* print query string */
|
||||
function printQuery (query) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
print(section("Query string:"));
|
||||
print(" " + value(wrap(query, 100).replace(/\n/g, "\n ", query)));
|
||||
print();
|
||||
|
@ -103,7 +102,7 @@ function printQuery (query) {
|
|||
|
||||
/* print write query modification flags */
|
||||
function printModificationFlags (flags) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
if (flags === undefined) {
|
||||
return;
|
||||
}
|
||||
|
@ -123,7 +122,7 @@ function printModificationFlags (flags) {
|
|||
|
||||
/* print optimizer rules */
|
||||
function printRules (rules) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
print(section("Optimization rules applied:"));
|
||||
if (rules.length === 0) {
|
||||
print(" " + value("none"));
|
||||
|
@ -140,7 +139,7 @@ function printRules (rules) {
|
|||
|
||||
/* print warnings */
|
||||
function printWarnings (warnings) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
if (! Array.isArray(warnings) || warnings.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -156,7 +155,7 @@ function printWarnings (warnings) {
|
|||
|
||||
/* print indexes used */
|
||||
function printIndexes (indexes) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
print(section("Indexes used:"));
|
||||
if (indexes.length === 0) {
|
||||
print(" " + value("none"));
|
||||
|
@ -224,7 +223,7 @@ function printIndexes (indexes) {
|
|||
|
||||
/* analzye and print execution plan */
|
||||
function processQuery (query, explain) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
var nodes = { },
|
||||
parents = { },
|
||||
rootNode = null,
|
||||
|
@ -584,7 +583,7 @@ function processQuery (query, explain) {
|
|||
|
||||
/* the exposed function */
|
||||
function explain (data, options) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
if (typeof data === "string") {
|
||||
data = { query: data };
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module.define("org/arangodb/aql/functions", function(exports, module) {
|
||||
/*jshint strict: false */
|
||||
/*global require, exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief AQL user functions management
|
||||
|
@ -48,7 +47,7 @@ var ArangoError = arangodb.ArangoError;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var getStorage = function () {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var functions = db._collection("_aqlfunctions");
|
||||
|
||||
|
@ -68,7 +67,7 @@ var getStorage = function () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var getFiltered = function (group) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var result = [ ];
|
||||
|
||||
|
@ -97,7 +96,7 @@ var getFiltered = function (group) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var validateName = function (name) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
if (typeof name !== 'string' ||
|
||||
! name.match(/^[a-zA-Z0-9_]+(::[a-zA-Z0-9_]+)+$/) ||
|
||||
|
@ -115,7 +114,7 @@ var validateName = function (name) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var stringifyFunction = function (code, name) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
if (typeof code === 'function') {
|
||||
code = String(code) + "\n";
|
||||
|
@ -173,7 +172,7 @@ var stringifyFunction = function (code, name) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var unregisterFunction = function (name) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var func = null;
|
||||
|
||||
|
@ -221,7 +220,7 @@ var unregisterFunction = function (name) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var unregisterFunctionsGroup = function (group) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
if (group.length === 0) {
|
||||
var err = new ArangoError();
|
||||
|
@ -388,7 +387,7 @@ var registerFunction = function (name, code, isDeterministic) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var toArrayFunctions = function (group) {
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var result = [ ];
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.define("org/arangodb/aql/queries", function(exports, module) {
|
||||
/*global require, exports */
|
||||
'use strict';
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief AQL query management
|
||||
|
@ -40,8 +40,6 @@ var arangosh = require("org/arangodb/arangosh");
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.clearSlow = function () {
|
||||
'use strict';
|
||||
|
||||
var db = internal.db;
|
||||
|
||||
var requestResult = db._connection.DELETE("/_api/query/slow", "");
|
||||
|
@ -55,8 +53,6 @@ exports.clearSlow = function () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.slow = function () {
|
||||
'use strict';
|
||||
|
||||
var db = internal.db;
|
||||
|
||||
var requestResult = db._connection.GET("/_api/query/slow", "");
|
||||
|
@ -70,8 +66,6 @@ exports.slow = function () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.current = function () {
|
||||
'use strict';
|
||||
|
||||
var db = internal.db;
|
||||
|
||||
var requestResult = db._connection.GET("/_api/query/current", "");
|
||||
|
@ -85,8 +79,6 @@ exports.current = function () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.properties = function (config) {
|
||||
'use strict';
|
||||
|
||||
var db = internal.db;
|
||||
|
||||
var requestResult;
|
||||
|
@ -108,8 +100,6 @@ exports.properties = function (config) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.kill = function (id) {
|
||||
'use strict';
|
||||
|
||||
if (typeof id === 'object' &&
|
||||
id.hasOwnProperty('id')) {
|
||||
id = id.id;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module.define("org/arangodb/arango-collection-common", function(exports, module) {
|
||||
/*jshint strict: false, unused: false, maxlen: 200 */
|
||||
/*global require */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief ArangoCollection
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module.define("org/arangodb/arango-collection", function(exports, module) {
|
||||
/*jshint strict: false */
|
||||
/*global require, exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief ArangoCollection
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module.define("org/arangodb/arango-database", function(exports, module) {
|
||||
/*jshint strict: false */
|
||||
/*global require, exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief ArangoDatabase
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module.define("org/arangodb/arango-query-cursor", function(exports, module) {
|
||||
/*jshint strict: false */
|
||||
/*global require, exports, more:true */
|
||||
/*global more:true */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief ArangoQueryCursor
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module.define("org/arangodb/arango-statement-common", function(exports, module) {
|
||||
/*jshint strict: false */
|
||||
/*global exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Arango statements
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module.define("org/arangodb/arango-statement", function(exports, module) {
|
||||
/*jshint strict: false */
|
||||
/*global require, exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief ArangoStatement
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module.define("org/arangodb/arangosh", function(exports, module) {
|
||||
/*jshint strict: false */
|
||||
/*global require, exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief ArangoShell client API
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module.define("org/arangodb/general-graph", function(exports, module) {
|
||||
/*jshint strict: false */
|
||||
/*global require, exports, ArangoClusterComm */
|
||||
/*global ArangoClusterComm */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Graph functionality
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module.define("org/arangodb/graph-blueprint", function(exports, module) {
|
||||
/*jshint strict: false */
|
||||
/*global require, exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Graph functionality
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module.define("org/arangodb/graph-common", function(exports, module) {
|
||||
/*jshint strict: false */
|
||||
/*global require, exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Graph functionality
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module.define("org/arangodb/graph", function(exports, module) {
|
||||
/*jshint strict: false */
|
||||
/*global require, exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Graph functionality
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module.define("org/arangodb/graph/traversal", function(exports, module) {
|
||||
/*jshint strict: false, unused: false */
|
||||
/*global require, exports, ArangoClusterComm, AQL_QUERY_IS_KILLED */
|
||||
/*global ArangoClusterComm, AQL_QUERY_IS_KILLED */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Traversal "classes"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.define("org/arangodb/is", function(exports, module) {
|
||||
/*global exports */
|
||||
'use strict';
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Check if something is something
|
||||
|
@ -29,28 +29,24 @@ module.define("org/arangodb/is", function(exports, module) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Check if a value is not undefined or null
|
||||
var existy = function (x) {
|
||||
"use strict";
|
||||
function existy (x) {
|
||||
return x !== null && x !== undefined;
|
||||
};
|
||||
}
|
||||
|
||||
// Check if a value is undefined or null
|
||||
var notExisty = function (x) {
|
||||
"use strict";
|
||||
function notExisty (x) {
|
||||
return !existy(x);
|
||||
};
|
||||
}
|
||||
|
||||
// Check if a value is existy and not false
|
||||
var truthy = function (x) {
|
||||
"use strict";
|
||||
function truthy (x) {
|
||||
return (x !== false) && existy(x);
|
||||
};
|
||||
}
|
||||
|
||||
// Check if a value is not truthy
|
||||
var falsy = function (x) {
|
||||
"use strict";
|
||||
function falsy (x) {
|
||||
return !truthy(x);
|
||||
};
|
||||
}
|
||||
|
||||
// is.object, is.noObject, is.array, is.noArray...
|
||||
[
|
||||
|
@ -63,12 +59,11 @@ var falsy = function (x) {
|
|||
'String',
|
||||
'RegExp'
|
||||
].forEach(function(type) {
|
||||
"use strict";
|
||||
exports[type.toLowerCase()] = function(obj) {
|
||||
exports[type.toLowerCase()] = function (obj) {
|
||||
return Object.prototype.toString.call(obj) === '[object '+type+']';
|
||||
};
|
||||
|
||||
exports["no" + type] = function(obj) {
|
||||
exports["no" + type] = function (obj) {
|
||||
return Object.prototype.toString.call(obj) !== '[object '+type+']';
|
||||
};
|
||||
});
|
||||
|
|
|
@ -6,7 +6,6 @@ module.define("org/arangodb/mimetypes", function(exports, module) {
|
|||
vars: true,
|
||||
white: true,
|
||||
plusplus: true */
|
||||
/*global exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief auto-generated file generated from mimetypes.dat
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.define("org/arangodb/replication", function(exports, module) {
|
||||
/*global require, exports */
|
||||
'use strict';
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Replication management
|
||||
|
@ -47,8 +47,6 @@ var applier = { };
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
logger.state = function () {
|
||||
'use strict';
|
||||
|
||||
var db = internal.db;
|
||||
|
||||
var requestResult = db._connection.GET("/_api/replication/logger-state");
|
||||
|
@ -62,8 +60,6 @@ logger.state = function () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
applier.start = function (initialTick) {
|
||||
'use strict';
|
||||
|
||||
var db = internal.db;
|
||||
var append = "";
|
||||
|
||||
|
@ -82,8 +78,6 @@ applier.start = function (initialTick) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
applier.stop = applier.shutdown = function () {
|
||||
'use strict';
|
||||
|
||||
var db = internal.db;
|
||||
|
||||
var requestResult = db._connection.PUT("/_api/replication/applier-stop", "");
|
||||
|
@ -97,8 +91,6 @@ applier.stop = applier.shutdown = function () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
applier.state = function () {
|
||||
'use strict';
|
||||
|
||||
var db = internal.db;
|
||||
|
||||
var requestResult = db._connection.GET("/_api/replication/applier-state");
|
||||
|
@ -112,8 +104,6 @@ applier.state = function () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
applier.forget = function () {
|
||||
'use strict';
|
||||
|
||||
var db = internal.db;
|
||||
|
||||
var requestResult = db._connection.DELETE("/_api/replication/applier-state");
|
||||
|
@ -127,8 +117,6 @@ applier.forget = function () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
applier.properties = function (config) {
|
||||
'use strict';
|
||||
|
||||
var db = internal.db;
|
||||
|
||||
var requestResult;
|
||||
|
@ -154,8 +142,6 @@ applier.properties = function (config) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var sync = function (config) {
|
||||
'use strict';
|
||||
|
||||
var db = internal.db;
|
||||
|
||||
var body = JSON.stringify(config || { });
|
||||
|
@ -171,8 +157,6 @@ var sync = function (config) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var serverId = function () {
|
||||
'use strict';
|
||||
|
||||
var db = internal.db;
|
||||
|
||||
var requestResult = db._connection.GET("/_api/replication/server-id");
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module.define("org/arangodb/simple-query-common", function(exports, module) {
|
||||
/*jshint strict: false */
|
||||
/*global require, exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Arango Simple Query Language
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module.define("org/arangodb/simple-query", function(exports, module) {
|
||||
/*jshint strict: false */
|
||||
/*global require, exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Arango Simple Query Language
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
module.define("org/arangodb/tutorial", function(exports, module) {
|
||||
/*jshint strict: false */
|
||||
/*global require, exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Shell tutorial
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint strict: false, unused: false */
|
||||
/*global $, jqconsole, window, document */
|
||||
/*jshint node:false, browser:true, strict: false, unused: false */
|
||||
/*global global:true, $, jqconsole */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief ArangoDB web browser shell
|
||||
|
@ -67,6 +67,10 @@ Module.prototype.moduleCache["/internal"] = new Module("/internal");
|
|||
// --SECTION-- public variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
if (typeof global === 'undefined' && typeof window !== 'undefined') {
|
||||
global = window;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoShell
|
||||
/// @{
|
||||
|
@ -76,7 +80,7 @@ Module.prototype.moduleCache["/internal"] = new Module("/internal");
|
|||
/// @brief module
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var module = Module.prototype.moduleCache["/"] = new Module("/");
|
||||
global.module = Module.prototype.moduleCache["/"] = new Module("/");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
|
@ -201,7 +205,7 @@ Module.prototype.require = function (path) {
|
|||
};
|
||||
|
||||
function require (path) {
|
||||
return module.require(path);
|
||||
return global.module.require(path);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, exports, Backbone, EJS, $, window, arangoHelper, templateEngine */
|
||||
/*global Backbone, EJS, $, window, arangoHelper, templateEngine */
|
||||
|
||||
(function() {
|
||||
"use strict";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, exports, Backbone, EJS, window, SwaggerUi, hljs, document, $, arango */
|
||||
/*global Backbone, EJS, window, SwaggerUi, hljs, document, $, arango */
|
||||
/*global templateEngine*/
|
||||
|
||||
(function() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, window, exports, Backbone, EJS, $, templateEngine, arangoHelper, Joi*/
|
||||
/*global window, exports, Backbone, EJS, $, templateEngine, arangoHelper, Joi*/
|
||||
|
||||
(function() {
|
||||
"use strict";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, exports, Backbone, EJS, $, flush, window, arangoHelper, nv, d3, localStorage*/
|
||||
/*global Backbone, EJS, $, flush, window, arangoHelper, nv, d3, localStorage*/
|
||||
/*global document, console, Dygraph, _,templateEngine */
|
||||
|
||||
(function () {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, exports, Backbone, EJS, $, window, arangoHelper, jsoneditor, templateEngine */
|
||||
/*global Backbone, EJS, $, window, arangoHelper, jsoneditor, templateEngine */
|
||||
/*global document, _ */
|
||||
|
||||
(function() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, arangoHelper, _, $, window, arangoHelper, templateEngine, Joi, btoa */
|
||||
/*global arangoHelper, _, $, window, arangoHelper, templateEngine, Joi, btoa */
|
||||
|
||||
(function() {
|
||||
"use strict";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jshint browser: true */
|
||||
/*global require, $, Joi, _, alert, templateEngine*/
|
||||
/*global $, Joi, _, alert, templateEngine*/
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, exports, Backbone, EJS, arangoHelper, window, setTimeout, $, templateEngine*/
|
||||
/*global Backbone, EJS, arangoHelper, window, setTimeout, $, templateEngine*/
|
||||
|
||||
(function() {
|
||||
"use strict";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, exports, Backbone, EJS, $, setTimeout, localStorage, ace, Storage, window, _ */
|
||||
/*global Backbone, EJS, $, setTimeout, localStorage, ace, Storage, window, _ */
|
||||
/*global _, arangoHelper, templateEngine, jQuery, Joi*/
|
||||
|
||||
(function () {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, exports, Backbone, EJS, $, setTimeout, localStorage, ace, Storage, window, _, console */
|
||||
/*global Backbone, EJS, $, setTimeout, localStorage, ace, Storage, window, _, console */
|
||||
/*global _, arangoHelper, templateEngine, jQuery, Joi, d3*/
|
||||
|
||||
(function () {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true, evil: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, exports, Backbone, EJS, $, window, ace, jqconsole, handler, help, location*/
|
||||
/*global Backbone, EJS, $, window, ace, jqconsole, handler, help, location*/
|
||||
/*global templateEngine*/
|
||||
|
||||
(function() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global exports, appCollection*/
|
||||
/*global appCollection*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief The default thumbnail for foxx apps
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global exports, appCollection*/
|
||||
/*global appCollection*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief A TODO-List Foxx-Application written for ArangoDB
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/*global exports, require*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief functionality to expose API documentation for Foxx apps
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*jslint indent: 2, nomen: true, maxlen: 100 */
|
||||
/*global require, exports */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief A configuration model for foxx templates
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/*global require, exports*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief A TODO-List Foxx-Application written for ArangoDB
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global require, applicationContext, ArangoServerState, ArangoClusterInfo, ArangoClusterComm*/
|
||||
/*global applicationContext, ArangoServerState, ArangoClusterInfo, ArangoClusterComm*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief A Foxx.Controller to handle the statistics
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global require, describe, beforeEach, it, expect, exports, Backbone, window, $, arangoLog */
|
||||
/*global describe, beforeEach, it, expect, exports, Backbone, window, $, arangoLog */
|
||||
/*global runs, waitsFor, spyOn, jasmine */
|
||||
(function () {
|
||||
"use strict";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*jshint unused: false */
|
||||
/*jshint globalstrict:false, unused: false */
|
||||
/*global document, window, d3*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*jshint unused: false */
|
||||
/*jshint globalstrict:false, unused: false */
|
||||
/*global document, window, $*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*jshint unused: false */
|
||||
/*jshint globalstrict:false, unused: false */
|
||||
/*global document, window*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*jshint unused: false */
|
||||
/*jshint globalstrict:false, unused: false */
|
||||
/*global _, document, window*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*jshint unused: false */
|
||||
/*jshint globalstrict:false, unused: false */
|
||||
/*global expect, _, $ */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global require, applicationContext*/
|
||||
/*global applicationContext*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief A Foxx.Controller to show all Foxx Applications
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global require, applicationContext */
|
||||
/*global applicationContext */
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global require, applicationContext */
|
||||
/*global applicationContext */
|
||||
(function () {
|
||||
'use strict';
|
||||
var _ = require('underscore'),
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/*jshint globalstrict:true */
|
||||
/*global exports */
|
||||
'use strict';
|
||||
function SessionNotFound(sid) {
|
||||
this.message = 'Session with session id ' + sid + ' not found.';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global require, applicationContext */
|
||||
/*global applicationContext */
|
||||
(function () {
|
||||
'use strict';
|
||||
var db = require('org/arangodb').db,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global require, exports, applicationContext */
|
||||
/*global applicationContext */
|
||||
(function () {
|
||||
'use strict';
|
||||
var _ = require('underscore'),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*global require, describe, it */
|
||||
/*global describe, it */
|
||||
(function () {
|
||||
'use strict';
|
||||
var expect = require('expect.js'),
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue