diff options
Diffstat (limited to 'common/src/main/webapp')
29 files changed, 2749 insertions, 0 deletions
diff --git a/common/src/main/webapp/usage guide/appserver/api.js b/common/src/main/webapp/usage guide/appserver/api.js new file mode 100644 index 00000000..d6517f11 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/api.js @@ -0,0 +1,311 @@ +/*
+
+ Copyright 2016-2017, Huawei Technologies Co., Ltd.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+var express = require('express');
+var router = express.Router();
+/*var js2xmlparser = require("js2xmlparser");
+var xml2js = require('xml2js');*/
+var fs = require('fs');
+var http = require('http');
+var bodyParser = require('body-parser');
+var path=require('path');
+
+var MongoClient = require('mongodb').MongoClient;
+var ObjectId = require('mongodb').ObjectId;
+
+var url = 'mongodb://localhost/rest_test';
+
+/*var exists = require('file-exists');*/
+
+// ############################################ Sign In code #################################################
+// Routes
+router.post('/signin', function (req, res) {
+ console.log("signin");
+ var obj = {
+ "name": req.body.name,
+ "pswd": req.body.pswd
+ };
+
+ var ObjLst =[] ;
+ var nameExist =0;
+ console.log(obj);
+ ObjLst = JSON.parse(fs.readFileSync('./data/input.json', 'utf8'));
+ for(var index = 0; index < ObjLst.length; index++) {
+ if (ObjLst[index].name === req.body.name && ObjLst[index].pswd === req.body.pswd) {
+ console.log("success");
+ nameExist++;
+ res.statusCode=200;
+ res.statusMessage="Sucessfully loged in";
+ break;
+ }
+ }
+ if (nameExist != 1) {
+ console.log("failed");
+ res.statusCode=404;
+ res.statusMessage="failed to login";
+ }
+ res.send();
+});
+
+// ############################################ Sign Up Code #################################################
+
+router.post('/signup', function (req, res) {
+
+ console.log("in api.js");
+
+ var ObjLst =[] ;
+ var nameNotExist =0;
+ var obj = {
+ "name": req.body.name,
+ "pswd": req.body.pswd,
+ "email": req.body.email
+ };
+ if(fs.existsSync("./data/input.json")) {
+ console.log("File Exist");
+ ObjLst = JSON.parse(fs.readFileSync('./data/input.json', 'utf8'));
+ }
+
+ for(var index = 0; index < ObjLst.length; index++) {
+ if (ObjLst[index].name === req.body.name && ObjLst[index].email === req.body.email) {
+ console.log("success");
+ nameNotExist++;
+ break;
+ }
+ }
+ if (nameNotExist == 0) {
+ ObjLst.push(obj);
+ console.log(ObjLst);
+ fs.writeFile('./data/input.json', JSON.stringify(ObjLst), function(err) {
+ if (err) {
+ return console.error(err);
+ }
+ console.log("Data written successfully!");
+ console.log("Let's read newly written data");
+ res.statusCode=200;
+ res.statusMessage="Sucessfully signed up";
+ });
+ }
+ res.send();
+});
+
+function getDataFrmProvince() {
+ var provinceData =[] ;
+ if(fs.existsSync("./data/provinceData.json")) {
+ console.log("File Exist");
+ provinceData = JSON.parse(fs.readFileSync('./data/provinceData.json', 'utf8'));
+ }
+ return provinceData;
+}
+
+function saveDataToProvince(provinceData) {
+ fs.writeFile('./data/provinceData.json', JSON.stringify(provinceData), function(err) {
+ var statueCode = 0;
+ if (err) {
+ console.error(err);
+ return statueCode = 404;
+ }
+ console.log("Data written successfully!");
+ console.log("Let's read newly written data");
+ return statueCode = 200;
+ });
+}
+
+function getIndexOfIdProvince(id) {
+ var provinceData = getDataFrmProvince();
+ var returnIndx = -1;
+ for (var index = 0; index < provinceData.length; index++) {
+ if(provinceData[index].id == id) {
+ returnIndx = index;
+ break;
+ }
+ }
+ return returnIndx;
+}
+
+function deleteIdFromProvince(idList) {
+ var provinceData = getDataFrmProvince();
+ /*for (var index = 0; index < provinceData.length; index++) {
+ if(provinceData[index].id == id) {
+ console.log("Deleting id : " + index);
+ provinceData.splice(index, 1);
+ break;
+ }
+ }*/
+ for(var i = 0; i < idList.length; i++) {
+ for (var index = 0; index < provinceData.length; index++) {
+ if(provinceData[index].id == idList[i]) {
+ console.log("Deleting id : " + index);
+ provinceData.splice(index, 1);
+ break;
+ }
+ }
+ }
+ return provinceData;
+}
+
+router.get('/getAllProvinceData', function (req, res) {
+ var provinceData = getDataFrmProvince();
+ if(provinceData) {
+ output = '{"provinceData" : ' + JSON.stringify(provinceData) + '}';
+
+ res.setHeader("Content-Type", "application/json");
+ console.log("output : " + JSON.stringify(output));
+ res.end(output);
+ }
+ /*MongoClient.connect(url, function(err, db) {
+ console.log("Connected... :-)");
+ var cursor = db.collection('ProvinceData').find({},function(err, cursor) {
+ cursor.toArray(function (err, items) {
+ output = '{"provinceData" : ' + JSON.stringify(items) + '}';
+
+ res.setHeader("Content-Type", "application/json");
+ //console.log("output : " + JSON.stringify(output));
+ res.end(output);
+ });
+ });
+ db.close(function(){
+ console.log("Connection Closed... :-)");
+ });
+ });*/
+});
+
+
+router.post('/addProvinceData', function(req, res) {
+ var provinceData = getDataFrmProvince();
+ var gen_id = Math.floor(Math.random() * (9999 - 1000 + 1)) + 1000;
+ provinceData.push({
+ "id": gen_id,
+ "province_name": req.body.province_name,
+ "ip": req.body.ip,
+ "port": req.body.port
+ });
+ var statusCode = saveDataToProvince(provinceData);
+ res.statusCode=statusCode;
+
+ if(statusCode == 200) {
+ res.statusMessage="Sucessfully signed up";
+ }
+ else {
+ res.statusMessage="Error";
+ }
+
+ /*MongoClient.connect(url, function(err, db) {
+ db.collection('ProvinceData').insertOne({
+ province_name: req.body.province_name,
+ ip: req.body.ip,
+ port: req.body.port
+ });
+ db.close();
+ });*/
+ res.statusCode=200;
+ res.statusMessage="Sucessfully signed up";
+ res.send();
+});
+
+router.post('/deleteProvinceData', function (req, res) {
+ //var provinceData = getDataFrmProvince();
+ console.log("IdList: "+ req.body.idList);
+ /*for(var i = req.body.idList.length - 1; i >= 0; i--) {
+ var index = getIndexOfIdProvince(req.body.idList[i]);
+ console.log("Deleting id : " + index);
+ if(index != -1) {
+ provinceData.splice(index, 1);
+ }
+ //deleteIdFromProvince(req.body.idList[i]);
+ };*/
+
+ var provinceData = deleteIdFromProvince(req.body.idList);
+
+ saveDataToProvince(provinceData);
+
+ /*MongoClient.connect(url, function(err, db) {
+
+ console.log("Deleting Province Data... " + req.body.idList);
+ for(var i = 0; i < req.body.idList.length; i++) {
+ db.collection('ProvinceData').deleteOne({ "_id": ObjectId(req.body.idList[i])});
+ }
+ /!*db.collection('ProvinceData').deleteOne({ "_id": ObjectId(req.body.idList)});*!/
+
+ db.close(function(){
+ console.log("Connection Closed... :-)");
+ });
+ res.send();
+ });*/
+ res.statusCode=200;
+ res.statusMessage="Sucessfully signed up";
+ res.send();
+});
+
+router.post('/editProvinceData', function (req, res) {
+ var provinceData = getDataFrmProvince();
+ var index = getIndexOfIdProvince(req.body.id);
+ console.log("Editing id : " + index);
+ if(index != -1) {
+ provinceData[index].province_name = req.body.province_name;
+ provinceData[index].ip = req.body.ip;
+ provinceData[index].port = req.body.port;
+ }
+ saveDataToProvince(provinceData);
+
+ res.statusCode=200;
+ res.statusMessage="Sucessfully signed up";
+ res.send();
+ /*MongoClient.connect(url, function(err, db) {
+
+ console.log("Editing Province Data... " + req.body._id);
+ db.collection('ProvinceData').updateOne(
+ { "_id": ObjectId(req.body._id)},
+ {
+ $set: {'province_name': req.body.province_name, 'ip': req.body.ip, 'port': req.body.port}
+ }
+ );
+
+ db.close(function(){
+ console.log("Connection Closed... :-)");
+ });
+ res.send();
+ });*/
+});
+
+
+///////////////////////////////////////////////// To Read JSON data for all widgets //////////////////////////////////////////
+
+function getDataFrmJSON(wdgtType) {
+ var jsonData =[] ;
+ if(fs.existsSync("./data/"+wdgtType+".json")) {
+ console.log("File Exist");
+ jsonData = JSON.parse(fs.readFileSync('./data/'+wdgtType+'.json', 'utf8'));
+ }
+ return jsonData;
+}
+
+router.post('/getAllJSONData', function (req, res) {
+ var jsonData = getDataFrmJSON(req.body.wdgtType);
+ if(jsonData) {
+ output = '{"data" : ' + JSON.stringify(jsonData) + '}';
+ res.setHeader("Content-Type", "application/json");
+ console.log("output : " + JSON.stringify(output));
+ res.end(output);
+ }
+});
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+// Return router
+module.exports = router;
+
diff --git a/common/src/main/webapp/usage guide/appserver/data/buttonsData.json b/common/src/main/webapp/usage guide/appserver/data/buttonsData.json new file mode 100644 index 00000000..0176461c --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/data/buttonsData.json @@ -0,0 +1,30 @@ +{
+ "default_btn_data" : {
+ "def_button" : {"title":"Default"},
+ "def_print_button" : {"title":"Print", "type":"btn btn-default", "gType": "glyphicon-print", "iconPosition":"left"},
+ "def_print_button_right" : {"title":"Search", "type":"btn btn-default", "gType": "glyphicon-search", "iconPosition":"right"}
+ },
+
+ "visual_btn_data" : {
+ "vis_pri_btn_data" : {"title":"Primary", "type":"primary"},
+ "vis_sec_btn_data" : {"title":"Secondary", "type":"secondary"},
+ "vis_succ_btn_data" : {"title":"Success", "type":"success"},
+ "vis_inf_btn_data" : {"title":"Info", "type":"info"},
+ "vis_warn_btn_data" : {"title":"Warning", "type":"warning"},
+ "vis_dang_btn_data" : {"title":"Danger", "type":"danger"},
+ "vis_link_btn_data" : {"title":"Link", "type":"link"}
+ },
+
+ "diffSize_btn_data" : {
+ "size_small_btn_data" : {"title": "Small Button", "type": "primary", "size": "btn-sm"},
+ "size_large_btn_data" : {"title": "Large Button", "type": "primary", "size": "btn-lg"},
+ "size_block_btn_data" : {"title": "Large Block Button", "type": "primary", "size": "btn-lg btn-block"}
+ },
+
+ "icon_btn_data" : {
+ "search_icon_btn_data" : {"title": "Search Icon", "type": "btn-default", "gType": "glyphicon-search"},
+ "search_icon_styled_btn_data" : {"title": "Styled Search Icon", "type": "primary", "gType": "glyphicon-search"},
+ "print_icon_btn_data" : {"title": "Print", "type": "primary btn-lg", "gType": "glyphicon-print"}
+ }
+
+}
diff --git a/common/src/main/webapp/usage guide/appserver/data/checkboxData.json b/common/src/main/webapp/usage guide/appserver/data/checkboxData.json new file mode 100644 index 00000000..f86d319d --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/data/checkboxData.json @@ -0,0 +1,8 @@ +{
+ "checkbox_default_data" : {"id":1, "label":"Default check box", "type":"default", "checked":true},
+ "checkbox_primary_data" : {"id":2, "label":"Primary check box", "type":"primary", "checked":false},
+ "checkbox_success_data" : {"id":3, "label":"Success check box", "type":"success", "checked":true},
+ "checkbox_danger_data" : {"id":4, "label":"Danger check box", "type":"danger", "checked":true},
+ "checkbox_warn_data" : {"id":5, "label":"Warn check box", "type":"warning", "checked":false},
+ "checkbox_info_data" : {"id":6, "label":"Info check box", "type":"info", "checked":true}
+}
\ No newline at end of file diff --git a/common/src/main/webapp/usage guide/appserver/data/dropdownData.json b/common/src/main/webapp/usage guide/appserver/data/dropdownData.json new file mode 100644 index 00000000..a02e31c0 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/data/dropdownData.json @@ -0,0 +1,18 @@ +{
+ "dropped_down_data" :{"title":"DropDown","position":"down", "items":[{"itemLabel": "Node JS"},{"itemLabel": "JS"}]},
+ "dropped_up_data" : {"title":"DropUp","position":"up", "items":[{"itemLabel": "PHP"},{"itemLabel": "ASP"}]},
+ "dropHeader_data" :{"title":"DropHeader","position":"down",
+ "items":[{"itemLabel": "Web UI", "isheader":true},
+ {"itemLabel": "HTML", "isheader":false},
+ {"itemLabel": "CSS", "isheader":false},
+ {"itemLabel": "JS", "isheader":false},
+ {"itemLabel": "Programming", "isheader":true},
+ {"itemLabel": "C", "isheader":false},
+ {"itemLabel": "C++", "isheader":false}]
+ },
+ "dropSimple_data" : {"title":"Gadgets",
+ "items":[
+ {"itemLabel": "Cameras"},{"itemLabel": "Mobile Phones"},{"itemLabel": "Computers"},{"itemLabel": "Monitors"},{"itemLabel": "Tablets"},{"itemLabel": "Others"}
+ ]
+ }
+}
\ No newline at end of file diff --git a/common/src/main/webapp/usage guide/appserver/data/functionalData.json b/common/src/main/webapp/usage guide/appserver/data/functionalData.json new file mode 100644 index 00000000..35b66f49 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/data/functionalData.json @@ -0,0 +1,6 @@ +{
+ "create_data" : {"title":"Create", "labels":[{"text": "Username", "input_id":"username", "type":"text"},{"text": "Password", "input_id":"username", "type":"password"}], "showClose":"true","closeBtnTxt":"Cancel","msg":"This is Create dialog box", "buttons":[{"text": "Ok"}]},
+ "modify_data" : {"title":"Modify", "labels":[{"text": "Username", "input_id":"username", "type":"text"},{"text": "Password", "input_id":"username", "type":"password"}], "showClose":"true","closeBtnTxt":"Cancel","msg":"This is Modify dialog box", "buttons":[{"text": "Ok"}]},
+ "delete_data" : {"title":"Delete", "showClose":"true","closeBtnTxt":"Cancel","msg":"This is Delete dialog box", "buttons":[{"text": "Ok"}]},
+ "workflow_data" : {"title":"Workflow","showClose":"true","closeBtnTxt":"Cancel","msg":"This is Workflow dialog box", "buttons":[{"text": "Ok"}]}
+}
diff --git a/common/src/main/webapp/usage guide/appserver/data/input.json b/common/src/main/webapp/usage guide/appserver/data/input.json new file mode 100644 index 00000000..7126e781 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/data/input.json @@ -0,0 +1 @@ +[{"name":"shahid","pswd":"shahid","email":"shahid@gmail.com"},{"name":"noor","pswd":"noor","email":"noor@lnt.com"}]
\ No newline at end of file diff --git a/common/src/main/webapp/usage guide/appserver/data/list.json b/common/src/main/webapp/usage guide/appserver/data/list.json new file mode 100644 index 00000000..505bbcc2 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/data/list.json @@ -0,0 +1,76 @@ +[
+ {
+ "id": "113",
+ "title": "Movies",
+ "subMenu": [
+ {
+ "title":"Sci-fi",
+ "subsubMenu":[
+ {"title":"Intersteller"},
+ {"title":"Inception"},
+ {"title":"The Arrival"},
+ {"title":"The Paycheck"}
+ ]
+ },
+ {
+ "title":"Animation",
+ "subsubMenu":[
+ {"title":"Big Hero"},
+ {"title":"Monster University"},
+ {"title":"Frozen"},
+ {"title":"Car"}
+ ]
+ },
+ {
+ "title":"Action",
+ "subsubMenu":[
+ {"title":"Mission Impossible"},
+ {"title":"The Expendables"}
+ ]
+ },
+ {
+ "title":"Horror",
+ "subsubMenu":[
+ {"title":"Evil Dead"},
+ {"title":"Anebelle"}
+ ]
+ },
+ {
+ "title":"Comedy",
+ "subsubMenu":[
+ {"title":"Superbad"},
+ {"title":"Airplane"},
+ {"title":"Clueless"}
+ ]
+ }
+ ]
+ },
+ {
+ "id": "211",
+ "title": "Games",
+ "subMenu": [{"title":"Outdoor Games", "subsubMenu":[{"title":"Cricket"},{"title":"Football"}, {"title":"Volleyball"}, {"title":"Hockey"}]}, {"title":"Indoor Games", "subsubMenu":[{"title":"Carroms"},{"title":"Table Tennis"}]}, {"title":"Puzzles", "subsubMenu":[{"title":"Sudoku"},{"title":"Chess"}]}, {"title":"Card Games", "subsubMenu":[{"title":"UNO"},{"title":"RUMMY"}]}]
+ },
+ {
+ "id": "037",
+ "title": "Animals",
+ "subMenu": [{"title":"Mammals", "subsubMenu":[{"title":"Monkey"},{"title":"Elephant"}]}, {"title":"Birds", "subsubMenu":[{"title":"Parrot"},{"title":"Ostrich"},{"title":"Eagle"}]}, {"title":"Reptiles", "subsubMenu":[{"title":"Snake"},{"title":"Lizard"},{"title":"Cameleon"}]}]
+ },
+ {
+ "id": "127",
+ "title": "Vehicles",
+ "subMenu": [{"title":"Cars", "subsubMenu":[{"title":"Audi"},{"title":"Range Rover"}]}, {"title":"Bikes", "subsubMenu":[{"title":"Apache"},{"title":"Pulsar"},{"title":"FZ"},{"title":"Jupiter"},{"title":"Victor"},{"title":"Avengers"}]}, {"title":"Cycles", "subsubMenu":[{"title":"Hero"},{"title":"Lady Bird"},{"title":"Firefox"}]}]
+ },
+ {
+ "id": "181",
+ "title": "Languages",
+ "subMenu": [{"title":"English"}, {"title":"French"}, {"title":"Chinese"}, {"title":"Hindi"}]
+ },
+ {
+ "id": "210",
+ "title": "Continents",
+ "subMenu": [{"title":"Asia", "subsubMenu":[{"title":"India"},{"title":"China"}]}, {"title":"Africa", "subsubMenu":[{"title":"South Africa"},{"title":"Kenya"},{"title":"Zimbabwe"}]}]
+ }
+]
+
+
+
diff --git a/common/src/main/webapp/usage guide/appserver/data/radioData.json b/common/src/main/webapp/usage guide/appserver/data/radioData.json new file mode 100644 index 00000000..da0daa47 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/data/radioData.json @@ -0,0 +1,14 @@ +{
+ "radio_btn_default_data" : {"id":1, "label":"Default Radio Btn", "type":"default", "checked":false},
+ "radio_btn_primary_data" : {"id":2, "label":"Primary Radio Btn", "type":"primary", "checked":false},
+ "radio_btn_success_data" : {"id":3, "label":"Success Radio Btn", "type":"success", "checked":true},
+ "radio_btn_danger_data" : {"id":4, "label":"Danger Radio Btn", "type":"danger", "checked":false},
+ "radio_btn_Warn_data" : {"id":5, "label":"Warn Radio Btn", "type":"warning", "checked":false},
+ "radio_btn_info_data" : {"id":6, "label":"Info Radio Btn", "type":"info", "checked":false}
+}
+
+
+
+
+
+
diff --git a/common/src/main/webapp/usage guide/appserver/data/shortNote.json b/common/src/main/webapp/usage guide/appserver/data/shortNote.json new file mode 100644 index 00000000..6b2942a8 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/data/shortNote.json @@ -0,0 +1,17 @@ +{
+ "treeTip":"Ztree",
+ "accordionTip":"Use the data-parent attribute to make sure that all collapsible elements under the specified parent will be closed when one of the collapsible item is shown.",
+ "tabTip":"Tabs are created with <ul class=nav nav-tabs> Tip: Also mark the current page with <li class=active>",
+ "vtabTip":"Pills can also be displayed vertically. Just add the .nav-stacked class",
+ "tableTip":"The .table class adds basic styling to a table, The .table-hover class adds a hover effect (grey background color) on table rows,The .table-striped class adds zebra-stripes to a table,Loop through all table rows, and hide those who don't match the search query",
+ "buttonTip":"Default Buttons-To achieve the button styles above, Bootstrap has the following classes like .btn-default, Visual Buttons- To achieve the button styles above, Bootstrap has the following classes like .btn-primary .btn-success .btn-info .btn-warning .btn-danger .btn-link,Different Sized Buttons-To achieve the button styles above, Bootstrap has the following classes like .btn-lg .btn-md .btn-sm .btn-xs,Icon Buttons- Bootstrap provides 260 glyphicons from the Glyphicons Halflings set. Glyphicons can be used in text, buttons, toolbars, navigation, forms, etc.",
+ "dropdownTip":"Dropdown- A dropdown menu is a toggleable menu that allows the user to choose one value from a predefined list,The .dropdown class indicates a dropdown menu,To open the dropdown menu, use a button or a link with a class of .dropdown-toggle and the data-toggle=dropdown attribute. The .caret class creates a caret arrow icon (), which indicates that the button is a dropdown. Add the .dropdown-menu class to a <ul> element to actually build the dropdown menu. Dropdown Header-The .dropdown-header class is used to add headers inside the dropdown menu. Dropup Header-If you want the dropdown menu to expand upwards instead of downwards, change the <div> element with class=dropdown to dropup",
+ "radioTip":"Use the type as Radio to use radio buttons",
+ "checkboxTip":"use the following classes funkyradio-default funkyradio-primary funkyradio-success funkyradio-info funkyradio-danger funkyradio-warning",
+ "toolTip":"Tooltip",
+ "listTip":"Listtip",
+ "provinceTip":"provinceTip",
+ "notificationTip":"notificationTip",
+ "functionalTip":"functionalTip"
+
+}
\ No newline at end of file diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/index.js b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/index.js new file mode 100644 index 00000000..93c3a1ff --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/index.js @@ -0,0 +1,157 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var deprecate = require('depd')('body-parser') + +/** + * Cache of loaded parsers. + * @private + */ + +var parsers = Object.create(null) + +/** + * @typedef Parsers + * @type {function} + * @property {function} json + * @property {function} raw + * @property {function} text + * @property {function} urlencoded + */ + +/** + * Module exports. + * @type {Parsers} + */ + +exports = module.exports = deprecate.function(bodyParser, + 'bodyParser: use individual json/urlencoded middlewares') + +/** + * JSON parser. + * @public + */ + +Object.defineProperty(exports, 'json', { + configurable: true, + enumerable: true, + get: createParserGetter('json') +}) + +/** + * Raw parser. + * @public + */ + +Object.defineProperty(exports, 'raw', { + configurable: true, + enumerable: true, + get: createParserGetter('raw') +}) + +/** + * Text parser. + * @public + */ + +Object.defineProperty(exports, 'text', { + configurable: true, + enumerable: true, + get: createParserGetter('text') +}) + +/** + * URL-encoded parser. + * @public + */ + +Object.defineProperty(exports, 'urlencoded', { + configurable: true, + enumerable: true, + get: createParserGetter('urlencoded') +}) + +/** + * Create a middleware to parse json and urlencoded bodies. + * + * @param {object} [options] + * @return {function} + * @deprecated + * @public + */ + +function bodyParser (options) { + var opts = {} + + // exclude type option + if (options) { + for (var prop in options) { + if (prop !== 'type') { + opts[prop] = options[prop] + } + } + } + + var _urlencoded = exports.urlencoded(opts) + var _json = exports.json(opts) + + return function bodyParser (req, res, next) { + _json(req, res, function (err) { + if (err) return next(err) + _urlencoded(req, res, next) + }) + } +} + +/** + * Create a getter for loading a parser. + * @private + */ + +function createParserGetter (name) { + return function get () { + return loadParser(name) + } +} + +/** + * Load a parser module. + * @private + */ + +function loadParser (parserName) { + var parser = parsers[parserName] + + if (parser !== undefined) { + return parser + } + + // this uses a switch for static require analysis + switch (parserName) { + case 'json': + parser = require('./lib/types/json') + break + case 'raw': + parser = require('./lib/types/raw') + break + case 'text': + parser = require('./lib/types/text') + break + case 'urlencoded': + parser = require('./lib/types/urlencoded') + break + } + + // store to prevent invoking require() + return (parsers[parserName] = parser) +} diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/lib/read.js b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/lib/read.js new file mode 100644 index 00000000..3c0fe936 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/lib/read.js @@ -0,0 +1,188 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var createError = require('http-errors') +var getBody = require('raw-body') +var iconv = require('iconv-lite') +var onFinished = require('on-finished') +var zlib = require('zlib') + +/** + * Module exports. + */ + +module.exports = read + +/** + * Read a request into a buffer and parse. + * + * @param {object} req + * @param {object} res + * @param {function} next + * @param {function} parse + * @param {function} debug + * @param {object} [options] + * @api private + */ + +function read (req, res, next, parse, debug, options) { + var length + var opts = options || {} + var stream + + // flag as parsed + req._body = true + + // read options + var encoding = opts.encoding !== null + ? opts.encoding || 'utf-8' + : null + var verify = opts.verify + + try { + // get the content stream + stream = contentstream(req, debug, opts.inflate) + length = stream.length + stream.length = undefined + } catch (err) { + return next(err) + } + + // set raw-body options + opts.length = length + opts.encoding = verify + ? null + : encoding + + // assert charset is supported + if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) { + return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', { + charset: encoding.toLowerCase() + })) + } + + // read body + debug('read body') + getBody(stream, opts, function (err, body) { + if (err) { + // default to 400 + setErrorStatus(err, 400) + + // echo back charset + if (err.type === 'encoding.unsupported') { + err = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', { + charset: encoding.toLowerCase() + }) + } + + // read off entire request + stream.resume() + onFinished(req, function onfinished () { + next(err) + }) + return + } + + // verify + if (verify) { + try { + debug('verify body') + verify(req, res, body, encoding) + } catch (err) { + // default to 403 + setErrorStatus(err, 403) + next(err) + return + } + } + + // parse + var str + try { + debug('parse body') + str = typeof body !== 'string' && encoding !== null + ? iconv.decode(body, encoding) + : body + req.body = parse(str) + } catch (err) { + err.body = str === undefined + ? body + : str + + // default to 400 + setErrorStatus(err, 400) + + next(err) + return + } + + next() + }) +} + +/** + * Get the content stream of the request. + * + * @param {object} req + * @param {function} debug + * @param {boolean} [inflate=true] + * @return {object} + * @api private + */ + +function contentstream (req, debug, inflate) { + var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase() + var length = req.headers['content-length'] + var stream + + debug('content-encoding "%s"', encoding) + + if (inflate === false && encoding !== 'identity') { + throw createError(415, 'content encoding unsupported') + } + + switch (encoding) { + case 'deflate': + stream = zlib.createInflate() + debug('inflate body') + req.pipe(stream) + break + case 'gzip': + stream = zlib.createGunzip() + debug('gunzip body') + req.pipe(stream) + break + case 'identity': + stream = req + stream.length = length + break + default: + throw createError(415, 'unsupported content encoding "' + encoding + '"', { + encoding: encoding + }) + } + + return stream +} + +/** + * Set a status on an error object, if ones does not exist + * @private + */ + +function setErrorStatus (error, status) { + if (!error.status && !error.statusCode) { + error.status = status + error.statusCode = status + } +} diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/lib/types/json.js b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/lib/types/json.js new file mode 100644 index 00000000..d0023c7b --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/lib/types/json.js @@ -0,0 +1,175 @@ +/*! + * body-parser + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var bytes = require('bytes') +var contentType = require('content-type') +var createError = require('http-errors') +var debug = require('debug')('body-parser:json') +var read = require('../read') +var typeis = require('type-is') + +/** + * Module exports. + */ + +module.exports = json + +/** + * RegExp to match the first non-space in a string. + * + * Allowed whitespace is defined in RFC 7159: + * + * ws = *( + * %x20 / ; Space + * %x09 / ; Horizontal tab + * %x0A / ; Line feed or New line + * %x0D ) ; Carriage return + */ + +var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*(.)/ // eslint-disable-line no-control-regex + +/** + * Create a middleware to parse JSON bodies. + * + * @param {object} [options] + * @return {function} + * @public + */ + +function json (options) { + var opts = options || {} + + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var inflate = opts.inflate !== false + var reviver = opts.reviver + var strict = opts.strict !== false + var type = opts.type || 'application/json' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type + + function parse (body) { + if (body.length === 0) { + // special-case empty json body, as it's a common client-side mistake + // TODO: maybe make this configurable or part of "strict" option + return {} + } + + if (strict) { + var first = firstchar(body) + + if (first !== '{' && first !== '[') { + debug('strict violation') + throw new SyntaxError('Unexpected token ' + first) + } + } + + debug('parse json') + return JSON.parse(body, reviver) + } + + return function jsonParser (req, res, next) { + if (req._body) { + debug('body already parsed') + next() + return + } + + req.body = req.body || {} + + // skip requests without bodies + if (!typeis.hasBody(req)) { + debug('skip empty body') + next() + return + } + + debug('content-type %j', req.headers['content-type']) + + // determine if request should be parsed + if (!shouldParse(req)) { + debug('skip parsing') + next() + return + } + + // assert charset per RFC 7159 sec 8.1 + var charset = getCharset(req) || 'utf-8' + if (charset.substr(0, 4) !== 'utf-') { + debug('invalid charset') + next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', { + charset: charset + })) + return + } + + // read + read(req, res, next, parse, debug, { + encoding: charset, + inflate: inflate, + limit: limit, + verify: verify + }) + } +} + +/** + * Get the first non-whitespace character in a string. + * + * @param {string} str + * @return {function} + * @api public + */ + +function firstchar (str) { + var match = FIRST_CHAR_REGEXP.exec(str) + return match ? match[1] : '' +} + +/** + * Get the charset of a request. + * + * @param {object} req + * @api private + */ + +function getCharset (req) { + try { + return contentType.parse(req).parameters.charset.toLowerCase() + } catch (e) { + return undefined + } +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/lib/types/raw.js b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/lib/types/raw.js new file mode 100644 index 00000000..f5d1b674 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/lib/types/raw.js @@ -0,0 +1,101 @@ +/*! + * body-parser + * Copyright(c) 2014-2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + */ + +var bytes = require('bytes') +var debug = require('debug')('body-parser:raw') +var read = require('../read') +var typeis = require('type-is') + +/** + * Module exports. + */ + +module.exports = raw + +/** + * Create a middleware to parse raw bodies. + * + * @param {object} [options] + * @return {function} + * @api public + */ + +function raw (options) { + var opts = options || {} + + var inflate = opts.inflate !== false + var limit = typeof opts.limit !== 'number' + ? bytes.parse(opts.limit || '100kb') + : opts.limit + var type = opts.type || 'application/octet-stream' + var verify = opts.verify || false + + if (verify !== false && typeof verify !== 'function') { + throw new TypeError('option verify must be function') + } + + // create the appropriate type checking function + var shouldParse = typeof type !== 'function' + ? typeChecker(type) + : type + + function parse (buf) { + return buf + } + + return function rawParser (req, res, next) { + if (req._body) { + debug('body already parsed') + next() + return + } + + req.body = req.body || {} + + // skip requests without bodies + if (!typeis.hasBody(req)) { + debug('skip empty body') + next() + return + } + + debug('content-type %j', req.headers['content-type']) + + // determine if request should be parsed + if (!shouldParse(req)) { + debug('skip parsing') + next() + return + } + + // read + read(req, res, next, parse, debug, { + encoding: null, + inflate: inflate, + limit: limit, + verify: verify + }) + } +} + +/** + * Get the simple type checker. + * + * @param {string} type + * @return {function} + */ + +function typeChecker (type) { + return function checkType (req) { + return Boolean(typeis(req, type)) + } +} diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/bytes/index.js b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/bytes/index.js new file mode 100644 index 00000000..aa24231b --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/bytes/index.js @@ -0,0 +1,157 @@ +/*! + * bytes + * Copyright(c) 2012-2014 TJ Holowaychuk + * Copyright(c) 2015 Jed Watson + * MIT Licensed + */ + +'use strict'; + +/** + * Module exports. + * @public + */ + +module.exports = bytes; +module.exports.format = format; +module.exports.parse = parse; + +/** + * Module variables. + * @private + */ + +var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g; + +var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/; + +var map = { + b: 1, + kb: 1 << 10, + mb: 1 << 20, + gb: 1 << 30, + tb: ((1 << 30) * 1024) +}; + +// TODO: use is-finite module? +var numberIsFinite = Number.isFinite || function (v) { return typeof v === 'number' && isFinite(v); }; + +var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb)$/i; + +/** + * Convert the given value in bytes into a string or parse to string to an integer in bytes. + * + * @param {string|number} value + * @param {{ + * case: [string], + * decimalPlaces: [number] + * fixedDecimals: [boolean] + * thousandsSeparator: [string] + * unitSeparator: [string] + * }} [options] bytes options. + * + * @returns {string|number|null} + */ + +function bytes(value, options) { + if (typeof value === 'string') { + return parse(value); + } + + if (typeof value === 'number') { + return format(value, options); + } + + return null; +} + +/** + * Format the given value in bytes into a string. + * + * If the value is negative, it is kept as such. If it is a float, + * it is rounded. + * + * @param {number} value + * @param {object} [options] + * @param {number} [options.decimalPlaces=2] + * @param {number} [options.fixedDecimals=false] + * @param {string} [options.thousandsSeparator=] + * @param {string} [options.unitSeparator=] + * + * @returns {string|null} + * @public + */ + +function format(value, options) { + if (!numberIsFinite(value)) { + return null; + } + + var mag = Math.abs(value); + var thousandsSeparator = (options && options.thousandsSeparator) || ''; + var unitSeparator = (options && options.unitSeparator) || ''; + var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2; + var fixedDecimals = Boolean(options && options.fixedDecimals); + var unit = 'B'; + + if (mag >= map.tb) { + unit = 'TB'; + } else if (mag >= map.gb) { + unit = 'GB'; + } else if (mag >= map.mb) { + unit = 'MB'; + } else if (mag >= map.kb) { + unit = 'kB'; + } + + var val = value / map[unit.toLowerCase()]; + var str = val.toFixed(decimalPlaces); + + if (!fixedDecimals) { + str = str.replace(formatDecimalsRegExp, '$1'); + } + + if (thousandsSeparator) { + str = str.replace(formatThousandsRegExp, thousandsSeparator); + } + + return str + unitSeparator + unit; +} + +/** + * Parse the string value into an integer in bytes. + * + * If no unit is given, it is assumed the value is in bytes. + * + * @param {number|string} val + * + * @returns {number|null} + * @public + */ + +function parse(val) { + if (typeof val === 'number' && !isNaN(val)) { + return val; + } + + if (typeof val !== 'string') { + return null; + } + + // Test if the string passed is valid + var results = parseRegExp.exec(val); + var floatValue; + var unit = 'b'; + + if (!results) { + // Nothing could be extracted from the given string + floatValue = parseInt(val, 10); + unit = 'b' + } else { + // Retrieve the value and the unit + floatValue = parseFloat(results[1]); + unit = results[4].toLowerCase(); + } + + return Math.floor(map[unit] * floatValue); +} diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/bytes/package.json b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/bytes/package.json new file mode 100644 index 00000000..bb349284 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/bytes/package.json @@ -0,0 +1,84 @@ +{ + "name": "bytes", + "description": "Utility to parse a string bytes to bytes and vice-versa", + "version": "2.4.0", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca", + "url": "http://tjholowaychuk.com" + }, + "contributors": [ + { + "name": "Jed Watson", + "email": "jed.watson@me.com" + }, + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "license": "MIT", + "keywords": [ + "byte", + "bytes", + "utility", + "parse", + "parser", + "convert", + "converter" + ], + "repository": { + "type": "git", + "url": "https://github.com/visionmedia/bytes.js" + }, + "component": { + "scripts": { + "bytes/index.js": "index.js" + } + }, + "devDependencies": { + "mocha": "1.21.5" + }, + "files": [ + "History.md", + "LICENSE", + "Readme.md", + "index.js" + ], + "scripts": { + "test": "mocha --check-leaks --reporter spec" + }, + "gitHead": "2a598442bdfa796df8d01a96cc54495cda550e70", + "bugs": { + "url": "https://github.com/visionmedia/bytes.js/issues" + }, + "homepage": "https://github.com/visionmedia/bytes.js", + "_id": "bytes@2.4.0", + "_shasum": "7d97196f9d5baf7f6935e25985549edd2a6c2339", + "_from": "bytes@2.4.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "dougwilson", + "email": "doug@somethingdoug.com" + }, + "maintainers": [ + { + "name": "dougwilson", + "email": "doug@somethingdoug.com" + }, + { + "name": "tjholowaychuk", + "email": "tj@vision-media.ca" + } + ], + "dist": { + "shasum": "7d97196f9d5baf7f6935e25985549edd2a6c2339", + "tarball": "https://registry.npmjs.org/bytes/-/bytes-2.4.0.tgz" + }, + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/bytes-2.4.0.tgz_1464812473023_0.6271433881483972" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/bytes/-/bytes-2.4.0.tgz" +} diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/content-type/index.js b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/content-type/index.js new file mode 100644 index 00000000..61ba6b5a --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/content-type/index.js @@ -0,0 +1,216 @@ +/*! + * content-type + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1 + * + * parameter = token "=" ( token / quoted-string ) + * token = 1*tchar + * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" + * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" + * / DIGIT / ALPHA + * ; any VCHAR, except delimiters + * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE + * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text + * obs-text = %x80-FF + * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) + */ +var paramRegExp = /; *([!#$%&'\*\+\-\.\^_`\|~0-9A-Za-z]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'\*\+\-\.\^_`\|~0-9A-Za-z]+) */g +var textRegExp = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/ +var tokenRegExp = /^[!#$%&'\*\+\-\.\^_`\|~0-9A-Za-z]+$/ + +/** + * RegExp to match quoted-pair in RFC 7230 sec 3.2.6 + * + * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) + * obs-text = %x80-FF + */ +var qescRegExp = /\\([\u000b\u0020-\u00ff])/g + +/** + * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6 + */ +var quoteRegExp = /([\\"])/g + +/** + * RegExp to match type in RFC 6838 + * + * media-type = type "/" subtype + * type = token + * subtype = token + */ +var typeRegExp = /^[!#$%&'\*\+\-\.\^_`\|~0-9A-Za-z]+\/[!#$%&'\*\+\-\.\^_`\|~0-9A-Za-z]+$/ + +/** + * Module exports. + * @public + */ + +exports.format = format +exports.parse = parse + +/** + * Format object to media type. + * + * @param {object} obj + * @return {string} + * @public + */ + +function format(obj) { + if (!obj || typeof obj !== 'object') { + throw new TypeError('argument obj is required') + } + + var parameters = obj.parameters + var type = obj.type + + if (!type || !typeRegExp.test(type)) { + throw new TypeError('invalid type') + } + + var string = type + + // append parameters + if (parameters && typeof parameters === 'object') { + var param + var params = Object.keys(parameters).sort() + + for (var i = 0; i < params.length; i++) { + param = params[i] + + if (!tokenRegExp.test(param)) { + throw new TypeError('invalid parameter name') + } + + string += '; ' + param + '=' + qstring(parameters[param]) + } + } + + return string +} + +/** + * Parse media type to object. + * + * @param {string|object} string + * @return {Object} + * @public + */ + +function parse(string) { + if (!string) { + throw new TypeError('argument string is required') + } + + if (typeof string === 'object') { + // support req/res-like objects as argument + string = getcontenttype(string) + + if (typeof string !== 'string') { + throw new TypeError('content-type header is missing from object'); + } + } + + if (typeof string !== 'string') { + throw new TypeError('argument string is required to be a string') + } + + var index = string.indexOf(';') + var type = index !== -1 + ? string.substr(0, index).trim() + : string.trim() + + if (!typeRegExp.test(type)) { + throw new TypeError('invalid media type') + } + + var key + var match + var obj = new ContentType(type.toLowerCase()) + var value + + paramRegExp.lastIndex = index + + while (match = paramRegExp.exec(string)) { + if (match.index !== index) { + throw new TypeError('invalid parameter format') + } + + index += match[0].length + key = match[1].toLowerCase() + value = match[2] + + if (value[0] === '"') { + // remove quotes and escapes + value = value + .substr(1, value.length - 2) + .replace(qescRegExp, '$1') + } + + obj.parameters[key] = value + } + + if (index !== -1 && index !== string.length) { + throw new TypeError('invalid parameter format') + } + + return obj +} + +/** + * Get content-type from req/res objects. + * + * @param {object} + * @return {Object} + * @private + */ + +function getcontenttype(obj) { + if (typeof obj.getHeader === 'function') { + // res-like + return obj.getHeader('content-type') + } + + if (typeof obj.headers === 'object') { + // req-like + return obj.headers && obj.headers['content-type'] + } +} + +/** + * Quote a string if necessary. + * + * @param {string} val + * @return {string} + * @private + */ + +function qstring(val) { + var str = String(val) + + // no need to quote tokens + if (tokenRegExp.test(str)) { + return str + } + + if (str.length > 0 && !textRegExp.test(str)) { + throw new TypeError('invalid parameter value') + } + + return '"' + str.replace(quoteRegExp, '\\$1') + '"' +} + +/** + * Class to represent a content type. + * @private + */ +function ContentType(type) { + this.parameters = Object.create(null) + this.type = type +} diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/content-type/package.json b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/content-type/package.json new file mode 100644 index 00000000..9f110914 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/content-type/package.json @@ -0,0 +1,70 @@ +{ + "name": "content-type", + "description": "Create and parse HTTP Content-Type header", + "version": "1.0.2", + "author": { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + "license": "MIT", + "keywords": [ + "content-type", + "http", + "req", + "res", + "rfc7231" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/jshttp/content-type.git" + }, + "devDependencies": { + "istanbul": "0.4.3", + "mocha": "~1.21.5" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "README.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "test": "mocha --reporter spec --check-leaks --bail test/", + "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/" + }, + "gitHead": "8118763adfbbac80cf1254191889330aec8b8be7", + "bugs": { + "url": "https://github.com/jshttp/content-type/issues" + }, + "homepage": "https://github.com/jshttp/content-type#readme", + "_id": "content-type@1.0.2", + "_shasum": "b7d113aee7a8dd27bd21133c4dc2529df1721eed", + "_from": "content-type@>=1.0.2 <1.1.0", + "_npmVersion": "2.15.1", + "_nodeVersion": "4.4.3", + "_npmUser": { + "name": "dougwilson", + "email": "doug@somethingdoug.com" + }, + "dist": { + "shasum": "b7d113aee7a8dd27bd21133c4dc2529df1721eed", + "tarball": "https://registry.npmjs.org/content-type/-/content-type-1.0.2.tgz" + }, + "maintainers": [ + { + "name": "dougwilson", + "email": "doug@somethingdoug.com" + } + ], + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/content-type-1.0.2.tgz_1462852785748_0.5491233412176371" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/.jshintrc b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/.jshintrc new file mode 100644 index 00000000..299877f2 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/.jshintrc @@ -0,0 +1,3 @@ +{ + "laxbreak": true +} diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/.npmignore b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/.npmignore new file mode 100644 index 00000000..7e6163db --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/.npmignore @@ -0,0 +1,6 @@ +support +test +examples +example +*.sock +dist diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/History.md b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/History.md new file mode 100644 index 00000000..854c9711 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/History.md @@ -0,0 +1,195 @@ + +2.2.0 / 2015-05-09 +================== + + * package: update "ms" to v0.7.1 (#202, @dougwilson) + * README: add logging to file example (#193, @DanielOchoa) + * README: fixed a typo (#191, @amir-s) + * browser: expose `storage` (#190, @stephenmathieson) + * Makefile: add a `distclean` target (#189, @stephenmathieson) + +2.1.3 / 2015-03-13 +================== + + * Updated stdout/stderr example (#186) + * Updated example/stdout.js to match debug current behaviour + * Renamed example/stderr.js to stdout.js + * Update Readme.md (#184) + * replace high intensity foreground color for bold (#182, #183) + +2.1.2 / 2015-03-01 +================== + + * dist: recompile + * update "ms" to v0.7.0 + * package: update "browserify" to v9.0.3 + * component: fix "ms.js" repo location + * changed bower package name + * updated documentation about using debug in a browser + * fix: security error on safari (#167, #168, @yields) + +2.1.1 / 2014-12-29 +================== + + * browser: use `typeof` to check for `console` existence + * browser: check for `console.log` truthiness (fix IE 8/9) + * browser: add support for Chrome apps + * Readme: added Windows usage remarks + * Add `bower.json` to properly support bower install + +2.1.0 / 2014-10-15 +================== + + * node: implement `DEBUG_FD` env variable support + * package: update "browserify" to v6.1.0 + * package: add "license" field to package.json (#135, @panuhorsmalahti) + +2.0.0 / 2014-09-01 +================== + + * package: update "browserify" to v5.11.0 + * node: use stderr rather than stdout for logging (#29, @stephenmathieson) + +1.0.4 / 2014-07-15 +================== + + * dist: recompile + * example: remove `console.info()` log usage + * example: add "Content-Type" UTF-8 header to browser example + * browser: place %c marker after the space character + * browser: reset the "content" color via `color: inherit` + * browser: add colors support for Firefox >= v31 + * debug: prefer an instance `log()` function over the global one (#119) + * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) + +1.0.3 / 2014-07-09 +================== + + * Add support for multiple wildcards in namespaces (#122, @seegno) + * browser: fix lint + +1.0.2 / 2014-06-10 +================== + + * browser: update color palette (#113, @gscottolson) + * common: make console logging function configurable (#108, @timoxley) + * node: fix %o colors on old node <= 0.8.x + * Makefile: find node path using shell/which (#109, @timoxley) + +1.0.1 / 2014-06-06 +================== + + * browser: use `removeItem()` to clear localStorage + * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) + * package: add "contributors" section + * node: fix comment typo + * README: list authors + +1.0.0 / 2014-06-04 +================== + + * make ms diff be global, not be scope + * debug: ignore empty strings in enable() + * node: make DEBUG_COLORS able to disable coloring + * *: export the `colors` array + * npmignore: don't publish the `dist` dir + * Makefile: refactor to use browserify + * package: add "browserify" as a dev dependency + * Readme: add Web Inspector Colors section + * node: reset terminal color for the debug content + * node: map "%o" to `util.inspect()` + * browser: map "%j" to `JSON.stringify()` + * debug: add custom "formatters" + * debug: use "ms" module for humanizing the diff + * Readme: add "bash" syntax highlighting + * browser: add Firebug color support + * browser: add colors for WebKit browsers + * node: apply log to `console` + * rewrite: abstract common logic for Node & browsers + * add .jshintrc file + +0.8.1 / 2014-04-14 +================== + + * package: re-add the "component" section + +0.8.0 / 2014-03-30 +================== + + * add `enable()` method for nodejs. Closes #27 + * change from stderr to stdout + * remove unnecessary index.js file + +0.7.4 / 2013-11-13 +================== + + * remove "browserify" key from package.json (fixes something in browserify) + +0.7.3 / 2013-10-30 +================== + + * fix: catch localStorage security error when cookies are blocked (Chrome) + * add debug(err) support. Closes #46 + * add .browser prop to package.json. Closes #42 + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/Makefile b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/Makefile new file mode 100644 index 00000000..5cf4a596 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/Makefile @@ -0,0 +1,36 @@ + +# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 +THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) + +# BIN directory +BIN := $(THIS_DIR)/node_modules/.bin + +# applications +NODE ?= $(shell which node) +NPM ?= $(NODE) $(shell which npm) +BROWSERIFY ?= $(NODE) $(BIN)/browserify + +all: dist/debug.js + +install: node_modules + +clean: + @rm -rf dist + +dist: + @mkdir -p $@ + +dist/debug.js: node_modules browser.js debug.js dist + @$(BROWSERIFY) \ + --standalone debug \ + . > $@ + +distclean: clean + @rm -rf node_modules + +node_modules: package.json + @NODE_ENV= $(NPM) install + @touch node_modules + +.PHONY: all install clean distclean diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/Readme.md b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/Readme.md new file mode 100644 index 00000000..b4f45e3c --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/Readme.md @@ -0,0 +1,188 @@ +# debug + + tiny node.js debugging utility modelled after node core's debugging technique. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + + With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. + +Example _app.js_: + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %s', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example _worker.js_: + +```js +var debug = require('debug')('worker'); + +setInterval(function(){ + debug('doing some work'); +}, 1000); +``` + + The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: + + ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) + + ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) + +#### Windows note + + On Windows the environment variable is set using the `set` command. + + ```cmd + set DEBUG=*,-not_this + ``` + +Then, run the program to be debugged as usual. + +## Millisecond diff + + When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) + + When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: + + ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) + +## Conventions + + If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". + +## Wildcards + + The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + + You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". + +## Browser support + + Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. Somewhere in the code on your page, include: + +```js +window.myDebug = require("debug"); +``` + + ("debug" is a global object in the browser so we give this object a different name.) When your page is open in the browser, type the following in the console: + +```js +myDebug.enable("worker:*") +``` + + Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + +#### Web Inspector Colors + + Colors are also enabled on "Web Inspectors" that understand the `%c` formatting + option. These are WebKit web inspectors, Firefox ([since version + 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) + and the Firebug plugin for Firefox (any version). + + Colored output looks something like: + + ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png) + +### stderr vs stdout + +You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally: + +Example _stdout.js_: + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +### Save debug output to a file + +You can save all debug statements to a file by piping them. + +Example: + +```bash +$ DEBUG_FD=3 node your-app.js 3> whatever.log +``` + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + +## License + +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/bower.json b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/bower.json new file mode 100644 index 00000000..6af573ff --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/bower.json @@ -0,0 +1,28 @@ +{ + "name": "visionmedia-debug", + "main": "dist/debug.js", + "version": "2.2.0", + "homepage": "https://github.com/visionmedia/debug", + "authors": [ + "TJ Holowaychuk <tj@vision-media.ca>" + ], + "description": "visionmedia-debug", + "moduleType": [ + "amd", + "es6", + "globals", + "node" + ], + "keywords": [ + "visionmedia", + "debug" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/browser.js b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/browser.js new file mode 100644 index 00000000..7c764522 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/browser.js @@ -0,0 +1,168 @@ + +/** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + +/** + * Colors. + */ + +exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +function useColors() { + // is webkit? http://stackoverflow.com/a/16459606/376773 + return ('WebkitAppearance' in document.documentElement.style) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (window.console && (console.firebug || (console.exception && console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); +} + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +exports.formatters.j = function(v) { + return JSON.stringify(v); +}; + + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return args; + + var c = 'color: ' + this.color; + args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + return args; +} + +/** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + +function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage(){ + try { + return window.localStorage; + } catch (e) {} +} diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/component.json b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/component.json new file mode 100644 index 00000000..ca106372 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/component.json @@ -0,0 +1,19 @@ +{ + "name": "debug", + "repo": "visionmedia/debug", + "description": "small debugging utility", + "version": "2.2.0", + "keywords": [ + "debug", + "log", + "debugger" + ], + "main": "browser.js", + "scripts": [ + "browser.js", + "debug.js" + ], + "dependencies": { + "rauchg/ms.js": "0.7.1" + } +} diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/debug.js b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/debug.js new file mode 100644 index 00000000..7571a860 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/debug.js @@ -0,0 +1,197 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = debug; +exports.coerce = coerce; +exports.disable = disable; +exports.enable = enable; +exports.enabled = enabled; +exports.humanize = require('ms'); + +/** + * The currently active debug mode names, and names to skip. + */ + +exports.names = []; +exports.skips = []; + +/** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ + +exports.formatters = {}; + +/** + * Previously assigned color. + */ + +var prevColor = 0; + +/** + * Previous log timestamp. + */ + +var prevTime; + +/** + * Select a color. + * + * @return {Number} + * @api private + */ + +function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; +} + +/** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + +function debug(namespace) { + + // define the `disabled` version + function disabled() { + } + disabled.enabled = false; + + // define the `enabled` version + function enabled() { + + var self = enabled; + + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + // add the `color` if not set + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + + var args = Array.prototype.slice.call(arguments); + + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + enabled.enabled = true; + + var fn = exports.enabled(namespace) ? enabled : disabled; + + fn.namespace = namespace; + + return fn; +} + +/** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + +function enable(namespaces) { + exports.save(namespaces); + + var split = (namespaces || '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } +} + +/** + * Disable debug output. + * + * @api public + */ + +function disable() { + exports.enable(''); +} + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; +} + +/** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + +function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; +} diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/node.js b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/node.js new file mode 100644 index 00000000..1d392a81 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/node.js @@ -0,0 +1,209 @@ + +/** + * Module dependencies. + */ + +var tty = require('tty'); +var util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + +exports = module.exports = require('./debug'); +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +/** + * The file descriptor to write the `debug()` calls to. + * Set the `DEBUG_FD` env variable to override with another value. i.e.: + * + * $ DEBUG_FD=3 node script.js 3>debug.log + */ + +var fd = parseInt(process.env.DEBUG_FD, 10) || 2; +var stream = 1 === fd ? process.stdout : + 2 === fd ? process.stderr : + createWritableStdioStream(fd); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase(); + if (0 === debugColors.length) { + return tty.isatty(fd); + } else { + return '0' !== debugColors + && 'no' !== debugColors + && 'false' !== debugColors + && 'disabled' !== debugColors; + } +} + +/** + * Map %o to `util.inspect()`, since Node doesn't do that out of the box. + */ + +var inspect = (4 === util.inspect.length ? + // node <= 0.8.x + function (v, colors) { + return util.inspect(v, void 0, void 0, colors); + } : + // node > 0.8.x + function (v, colors) { + return util.inspect(v, { colors: colors }); + } +); + +exports.formatters.o = function(v) { + return inspect(v, this.useColors) + .replace(/\s*\n\s*/g, ' '); +}; + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs() { + var args = arguments; + var useColors = this.useColors; + var name = this.namespace; + + if (useColors) { + var c = this.color; + + args[0] = ' \u001b[3' + c + ';1m' + name + ' ' + + '\u001b[0m' + + args[0] + '\u001b[3' + c + 'm' + + ' +' + exports.humanize(this.diff) + '\u001b[0m'; + } else { + args[0] = new Date().toUTCString() + + ' ' + name + ' ' + args[0]; + } + return args; +} + +/** + * Invokes `console.error()` with the specified arguments. + */ + +function log() { + return stream.write(util.format.apply(this, arguments) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + if (null == namespaces) { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } else { + process.env.DEBUG = namespaces; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Copied from `node/src/node.js`. + * + * XXX: It's lame that node doesn't expose this API out-of-the-box. It also + * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. + */ + +function createWritableStdioStream (fd) { + var stream; + var tty_wrap = process.binding('tty_wrap'); + + // Note stream._type is used for test-module-load-list.js + + switch (tty_wrap.guessHandleType(fd)) { + case 'TTY': + stream = new tty.WriteStream(fd); + stream._type = 'tty'; + + // Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + case 'FILE': + var fs = require('fs'); + stream = new fs.SyncWriteStream(fd, { autoClose: false }); + stream._type = 'fs'; + break; + + case 'PIPE': + case 'TCP': + var net = require('net'); + stream = new net.Socket({ + fd: fd, + readable: false, + writable: true + }); + + // FIXME Should probably have an option in net.Socket to create a + // stream from an existing fd which is writable only. But for now + // we'll just add this hack and set the `readable` member to false. + // Test: ./node test/fixtures/echo.js < /etc/passwd + stream.readable = false; + stream.read = null; + stream._type = 'pipe'; + + // FIXME Hack to have stream not keep the event loop alive. + // See https://github.com/joyent/node/issues/1726 + if (stream._handle && stream._handle.unref) { + stream._handle.unref(); + } + break; + + default: + // Probably an error on in uv_guess_handle() + throw new Error('Implement me. Unknown stream file type!'); + } + + // For supporting legacy API we put the FD here. + stream.fd = fd; + + stream._isStdio = true; + + return stream; +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/node_modules/ms/.npmignore b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/node_modules/ms/.npmignore new file mode 100644 index 00000000..d1aa0ce4 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/node_modules/ms/.npmignore @@ -0,0 +1,5 @@ +node_modules +test +History.md +Makefile +component.json diff --git a/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/node_modules/ms/History.md b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/node_modules/ms/History.md new file mode 100644 index 00000000..32fdfc17 --- /dev/null +++ b/common/src/main/webapp/usage guide/appserver/node_modules/body-parser/node_modules/debug/node_modules/ms/History.md @@ -0,0 +1,66 @@ + +0.7.1 / 2015-04-20 +================== + + * prevent extraordinary long inputs (@evilpacket) + * Fixed broken readme link + +0.7.0 / 2014-11-24 +================== + + * add time abbreviations, updated tests and readme for the new units + * fix example in the readme. + * add LICENSE file + +0.6.2 / 2013-12-05 +================== + + * Adding repository section to package.json to suppress warning from NPM. + +0.6.1 / 2013-05-10 +================== + + * fix singularization [visionmedia] + +0.6.0 / 2013-03-15 +================== + + * fix minutes + +0.5.1 / 2013-02-24 +================== + + * add component namespace + +0.5.0 / 2012-11-09 +================== + + * add short formatting as default and .long option + * add .license property to component.json + * add version to component.json + +0.4.0 / 2012-10-22 +================== + + * add rounding to fix crazy decimals + +0.3.0 / 2012-09-07 +================== + + * fix `ms(<String>)` [visionmedia] + +0.2.0 / 2012-09-03 +================== + + * add component.json [visionmedia] + * add days support [visionmedia] + * add hours support [visionmedia] + * add minutes support [visionmedia] + * add seconds support [visionmedia] + * add ms string support [visionmedia] + * refactor tests to facilitate ms(number) [visionmedia] + +0.1.0 / 2012-03-07 +================== + + * Initial release |