From 8c82c0ffa59a1d045b25d596a99270c28d6b082b Mon Sep 17 00:00:00 2001 From: Russell Mays Date: Mon, 4 Aug 2014 12:39:38 -0700 Subject: [PATCH 01/44] refactoring layout --- app.js | 5 +---- views/layout.jade | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/app.js b/app.js index e2ae173..8ea45b1 100644 --- a/app.js +++ b/app.js @@ -34,14 +34,11 @@ if ('development' == app.get('env')) { app.get('/', routes.index(Recipe)); app.post('/versioner', routes.versioner(Recipe)); -app.get('/modify', routes.modify(Recipe)); +app.get('/dev', routes.modify(Recipe)); app.post('/hierarchy', routes.hierarchy(Recipe)); app.post('/tabler', routes.tabler(Recipe)); app.post('/commit', routes.commit(Recipe)); -app.get('/create', routes.create(Recipe)); -app.post('/create', routes.createRecipe(Recipe)); - app.post('/download', routes.downloadRecipe(Recipe)); http.createServer(app).listen(app.get('port'), function(){ diff --git a/views/layout.jade b/views/layout.jade index 30a11da..b700f96 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -23,8 +23,6 @@ html div(style="float:left", align="center") a(href="/") Cool Image for Recipe View Link div(style="float:right", align="center") - a(href="/create") Cool Image for Recipe Create Link - div(style="float:none", align="center") - a(href="/modify") Cool Image for Recipe Modify Link + a(href="/dev") Cool Image for Recipe Create Link block content From ddd388cec9ad62d9bff5074a6623e764e0b1dab4 Mon Sep 17 00:00:00 2001 From: Russell Mays Date: Mon, 4 Aug 2014 14:57:46 -0700 Subject: [PATCH 02/44] transitioning to dev setup --- app.js | 2 +- public/javascripts/{modify.js => dev.js} | 0 public/javascripts/tabler.js | 22 +++++--------- routes/index.js | 4 +-- views/create.jade | 38 ------------------------ views/{modify.jade => dev.jade} | 2 +- 6 files changed, 12 insertions(+), 56 deletions(-) rename public/javascripts/{modify.js => dev.js} (100%) delete mode 100644 views/create.jade rename views/{modify.jade => dev.jade} (95%) diff --git a/app.js b/app.js index cea1d19..ecbd87a 100644 --- a/app.js +++ b/app.js @@ -33,7 +33,7 @@ if ('development' == app.get('env')) { app.get('/', routes.index(Recipe)); app.post('/versioner', routes.versioner(Recipe)); -app.get('/dev', routes.modify(Recipe)); +app.get('/dev', routes.dev(Recipe)); app.post('/hierarchy', routes.hierarchy(Recipe)); app.post('/tabler', routes.tabler(Recipe)); app.post('/commit', routes.commit(Recipe)); diff --git a/public/javascripts/modify.js b/public/javascripts/dev.js similarity index 100% rename from public/javascripts/modify.js rename to public/javascripts/dev.js diff --git a/public/javascripts/tabler.js b/public/javascripts/tabler.js index 1c7a3ce..edc809b 100644 --- a/public/javascripts/tabler.js +++ b/public/javascripts/tabler.js @@ -8,24 +8,20 @@ $.post('/tabler', {'recipename': recipeName, 'recipevers': recipeVersion}, funct var tableVersion = data['recipeIdentifier'].split('-')[1].split('_').join('.'); $('#recTableHeader').append('

'+tableName+'

'); - var recTable = ''; - var recLabels = ''; - var recValues = ''; var newTableVersion = tableVersion.split('.'); newTableVersion[2] = 'X'; - var dyValues = ''; - + var recTable = '
Version
'+tableVersion+'
'+newTableVersion.join('.')+'
'; + + $.each(Object.keys(data['recipeOptions']), function(i, val) { - recLabels = recLabels + ''; - recValues = recValues + ''; - dyValues = dyValues + ''; + recTable = recTable + ''; }); - recTable = recTable + recLabels + '' + recValues + '' + dyValues + '
Version'+tableVersion+''+newTableVersion.join('.')+'
'+ val + '' + data['recipeOptions'][val] + '
'+val+''+data['recipeOptions'][val]+'
'; + recTable = recTable + '

'; - $('#recipeForm').append(recTable+'

'); + $('#recipeForm').append(recTable); $('#recipeForm').append('

'); $('#submitter').click(function() { @@ -34,10 +30,8 @@ $.post('/tabler', {'recipename': recipeName, 'recipevers': recipeVersion}, funct var recOptions = {}; var optionLabels = []; - $('#'+recName+'-referencelabels').children().each(function(index) { - if (index != 0) { - optionLabels.push($(this).html()); - } + $('#'+recName+'-tableLabels').each(function(index) { + optionLabels.push($(this).html()); }); var edited = false; diff --git a/routes/index.js b/routes/index.js index 4c265be..27b5da0 100644 --- a/routes/index.js +++ b/routes/index.js @@ -20,11 +20,11 @@ exports.versioner = function(recipeModel) { }; }; -exports.modify = function(recipeModel) { +exports.dev = function(recipeModel) { return function(req, res) { recipeModel.find(function(e, recipes) { var recNames = helpers.getDocNames(recipes); - res.render('modify', {'title': 'Modify Recipe', 'recNames': recNames}); + res.render('dev', {'title': 'Modify Recipe', 'recNames': recNames}); }); }; }; diff --git a/views/create.jade b/views/create.jade deleted file mode 100644 index 882575b..0000000 --- a/views/create.jade +++ /dev/null @@ -1,38 +0,0 @@ -extends layout - -block subhead - script(src="javascripts/jquery-2.1.1.js") - script. - var recNames = !{JSON.stringify(recNames)} - script(src="javascripts/create.js") - -block content - div(id="createInterface", align="middle") - form(id="createForm", cation="/create", method="post") - h2 Create New Cellpack Recipe   - h3 Recipe Name - input(type="text", name="recname") - br - br - br - div(id="recOptions", style="float:left;width:48%") - h3 Recipe Options - h4 Option Label   Option Value - div(id="recOptionFields") - input(type="text", class="optionLabs", name="optionLab") - input(type="text", class="optionVals", name="optionVal") - br - br - button(type="button", id="recOptioner") Add More Recipe Options - div(id="recChildren", style="float:right;width:48%") - h3 Recipe Children - h4(id="childrenHeader") Recipe Child   Child Version - div(id="recChildrenFields") - br - br - button(type="button", id="recChilder") Add Recipe Children - div(id="formFooter", align="middle", style="clear:both") - br - br - br - button(type="submit") Create New Recipe diff --git a/views/modify.jade b/views/dev.jade similarity index 95% rename from views/modify.jade rename to views/dev.jade index 87fa4fa..8934694 100644 --- a/views/modify.jade +++ b/views/dev.jade @@ -3,7 +3,7 @@ extends layout block subhead script(src="javascripts/jquery-2.1.1.js") script(src="javascripts/versioner.js") - script(src="javascripts/modify.js") + script(src="javascripts/dev.js") block content div(id="interface", align="middle") From 0ec5f009f067f70cf82a307917cb533f39f352d7 Mon Sep 17 00:00:00 2001 From: Russell Mays Date: Mon, 4 Aug 2014 16:32:34 -0700 Subject: [PATCH 03/44] vertical modify display works --- public/javascripts/tabler.js | 16 ++++++++-------- routes/index.js | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/public/javascripts/tabler.js b/public/javascripts/tabler.js index edc809b..815afde 100644 --- a/public/javascripts/tabler.js +++ b/public/javascripts/tabler.js @@ -11,12 +11,12 @@ $.post('/tabler', {'recipename': recipeName, 'recipevers': recipeVersion}, funct var newTableVersion = tableVersion.split('.'); newTableVersion[2] = 'X'; - var recTable = ''; + var recTable = '
Version'+tableVersion+''+newTableVersion.join('.')+'
'; $.each(Object.keys(data['recipeOptions']), function(i, val) { - recTable = recTable + ''; + recTable = recTable + ''; }); recTable = recTable + '
Version'+tableVersion+''+newTableVersion.join('.')+'
'+val+''+data['recipeOptions'][val]+'
'+val+''+data['recipeOptions'][val]+'


'; @@ -30,21 +30,21 @@ $.post('/tabler', {'recipename': recipeName, 'recipevers': recipeVersion}, funct var recOptions = {}; var optionLabels = []; - $('#'+recName+'-tableLabels').each(function(index) { + $('.'+recName+'-tableLabels').each(function(index) { optionLabels.push($(this).html()); }); - + var edited = false; var optionValues = []; - $('#'+recName+'-dynamicvalues').children().each(function(index) { + $('.'+recName+'-tableVals').each(function(index) { if (index == 0) { recVersion = $(this).html(); } else { - if ($(this).children().val() != '') { + if ($(this).val() != '') { edited = true; - optionValues.push($(this).children().val()); + optionValues.push($(this).val()); } else { - optionValues.push($(this).children().attr('placeholder')); + optionValues.push($(this).attr('placeholder')); } } }); diff --git a/routes/index.js b/routes/index.js index 27b5da0..45eabed 100644 --- a/routes/index.js +++ b/routes/index.js @@ -51,7 +51,7 @@ exports.tabler = function(recipeModel) { exports.commit = function(recipeModel) { return function(req, res) { recipeModel.find({}, function(e, recipes) { - + console.log(req.body); var nextVersion = helpers.getLastVersion(recipes, req.body['newRecipe']['recipeIdentifier']); var newRecipes = [{'recipeIdentifier': nextVersion, 'recipeOptions': req.body['newRecipe']['recipeOptions']}]; newRecipes[0]['recipeChildren'] = helpers.getChildrenList(recipes, req.body['derivedIdentifier']); From 32c7ad587e9aaf56af80d855a0b6f496741f3e73 Mon Sep 17 00:00:00 2001 From: Russell Mays Date: Tue, 5 Aug 2014 11:31:43 -0700 Subject: [PATCH 04/44] coloring and modifying --- public/javascripts/dev.js | 11 +++++++++++ public/javascripts/linker.js | 2 ++ views/dev.jade | 19 ++++++++++++------- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/public/javascripts/dev.js b/public/javascripts/dev.js index 0d96f0d..dc3e7e3 100644 --- a/public/javascripts/dev.js +++ b/public/javascripts/dev.js @@ -1,4 +1,5 @@ $(document).ready(function() { + $('#createChild').hide(); $('#loader').click(function() { window.recipeName = $('select.recn').val(); window.recipeVersion = $('select.recv').val(); @@ -7,8 +8,18 @@ $(document).ready(function() { $.each(data, function(i, val) { $('#recipeList').append('
'); }); + $('.sideLink').first().css('background-color', 'blue'); + $('#createChild').show(); }); $.getScript('javascripts/tabler.js'); $.getScript('javascripts/linker.js'); }); + + $('#createChild').click(function() { + alert('Adding Child!'); + }); + + $('#childer').click(function() { + alert('Childer Pressed'); + }); }); diff --git a/public/javascripts/linker.js b/public/javascripts/linker.js index 1a46073..e1de9a2 100644 --- a/public/javascripts/linker.js +++ b/public/javascripts/linker.js @@ -1,5 +1,7 @@ $('.sideLink').click(function() { window.recipeName = $(this).html(); window.recipeVersion = $(this).data('vers'); + $('.sideLink').not($(this)).css('background-color', 'white'); + $(this).css('background-color', 'blue'); $.getScript('javascripts/tabler.js'); }); diff --git a/views/dev.jade b/views/dev.jade index 8934694..f2e6a67 100644 --- a/views/dev.jade +++ b/views/dev.jade @@ -7,17 +7,22 @@ block subhead block content div(id="interface", align="middle") - h2 Load autoPACK Recipe Table   - select(name='recname', class='recn') - each rn, index in recNames - option(value=rn)= rn - select(name='recversion', class="recv") - button(id="loader", type="button") Load Table + h2 Create version of recipe   + select(name='recname', class='recn') + each rn, index in recNames + option(value=rn)= rn + select(name='recversion', class="recv") + button(id="loader", type="button") Load + h2 Create recipe from scratch   + button(id="childer", type="button") Create br br div(id="editInterface" style="height:400px") div(id="recipeTree", style="float:left") - ul(id="recipeList") + div(id="recipeHierarchy") + ul(id="recipeList") + div(id="hierarchyControl", align="middle") + button(id="createChild", type="button") Add Child div(id="tableInterface", style="float:right") div(id="recTableHeader", align="middle") div(id="recipeTable", align="middle") From 6e03120c1192beb8df6735707cc3c35df426fcc4 Mon Sep 17 00:00:00 2001 From: Russell Mays Date: Wed, 6 Aug 2014 12:20:12 -0700 Subject: [PATCH 05/44] hierarchy works --- app.js | 1 + node_modules/utils/index.js | 3 ++- public/javascripts/dev.js | 34 +++++++++++++++++++++++++++++----- routes/index.js | 4 ++++ views/dev.jade | 1 - views/layout.jade | 4 ++-- 6 files changed, 38 insertions(+), 9 deletions(-) diff --git a/app.js b/app.js index ecbd87a..d4593f6 100644 --- a/app.js +++ b/app.js @@ -37,6 +37,7 @@ app.get('/dev', routes.dev(Recipe)); app.post('/hierarchy', routes.hierarchy(Recipe)); app.post('/tabler', routes.tabler(Recipe)); app.post('/commit', routes.commit(Recipe)); +app.post('/create', routes.create(Recipe)); app.post('/download', routes.downloadRecipe(Recipe)); diff --git a/node_modules/utils/index.js b/node_modules/utils/index.js index 98397ca..35afc75 100644 --- a/node_modules/utils/index.js +++ b/node_modules/utils/index.js @@ -74,7 +74,8 @@ buildIDTree = function(docs, arr) { exports.getIdentifierTree = function(docs, identifier) { var idList = getIdentifierList(docs, identifier); buildIDTree(docs, idList); - return undersc.flatten(idList); + // unflatten here + return idList; } buildTrain = function(docs, topLevel, candidates, pathArray) { diff --git a/public/javascripts/dev.js b/public/javascripts/dev.js index dc3e7e3..312aaa7 100644 --- a/public/javascripts/dev.js +++ b/public/javascripts/dev.js @@ -3,11 +3,27 @@ $(document).ready(function() { $('#loader').click(function() { window.recipeName = $('select.recn').val(); window.recipeVersion = $('select.recv').val(); - $('#recipeList').empty(); + $('#recipeHierarchy').empty(); $.post('/hierarchy', {'recipename': recipeName, 'recipevers': recipeVersion}, function(data) { - $.each(data, function(i, val) { - $('#recipeList').append('
'); - }); + var hs = ''; + var makeHierarchy = function(hierarchArray) { + if (hierarchArray instanceof Array) { + hs = hs + '
    '; + for (var i = 0; i < hierarchArray.length; i++) { + makeHierarchy(hierarchArray[i]); + } + hs = hs + '
'; + } else { + if (hs.substring(hs.length-9) == '') { + hs = hs + ''; + } + hs = hs + '
  • '; + } + } + + makeHierarchy(data); + alert(hs); + $('#recipeHierarchy').append(hs+'

    '); $('.sideLink').first().css('background-color', 'blue'); $('#createChild').show(); }); @@ -16,7 +32,15 @@ $(document).ready(function() { }); $('#createChild').click(function() { - alert('Adding Child!'); + var newName = prompt("Please enter the new recipe name!"); + + var selected = $('.sideLink').filter(function() { + return $(this).css('background-color') == 'rgb(0, 0, 255)'; + }); + + $.post('/create', {'recipename': selected.html(), 'recipevers': selected.data('vers'), 'topLevel': $('.sideLink').first().html()}, function(data) { + alert(data); + }); }); $('#childer').click(function() { diff --git a/routes/index.js b/routes/index.js index 45eabed..e72f4e3 100644 --- a/routes/index.js +++ b/routes/index.js @@ -66,10 +66,14 @@ exports.commit = function(recipeModel) { exports.create = function(recipeModel) { return function(req, res) { + console.log(req.body); + /* recipeModel.find(function(e, recipes) { var recNames = helpers.getDocNames(recipes); res.render('create', {'title': 'Create New Recipe', 'recNames': recNames}); }); + */ + res.send('Success!'); }; }; diff --git a/views/dev.jade b/views/dev.jade index f2e6a67..1580251 100644 --- a/views/dev.jade +++ b/views/dev.jade @@ -20,7 +20,6 @@ block content div(id="editInterface" style="height:400px") div(id="recipeTree", style="float:left") div(id="recipeHierarchy") - ul(id="recipeList") div(id="hierarchyControl", align="middle") button(id="createChild", type="button") Add Child div(id="tableInterface", style="float:right") diff --git a/views/layout.jade b/views/layout.jade index b700f96..aa8e748 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -21,8 +21,8 @@ html div(id="links", style="height:50px") div(style="float:left", align="center") - a(href="/") Cool Image for Recipe View Link + a(href="/") Recipe Download div(style="float:right", align="center") - a(href="/dev") Cool Image for Recipe Create Link + a(href="/dev") Recipe Development block content From 63a134a79dcc994fd2cdfe2a99d05426d9215387 Mon Sep 17 00:00:00 2001 From: Russell Mays Date: Fri, 8 Aug 2014 11:52:18 -0700 Subject: [PATCH 06/44] working on session editing --- app.js | 10 +- node_modules/express-session/.npmignore | 3 + node_modules/express-session/History.md | 152 +++++ node_modules/express-session/LICENSE | 22 + node_modules/express-session/README.md | 202 +++++++ node_modules/express-session/index.js | 491 +++++++++++++++++ .../node_modules/buffer-crc32/.npmignore | 1 + .../node_modules/buffer-crc32/.travis.yml | 8 + .../node_modules/buffer-crc32/LICENSE | 17 + .../node_modules/buffer-crc32/README.md | 47 ++ .../node_modules/buffer-crc32/index.js | 91 +++ .../node_modules/buffer-crc32/package.json | 43 ++ .../buffer-crc32/tests/crc.test.js | 89 +++ .../node_modules/cookie-signature/.npmignore | 4 + .../node_modules/cookie-signature/History.md | 27 + .../node_modules/cookie-signature/Makefile | 7 + .../node_modules/cookie-signature/Readme.md | 42 ++ .../node_modules/cookie-signature/index.js | 51 ++ .../cookie-signature/package.json | 36 ++ .../node_modules/cookie/.npmignore | 2 + .../node_modules/cookie/LICENSE | 9 + .../node_modules/cookie/README.md | 44 ++ .../node_modules/cookie/index.js | 75 +++ .../node_modules/cookie/package.json | 41 ++ .../node_modules/debug/.jshintrc | 3 + .../node_modules/debug/.npmignore | 6 + .../node_modules/debug/History.md | 144 +++++ .../node_modules/debug/Makefile | 33 ++ .../node_modules/debug/Readme.md | 156 ++++++ .../node_modules/debug/browser.js | 147 +++++ .../node_modules/debug/component.json | 19 + .../node_modules/debug/debug.js | 197 +++++++ .../node_modules/debug/node.js | 129 +++++ .../debug/node_modules/ms/.npmignore | 5 + .../debug/node_modules/ms/README.md | 33 ++ .../debug/node_modules/ms/index.js | 111 ++++ .../debug/node_modules/ms/package.json | 32 ++ .../node_modules/debug/package.json | 52 ++ .../node_modules/depd/.npmignore | 4 + .../node_modules/depd/History.md | 56 ++ .../express-session/node_modules/depd/LICENSE | 22 + .../node_modules/depd/Readme.md | 272 +++++++++ .../node_modules/depd/index.js | 520 ++++++++++++++++++ .../node_modules/depd/package.json | 43 ++ .../node_modules/on-headers/.npmignore | 2 + .../node_modules/on-headers/History.md | 4 + .../node_modules/on-headers/LICENSE | 22 + .../node_modules/on-headers/README.md | 70 +++ .../node_modules/on-headers/index.js | 72 +++ .../node_modules/on-headers/package.json | 43 ++ .../node_modules/uid-safe/.npmignore | 2 + .../node_modules/uid-safe/LICENSE | 22 + .../node_modules/uid-safe/README.md | 44 ++ .../node_modules/uid-safe/index.js | 27 + .../node_modules/base64-url/.npmignore | 12 + .../node_modules/base64-url/.travis.yml | 12 + .../uid-safe/node_modules/base64-url/LICENSE | 15 + .../node_modules/base64-url/README.md | 27 + .../uid-safe/node_modules/base64-url/index.js | 17 + .../node_modules/base64-url/package.json | 39 ++ .../node_modules/base64-url/test/index.js | 24 + .../uid-safe/node_modules/mz/.npmignore | 1 + .../uid-safe/node_modules/mz/.travis.yml | 5 + .../uid-safe/node_modules/mz/HISTORY.md | 6 + .../uid-safe/node_modules/mz/LICENSE | 22 + .../uid-safe/node_modules/mz/README.md | 89 +++ .../uid-safe/node_modules/mz/_promisify.js | 54 ++ .../node_modules/mz/_promisify_all.js | 24 + .../uid-safe/node_modules/mz/child_process.js | 8 + .../uid-safe/node_modules/mz/crypto.js | 9 + .../uid-safe/node_modules/mz/dns.js | 16 + .../uid-safe/node_modules/mz/fs.js | 42 ++ .../uid-safe/node_modules/mz/package.json | 34 ++ .../uid-safe/node_modules/mz/zlib.js | 13 + .../node_modules/uid-safe/package.json | 38 ++ .../node_modules/uid-safe/test.js | 46 ++ .../node_modules/utils-merge/.travis.yml | 6 + .../node_modules/utils-merge/LICENSE | 20 + .../node_modules/utils-merge/README.md | 34 ++ .../node_modules/utils-merge/index.js | 23 + .../node_modules/utils-merge/package.json | 47 ++ node_modules/express-session/package.json | 64 +++ .../express-session/session/cookie.js | 128 +++++ .../express-session/session/memory.js | 151 +++++ .../express-session/session/session.js | 116 ++++ node_modules/express-session/session/store.js | 84 +++ public/javascripts/create.js | 7 - public/javascripts/createchildren.js | 21 - public/javascripts/dev.js | 15 +- public/javascripts/linker.js | 2 +- public/javascripts/tabler.js | 6 +- routes/index.js | 76 +-- views/dev.jade | 18 +- 93 files changed, 5080 insertions(+), 97 deletions(-) create mode 100644 node_modules/express-session/.npmignore create mode 100644 node_modules/express-session/History.md create mode 100644 node_modules/express-session/LICENSE create mode 100644 node_modules/express-session/README.md create mode 100644 node_modules/express-session/index.js create mode 100644 node_modules/express-session/node_modules/buffer-crc32/.npmignore create mode 100644 node_modules/express-session/node_modules/buffer-crc32/.travis.yml create mode 100644 node_modules/express-session/node_modules/buffer-crc32/LICENSE create mode 100644 node_modules/express-session/node_modules/buffer-crc32/README.md create mode 100644 node_modules/express-session/node_modules/buffer-crc32/index.js create mode 100644 node_modules/express-session/node_modules/buffer-crc32/package.json create mode 100644 node_modules/express-session/node_modules/buffer-crc32/tests/crc.test.js create mode 100644 node_modules/express-session/node_modules/cookie-signature/.npmignore create mode 100644 node_modules/express-session/node_modules/cookie-signature/History.md create mode 100644 node_modules/express-session/node_modules/cookie-signature/Makefile create mode 100644 node_modules/express-session/node_modules/cookie-signature/Readme.md create mode 100644 node_modules/express-session/node_modules/cookie-signature/index.js create mode 100644 node_modules/express-session/node_modules/cookie-signature/package.json create mode 100644 node_modules/express-session/node_modules/cookie/.npmignore create mode 100644 node_modules/express-session/node_modules/cookie/LICENSE create mode 100644 node_modules/express-session/node_modules/cookie/README.md create mode 100644 node_modules/express-session/node_modules/cookie/index.js create mode 100644 node_modules/express-session/node_modules/cookie/package.json create mode 100644 node_modules/express-session/node_modules/debug/.jshintrc create mode 100644 node_modules/express-session/node_modules/debug/.npmignore create mode 100644 node_modules/express-session/node_modules/debug/History.md create mode 100644 node_modules/express-session/node_modules/debug/Makefile create mode 100644 node_modules/express-session/node_modules/debug/Readme.md create mode 100644 node_modules/express-session/node_modules/debug/browser.js create mode 100644 node_modules/express-session/node_modules/debug/component.json create mode 100644 node_modules/express-session/node_modules/debug/debug.js create mode 100644 node_modules/express-session/node_modules/debug/node.js create mode 100644 node_modules/express-session/node_modules/debug/node_modules/ms/.npmignore create mode 100644 node_modules/express-session/node_modules/debug/node_modules/ms/README.md create mode 100644 node_modules/express-session/node_modules/debug/node_modules/ms/index.js create mode 100644 node_modules/express-session/node_modules/debug/node_modules/ms/package.json create mode 100644 node_modules/express-session/node_modules/debug/package.json create mode 100644 node_modules/express-session/node_modules/depd/.npmignore create mode 100644 node_modules/express-session/node_modules/depd/History.md create mode 100644 node_modules/express-session/node_modules/depd/LICENSE create mode 100644 node_modules/express-session/node_modules/depd/Readme.md create mode 100644 node_modules/express-session/node_modules/depd/index.js create mode 100644 node_modules/express-session/node_modules/depd/package.json create mode 100644 node_modules/express-session/node_modules/on-headers/.npmignore create mode 100644 node_modules/express-session/node_modules/on-headers/History.md create mode 100644 node_modules/express-session/node_modules/on-headers/LICENSE create mode 100644 node_modules/express-session/node_modules/on-headers/README.md create mode 100644 node_modules/express-session/node_modules/on-headers/index.js create mode 100644 node_modules/express-session/node_modules/on-headers/package.json create mode 100644 node_modules/express-session/node_modules/uid-safe/.npmignore create mode 100644 node_modules/express-session/node_modules/uid-safe/LICENSE create mode 100644 node_modules/express-session/node_modules/uid-safe/README.md create mode 100644 node_modules/express-session/node_modules/uid-safe/index.js create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.npmignore create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.travis.yml create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/LICENSE create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/README.md create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/index.js create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/package.json create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/test/index.js create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/.npmignore create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/.travis.yml create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/HISTORY.md create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/LICENSE create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/README.md create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify.js create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify_all.js create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/child_process.js create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/crypto.js create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/dns.js create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/fs.js create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/package.json create mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/zlib.js create mode 100644 node_modules/express-session/node_modules/uid-safe/package.json create mode 100644 node_modules/express-session/node_modules/uid-safe/test.js create mode 100644 node_modules/express-session/node_modules/utils-merge/.travis.yml create mode 100644 node_modules/express-session/node_modules/utils-merge/LICENSE create mode 100644 node_modules/express-session/node_modules/utils-merge/README.md create mode 100644 node_modules/express-session/node_modules/utils-merge/index.js create mode 100644 node_modules/express-session/node_modules/utils-merge/package.json create mode 100644 node_modules/express-session/package.json create mode 100644 node_modules/express-session/session/cookie.js create mode 100644 node_modules/express-session/session/memory.js create mode 100644 node_modules/express-session/session/session.js create mode 100644 node_modules/express-session/session/store.js delete mode 100644 public/javascripts/create.js delete mode 100644 public/javascripts/createchildren.js diff --git a/app.js b/app.js index d4593f6..859b377 100644 --- a/app.js +++ b/app.js @@ -13,8 +13,15 @@ var recipeSchema = mongoose.Schema({ }, {collection: 'recipes'}); var Recipe = mongoose.model('Recipe', recipeSchema); +var session = require('express-session'); + + + var app = express(); +// Session +app.use(session({secret: '1234567890QWERTY'})); + app.set('port', process.env.PORT || 3000); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); @@ -25,6 +32,7 @@ app.use(express.methodOverride()); app.use(app.router); app.use(express.static(__dirname + '/public')); + // development only if ('development' == app.get('env')) { app.use(express.errorHandler()); @@ -36,8 +44,8 @@ app.post('/versioner', routes.versioner(Recipe)); app.get('/dev', routes.dev(Recipe)); app.post('/hierarchy', routes.hierarchy(Recipe)); app.post('/tabler', routes.tabler(Recipe)); +app.post('/save', routes.save); app.post('/commit', routes.commit(Recipe)); -app.post('/create', routes.create(Recipe)); app.post('/download', routes.downloadRecipe(Recipe)); diff --git a/node_modules/express-session/.npmignore b/node_modules/express-session/.npmignore new file mode 100644 index 0000000..cd39b77 --- /dev/null +++ b/node_modules/express-session/.npmignore @@ -0,0 +1,3 @@ +coverage/ +test/ +.travis.yml diff --git a/node_modules/express-session/History.md b/node_modules/express-session/History.md new file mode 100644 index 0000000..0bdf5cd --- /dev/null +++ b/node_modules/express-session/History.md @@ -0,0 +1,152 @@ +1.7.4 / 2014-08-05 +================== + + * Fix response end delay for non-chunked responses + +1.7.3 / 2014-08-05 +================== + + * Fix `res.end` patch to call correct upstream `res.write` + +1.7.2 / 2014-07-27 +================== + + * deps: depd@0.4.4 + - Work-around v8 generating empty stack traces + +1.7.1 / 2014-07-26 +================== + + * deps: depd@0.4.3 + - Fix exception when global `Error.stackTraceLimit` is too low + +1.7.0 / 2014-07-22 +================== + + * Improve session-ending error handling + - Errors are passed to `next(err)` instead of `console.error` + * deps: debug@1.0.4 + * deps: depd@0.4.2 + - Add `TRACE_DEPRECATION` environment variable + - Remove non-standard grey color from color output + - Support `--no-deprecation` argument + - Support `--trace-deprecation` argument + +1.6.5 / 2014-07-11 +================== + + * Do not require `req.originalUrl` + * deps: debug@1.0.3 + - Add support for multiple wildcards in namespaces + +1.6.4 / 2014-07-07 +================== + + * Fix blank responses for stores with synchronous operations + +1.6.3 / 2014-07-04 +================== + + * Fix resave deprecation message + +1.6.2 / 2014-07-04 +================== + + * Fix confusing option deprecation messages + +1.6.1 / 2014-06-28 +================== + + * Fix saveUninitialized deprecation message + +1.6.0 / 2014-06-28 +================== + + * Add deprecation message to undefined `resave` option + * Add deprecation message to undefined `saveUninitialized` option + * Fix `res.end` patch to return correct value + * Fix `res.end` patch to handle multiple `res.end` calls + * Reject cookies with missing signatures + +1.5.2 / 2014-06-26 +================== + + * deps: cookie-signature@1.0.4 + - fix for timing attacks + +1.5.1 / 2014-06-21 +================== + + * Move hard-to-track-down `req.secret` deprecation message + +1.5.0 / 2014-06-19 +================== + + * Debug name is now "express-session" + * Deprecate integration with `cookie-parser` middleware + * Deprecate looking for secret in `req.secret` + * Directly read cookies; `cookie-parser` no longer required + * Directly set cookies; `res.cookie` no longer required + * Generate session IDs with `uid-safe`, faster and even less collisions + +1.4.0 / 2014-06-17 +================== + + * Add `genid` option to generate custom session IDs + * Add `saveUninitialized` option to control saving uninitialized sessions + * Add `unset` option to control unsetting `req.session` + * Generate session IDs with `rand-token` by default; reduce collisions + * deps: buffer-crc32@0.2.3 + +1.3.1 / 2014-06-14 +================== + + * Add description in package for npmjs.org listing + +1.3.0 / 2014-06-14 +================== + + * Integrate with express "trust proxy" by default + * deps: debug@1.0.2 + +1.2.1 / 2014-05-27 +================== + + * Fix `resave` such that `resave: true` works + +1.2.0 / 2014-05-19 +================== + + * Add `resave` option to control saving unmodified sessions + +1.1.0 / 2014-05-12 +================== + + * Add `name` option; replacement for `key` option + * Use `setImmediate` in MemoryStore for node.js >= 0.10 + +1.0.4 / 2014-04-27 +================== + + * deps: debug@0.8.1 + +1.0.3 / 2014-04-19 +================== + + * Use `res.cookie()` instead of `res.setHeader()` + * deps: cookie@0.1.2 + +1.0.2 / 2014-02-23 +================== + + * Add missing dependency to `package.json` + +1.0.1 / 2014-02-15 +================== + + * Add missing dependencies to `package.json` + +1.0.0 / 2014-02-15 +================== + + * Genesis from `connect` diff --git a/node_modules/express-session/LICENSE b/node_modules/express-session/LICENSE new file mode 100644 index 0000000..a7693b0 --- /dev/null +++ b/node_modules/express-session/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014 TJ Holowaychuk + +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/node_modules/express-session/README.md b/node_modules/express-session/README.md new file mode 100644 index 0000000..dd1ba7a --- /dev/null +++ b/node_modules/express-session/README.md @@ -0,0 +1,202 @@ +# express-session + +[![NPM Version](https://badge.fury.io/js/express-session.svg)](https://badge.fury.io/js/express-session) +[![Build Status](https://travis-ci.org/expressjs/session.svg?branch=master)](https://travis-ci.org/expressjs/session) +[![Coverage Status](https://img.shields.io/coveralls/expressjs/session.svg?branch=master)](https://coveralls.io/r/expressjs/session) + +THIS REPOSITORY NEEDS A MAINTAINER. +If you are interested in maintaining this module, please start contributing by making PRs and solving / discussing unsolved issues. + +## API + +```js +var express = require('express') +var session = require('express-session') + +var app = express() + +app.use(session({secret: 'keyboard cat'})) +``` + + +### session(options) + +Setup session store with the given `options`. + +Session data is _not_ saved in the cookie itself, just the session ID. + +#### Options + + - `name` - cookie name (formerly known as `key`). (default: `'connect.sid'`) + - `store` - session store instance. + - `secret` - session cookie is signed with this secret to prevent tampering. + - `cookie` - session cookie settings. + - (default: `{ path: '/', httpOnly: true, secure: false, maxAge: null }`) + - `genid` - function to call to generate a new session ID. (default: uses `uid2` library) + - `rolling` - forces a cookie set on every response. This resets the expiration date. (default: `false`) + - `resave` - forces session to be saved even when unmodified. (default: `true`) + - `proxy` - trust the reverse proxy when setting secure cookies (via "x-forwarded-proto" header). When set to `true`, the "x-forwarded-proto" header will be used. When set to `false`, all headers are ignored. When left unset, will use the "trust proxy" setting from express. (default: `undefined`) + - `saveUninitialized` - forces a session that is "uninitialized" to be saved to the store. A session is uninitialized when it is new but not modified. This is useful for implementing login sessions, reducing server storage usage, or complying with laws that require permission before setting a cookie. (default: `true`) + - `unset` - controls result of unsetting `req.session` (through `delete`, setting to `null`, etc.). This can be "keep" to keep the session in the store but ignore modifications or "destroy" to destroy the stored session. (default: `'keep'`) + +#### options.genid + +Generate a custom session ID for new sessions. Provide a function that returns a string that will be used as a session ID. The function is given `req` as the first argument if you want to use some value attached to `req` when generating the ID. + +**NOTE** be careful you generate unique IDs so your sessions do not conflict. + +```js +app.use(session({ + genid: function(req) { + return genuuid(); // use UUIDs for session IDs + }, + secret: 'keyboard cat' +})) +``` + +#### Cookie options + +Please note that `secure: true` is a **recommended** option. However, it requires an https-enabled website, i.e., HTTPS is necessary for secure cookies. +If `secure` is set, and you access your site over HTTP, the cookie will not be set. If you have your node.js behind a proxy and are using `secure: true`, you need to set "trust proxy" in express: + +```js +var app = express() +app.set('trust proxy', 1) // trust first proxy +app.use(session({ + secret: 'keyboard cat' + , cookie: { secure: true } +})) +``` + +For using secure cookies in production, but allowing for testing in development, the following is an example of enabling this setup based on `NODE_ENV` in express: + +```js +var app = express() +var sess = { + secret: 'keyboard cat' + cookie: {} +} + +if (app.get('env') === 'production') { + app.set('trust proxy', 1) // trust first proxy + sess.cookie.secure = true // serve secure cookies +} + +app.use(session(sess)) +``` + +By default `cookie.maxAge` is `null`, meaning no "expires" parameter is set +so the cookie becomes a browser-session cookie. When the user closes the +browser the cookie (and session) will be removed. + +### req.session + +To store or access session data, simply use the request property `req.session`, +which is (generally) serialized as JSON by the store, so nested objects +are typically fine. For example below is a user-specific view counter: + +```js +app.use(session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }})) + +app.use(function(req, res, next) { + var sess = req.session + if (sess.views) { + sess.views++ + res.setHeader('Content-Type', 'text/html') + res.write('

    views: ' + sess.views + '

    ') + res.write('

    expires in: ' + (sess.cookie.maxAge / 1000) + 's

    ') + res.end() + } else { + sess.views = 1 + res.end('welcome to the session demo. refresh!') + } +}) +``` + +#### Session.regenerate() + +To regenerate the session simply invoke the method, once complete +a new SID and `Session` instance will be initialized at `req.session`. + +```js +req.session.regenerate(function(err) { + // will have a new session here +}) +``` + +#### Session.destroy() + +Destroys the session, removing `req.session`, will be re-generated next request. + +```js +req.session.destroy(function(err) { + // cannot access session here +}) +``` + +#### Session.reload() + +Reloads the session data. + +```js +req.session.reload(function(err) { + // session updated +}) +``` + +#### Session.save() + +```js +req.session.save(function(err) { + // session saved +}) +``` + +#### Session.touch() + +Updates the `.maxAge` property. Typically this is +not necessary to call, as the session middleware does this for you. + +### req.session.cookie + +Each session has a unique cookie object accompany it. This allows +you to alter the session cookie per visitor. For example we can +set `req.session.cookie.expires` to `false` to enable the cookie +to remain for only the duration of the user-agent. + +#### Cookie.maxAge + +Alternatively `req.session.cookie.maxAge` will return the time +remaining in milliseconds, which we may also re-assign a new value +to adjust the `.expires` property appropriately. The following +are essentially equivalent + +```js +var hour = 3600000 +req.session.cookie.expires = new Date(Date.now() + hour) +req.session.cookie.maxAge = hour +``` + +For example when `maxAge` is set to `60000` (one minute), and 30 seconds +has elapsed it will return `30000` until the current request has completed, +at which time `req.session.touch()` is called to reset `req.session.maxAge` +to its original value. + +```js +req.session.cookie.maxAge // => 30000 +``` + +## Session Store Implementation + +Every session store _must_ implement the following methods + + - `.get(sid, callback)` + - `.set(sid, session, callback)` + - `.destroy(sid, callback)` + +Recommended methods include, but are not limited to: + + - `.length(callback)` + - `.clear(callback)` + +For an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo. diff --git a/node_modules/express-session/index.js b/node_modules/express-session/index.js new file mode 100644 index 0000000..55bf367 --- /dev/null +++ b/node_modules/express-session/index.js @@ -0,0 +1,491 @@ +/*! + * express-session + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var cookie = require('cookie'); +var debug = require('debug')('express-session'); +var deprecate = require('depd')('express-session'); +var uid = require('uid-safe').sync + , onHeaders = require('on-headers') + , crc32 = require('buffer-crc32') + , parse = require('url').parse + , signature = require('cookie-signature') + +var Session = require('./session/session') + , MemoryStore = require('./session/memory') + , Cookie = require('./session/cookie') + , Store = require('./session/store') + +// environment + +var env = process.env.NODE_ENV; + +/** + * Expose the middleware. + */ + +exports = module.exports = session; + +/** + * Expose constructors. + */ + +exports.Store = Store; +exports.Cookie = Cookie; +exports.Session = Session; +exports.MemoryStore = MemoryStore; + +/** + * Warning message for `MemoryStore` usage in production. + */ + +var warning = 'Warning: connect.session() MemoryStore is not\n' + + 'designed for a production environment, as it will leak\n' + + 'memory, and will not scale past a single process.'; + +/** + * Node.js 0.8+ async implementation. + */ + +/* istanbul ignore next */ +var defer = typeof setImmediate === 'function' + ? setImmediate + : function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) } + +/** + * Setup session store with the given `options`. + * + * See README.md for documentation of options and formatting. + * + * Session data is _not_ saved in the cookie itself, however cookies are used, + * so you must use the cookie-parser middleware _before_ `session()`. + * [https://github.com/expressjs/cookie-parser] + * + * @param {Object} options + * @return {Function} middleware + * @api public + */ + +function session(options){ + var options = options || {} + // name - previously "options.key" + , name = options.name || options.key || 'connect.sid' + , store = options.store || new MemoryStore + , cookie = options.cookie || {} + , trustProxy = options.proxy + , storeReady = true + , rollingSessions = options.rolling || false; + var resaveSession = options.resave; + var saveUninitializedSession = options.saveUninitialized; + + var generateId = options.genid || generateSessionId; + + if (typeof generateId !== 'function') { + throw new TypeError('genid option must be a function'); + } + + if (resaveSession === undefined) { + deprecate('undefined resave option; provide resave option'); + resaveSession = true; + } + + if (saveUninitializedSession === undefined) { + deprecate('undefined saveUninitialized option; provide saveUninitialized option'); + saveUninitializedSession = true; + } + + if (options.unset && options.unset !== 'destroy' && options.unset !== 'keep') { + throw new TypeError('unset option must be "destroy" or "keep"'); + } + + // TODO: switch to "destroy" on next major + var unsetDestroy = options.unset === 'destroy'; + + // notify user that this store is not + // meant for a production environment + if ('production' == env && store instanceof MemoryStore) { + console.warn(warning); + } + + // generates the new session + store.generate = function(req){ + req.sessionID = generateId(req); + req.session = new Session(req); + req.session.cookie = new Cookie(cookie); + }; + + store.on('disconnect', function(){ storeReady = false; }); + store.on('connect', function(){ storeReady = true; }); + + if (!options.secret) { + deprecate('req.secret; provide secret option'); + } + + return function session(req, res, next) { + // self-awareness + if (req.session) return next(); + + // Handle connection as if there is no session if + // the store has temporarily disconnected etc + if (!storeReady) return debug('store is disconnected'), next(); + + // pathname mismatch + var originalPath = parse(req.originalUrl || req.url).pathname; + if (0 != originalPath.indexOf(cookie.path || '/')) return next(); + + // backwards compatibility for signed cookies + // req.secret is passed from the cookie parser middleware + var secret = options.secret || req.secret; + + // ensure secret is available or bail + if (!secret) next(new Error('`secret` option required for sessions')); + + var originalHash + , originalId; + + // expose store + req.sessionStore = store; + + // get the session ID from the cookie + var cookieId = req.sessionID = getcookie(req, name, secret); + + // set-cookie + onHeaders(res, function(){ + if (!req.session) { + debug('no session'); + return; + } + + var cookie = req.session.cookie; + + // only send secure cookies via https + if (cookie.secure && !issecure(req, trustProxy)) { + debug('not secured'); + return; + } + + if (!shouldSetCookie(req)) { + return; + } + + setcookie(res, name, req.sessionID, secret, cookie.data); + }); + + // proxy end() to commit the session + var _end = res.end; + var _write = res.write; + var ended = false; + res.end = function end(chunk, encoding) { + if (ended) { + return false; + } + + ended = true; + + var ret; + var sync = true; + + if (chunk === undefined) { + chunk = ''; + } + + function writeend() { + if (sync) { + ret = _end.call(res, chunk, encoding); + sync = false; + return; + } + + _end.call(res); + } + + function writetop() { + if (!sync) { + return ret; + } + + var contentLength = Number(res.getHeader('Content-Length')); + + if (!isNaN(contentLength) && contentLength > 0) { + // measure chunk + chunk = !Buffer.isBuffer(chunk) + ? new Buffer(chunk, encoding) + : chunk; + encoding = undefined; + + if (chunk.length !== 0) { + debug('split response'); + ret = _write.call(res, chunk.slice(0, chunk.length - 1)); + chunk = chunk.slice(chunk.length - 1, chunk.length); + return ret; + } + } + + ret = _write.call(res, chunk, encoding); + sync = false; + + return ret; + } + + if (shouldDestroy(req)) { + // destroy session + debug('destroying'); + store.destroy(req.sessionID, function ondestroy(err) { + if (err) { + defer(next, err); + } + + debug('destroyed'); + writeend(); + }); + + return writetop(); + } + + // no session to save + if (!req.session) { + debug('no session'); + return _end.call(res, chunk, encoding); + } + + req.session.resetMaxAge(); + + if (shouldSave(req)) { + debug('saving'); + req.session.save(function onsave(err) { + if (err) { + defer(next, err); + } + + debug('saved'); + writeend(); + }); + + return writetop(); + } + + return _end.call(res, chunk, encoding); + }; + + // generate the session + function generate() { + store.generate(req); + originalId = req.sessionID; + originalHash = hash(req.session); + } + + // check if session has been modified + function isModified(sess) { + return originalHash != hash(sess) || originalId != sess.id; + } + + // determine if session should be destroyed + function shouldDestroy(req) { + return req.sessionID && unsetDestroy && req.session == null; + } + + // determine if session should be saved to store + function shouldSave(req) { + return cookieId != req.sessionID + ? saveUninitializedSession || isModified(req.session) + : resaveSession || isModified(req.session); + } + + // determine if cookie should be set on response + function shouldSetCookie(req) { + // in case of rolling session, always reset the cookie + if (rollingSessions) { + return true; + } + + return cookieId != req.sessionID + ? saveUninitializedSession || isModified(req.session) + : req.session.cookie.expires != null && isModified(req.session); + } + + // generate a session if the browser doesn't send a sessionID + if (!req.sessionID) { + debug('no SID sent, generating session'); + generate(); + next(); + return; + } + + // generate the session object + debug('fetching %s', req.sessionID); + store.get(req.sessionID, function(err, sess){ + // error handling + if (err) { + debug('error %j', err); + if ('ENOENT' == err.code) { + generate(); + next(); + } else { + next(err); + } + // no session + } else if (!sess) { + debug('no session found'); + generate(); + next(); + // populate req.session + } else { + debug('session found'); + store.createSession(req, sess); + originalId = req.sessionID; + originalHash = hash(sess); + next(); + } + }); + }; +}; + +/** + * Generate a session ID for a new session. + * + * @return {String} + * @api private + */ + +function generateSessionId(sess) { + return uid(24); +} + +/** + * Get the session ID cookie from request. + * + * @return {string} + * @api private + */ + +function getcookie(req, name, secret) { + var header = req.headers.cookie; + var raw; + var val; + + // read from cookie header + if (header) { + var cookies = cookie.parse(header); + + raw = cookies[name]; + + if (raw) { + if (raw.substr(0, 2) === 's:') { + val = signature.unsign(raw.slice(2), secret); + + if (val === false) { + debug('cookie signature invalid'); + val = undefined; + } + } else { + debug('cookie unsigned') + } + } + } + + // back-compat read from cookieParser() signedCookies data + if (!val && req.signedCookies) { + val = req.signedCookies[name]; + + if (val) { + deprecate('cookie should be available in req.headers.cookie'); + } + } + + // back-compat read from cookieParser() cookies data + if (!val && req.cookies) { + raw = req.cookies[name]; + + if (raw) { + if (raw.substr(0, 2) === 's:') { + val = signature.unsign(raw.slice(2), secret); + + if (val) { + deprecate('cookie should be available in req.headers.cookie'); + } + + if (val === false) { + debug('cookie signature invalid'); + val = undefined; + } + } else { + debug('cookie unsigned') + } + } + } + + return val; +} + +/** + * Hash the given `sess` object omitting changes to `.cookie`. + * + * @param {Object} sess + * @return {String} + * @api private + */ + +function hash(sess) { + return crc32.signed(JSON.stringify(sess, function(key, val){ + if ('cookie' != key) return val; + })); +} + +/** + * Determine if request is secure. + * + * @param {Object} req + * @param {Boolean} [trustProxy] + * @return {Boolean} + * @api private + */ + +function issecure(req, trustProxy) { + // socket is https server + if (req.connection && req.connection.encrypted) { + return true; + } + + // do not trust proxy + if (trustProxy === false) { + return false; + } + + // no explicit trust; try req.secure from express + if (trustProxy !== true) { + var secure = req.secure; + return typeof secure === 'boolean' + ? secure + : false; + } + + // read the proto from x-forwarded-proto header + var header = req.headers['x-forwarded-proto'] || ''; + var index = header.indexOf(','); + var proto = index !== -1 + ? header.substr(0, index).toLowerCase().trim() + : header.toLowerCase().trim() + + return proto === 'https'; +} + +function setcookie(res, name, val, secret, options) { + var signed = 's:' + signature.sign(val, secret); + var data = cookie.serialize(name, signed, options); + + debug('set-cookie %s', data); + + var prev = res.getHeader('set-cookie') || []; + var header = Array.isArray(prev) ? prev.concat(data) + : Array.isArray(data) ? [prev].concat(data) + : [prev, data]; + + res.setHeader('set-cookie', header) +} diff --git a/node_modules/express-session/node_modules/buffer-crc32/.npmignore b/node_modules/express-session/node_modules/buffer-crc32/.npmignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/node_modules/express-session/node_modules/buffer-crc32/.npmignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/node_modules/express-session/node_modules/buffer-crc32/.travis.yml b/node_modules/express-session/node_modules/buffer-crc32/.travis.yml new file mode 100644 index 0000000..7a902e8 --- /dev/null +++ b/node_modules/express-session/node_modules/buffer-crc32/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - 0.6 + - 0.8 +notifications: + email: + recipients: + - brianloveswords@gmail.com \ No newline at end of file diff --git a/node_modules/express-session/node_modules/buffer-crc32/LICENSE b/node_modules/express-session/node_modules/buffer-crc32/LICENSE new file mode 100644 index 0000000..caeb849 --- /dev/null +++ b/node_modules/express-session/node_modules/buffer-crc32/LICENSE @@ -0,0 +1,17 @@ +Copyright (c) 2013 Brian J. Brennan + +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/node_modules/express-session/node_modules/buffer-crc32/README.md b/node_modules/express-session/node_modules/buffer-crc32/README.md new file mode 100644 index 0000000..0d9d8b8 --- /dev/null +++ b/node_modules/express-session/node_modules/buffer-crc32/README.md @@ -0,0 +1,47 @@ +# buffer-crc32 + +[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32) + +crc32 that works with binary data and fancy character sets, outputs +buffer, signed or unsigned data and has tests. + +Derived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix + +# install +``` +npm install buffer-crc32 +``` + +# example +```js +var crc32 = require('buffer-crc32'); +// works with buffers +var buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00]) +crc32(buf) // -> + +// has convenience methods for getting signed or unsigned ints +crc32.signed(buf) // -> -1805997238 +crc32.unsigned(buf) // -> 2488970058 + +// will cast to buffer if given a string, so you can +// directly use foreign characters safely +crc32('自動販売機') // -> + +// and works in append mode too +var partialCrc = crc32('hey'); +var partialCrc = crc32(' ', partialCrc); +var partialCrc = crc32('sup', partialCrc); +var partialCrc = crc32(' ', partialCrc); +var finalCrc = crc32('bros', partialCrc); // -> +``` + +# tests +This was tested against the output of zlib's crc32 method. You can run +the tests with`npm test` (requires tap) + +# see also +https://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also +supports buffer inputs and return unsigned ints (thanks @tjholowaychuk). + +# license +MIT/X11 diff --git a/node_modules/express-session/node_modules/buffer-crc32/index.js b/node_modules/express-session/node_modules/buffer-crc32/index.js new file mode 100644 index 0000000..8694c63 --- /dev/null +++ b/node_modules/express-session/node_modules/buffer-crc32/index.js @@ -0,0 +1,91 @@ +var Buffer = require('buffer').Buffer; + +var CRC_TABLE = [ + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d +]; + +if (typeof Int32Array !== 'undefined') + CRC_TABLE = new Int32Array(CRC_TABLE); + +function bufferizeInt(num) { + var tmp = Buffer(4); + tmp.writeInt32BE(num, 0); + return tmp; +} + +function _crc32(buf, previous) { + if (!Buffer.isBuffer(buf)) { + buf = Buffer(buf); + } + if (Buffer.isBuffer(previous)) { + previous = previous.readUInt32BE(0); + } + var crc = ~~previous ^ -1; + for (var n = 0; n < buf.length; n++) { + crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8); + } + return (crc ^ -1); +} + +function crc32() { + return bufferizeInt(_crc32.apply(null, arguments)); +} +crc32.signed = function () { + return _crc32.apply(null, arguments); +}; +crc32.unsigned = function () { + return _crc32.apply(null, arguments) >>> 0; +}; + +module.exports = crc32; diff --git a/node_modules/express-session/node_modules/buffer-crc32/package.json b/node_modules/express-session/node_modules/buffer-crc32/package.json new file mode 100644 index 0000000..4516500 --- /dev/null +++ b/node_modules/express-session/node_modules/buffer-crc32/package.json @@ -0,0 +1,43 @@ +{ + "author": { + "name": "Brian J. Brennan", + "email": "brianloveswords@gmail.com", + "url": "http://bjb.io" + }, + "name": "buffer-crc32", + "description": "A pure javascript CRC32 algorithm that plays nice with binary data", + "version": "0.2.3", + "contributors": [ + { + "name": "Vladimir Kuznetsov" + } + ], + "homepage": "https://github.com/brianloveswords/buffer-crc32", + "repository": { + "type": "git", + "url": "git://github.com/brianloveswords/buffer-crc32.git" + }, + "main": "index.js", + "scripts": { + "test": "tap tests/*.test.js" + }, + "dependencies": {}, + "devDependencies": { + "tap": "~0.2.5" + }, + "optionalDependencies": {}, + "engines": { + "node": "*" + }, + "readme": "# buffer-crc32\n\n[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32)\n\ncrc32 that works with binary data and fancy character sets, outputs\nbuffer, signed or unsigned data and has tests.\n\nDerived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix\n\n# install\n```\nnpm install buffer-crc32\n```\n\n# example\n```js\nvar crc32 = require('buffer-crc32');\n// works with buffers\nvar buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00])\ncrc32(buf) // -> \n\n// has convenience methods for getting signed or unsigned ints\ncrc32.signed(buf) // -> -1805997238\ncrc32.unsigned(buf) // -> 2488970058\n\n// will cast to buffer if given a string, so you can\n// directly use foreign characters safely\ncrc32('自動販売機') // -> \n\n// and works in append mode too\nvar partialCrc = crc32('hey');\nvar partialCrc = crc32(' ', partialCrc);\nvar partialCrc = crc32('sup', partialCrc);\nvar partialCrc = crc32(' ', partialCrc);\nvar finalCrc = crc32('bros', partialCrc); // -> \n```\n\n# tests\nThis was tested against the output of zlib's crc32 method. You can run\nthe tests with`npm test` (requires tap)\n\n# see also\nhttps://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also\nsupports buffer inputs and return unsigned ints (thanks @tjholowaychuk).\n\n# license\nMIT/X11\n", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/brianloveswords/buffer-crc32/issues" + }, + "_id": "buffer-crc32@0.2.3", + "dist": { + "shasum": "bb54519e95d107cbd2400e76d0cab1467336d921" + }, + "_from": "buffer-crc32@0.2.3", + "_resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.3.tgz" +} diff --git a/node_modules/express-session/node_modules/buffer-crc32/tests/crc.test.js b/node_modules/express-session/node_modules/buffer-crc32/tests/crc.test.js new file mode 100644 index 0000000..bb0f9ef --- /dev/null +++ b/node_modules/express-session/node_modules/buffer-crc32/tests/crc.test.js @@ -0,0 +1,89 @@ +var crc32 = require('..'); +var test = require('tap').test; + +test('simple crc32 is no problem', function (t) { + var input = Buffer('hey sup bros'); + var expected = Buffer([0x47, 0xfa, 0x55, 0x70]); + t.same(crc32(input), expected); + t.end(); +}); + +test('another simple one', function (t) { + var input = Buffer('IEND'); + var expected = Buffer([0xae, 0x42, 0x60, 0x82]); + t.same(crc32(input), expected); + t.end(); +}); + +test('slightly more complex', function (t) { + var input = Buffer([0x00, 0x00, 0x00]); + var expected = Buffer([0xff, 0x41, 0xd9, 0x12]); + t.same(crc32(input), expected); + t.end(); +}); + +test('complex crc32 gets calculated like a champ', function (t) { + var input = Buffer('शीर्षक'); + var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]); + t.same(crc32(input), expected); + t.end(); +}); + +test('casts to buffer if necessary', function (t) { + var input = 'शीर्षक'; + var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]); + t.same(crc32(input), expected); + t.end(); +}); + +test('can do signed', function (t) { + var input = 'ham sandwich'; + var expected = -1891873021; + t.same(crc32.signed(input), expected); + t.end(); +}); + +test('can do unsigned', function (t) { + var input = 'bear sandwich'; + var expected = 3711466352; + t.same(crc32.unsigned(input), expected); + t.end(); +}); + + +test('simple crc32 in append mode', function (t) { + var input = [Buffer('hey'), Buffer(' '), Buffer('sup'), Buffer(' '), Buffer('bros')]; + var expected = Buffer([0x47, 0xfa, 0x55, 0x70]); + for (var crc = 0, i = 0; i < input.length; i++) { + crc = crc32(input[i], crc); + } + t.same(crc, expected); + t.end(); +}); + + +test('can do signed in append mode', function (t) { + var input1 = 'ham'; + var input2 = ' '; + var input3 = 'sandwich'; + var expected = -1891873021; + + var crc = crc32.signed(input1); + crc = crc32.signed(input2, crc); + crc = crc32.signed(input3, crc); + + t.same(crc, expected); + t.end(); +}); + +test('can do unsigned in append mode', function (t) { + var input1 = 'bear san'; + var input2 = 'dwich'; + var expected = 3711466352; + + var crc = crc32.unsigned(input1); + crc = crc32.unsigned(input2, crc); + t.same(crc, expected); + t.end(); +}); + diff --git a/node_modules/express-session/node_modules/cookie-signature/.npmignore b/node_modules/express-session/node_modules/cookie-signature/.npmignore new file mode 100644 index 0000000..f1250e5 --- /dev/null +++ b/node_modules/express-session/node_modules/cookie-signature/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/express-session/node_modules/cookie-signature/History.md b/node_modules/express-session/node_modules/cookie-signature/History.md new file mode 100644 index 0000000..2bbc4b3 --- /dev/null +++ b/node_modules/express-session/node_modules/cookie-signature/History.md @@ -0,0 +1,27 @@ +1.0.4 / 2014-06-25 +================== + + * corrected avoidance of timing attacks (thanks @tenbits!) + + +1.0.3 / 2014-01-28 +================== + + * [incorrect] fix for timing attacks + +1.0.2 / 2014-01-28 +================== + + * fix missing repository warning + * fix typo in test + +1.0.1 / 2013-04-15 +================== + + * Revert "Changed underlying HMAC algo. to sha512." + * Revert "Fix for timing attacks on MAC verification." + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/express-session/node_modules/cookie-signature/Makefile b/node_modules/express-session/node_modules/cookie-signature/Makefile new file mode 100644 index 0000000..4e9c8d3 --- /dev/null +++ b/node_modules/express-session/node_modules/cookie-signature/Makefile @@ -0,0 +1,7 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec + +.PHONY: test \ No newline at end of file diff --git a/node_modules/express-session/node_modules/cookie-signature/Readme.md b/node_modules/express-session/node_modules/cookie-signature/Readme.md new file mode 100644 index 0000000..2559e84 --- /dev/null +++ b/node_modules/express-session/node_modules/cookie-signature/Readme.md @@ -0,0 +1,42 @@ + +# cookie-signature + + Sign and unsign cookies. + +## Example + +```js +var cookie = require('cookie-signature'); + +var val = cookie.sign('hello', 'tobiiscool'); +val.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI'); + +var val = cookie.sign('hello', 'tobiiscool'); +cookie.unsign(val, 'tobiiscool').should.equal('hello'); +cookie.unsign(val, 'luna').should.be.false; +``` + +## License + +(The MIT License) + +Copyright (c) 2012 LearnBoost <tj@learnboost.com> + +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. \ No newline at end of file diff --git a/node_modules/express-session/node_modules/cookie-signature/index.js b/node_modules/express-session/node_modules/cookie-signature/index.js new file mode 100644 index 0000000..b63bf84 --- /dev/null +++ b/node_modules/express-session/node_modules/cookie-signature/index.js @@ -0,0 +1,51 @@ +/** + * Module dependencies. + */ + +var crypto = require('crypto'); + +/** + * Sign the given `val` with `secret`. + * + * @param {String} val + * @param {String} secret + * @return {String} + * @api private + */ + +exports.sign = function(val, secret){ + if ('string' != typeof val) throw new TypeError('cookie required'); + if ('string' != typeof secret) throw new TypeError('secret required'); + return val + '.' + crypto + .createHmac('sha256', secret) + .update(val) + .digest('base64') + .replace(/\=+$/, ''); +}; + +/** + * Unsign and decode the given `val` with `secret`, + * returning `false` if the signature is invalid. + * + * @param {String} val + * @param {String} secret + * @return {String|Boolean} + * @api private + */ + +exports.unsign = function(val, secret){ + if ('string' != typeof val) throw new TypeError('cookie required'); + if ('string' != typeof secret) throw new TypeError('secret required'); + var str = val.slice(0, val.lastIndexOf('.')) + , mac = exports.sign(str, secret); + + return sha1(mac) == sha1(val) ? str : false; +}; + +/** + * Private + */ + +function sha1(str){ + return crypto.createHash('sha1').update(str).digest('hex'); +} diff --git a/node_modules/express-session/node_modules/cookie-signature/package.json b/node_modules/express-session/node_modules/cookie-signature/package.json new file mode 100644 index 0000000..6ad14d4 --- /dev/null +++ b/node_modules/express-session/node_modules/cookie-signature/package.json @@ -0,0 +1,36 @@ +{ + "name": "cookie-signature", + "version": "1.0.4", + "description": "Sign and unsign cookies", + "keywords": [ + "cookie", + "sign", + "unsign" + ], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@learnboost.com" + }, + "repository": { + "type": "git", + "url": "https://github.com/visionmedia/node-cookie-signature.git" + }, + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "main": "index", + "readme": "\n# cookie-signature\n\n Sign and unsign cookies.\n\n## Example\n\n```js\nvar cookie = require('cookie-signature');\n\nvar val = cookie.sign('hello', 'tobiiscool');\nval.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI');\n\nvar val = cookie.sign('hello', 'tobiiscool');\ncookie.unsign(val, 'tobiiscool').should.equal('hello');\ncookie.unsign(val, 'luna').should.be.false;\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 LearnBoost <tj@learnboost.com>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", + "readmeFilename": "Readme.md", + "bugs": { + "url": "https://github.com/visionmedia/node-cookie-signature/issues" + }, + "homepage": "https://github.com/visionmedia/node-cookie-signature", + "_id": "cookie-signature@1.0.4", + "dist": { + "shasum": "0edd22286e3a111b9a2a70db363e925e867f6aca" + }, + "_from": "cookie-signature@1.0.4", + "_resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.4.tgz" +} diff --git a/node_modules/express-session/node_modules/cookie/.npmignore b/node_modules/express-session/node_modules/cookie/.npmignore new file mode 100644 index 0000000..efab07f --- /dev/null +++ b/node_modules/express-session/node_modules/cookie/.npmignore @@ -0,0 +1,2 @@ +test +.travis.yml diff --git a/node_modules/express-session/node_modules/cookie/LICENSE b/node_modules/express-session/node_modules/cookie/LICENSE new file mode 100644 index 0000000..249d9de --- /dev/null +++ b/node_modules/express-session/node_modules/cookie/LICENSE @@ -0,0 +1,9 @@ +// MIT License + +Copyright (C) Roman Shtylman + +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/node_modules/express-session/node_modules/cookie/README.md b/node_modules/express-session/node_modules/cookie/README.md new file mode 100644 index 0000000..3170b4b --- /dev/null +++ b/node_modules/express-session/node_modules/cookie/README.md @@ -0,0 +1,44 @@ +# cookie [![Build Status](https://secure.travis-ci.org/defunctzombie/node-cookie.png?branch=master)](http://travis-ci.org/defunctzombie/node-cookie) # + +cookie is a basic cookie parser and serializer. It doesn't make assumptions about how you are going to deal with your cookies. It basically just provides a way to read and write the HTTP cookie headers. + +See [RFC6265](http://tools.ietf.org/html/rfc6265) for details about the http header for cookies. + +## how? + +``` +npm install cookie +``` + +```javascript +var cookie = require('cookie'); + +var hdr = cookie.serialize('foo', 'bar'); +// hdr = 'foo=bar'; + +var cookies = cookie.parse('foo=bar; cat=meow; dog=ruff'); +// cookies = { foo: 'bar', cat: 'meow', dog: 'ruff' }; +``` + +## more + +The serialize function takes a third parameter, an object, to set cookie options. See the RFC for valid values. + +### path +> cookie path + +### expires +> absolute expiration date for the cookie (Date object) + +### maxAge +> relative max age of the cookie from when the client receives it (seconds) + +### domain +> domain for the cookie + +### secure +> true or false + +### httpOnly +> true or false + diff --git a/node_modules/express-session/node_modules/cookie/index.js b/node_modules/express-session/node_modules/cookie/index.js new file mode 100644 index 0000000..00d54a7 --- /dev/null +++ b/node_modules/express-session/node_modules/cookie/index.js @@ -0,0 +1,75 @@ + +/// Serialize the a name value pair into a cookie string suitable for +/// http headers. An optional options object specified cookie parameters +/// +/// serialize('foo', 'bar', { httpOnly: true }) +/// => "foo=bar; httpOnly" +/// +/// @param {String} name +/// @param {String} val +/// @param {Object} options +/// @return {String} +var serialize = function(name, val, opt){ + opt = opt || {}; + var enc = opt.encode || encode; + var pairs = [name + '=' + enc(val)]; + + if (null != opt.maxAge) { + var maxAge = opt.maxAge - 0; + if (isNaN(maxAge)) throw new Error('maxAge should be a Number'); + pairs.push('Max-Age=' + maxAge); + } + + if (opt.domain) pairs.push('Domain=' + opt.domain); + if (opt.path) pairs.push('Path=' + opt.path); + if (opt.expires) pairs.push('Expires=' + opt.expires.toUTCString()); + if (opt.httpOnly) pairs.push('HttpOnly'); + if (opt.secure) pairs.push('Secure'); + + return pairs.join('; '); +}; + +/// Parse the given cookie header string into an object +/// The object has the various cookies as keys(names) => values +/// @param {String} str +/// @return {Object} +var parse = function(str, opt) { + opt = opt || {}; + var obj = {} + var pairs = str.split(/; */); + var dec = opt.decode || decode; + + pairs.forEach(function(pair) { + var eq_idx = pair.indexOf('=') + + // skip things that don't look like key=value + if (eq_idx < 0) { + return; + } + + var key = pair.substr(0, eq_idx).trim() + var val = pair.substr(++eq_idx, pair.length).trim(); + + // quoted values + if ('"' == val[0]) { + val = val.slice(1, -1); + } + + // only assign once + if (undefined == obj[key]) { + try { + obj[key] = dec(val); + } catch (e) { + obj[key] = val; + } + } + }); + + return obj; +}; + +var encode = encodeURIComponent; +var decode = decodeURIComponent; + +module.exports.serialize = serialize; +module.exports.parse = parse; diff --git a/node_modules/express-session/node_modules/cookie/package.json b/node_modules/express-session/node_modules/cookie/package.json new file mode 100644 index 0000000..46e38e7 --- /dev/null +++ b/node_modules/express-session/node_modules/cookie/package.json @@ -0,0 +1,41 @@ +{ + "author": { + "name": "Roman Shtylman", + "email": "shtylman@gmail.com" + }, + "name": "cookie", + "description": "cookie parsing and serialization", + "version": "0.1.2", + "repository": { + "type": "git", + "url": "git://github.com/shtylman/node-cookie.git" + }, + "keywords": [ + "cookie", + "cookies" + ], + "main": "index.js", + "scripts": { + "test": "mocha" + }, + "dependencies": {}, + "devDependencies": { + "mocha": "1.x.x" + }, + "optionalDependencies": {}, + "engines": { + "node": "*" + }, + "readme": "# cookie [![Build Status](https://secure.travis-ci.org/defunctzombie/node-cookie.png?branch=master)](http://travis-ci.org/defunctzombie/node-cookie) #\n\ncookie is a basic cookie parser and serializer. It doesn't make assumptions about how you are going to deal with your cookies. It basically just provides a way to read and write the HTTP cookie headers.\n\nSee [RFC6265](http://tools.ietf.org/html/rfc6265) for details about the http header for cookies.\n\n## how?\n\n```\nnpm install cookie\n```\n\n```javascript\nvar cookie = require('cookie');\n\nvar hdr = cookie.serialize('foo', 'bar');\n// hdr = 'foo=bar';\n\nvar cookies = cookie.parse('foo=bar; cat=meow; dog=ruff');\n// cookies = { foo: 'bar', cat: 'meow', dog: 'ruff' };\n```\n\n## more\n\nThe serialize function takes a third parameter, an object, to set cookie options. See the RFC for valid values.\n\n### path\n> cookie path\n\n### expires\n> absolute expiration date for the cookie (Date object)\n\n### maxAge\n> relative max age of the cookie from when the client receives it (seconds)\n\n### domain\n> domain for the cookie\n\n### secure\n> true or false\n\n### httpOnly\n> true or false\n\n", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/shtylman/node-cookie/issues" + }, + "homepage": "https://github.com/shtylman/node-cookie", + "_id": "cookie@0.1.2", + "dist": { + "shasum": "72fec3d24e48a3432073d90c12642005061004b1" + }, + "_from": "cookie@0.1.2", + "_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.1.2.tgz" +} diff --git a/node_modules/express-session/node_modules/debug/.jshintrc b/node_modules/express-session/node_modules/debug/.jshintrc new file mode 100644 index 0000000..299877f --- /dev/null +++ b/node_modules/express-session/node_modules/debug/.jshintrc @@ -0,0 +1,3 @@ +{ + "laxbreak": true +} diff --git a/node_modules/express-session/node_modules/debug/.npmignore b/node_modules/express-session/node_modules/debug/.npmignore new file mode 100644 index 0000000..7e6163d --- /dev/null +++ b/node_modules/express-session/node_modules/debug/.npmignore @@ -0,0 +1,6 @@ +support +test +examples +example +*.sock +dist diff --git a/node_modules/express-session/node_modules/debug/History.md b/node_modules/express-session/node_modules/debug/History.md new file mode 100644 index 0000000..3b96560 --- /dev/null +++ b/node_modules/express-session/node_modules/debug/History.md @@ -0,0 +1,144 @@ + +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/node_modules/express-session/node_modules/debug/Makefile b/node_modules/express-session/node_modules/debug/Makefile new file mode 100644 index 0000000..b0bde6e --- /dev/null +++ b/node_modules/express-session/node_modules/debug/Makefile @@ -0,0 +1,33 @@ + +# 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 node_modules dist + +dist: + @mkdir -p $@ + +dist/debug.js: node_modules browser.js debug.js dist + @$(BROWSERIFY) \ + --standalone debug \ + . > $@ + +node_modules: package.json + @NODE_ENV= $(NPM) install + @touch node_modules + +.PHONY: all install clean diff --git a/node_modules/express-session/node_modules/debug/Readme.md b/node_modules/express-session/node_modules/debug/Readme.md new file mode 100644 index 0000000..e59b9ad --- /dev/null +++ b/node_modules/express-session/node_modules/debug/Readme.md @@ -0,0 +1,156 @@ +# 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) + +## 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`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. + +```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 _stderr.js_: + +```js +var debug = require('../'); +var log = debug('app:log'); + +// by default console.log is used +log('goes to stdout!'); + +var error = debug('app:error'); +// set this namespace to log via console.error +error.log = console.error.bind(console); // don't forget to bind to console! +error('goes to stderr'); +log('still goes to stdout!'); + +// set all output to go via console.warn +// overrides all per-namespace log settings +debug.log = console.warn.bind(console); +log('now goes to stderr via console.warn'); +error('still goes to stderr, but via console.warn now'); +``` + +## 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/node_modules/express-session/node_modules/debug/browser.js b/node_modules/express-session/node_modules/debug/browser.js new file mode 100644 index 0000000..ce6369f --- /dev/null +++ b/node_modules/express-session/node_modules/debug/browser.js @@ -0,0 +1,147 @@ + +/** + * 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; + +/** + * 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, + // where the `console.log` function doesn't have 'apply' + return 'object' == typeof console + && 'function' == typeof console.log + && Function.prototype.apply.call(console.log, console, arguments); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + +function save(namespaces) { + try { + if (null == namespaces) { + localStorage.removeItem('debug'); + } else { + localStorage.debug = namespaces; + } + } catch(e) {} +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + var r; + try { + r = localStorage.debug; + } catch(e) {} + return r; +} + +/** + * Enable namespaces listed in `localStorage.debug` initially. + */ + +exports.enable(load()); diff --git a/node_modules/express-session/node_modules/debug/component.json b/node_modules/express-session/node_modules/debug/component.json new file mode 100644 index 0000000..ab5f3ee --- /dev/null +++ b/node_modules/express-session/node_modules/debug/component.json @@ -0,0 +1,19 @@ +{ + "name": "debug", + "repo": "visionmedia/debug", + "description": "small debugging utility", + "version": "1.0.4", + "keywords": [ + "debug", + "log", + "debugger" + ], + "main": "browser.js", + "scripts": [ + "browser.js", + "debug.js" + ], + "dependencies": { + "guille/ms.js": "0.6.1" + } +} diff --git a/node_modules/express-session/node_modules/debug/debug.js b/node_modules/express-session/node_modules/debug/debug.js new file mode 100644 index 0000000..7571a86 --- /dev/null +++ b/node_modules/express-session/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/node_modules/express-session/node_modules/debug/node.js b/node_modules/express-session/node_modules/debug/node.js new file mode 100644 index 0000000..c94f7d1 --- /dev/null +++ b/node_modules/express-session/node_modules/debug/node.js @@ -0,0 +1,129 @@ + +/** + * 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]; + +/** + * 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(1); + } 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[9' + c + 'm' + 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.log()` with the specified arguments. + */ + +function log() { + return console.log.apply(console, arguments); +} + +/** + * 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; +} + +/** + * Enable namespaces listed in `process.env.DEBUG` initially. + */ + +exports.enable(load()); diff --git a/node_modules/express-session/node_modules/debug/node_modules/ms/.npmignore b/node_modules/express-session/node_modules/debug/node_modules/ms/.npmignore new file mode 100644 index 0000000..d1aa0ce --- /dev/null +++ b/node_modules/express-session/node_modules/debug/node_modules/ms/.npmignore @@ -0,0 +1,5 @@ +node_modules +test +History.md +Makefile +component.json diff --git a/node_modules/express-session/node_modules/debug/node_modules/ms/README.md b/node_modules/express-session/node_modules/debug/node_modules/ms/README.md new file mode 100644 index 0000000..d4ab12a --- /dev/null +++ b/node_modules/express-session/node_modules/debug/node_modules/ms/README.md @@ -0,0 +1,33 @@ +# ms.js: miliseconds conversion utility + +```js +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('100') // 100 +``` + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(ms('10 hours')) // "10h" +``` + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(ms('10 hours', { long: true })) // "10 hours" +``` + +- Node/Browser compatible. Published as `ms` in NPM. +- If a number is supplied to `ms`, a string with a unit is returned. +- If a string that contains the number is supplied, it returns it as +a number (e.g: it returns `100` for `'100'`). +- If you pass a string with a number and a valid unit, the number of +equivalent ms is returned. + +## License + +MIT \ No newline at end of file diff --git a/node_modules/express-session/node_modules/debug/node_modules/ms/index.js b/node_modules/express-session/node_modules/debug/node_modules/ms/index.js new file mode 100644 index 0000000..c5847f8 --- /dev/null +++ b/node_modules/express-session/node_modules/debug/node_modules/ms/index.js @@ -0,0 +1,111 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options){ + options = options || {}; + if ('string' == typeof val) return parse(val); + return options.long + ? long(val) + : short(val); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + var match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str); + if (!match) return; + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 's': + return n * s; + case 'ms': + return n; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function long(ms) { + return plural(ms, d, 'day') + || plural(ms, h, 'hour') + || plural(ms, m, 'minute') + || plural(ms, s, 'second') + || ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) return; + if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; + return Math.ceil(ms / n) + ' ' + name + 's'; +} diff --git a/node_modules/express-session/node_modules/debug/node_modules/ms/package.json b/node_modules/express-session/node_modules/debug/node_modules/ms/package.json new file mode 100644 index 0000000..5ea9cac --- /dev/null +++ b/node_modules/express-session/node_modules/debug/node_modules/ms/package.json @@ -0,0 +1,32 @@ +{ + "name": "ms", + "version": "0.6.2", + "description": "Tiny ms conversion utility", + "repository": { + "type": "git", + "url": "git://github.com/guille/ms.js.git" + }, + "main": "./index", + "devDependencies": { + "mocha": "*", + "expect.js": "*", + "serve": "*" + }, + "component": { + "scripts": { + "ms/index.js": "index.js" + } + }, + "readme": "# ms.js: miliseconds conversion utility\n\n```js\nms('1d') // 86400000\nms('10h') // 36000000\nms('2h') // 7200000\nms('1m') // 60000\nms('5s') // 5000\nms('100') // 100\n```\n\n```js\nms(60000) // \"1m\"\nms(2 * 60000) // \"2m\"\nms(ms('10 hours')) // \"10h\"\n```\n\n```js\nms(60000, { long: true }) // \"1 minute\"\nms(2 * 60000, { long: true }) // \"2 minutes\"\nms(ms('10 hours', { long: true })) // \"10 hours\"\n```\n\n- Node/Browser compatible. Published as `ms` in NPM.\n- If a number is supplied to `ms`, a string with a unit is returned.\n- If a string that contains the number is supplied, it returns it as\na number (e.g: it returns `100` for `'100'`).\n- If you pass a string with a number and a valid unit, the number of\nequivalent ms is returned.\n\n## License\n\nMIT", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/guille/ms.js/issues" + }, + "homepage": "https://github.com/guille/ms.js", + "_id": "ms@0.6.2", + "dist": { + "shasum": "d89c2124c6fdc1353d65a8b77bf1aac4b193708c" + }, + "_from": "ms@0.6.2", + "_resolved": "https://registry.npmjs.org/ms/-/ms-0.6.2.tgz" +} diff --git a/node_modules/express-session/node_modules/debug/package.json b/node_modules/express-session/node_modules/debug/package.json new file mode 100644 index 0000000..e8b07d1 --- /dev/null +++ b/node_modules/express-session/node_modules/debug/package.json @@ -0,0 +1,52 @@ +{ + "name": "debug", + "version": "1.0.4", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "contributors": [ + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net", + "url": "http://n8.io" + } + ], + "dependencies": { + "ms": "0.6.2" + }, + "devDependencies": { + "browserify": "4.1.6", + "mocha": "*" + }, + "main": "./node.js", + "browser": "./browser.js", + "component": { + "scripts": { + "debug/index.js": "browser.js", + "debug/debug.js": "debug.js" + } + }, + "readme": "# debug\n\n tiny node.js debugging utility modelled after node core's debugging technique.\n\n## Installation\n\n```bash\n$ npm install debug\n```\n\n## Usage\n\n 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.\n\nExample _app.js_:\n\n```js\nvar debug = require('debug')('http')\n , http = require('http')\n , name = 'My App';\n\n// fake app\n\ndebug('booting %s', name);\n\nhttp.createServer(function(req, res){\n debug(req.method + ' ' + req.url);\n res.end('hello\\n');\n}).listen(3000, function(){\n debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample _worker.js_:\n\n```js\nvar debug = require('debug')('worker');\n\nsetInterval(function(){\n debug('doing some work');\n}, 1000);\n```\n\n The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:\n\n ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)\n\n ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)\n\n## Millisecond diff\n\n 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.\n\n ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)\n\n When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:\n\n ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)\n\n## Conventions\n\n 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\".\n\n## Wildcards\n\n 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=*`.\n\n 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:\".\n\n## Browser support\n\n Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`.\n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n b('doing some work');\n}, 1200);\n```\n\n#### Web Inspector Colors\n\n Colors are also enabled on \"Web Inspectors\" that understand the `%c` formatting\n option. These are WebKit web inspectors, Firefox ([since version\n 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))\n and the Firebug plugin for Firefox (any version).\n\n Colored output looks something like:\n\n ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png)\n\n### stderr vs stdout\n\nYou can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally:\n\nExample _stderr.js_:\n\n```js\nvar debug = require('../');\nvar log = debug('app:log');\n\n// by default console.log is used\nlog('goes to stdout!');\n\nvar error = debug('app:error');\n// set this namespace to log via console.error\nerror.log = console.error.bind(console); // don't forget to bind to console!\nerror('goes to stderr');\nlog('still goes to stdout!');\n\n// set all output to go via console.warn\n// overrides all per-namespace log settings\ndebug.log = console.warn.bind(console);\nlog('now goes to stderr via console.warn');\nerror('still goes to stderr, but via console.warn now');\n```\n\n## Authors\n\n - TJ Holowaychuk\n - Nathan Rajlich\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", + "readmeFilename": "Readme.md", + "bugs": { + "url": "https://github.com/visionmedia/debug/issues" + }, + "homepage": "https://github.com/visionmedia/debug", + "_id": "debug@1.0.4", + "dist": { + "shasum": "8a2e8e20db6bfc97bbfe967bb076fc1ce411415d" + }, + "_from": "debug@1.0.4", + "_resolved": "https://registry.npmjs.org/debug/-/debug-1.0.4.tgz" +} diff --git a/node_modules/express-session/node_modules/depd/.npmignore b/node_modules/express-session/node_modules/depd/.npmignore new file mode 100644 index 0000000..0c7e391 --- /dev/null +++ b/node_modules/express-session/node_modules/depd/.npmignore @@ -0,0 +1,4 @@ +coverage/ +files/ +test/ +.travis.yml diff --git a/node_modules/express-session/node_modules/depd/History.md b/node_modules/express-session/node_modules/depd/History.md new file mode 100644 index 0000000..ba1af12 --- /dev/null +++ b/node_modules/express-session/node_modules/depd/History.md @@ -0,0 +1,56 @@ +0.4.4 / 2014-07-27 +================== + + * Work-around v8 generating empty stack traces + +0.4.3 / 2014-07-26 +================== + + * Fix exception when global `Error.stackTraceLimit` is too low + +0.4.2 / 2014-07-19 +================== + + * Correct call site for wrapped functions and properties + +0.4.1 / 2014-07-19 +================== + + * Improve automatic message generation for function properties + +0.4.0 / 2014-07-19 +================== + + * Add `TRACE_DEPRECATION` environment variable + * Remove non-standard grey color from color output + * Support `--no-deprecation` argument + * Support `--trace-deprecation` argument + * Support `deprecate.property(fn, prop, message)` + +0.3.0 / 2014-06-16 +================== + + * Add `NO_DEPRECATION` environment variable + +0.2.0 / 2014-06-15 +================== + + * Add `deprecate.property(obj, prop, message)` + * Remove `supports-color` dependency for node.js 0.8 + +0.1.0 / 2014-06-15 +================== + + * Add `deprecate.function(fn, message)` + * Add `process.on('deprecation', fn)` emitter + * Automatically generate message when omitted from `deprecate()` + +0.0.1 / 2014-06-15 +================== + + * Fix warning for dynamic calls at singe call site + +0.0.0 / 2014-06-15 +================== + + * Initial implementation diff --git a/node_modules/express-session/node_modules/depd/LICENSE b/node_modules/express-session/node_modules/depd/LICENSE new file mode 100644 index 0000000..b7dce6c --- /dev/null +++ b/node_modules/express-session/node_modules/depd/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014 Douglas Christopher Wilson + +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/node_modules/express-session/node_modules/depd/Readme.md b/node_modules/express-session/node_modules/depd/Readme.md new file mode 100644 index 0000000..47a53a1 --- /dev/null +++ b/node_modules/express-session/node_modules/depd/Readme.md @@ -0,0 +1,272 @@ +# depd + +[![NPM version](https://badge.fury.io/js/depd.svg)](http://badge.fury.io/js/depd) +[![Build Status](https://travis-ci.org/dougwilson/nodejs-depd.svg?branch=master)](https://travis-ci.org/dougwilson/nodejs-depd) +[![Coverage Status](https://img.shields.io/coveralls/dougwilson/nodejs-depd.svg?branch=master)](https://coveralls.io/r/dougwilson/nodejs-depd) +[![Gittip](http://img.shields.io/gittip/dougwilson.svg)](https://www.gittip.com/dougwilson/) + +Deprecate all the things + +> With great modules comes great responsibility; mark things deprecated! + +## Install + +```sh +$ npm install depd +``` + +## API + +```js +var deprecate = require('depd')('my-module') +``` + +This library allows you to display deprecation messages to your users. +This library goes above and beyond with deprecation warnings by +introspecting the call stack (but only the bits that it is interested +in). + +Instead of just warning on the first invocation of a deprecated +function and never again, this module will warn on the first invocation +of a deprecated function per unique call site, making it ideal to alert +users of all deprecated uses across the code base, rather than just +whatever happens to execute first. + +The deprecation warnings from this module also include the file and line +information for the call into the module that the deprecated function was +in. + +### depd(namespace) + +Create a new deprecate function that uses the given namespace name in the +messages and will display the call site prior to the stack entering the +file this function was called from. It is highly suggested you use the +name of your module as the namespace. + +### deprecate(message) + +Call this function from deprecated code to display a deprecation message. +This message will appear once per unique caller site. Caller site is the +first call site in the stack in a different file from the caller of this +function. + +If the message is omitted, a message is generated for you based on the site +of the `deprecate()` call and will display the name of the function called, +similar to the name displayed in a stack trace. + +### deprecate.function(fn, message) + +Call this function to wrap a given function in a deprecation message on any +call to the function. An optional message can be supplied to provide a custom +message. + +### deprecate.property(obj, prop, message) + +Call this function to wrap a given property on object in a deprecation message +on any accessing or setting of the property. An optional message can be supplied +to provide a custom message. + +The method must be called on the object where the property belongs (not +inherited from the prototype). + +If the property is a data descriptor, it will be converted to an accessor +descriptor in order to display the deprecation message. + +### process.on('deprecation', fn) + +This module will allow easy capturing of deprecation errors by emitting the +errors as the type "deprecation" on the global `process`. If there are no +listeners for this type, the errors are written to STDERR as normal, but if +there are any listeners, nothing will be written to STDERR and instead only +emitted. From there, you can write the errors in a different format or to a +logging source. + +The error represents the deprecation and is emitted only once with the same +rules as writing to STDERR. The error has the following properties: + + - `message` - This is the message given by the library + - `name` - This is always `'DeprecationError'` + - `namespace` - This is the namespace the deprecation came from + - `stack` - This is the stack of the call to the deprecated thing + +Example `error.stack` output: + +``` +DeprecationError: my-cool-module deprecated oldfunction + at Object. ([eval]-wrapper:6:22) + at Module._compile (module.js:456:26) + at evalScript (node.js:532:25) + at startup (node.js:80:7) + at node.js:902:3 +``` + +### process.env.NO_DEPRECATION + +As a user of modules that are deprecated, the environment variable `NO_DEPRECATION` +is provided as a quick solution to silencing deprecation warnings from being +output. The format of this is similar to that of `DEBUG`: + +```sh +$ NO_DEPRECATION=my-module,othermod node app.js +``` + +This will suppress deprecations from being output for "my-module" and "othermod". +The value is a list of comma-separated namespaces. To suppress every warning +across all namespaces, use the value `*` for a namespace. + +Providing the argument `--no-deprecation` to the `node` executable will suppress +all deprecations. + +**NOTE** This will not suppress the deperecations given to any "deprecation" +event listeners, just the output to STDERR. + +### process.env.TRACE_DEPRECATION + +As a user of modules that are deprecated, the environment variable `TRACE_DEPRECATION` +is provided as a solution to getting more detailed location information in deprecation +warnings by including the entire stack trace. The format of this is the same as +`NO_DEPRECATION`: + +```sh +$ TRACE_DEPRECATION=my-module,othermod node app.js +``` + +This will include stack traces for deprecations being output for "my-module" and +"othermod". The value is a list of comma-separated namespaces. To trace every +warning across all namespaces, use the value `*` for a namespace. + +Providing the argument `--trace-deprecation` to the `node` executable will trace +all deprecations. + +**NOTE** This will not trace the deperecations silenced by `NO_DEPRECATION`. + +## Display + +![message](files/message.png) + +When a user calls a function in your library that you mark deprecated, they +will see the following written to STDERR (in the given colors, similar colors +and layout to the `debug` module): + +``` +bright cyan bright yellow +| | reset cyan +| | | | +▼ ▼ ▼ ▼ +my-cool-module deprecated oldfunction [eval]-wrapper:6:22 +▲ ▲ ▲ ▲ +| | | | +namespace | | location of mycoolmod.oldfunction() call + | deprecation message + the word "deprecated" +``` + +If the user redirects their STDERR to a file or somewhere that does not support +colors, they see (similar layout to the `debug` module): + +``` +Sun, 15 Jun 2014 05:21:37 GMT my-cool-module deprecated oldfunction at [eval]-wrapper:6:22 +▲ ▲ ▲ ▲ ▲ +| | | | | +timestamp of message namespace | | location of mycoolmod.oldfunction() call + | deprecation message + the word "deprecated" +``` + +## Examples + +### Deprecating all calls to a function + +This will display a deprecated message about "oldfunction" being deprecated +from "my-module" on STDERR. + +```js +var deprecate = require('depd')('my-cool-module') + +// message automatically derived from function name +// Object.oldfunction +exports.oldfunction = deprecate.function(function oldfunction() { + // all calls to function are deprecated +}) + +// specific message +exports.oldfunction = deprecate.function(function () { + // all calls to function are deprecated +}, 'oldfunction') +``` + +### Conditionally deprecating a function call + +This will display a deprecated message about "weirdfunction" being deprecated +from "my-module" on STDERR when called with less than 2 arguments. + +```js +var deprecate = require('depd')('my-cool-module') + +exports.weirdfunction = function () { + if (arguments.length < 2) { + // calls with 0 or 1 args are deprecated + deprecate('weirdfunction args < 2') + } +} +``` + +When calling `deprecate` as a function, the warning is counted per call site +within your own module, so you can display different deprecations depending +on different situations and the users will still get all the warnings: + +```js +var deprecate = require('depd')('my-cool-module') + +exports.weirdfunction = function () { + if (arguments.length < 2) { + // calls with 0 or 1 args are deprecated + deprecate('weirdfunction args < 2') + } else if (typeof arguments[0] !== 'string') { + // calls with non-string first argument are deprecated + deprecate('weirdfunction non-string first arg') + } +} +``` + +### Deprecating property access + +This will display a deprecated message about "oldprop" being deprecated +from "my-module" on STDERR when accessed. A deprecation will be displayed +when setting the value and when getting the value. + +```js +var deprecate = require('depd')('my-cool-module') + +exports.oldprop = 'something' + +// message automatically derives from property name +deprecate.property(exports, 'oldprop') + +// explicit message +deprecate.property(exports, 'oldprop', 'oldprop >= 0.10') +``` + +## License + +The MIT License (MIT) + +Copyright (c) 2014 Douglas Christopher Wilson + +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/node_modules/express-session/node_modules/depd/index.js b/node_modules/express-session/node_modules/depd/index.js new file mode 100644 index 0000000..a6fb372 --- /dev/null +++ b/node_modules/express-session/node_modules/depd/index.js @@ -0,0 +1,520 @@ +/*! + * depd + * Copyright(c) 2014 Douglas Christopher Wilson + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var EventEmitter = require('events').EventEmitter +var relative = require('path').relative + +/** + * Module exports. + */ + +module.exports = depd + +/** + * Get the path to base files on. + */ + +var basePath = process.cwd() + +/** + * Get listener count on event emitter. + */ + +/*istanbul ignore next*/ +var eventListenerCount = EventEmitter.listenerCount + || function (emitter, type) { return emitter.listeners(type).length } + +/** + * Determine if namespace is contained in the string. + */ + +function containsNamespace(str, namespace) { + var val = str.split(/[ ,]+/) + + namespace = String(namespace).toLowerCase() + + for (var i = 0 ; i < val.length; i++) { + if (!(str = val[i])) continue; + + // namespace contained + if (str === '*' || str.toLowerCase() === namespace) { + return true + } + } + + return false +} + +/** + * Convert a data descriptor to accessor descriptor. + */ + +function convertDataDescriptorToAccessor(obj, prop, message) { + var descriptor = Object.getOwnPropertyDescriptor(obj, prop) + var value = descriptor.value + + descriptor.get = function getter() { return value } + + if (descriptor.writable) { + descriptor.set = function setter(val) { return value = val } + } + + delete descriptor.value + delete descriptor.writable + + Object.defineProperty(obj, prop, descriptor) + + return descriptor +} + +/** + * Create arguments string to keep arity. + */ + +function createArgumentsString(arity) { + var str = '' + + for (var i = 0; i < arity; i++) { + str += ', arg' + i + } + + return str.substr(2) +} + +/** + * Create stack string from stack. + */ + +function createStackString(stack) { + var str = this.name + ': ' + this.namespace + + if (this.message) { + str += ' deprecated ' + this.message + } + + for (var i = 0; i < stack.length; i++) { + str += '\n at ' + stack[i].toString() + } + + return str +} + +/** + * Create deprecate for namespace in caller. + */ + +function depd(namespace) { + if (!namespace) { + throw new TypeError('argument namespace is required') + } + + var stack = getStack() + var site = callSiteLocation(stack[1]) + var file = site[0] + + function deprecate(message) { + // call to self as log + log.call(deprecate, message) + } + + deprecate._file = file + deprecate._ignored = isignored(namespace) + deprecate._namespace = namespace + deprecate._traced = istraced(namespace) + deprecate._warned = Object.create(null) + + deprecate.function = wrapfunction + deprecate.property = wrapproperty + + return deprecate +} + +/** + * Determine if namespace is ignored. + */ + +function isignored(namespace) { + /* istanbul ignore next: tested in a child processs */ + if (process.noDeprecation) { + // --no-deprecation support + return true + } + + var str = process.env.NO_DEPRECATION || '' + + // namespace ignored + return containsNamespace(str, namespace) +} + +/** + * Determine if namespace is traced. + */ + +function istraced(namespace) { + /* istanbul ignore next: tested in a child processs */ + if (process.traceDeprecation) { + // --trace-deprecation support + return true + } + + var str = process.env.TRACE_DEPRECATION || '' + + // namespace traced + return containsNamespace(str, namespace) +} + +/** + * Display deprecation message. + */ + +function log(message, site) { + var haslisteners = eventListenerCount(process, 'deprecation') !== 0 + + // abort early if no destination + if (!haslisteners && this._ignored) { + return + } + + var caller + var callFile + var callSite + var i = 0 + var seen = false + var stack = getStack() + var file = this._file + + if (site) { + // provided site + callSite = callSiteLocation(stack[1]) + callSite.name = site.name + file = callSite[0] + } else { + // get call site + i = 2 + site = callSiteLocation(stack[i]) + callSite = site + } + + // get caller of deprecated thing in relation to file + for (; i < stack.length; i++) { + caller = callSiteLocation(stack[i]) + callFile = caller[0] + + if (callFile === file) { + seen = true + } else if (callFile === this._file) { + file = this._file + } else if (seen) { + break + } + } + + var key = caller + ? site.join(':') + '__' + caller.join(':') + : undefined + + if (key !== undefined && key in this._warned) { + // already warned + return + } + + this._warned[key] = true + + // generate automatic message from call site + if (!message) { + message = callSite === site || !callSite.name + ? defaultMessage(site) + : defaultMessage(callSite) + } + + // emit deprecation if listeners exist + if (haslisteners) { + var err = DeprecationError(this._namespace, message, stack.slice(i)) + process.emit('deprecation', err) + return + } + + // format and write message + var format = process.stderr.isTTY + ? formatColor + : formatPlain + var msg = format.call(this, message, caller, stack.slice(i)) + process.stderr.write(msg + '\n', 'utf8') + + return +} + +/** + * Get call site location as array. + */ + +function callSiteLocation(callSite) { + var file = callSite.getFileName() || '' + var line = callSite.getLineNumber() + var colm = callSite.getColumnNumber() + + if (callSite.isEval()) { + file = callSite.getEvalOrigin() + ', ' + file + } + + var site = [file, line, colm] + + site.callSite = callSite + site.name = callSite.getFunctionName() + + return site +} + +/** + * Generate a default message from the site. + */ + +function defaultMessage(site) { + var callSite = site.callSite + var funcName = site.name + var typeName = callSite.getTypeName() + + // make useful anonymous name + if (!funcName) { + funcName = '' + } + + // make useful type name + if (typeName === 'Function') { + typeName = callSite.getThis().name || typeName + } + + return callSite.getMethodName() + ? typeName + '.' + funcName + : funcName +} + +/** + * Format deprecation message without color. + */ + +function formatPlain(msg, caller, stack) { + var timestamp = new Date().toUTCString() + + var formatted = timestamp + + ' ' + this._namespace + + ' deprecated ' + msg + + // add stack trace + if (this._traced) { + for (var i = 0; i < stack.length; i++) { + formatted += '\n at ' + stack[i].toString() + } + + return formatted + } + + if (caller) { + formatted += ' at ' + formatLocation(caller) + } + + return formatted +} + +/** + * Format deprecation message with color. + */ + +function formatColor(msg, caller, stack) { + var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' // bold cyan + + ' \x1b[33;1mdeprecated\x1b[22;39m' // bold yellow + + ' \x1b[0m' + msg + '\x1b[39m' // reset + + // add stack trace + if (this._traced) { + for (var i = 0; i < stack.length; i++) { + formatted += '\n \x1b[36mat ' + stack[i].toString() + '\x1b[39m' // cyan + } + + return formatted + } + + if (caller) { + formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m' // cyan + } + + return formatted +} + +/** + * Format call site location. + */ + +function formatLocation(callSite) { + return relative(basePath, callSite[0]) + + ':' + callSite[1] + + ':' + callSite[2] +} + +/** + * Get the stack as array of call sites. + */ + +function getStack() { + var limit = Error.stackTraceLimit + var obj = {} + var prep = Error.prepareStackTrace + + Error.prepareStackTrace = prepareObjectStackTrace + Error.stackTraceLimit = Math.max(10, limit) + + // capture the stack + Error.captureStackTrace(obj) + + // slice this function off the top + var stack = obj.stack.slice(1) + + Error.prepareStackTrace = prep + Error.stackTraceLimit = limit + + return stack +} + +/** + * Capture call site stack from v8. + */ + +function prepareObjectStackTrace(obj, stack) { + return stack +} + +/** + * Return a wrapped function in a deprecation message. + */ + +function wrapfunction(fn, message) { + if (typeof fn !== 'function') { + throw new TypeError('argument fn must be a function') + } + + var args = createArgumentsString(fn.length) + var deprecate = this + var stack = getStack() + var site = callSiteLocation(stack[1]) + + site.name = fn.name + + var deprecatedfn = eval('(function (' + args + ') {\n' + + 'log.call(deprecate, message, site)\n' + + 'return fn.apply(this, arguments)\n' + + '})') + + return deprecatedfn +} + +/** + * Wrap property in a deprecation message. + */ + +function wrapproperty(obj, prop, message) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new TypeError('argument obj must be object') + } + + var descriptor = Object.getOwnPropertyDescriptor(obj, prop) + + if (!descriptor) { + throw new TypeError('must call property on owner object') + } + + if (!descriptor.configurable) { + throw new TypeError('property must be configurable') + } + + var deprecate = this + var stack = getStack() + var site = callSiteLocation(stack[1]) + + // set site name + site.name = prop + + // convert data descriptor + if ('value' in descriptor) { + descriptor = convertDataDescriptorToAccessor(obj, prop, message) + } + + var get = descriptor.get + var set = descriptor.set + + // wrap getter + if (typeof get === 'function') { + descriptor.get = function getter() { + log.call(deprecate, message, site) + return get.apply(this, arguments) + } + } + + // wrap setter + if (typeof set === 'function') { + descriptor.set = function setter() { + log.call(deprecate, message, site) + return set.apply(this, arguments) + } + } + + Object.defineProperty(obj, prop, descriptor) +} + +/** + * Create DeprecationError for deprecation + */ + +function DeprecationError(namespace, message, stack) { + var error = new Error() + var stackString + + Object.defineProperty(error, 'constructor', { + value: DeprecationError + }) + + Object.defineProperty(error, 'message', { + configurable: true, + enumerable: false, + value: message, + writable: true + }) + + Object.defineProperty(error, 'name', { + enumerable: false, + configurable: true, + value: 'DeprecationError', + writable: true + }) + + Object.defineProperty(error, 'namespace', { + configurable: true, + enumerable: false, + value: namespace, + writable: true + }) + + Object.defineProperty(error, 'stack', { + configurable: true, + enumerable: false, + get: function () { + if (stackString !== undefined) { + return stackString + } + + // prepare stack trace + return stackString = createStackString.call(this, stack) + }, + set: function setter(val) { + stackString = val + } + }) + + return error +} diff --git a/node_modules/express-session/node_modules/depd/package.json b/node_modules/express-session/node_modules/depd/package.json new file mode 100644 index 0000000..9a1a84c --- /dev/null +++ b/node_modules/express-session/node_modules/depd/package.json @@ -0,0 +1,43 @@ +{ + "name": "depd", + "description": "Deprecate all the things", + "version": "0.4.4", + "author": { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + "license": "MIT", + "keywords": [ + "deprecate", + "deprecated" + ], + "repository": { + "type": "git", + "url": "git://github.com/dougwilson/nodejs-depd" + }, + "devDependencies": { + "istanbul": "0.3.0", + "mocha": "~1.20.1", + "should": "~4.0.4" + }, + "engines": { + "node": ">= 0.8.0" + }, + "scripts": { + "test": "mocha --reporter spec --bail --require should test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --require should test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --require should test/" + }, + "readme": "# depd\n\n[![NPM version](https://badge.fury.io/js/depd.svg)](http://badge.fury.io/js/depd)\n[![Build Status](https://travis-ci.org/dougwilson/nodejs-depd.svg?branch=master)](https://travis-ci.org/dougwilson/nodejs-depd)\n[![Coverage Status](https://img.shields.io/coveralls/dougwilson/nodejs-depd.svg?branch=master)](https://coveralls.io/r/dougwilson/nodejs-depd)\n[![Gittip](http://img.shields.io/gittip/dougwilson.svg)](https://www.gittip.com/dougwilson/)\n\nDeprecate all the things\n\n> With great modules comes great responsibility; mark things deprecated!\n\n## Install\n\n```sh\n$ npm install depd\n```\n\n## API\n\n```js\nvar deprecate = require('depd')('my-module')\n```\n\nThis library allows you to display deprecation messages to your users.\nThis library goes above and beyond with deprecation warnings by\nintrospecting the call stack (but only the bits that it is interested\nin).\n\nInstead of just warning on the first invocation of a deprecated\nfunction and never again, this module will warn on the first invocation\nof a deprecated function per unique call site, making it ideal to alert\nusers of all deprecated uses across the code base, rather than just\nwhatever happens to execute first.\n\nThe deprecation warnings from this module also include the file and line\ninformation for the call into the module that the deprecated function was\nin.\n\n### depd(namespace)\n\nCreate a new deprecate function that uses the given namespace name in the\nmessages and will display the call site prior to the stack entering the\nfile this function was called from. It is highly suggested you use the\nname of your module as the namespace.\n\n### deprecate(message)\n\nCall this function from deprecated code to display a deprecation message.\nThis message will appear once per unique caller site. Caller site is the\nfirst call site in the stack in a different file from the caller of this\nfunction.\n\nIf the message is omitted, a message is generated for you based on the site\nof the `deprecate()` call and will display the name of the function called,\nsimilar to the name displayed in a stack trace.\n\n### deprecate.function(fn, message)\n\nCall this function to wrap a given function in a deprecation message on any\ncall to the function. An optional message can be supplied to provide a custom\nmessage.\n\n### deprecate.property(obj, prop, message)\n\nCall this function to wrap a given property on object in a deprecation message\non any accessing or setting of the property. An optional message can be supplied\nto provide a custom message.\n\nThe method must be called on the object where the property belongs (not\ninherited from the prototype).\n\nIf the property is a data descriptor, it will be converted to an accessor\ndescriptor in order to display the deprecation message.\n\n### process.on('deprecation', fn)\n\nThis module will allow easy capturing of deprecation errors by emitting the\nerrors as the type \"deprecation\" on the global `process`. If there are no\nlisteners for this type, the errors are written to STDERR as normal, but if\nthere are any listeners, nothing will be written to STDERR and instead only\nemitted. From there, you can write the errors in a different format or to a\nlogging source.\n\nThe error represents the deprecation and is emitted only once with the same\nrules as writing to STDERR. The error has the following properties:\n\n - `message` - This is the message given by the library\n - `name` - This is always `'DeprecationError'`\n - `namespace` - This is the namespace the deprecation came from\n - `stack` - This is the stack of the call to the deprecated thing\n\nExample `error.stack` output:\n\n```\nDeprecationError: my-cool-module deprecated oldfunction\n at Object. ([eval]-wrapper:6:22)\n at Module._compile (module.js:456:26)\n at evalScript (node.js:532:25)\n at startup (node.js:80:7)\n at node.js:902:3\n```\n\n### process.env.NO_DEPRECATION\n\nAs a user of modules that are deprecated, the environment variable `NO_DEPRECATION`\nis provided as a quick solution to silencing deprecation warnings from being\noutput. The format of this is similar to that of `DEBUG`:\n\n```sh\n$ NO_DEPRECATION=my-module,othermod node app.js\n```\n\nThis will suppress deprecations from being output for \"my-module\" and \"othermod\".\nThe value is a list of comma-separated namespaces. To suppress every warning\nacross all namespaces, use the value `*` for a namespace.\n\nProviding the argument `--no-deprecation` to the `node` executable will suppress\nall deprecations.\n\n**NOTE** This will not suppress the deperecations given to any \"deprecation\"\nevent listeners, just the output to STDERR.\n\n### process.env.TRACE_DEPRECATION\n\nAs a user of modules that are deprecated, the environment variable `TRACE_DEPRECATION`\nis provided as a solution to getting more detailed location information in deprecation\nwarnings by including the entire stack trace. The format of this is the same as\n`NO_DEPRECATION`:\n\n```sh\n$ TRACE_DEPRECATION=my-module,othermod node app.js\n```\n\nThis will include stack traces for deprecations being output for \"my-module\" and\n\"othermod\". The value is a list of comma-separated namespaces. To trace every\nwarning across all namespaces, use the value `*` for a namespace.\n\nProviding the argument `--trace-deprecation` to the `node` executable will trace\nall deprecations.\n\n**NOTE** This will not trace the deperecations silenced by `NO_DEPRECATION`.\n\n## Display\n\n![message](files/message.png)\n\nWhen a user calls a function in your library that you mark deprecated, they\nwill see the following written to STDERR (in the given colors, similar colors\nand layout to the `debug` module):\n\n```\nbright cyan bright yellow\n| | reset cyan\n| | | |\n▼ ▼ ▼ ▼\nmy-cool-module deprecated oldfunction [eval]-wrapper:6:22\n▲ ▲ ▲ ▲\n| | | |\nnamespace | | location of mycoolmod.oldfunction() call\n | deprecation message\n the word \"deprecated\"\n```\n\nIf the user redirects their STDERR to a file or somewhere that does not support\ncolors, they see (similar layout to the `debug` module):\n\n```\nSun, 15 Jun 2014 05:21:37 GMT my-cool-module deprecated oldfunction at [eval]-wrapper:6:22\n▲ ▲ ▲ ▲ ▲\n| | | | |\ntimestamp of message namespace | | location of mycoolmod.oldfunction() call\n | deprecation message\n the word \"deprecated\"\n```\n\n## Examples\n\n### Deprecating all calls to a function\n\nThis will display a deprecated message about \"oldfunction\" being deprecated\nfrom \"my-module\" on STDERR.\n\n```js\nvar deprecate = require('depd')('my-cool-module')\n\n// message automatically derived from function name\n// Object.oldfunction\nexports.oldfunction = deprecate.function(function oldfunction() {\n // all calls to function are deprecated\n})\n\n// specific message\nexports.oldfunction = deprecate.function(function () {\n // all calls to function are deprecated\n}, 'oldfunction')\n```\n\n### Conditionally deprecating a function call\n\nThis will display a deprecated message about \"weirdfunction\" being deprecated\nfrom \"my-module\" on STDERR when called with less than 2 arguments.\n\n```js\nvar deprecate = require('depd')('my-cool-module')\n\nexports.weirdfunction = function () {\n if (arguments.length < 2) {\n // calls with 0 or 1 args are deprecated\n deprecate('weirdfunction args < 2')\n }\n}\n```\n\nWhen calling `deprecate` as a function, the warning is counted per call site\nwithin your own module, so you can display different deprecations depending\non different situations and the users will still get all the warnings:\n\n```js\nvar deprecate = require('depd')('my-cool-module')\n\nexports.weirdfunction = function () {\n if (arguments.length < 2) {\n // calls with 0 or 1 args are deprecated\n deprecate('weirdfunction args < 2')\n } else if (typeof arguments[0] !== 'string') {\n // calls with non-string first argument are deprecated\n deprecate('weirdfunction non-string first arg')\n }\n}\n```\n\n### Deprecating property access\n\nThis will display a deprecated message about \"oldprop\" being deprecated\nfrom \"my-module\" on STDERR when accessed. A deprecation will be displayed\nwhen setting the value and when getting the value.\n\n```js\nvar deprecate = require('depd')('my-cool-module')\n\nexports.oldprop = 'something'\n\n// message automatically derives from property name\ndeprecate.property(exports, 'oldprop')\n\n// explicit message\ndeprecate.property(exports, 'oldprop', 'oldprop >= 0.10')\n```\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 Douglas Christopher Wilson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n", + "readmeFilename": "Readme.md", + "bugs": { + "url": "https://github.com/dougwilson/nodejs-depd/issues" + }, + "homepage": "https://github.com/dougwilson/nodejs-depd", + "_id": "depd@0.4.4", + "dist": { + "shasum": "006034f41204a7af85b489297937806a8de3ef62" + }, + "_from": "depd@0.4.4", + "_resolved": "https://registry.npmjs.org/depd/-/depd-0.4.4.tgz" +} diff --git a/node_modules/express-session/node_modules/on-headers/.npmignore b/node_modules/express-session/node_modules/on-headers/.npmignore new file mode 100644 index 0000000..ac0bfb9 --- /dev/null +++ b/node_modules/express-session/node_modules/on-headers/.npmignore @@ -0,0 +1,2 @@ +test/ +.travis.yml diff --git a/node_modules/express-session/node_modules/on-headers/History.md b/node_modules/express-session/node_modules/on-headers/History.md new file mode 100644 index 0000000..369468c --- /dev/null +++ b/node_modules/express-session/node_modules/on-headers/History.md @@ -0,0 +1,4 @@ +0.0.0 / 2014-05-13 +================== + + * Genesis from `connect` diff --git a/node_modules/express-session/node_modules/on-headers/LICENSE b/node_modules/express-session/node_modules/on-headers/LICENSE new file mode 100644 index 0000000..b7dce6c --- /dev/null +++ b/node_modules/express-session/node_modules/on-headers/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2014 Douglas Christopher Wilson + +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/node_modules/express-session/node_modules/on-headers/README.md b/node_modules/express-session/node_modules/on-headers/README.md new file mode 100644 index 0000000..3b9bdd4 --- /dev/null +++ b/node_modules/express-session/node_modules/on-headers/README.md @@ -0,0 +1,70 @@ +# on-headers [![Build Status](https://travis-ci.org/expressjs/on-headers.svg)](https://travis-ci.org/expressjs/on-headers) [![NPM version](https://badge.fury.io/js/on-headers.svg)](http://badge.fury.io/js/on-headers) + +Execute a listener when a response is about to write headers. + +## Install + +```sh +$ npm install on-headers +``` + +## API + +```js +var onHeaders = require('on-headers') +``` + +### onHeaders(res, listener) + +This will add the listener `listener` to fire when headers are emitted for `res`. +Headers are considered to be emitted only once, right before they are sent to +the client. + +## Examples + +```js +var http = require('http') +var onHeaders = require('on-headers') + +http +.createServer(onRequest) +.listen(3000) + +function addPoweredBy() { + // add if not set by end of request + if (!this.getHeader('X-Powered-By')) { + this.addHeader('X-Powered-By', 'Node.js') + } +} + +function onRequest(req, res) { + onHeaders(res, addPoweredBy) + + res.setHeader('Content-Type', 'text/plain') + res.end('hello!') +} +``` + +## License + +The MIT License (MIT) + +Copyright (c) 2014 Douglas Christopher Wilson doug@somethingdoug.com + +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/node_modules/express-session/node_modules/on-headers/index.js b/node_modules/express-session/node_modules/on-headers/index.js new file mode 100644 index 0000000..850e059 --- /dev/null +++ b/node_modules/express-session/node_modules/on-headers/index.js @@ -0,0 +1,72 @@ +/*! + * on-headers + * Copyright(c) 2014 Douglas Christopher Wilson + * MIT Licensed + */ + +/** + * Reference to Array slice. + */ + +var slice = Array.prototype.slice + +/** + * Execute a listener when a response is about to write headers. + * + * @param {Object} res + * @return {Function} listener + * @api public + */ + +module.exports = function onHeaders(res, listener) { + if (typeof listener !== 'function') { + throw new TypeError('listener must be a function') + } + + res.writeHead = createWriteHead(res.writeHead, listener) +} + +function createWriteHead(prevWriteHead, listener) { + var fired = false; + + // return function with core name and argument list + return function writeHead(statusCode) { + // set headers from arguments + var args = setWriteHeadHeaders.apply(this, arguments); + + // fire listener + if (!fired) { + fired = true + listener.call(this) + } + + prevWriteHead.apply(this, args); + } +} + +function setWriteHeadHeaders(statusCode) { + var headerIndex = typeof arguments[1] === 'string' + ? 2 + : 1 + + var headers = arguments[headerIndex] + + this.statusCode = statusCode + + // the following block is from node.js core + if (Array.isArray(headers)) { + // handle array case + for (var i = 0, len = headers.length; i < len; ++i) { + this.setHeader(headers[i][0], headers[i][1]) + } + } else if (headers) { + // handle object case + var keys = Object.keys(headers) + for (var i = 0; i < keys.length; i++) { + var k = keys[i] + if (k) this.setHeader(k, headers[k]) + } + } + + return slice.call(arguments, 0, headerIndex) +} diff --git a/node_modules/express-session/node_modules/on-headers/package.json b/node_modules/express-session/node_modules/on-headers/package.json new file mode 100644 index 0000000..983e0e4 --- /dev/null +++ b/node_modules/express-session/node_modules/on-headers/package.json @@ -0,0 +1,43 @@ +{ + "name": "on-headers", + "description": "Execute a listener when a response is about to write headers", + "version": "0.0.0", + "author": { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + "license": "MIT", + "keywords": [ + "event", + "headers", + "http", + "onheaders" + ], + "repository": { + "type": "git", + "url": "https://github.com/expressjs/on-headers.git" + }, + "bugs": { + "url": "https://github.com/expressjs/on-headers/issues" + }, + "dependencies": {}, + "devDependencies": { + "mocha": "~1.18.2", + "supertest": "~0.12.1" + }, + "engines": { + "node": ">= 0.8.0" + }, + "scripts": { + "test": "mocha --reporter spec test/" + }, + "readme": "# on-headers [![Build Status](https://travis-ci.org/expressjs/on-headers.svg)](https://travis-ci.org/expressjs/on-headers) [![NPM version](https://badge.fury.io/js/on-headers.svg)](http://badge.fury.io/js/on-headers)\n\nExecute a listener when a response is about to write headers.\n\n## Install\n\n```sh\n$ npm install on-headers\n```\n\n## API\n\n```js\nvar onHeaders = require('on-headers')\n```\n\n### onHeaders(res, listener)\n\nThis will add the listener `listener` to fire when headers are emitted for `res`.\nHeaders are considered to be emitted only once, right before they are sent to\nthe client.\n\n## Examples\n\n```js\nvar http = require('http')\nvar onHeaders = require('on-headers')\n\nhttp\n.createServer(onRequest)\n.listen(3000)\n\nfunction addPoweredBy() {\n // add if not set by end of request\n if (!this.getHeader('X-Powered-By')) {\n this.addHeader('X-Powered-By', 'Node.js')\n }\n}\n\nfunction onRequest(req, res) {\n onHeaders(res, addPoweredBy)\n\n res.setHeader('Content-Type', 'text/plain')\n res.end('hello!')\n}\n```\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 Douglas Christopher Wilson doug@somethingdoug.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n", + "readmeFilename": "README.md", + "homepage": "https://github.com/expressjs/on-headers", + "_id": "on-headers@0.0.0", + "dist": { + "shasum": "e1bd917f35859aad016317f4f22569ebce440d6e" + }, + "_from": "on-headers@0.0.0", + "_resolved": "https://registry.npmjs.org/on-headers/-/on-headers-0.0.0.tgz" +} diff --git a/node_modules/express-session/node_modules/uid-safe/.npmignore b/node_modules/express-session/node_modules/uid-safe/.npmignore new file mode 100644 index 0000000..72921ab --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/.npmignore @@ -0,0 +1,2 @@ +.DS_Store* +node_modules diff --git a/node_modules/express-session/node_modules/uid-safe/LICENSE b/node_modules/express-session/node_modules/uid-safe/LICENSE new file mode 100644 index 0000000..a7ae8ee --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/LICENSE @@ -0,0 +1,22 @@ + +The MIT License (MIT) + +Copyright (c) 2014 Jonathan Ong me@jongleberry.com + +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/node_modules/express-session/node_modules/uid-safe/README.md b/node_modules/express-session/node_modules/uid-safe/README.md new file mode 100644 index 0000000..2178c6c --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/README.md @@ -0,0 +1,44 @@ + +# UID Safe + +Create cryptographically secure UIDs safe for both cookie and URL usage. +This is in contrast to modules such as [rand-token](https://github.com/sehrope/node-rand-token) +and [uid2](https://github.com/coreh/uid2) whose UIDs are actually skewed +due to the use of `%` and unnecessarily truncate the UID. +Use this if you could still use UIDs with `-` and `_` in them. + +## API + +```js +var uid = require('uid-safe') +``` + +### uid(byteLength, [cb]) + +Asynchronously create a UID with a specific byte length. +Because `base64` encoding is used underneath, this is not the string length! +For example, to create a UID of length 24, you want a byte length of 18! + +If `cb` is not defined, a promise is returned. +However, to use promises, you must either install [bluebird](https://github.com/petkaantonov/bluebird) +or use a version of node.js that has native promises, +otherwise your process will crash and die. + +```js +uid(18).then(function (string) { + // do something with the string +}) + +uid(18, function (err, string) { + if (err) throw err + // do something with the string +}) +``` + +### uid.sync(byteLength) + +A synchronous version of above. + +```js +var string = uid.sync(18) +``` diff --git a/node_modules/express-session/node_modules/uid-safe/index.js b/node_modules/express-session/node_modules/uid-safe/index.js new file mode 100644 index 0000000..9e26461 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/index.js @@ -0,0 +1,27 @@ + +var pseudoRandomBytes = require('crypto').pseudoRandomBytes +var escape = require('base64-url').escape + +var pseudoRandomBytesProm + +module.exports = uid + +function uid(length, cb) { + if (cb) { + return pseudoRandomBytes(length, function (err, buf) { + if (err) return cb(err) + cb(null, escapeBuffer(buf)) + }) + } + + pseudoRandomBytesProm || (pseudoRandomBytesProm = require('mz/crypto').pseudoRandomBytes) + return pseudoRandomBytesProm(length).then(escapeBuffer) +} + +uid.sync = function uid_sync(length) { + return escapeBuffer(pseudoRandomBytes(length)) +} + +function escapeBuffer(buf) { + return escape(buf.toString('base64')) +} diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.npmignore b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.npmignore new file mode 100644 index 0000000..b0e8ee7 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.npmignore @@ -0,0 +1,12 @@ +.*.swp +._* +.DS_Store +.git +.hg +.lock-wscript +.svn +.wafpickle-* +CVS +npm-debug.log +*.sublime-project +*.sublime-workspace \ No newline at end of file diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.travis.yml b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.travis.yml new file mode 100644 index 0000000..9c52355 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.travis.yml @@ -0,0 +1,12 @@ + language: node_js + node_js: + - "0.11" + - "0.10" + - "0.8" + branches: + only: + - master + notifications: + email: + - joaquim.serafim@gmail.com + script: npm test diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/LICENSE b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/LICENSE new file mode 100644 index 0000000..da1b624 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Joaquim José F. Serafim + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/README.md b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/README.md new file mode 100644 index 0000000..aa34ec8 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/README.md @@ -0,0 +1,27 @@ +# base64-url + +Base64 encode, decode, escape and unescape for URL applications. + + + +[![Build Status](https://travis-ci.org/joaquimserafim/base64-url.png?branch=master)](https://travis-ci.org/joaquimserafim/base64-url) + + + +**V1** + + +####API + + > base64url.encode('Node.js is awesome.'); + Tm9kZS5qcyBpcyBhd2Vzb21lLg + + > base64url.decode('Tm9kZS5qcyBpcyBhd2Vzb21lLg'); + Node.js is awesome. + + > base64url.escape(This+is/goingto+escape==); + This-is_goingto-escape + + > base64url.unescape('This-is_goingto-escape'); + This+is/goingto+escape== + \ No newline at end of file diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/index.js b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/index.js new file mode 100644 index 0000000..c5547ee --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/index.js @@ -0,0 +1,17 @@ +var base64url = exports; + +base64url.unescape = function unescape (str) { + return (str + Array(5 - str.length % 4).join('=')).replace(/\-/g,'+').replace(/_/g, '/'); +}; + +base64url.escape = function escape (str) { + return str.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); +}; + +base64url.encode = function encode (str) { + return this.escape(new Buffer(str).toString('base64')); +}; + +base64url.decode = function decode (str) { + return new Buffer(this.unescape(str), 'base64').toString(); +}; diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/package.json b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/package.json new file mode 100644 index 0000000..77803c8 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/package.json @@ -0,0 +1,39 @@ +{ + "name": "base64-url", + "version": "1.0.0", + "description": "Base64 encode, decode, escape and unescape for URL applications", + "main": "index.js", + "directories": { + "test": "test" + }, + "scripts": { + "test": "node test" + }, + "repository": { + "type": "git", + "url": "git://github.com/joaquimserafim/base64-url.git" + }, + "keywords": [ + "base64", + "base64url" + ], + "author": { + "name": "@joaquimserafim" + }, + "license": "ISC", + "bugs": { + "url": "https://github.com/joaquimserafim/base64-url/issues" + }, + "homepage": "https://github.com/joaquimserafim/base64-url", + "devDependencies": { + "tape": "^2.12.3" + }, + "readme": "# base64-url\n\nBase64 encode, decode, escape and unescape for URL applications.\n\n\n\n[![Build Status](https://travis-ci.org/joaquimserafim/base64-url.png?branch=master)](https://travis-ci.org/joaquimserafim/base64-url)\n\n\n\n**V1**\n\n\n####API\n \n \t> base64url.encode('Node.js is awesome.');\n \tTm9kZS5qcyBpcyBhd2Vzb21lLg\n\n \t> base64url.decode('Tm9kZS5qcyBpcyBhd2Vzb21lLg');\n \tNode.js is awesome.\n \n \t> base64url.escape(This+is/goingto+escape==);\n \tThis-is_goingto-escape\n \t\n > base64url.unescape('This-is_goingto-escape');\n This+is/goingto+escape==\n \t", + "readmeFilename": "README.md", + "_id": "base64-url@1.0.0", + "dist": { + "shasum": "ab694376f2801af6c9260899ffef02f86b40ee2c" + }, + "_from": "base64-url@1", + "_resolved": "https://registry.npmjs.org/base64-url/-/base64-url-1.0.0.tgz" +} diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/test/index.js b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/test/index.js new file mode 100644 index 0000000..1c3c4ed --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/test/index.js @@ -0,0 +1,24 @@ +var test = require('tape'); +var base64url = require('../'); + + +test('base64url', function (t) { + t.plan(4); + + var text = 'Node.js is awesome.'; + + var encode = base64url.encode(text); + t.ok(encode, 'encode: ' + encode); + + var decode = base64url.decode(encode); + t.deepEqual(decode, text, 'decode: ' + decode); + + var text_escape = 'This+is/goingto+escape=='; + console.log(text_escape); + + var escape = base64url.escape(text_escape); + t.equal(escape.match(/\+|\//g), null, 'escape (omit + and /): ' + escape); + + var unescape = base64url.unescape(escape); + t.equal(unescape.match(/\-|_/g), null, 'unescape (back to first form): ' + unescape); +}); diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/.npmignore b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/.npmignore new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/.npmignore @@ -0,0 +1 @@ +test diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/.travis.yml b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/.travis.yml new file mode 100644 index 0000000..4a10bc4 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - '0.11' + - '0.10' + - '0.8' diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/HISTORY.md b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/HISTORY.md new file mode 100644 index 0000000..57d20a0 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/HISTORY.md @@ -0,0 +1,6 @@ + +1.0.0 / 2014-06-18 +================== + + * use `bluebird` by default if found + * support node 0.8 diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/LICENSE b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/LICENSE new file mode 100644 index 0000000..a7ae8ee --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/LICENSE @@ -0,0 +1,22 @@ + +The MIT License (MIT) + +Copyright (c) 2014 Jonathan Ong me@jongleberry.com + +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/node_modules/express-session/node_modules/uid-safe/node_modules/mz/README.md b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/README.md new file mode 100644 index 0000000..fac80d9 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/README.md @@ -0,0 +1,89 @@ + +# MZ - Modernize node.js + +Modernize node.js to current ECMAScript specifications! +node.js will not update their API to ES6+ [for a while](https://github.com/joyent/node/issues/7549). +This library is a wrapper for various aspects of node.js' API. + +## Installation and Usage + +Set `mz` as a dependency and install it. + +```bash +npm i mz +``` + +Then prefix the relevant `require()`s with `mz/`: + +```js +var fs = require('mz/fs') + +fs.exists(__filename).then(function (exists) { + if (exists) // do something +}) +``` + +Personally, I use this with generator-based control flow libraries such as [co](https://github.com/visionmedia/co) so I don't need to use implementation-specific wrappers like [co-fs](https://github.com/visionmedia/co-fs). + +```js +var co = require('co') +var fs = require('mz/fs') + +co(function* () { + if (yield fs.exists(__filename)) // do something +})() +``` + +## Promisification + +Many node methods are converted into promises. +Any properties that are deprecated or aren't asynchronous will simply be proxied. +The modules wrapped are: + +- `child_process` +- `crypto` +- `dns` +- `fs` +- `zlib` + +```js +var exec = require('mz/child_process').exec + +exec('node --version').then(function (stdout) { + console.log(stdout) +}) +``` + +## Promise Engine + +If you've installed [bluebird][bluebird], +[bluebird][bluebird] will be used. +`mz` does not install [bluebird][bluebird] for you. + +Otherwise, if you're using a node that has native v8 Promises (v0.11.13+), +then that will be used. + +Otherwise, this library will crash the process and exit, +so you might as well install [bluebird][bluebird] as a dependency! + +## FAQ + +### Can I use this in production? + +If you do, you should probably install [bluebird][bluebird] as +native v8 promises are still pretty raw. + +### Will this make my app faster? + +Nope, probably slower actually. + +### Can I add more features? + +Sure. +Open an issue. + +Currently, the plans are to eventually support: + +- ECMAScript7 Streams + +[bluebird]: https://github.com/petkaantonov/bluebird diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify.js b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify.js new file mode 100644 index 0000000..87853b3 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify.js @@ -0,0 +1,54 @@ + +var promisify +try { + promisify = require('bluebird').promisify +} catch (_) {} + +if (promisify) { + module.exports = function mz_promisify(name, fn) { + return promisify(fn) + } +} else { + if (typeof Promise !== 'function') { + console.error() + console.error('mz: a `Promise` implementation could not be found.') + console.error('mz: please use a version of node that has native Promises') + console.error('mz: or `npm i bluebird`') + console.error() + process.exit(1) + } + + module.exports = function mz_promisify(name, fn) { + return eval('(function ' + name + '() {\n' + + 'var len = arguments.length\n' + + 'var args = new Array(len + 1)\n' + + 'for (var i = 0; i < len; ++i) args[i] = arguments[i]\n' + + 'var lastIndex = i\n' + + 'return new Promise(function (resolve, reject) {\n' + + 'args[lastIndex] = makeCallback(resolve, reject)\n' + + 'fn.apply(null, args)\n' + + '})\n' + + '})') + } +} + +module.exports.bluebird = !!promisify + +function makeCallback(resolve, reject) { + return function(err, value) { + if (err) { + reject(err) + } else { + var len = arguments.length + if (len > 2) { + var values = new Array(len - 1) + for (var i = 1; i < len; ++i) { + values[i - 1] = arguments[i] + } + resolve(values) + } else { + resolve(value) + } + } + } +} diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify_all.js b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify_all.js new file mode 100644 index 0000000..1edb209 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify_all.js @@ -0,0 +1,24 @@ + +var promisify = require('./_promisify.js') + +module.exports = function (source, exports, methods) { + methods.forEach(function (name) { + if (deprecated(source, name)) return + if (typeof source[name] === 'function') + exports[name] = promisify(name, source[name]) + }) + + // proxy the rest + Object.keys(source).forEach(function (name) { + if (deprecated(source, name)) return + if (exports[name]) return + exports[name] = source[name] + }) +} + +function deprecated(source, name) { + var desc = Object.getOwnPropertyDescriptor(source, name) + if (!desc || !desc.get) return false + if (desc.get.name === 'deprecated') return true + return false +} diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/child_process.js b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/child_process.js new file mode 100644 index 0000000..a4b5162 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/child_process.js @@ -0,0 +1,8 @@ + +require('./_promisify_all')( + require('child_process'), + exports, [ + 'exec', + 'execFile', + ] +) diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/crypto.js b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/crypto.js new file mode 100644 index 0000000..58a0392 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/crypto.js @@ -0,0 +1,9 @@ + +require('./_promisify_all')( + require('crypto'), + exports, [ + 'pbkdf2', + 'randomBytes', + 'pseudoRandomBytes', + ] +) diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/dns.js b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/dns.js new file mode 100644 index 0000000..ed45826 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/dns.js @@ -0,0 +1,16 @@ + +require('./_promisify_all')( + require('dns'), + exports, [ + 'lookup', + 'resolve', + 'resolve4', + 'resolve6', + 'resolveMx', + 'resolveTxt', + 'resolveSrv', + 'resolveNs', + 'resolveCname', + 'reverse', + ] +) diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/fs.js b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/fs.js new file mode 100644 index 0000000..5ea92c7 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/fs.js @@ -0,0 +1,42 @@ + +var fs = require('fs') + +require('./_promisify_all.js')(fs, exports, [ + 'rename', + 'ftruncate', + 'chown', + 'fchown', + 'lchown', + 'chmod', + 'fchmod', + 'stat', + 'lstat', + 'fstat', + 'link', + 'symlink', + 'readlink', + 'realpath', + 'unlink', + 'rmdir', + 'mkdir', + 'readdir', + 'close', + 'open', + 'utimes', + 'futimes', + 'fsync', + 'write', + 'read', + 'readFile', + 'writeFile', + 'appendFile', +]) + +var promisify = require('./_promisify.js') + +// don't know enough about promises to do this haha +exports.exists = promisify('exists', function exists(filename, done) { + fs.stat(filename, function (err) { + done(null, !err) + }) +}) diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/package.json b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/package.json new file mode 100644 index 0000000..af52df4 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/package.json @@ -0,0 +1,34 @@ +{ + "name": "mz", + "description": "modernize node.js to current ECMAScript standards", + "version": "1.0.0", + "author": { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git://github.com/normalize/mz" + }, + "devDependencies": { + "bluebird": "2", + "mocha": "1" + }, + "scripts": { + "test": "mocha --reporter spec --bail" + }, + "readme": "\n# MZ - Modernize node.js\n\nModernize node.js to current ECMAScript specifications!\nnode.js will not update their API to ES6+ [for a while](https://github.com/joyent/node/issues/7549).\nThis library is a wrapper for various aspects of node.js' API.\n\n## Installation and Usage\n\nSet `mz` as a dependency and install it.\n\n```bash\nnpm i mz\n```\n\nThen prefix the relevant `require()`s with `mz/`:\n\n```js\nvar fs = require('mz/fs')\n\nfs.exists(__filename).then(function (exists) {\n if (exists) // do something\n})\n```\n\nPersonally, I use this with generator-based control flow libraries such as [co](https://github.com/visionmedia/co) so I don't need to use implementation-specific wrappers like [co-fs](https://github.com/visionmedia/co-fs).\n\n```js\nvar co = require('co')\nvar fs = require('mz/fs')\n\nco(function* () {\n if (yield fs.exists(__filename)) // do something\n})()\n```\n\n## Promisification\n\nMany node methods are converted into promises.\nAny properties that are deprecated or aren't asynchronous will simply be proxied.\nThe modules wrapped are:\n\n- `child_process`\n- `crypto`\n- `dns`\n- `fs`\n- `zlib`\n\n```js\nvar exec = require('mz/child_process').exec\n\nexec('node --version').then(function (stdout) {\n console.log(stdout)\n})\n```\n\n## Promise Engine\n\nIf you've installed [bluebird][bluebird],\n[bluebird][bluebird] will be used.\n`mz` does not install [bluebird][bluebird] for you.\n\nOtherwise, if you're using a node that has native v8 Promises (v0.11.13+),\nthen that will be used.\n\nOtherwise, this library will crash the process and exit,\nso you might as well install [bluebird][bluebird] as a dependency!\n\n## FAQ\n\n### Can I use this in production?\n\nIf you do, you should probably install [bluebird][bluebird] as\nnative v8 promises are still pretty raw.\n\n### Will this make my app faster?\n\nNope, probably slower actually.\n\n### Can I add more features?\n\nSure.\nOpen an issue.\n\nCurrently, the plans are to eventually support:\n\n- ECMAScript7 Streams\n\n[bluebird]: https://github.com/petkaantonov/bluebird\n", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/normalize/mz/issues" + }, + "homepage": "https://github.com/normalize/mz", + "_id": "mz@1.0.0", + "dist": { + "shasum": "1a2354f3ee6030fbc5a0f560da9d60a62781f1f1" + }, + "_from": "mz@1", + "_resolved": "https://registry.npmjs.org/mz/-/mz-1.0.0.tgz" +} diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/zlib.js b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/zlib.js new file mode 100644 index 0000000..5cf3222 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/zlib.js @@ -0,0 +1,13 @@ + +require('./_promisify_all')( + require('zlib'), + exports, [ + 'deflate', + 'deflateRaw', + 'gzip', + 'gunzip', + 'inflate', + 'inflateRaw', + 'unzip', + ] +) diff --git a/node_modules/express-session/node_modules/uid-safe/package.json b/node_modules/express-session/node_modules/uid-safe/package.json new file mode 100644 index 0000000..8151c4c --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/package.json @@ -0,0 +1,38 @@ +{ + "name": "uid-safe", + "description": "URL and cookie safe UIDs", + "version": "1.0.1", + "author": { + "name": "Jonathan Ong", + "email": "me@jongleberry.com", + "url": "http://jongleberry.com" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git://github.com/crypto-utils/uid-safe" + }, + "dependencies": { + "mz": "1", + "base64-url": "1" + }, + "devDependencies": { + "bluebird": "2", + "mocha": "1" + }, + "scripts": { + "test": "mocha --reporter spec --bail" + }, + "readme": "\n# UID Safe\n\nCreate cryptographically secure UIDs safe for both cookie and URL usage.\nThis is in contrast to modules such as [rand-token](https://github.com/sehrope/node-rand-token)\nand [uid2](https://github.com/coreh/uid2) whose UIDs are actually skewed\ndue to the use of `%` and unnecessarily truncate the UID.\nUse this if you could still use UIDs with `-` and `_` in them.\n\n## API\n\n```js\nvar uid = require('uid-safe')\n```\n\n### uid(byteLength, [cb])\n\nAsynchronously create a UID with a specific byte length.\nBecause `base64` encoding is used underneath, this is not the string length!\nFor example, to create a UID of length 24, you want a byte length of 18!\n\nIf `cb` is not defined, a promise is returned.\nHowever, to use promises, you must either install [bluebird](https://github.com/petkaantonov/bluebird)\nor use a version of node.js that has native promises,\notherwise your process will crash and die.\n\n```js\nuid(18).then(function (string) {\n // do something with the string\n})\n\nuid(18, function (err, string) {\n if (err) throw err\n // do something with the string\n})\n```\n\n### uid.sync(byteLength)\n\nA synchronous version of above.\n\n```js\nvar string = uid.sync(18)\n```\n", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/crypto-utils/uid-safe/issues" + }, + "homepage": "https://github.com/crypto-utils/uid-safe", + "_id": "uid-safe@1.0.1", + "dist": { + "shasum": "5bd148460a2e84f54f193fd20352c8c3d7de6ac8" + }, + "_from": "uid-safe@1.0.1", + "_resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-1.0.1.tgz" +} diff --git a/node_modules/express-session/node_modules/uid-safe/test.js b/node_modules/express-session/node_modules/uid-safe/test.js new file mode 100644 index 0000000..3665fb9 --- /dev/null +++ b/node_modules/express-session/node_modules/uid-safe/test.js @@ -0,0 +1,46 @@ + +var assert = require('assert') + +var uid = require('./') + +describe('uid-url', function () { + describe('uid()', function () { + it('should return a uid of the correct length', function () { + return uid(18).then(function (val) { + assert.equal(24, Buffer.byteLength(val)) + }) + }) + + it('should not contain +, /, or =', function () { + return uid(100000).then(function (val) { + assert(!~val.indexOf('+')) + assert(!~val.indexOf('/')) + assert(!~val.indexOf('=')) + }) + }) + + it('should support callbacks', function (done) { + uid(1000000, function (err, val) { + if (err) return done(err) + assert(!~val.indexOf('+')) + assert(!~val.indexOf('/')) + assert(!~val.indexOf('=')) + done() + }) + }) + }) + + describe('uid.sync()', function () { + it('should return a uid of the correct length', function () { + var val = uid.sync(18) + assert.equal(24, Buffer.byteLength(val)) + }) + + it('should not contain +, /, or =', function () { + var val = uid.sync(100000) + assert(!~val.indexOf('+')) + assert(!~val.indexOf('/')) + assert(!~val.indexOf('=')) + }) + }) +}) diff --git a/node_modules/express-session/node_modules/utils-merge/.travis.yml b/node_modules/express-session/node_modules/utils-merge/.travis.yml new file mode 100644 index 0000000..af92b02 --- /dev/null +++ b/node_modules/express-session/node_modules/utils-merge/.travis.yml @@ -0,0 +1,6 @@ +language: "node_js" +node_js: + - "0.4" + - "0.6" + - "0.8" + - "0.10" diff --git a/node_modules/express-session/node_modules/utils-merge/LICENSE b/node_modules/express-session/node_modules/utils-merge/LICENSE new file mode 100644 index 0000000..e33bd10 --- /dev/null +++ b/node_modules/express-session/node_modules/utils-merge/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2013 Jared Hanson + +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/node_modules/express-session/node_modules/utils-merge/README.md b/node_modules/express-session/node_modules/utils-merge/README.md new file mode 100644 index 0000000..2f94e9b --- /dev/null +++ b/node_modules/express-session/node_modules/utils-merge/README.md @@ -0,0 +1,34 @@ +# utils-merge + +Merges the properties from a source object into a destination object. + +## Install + + $ npm install utils-merge + +## Usage + +```javascript +var a = { foo: 'bar' } + , b = { bar: 'baz' }; + +merge(a, b); +// => { foo: 'bar', bar: 'baz' } +``` + +## Tests + + $ npm install + $ npm test + +[![Build Status](https://secure.travis-ci.org/jaredhanson/utils-merge.png)](http://travis-ci.org/jaredhanson/utils-merge) + +## Credits + + - [Jared Hanson](http://github.com/jaredhanson) + +## License + +[The MIT License](http://opensource.org/licenses/MIT) + +Copyright (c) 2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)> diff --git a/node_modules/express-session/node_modules/utils-merge/index.js b/node_modules/express-session/node_modules/utils-merge/index.js new file mode 100644 index 0000000..4265c69 --- /dev/null +++ b/node_modules/express-session/node_modules/utils-merge/index.js @@ -0,0 +1,23 @@ +/** + * Merge object b with object a. + * + * var a = { foo: 'bar' } + * , b = { bar: 'baz' }; + * + * merge(a, b); + * // => { foo: 'bar', bar: 'baz' } + * + * @param {Object} a + * @param {Object} b + * @return {Object} + * @api public + */ + +exports = module.exports = function(a, b){ + if (a && b) { + for (var key in b) { + a[key] = b[key]; + } + } + return a; +}; diff --git a/node_modules/express-session/node_modules/utils-merge/package.json b/node_modules/express-session/node_modules/utils-merge/package.json new file mode 100644 index 0000000..77f3dd3 --- /dev/null +++ b/node_modules/express-session/node_modules/utils-merge/package.json @@ -0,0 +1,47 @@ +{ + "name": "utils-merge", + "version": "1.0.0", + "description": "merge() utility function", + "keywords": [ + "util" + ], + "repository": { + "type": "git", + "url": "git://github.com/jaredhanson/utils-merge.git" + }, + "bugs": { + "url": "http://github.com/jaredhanson/utils-merge/issues" + }, + "author": { + "name": "Jared Hanson", + "email": "jaredhanson@gmail.com", + "url": "http://www.jaredhanson.net/" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/MIT" + } + ], + "main": "./index", + "dependencies": {}, + "devDependencies": { + "mocha": "1.x.x", + "chai": "1.x.x" + }, + "scripts": { + "test": "mocha --reporter spec --require test/bootstrap/node test/*.test.js" + }, + "engines": { + "node": ">= 0.4.0" + }, + "readme": "# utils-merge\n\nMerges the properties from a source object into a destination object.\n\n## Install\n\n $ npm install utils-merge\n\n## Usage\n\n```javascript\nvar a = { foo: 'bar' }\n , b = { bar: 'baz' };\n\nmerge(a, b);\n// => { foo: 'bar', bar: 'baz' }\n```\n\n## Tests\n\n $ npm install\n $ npm test\n\n[![Build Status](https://secure.travis-ci.org/jaredhanson/utils-merge.png)](http://travis-ci.org/jaredhanson/utils-merge)\n\n## Credits\n\n - [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>\n", + "readmeFilename": "README.md", + "homepage": "https://github.com/jaredhanson/utils-merge", + "_id": "utils-merge@1.0.0", + "dist": { + "shasum": "0294fb922bb9375153541c4f7096231f287c8af8" + }, + "_from": "utils-merge@1.0.0", + "_resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz" +} diff --git a/node_modules/express-session/package.json b/node_modules/express-session/package.json new file mode 100644 index 0000000..792e3d9 --- /dev/null +++ b/node_modules/express-session/package.json @@ -0,0 +1,64 @@ +{ + "name": "express-session", + "version": "1.7.4", + "description": "Simple session middleware for Express", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca", + "url": "http://tjholowaychuk.com" + }, + "contributors": [ + { + "name": "Douglas Christopher Wilson", + "email": "doug@somethingdoug.com" + }, + { + "name": "Joe Wagner", + "email": "njwjs722@gmail.com" + } + ], + "repository": { + "type": "git", + "url": "git://github.com/expressjs/session" + }, + "license": "MIT", + "dependencies": { + "buffer-crc32": "0.2.3", + "cookie": "0.1.2", + "cookie-signature": "1.0.4", + "debug": "1.0.4", + "depd": "0.4.4", + "on-headers": "0.0.0", + "uid-safe": "1.0.1", + "utils-merge": "1.0.0" + }, + "devDependencies": { + "after": "0.8.1", + "cookie-parser": "1.3.2", + "istanbul": "0.3.0", + "express": "~4.6.1", + "mocha": "~1.21.0", + "should": "~4.0.4", + "supertest": "~0.13.0" + }, + "engines": { + "node": ">= 0.8.0" + }, + "scripts": { + "test": "mocha --bail --reporter spec test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec test/" + }, + "readme": "# express-session\n\n[![NPM Version](https://badge.fury.io/js/express-session.svg)](https://badge.fury.io/js/express-session)\n[![Build Status](https://travis-ci.org/expressjs/session.svg?branch=master)](https://travis-ci.org/expressjs/session)\n[![Coverage Status](https://img.shields.io/coveralls/expressjs/session.svg?branch=master)](https://coveralls.io/r/expressjs/session)\n\nTHIS REPOSITORY NEEDS A MAINTAINER.\nIf you are interested in maintaining this module, please start contributing by making PRs and solving / discussing unsolved issues.\n\n## API\n\n```js\nvar express = require('express')\nvar session = require('express-session')\n\nvar app = express()\n\napp.use(session({secret: 'keyboard cat'}))\n```\n\n\n### session(options)\n\nSetup session store with the given `options`.\n\nSession data is _not_ saved in the cookie itself, just the session ID.\n\n#### Options\n\n - `name` - cookie name (formerly known as `key`). (default: `'connect.sid'`)\n - `store` - session store instance.\n - `secret` - session cookie is signed with this secret to prevent tampering.\n - `cookie` - session cookie settings.\n - (default: `{ path: '/', httpOnly: true, secure: false, maxAge: null }`)\n - `genid` - function to call to generate a new session ID. (default: uses `uid2` library)\n - `rolling` - forces a cookie set on every response. This resets the expiration date. (default: `false`)\n - `resave` - forces session to be saved even when unmodified. (default: `true`)\n - `proxy` - trust the reverse proxy when setting secure cookies (via \"x-forwarded-proto\" header). When set to `true`, the \"x-forwarded-proto\" header will be used. When set to `false`, all headers are ignored. When left unset, will use the \"trust proxy\" setting from express. (default: `undefined`)\n - `saveUninitialized` - forces a session that is \"uninitialized\" to be saved to the store. A session is uninitialized when it is new but not modified. This is useful for implementing login sessions, reducing server storage usage, or complying with laws that require permission before setting a cookie. (default: `true`)\n - `unset` - controls result of unsetting `req.session` (through `delete`, setting to `null`, etc.). This can be \"keep\" to keep the session in the store but ignore modifications or \"destroy\" to destroy the stored session. (default: `'keep'`)\n\n#### options.genid\n\nGenerate a custom session ID for new sessions. Provide a function that returns a string that will be used as a session ID. The function is given `req` as the first argument if you want to use some value attached to `req` when generating the ID.\n\n**NOTE** be careful you generate unique IDs so your sessions do not conflict.\n\n```js\napp.use(session({\n genid: function(req) {\n return genuuid(); // use UUIDs for session IDs\n },\n secret: 'keyboard cat'\n}))\n```\n\n#### Cookie options\n\nPlease note that `secure: true` is a **recommended** option. However, it requires an https-enabled website, i.e., HTTPS is necessary for secure cookies.\nIf `secure` is set, and you access your site over HTTP, the cookie will not be set. If you have your node.js behind a proxy and are using `secure: true`, you need to set \"trust proxy\" in express:\n\n```js\nvar app = express()\napp.set('trust proxy', 1) // trust first proxy\napp.use(session({\n secret: 'keyboard cat'\n , cookie: { secure: true }\n}))\n```\n\nFor using secure cookies in production, but allowing for testing in development, the following is an example of enabling this setup based on `NODE_ENV` in express:\n\n```js\nvar app = express()\nvar sess = {\n secret: 'keyboard cat'\n cookie: {}\n}\n\nif (app.get('env') === 'production') {\n app.set('trust proxy', 1) // trust first proxy\n sess.cookie.secure = true // serve secure cookies\n}\n\napp.use(session(sess))\n```\n\nBy default `cookie.maxAge` is `null`, meaning no \"expires\" parameter is set\nso the cookie becomes a browser-session cookie. When the user closes the\nbrowser the cookie (and session) will be removed.\n\n### req.session\n\nTo store or access session data, simply use the request property `req.session`,\nwhich is (generally) serialized as JSON by the store, so nested objects\nare typically fine. For example below is a user-specific view counter:\n\n```js\napp.use(session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }}))\n\napp.use(function(req, res, next) {\n var sess = req.session\n if (sess.views) {\n sess.views++\n res.setHeader('Content-Type', 'text/html')\n res.write('

    views: ' + sess.views + '

    ')\n res.write('

    expires in: ' + (sess.cookie.maxAge / 1000) + 's

    ')\n res.end()\n } else {\n sess.views = 1\n res.end('welcome to the session demo. refresh!')\n }\n})\n```\n\n#### Session.regenerate()\n\nTo regenerate the session simply invoke the method, once complete\na new SID and `Session` instance will be initialized at `req.session`.\n\n```js\nreq.session.regenerate(function(err) {\n // will have a new session here\n})\n```\n\n#### Session.destroy()\n\nDestroys the session, removing `req.session`, will be re-generated next request.\n\n```js\nreq.session.destroy(function(err) {\n // cannot access session here\n})\n```\n\n#### Session.reload()\n\nReloads the session data.\n\n```js\nreq.session.reload(function(err) {\n // session updated\n})\n```\n\n#### Session.save()\n\n```js\nreq.session.save(function(err) {\n // session saved\n})\n```\n\n#### Session.touch()\n\nUpdates the `.maxAge` property. Typically this is\nnot necessary to call, as the session middleware does this for you.\n\n### req.session.cookie\n\nEach session has a unique cookie object accompany it. This allows\nyou to alter the session cookie per visitor. For example we can\nset `req.session.cookie.expires` to `false` to enable the cookie\nto remain for only the duration of the user-agent.\n\n#### Cookie.maxAge\n\nAlternatively `req.session.cookie.maxAge` will return the time\nremaining in milliseconds, which we may also re-assign a new value\nto adjust the `.expires` property appropriately. The following\nare essentially equivalent\n\n```js\nvar hour = 3600000\nreq.session.cookie.expires = new Date(Date.now() + hour)\nreq.session.cookie.maxAge = hour\n```\n\nFor example when `maxAge` is set to `60000` (one minute), and 30 seconds\nhas elapsed it will return `30000` until the current request has completed,\nat which time `req.session.touch()` is called to reset `req.session.maxAge`\nto its original value.\n\n```js\nreq.session.cookie.maxAge // => 30000\n```\n\n## Session Store Implementation\n\nEvery session store _must_ implement the following methods\n\n - `.get(sid, callback)`\n - `.set(sid, session, callback)`\n - `.destroy(sid, callback)`\n\nRecommended methods include, but are not limited to:\n\n - `.length(callback)`\n - `.clear(callback)`\n\nFor an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo.\n", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/expressjs/session/issues" + }, + "homepage": "https://github.com/expressjs/session", + "_id": "express-session@1.7.4", + "dist": { + "shasum": "8f13aa6da8b1f09ae80a4133df1e0467d40e0e2a" + }, + "_from": "express-session@", + "_resolved": "https://registry.npmjs.org/express-session/-/express-session-1.7.4.tgz" +} diff --git a/node_modules/express-session/session/cookie.js b/node_modules/express-session/session/cookie.js new file mode 100644 index 0000000..86591de --- /dev/null +++ b/node_modules/express-session/session/cookie.js @@ -0,0 +1,128 @@ + +/*! + * Connect - session - Cookie + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var merge = require('utils-merge') + , cookie = require('cookie'); + +/** + * Initialize a new `Cookie` with the given `options`. + * + * @param {IncomingMessage} req + * @param {Object} options + * @api private + */ + +var Cookie = module.exports = function Cookie(options) { + this.path = '/'; + this.maxAge = null; + this.httpOnly = true; + if (options) merge(this, options); + this.originalMaxAge = undefined == this.originalMaxAge + ? this.maxAge + : this.originalMaxAge; +}; + +/*! + * Prototype. + */ + +Cookie.prototype = { + + /** + * Set expires `date`. + * + * @param {Date} date + * @api public + */ + + set expires(date) { + this._expires = date; + this.originalMaxAge = this.maxAge; + }, + + /** + * Get expires `date`. + * + * @return {Date} + * @api public + */ + + get expires() { + return this._expires; + }, + + /** + * Set expires via max-age in `ms`. + * + * @param {Number} ms + * @api public + */ + + set maxAge(ms) { + this.expires = 'number' == typeof ms + ? new Date(Date.now() + ms) + : ms; + }, + + /** + * Get expires max-age in `ms`. + * + * @return {Number} + * @api public + */ + + get maxAge() { + return this.expires instanceof Date + ? this.expires.valueOf() - Date.now() + : this.expires; + }, + + /** + * Return cookie data object. + * + * @return {Object} + * @api private + */ + + get data() { + return { + originalMaxAge: this.originalMaxAge + , expires: this._expires + , secure: this.secure + , httpOnly: this.httpOnly + , domain: this.domain + , path: this.path + } + }, + + /** + * Return a serialized cookie string. + * + * @return {String} + * @api public + */ + + serialize: function(name, val){ + return cookie.serialize(name, val, this.data); + }, + + /** + * Return JSON representation of this cookie. + * + * @return {Object} + * @api private + */ + + toJSON: function(){ + return this.data; + } +}; diff --git a/node_modules/express-session/session/memory.js b/node_modules/express-session/session/memory.js new file mode 100644 index 0000000..4efe99d --- /dev/null +++ b/node_modules/express-session/session/memory.js @@ -0,0 +1,151 @@ + +/*! + * Connect - session - MemoryStore + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var Store = require('./store'); + +/** + * Shim setImmediate for node.js < 0.10 + */ + +/* istanbul ignore next */ +var defer = typeof setImmediate === 'function' + ? setImmediate + : function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) } + +/** + * Initialize a new `MemoryStore`. + * + * @api public + */ + +var MemoryStore = module.exports = function MemoryStore() { + this.sessions = Object.create(null); +}; + +/** + * Inherit from `Store.prototype`. + */ + +MemoryStore.prototype.__proto__ = Store.prototype; + +/** + * Attempt to fetch session by the given `sid`. + * + * @param {String} sid + * @param {Function} fn + * @api public + */ + +MemoryStore.prototype.get = function(sid, fn){ + var self = this; + var sess = self.sessions[sid]; + + if (!sess) { + return defer(fn); + } + + // parse + sess = JSON.parse(sess); + + var expires = typeof sess.cookie.expires === 'string' + ? new Date(sess.cookie.expires) + : sess.cookie.expires; + + // destroy expired session + if (expires && expires <= Date.now()) { + return self.destroy(sid, fn); + } + + defer(fn, null, sess); +}; + +/** + * Commit the given `sess` object associated with the given `sid`. + * + * @param {String} sid + * @param {Session} sess + * @param {Function} fn + * @api public + */ + +MemoryStore.prototype.set = function(sid, sess, fn){ + this.sessions[sid] = JSON.stringify(sess); + fn && defer(fn); +}; + +/** + * Destroy the session associated with the given `sid`. + * + * @param {String} sid + * @api public + */ + +MemoryStore.prototype.destroy = function(sid, fn){ + delete this.sessions[sid]; + fn && defer(fn); +}; + +/** + * Invoke the given callback `fn` with all active sessions. + * + * @param {Function} fn + * @api public + */ + +MemoryStore.prototype.all = function(fn){ + var keys = Object.keys(this.sessions); + var now = Date.now(); + var obj = Object.create(null); + var sess; + var sid; + + for (var i = 0, len = keys.length; i < len; ++i) { + sid = keys[i]; + + // parse + sess = JSON.parse(this.sessions[sid]); + + expires = typeof sess.cookie.expires === 'string' + ? new Date(sess.cookie.expires) + : sess.cookie.expires; + + if (!expires || expires > now) { + obj[sid] = sess; + } + } + + fn && defer(fn, null, obj); +}; + +/** + * Clear all sessions. + * + * @param {Function} fn + * @api public + */ + +MemoryStore.prototype.clear = function(fn){ + this.sessions = {}; + fn && defer(fn); +}; + +/** + * Fetch number of sessions. + * + * @param {Function} fn + * @api public + */ + +MemoryStore.prototype.length = function(fn){ + var len = Object.keys(this.sessions).length; + defer(fn, null, len); +}; diff --git a/node_modules/express-session/session/session.js b/node_modules/express-session/session/session.js new file mode 100644 index 0000000..891f31c --- /dev/null +++ b/node_modules/express-session/session/session.js @@ -0,0 +1,116 @@ + +/*! + * Connect - session - Session + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var merge = require('utils-merge') + +/** + * Create a new `Session` with the given request and `data`. + * + * @param {IncomingRequest} req + * @param {Object} data + * @api private + */ + +var Session = module.exports = function Session(req, data) { + Object.defineProperty(this, 'req', { value: req }); + Object.defineProperty(this, 'id', { value: req.sessionID }); + if ('object' == typeof data) merge(this, data); +}; + +/** + * Update reset `.cookie.maxAge` to prevent + * the cookie from expiring when the + * session is still active. + * + * @return {Session} for chaining + * @api public + */ + +Session.prototype.touch = function(){ + return this.resetMaxAge(); +}; + +/** + * Reset `.maxAge` to `.originalMaxAge`. + * + * @return {Session} for chaining + * @api public + */ + +Session.prototype.resetMaxAge = function(){ + this.cookie.maxAge = this.cookie.originalMaxAge; + return this; +}; + +/** + * Save the session data with optional callback `fn(err)`. + * + * @param {Function} fn + * @return {Session} for chaining + * @api public + */ + +Session.prototype.save = function(fn){ + this.req.sessionStore.set(this.id, this, fn || function(){}); + return this; +}; + +/** + * Re-loads the session data _without_ altering + * the maxAge properties. Invokes the callback `fn(err)`, + * after which time if no exception has occurred the + * `req.session` property will be a new `Session` object, + * although representing the same session. + * + * @param {Function} fn + * @return {Session} for chaining + * @api public + */ + +Session.prototype.reload = function(fn){ + var req = this.req + , store = this.req.sessionStore; + store.get(this.id, function(err, sess){ + if (err) return fn(err); + if (!sess) return fn(new Error('failed to load session')); + store.createSession(req, sess); + fn(); + }); + return this; +}; + +/** + * Destroy `this` session. + * + * @param {Function} fn + * @return {Session} for chaining + * @api public + */ + +Session.prototype.destroy = function(fn){ + delete this.req.session; + this.req.sessionStore.destroy(this.id, fn); + return this; +}; + +/** + * Regenerate this request's session. + * + * @param {Function} fn + * @return {Session} for chaining + * @api public + */ + +Session.prototype.regenerate = function(fn){ + this.req.sessionStore.regenerate(this.req, fn); + return this; +}; diff --git a/node_modules/express-session/session/store.js b/node_modules/express-session/session/store.js new file mode 100644 index 0000000..54294cb --- /dev/null +++ b/node_modules/express-session/session/store.js @@ -0,0 +1,84 @@ + +/*! + * Connect - session - Store + * Copyright(c) 2010 Sencha Inc. + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var EventEmitter = require('events').EventEmitter + , Session = require('./session') + , Cookie = require('./cookie'); + +/** + * Initialize abstract `Store`. + * + * @api private + */ + +var Store = module.exports = function Store(options){}; + +/** + * Inherit from `EventEmitter.prototype`. + */ + +Store.prototype.__proto__ = EventEmitter.prototype; + +/** + * Re-generate the given requests's session. + * + * @param {IncomingRequest} req + * @return {Function} fn + * @api public + */ + +Store.prototype.regenerate = function(req, fn){ + var self = this; + this.destroy(req.sessionID, function(err){ + self.generate(req); + fn(err); + }); +}; + +/** + * Load a `Session` instance via the given `sid` + * and invoke the callback `fn(err, sess)`. + * + * @param {String} sid + * @param {Function} fn + * @api public + */ + +Store.prototype.load = function(sid, fn){ + var self = this; + this.get(sid, function(err, sess){ + if (err) return fn(err); + if (!sess) return fn(); + var req = { sessionID: sid, sessionStore: self }; + sess = self.createSession(req, sess); + fn(null, sess); + }); +}; + +/** + * Create session from JSON `sess` data. + * + * @param {IncomingRequest} req + * @param {Object} sess + * @return {Session} + * @api private + */ + +Store.prototype.createSession = function(req, sess){ + var expires = sess.cookie.expires + , orig = sess.cookie.originalMaxAge; + sess.cookie = new Cookie(sess.cookie); + if ('string' == typeof expires) sess.cookie.expires = new Date(expires); + sess.cookie.originalMaxAge = orig; + req.session = new Session(req, sess); + return req.session; +}; diff --git a/public/javascripts/create.js b/public/javascripts/create.js deleted file mode 100644 index fdfd3b0..0000000 --- a/public/javascripts/create.js +++ /dev/null @@ -1,7 +0,0 @@ -$(document).ready(function() { - $('#childrenHeader').hide(); - $('#recOptioner').click(function() { - $('#recOptionFields').append('
    '); - }); - $.getScript('javascripts/createchildren.js'); -}); diff --git a/public/javascripts/createchildren.js b/public/javascripts/createchildren.js deleted file mode 100644 index 96e4899..0000000 --- a/public/javascripts/createchildren.js +++ /dev/null @@ -1,21 +0,0 @@ -$('#recChilder').click(function() { - $('#childrenHeader').show() - var nameSelector = '
    '; - $('#recChildrenFields').append(nameSelector); - $('#recChildrenFields').append(''); - $('.recn').last().change(function() { - $.post('/versioner', {'recipename': $(this).val()}, function(data) { - $('.recv').last().empty().append(function () { - var output = ''; - $.each(data, function(versIndex) { - output += ''; - }) - return output; - }); - }); - }).change(); -}); diff --git a/public/javascripts/dev.js b/public/javascripts/dev.js index 312aaa7..c9d1d9f 100644 --- a/public/javascripts/dev.js +++ b/public/javascripts/dev.js @@ -1,5 +1,7 @@ $(document).ready(function() { $('#createChild').hide(); + $('#saver').hide(); + $('#committer').hide(); $('#loader').click(function() { window.recipeName = $('select.recn').val(); window.recipeVersion = $('select.recv').val(); @@ -22,10 +24,11 @@ $(document).ready(function() { } makeHierarchy(data); - alert(hs); $('#recipeHierarchy').append(hs+'

    '); - $('.sideLink').first().css('background-color', 'blue'); + $('.sideLink').first().css('background-color', 'yellow'); $('#createChild').show(); + $('#saver').show(); + $('#committer').show(); }); $.getScript('javascripts/tabler.js'); $.getScript('javascripts/linker.js'); @@ -35,15 +38,11 @@ $(document).ready(function() { var newName = prompt("Please enter the new recipe name!"); var selected = $('.sideLink').filter(function() { - return $(this).css('background-color') == 'rgb(0, 0, 255)'; + return $(this).css('background-color') == 'rgb(255, 255, 0)'; }); - $.post('/create', {'recipename': selected.html(), 'recipevers': selected.data('vers'), 'topLevel': $('.sideLink').first().html()}, function(data) { + $.post('/save', {'newname': newName, 'parentname': selected.html(), 'parentvers': selected.data('vers')}, function(data) { alert(data); }); }); - - $('#childer').click(function() { - alert('Childer Pressed'); - }); }); diff --git a/public/javascripts/linker.js b/public/javascripts/linker.js index e1de9a2..49b5f99 100644 --- a/public/javascripts/linker.js +++ b/public/javascripts/linker.js @@ -2,6 +2,6 @@ $('.sideLink').click(function() { window.recipeName = $(this).html(); window.recipeVersion = $(this).data('vers'); $('.sideLink').not($(this)).css('background-color', 'white'); - $(this).css('background-color', 'blue'); + $(this).css('background-color', 'yellow'); $.getScript('javascripts/tabler.js'); }); diff --git a/public/javascripts/tabler.js b/public/javascripts/tabler.js index 815afde..bc317dd 100644 --- a/public/javascripts/tabler.js +++ b/public/javascripts/tabler.js @@ -22,9 +22,9 @@ $.post('/tabler', {'recipename': recipeName, 'recipevers': recipeVersion}, funct $('#recipeForm').append(recTable); - $('#recipeForm').append('

    '); + $('#recipeForm').append(''); - $('#submitter').click(function() { + $('#committer').click(function() { var recName = $('#recTableHeader').children().html(); var recVersion = 'UNDEFINED'; var recOptions = {}; @@ -59,7 +59,7 @@ $.post('/tabler', {'recipename': recipeName, 'recipevers': recipeVersion}, funct topLevel = $(this).html()+'-'+$(this).data('vers').split('.').join('_'); } }); - + if (edited) { var newIdentifier = recName + '-' + recVersion.split('.').join('_'); var newRecipe = {'recipeIdentifier': newIdentifier, 'recipeOptions': recOptions}; diff --git a/routes/index.js b/routes/index.js index e72f4e3..b6c928e 100644 --- a/routes/index.js +++ b/routes/index.js @@ -34,6 +34,8 @@ exports.hierarchy = function(recipeModel) { recipeModel.find({}, function(e, recipes) { var reqID = req.body['recipename']+'-'+req.body['recipevers'].split('.').join('_'); var identifierTree = helpers.getIdentifierTree(recipes, reqID); + req.session.recTree = identifierTree; + console.log(req.session); res.send(identifierTree); }); }; @@ -48,10 +50,35 @@ exports.tabler = function(recipeModel) { }; }; +exports.save = function(req, res) { + console.log(req.body); + console.log(req.session); + res.send('Tester Works'); +} + +// UNIFY COMMIT AND CREATE +/* +exports.createRecipe = function(recipeModel) { + return function(req, res) { + console.log(req.body); + if (req.body['newname'] != '') { + var newRecipe = {'recipeIdentifier': req.body['newname']+'-0_0_0'}; + newRecipe['recipeOptions'] = {'testOption': 'defaultVal', 'testOption2': 'defaultVal'}; + newRecipe['recipeChildren'] = []; + recipeModel.find({}, function(e, recipes) { + }); + var createdRecipe = new recipeModel(newRecipe); + createdRecipe.save(); + } + res.redirect('/'); + }; +}; +*/ + +// UNIFY COMMIT AND CREATE exports.commit = function(recipeModel) { return function(req, res) { recipeModel.find({}, function(e, recipes) { - console.log(req.body); var nextVersion = helpers.getLastVersion(recipes, req.body['newRecipe']['recipeIdentifier']); var newRecipes = [{'recipeIdentifier': nextVersion, 'recipeOptions': req.body['newRecipe']['recipeOptions']}]; newRecipes[0]['recipeChildren'] = helpers.getChildrenList(recipes, req.body['derivedIdentifier']); @@ -64,54 +91,7 @@ exports.commit = function(recipeModel) { }; }; -exports.create = function(recipeModel) { - return function(req, res) { - console.log(req.body); - /* - recipeModel.find(function(e, recipes) { - var recNames = helpers.getDocNames(recipes); - res.render('create', {'title': 'Create New Recipe', 'recNames': recNames}); - }); - */ - res.send('Success!'); - }; -}; - -exports.createRecipe = function(recipeModel) { - return function(req, res) { - if (req.body['recname'] != '') { - var newRecipe = {'recipeIdentifier': req.body['recname']+'-0_0_0'}; - - if (req.body['optionLab'] != '') { - newRecipe['recipeOptions'] = {}; - if (req.body['optionLab'] instanceof Array) { - for (var i = 0; i < req.body['optionLab'].length; i++) { - newRecipe['recipeOptions'][req.body['optionLab'][i]] = req.body['optionVal'][i]; - } - } else { - newRecipe['recipeOptions'][req.body['optionLab']] = req.body['optionVal']; - } - } - if (req.body.hasOwnProperty('childname')) { - if (req.body['childname'] instanceof Array) { - var childidentifiers = []; - for (var i = 0; i < req.body['childname'].length; i++) { - childidentifiers.push(req.body['childname'][i]+'-'+req.body['childversion'][i].split('.').join('_')); - } - newRecipe['recipeChildren'] = childidentifiers; - } else { - newRecipe['recipeChildren'] = [req.body['childname']+'-'+req.body['childversion'].split('.').join('_')]; - } - } else { - newRecipe['recipeChildren'] = []; - } - var createdRecipe = new recipeModel(newRecipe); - createdRecipe.save(); - } - res.redirect('/'); - }; -}; exports.downloadRecipe = function(recipeModel) { return function(req, res) { diff --git a/views/dev.jade b/views/dev.jade index 1580251..4e67f7b 100644 --- a/views/dev.jade +++ b/views/dev.jade @@ -7,22 +7,24 @@ block subhead block content div(id="interface", align="middle") - h2 Create version of recipe   + h2 Create new version of recipe   select(name='recname', class='recn') each rn, index in recNames option(value=rn)= rn select(name='recversion', class="recv") button(id="loader", type="button") Load - h2 Create recipe from scratch   - button(id="childer", type="button") Create br br - div(id="editInterface" style="height:400px") - div(id="recipeTree", style="float:left") - div(id="recipeHierarchy") + div(id="editInterface" style="height:150px") + div(id="recipeTree", style="float:left;width:39%;height:100%") + div(id="recipeHierarchy", style="overflow:scroll") div(id="hierarchyControl", align="middle") button(id="createChild", type="button") Add Child - div(id="tableInterface", style="float:right") + div(id="tableInterface", style="width:60%;float:right;height:100%") div(id="recTableHeader", align="middle") - div(id="recipeTable", align="middle") + div(id="recipeTable", align="middle", style="overflow:scroll") form(id="recipeForm") + br + br + div(id="submitButton", align="middle") + button(id="committer", type="button") Commit All Changes From 751e6e7795462af373b4fc73feb6d5b77b0e9acb Mon Sep 17 00:00:00 2001 From: Russell Mays Date: Sun, 22 Feb 2015 21:05:56 +0000 Subject: [PATCH 07/44] starting to comment --- app.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app.js b/app.js index d33c3f0..084e0ff 100644 --- a/app.js +++ b/app.js @@ -1,8 +1,15 @@ +// load express var express = require('express'); +// load routes +// what does this do? var routes = require('./routes'); +// load http module var http = require('http'); +// load path +// what does this do? var path = require('path'); +// load mongoose var mongoose = require('mongoose'); var mongoUri = process.env.MONGOLAB_URI || process.env.MONGOHQ_URL || 'mongodb://localhost/cellpack'; mongoose.connect(mongoUri); From e56073958d18bc4ec357be7d0eb84bb5475b3764 Mon Sep 17 00:00:00 2001 From: Russell Mays Date: Tue, 12 May 2015 02:09:09 +0000 Subject: [PATCH 08/44] removing trash --- app.js | 20 +++++--------------- tmp/bottomRecipe-0_0_0-pack.json | 11 ----------- tmp/placeholder | 1 - 3 files changed, 5 insertions(+), 27 deletions(-) delete mode 100644 tmp/bottomRecipe-0_0_0-pack.json delete mode 100644 tmp/placeholder diff --git a/app.js b/app.js index 9ff4cbb..dafe885 100644 --- a/app.js +++ b/app.js @@ -1,18 +1,14 @@ -// load express var express = require('express'); -// load routes -// what does this do? var routes = require('./routes'); -// load http module var http = require('http'); -// load path -// what does this do? var path = require('path'); -// load mongoose +// load mongoose and connect to cellpack database var mongoose = require('mongoose'); var mongoUri = process.env.MONGOLAB_URI || process.env.MONGOHQ_URL || 'mongodb://localhost/cellpack'; mongoose.connect(mongoUri); + +// recipe schema var recipeSchema = mongoose.Schema({ recipeIdentifier: String, recipeOptions: mongoose.Schema.Types.Mixed, @@ -20,15 +16,10 @@ var recipeSchema = mongoose.Schema({ }, {collection: 'recipes'}); var Recipe = mongoose.model('Recipe', recipeSchema); -var session = require('express-session'); - - +// instantiates the application var app = express(); -// Session -app.use(session({secret: '1234567890QWERTY'})); - app.set('port', process.env.PORT || 3000); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); @@ -39,7 +30,6 @@ app.use(express.methodOverride()); app.use(app.router); app.use(express.static(__dirname + '/public')); - // development only if ('development' == app.get('env')) { app.use(express.errorHandler()); @@ -58,4 +48,4 @@ app.post('/download', routes.downloadRecipe(Recipe)); http.createServer(app).listen(app.get('port'), function(){ console.log('Express server listening on port ' + app.get('port')); -}); +}); \ No newline at end of file diff --git a/tmp/bottomRecipe-0_0_0-pack.json b/tmp/bottomRecipe-0_0_0-pack.json deleted file mode 100644 index e134f4e..0000000 --- a/tmp/bottomRecipe-0_0_0-pack.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "bottomRecipe-0_0_0": { - "recipeIdentifier": "bottomRecipe-0_0_0", - "recipeOptions": { - "bottomLab": "bottomVal" - }, - "_id": "53dbf501867f3015bb27c949", - "__v": 0, - "recipeChildren": [] - } -} \ No newline at end of file diff --git a/tmp/placeholder b/tmp/placeholder deleted file mode 100644 index 761ce8b..0000000 --- a/tmp/placeholder +++ /dev/null @@ -1 +0,0 @@ -Not Empty From 19a82e6a608a2cf1302e4bbd5960127ade5150fe Mon Sep 17 00:00:00 2001 From: Russell Mays Date: Tue, 12 May 2015 18:13:54 +0000 Subject: [PATCH 09/44] major overhaul --- app.js | 39 +- json_parser.py | 14 - models/index.js | 5 + models/recipe.js | 8 + .../utils/index.js => models/utils.js | 0 mongoose/index.js | 3 + node_modules/express-session/.npmignore | 3 - node_modules/express-session/History.md | 152 ----- node_modules/express-session/LICENSE | 22 - node_modules/express-session/README.md | 202 ------- node_modules/express-session/index.js | 491 ----------------- .../node_modules/buffer-crc32/.npmignore | 1 - .../node_modules/buffer-crc32/.travis.yml | 8 - .../node_modules/buffer-crc32/LICENSE | 17 - .../node_modules/buffer-crc32/README.md | 47 -- .../node_modules/buffer-crc32/index.js | 91 --- .../node_modules/buffer-crc32/package.json | 43 -- .../buffer-crc32/tests/crc.test.js | 89 --- .../node_modules/cookie-signature/.npmignore | 4 - .../node_modules/cookie-signature/History.md | 27 - .../node_modules/cookie-signature/Makefile | 7 - .../node_modules/cookie-signature/Readme.md | 42 -- .../node_modules/cookie-signature/index.js | 51 -- .../cookie-signature/package.json | 36 -- .../node_modules/cookie/.npmignore | 2 - .../node_modules/cookie/LICENSE | 9 - .../node_modules/cookie/README.md | 44 -- .../node_modules/cookie/index.js | 75 --- .../node_modules/cookie/package.json | 41 -- .../node_modules/debug/.jshintrc | 3 - .../node_modules/debug/.npmignore | 6 - .../node_modules/debug/History.md | 144 ----- .../node_modules/debug/Makefile | 33 -- .../node_modules/debug/Readme.md | 156 ------ .../node_modules/debug/browser.js | 147 ----- .../node_modules/debug/component.json | 19 - .../node_modules/debug/debug.js | 197 ------- .../node_modules/debug/node.js | 129 ----- .../debug/node_modules/ms/.npmignore | 5 - .../debug/node_modules/ms/README.md | 33 -- .../debug/node_modules/ms/index.js | 111 ---- .../debug/node_modules/ms/package.json | 32 -- .../node_modules/debug/package.json | 52 -- .../node_modules/depd/.npmignore | 4 - .../node_modules/depd/History.md | 56 -- .../express-session/node_modules/depd/LICENSE | 22 - .../node_modules/depd/Readme.md | 272 --------- .../node_modules/depd/index.js | 520 ------------------ .../node_modules/depd/package.json | 43 -- .../node_modules/on-headers/.npmignore | 2 - .../node_modules/on-headers/History.md | 4 - .../node_modules/on-headers/LICENSE | 22 - .../node_modules/on-headers/README.md | 70 --- .../node_modules/on-headers/index.js | 72 --- .../node_modules/on-headers/package.json | 43 -- .../node_modules/uid-safe/.npmignore | 2 - .../node_modules/uid-safe/LICENSE | 22 - .../node_modules/uid-safe/README.md | 44 -- .../node_modules/uid-safe/index.js | 27 - .../node_modules/base64-url/.npmignore | 12 - .../node_modules/base64-url/.travis.yml | 12 - .../uid-safe/node_modules/base64-url/LICENSE | 15 - .../node_modules/base64-url/README.md | 27 - .../uid-safe/node_modules/base64-url/index.js | 17 - .../node_modules/base64-url/package.json | 39 -- .../node_modules/base64-url/test/index.js | 24 - .../uid-safe/node_modules/mz/.npmignore | 1 - .../uid-safe/node_modules/mz/.travis.yml | 5 - .../uid-safe/node_modules/mz/HISTORY.md | 6 - .../uid-safe/node_modules/mz/LICENSE | 22 - .../uid-safe/node_modules/mz/README.md | 89 --- .../uid-safe/node_modules/mz/_promisify.js | 54 -- .../node_modules/mz/_promisify_all.js | 24 - .../uid-safe/node_modules/mz/child_process.js | 8 - .../uid-safe/node_modules/mz/crypto.js | 9 - .../uid-safe/node_modules/mz/dns.js | 16 - .../uid-safe/node_modules/mz/fs.js | 42 -- .../uid-safe/node_modules/mz/package.json | 34 -- .../uid-safe/node_modules/mz/zlib.js | 13 - .../node_modules/uid-safe/package.json | 38 -- .../node_modules/uid-safe/test.js | 46 -- .../node_modules/utils-merge/.travis.yml | 6 - .../node_modules/utils-merge/LICENSE | 20 - .../node_modules/utils-merge/README.md | 34 -- .../node_modules/utils-merge/index.js | 23 - .../node_modules/utils-merge/package.json | 47 -- node_modules/express-session/package.json | 64 --- .../express-session/session/cookie.js | 128 ----- .../express-session/session/memory.js | 151 ----- .../express-session/session/session.js | 116 ---- node_modules/express-session/session/store.js | 84 --- package.json | 1 - routes/index.js | 1 - 93 files changed, 35 insertions(+), 5058 deletions(-) delete mode 100644 json_parser.py create mode 100644 models/index.js create mode 100644 models/recipe.js rename node_modules/utils/index.js => models/utils.js (100%) create mode 100644 mongoose/index.js delete mode 100644 node_modules/express-session/.npmignore delete mode 100644 node_modules/express-session/History.md delete mode 100644 node_modules/express-session/LICENSE delete mode 100644 node_modules/express-session/README.md delete mode 100644 node_modules/express-session/index.js delete mode 100644 node_modules/express-session/node_modules/buffer-crc32/.npmignore delete mode 100644 node_modules/express-session/node_modules/buffer-crc32/.travis.yml delete mode 100644 node_modules/express-session/node_modules/buffer-crc32/LICENSE delete mode 100644 node_modules/express-session/node_modules/buffer-crc32/README.md delete mode 100644 node_modules/express-session/node_modules/buffer-crc32/index.js delete mode 100644 node_modules/express-session/node_modules/buffer-crc32/package.json delete mode 100644 node_modules/express-session/node_modules/buffer-crc32/tests/crc.test.js delete mode 100644 node_modules/express-session/node_modules/cookie-signature/.npmignore delete mode 100644 node_modules/express-session/node_modules/cookie-signature/History.md delete mode 100644 node_modules/express-session/node_modules/cookie-signature/Makefile delete mode 100644 node_modules/express-session/node_modules/cookie-signature/Readme.md delete mode 100644 node_modules/express-session/node_modules/cookie-signature/index.js delete mode 100644 node_modules/express-session/node_modules/cookie-signature/package.json delete mode 100644 node_modules/express-session/node_modules/cookie/.npmignore delete mode 100644 node_modules/express-session/node_modules/cookie/LICENSE delete mode 100644 node_modules/express-session/node_modules/cookie/README.md delete mode 100644 node_modules/express-session/node_modules/cookie/index.js delete mode 100644 node_modules/express-session/node_modules/cookie/package.json delete mode 100644 node_modules/express-session/node_modules/debug/.jshintrc delete mode 100644 node_modules/express-session/node_modules/debug/.npmignore delete mode 100644 node_modules/express-session/node_modules/debug/History.md delete mode 100644 node_modules/express-session/node_modules/debug/Makefile delete mode 100644 node_modules/express-session/node_modules/debug/Readme.md delete mode 100644 node_modules/express-session/node_modules/debug/browser.js delete mode 100644 node_modules/express-session/node_modules/debug/component.json delete mode 100644 node_modules/express-session/node_modules/debug/debug.js delete mode 100644 node_modules/express-session/node_modules/debug/node.js delete mode 100644 node_modules/express-session/node_modules/debug/node_modules/ms/.npmignore delete mode 100644 node_modules/express-session/node_modules/debug/node_modules/ms/README.md delete mode 100644 node_modules/express-session/node_modules/debug/node_modules/ms/index.js delete mode 100644 node_modules/express-session/node_modules/debug/node_modules/ms/package.json delete mode 100644 node_modules/express-session/node_modules/debug/package.json delete mode 100644 node_modules/express-session/node_modules/depd/.npmignore delete mode 100644 node_modules/express-session/node_modules/depd/History.md delete mode 100644 node_modules/express-session/node_modules/depd/LICENSE delete mode 100644 node_modules/express-session/node_modules/depd/Readme.md delete mode 100644 node_modules/express-session/node_modules/depd/index.js delete mode 100644 node_modules/express-session/node_modules/depd/package.json delete mode 100644 node_modules/express-session/node_modules/on-headers/.npmignore delete mode 100644 node_modules/express-session/node_modules/on-headers/History.md delete mode 100644 node_modules/express-session/node_modules/on-headers/LICENSE delete mode 100644 node_modules/express-session/node_modules/on-headers/README.md delete mode 100644 node_modules/express-session/node_modules/on-headers/index.js delete mode 100644 node_modules/express-session/node_modules/on-headers/package.json delete mode 100644 node_modules/express-session/node_modules/uid-safe/.npmignore delete mode 100644 node_modules/express-session/node_modules/uid-safe/LICENSE delete mode 100644 node_modules/express-session/node_modules/uid-safe/README.md delete mode 100644 node_modules/express-session/node_modules/uid-safe/index.js delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.npmignore delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.travis.yml delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/LICENSE delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/README.md delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/index.js delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/package.json delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/test/index.js delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/.npmignore delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/.travis.yml delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/HISTORY.md delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/LICENSE delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/README.md delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify.js delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify_all.js delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/child_process.js delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/crypto.js delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/dns.js delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/fs.js delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/package.json delete mode 100644 node_modules/express-session/node_modules/uid-safe/node_modules/mz/zlib.js delete mode 100644 node_modules/express-session/node_modules/uid-safe/package.json delete mode 100644 node_modules/express-session/node_modules/uid-safe/test.js delete mode 100644 node_modules/express-session/node_modules/utils-merge/.travis.yml delete mode 100644 node_modules/express-session/node_modules/utils-merge/LICENSE delete mode 100644 node_modules/express-session/node_modules/utils-merge/README.md delete mode 100644 node_modules/express-session/node_modules/utils-merge/index.js delete mode 100644 node_modules/express-session/node_modules/utils-merge/package.json delete mode 100644 node_modules/express-session/package.json delete mode 100644 node_modules/express-session/session/cookie.js delete mode 100644 node_modules/express-session/session/memory.js delete mode 100644 node_modules/express-session/session/session.js delete mode 100644 node_modules/express-session/session/store.js diff --git a/app.js b/app.js index dafe885..160da92 100644 --- a/app.js +++ b/app.js @@ -1,21 +1,10 @@ +var db = require('./mongoose'); + var express = require('express'); var routes = require('./routes'); var http = require('http'); var path = require('path'); -// load mongoose and connect to cellpack database -var mongoose = require('mongoose'); -var mongoUri = process.env.MONGOLAB_URI || process.env.MONGOHQ_URL || 'mongodb://localhost/cellpack'; -mongoose.connect(mongoUri); - -// recipe schema -var recipeSchema = mongoose.Schema({ - recipeIdentifier: String, - recipeOptions: mongoose.Schema.Types.Mixed, - recipeChildren: [] -}, {collection: 'recipes'}); -var Recipe = mongoose.model('Recipe', recipeSchema); - // instantiates the application var app = express(); @@ -35,16 +24,26 @@ if ('development' == app.get('env')) { app.use(express.errorHandler()); } + + + +// DROP RECIPE REFERENCES + app.get('/', routes.index(Recipe)); -app.post('/versioner', routes.versioner(Recipe)); +//app.get('/', routes.index) + +//app.post('/versioner', routes.versioner(Recipe)); + + +//app.get('/dev', routes.dev(Recipe)); + -app.get('/dev', routes.dev(Recipe)); -app.post('/hierarchy', routes.hierarchy(Recipe)); -app.post('/tabler', routes.tabler(Recipe)); -app.post('/save', routes.save); -app.post('/commit', routes.commit(Recipe)); +//app.post('/hierarchy', routes.hierarchy(Recipe)); +//app.post('/tabler', routes.tabler(Recipe)); +//app.post('/save', routes.save); +//app.post('/commit', routes.commit(Recipe)); -app.post('/download', routes.downloadRecipe(Recipe)); +//app.post('/download', routes.downloadRecipe(Recipe)); http.createServer(app).listen(app.get('port'), function(){ console.log('Express server listening on port ' + app.get('port')); diff --git a/json_parser.py b/json_parser.py deleted file mode 100644 index 6f2e4b7..0000000 --- a/json_parser.py +++ /dev/null @@ -1,14 +0,0 @@ -""" -Python Utility File to Convert into Cellpack JSON format - -""" -import sys -import json - - -if __name__ == "__main__": - print "Parser called on", sys.argv[1] - with open(sys.argv[1]) as originalFile: - fileData = json.load(originalFile) - for key in fileData: - print key diff --git a/models/index.js b/models/index.js new file mode 100644 index 0000000..e7238d8 --- /dev/null +++ b/models/index.js @@ -0,0 +1,5 @@ +// models +Recipe = require('./recipe') + +// exports +exports.recipeModel = Recipe.recipeModel; \ No newline at end of file diff --git a/models/recipe.js b/models/recipe.js new file mode 100644 index 0000000..c6a7b48 --- /dev/null +++ b/models/recipe.js @@ -0,0 +1,8 @@ +var mongoose = require('mongoose'); + +var recipeSchema = mongoose.Schema({ + identifier: String, + children: [] +}, {collection: 'recipes'}); + +exports.recipeModel = mongoose.model('Recipe', recipeSchema); \ No newline at end of file diff --git a/node_modules/utils/index.js b/models/utils.js similarity index 100% rename from node_modules/utils/index.js rename to models/utils.js diff --git a/mongoose/index.js b/mongoose/index.js new file mode 100644 index 0000000..c1cf944 --- /dev/null +++ b/mongoose/index.js @@ -0,0 +1,3 @@ +var mongoose = require('mongoose'); +var mongoUri = process.env.MONGOLAB_URI || process.env.MONGOHQ_URL || 'mongodb://localhost/cellpack'; +mongoose.connect(mongoUri); diff --git a/node_modules/express-session/.npmignore b/node_modules/express-session/.npmignore deleted file mode 100644 index cd39b77..0000000 --- a/node_modules/express-session/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -coverage/ -test/ -.travis.yml diff --git a/node_modules/express-session/History.md b/node_modules/express-session/History.md deleted file mode 100644 index 0bdf5cd..0000000 --- a/node_modules/express-session/History.md +++ /dev/null @@ -1,152 +0,0 @@ -1.7.4 / 2014-08-05 -================== - - * Fix response end delay for non-chunked responses - -1.7.3 / 2014-08-05 -================== - - * Fix `res.end` patch to call correct upstream `res.write` - -1.7.2 / 2014-07-27 -================== - - * deps: depd@0.4.4 - - Work-around v8 generating empty stack traces - -1.7.1 / 2014-07-26 -================== - - * deps: depd@0.4.3 - - Fix exception when global `Error.stackTraceLimit` is too low - -1.7.0 / 2014-07-22 -================== - - * Improve session-ending error handling - - Errors are passed to `next(err)` instead of `console.error` - * deps: debug@1.0.4 - * deps: depd@0.4.2 - - Add `TRACE_DEPRECATION` environment variable - - Remove non-standard grey color from color output - - Support `--no-deprecation` argument - - Support `--trace-deprecation` argument - -1.6.5 / 2014-07-11 -================== - - * Do not require `req.originalUrl` - * deps: debug@1.0.3 - - Add support for multiple wildcards in namespaces - -1.6.4 / 2014-07-07 -================== - - * Fix blank responses for stores with synchronous operations - -1.6.3 / 2014-07-04 -================== - - * Fix resave deprecation message - -1.6.2 / 2014-07-04 -================== - - * Fix confusing option deprecation messages - -1.6.1 / 2014-06-28 -================== - - * Fix saveUninitialized deprecation message - -1.6.0 / 2014-06-28 -================== - - * Add deprecation message to undefined `resave` option - * Add deprecation message to undefined `saveUninitialized` option - * Fix `res.end` patch to return correct value - * Fix `res.end` patch to handle multiple `res.end` calls - * Reject cookies with missing signatures - -1.5.2 / 2014-06-26 -================== - - * deps: cookie-signature@1.0.4 - - fix for timing attacks - -1.5.1 / 2014-06-21 -================== - - * Move hard-to-track-down `req.secret` deprecation message - -1.5.0 / 2014-06-19 -================== - - * Debug name is now "express-session" - * Deprecate integration with `cookie-parser` middleware - * Deprecate looking for secret in `req.secret` - * Directly read cookies; `cookie-parser` no longer required - * Directly set cookies; `res.cookie` no longer required - * Generate session IDs with `uid-safe`, faster and even less collisions - -1.4.0 / 2014-06-17 -================== - - * Add `genid` option to generate custom session IDs - * Add `saveUninitialized` option to control saving uninitialized sessions - * Add `unset` option to control unsetting `req.session` - * Generate session IDs with `rand-token` by default; reduce collisions - * deps: buffer-crc32@0.2.3 - -1.3.1 / 2014-06-14 -================== - - * Add description in package for npmjs.org listing - -1.3.0 / 2014-06-14 -================== - - * Integrate with express "trust proxy" by default - * deps: debug@1.0.2 - -1.2.1 / 2014-05-27 -================== - - * Fix `resave` such that `resave: true` works - -1.2.0 / 2014-05-19 -================== - - * Add `resave` option to control saving unmodified sessions - -1.1.0 / 2014-05-12 -================== - - * Add `name` option; replacement for `key` option - * Use `setImmediate` in MemoryStore for node.js >= 0.10 - -1.0.4 / 2014-04-27 -================== - - * deps: debug@0.8.1 - -1.0.3 / 2014-04-19 -================== - - * Use `res.cookie()` instead of `res.setHeader()` - * deps: cookie@0.1.2 - -1.0.2 / 2014-02-23 -================== - - * Add missing dependency to `package.json` - -1.0.1 / 2014-02-15 -================== - - * Add missing dependencies to `package.json` - -1.0.0 / 2014-02-15 -================== - - * Genesis from `connect` diff --git a/node_modules/express-session/LICENSE b/node_modules/express-session/LICENSE deleted file mode 100644 index a7693b0..0000000 --- a/node_modules/express-session/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 TJ Holowaychuk - -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/node_modules/express-session/README.md b/node_modules/express-session/README.md deleted file mode 100644 index dd1ba7a..0000000 --- a/node_modules/express-session/README.md +++ /dev/null @@ -1,202 +0,0 @@ -# express-session - -[![NPM Version](https://badge.fury.io/js/express-session.svg)](https://badge.fury.io/js/express-session) -[![Build Status](https://travis-ci.org/expressjs/session.svg?branch=master)](https://travis-ci.org/expressjs/session) -[![Coverage Status](https://img.shields.io/coveralls/expressjs/session.svg?branch=master)](https://coveralls.io/r/expressjs/session) - -THIS REPOSITORY NEEDS A MAINTAINER. -If you are interested in maintaining this module, please start contributing by making PRs and solving / discussing unsolved issues. - -## API - -```js -var express = require('express') -var session = require('express-session') - -var app = express() - -app.use(session({secret: 'keyboard cat'})) -``` - - -### session(options) - -Setup session store with the given `options`. - -Session data is _not_ saved in the cookie itself, just the session ID. - -#### Options - - - `name` - cookie name (formerly known as `key`). (default: `'connect.sid'`) - - `store` - session store instance. - - `secret` - session cookie is signed with this secret to prevent tampering. - - `cookie` - session cookie settings. - - (default: `{ path: '/', httpOnly: true, secure: false, maxAge: null }`) - - `genid` - function to call to generate a new session ID. (default: uses `uid2` library) - - `rolling` - forces a cookie set on every response. This resets the expiration date. (default: `false`) - - `resave` - forces session to be saved even when unmodified. (default: `true`) - - `proxy` - trust the reverse proxy when setting secure cookies (via "x-forwarded-proto" header). When set to `true`, the "x-forwarded-proto" header will be used. When set to `false`, all headers are ignored. When left unset, will use the "trust proxy" setting from express. (default: `undefined`) - - `saveUninitialized` - forces a session that is "uninitialized" to be saved to the store. A session is uninitialized when it is new but not modified. This is useful for implementing login sessions, reducing server storage usage, or complying with laws that require permission before setting a cookie. (default: `true`) - - `unset` - controls result of unsetting `req.session` (through `delete`, setting to `null`, etc.). This can be "keep" to keep the session in the store but ignore modifications or "destroy" to destroy the stored session. (default: `'keep'`) - -#### options.genid - -Generate a custom session ID for new sessions. Provide a function that returns a string that will be used as a session ID. The function is given `req` as the first argument if you want to use some value attached to `req` when generating the ID. - -**NOTE** be careful you generate unique IDs so your sessions do not conflict. - -```js -app.use(session({ - genid: function(req) { - return genuuid(); // use UUIDs for session IDs - }, - secret: 'keyboard cat' -})) -``` - -#### Cookie options - -Please note that `secure: true` is a **recommended** option. However, it requires an https-enabled website, i.e., HTTPS is necessary for secure cookies. -If `secure` is set, and you access your site over HTTP, the cookie will not be set. If you have your node.js behind a proxy and are using `secure: true`, you need to set "trust proxy" in express: - -```js -var app = express() -app.set('trust proxy', 1) // trust first proxy -app.use(session({ - secret: 'keyboard cat' - , cookie: { secure: true } -})) -``` - -For using secure cookies in production, but allowing for testing in development, the following is an example of enabling this setup based on `NODE_ENV` in express: - -```js -var app = express() -var sess = { - secret: 'keyboard cat' - cookie: {} -} - -if (app.get('env') === 'production') { - app.set('trust proxy', 1) // trust first proxy - sess.cookie.secure = true // serve secure cookies -} - -app.use(session(sess)) -``` - -By default `cookie.maxAge` is `null`, meaning no "expires" parameter is set -so the cookie becomes a browser-session cookie. When the user closes the -browser the cookie (and session) will be removed. - -### req.session - -To store or access session data, simply use the request property `req.session`, -which is (generally) serialized as JSON by the store, so nested objects -are typically fine. For example below is a user-specific view counter: - -```js -app.use(session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }})) - -app.use(function(req, res, next) { - var sess = req.session - if (sess.views) { - sess.views++ - res.setHeader('Content-Type', 'text/html') - res.write('

    views: ' + sess.views + '

    ') - res.write('

    expires in: ' + (sess.cookie.maxAge / 1000) + 's

    ') - res.end() - } else { - sess.views = 1 - res.end('welcome to the session demo. refresh!') - } -}) -``` - -#### Session.regenerate() - -To regenerate the session simply invoke the method, once complete -a new SID and `Session` instance will be initialized at `req.session`. - -```js -req.session.regenerate(function(err) { - // will have a new session here -}) -``` - -#### Session.destroy() - -Destroys the session, removing `req.session`, will be re-generated next request. - -```js -req.session.destroy(function(err) { - // cannot access session here -}) -``` - -#### Session.reload() - -Reloads the session data. - -```js -req.session.reload(function(err) { - // session updated -}) -``` - -#### Session.save() - -```js -req.session.save(function(err) { - // session saved -}) -``` - -#### Session.touch() - -Updates the `.maxAge` property. Typically this is -not necessary to call, as the session middleware does this for you. - -### req.session.cookie - -Each session has a unique cookie object accompany it. This allows -you to alter the session cookie per visitor. For example we can -set `req.session.cookie.expires` to `false` to enable the cookie -to remain for only the duration of the user-agent. - -#### Cookie.maxAge - -Alternatively `req.session.cookie.maxAge` will return the time -remaining in milliseconds, which we may also re-assign a new value -to adjust the `.expires` property appropriately. The following -are essentially equivalent - -```js -var hour = 3600000 -req.session.cookie.expires = new Date(Date.now() + hour) -req.session.cookie.maxAge = hour -``` - -For example when `maxAge` is set to `60000` (one minute), and 30 seconds -has elapsed it will return `30000` until the current request has completed, -at which time `req.session.touch()` is called to reset `req.session.maxAge` -to its original value. - -```js -req.session.cookie.maxAge // => 30000 -``` - -## Session Store Implementation - -Every session store _must_ implement the following methods - - - `.get(sid, callback)` - - `.set(sid, session, callback)` - - `.destroy(sid, callback)` - -Recommended methods include, but are not limited to: - - - `.length(callback)` - - `.clear(callback)` - -For an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo. diff --git a/node_modules/express-session/index.js b/node_modules/express-session/index.js deleted file mode 100644 index 55bf367..0000000 --- a/node_modules/express-session/index.js +++ /dev/null @@ -1,491 +0,0 @@ -/*! - * express-session - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var cookie = require('cookie'); -var debug = require('debug')('express-session'); -var deprecate = require('depd')('express-session'); -var uid = require('uid-safe').sync - , onHeaders = require('on-headers') - , crc32 = require('buffer-crc32') - , parse = require('url').parse - , signature = require('cookie-signature') - -var Session = require('./session/session') - , MemoryStore = require('./session/memory') - , Cookie = require('./session/cookie') - , Store = require('./session/store') - -// environment - -var env = process.env.NODE_ENV; - -/** - * Expose the middleware. - */ - -exports = module.exports = session; - -/** - * Expose constructors. - */ - -exports.Store = Store; -exports.Cookie = Cookie; -exports.Session = Session; -exports.MemoryStore = MemoryStore; - -/** - * Warning message for `MemoryStore` usage in production. - */ - -var warning = 'Warning: connect.session() MemoryStore is not\n' - + 'designed for a production environment, as it will leak\n' - + 'memory, and will not scale past a single process.'; - -/** - * Node.js 0.8+ async implementation. - */ - -/* istanbul ignore next */ -var defer = typeof setImmediate === 'function' - ? setImmediate - : function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) } - -/** - * Setup session store with the given `options`. - * - * See README.md for documentation of options and formatting. - * - * Session data is _not_ saved in the cookie itself, however cookies are used, - * so you must use the cookie-parser middleware _before_ `session()`. - * [https://github.com/expressjs/cookie-parser] - * - * @param {Object} options - * @return {Function} middleware - * @api public - */ - -function session(options){ - var options = options || {} - // name - previously "options.key" - , name = options.name || options.key || 'connect.sid' - , store = options.store || new MemoryStore - , cookie = options.cookie || {} - , trustProxy = options.proxy - , storeReady = true - , rollingSessions = options.rolling || false; - var resaveSession = options.resave; - var saveUninitializedSession = options.saveUninitialized; - - var generateId = options.genid || generateSessionId; - - if (typeof generateId !== 'function') { - throw new TypeError('genid option must be a function'); - } - - if (resaveSession === undefined) { - deprecate('undefined resave option; provide resave option'); - resaveSession = true; - } - - if (saveUninitializedSession === undefined) { - deprecate('undefined saveUninitialized option; provide saveUninitialized option'); - saveUninitializedSession = true; - } - - if (options.unset && options.unset !== 'destroy' && options.unset !== 'keep') { - throw new TypeError('unset option must be "destroy" or "keep"'); - } - - // TODO: switch to "destroy" on next major - var unsetDestroy = options.unset === 'destroy'; - - // notify user that this store is not - // meant for a production environment - if ('production' == env && store instanceof MemoryStore) { - console.warn(warning); - } - - // generates the new session - store.generate = function(req){ - req.sessionID = generateId(req); - req.session = new Session(req); - req.session.cookie = new Cookie(cookie); - }; - - store.on('disconnect', function(){ storeReady = false; }); - store.on('connect', function(){ storeReady = true; }); - - if (!options.secret) { - deprecate('req.secret; provide secret option'); - } - - return function session(req, res, next) { - // self-awareness - if (req.session) return next(); - - // Handle connection as if there is no session if - // the store has temporarily disconnected etc - if (!storeReady) return debug('store is disconnected'), next(); - - // pathname mismatch - var originalPath = parse(req.originalUrl || req.url).pathname; - if (0 != originalPath.indexOf(cookie.path || '/')) return next(); - - // backwards compatibility for signed cookies - // req.secret is passed from the cookie parser middleware - var secret = options.secret || req.secret; - - // ensure secret is available or bail - if (!secret) next(new Error('`secret` option required for sessions')); - - var originalHash - , originalId; - - // expose store - req.sessionStore = store; - - // get the session ID from the cookie - var cookieId = req.sessionID = getcookie(req, name, secret); - - // set-cookie - onHeaders(res, function(){ - if (!req.session) { - debug('no session'); - return; - } - - var cookie = req.session.cookie; - - // only send secure cookies via https - if (cookie.secure && !issecure(req, trustProxy)) { - debug('not secured'); - return; - } - - if (!shouldSetCookie(req)) { - return; - } - - setcookie(res, name, req.sessionID, secret, cookie.data); - }); - - // proxy end() to commit the session - var _end = res.end; - var _write = res.write; - var ended = false; - res.end = function end(chunk, encoding) { - if (ended) { - return false; - } - - ended = true; - - var ret; - var sync = true; - - if (chunk === undefined) { - chunk = ''; - } - - function writeend() { - if (sync) { - ret = _end.call(res, chunk, encoding); - sync = false; - return; - } - - _end.call(res); - } - - function writetop() { - if (!sync) { - return ret; - } - - var contentLength = Number(res.getHeader('Content-Length')); - - if (!isNaN(contentLength) && contentLength > 0) { - // measure chunk - chunk = !Buffer.isBuffer(chunk) - ? new Buffer(chunk, encoding) - : chunk; - encoding = undefined; - - if (chunk.length !== 0) { - debug('split response'); - ret = _write.call(res, chunk.slice(0, chunk.length - 1)); - chunk = chunk.slice(chunk.length - 1, chunk.length); - return ret; - } - } - - ret = _write.call(res, chunk, encoding); - sync = false; - - return ret; - } - - if (shouldDestroy(req)) { - // destroy session - debug('destroying'); - store.destroy(req.sessionID, function ondestroy(err) { - if (err) { - defer(next, err); - } - - debug('destroyed'); - writeend(); - }); - - return writetop(); - } - - // no session to save - if (!req.session) { - debug('no session'); - return _end.call(res, chunk, encoding); - } - - req.session.resetMaxAge(); - - if (shouldSave(req)) { - debug('saving'); - req.session.save(function onsave(err) { - if (err) { - defer(next, err); - } - - debug('saved'); - writeend(); - }); - - return writetop(); - } - - return _end.call(res, chunk, encoding); - }; - - // generate the session - function generate() { - store.generate(req); - originalId = req.sessionID; - originalHash = hash(req.session); - } - - // check if session has been modified - function isModified(sess) { - return originalHash != hash(sess) || originalId != sess.id; - } - - // determine if session should be destroyed - function shouldDestroy(req) { - return req.sessionID && unsetDestroy && req.session == null; - } - - // determine if session should be saved to store - function shouldSave(req) { - return cookieId != req.sessionID - ? saveUninitializedSession || isModified(req.session) - : resaveSession || isModified(req.session); - } - - // determine if cookie should be set on response - function shouldSetCookie(req) { - // in case of rolling session, always reset the cookie - if (rollingSessions) { - return true; - } - - return cookieId != req.sessionID - ? saveUninitializedSession || isModified(req.session) - : req.session.cookie.expires != null && isModified(req.session); - } - - // generate a session if the browser doesn't send a sessionID - if (!req.sessionID) { - debug('no SID sent, generating session'); - generate(); - next(); - return; - } - - // generate the session object - debug('fetching %s', req.sessionID); - store.get(req.sessionID, function(err, sess){ - // error handling - if (err) { - debug('error %j', err); - if ('ENOENT' == err.code) { - generate(); - next(); - } else { - next(err); - } - // no session - } else if (!sess) { - debug('no session found'); - generate(); - next(); - // populate req.session - } else { - debug('session found'); - store.createSession(req, sess); - originalId = req.sessionID; - originalHash = hash(sess); - next(); - } - }); - }; -}; - -/** - * Generate a session ID for a new session. - * - * @return {String} - * @api private - */ - -function generateSessionId(sess) { - return uid(24); -} - -/** - * Get the session ID cookie from request. - * - * @return {string} - * @api private - */ - -function getcookie(req, name, secret) { - var header = req.headers.cookie; - var raw; - var val; - - // read from cookie header - if (header) { - var cookies = cookie.parse(header); - - raw = cookies[name]; - - if (raw) { - if (raw.substr(0, 2) === 's:') { - val = signature.unsign(raw.slice(2), secret); - - if (val === false) { - debug('cookie signature invalid'); - val = undefined; - } - } else { - debug('cookie unsigned') - } - } - } - - // back-compat read from cookieParser() signedCookies data - if (!val && req.signedCookies) { - val = req.signedCookies[name]; - - if (val) { - deprecate('cookie should be available in req.headers.cookie'); - } - } - - // back-compat read from cookieParser() cookies data - if (!val && req.cookies) { - raw = req.cookies[name]; - - if (raw) { - if (raw.substr(0, 2) === 's:') { - val = signature.unsign(raw.slice(2), secret); - - if (val) { - deprecate('cookie should be available in req.headers.cookie'); - } - - if (val === false) { - debug('cookie signature invalid'); - val = undefined; - } - } else { - debug('cookie unsigned') - } - } - } - - return val; -} - -/** - * Hash the given `sess` object omitting changes to `.cookie`. - * - * @param {Object} sess - * @return {String} - * @api private - */ - -function hash(sess) { - return crc32.signed(JSON.stringify(sess, function(key, val){ - if ('cookie' != key) return val; - })); -} - -/** - * Determine if request is secure. - * - * @param {Object} req - * @param {Boolean} [trustProxy] - * @return {Boolean} - * @api private - */ - -function issecure(req, trustProxy) { - // socket is https server - if (req.connection && req.connection.encrypted) { - return true; - } - - // do not trust proxy - if (trustProxy === false) { - return false; - } - - // no explicit trust; try req.secure from express - if (trustProxy !== true) { - var secure = req.secure; - return typeof secure === 'boolean' - ? secure - : false; - } - - // read the proto from x-forwarded-proto header - var header = req.headers['x-forwarded-proto'] || ''; - var index = header.indexOf(','); - var proto = index !== -1 - ? header.substr(0, index).toLowerCase().trim() - : header.toLowerCase().trim() - - return proto === 'https'; -} - -function setcookie(res, name, val, secret, options) { - var signed = 's:' + signature.sign(val, secret); - var data = cookie.serialize(name, signed, options); - - debug('set-cookie %s', data); - - var prev = res.getHeader('set-cookie') || []; - var header = Array.isArray(prev) ? prev.concat(data) - : Array.isArray(data) ? [prev].concat(data) - : [prev, data]; - - res.setHeader('set-cookie', header) -} diff --git a/node_modules/express-session/node_modules/buffer-crc32/.npmignore b/node_modules/express-session/node_modules/buffer-crc32/.npmignore deleted file mode 100644 index b512c09..0000000 --- a/node_modules/express-session/node_modules/buffer-crc32/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/node_modules/express-session/node_modules/buffer-crc32/.travis.yml b/node_modules/express-session/node_modules/buffer-crc32/.travis.yml deleted file mode 100644 index 7a902e8..0000000 --- a/node_modules/express-session/node_modules/buffer-crc32/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 -notifications: - email: - recipients: - - brianloveswords@gmail.com \ No newline at end of file diff --git a/node_modules/express-session/node_modules/buffer-crc32/LICENSE b/node_modules/express-session/node_modules/buffer-crc32/LICENSE deleted file mode 100644 index caeb849..0000000 --- a/node_modules/express-session/node_modules/buffer-crc32/LICENSE +++ /dev/null @@ -1,17 +0,0 @@ -Copyright (c) 2013 Brian J. Brennan - -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/node_modules/express-session/node_modules/buffer-crc32/README.md b/node_modules/express-session/node_modules/buffer-crc32/README.md deleted file mode 100644 index 0d9d8b8..0000000 --- a/node_modules/express-session/node_modules/buffer-crc32/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# buffer-crc32 - -[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32) - -crc32 that works with binary data and fancy character sets, outputs -buffer, signed or unsigned data and has tests. - -Derived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix - -# install -``` -npm install buffer-crc32 -``` - -# example -```js -var crc32 = require('buffer-crc32'); -// works with buffers -var buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00]) -crc32(buf) // -> - -// has convenience methods for getting signed or unsigned ints -crc32.signed(buf) // -> -1805997238 -crc32.unsigned(buf) // -> 2488970058 - -// will cast to buffer if given a string, so you can -// directly use foreign characters safely -crc32('自動販売機') // -> - -// and works in append mode too -var partialCrc = crc32('hey'); -var partialCrc = crc32(' ', partialCrc); -var partialCrc = crc32('sup', partialCrc); -var partialCrc = crc32(' ', partialCrc); -var finalCrc = crc32('bros', partialCrc); // -> -``` - -# tests -This was tested against the output of zlib's crc32 method. You can run -the tests with`npm test` (requires tap) - -# see also -https://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also -supports buffer inputs and return unsigned ints (thanks @tjholowaychuk). - -# license -MIT/X11 diff --git a/node_modules/express-session/node_modules/buffer-crc32/index.js b/node_modules/express-session/node_modules/buffer-crc32/index.js deleted file mode 100644 index 8694c63..0000000 --- a/node_modules/express-session/node_modules/buffer-crc32/index.js +++ /dev/null @@ -1,91 +0,0 @@ -var Buffer = require('buffer').Buffer; - -var CRC_TABLE = [ - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, - 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, - 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, - 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, - 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, - 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, - 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, - 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, - 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, - 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, - 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, - 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, - 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, - 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, - 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, - 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, - 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, - 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, - 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, - 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, - 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, - 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, - 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, - 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, - 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, - 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, - 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, - 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, - 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, - 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, - 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, - 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, - 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, - 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, - 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, - 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, - 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, - 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, - 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, - 0x2d02ef8d -]; - -if (typeof Int32Array !== 'undefined') - CRC_TABLE = new Int32Array(CRC_TABLE); - -function bufferizeInt(num) { - var tmp = Buffer(4); - tmp.writeInt32BE(num, 0); - return tmp; -} - -function _crc32(buf, previous) { - if (!Buffer.isBuffer(buf)) { - buf = Buffer(buf); - } - if (Buffer.isBuffer(previous)) { - previous = previous.readUInt32BE(0); - } - var crc = ~~previous ^ -1; - for (var n = 0; n < buf.length; n++) { - crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8); - } - return (crc ^ -1); -} - -function crc32() { - return bufferizeInt(_crc32.apply(null, arguments)); -} -crc32.signed = function () { - return _crc32.apply(null, arguments); -}; -crc32.unsigned = function () { - return _crc32.apply(null, arguments) >>> 0; -}; - -module.exports = crc32; diff --git a/node_modules/express-session/node_modules/buffer-crc32/package.json b/node_modules/express-session/node_modules/buffer-crc32/package.json deleted file mode 100644 index 4516500..0000000 --- a/node_modules/express-session/node_modules/buffer-crc32/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "author": { - "name": "Brian J. Brennan", - "email": "brianloveswords@gmail.com", - "url": "http://bjb.io" - }, - "name": "buffer-crc32", - "description": "A pure javascript CRC32 algorithm that plays nice with binary data", - "version": "0.2.3", - "contributors": [ - { - "name": "Vladimir Kuznetsov" - } - ], - "homepage": "https://github.com/brianloveswords/buffer-crc32", - "repository": { - "type": "git", - "url": "git://github.com/brianloveswords/buffer-crc32.git" - }, - "main": "index.js", - "scripts": { - "test": "tap tests/*.test.js" - }, - "dependencies": {}, - "devDependencies": { - "tap": "~0.2.5" - }, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "readme": "# buffer-crc32\n\n[![Build Status](https://secure.travis-ci.org/brianloveswords/buffer-crc32.png?branch=master)](http://travis-ci.org/brianloveswords/buffer-crc32)\n\ncrc32 that works with binary data and fancy character sets, outputs\nbuffer, signed or unsigned data and has tests.\n\nDerived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix\n\n# install\n```\nnpm install buffer-crc32\n```\n\n# example\n```js\nvar crc32 = require('buffer-crc32');\n// works with buffers\nvar buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00])\ncrc32(buf) // -> \n\n// has convenience methods for getting signed or unsigned ints\ncrc32.signed(buf) // -> -1805997238\ncrc32.unsigned(buf) // -> 2488970058\n\n// will cast to buffer if given a string, so you can\n// directly use foreign characters safely\ncrc32('自動販売機') // -> \n\n// and works in append mode too\nvar partialCrc = crc32('hey');\nvar partialCrc = crc32(' ', partialCrc);\nvar partialCrc = crc32('sup', partialCrc);\nvar partialCrc = crc32(' ', partialCrc);\nvar finalCrc = crc32('bros', partialCrc); // -> \n```\n\n# tests\nThis was tested against the output of zlib's crc32 method. You can run\nthe tests with`npm test` (requires tap)\n\n# see also\nhttps://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also\nsupports buffer inputs and return unsigned ints (thanks @tjholowaychuk).\n\n# license\nMIT/X11\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/brianloveswords/buffer-crc32/issues" - }, - "_id": "buffer-crc32@0.2.3", - "dist": { - "shasum": "bb54519e95d107cbd2400e76d0cab1467336d921" - }, - "_from": "buffer-crc32@0.2.3", - "_resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.3.tgz" -} diff --git a/node_modules/express-session/node_modules/buffer-crc32/tests/crc.test.js b/node_modules/express-session/node_modules/buffer-crc32/tests/crc.test.js deleted file mode 100644 index bb0f9ef..0000000 --- a/node_modules/express-session/node_modules/buffer-crc32/tests/crc.test.js +++ /dev/null @@ -1,89 +0,0 @@ -var crc32 = require('..'); -var test = require('tap').test; - -test('simple crc32 is no problem', function (t) { - var input = Buffer('hey sup bros'); - var expected = Buffer([0x47, 0xfa, 0x55, 0x70]); - t.same(crc32(input), expected); - t.end(); -}); - -test('another simple one', function (t) { - var input = Buffer('IEND'); - var expected = Buffer([0xae, 0x42, 0x60, 0x82]); - t.same(crc32(input), expected); - t.end(); -}); - -test('slightly more complex', function (t) { - var input = Buffer([0x00, 0x00, 0x00]); - var expected = Buffer([0xff, 0x41, 0xd9, 0x12]); - t.same(crc32(input), expected); - t.end(); -}); - -test('complex crc32 gets calculated like a champ', function (t) { - var input = Buffer('शीर्षक'); - var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]); - t.same(crc32(input), expected); - t.end(); -}); - -test('casts to buffer if necessary', function (t) { - var input = 'शीर्षक'; - var expected = Buffer([0x17, 0xb8, 0xaf, 0xf1]); - t.same(crc32(input), expected); - t.end(); -}); - -test('can do signed', function (t) { - var input = 'ham sandwich'; - var expected = -1891873021; - t.same(crc32.signed(input), expected); - t.end(); -}); - -test('can do unsigned', function (t) { - var input = 'bear sandwich'; - var expected = 3711466352; - t.same(crc32.unsigned(input), expected); - t.end(); -}); - - -test('simple crc32 in append mode', function (t) { - var input = [Buffer('hey'), Buffer(' '), Buffer('sup'), Buffer(' '), Buffer('bros')]; - var expected = Buffer([0x47, 0xfa, 0x55, 0x70]); - for (var crc = 0, i = 0; i < input.length; i++) { - crc = crc32(input[i], crc); - } - t.same(crc, expected); - t.end(); -}); - - -test('can do signed in append mode', function (t) { - var input1 = 'ham'; - var input2 = ' '; - var input3 = 'sandwich'; - var expected = -1891873021; - - var crc = crc32.signed(input1); - crc = crc32.signed(input2, crc); - crc = crc32.signed(input3, crc); - - t.same(crc, expected); - t.end(); -}); - -test('can do unsigned in append mode', function (t) { - var input1 = 'bear san'; - var input2 = 'dwich'; - var expected = 3711466352; - - var crc = crc32.unsigned(input1); - crc = crc32.unsigned(input2, crc); - t.same(crc, expected); - t.end(); -}); - diff --git a/node_modules/express-session/node_modules/cookie-signature/.npmignore b/node_modules/express-session/node_modules/cookie-signature/.npmignore deleted file mode 100644 index f1250e5..0000000 --- a/node_modules/express-session/node_modules/cookie-signature/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/node_modules/express-session/node_modules/cookie-signature/History.md b/node_modules/express-session/node_modules/cookie-signature/History.md deleted file mode 100644 index 2bbc4b3..0000000 --- a/node_modules/express-session/node_modules/cookie-signature/History.md +++ /dev/null @@ -1,27 +0,0 @@ -1.0.4 / 2014-06-25 -================== - - * corrected avoidance of timing attacks (thanks @tenbits!) - - -1.0.3 / 2014-01-28 -================== - - * [incorrect] fix for timing attacks - -1.0.2 / 2014-01-28 -================== - - * fix missing repository warning - * fix typo in test - -1.0.1 / 2013-04-15 -================== - - * Revert "Changed underlying HMAC algo. to sha512." - * Revert "Fix for timing attacks on MAC verification." - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/express-session/node_modules/cookie-signature/Makefile b/node_modules/express-session/node_modules/cookie-signature/Makefile deleted file mode 100644 index 4e9c8d3..0000000 --- a/node_modules/express-session/node_modules/cookie-signature/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --require should \ - --reporter spec - -.PHONY: test \ No newline at end of file diff --git a/node_modules/express-session/node_modules/cookie-signature/Readme.md b/node_modules/express-session/node_modules/cookie-signature/Readme.md deleted file mode 100644 index 2559e84..0000000 --- a/node_modules/express-session/node_modules/cookie-signature/Readme.md +++ /dev/null @@ -1,42 +0,0 @@ - -# cookie-signature - - Sign and unsign cookies. - -## Example - -```js -var cookie = require('cookie-signature'); - -var val = cookie.sign('hello', 'tobiiscool'); -val.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI'); - -var val = cookie.sign('hello', 'tobiiscool'); -cookie.unsign(val, 'tobiiscool').should.equal('hello'); -cookie.unsign(val, 'luna').should.be.false; -``` - -## License - -(The MIT License) - -Copyright (c) 2012 LearnBoost <tj@learnboost.com> - -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. \ No newline at end of file diff --git a/node_modules/express-session/node_modules/cookie-signature/index.js b/node_modules/express-session/node_modules/cookie-signature/index.js deleted file mode 100644 index b63bf84..0000000 --- a/node_modules/express-session/node_modules/cookie-signature/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Module dependencies. - */ - -var crypto = require('crypto'); - -/** - * Sign the given `val` with `secret`. - * - * @param {String} val - * @param {String} secret - * @return {String} - * @api private - */ - -exports.sign = function(val, secret){ - if ('string' != typeof val) throw new TypeError('cookie required'); - if ('string' != typeof secret) throw new TypeError('secret required'); - return val + '.' + crypto - .createHmac('sha256', secret) - .update(val) - .digest('base64') - .replace(/\=+$/, ''); -}; - -/** - * Unsign and decode the given `val` with `secret`, - * returning `false` if the signature is invalid. - * - * @param {String} val - * @param {String} secret - * @return {String|Boolean} - * @api private - */ - -exports.unsign = function(val, secret){ - if ('string' != typeof val) throw new TypeError('cookie required'); - if ('string' != typeof secret) throw new TypeError('secret required'); - var str = val.slice(0, val.lastIndexOf('.')) - , mac = exports.sign(str, secret); - - return sha1(mac) == sha1(val) ? str : false; -}; - -/** - * Private - */ - -function sha1(str){ - return crypto.createHash('sha1').update(str).digest('hex'); -} diff --git a/node_modules/express-session/node_modules/cookie-signature/package.json b/node_modules/express-session/node_modules/cookie-signature/package.json deleted file mode 100644 index 6ad14d4..0000000 --- a/node_modules/express-session/node_modules/cookie-signature/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "cookie-signature", - "version": "1.0.4", - "description": "Sign and unsign cookies", - "keywords": [ - "cookie", - "sign", - "unsign" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@learnboost.com" - }, - "repository": { - "type": "git", - "url": "https://github.com/visionmedia/node-cookie-signature.git" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "main": "index", - "readme": "\n# cookie-signature\n\n Sign and unsign cookies.\n\n## Example\n\n```js\nvar cookie = require('cookie-signature');\n\nvar val = cookie.sign('hello', 'tobiiscool');\nval.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI');\n\nvar val = cookie.sign('hello', 'tobiiscool');\ncookie.unsign(val, 'tobiiscool').should.equal('hello');\ncookie.unsign(val, 'luna').should.be.false;\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 LearnBoost <tj@learnboost.com>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", - "readmeFilename": "Readme.md", - "bugs": { - "url": "https://github.com/visionmedia/node-cookie-signature/issues" - }, - "homepage": "https://github.com/visionmedia/node-cookie-signature", - "_id": "cookie-signature@1.0.4", - "dist": { - "shasum": "0edd22286e3a111b9a2a70db363e925e867f6aca" - }, - "_from": "cookie-signature@1.0.4", - "_resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.4.tgz" -} diff --git a/node_modules/express-session/node_modules/cookie/.npmignore b/node_modules/express-session/node_modules/cookie/.npmignore deleted file mode 100644 index efab07f..0000000 --- a/node_modules/express-session/node_modules/cookie/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -test -.travis.yml diff --git a/node_modules/express-session/node_modules/cookie/LICENSE b/node_modules/express-session/node_modules/cookie/LICENSE deleted file mode 100644 index 249d9de..0000000 --- a/node_modules/express-session/node_modules/cookie/LICENSE +++ /dev/null @@ -1,9 +0,0 @@ -// MIT License - -Copyright (C) Roman Shtylman - -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/node_modules/express-session/node_modules/cookie/README.md b/node_modules/express-session/node_modules/cookie/README.md deleted file mode 100644 index 3170b4b..0000000 --- a/node_modules/express-session/node_modules/cookie/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# cookie [![Build Status](https://secure.travis-ci.org/defunctzombie/node-cookie.png?branch=master)](http://travis-ci.org/defunctzombie/node-cookie) # - -cookie is a basic cookie parser and serializer. It doesn't make assumptions about how you are going to deal with your cookies. It basically just provides a way to read and write the HTTP cookie headers. - -See [RFC6265](http://tools.ietf.org/html/rfc6265) for details about the http header for cookies. - -## how? - -``` -npm install cookie -``` - -```javascript -var cookie = require('cookie'); - -var hdr = cookie.serialize('foo', 'bar'); -// hdr = 'foo=bar'; - -var cookies = cookie.parse('foo=bar; cat=meow; dog=ruff'); -// cookies = { foo: 'bar', cat: 'meow', dog: 'ruff' }; -``` - -## more - -The serialize function takes a third parameter, an object, to set cookie options. See the RFC for valid values. - -### path -> cookie path - -### expires -> absolute expiration date for the cookie (Date object) - -### maxAge -> relative max age of the cookie from when the client receives it (seconds) - -### domain -> domain for the cookie - -### secure -> true or false - -### httpOnly -> true or false - diff --git a/node_modules/express-session/node_modules/cookie/index.js b/node_modules/express-session/node_modules/cookie/index.js deleted file mode 100644 index 00d54a7..0000000 --- a/node_modules/express-session/node_modules/cookie/index.js +++ /dev/null @@ -1,75 +0,0 @@ - -/// Serialize the a name value pair into a cookie string suitable for -/// http headers. An optional options object specified cookie parameters -/// -/// serialize('foo', 'bar', { httpOnly: true }) -/// => "foo=bar; httpOnly" -/// -/// @param {String} name -/// @param {String} val -/// @param {Object} options -/// @return {String} -var serialize = function(name, val, opt){ - opt = opt || {}; - var enc = opt.encode || encode; - var pairs = [name + '=' + enc(val)]; - - if (null != opt.maxAge) { - var maxAge = opt.maxAge - 0; - if (isNaN(maxAge)) throw new Error('maxAge should be a Number'); - pairs.push('Max-Age=' + maxAge); - } - - if (opt.domain) pairs.push('Domain=' + opt.domain); - if (opt.path) pairs.push('Path=' + opt.path); - if (opt.expires) pairs.push('Expires=' + opt.expires.toUTCString()); - if (opt.httpOnly) pairs.push('HttpOnly'); - if (opt.secure) pairs.push('Secure'); - - return pairs.join('; '); -}; - -/// Parse the given cookie header string into an object -/// The object has the various cookies as keys(names) => values -/// @param {String} str -/// @return {Object} -var parse = function(str, opt) { - opt = opt || {}; - var obj = {} - var pairs = str.split(/; */); - var dec = opt.decode || decode; - - pairs.forEach(function(pair) { - var eq_idx = pair.indexOf('=') - - // skip things that don't look like key=value - if (eq_idx < 0) { - return; - } - - var key = pair.substr(0, eq_idx).trim() - var val = pair.substr(++eq_idx, pair.length).trim(); - - // quoted values - if ('"' == val[0]) { - val = val.slice(1, -1); - } - - // only assign once - if (undefined == obj[key]) { - try { - obj[key] = dec(val); - } catch (e) { - obj[key] = val; - } - } - }); - - return obj; -}; - -var encode = encodeURIComponent; -var decode = decodeURIComponent; - -module.exports.serialize = serialize; -module.exports.parse = parse; diff --git a/node_modules/express-session/node_modules/cookie/package.json b/node_modules/express-session/node_modules/cookie/package.json deleted file mode 100644 index 46e38e7..0000000 --- a/node_modules/express-session/node_modules/cookie/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "author": { - "name": "Roman Shtylman", - "email": "shtylman@gmail.com" - }, - "name": "cookie", - "description": "cookie parsing and serialization", - "version": "0.1.2", - "repository": { - "type": "git", - "url": "git://github.com/shtylman/node-cookie.git" - }, - "keywords": [ - "cookie", - "cookies" - ], - "main": "index.js", - "scripts": { - "test": "mocha" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "1.x.x" - }, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "readme": "# cookie [![Build Status](https://secure.travis-ci.org/defunctzombie/node-cookie.png?branch=master)](http://travis-ci.org/defunctzombie/node-cookie) #\n\ncookie is a basic cookie parser and serializer. It doesn't make assumptions about how you are going to deal with your cookies. It basically just provides a way to read and write the HTTP cookie headers.\n\nSee [RFC6265](http://tools.ietf.org/html/rfc6265) for details about the http header for cookies.\n\n## how?\n\n```\nnpm install cookie\n```\n\n```javascript\nvar cookie = require('cookie');\n\nvar hdr = cookie.serialize('foo', 'bar');\n// hdr = 'foo=bar';\n\nvar cookies = cookie.parse('foo=bar; cat=meow; dog=ruff');\n// cookies = { foo: 'bar', cat: 'meow', dog: 'ruff' };\n```\n\n## more\n\nThe serialize function takes a third parameter, an object, to set cookie options. See the RFC for valid values.\n\n### path\n> cookie path\n\n### expires\n> absolute expiration date for the cookie (Date object)\n\n### maxAge\n> relative max age of the cookie from when the client receives it (seconds)\n\n### domain\n> domain for the cookie\n\n### secure\n> true or false\n\n### httpOnly\n> true or false\n\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/shtylman/node-cookie/issues" - }, - "homepage": "https://github.com/shtylman/node-cookie", - "_id": "cookie@0.1.2", - "dist": { - "shasum": "72fec3d24e48a3432073d90c12642005061004b1" - }, - "_from": "cookie@0.1.2", - "_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.1.2.tgz" -} diff --git a/node_modules/express-session/node_modules/debug/.jshintrc b/node_modules/express-session/node_modules/debug/.jshintrc deleted file mode 100644 index 299877f..0000000 --- a/node_modules/express-session/node_modules/debug/.jshintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "laxbreak": true -} diff --git a/node_modules/express-session/node_modules/debug/.npmignore b/node_modules/express-session/node_modules/debug/.npmignore deleted file mode 100644 index 7e6163d..0000000 --- a/node_modules/express-session/node_modules/debug/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -support -test -examples -example -*.sock -dist diff --git a/node_modules/express-session/node_modules/debug/History.md b/node_modules/express-session/node_modules/debug/History.md deleted file mode 100644 index 3b96560..0000000 --- a/node_modules/express-session/node_modules/debug/History.md +++ /dev/null @@ -1,144 +0,0 @@ - -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/node_modules/express-session/node_modules/debug/Makefile b/node_modules/express-session/node_modules/debug/Makefile deleted file mode 100644 index b0bde6e..0000000 --- a/node_modules/express-session/node_modules/debug/Makefile +++ /dev/null @@ -1,33 +0,0 @@ - -# 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 node_modules dist - -dist: - @mkdir -p $@ - -dist/debug.js: node_modules browser.js debug.js dist - @$(BROWSERIFY) \ - --standalone debug \ - . > $@ - -node_modules: package.json - @NODE_ENV= $(NPM) install - @touch node_modules - -.PHONY: all install clean diff --git a/node_modules/express-session/node_modules/debug/Readme.md b/node_modules/express-session/node_modules/debug/Readme.md deleted file mode 100644 index e59b9ad..0000000 --- a/node_modules/express-session/node_modules/debug/Readme.md +++ /dev/null @@ -1,156 +0,0 @@ -# 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) - -## 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`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. - -```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 _stderr.js_: - -```js -var debug = require('../'); -var log = debug('app:log'); - -// by default console.log is used -log('goes to stdout!'); - -var error = debug('app:error'); -// set this namespace to log via console.error -error.log = console.error.bind(console); // don't forget to bind to console! -error('goes to stderr'); -log('still goes to stdout!'); - -// set all output to go via console.warn -// overrides all per-namespace log settings -debug.log = console.warn.bind(console); -log('now goes to stderr via console.warn'); -error('still goes to stderr, but via console.warn now'); -``` - -## 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/node_modules/express-session/node_modules/debug/browser.js b/node_modules/express-session/node_modules/debug/browser.js deleted file mode 100644 index ce6369f..0000000 --- a/node_modules/express-session/node_modules/debug/browser.js +++ /dev/null @@ -1,147 +0,0 @@ - -/** - * 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; - -/** - * 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, - // where the `console.log` function doesn't have 'apply' - return 'object' == typeof console - && 'function' == typeof console.log - && Function.prototype.apply.call(console.log, console, arguments); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - try { - if (null == namespaces) { - localStorage.removeItem('debug'); - } else { - localStorage.debug = namespaces; - } - } catch(e) {} -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - var r; - try { - r = localStorage.debug; - } catch(e) {} - return r; -} - -/** - * Enable namespaces listed in `localStorage.debug` initially. - */ - -exports.enable(load()); diff --git a/node_modules/express-session/node_modules/debug/component.json b/node_modules/express-session/node_modules/debug/component.json deleted file mode 100644 index ab5f3ee..0000000 --- a/node_modules/express-session/node_modules/debug/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "debug", - "repo": "visionmedia/debug", - "description": "small debugging utility", - "version": "1.0.4", - "keywords": [ - "debug", - "log", - "debugger" - ], - "main": "browser.js", - "scripts": [ - "browser.js", - "debug.js" - ], - "dependencies": { - "guille/ms.js": "0.6.1" - } -} diff --git a/node_modules/express-session/node_modules/debug/debug.js b/node_modules/express-session/node_modules/debug/debug.js deleted file mode 100644 index 7571a86..0000000 --- a/node_modules/express-session/node_modules/debug/debug.js +++ /dev/null @@ -1,197 +0,0 @@ - -/** - * 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/node_modules/express-session/node_modules/debug/node.js b/node_modules/express-session/node_modules/debug/node.js deleted file mode 100644 index c94f7d1..0000000 --- a/node_modules/express-session/node_modules/debug/node.js +++ /dev/null @@ -1,129 +0,0 @@ - -/** - * 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]; - -/** - * 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(1); - } 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[9' + c + 'm' + 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.log()` with the specified arguments. - */ - -function log() { - return console.log.apply(console, arguments); -} - -/** - * 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; -} - -/** - * Enable namespaces listed in `process.env.DEBUG` initially. - */ - -exports.enable(load()); diff --git a/node_modules/express-session/node_modules/debug/node_modules/ms/.npmignore b/node_modules/express-session/node_modules/debug/node_modules/ms/.npmignore deleted file mode 100644 index d1aa0ce..0000000 --- a/node_modules/express-session/node_modules/debug/node_modules/ms/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -test -History.md -Makefile -component.json diff --git a/node_modules/express-session/node_modules/debug/node_modules/ms/README.md b/node_modules/express-session/node_modules/debug/node_modules/ms/README.md deleted file mode 100644 index d4ab12a..0000000 --- a/node_modules/express-session/node_modules/debug/node_modules/ms/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# ms.js: miliseconds conversion utility - -```js -ms('1d') // 86400000 -ms('10h') // 36000000 -ms('2h') // 7200000 -ms('1m') // 60000 -ms('5s') // 5000 -ms('100') // 100 -``` - -```js -ms(60000) // "1m" -ms(2 * 60000) // "2m" -ms(ms('10 hours')) // "10h" -``` - -```js -ms(60000, { long: true }) // "1 minute" -ms(2 * 60000, { long: true }) // "2 minutes" -ms(ms('10 hours', { long: true })) // "10 hours" -``` - -- Node/Browser compatible. Published as `ms` in NPM. -- If a number is supplied to `ms`, a string with a unit is returned. -- If a string that contains the number is supplied, it returns it as -a number (e.g: it returns `100` for `'100'`). -- If you pass a string with a number and a valid unit, the number of -equivalent ms is returned. - -## License - -MIT \ No newline at end of file diff --git a/node_modules/express-session/node_modules/debug/node_modules/ms/index.js b/node_modules/express-session/node_modules/debug/node_modules/ms/index.js deleted file mode 100644 index c5847f8..0000000 --- a/node_modules/express-session/node_modules/debug/node_modules/ms/index.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var y = d * 365.25; - -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} options - * @return {String|Number} - * @api public - */ - -module.exports = function(val, options){ - options = options || {}; - if ('string' == typeof val) return parse(val); - return options.long - ? long(val) - : short(val); -}; - -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function parse(str) { - var match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str); - if (!match) return; - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'y': - return n * y; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 's': - return n * s; - case 'ms': - return n; - } -} - -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function short(ms) { - if (ms >= d) return Math.round(ms / d) + 'd'; - if (ms >= h) return Math.round(ms / h) + 'h'; - if (ms >= m) return Math.round(ms / m) + 'm'; - if (ms >= s) return Math.round(ms / s) + 's'; - return ms + 'ms'; -} - -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function long(ms) { - return plural(ms, d, 'day') - || plural(ms, h, 'hour') - || plural(ms, m, 'minute') - || plural(ms, s, 'second') - || ms + ' ms'; -} - -/** - * Pluralization helper. - */ - -function plural(ms, n, name) { - if (ms < n) return; - if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; - return Math.ceil(ms / n) + ' ' + name + 's'; -} diff --git a/node_modules/express-session/node_modules/debug/node_modules/ms/package.json b/node_modules/express-session/node_modules/debug/node_modules/ms/package.json deleted file mode 100644 index 5ea9cac..0000000 --- a/node_modules/express-session/node_modules/debug/node_modules/ms/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "ms", - "version": "0.6.2", - "description": "Tiny ms conversion utility", - "repository": { - "type": "git", - "url": "git://github.com/guille/ms.js.git" - }, - "main": "./index", - "devDependencies": { - "mocha": "*", - "expect.js": "*", - "serve": "*" - }, - "component": { - "scripts": { - "ms/index.js": "index.js" - } - }, - "readme": "# ms.js: miliseconds conversion utility\n\n```js\nms('1d') // 86400000\nms('10h') // 36000000\nms('2h') // 7200000\nms('1m') // 60000\nms('5s') // 5000\nms('100') // 100\n```\n\n```js\nms(60000) // \"1m\"\nms(2 * 60000) // \"2m\"\nms(ms('10 hours')) // \"10h\"\n```\n\n```js\nms(60000, { long: true }) // \"1 minute\"\nms(2 * 60000, { long: true }) // \"2 minutes\"\nms(ms('10 hours', { long: true })) // \"10 hours\"\n```\n\n- Node/Browser compatible. Published as `ms` in NPM.\n- If a number is supplied to `ms`, a string with a unit is returned.\n- If a string that contains the number is supplied, it returns it as\na number (e.g: it returns `100` for `'100'`).\n- If you pass a string with a number and a valid unit, the number of\nequivalent ms is returned.\n\n## License\n\nMIT", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/guille/ms.js/issues" - }, - "homepage": "https://github.com/guille/ms.js", - "_id": "ms@0.6.2", - "dist": { - "shasum": "d89c2124c6fdc1353d65a8b77bf1aac4b193708c" - }, - "_from": "ms@0.6.2", - "_resolved": "https://registry.npmjs.org/ms/-/ms-0.6.2.tgz" -} diff --git a/node_modules/express-session/node_modules/debug/package.json b/node_modules/express-session/node_modules/debug/package.json deleted file mode 100644 index e8b07d1..0000000 --- a/node_modules/express-session/node_modules/debug/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "debug", - "version": "1.0.4", - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/debug.git" - }, - "description": "small debugging utility", - "keywords": [ - "debug", - "log", - "debugger" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "contributors": [ - { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io" - } - ], - "dependencies": { - "ms": "0.6.2" - }, - "devDependencies": { - "browserify": "4.1.6", - "mocha": "*" - }, - "main": "./node.js", - "browser": "./browser.js", - "component": { - "scripts": { - "debug/index.js": "browser.js", - "debug/debug.js": "debug.js" - } - }, - "readme": "# debug\n\n tiny node.js debugging utility modelled after node core's debugging technique.\n\n## Installation\n\n```bash\n$ npm install debug\n```\n\n## Usage\n\n 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.\n\nExample _app.js_:\n\n```js\nvar debug = require('debug')('http')\n , http = require('http')\n , name = 'My App';\n\n// fake app\n\ndebug('booting %s', name);\n\nhttp.createServer(function(req, res){\n debug(req.method + ' ' + req.url);\n res.end('hello\\n');\n}).listen(3000, function(){\n debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample _worker.js_:\n\n```js\nvar debug = require('debug')('worker');\n\nsetInterval(function(){\n debug('doing some work');\n}, 1000);\n```\n\n The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:\n\n ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)\n\n ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)\n\n## Millisecond diff\n\n 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.\n\n ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)\n\n When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:\n\n ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)\n\n## Conventions\n\n 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\".\n\n## Wildcards\n\n 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=*`.\n\n 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:\".\n\n## Browser support\n\n Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`.\n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n b('doing some work');\n}, 1200);\n```\n\n#### Web Inspector Colors\n\n Colors are also enabled on \"Web Inspectors\" that understand the `%c` formatting\n option. These are WebKit web inspectors, Firefox ([since version\n 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))\n and the Firebug plugin for Firefox (any version).\n\n Colored output looks something like:\n\n ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png)\n\n### stderr vs stdout\n\nYou can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally:\n\nExample _stderr.js_:\n\n```js\nvar debug = require('../');\nvar log = debug('app:log');\n\n// by default console.log is used\nlog('goes to stdout!');\n\nvar error = debug('app:error');\n// set this namespace to log via console.error\nerror.log = console.error.bind(console); // don't forget to bind to console!\nerror('goes to stderr');\nlog('still goes to stdout!');\n\n// set all output to go via console.warn\n// overrides all per-namespace log settings\ndebug.log = console.warn.bind(console);\nlog('now goes to stderr via console.warn');\nerror('still goes to stderr, but via console.warn now');\n```\n\n## Authors\n\n - TJ Holowaychuk\n - Nathan Rajlich\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", - "readmeFilename": "Readme.md", - "bugs": { - "url": "https://github.com/visionmedia/debug/issues" - }, - "homepage": "https://github.com/visionmedia/debug", - "_id": "debug@1.0.4", - "dist": { - "shasum": "8a2e8e20db6bfc97bbfe967bb076fc1ce411415d" - }, - "_from": "debug@1.0.4", - "_resolved": "https://registry.npmjs.org/debug/-/debug-1.0.4.tgz" -} diff --git a/node_modules/express-session/node_modules/depd/.npmignore b/node_modules/express-session/node_modules/depd/.npmignore deleted file mode 100644 index 0c7e391..0000000 --- a/node_modules/express-session/node_modules/depd/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -coverage/ -files/ -test/ -.travis.yml diff --git a/node_modules/express-session/node_modules/depd/History.md b/node_modules/express-session/node_modules/depd/History.md deleted file mode 100644 index ba1af12..0000000 --- a/node_modules/express-session/node_modules/depd/History.md +++ /dev/null @@ -1,56 +0,0 @@ -0.4.4 / 2014-07-27 -================== - - * Work-around v8 generating empty stack traces - -0.4.3 / 2014-07-26 -================== - - * Fix exception when global `Error.stackTraceLimit` is too low - -0.4.2 / 2014-07-19 -================== - - * Correct call site for wrapped functions and properties - -0.4.1 / 2014-07-19 -================== - - * Improve automatic message generation for function properties - -0.4.0 / 2014-07-19 -================== - - * Add `TRACE_DEPRECATION` environment variable - * Remove non-standard grey color from color output - * Support `--no-deprecation` argument - * Support `--trace-deprecation` argument - * Support `deprecate.property(fn, prop, message)` - -0.3.0 / 2014-06-16 -================== - - * Add `NO_DEPRECATION` environment variable - -0.2.0 / 2014-06-15 -================== - - * Add `deprecate.property(obj, prop, message)` - * Remove `supports-color` dependency for node.js 0.8 - -0.1.0 / 2014-06-15 -================== - - * Add `deprecate.function(fn, message)` - * Add `process.on('deprecation', fn)` emitter - * Automatically generate message when omitted from `deprecate()` - -0.0.1 / 2014-06-15 -================== - - * Fix warning for dynamic calls at singe call site - -0.0.0 / 2014-06-15 -================== - - * Initial implementation diff --git a/node_modules/express-session/node_modules/depd/LICENSE b/node_modules/express-session/node_modules/depd/LICENSE deleted file mode 100644 index b7dce6c..0000000 --- a/node_modules/express-session/node_modules/depd/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Douglas Christopher Wilson - -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/node_modules/express-session/node_modules/depd/Readme.md b/node_modules/express-session/node_modules/depd/Readme.md deleted file mode 100644 index 47a53a1..0000000 --- a/node_modules/express-session/node_modules/depd/Readme.md +++ /dev/null @@ -1,272 +0,0 @@ -# depd - -[![NPM version](https://badge.fury.io/js/depd.svg)](http://badge.fury.io/js/depd) -[![Build Status](https://travis-ci.org/dougwilson/nodejs-depd.svg?branch=master)](https://travis-ci.org/dougwilson/nodejs-depd) -[![Coverage Status](https://img.shields.io/coveralls/dougwilson/nodejs-depd.svg?branch=master)](https://coveralls.io/r/dougwilson/nodejs-depd) -[![Gittip](http://img.shields.io/gittip/dougwilson.svg)](https://www.gittip.com/dougwilson/) - -Deprecate all the things - -> With great modules comes great responsibility; mark things deprecated! - -## Install - -```sh -$ npm install depd -``` - -## API - -```js -var deprecate = require('depd')('my-module') -``` - -This library allows you to display deprecation messages to your users. -This library goes above and beyond with deprecation warnings by -introspecting the call stack (but only the bits that it is interested -in). - -Instead of just warning on the first invocation of a deprecated -function and never again, this module will warn on the first invocation -of a deprecated function per unique call site, making it ideal to alert -users of all deprecated uses across the code base, rather than just -whatever happens to execute first. - -The deprecation warnings from this module also include the file and line -information for the call into the module that the deprecated function was -in. - -### depd(namespace) - -Create a new deprecate function that uses the given namespace name in the -messages and will display the call site prior to the stack entering the -file this function was called from. It is highly suggested you use the -name of your module as the namespace. - -### deprecate(message) - -Call this function from deprecated code to display a deprecation message. -This message will appear once per unique caller site. Caller site is the -first call site in the stack in a different file from the caller of this -function. - -If the message is omitted, a message is generated for you based on the site -of the `deprecate()` call and will display the name of the function called, -similar to the name displayed in a stack trace. - -### deprecate.function(fn, message) - -Call this function to wrap a given function in a deprecation message on any -call to the function. An optional message can be supplied to provide a custom -message. - -### deprecate.property(obj, prop, message) - -Call this function to wrap a given property on object in a deprecation message -on any accessing or setting of the property. An optional message can be supplied -to provide a custom message. - -The method must be called on the object where the property belongs (not -inherited from the prototype). - -If the property is a data descriptor, it will be converted to an accessor -descriptor in order to display the deprecation message. - -### process.on('deprecation', fn) - -This module will allow easy capturing of deprecation errors by emitting the -errors as the type "deprecation" on the global `process`. If there are no -listeners for this type, the errors are written to STDERR as normal, but if -there are any listeners, nothing will be written to STDERR and instead only -emitted. From there, you can write the errors in a different format or to a -logging source. - -The error represents the deprecation and is emitted only once with the same -rules as writing to STDERR. The error has the following properties: - - - `message` - This is the message given by the library - - `name` - This is always `'DeprecationError'` - - `namespace` - This is the namespace the deprecation came from - - `stack` - This is the stack of the call to the deprecated thing - -Example `error.stack` output: - -``` -DeprecationError: my-cool-module deprecated oldfunction - at Object. ([eval]-wrapper:6:22) - at Module._compile (module.js:456:26) - at evalScript (node.js:532:25) - at startup (node.js:80:7) - at node.js:902:3 -``` - -### process.env.NO_DEPRECATION - -As a user of modules that are deprecated, the environment variable `NO_DEPRECATION` -is provided as a quick solution to silencing deprecation warnings from being -output. The format of this is similar to that of `DEBUG`: - -```sh -$ NO_DEPRECATION=my-module,othermod node app.js -``` - -This will suppress deprecations from being output for "my-module" and "othermod". -The value is a list of comma-separated namespaces. To suppress every warning -across all namespaces, use the value `*` for a namespace. - -Providing the argument `--no-deprecation` to the `node` executable will suppress -all deprecations. - -**NOTE** This will not suppress the deperecations given to any "deprecation" -event listeners, just the output to STDERR. - -### process.env.TRACE_DEPRECATION - -As a user of modules that are deprecated, the environment variable `TRACE_DEPRECATION` -is provided as a solution to getting more detailed location information in deprecation -warnings by including the entire stack trace. The format of this is the same as -`NO_DEPRECATION`: - -```sh -$ TRACE_DEPRECATION=my-module,othermod node app.js -``` - -This will include stack traces for deprecations being output for "my-module" and -"othermod". The value is a list of comma-separated namespaces. To trace every -warning across all namespaces, use the value `*` for a namespace. - -Providing the argument `--trace-deprecation` to the `node` executable will trace -all deprecations. - -**NOTE** This will not trace the deperecations silenced by `NO_DEPRECATION`. - -## Display - -![message](files/message.png) - -When a user calls a function in your library that you mark deprecated, they -will see the following written to STDERR (in the given colors, similar colors -and layout to the `debug` module): - -``` -bright cyan bright yellow -| | reset cyan -| | | | -▼ ▼ ▼ ▼ -my-cool-module deprecated oldfunction [eval]-wrapper:6:22 -▲ ▲ ▲ ▲ -| | | | -namespace | | location of mycoolmod.oldfunction() call - | deprecation message - the word "deprecated" -``` - -If the user redirects their STDERR to a file or somewhere that does not support -colors, they see (similar layout to the `debug` module): - -``` -Sun, 15 Jun 2014 05:21:37 GMT my-cool-module deprecated oldfunction at [eval]-wrapper:6:22 -▲ ▲ ▲ ▲ ▲ -| | | | | -timestamp of message namespace | | location of mycoolmod.oldfunction() call - | deprecation message - the word "deprecated" -``` - -## Examples - -### Deprecating all calls to a function - -This will display a deprecated message about "oldfunction" being deprecated -from "my-module" on STDERR. - -```js -var deprecate = require('depd')('my-cool-module') - -// message automatically derived from function name -// Object.oldfunction -exports.oldfunction = deprecate.function(function oldfunction() { - // all calls to function are deprecated -}) - -// specific message -exports.oldfunction = deprecate.function(function () { - // all calls to function are deprecated -}, 'oldfunction') -``` - -### Conditionally deprecating a function call - -This will display a deprecated message about "weirdfunction" being deprecated -from "my-module" on STDERR when called with less than 2 arguments. - -```js -var deprecate = require('depd')('my-cool-module') - -exports.weirdfunction = function () { - if (arguments.length < 2) { - // calls with 0 or 1 args are deprecated - deprecate('weirdfunction args < 2') - } -} -``` - -When calling `deprecate` as a function, the warning is counted per call site -within your own module, so you can display different deprecations depending -on different situations and the users will still get all the warnings: - -```js -var deprecate = require('depd')('my-cool-module') - -exports.weirdfunction = function () { - if (arguments.length < 2) { - // calls with 0 or 1 args are deprecated - deprecate('weirdfunction args < 2') - } else if (typeof arguments[0] !== 'string') { - // calls with non-string first argument are deprecated - deprecate('weirdfunction non-string first arg') - } -} -``` - -### Deprecating property access - -This will display a deprecated message about "oldprop" being deprecated -from "my-module" on STDERR when accessed. A deprecation will be displayed -when setting the value and when getting the value. - -```js -var deprecate = require('depd')('my-cool-module') - -exports.oldprop = 'something' - -// message automatically derives from property name -deprecate.property(exports, 'oldprop') - -// explicit message -deprecate.property(exports, 'oldprop', 'oldprop >= 0.10') -``` - -## License - -The MIT License (MIT) - -Copyright (c) 2014 Douglas Christopher Wilson - -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/node_modules/express-session/node_modules/depd/index.js b/node_modules/express-session/node_modules/depd/index.js deleted file mode 100644 index a6fb372..0000000 --- a/node_modules/express-session/node_modules/depd/index.js +++ /dev/null @@ -1,520 +0,0 @@ -/*! - * depd - * Copyright(c) 2014 Douglas Christopher Wilson - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter -var relative = require('path').relative - -/** - * Module exports. - */ - -module.exports = depd - -/** - * Get the path to base files on. - */ - -var basePath = process.cwd() - -/** - * Get listener count on event emitter. - */ - -/*istanbul ignore next*/ -var eventListenerCount = EventEmitter.listenerCount - || function (emitter, type) { return emitter.listeners(type).length } - -/** - * Determine if namespace is contained in the string. - */ - -function containsNamespace(str, namespace) { - var val = str.split(/[ ,]+/) - - namespace = String(namespace).toLowerCase() - - for (var i = 0 ; i < val.length; i++) { - if (!(str = val[i])) continue; - - // namespace contained - if (str === '*' || str.toLowerCase() === namespace) { - return true - } - } - - return false -} - -/** - * Convert a data descriptor to accessor descriptor. - */ - -function convertDataDescriptorToAccessor(obj, prop, message) { - var descriptor = Object.getOwnPropertyDescriptor(obj, prop) - var value = descriptor.value - - descriptor.get = function getter() { return value } - - if (descriptor.writable) { - descriptor.set = function setter(val) { return value = val } - } - - delete descriptor.value - delete descriptor.writable - - Object.defineProperty(obj, prop, descriptor) - - return descriptor -} - -/** - * Create arguments string to keep arity. - */ - -function createArgumentsString(arity) { - var str = '' - - for (var i = 0; i < arity; i++) { - str += ', arg' + i - } - - return str.substr(2) -} - -/** - * Create stack string from stack. - */ - -function createStackString(stack) { - var str = this.name + ': ' + this.namespace - - if (this.message) { - str += ' deprecated ' + this.message - } - - for (var i = 0; i < stack.length; i++) { - str += '\n at ' + stack[i].toString() - } - - return str -} - -/** - * Create deprecate for namespace in caller. - */ - -function depd(namespace) { - if (!namespace) { - throw new TypeError('argument namespace is required') - } - - var stack = getStack() - var site = callSiteLocation(stack[1]) - var file = site[0] - - function deprecate(message) { - // call to self as log - log.call(deprecate, message) - } - - deprecate._file = file - deprecate._ignored = isignored(namespace) - deprecate._namespace = namespace - deprecate._traced = istraced(namespace) - deprecate._warned = Object.create(null) - - deprecate.function = wrapfunction - deprecate.property = wrapproperty - - return deprecate -} - -/** - * Determine if namespace is ignored. - */ - -function isignored(namespace) { - /* istanbul ignore next: tested in a child processs */ - if (process.noDeprecation) { - // --no-deprecation support - return true - } - - var str = process.env.NO_DEPRECATION || '' - - // namespace ignored - return containsNamespace(str, namespace) -} - -/** - * Determine if namespace is traced. - */ - -function istraced(namespace) { - /* istanbul ignore next: tested in a child processs */ - if (process.traceDeprecation) { - // --trace-deprecation support - return true - } - - var str = process.env.TRACE_DEPRECATION || '' - - // namespace traced - return containsNamespace(str, namespace) -} - -/** - * Display deprecation message. - */ - -function log(message, site) { - var haslisteners = eventListenerCount(process, 'deprecation') !== 0 - - // abort early if no destination - if (!haslisteners && this._ignored) { - return - } - - var caller - var callFile - var callSite - var i = 0 - var seen = false - var stack = getStack() - var file = this._file - - if (site) { - // provided site - callSite = callSiteLocation(stack[1]) - callSite.name = site.name - file = callSite[0] - } else { - // get call site - i = 2 - site = callSiteLocation(stack[i]) - callSite = site - } - - // get caller of deprecated thing in relation to file - for (; i < stack.length; i++) { - caller = callSiteLocation(stack[i]) - callFile = caller[0] - - if (callFile === file) { - seen = true - } else if (callFile === this._file) { - file = this._file - } else if (seen) { - break - } - } - - var key = caller - ? site.join(':') + '__' + caller.join(':') - : undefined - - if (key !== undefined && key in this._warned) { - // already warned - return - } - - this._warned[key] = true - - // generate automatic message from call site - if (!message) { - message = callSite === site || !callSite.name - ? defaultMessage(site) - : defaultMessage(callSite) - } - - // emit deprecation if listeners exist - if (haslisteners) { - var err = DeprecationError(this._namespace, message, stack.slice(i)) - process.emit('deprecation', err) - return - } - - // format and write message - var format = process.stderr.isTTY - ? formatColor - : formatPlain - var msg = format.call(this, message, caller, stack.slice(i)) - process.stderr.write(msg + '\n', 'utf8') - - return -} - -/** - * Get call site location as array. - */ - -function callSiteLocation(callSite) { - var file = callSite.getFileName() || '' - var line = callSite.getLineNumber() - var colm = callSite.getColumnNumber() - - if (callSite.isEval()) { - file = callSite.getEvalOrigin() + ', ' + file - } - - var site = [file, line, colm] - - site.callSite = callSite - site.name = callSite.getFunctionName() - - return site -} - -/** - * Generate a default message from the site. - */ - -function defaultMessage(site) { - var callSite = site.callSite - var funcName = site.name - var typeName = callSite.getTypeName() - - // make useful anonymous name - if (!funcName) { - funcName = '' - } - - // make useful type name - if (typeName === 'Function') { - typeName = callSite.getThis().name || typeName - } - - return callSite.getMethodName() - ? typeName + '.' + funcName - : funcName -} - -/** - * Format deprecation message without color. - */ - -function formatPlain(msg, caller, stack) { - var timestamp = new Date().toUTCString() - - var formatted = timestamp - + ' ' + this._namespace - + ' deprecated ' + msg - - // add stack trace - if (this._traced) { - for (var i = 0; i < stack.length; i++) { - formatted += '\n at ' + stack[i].toString() - } - - return formatted - } - - if (caller) { - formatted += ' at ' + formatLocation(caller) - } - - return formatted -} - -/** - * Format deprecation message with color. - */ - -function formatColor(msg, caller, stack) { - var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' // bold cyan - + ' \x1b[33;1mdeprecated\x1b[22;39m' // bold yellow - + ' \x1b[0m' + msg + '\x1b[39m' // reset - - // add stack trace - if (this._traced) { - for (var i = 0; i < stack.length; i++) { - formatted += '\n \x1b[36mat ' + stack[i].toString() + '\x1b[39m' // cyan - } - - return formatted - } - - if (caller) { - formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m' // cyan - } - - return formatted -} - -/** - * Format call site location. - */ - -function formatLocation(callSite) { - return relative(basePath, callSite[0]) - + ':' + callSite[1] - + ':' + callSite[2] -} - -/** - * Get the stack as array of call sites. - */ - -function getStack() { - var limit = Error.stackTraceLimit - var obj = {} - var prep = Error.prepareStackTrace - - Error.prepareStackTrace = prepareObjectStackTrace - Error.stackTraceLimit = Math.max(10, limit) - - // capture the stack - Error.captureStackTrace(obj) - - // slice this function off the top - var stack = obj.stack.slice(1) - - Error.prepareStackTrace = prep - Error.stackTraceLimit = limit - - return stack -} - -/** - * Capture call site stack from v8. - */ - -function prepareObjectStackTrace(obj, stack) { - return stack -} - -/** - * Return a wrapped function in a deprecation message. - */ - -function wrapfunction(fn, message) { - if (typeof fn !== 'function') { - throw new TypeError('argument fn must be a function') - } - - var args = createArgumentsString(fn.length) - var deprecate = this - var stack = getStack() - var site = callSiteLocation(stack[1]) - - site.name = fn.name - - var deprecatedfn = eval('(function (' + args + ') {\n' - + 'log.call(deprecate, message, site)\n' - + 'return fn.apply(this, arguments)\n' - + '})') - - return deprecatedfn -} - -/** - * Wrap property in a deprecation message. - */ - -function wrapproperty(obj, prop, message) { - if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { - throw new TypeError('argument obj must be object') - } - - var descriptor = Object.getOwnPropertyDescriptor(obj, prop) - - if (!descriptor) { - throw new TypeError('must call property on owner object') - } - - if (!descriptor.configurable) { - throw new TypeError('property must be configurable') - } - - var deprecate = this - var stack = getStack() - var site = callSiteLocation(stack[1]) - - // set site name - site.name = prop - - // convert data descriptor - if ('value' in descriptor) { - descriptor = convertDataDescriptorToAccessor(obj, prop, message) - } - - var get = descriptor.get - var set = descriptor.set - - // wrap getter - if (typeof get === 'function') { - descriptor.get = function getter() { - log.call(deprecate, message, site) - return get.apply(this, arguments) - } - } - - // wrap setter - if (typeof set === 'function') { - descriptor.set = function setter() { - log.call(deprecate, message, site) - return set.apply(this, arguments) - } - } - - Object.defineProperty(obj, prop, descriptor) -} - -/** - * Create DeprecationError for deprecation - */ - -function DeprecationError(namespace, message, stack) { - var error = new Error() - var stackString - - Object.defineProperty(error, 'constructor', { - value: DeprecationError - }) - - Object.defineProperty(error, 'message', { - configurable: true, - enumerable: false, - value: message, - writable: true - }) - - Object.defineProperty(error, 'name', { - enumerable: false, - configurable: true, - value: 'DeprecationError', - writable: true - }) - - Object.defineProperty(error, 'namespace', { - configurable: true, - enumerable: false, - value: namespace, - writable: true - }) - - Object.defineProperty(error, 'stack', { - configurable: true, - enumerable: false, - get: function () { - if (stackString !== undefined) { - return stackString - } - - // prepare stack trace - return stackString = createStackString.call(this, stack) - }, - set: function setter(val) { - stackString = val - } - }) - - return error -} diff --git a/node_modules/express-session/node_modules/depd/package.json b/node_modules/express-session/node_modules/depd/package.json deleted file mode 100644 index 9a1a84c..0000000 --- a/node_modules/express-session/node_modules/depd/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "depd", - "description": "Deprecate all the things", - "version": "0.4.4", - "author": { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - "license": "MIT", - "keywords": [ - "deprecate", - "deprecated" - ], - "repository": { - "type": "git", - "url": "git://github.com/dougwilson/nodejs-depd" - }, - "devDependencies": { - "istanbul": "0.3.0", - "mocha": "~1.20.1", - "should": "~4.0.4" - }, - "engines": { - "node": ">= 0.8.0" - }, - "scripts": { - "test": "mocha --reporter spec --bail --require should test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --require should test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --require should test/" - }, - "readme": "# depd\n\n[![NPM version](https://badge.fury.io/js/depd.svg)](http://badge.fury.io/js/depd)\n[![Build Status](https://travis-ci.org/dougwilson/nodejs-depd.svg?branch=master)](https://travis-ci.org/dougwilson/nodejs-depd)\n[![Coverage Status](https://img.shields.io/coveralls/dougwilson/nodejs-depd.svg?branch=master)](https://coveralls.io/r/dougwilson/nodejs-depd)\n[![Gittip](http://img.shields.io/gittip/dougwilson.svg)](https://www.gittip.com/dougwilson/)\n\nDeprecate all the things\n\n> With great modules comes great responsibility; mark things deprecated!\n\n## Install\n\n```sh\n$ npm install depd\n```\n\n## API\n\n```js\nvar deprecate = require('depd')('my-module')\n```\n\nThis library allows you to display deprecation messages to your users.\nThis library goes above and beyond with deprecation warnings by\nintrospecting the call stack (but only the bits that it is interested\nin).\n\nInstead of just warning on the first invocation of a deprecated\nfunction and never again, this module will warn on the first invocation\nof a deprecated function per unique call site, making it ideal to alert\nusers of all deprecated uses across the code base, rather than just\nwhatever happens to execute first.\n\nThe deprecation warnings from this module also include the file and line\ninformation for the call into the module that the deprecated function was\nin.\n\n### depd(namespace)\n\nCreate a new deprecate function that uses the given namespace name in the\nmessages and will display the call site prior to the stack entering the\nfile this function was called from. It is highly suggested you use the\nname of your module as the namespace.\n\n### deprecate(message)\n\nCall this function from deprecated code to display a deprecation message.\nThis message will appear once per unique caller site. Caller site is the\nfirst call site in the stack in a different file from the caller of this\nfunction.\n\nIf the message is omitted, a message is generated for you based on the site\nof the `deprecate()` call and will display the name of the function called,\nsimilar to the name displayed in a stack trace.\n\n### deprecate.function(fn, message)\n\nCall this function to wrap a given function in a deprecation message on any\ncall to the function. An optional message can be supplied to provide a custom\nmessage.\n\n### deprecate.property(obj, prop, message)\n\nCall this function to wrap a given property on object in a deprecation message\non any accessing or setting of the property. An optional message can be supplied\nto provide a custom message.\n\nThe method must be called on the object where the property belongs (not\ninherited from the prototype).\n\nIf the property is a data descriptor, it will be converted to an accessor\ndescriptor in order to display the deprecation message.\n\n### process.on('deprecation', fn)\n\nThis module will allow easy capturing of deprecation errors by emitting the\nerrors as the type \"deprecation\" on the global `process`. If there are no\nlisteners for this type, the errors are written to STDERR as normal, but if\nthere are any listeners, nothing will be written to STDERR and instead only\nemitted. From there, you can write the errors in a different format or to a\nlogging source.\n\nThe error represents the deprecation and is emitted only once with the same\nrules as writing to STDERR. The error has the following properties:\n\n - `message` - This is the message given by the library\n - `name` - This is always `'DeprecationError'`\n - `namespace` - This is the namespace the deprecation came from\n - `stack` - This is the stack of the call to the deprecated thing\n\nExample `error.stack` output:\n\n```\nDeprecationError: my-cool-module deprecated oldfunction\n at Object. ([eval]-wrapper:6:22)\n at Module._compile (module.js:456:26)\n at evalScript (node.js:532:25)\n at startup (node.js:80:7)\n at node.js:902:3\n```\n\n### process.env.NO_DEPRECATION\n\nAs a user of modules that are deprecated, the environment variable `NO_DEPRECATION`\nis provided as a quick solution to silencing deprecation warnings from being\noutput. The format of this is similar to that of `DEBUG`:\n\n```sh\n$ NO_DEPRECATION=my-module,othermod node app.js\n```\n\nThis will suppress deprecations from being output for \"my-module\" and \"othermod\".\nThe value is a list of comma-separated namespaces. To suppress every warning\nacross all namespaces, use the value `*` for a namespace.\n\nProviding the argument `--no-deprecation` to the `node` executable will suppress\nall deprecations.\n\n**NOTE** This will not suppress the deperecations given to any \"deprecation\"\nevent listeners, just the output to STDERR.\n\n### process.env.TRACE_DEPRECATION\n\nAs a user of modules that are deprecated, the environment variable `TRACE_DEPRECATION`\nis provided as a solution to getting more detailed location information in deprecation\nwarnings by including the entire stack trace. The format of this is the same as\n`NO_DEPRECATION`:\n\n```sh\n$ TRACE_DEPRECATION=my-module,othermod node app.js\n```\n\nThis will include stack traces for deprecations being output for \"my-module\" and\n\"othermod\". The value is a list of comma-separated namespaces. To trace every\nwarning across all namespaces, use the value `*` for a namespace.\n\nProviding the argument `--trace-deprecation` to the `node` executable will trace\nall deprecations.\n\n**NOTE** This will not trace the deperecations silenced by `NO_DEPRECATION`.\n\n## Display\n\n![message](files/message.png)\n\nWhen a user calls a function in your library that you mark deprecated, they\nwill see the following written to STDERR (in the given colors, similar colors\nand layout to the `debug` module):\n\n```\nbright cyan bright yellow\n| | reset cyan\n| | | |\n▼ ▼ ▼ ▼\nmy-cool-module deprecated oldfunction [eval]-wrapper:6:22\n▲ ▲ ▲ ▲\n| | | |\nnamespace | | location of mycoolmod.oldfunction() call\n | deprecation message\n the word \"deprecated\"\n```\n\nIf the user redirects their STDERR to a file or somewhere that does not support\ncolors, they see (similar layout to the `debug` module):\n\n```\nSun, 15 Jun 2014 05:21:37 GMT my-cool-module deprecated oldfunction at [eval]-wrapper:6:22\n▲ ▲ ▲ ▲ ▲\n| | | | |\ntimestamp of message namespace | | location of mycoolmod.oldfunction() call\n | deprecation message\n the word \"deprecated\"\n```\n\n## Examples\n\n### Deprecating all calls to a function\n\nThis will display a deprecated message about \"oldfunction\" being deprecated\nfrom \"my-module\" on STDERR.\n\n```js\nvar deprecate = require('depd')('my-cool-module')\n\n// message automatically derived from function name\n// Object.oldfunction\nexports.oldfunction = deprecate.function(function oldfunction() {\n // all calls to function are deprecated\n})\n\n// specific message\nexports.oldfunction = deprecate.function(function () {\n // all calls to function are deprecated\n}, 'oldfunction')\n```\n\n### Conditionally deprecating a function call\n\nThis will display a deprecated message about \"weirdfunction\" being deprecated\nfrom \"my-module\" on STDERR when called with less than 2 arguments.\n\n```js\nvar deprecate = require('depd')('my-cool-module')\n\nexports.weirdfunction = function () {\n if (arguments.length < 2) {\n // calls with 0 or 1 args are deprecated\n deprecate('weirdfunction args < 2')\n }\n}\n```\n\nWhen calling `deprecate` as a function, the warning is counted per call site\nwithin your own module, so you can display different deprecations depending\non different situations and the users will still get all the warnings:\n\n```js\nvar deprecate = require('depd')('my-cool-module')\n\nexports.weirdfunction = function () {\n if (arguments.length < 2) {\n // calls with 0 or 1 args are deprecated\n deprecate('weirdfunction args < 2')\n } else if (typeof arguments[0] !== 'string') {\n // calls with non-string first argument are deprecated\n deprecate('weirdfunction non-string first arg')\n }\n}\n```\n\n### Deprecating property access\n\nThis will display a deprecated message about \"oldprop\" being deprecated\nfrom \"my-module\" on STDERR when accessed. A deprecation will be displayed\nwhen setting the value and when getting the value.\n\n```js\nvar deprecate = require('depd')('my-cool-module')\n\nexports.oldprop = 'something'\n\n// message automatically derives from property name\ndeprecate.property(exports, 'oldprop')\n\n// explicit message\ndeprecate.property(exports, 'oldprop', 'oldprop >= 0.10')\n```\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 Douglas Christopher Wilson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n", - "readmeFilename": "Readme.md", - "bugs": { - "url": "https://github.com/dougwilson/nodejs-depd/issues" - }, - "homepage": "https://github.com/dougwilson/nodejs-depd", - "_id": "depd@0.4.4", - "dist": { - "shasum": "006034f41204a7af85b489297937806a8de3ef62" - }, - "_from": "depd@0.4.4", - "_resolved": "https://registry.npmjs.org/depd/-/depd-0.4.4.tgz" -} diff --git a/node_modules/express-session/node_modules/on-headers/.npmignore b/node_modules/express-session/node_modules/on-headers/.npmignore deleted file mode 100644 index ac0bfb9..0000000 --- a/node_modules/express-session/node_modules/on-headers/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -test/ -.travis.yml diff --git a/node_modules/express-session/node_modules/on-headers/History.md b/node_modules/express-session/node_modules/on-headers/History.md deleted file mode 100644 index 369468c..0000000 --- a/node_modules/express-session/node_modules/on-headers/History.md +++ /dev/null @@ -1,4 +0,0 @@ -0.0.0 / 2014-05-13 -================== - - * Genesis from `connect` diff --git a/node_modules/express-session/node_modules/on-headers/LICENSE b/node_modules/express-session/node_modules/on-headers/LICENSE deleted file mode 100644 index b7dce6c..0000000 --- a/node_modules/express-session/node_modules/on-headers/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Douglas Christopher Wilson - -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/node_modules/express-session/node_modules/on-headers/README.md b/node_modules/express-session/node_modules/on-headers/README.md deleted file mode 100644 index 3b9bdd4..0000000 --- a/node_modules/express-session/node_modules/on-headers/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# on-headers [![Build Status](https://travis-ci.org/expressjs/on-headers.svg)](https://travis-ci.org/expressjs/on-headers) [![NPM version](https://badge.fury.io/js/on-headers.svg)](http://badge.fury.io/js/on-headers) - -Execute a listener when a response is about to write headers. - -## Install - -```sh -$ npm install on-headers -``` - -## API - -```js -var onHeaders = require('on-headers') -``` - -### onHeaders(res, listener) - -This will add the listener `listener` to fire when headers are emitted for `res`. -Headers are considered to be emitted only once, right before they are sent to -the client. - -## Examples - -```js -var http = require('http') -var onHeaders = require('on-headers') - -http -.createServer(onRequest) -.listen(3000) - -function addPoweredBy() { - // add if not set by end of request - if (!this.getHeader('X-Powered-By')) { - this.addHeader('X-Powered-By', 'Node.js') - } -} - -function onRequest(req, res) { - onHeaders(res, addPoweredBy) - - res.setHeader('Content-Type', 'text/plain') - res.end('hello!') -} -``` - -## License - -The MIT License (MIT) - -Copyright (c) 2014 Douglas Christopher Wilson doug@somethingdoug.com - -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/node_modules/express-session/node_modules/on-headers/index.js b/node_modules/express-session/node_modules/on-headers/index.js deleted file mode 100644 index 850e059..0000000 --- a/node_modules/express-session/node_modules/on-headers/index.js +++ /dev/null @@ -1,72 +0,0 @@ -/*! - * on-headers - * Copyright(c) 2014 Douglas Christopher Wilson - * MIT Licensed - */ - -/** - * Reference to Array slice. - */ - -var slice = Array.prototype.slice - -/** - * Execute a listener when a response is about to write headers. - * - * @param {Object} res - * @return {Function} listener - * @api public - */ - -module.exports = function onHeaders(res, listener) { - if (typeof listener !== 'function') { - throw new TypeError('listener must be a function') - } - - res.writeHead = createWriteHead(res.writeHead, listener) -} - -function createWriteHead(prevWriteHead, listener) { - var fired = false; - - // return function with core name and argument list - return function writeHead(statusCode) { - // set headers from arguments - var args = setWriteHeadHeaders.apply(this, arguments); - - // fire listener - if (!fired) { - fired = true - listener.call(this) - } - - prevWriteHead.apply(this, args); - } -} - -function setWriteHeadHeaders(statusCode) { - var headerIndex = typeof arguments[1] === 'string' - ? 2 - : 1 - - var headers = arguments[headerIndex] - - this.statusCode = statusCode - - // the following block is from node.js core - if (Array.isArray(headers)) { - // handle array case - for (var i = 0, len = headers.length; i < len; ++i) { - this.setHeader(headers[i][0], headers[i][1]) - } - } else if (headers) { - // handle object case - var keys = Object.keys(headers) - for (var i = 0; i < keys.length; i++) { - var k = keys[i] - if (k) this.setHeader(k, headers[k]) - } - } - - return slice.call(arguments, 0, headerIndex) -} diff --git a/node_modules/express-session/node_modules/on-headers/package.json b/node_modules/express-session/node_modules/on-headers/package.json deleted file mode 100644 index 983e0e4..0000000 --- a/node_modules/express-session/node_modules/on-headers/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "on-headers", - "description": "Execute a listener when a response is about to write headers", - "version": "0.0.0", - "author": { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - "license": "MIT", - "keywords": [ - "event", - "headers", - "http", - "onheaders" - ], - "repository": { - "type": "git", - "url": "https://github.com/expressjs/on-headers.git" - }, - "bugs": { - "url": "https://github.com/expressjs/on-headers/issues" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "~1.18.2", - "supertest": "~0.12.1" - }, - "engines": { - "node": ">= 0.8.0" - }, - "scripts": { - "test": "mocha --reporter spec test/" - }, - "readme": "# on-headers [![Build Status](https://travis-ci.org/expressjs/on-headers.svg)](https://travis-ci.org/expressjs/on-headers) [![NPM version](https://badge.fury.io/js/on-headers.svg)](http://badge.fury.io/js/on-headers)\n\nExecute a listener when a response is about to write headers.\n\n## Install\n\n```sh\n$ npm install on-headers\n```\n\n## API\n\n```js\nvar onHeaders = require('on-headers')\n```\n\n### onHeaders(res, listener)\n\nThis will add the listener `listener` to fire when headers are emitted for `res`.\nHeaders are considered to be emitted only once, right before they are sent to\nthe client.\n\n## Examples\n\n```js\nvar http = require('http')\nvar onHeaders = require('on-headers')\n\nhttp\n.createServer(onRequest)\n.listen(3000)\n\nfunction addPoweredBy() {\n // add if not set by end of request\n if (!this.getHeader('X-Powered-By')) {\n this.addHeader('X-Powered-By', 'Node.js')\n }\n}\n\nfunction onRequest(req, res) {\n onHeaders(res, addPoweredBy)\n\n res.setHeader('Content-Type', 'text/plain')\n res.end('hello!')\n}\n```\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 Douglas Christopher Wilson doug@somethingdoug.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n", - "readmeFilename": "README.md", - "homepage": "https://github.com/expressjs/on-headers", - "_id": "on-headers@0.0.0", - "dist": { - "shasum": "e1bd917f35859aad016317f4f22569ebce440d6e" - }, - "_from": "on-headers@0.0.0", - "_resolved": "https://registry.npmjs.org/on-headers/-/on-headers-0.0.0.tgz" -} diff --git a/node_modules/express-session/node_modules/uid-safe/.npmignore b/node_modules/express-session/node_modules/uid-safe/.npmignore deleted file mode 100644 index 72921ab..0000000 --- a/node_modules/express-session/node_modules/uid-safe/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -.DS_Store* -node_modules diff --git a/node_modules/express-session/node_modules/uid-safe/LICENSE b/node_modules/express-session/node_modules/uid-safe/LICENSE deleted file mode 100644 index a7ae8ee..0000000 --- a/node_modules/express-session/node_modules/uid-safe/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ - -The MIT License (MIT) - -Copyright (c) 2014 Jonathan Ong me@jongleberry.com - -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/node_modules/express-session/node_modules/uid-safe/README.md b/node_modules/express-session/node_modules/uid-safe/README.md deleted file mode 100644 index 2178c6c..0000000 --- a/node_modules/express-session/node_modules/uid-safe/README.md +++ /dev/null @@ -1,44 +0,0 @@ - -# UID Safe - -Create cryptographically secure UIDs safe for both cookie and URL usage. -This is in contrast to modules such as [rand-token](https://github.com/sehrope/node-rand-token) -and [uid2](https://github.com/coreh/uid2) whose UIDs are actually skewed -due to the use of `%` and unnecessarily truncate the UID. -Use this if you could still use UIDs with `-` and `_` in them. - -## API - -```js -var uid = require('uid-safe') -``` - -### uid(byteLength, [cb]) - -Asynchronously create a UID with a specific byte length. -Because `base64` encoding is used underneath, this is not the string length! -For example, to create a UID of length 24, you want a byte length of 18! - -If `cb` is not defined, a promise is returned. -However, to use promises, you must either install [bluebird](https://github.com/petkaantonov/bluebird) -or use a version of node.js that has native promises, -otherwise your process will crash and die. - -```js -uid(18).then(function (string) { - // do something with the string -}) - -uid(18, function (err, string) { - if (err) throw err - // do something with the string -}) -``` - -### uid.sync(byteLength) - -A synchronous version of above. - -```js -var string = uid.sync(18) -``` diff --git a/node_modules/express-session/node_modules/uid-safe/index.js b/node_modules/express-session/node_modules/uid-safe/index.js deleted file mode 100644 index 9e26461..0000000 --- a/node_modules/express-session/node_modules/uid-safe/index.js +++ /dev/null @@ -1,27 +0,0 @@ - -var pseudoRandomBytes = require('crypto').pseudoRandomBytes -var escape = require('base64-url').escape - -var pseudoRandomBytesProm - -module.exports = uid - -function uid(length, cb) { - if (cb) { - return pseudoRandomBytes(length, function (err, buf) { - if (err) return cb(err) - cb(null, escapeBuffer(buf)) - }) - } - - pseudoRandomBytesProm || (pseudoRandomBytesProm = require('mz/crypto').pseudoRandomBytes) - return pseudoRandomBytesProm(length).then(escapeBuffer) -} - -uid.sync = function uid_sync(length) { - return escapeBuffer(pseudoRandomBytes(length)) -} - -function escapeBuffer(buf) { - return escape(buf.toString('base64')) -} diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.npmignore b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.npmignore deleted file mode 100644 index b0e8ee7..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.npmignore +++ /dev/null @@ -1,12 +0,0 @@ -.*.swp -._* -.DS_Store -.git -.hg -.lock-wscript -.svn -.wafpickle-* -CVS -npm-debug.log -*.sublime-project -*.sublime-workspace \ No newline at end of file diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.travis.yml b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.travis.yml deleted file mode 100644 index 9c52355..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ - language: node_js - node_js: - - "0.11" - - "0.10" - - "0.8" - branches: - only: - - master - notifications: - email: - - joaquim.serafim@gmail.com - script: npm test diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/LICENSE b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/LICENSE deleted file mode 100644 index da1b624..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Joaquim José F. Serafim - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/README.md b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/README.md deleted file mode 100644 index aa34ec8..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# base64-url - -Base64 encode, decode, escape and unescape for URL applications. - - - -[![Build Status](https://travis-ci.org/joaquimserafim/base64-url.png?branch=master)](https://travis-ci.org/joaquimserafim/base64-url) - - - -**V1** - - -####API - - > base64url.encode('Node.js is awesome.'); - Tm9kZS5qcyBpcyBhd2Vzb21lLg - - > base64url.decode('Tm9kZS5qcyBpcyBhd2Vzb21lLg'); - Node.js is awesome. - - > base64url.escape(This+is/goingto+escape==); - This-is_goingto-escape - - > base64url.unescape('This-is_goingto-escape'); - This+is/goingto+escape== - \ No newline at end of file diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/index.js b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/index.js deleted file mode 100644 index c5547ee..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/index.js +++ /dev/null @@ -1,17 +0,0 @@ -var base64url = exports; - -base64url.unescape = function unescape (str) { - return (str + Array(5 - str.length % 4).join('=')).replace(/\-/g,'+').replace(/_/g, '/'); -}; - -base64url.escape = function escape (str) { - return str.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); -}; - -base64url.encode = function encode (str) { - return this.escape(new Buffer(str).toString('base64')); -}; - -base64url.decode = function decode (str) { - return new Buffer(this.unescape(str), 'base64').toString(); -}; diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/package.json b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/package.json deleted file mode 100644 index 77803c8..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "base64-url", - "version": "1.0.0", - "description": "Base64 encode, decode, escape and unescape for URL applications", - "main": "index.js", - "directories": { - "test": "test" - }, - "scripts": { - "test": "node test" - }, - "repository": { - "type": "git", - "url": "git://github.com/joaquimserafim/base64-url.git" - }, - "keywords": [ - "base64", - "base64url" - ], - "author": { - "name": "@joaquimserafim" - }, - "license": "ISC", - "bugs": { - "url": "https://github.com/joaquimserafim/base64-url/issues" - }, - "homepage": "https://github.com/joaquimserafim/base64-url", - "devDependencies": { - "tape": "^2.12.3" - }, - "readme": "# base64-url\n\nBase64 encode, decode, escape and unescape for URL applications.\n\n\n\n[![Build Status](https://travis-ci.org/joaquimserafim/base64-url.png?branch=master)](https://travis-ci.org/joaquimserafim/base64-url)\n\n\n\n**V1**\n\n\n####API\n \n \t> base64url.encode('Node.js is awesome.');\n \tTm9kZS5qcyBpcyBhd2Vzb21lLg\n\n \t> base64url.decode('Tm9kZS5qcyBpcyBhd2Vzb21lLg');\n \tNode.js is awesome.\n \n \t> base64url.escape(This+is/goingto+escape==);\n \tThis-is_goingto-escape\n \t\n > base64url.unescape('This-is_goingto-escape');\n This+is/goingto+escape==\n \t", - "readmeFilename": "README.md", - "_id": "base64-url@1.0.0", - "dist": { - "shasum": "ab694376f2801af6c9260899ffef02f86b40ee2c" - }, - "_from": "base64-url@1", - "_resolved": "https://registry.npmjs.org/base64-url/-/base64-url-1.0.0.tgz" -} diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/test/index.js b/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/test/index.js deleted file mode 100644 index 1c3c4ed..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/base64-url/test/index.js +++ /dev/null @@ -1,24 +0,0 @@ -var test = require('tape'); -var base64url = require('../'); - - -test('base64url', function (t) { - t.plan(4); - - var text = 'Node.js is awesome.'; - - var encode = base64url.encode(text); - t.ok(encode, 'encode: ' + encode); - - var decode = base64url.decode(encode); - t.deepEqual(decode, text, 'decode: ' + decode); - - var text_escape = 'This+is/goingto+escape=='; - console.log(text_escape); - - var escape = base64url.escape(text_escape); - t.equal(escape.match(/\+|\//g), null, 'escape (omit + and /): ' + escape); - - var unescape = base64url.unescape(escape); - t.equal(unescape.match(/\-|_/g), null, 'unescape (back to first form): ' + unescape); -}); diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/.npmignore b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/.npmignore deleted file mode 100644 index 9daeafb..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/.travis.yml b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/.travis.yml deleted file mode 100644 index 4a10bc4..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - '0.11' - - '0.10' - - '0.8' diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/HISTORY.md b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/HISTORY.md deleted file mode 100644 index 57d20a0..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/HISTORY.md +++ /dev/null @@ -1,6 +0,0 @@ - -1.0.0 / 2014-06-18 -================== - - * use `bluebird` by default if found - * support node 0.8 diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/LICENSE b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/LICENSE deleted file mode 100644 index a7ae8ee..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ - -The MIT License (MIT) - -Copyright (c) 2014 Jonathan Ong me@jongleberry.com - -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/node_modules/express-session/node_modules/uid-safe/node_modules/mz/README.md b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/README.md deleted file mode 100644 index fac80d9..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/README.md +++ /dev/null @@ -1,89 +0,0 @@ - -# MZ - Modernize node.js - -Modernize node.js to current ECMAScript specifications! -node.js will not update their API to ES6+ [for a while](https://github.com/joyent/node/issues/7549). -This library is a wrapper for various aspects of node.js' API. - -## Installation and Usage - -Set `mz` as a dependency and install it. - -```bash -npm i mz -``` - -Then prefix the relevant `require()`s with `mz/`: - -```js -var fs = require('mz/fs') - -fs.exists(__filename).then(function (exists) { - if (exists) // do something -}) -``` - -Personally, I use this with generator-based control flow libraries such as [co](https://github.com/visionmedia/co) so I don't need to use implementation-specific wrappers like [co-fs](https://github.com/visionmedia/co-fs). - -```js -var co = require('co') -var fs = require('mz/fs') - -co(function* () { - if (yield fs.exists(__filename)) // do something -})() -``` - -## Promisification - -Many node methods are converted into promises. -Any properties that are deprecated or aren't asynchronous will simply be proxied. -The modules wrapped are: - -- `child_process` -- `crypto` -- `dns` -- `fs` -- `zlib` - -```js -var exec = require('mz/child_process').exec - -exec('node --version').then(function (stdout) { - console.log(stdout) -}) -``` - -## Promise Engine - -If you've installed [bluebird][bluebird], -[bluebird][bluebird] will be used. -`mz` does not install [bluebird][bluebird] for you. - -Otherwise, if you're using a node that has native v8 Promises (v0.11.13+), -then that will be used. - -Otherwise, this library will crash the process and exit, -so you might as well install [bluebird][bluebird] as a dependency! - -## FAQ - -### Can I use this in production? - -If you do, you should probably install [bluebird][bluebird] as -native v8 promises are still pretty raw. - -### Will this make my app faster? - -Nope, probably slower actually. - -### Can I add more features? - -Sure. -Open an issue. - -Currently, the plans are to eventually support: - -- ECMAScript7 Streams - -[bluebird]: https://github.com/petkaantonov/bluebird diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify.js b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify.js deleted file mode 100644 index 87853b3..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify.js +++ /dev/null @@ -1,54 +0,0 @@ - -var promisify -try { - promisify = require('bluebird').promisify -} catch (_) {} - -if (promisify) { - module.exports = function mz_promisify(name, fn) { - return promisify(fn) - } -} else { - if (typeof Promise !== 'function') { - console.error() - console.error('mz: a `Promise` implementation could not be found.') - console.error('mz: please use a version of node that has native Promises') - console.error('mz: or `npm i bluebird`') - console.error() - process.exit(1) - } - - module.exports = function mz_promisify(name, fn) { - return eval('(function ' + name + '() {\n' - + 'var len = arguments.length\n' - + 'var args = new Array(len + 1)\n' - + 'for (var i = 0; i < len; ++i) args[i] = arguments[i]\n' - + 'var lastIndex = i\n' - + 'return new Promise(function (resolve, reject) {\n' - + 'args[lastIndex] = makeCallback(resolve, reject)\n' - + 'fn.apply(null, args)\n' - + '})\n' - + '})') - } -} - -module.exports.bluebird = !!promisify - -function makeCallback(resolve, reject) { - return function(err, value) { - if (err) { - reject(err) - } else { - var len = arguments.length - if (len > 2) { - var values = new Array(len - 1) - for (var i = 1; i < len; ++i) { - values[i - 1] = arguments[i] - } - resolve(values) - } else { - resolve(value) - } - } - } -} diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify_all.js b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify_all.js deleted file mode 100644 index 1edb209..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/_promisify_all.js +++ /dev/null @@ -1,24 +0,0 @@ - -var promisify = require('./_promisify.js') - -module.exports = function (source, exports, methods) { - methods.forEach(function (name) { - if (deprecated(source, name)) return - if (typeof source[name] === 'function') - exports[name] = promisify(name, source[name]) - }) - - // proxy the rest - Object.keys(source).forEach(function (name) { - if (deprecated(source, name)) return - if (exports[name]) return - exports[name] = source[name] - }) -} - -function deprecated(source, name) { - var desc = Object.getOwnPropertyDescriptor(source, name) - if (!desc || !desc.get) return false - if (desc.get.name === 'deprecated') return true - return false -} diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/child_process.js b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/child_process.js deleted file mode 100644 index a4b5162..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/child_process.js +++ /dev/null @@ -1,8 +0,0 @@ - -require('./_promisify_all')( - require('child_process'), - exports, [ - 'exec', - 'execFile', - ] -) diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/crypto.js b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/crypto.js deleted file mode 100644 index 58a0392..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/crypto.js +++ /dev/null @@ -1,9 +0,0 @@ - -require('./_promisify_all')( - require('crypto'), - exports, [ - 'pbkdf2', - 'randomBytes', - 'pseudoRandomBytes', - ] -) diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/dns.js b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/dns.js deleted file mode 100644 index ed45826..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/dns.js +++ /dev/null @@ -1,16 +0,0 @@ - -require('./_promisify_all')( - require('dns'), - exports, [ - 'lookup', - 'resolve', - 'resolve4', - 'resolve6', - 'resolveMx', - 'resolveTxt', - 'resolveSrv', - 'resolveNs', - 'resolveCname', - 'reverse', - ] -) diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/fs.js b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/fs.js deleted file mode 100644 index 5ea92c7..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/fs.js +++ /dev/null @@ -1,42 +0,0 @@ - -var fs = require('fs') - -require('./_promisify_all.js')(fs, exports, [ - 'rename', - 'ftruncate', - 'chown', - 'fchown', - 'lchown', - 'chmod', - 'fchmod', - 'stat', - 'lstat', - 'fstat', - 'link', - 'symlink', - 'readlink', - 'realpath', - 'unlink', - 'rmdir', - 'mkdir', - 'readdir', - 'close', - 'open', - 'utimes', - 'futimes', - 'fsync', - 'write', - 'read', - 'readFile', - 'writeFile', - 'appendFile', -]) - -var promisify = require('./_promisify.js') - -// don't know enough about promises to do this haha -exports.exists = promisify('exists', function exists(filename, done) { - fs.stat(filename, function (err) { - done(null, !err) - }) -}) diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/package.json b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/package.json deleted file mode 100644 index af52df4..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "mz", - "description": "modernize node.js to current ECMAScript standards", - "version": "1.0.0", - "author": { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/normalize/mz" - }, - "devDependencies": { - "bluebird": "2", - "mocha": "1" - }, - "scripts": { - "test": "mocha --reporter spec --bail" - }, - "readme": "\n# MZ - Modernize node.js\n\nModernize node.js to current ECMAScript specifications!\nnode.js will not update their API to ES6+ [for a while](https://github.com/joyent/node/issues/7549).\nThis library is a wrapper for various aspects of node.js' API.\n\n## Installation and Usage\n\nSet `mz` as a dependency and install it.\n\n```bash\nnpm i mz\n```\n\nThen prefix the relevant `require()`s with `mz/`:\n\n```js\nvar fs = require('mz/fs')\n\nfs.exists(__filename).then(function (exists) {\n if (exists) // do something\n})\n```\n\nPersonally, I use this with generator-based control flow libraries such as [co](https://github.com/visionmedia/co) so I don't need to use implementation-specific wrappers like [co-fs](https://github.com/visionmedia/co-fs).\n\n```js\nvar co = require('co')\nvar fs = require('mz/fs')\n\nco(function* () {\n if (yield fs.exists(__filename)) // do something\n})()\n```\n\n## Promisification\n\nMany node methods are converted into promises.\nAny properties that are deprecated or aren't asynchronous will simply be proxied.\nThe modules wrapped are:\n\n- `child_process`\n- `crypto`\n- `dns`\n- `fs`\n- `zlib`\n\n```js\nvar exec = require('mz/child_process').exec\n\nexec('node --version').then(function (stdout) {\n console.log(stdout)\n})\n```\n\n## Promise Engine\n\nIf you've installed [bluebird][bluebird],\n[bluebird][bluebird] will be used.\n`mz` does not install [bluebird][bluebird] for you.\n\nOtherwise, if you're using a node that has native v8 Promises (v0.11.13+),\nthen that will be used.\n\nOtherwise, this library will crash the process and exit,\nso you might as well install [bluebird][bluebird] as a dependency!\n\n## FAQ\n\n### Can I use this in production?\n\nIf you do, you should probably install [bluebird][bluebird] as\nnative v8 promises are still pretty raw.\n\n### Will this make my app faster?\n\nNope, probably slower actually.\n\n### Can I add more features?\n\nSure.\nOpen an issue.\n\nCurrently, the plans are to eventually support:\n\n- ECMAScript7 Streams\n\n[bluebird]: https://github.com/petkaantonov/bluebird\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/normalize/mz/issues" - }, - "homepage": "https://github.com/normalize/mz", - "_id": "mz@1.0.0", - "dist": { - "shasum": "1a2354f3ee6030fbc5a0f560da9d60a62781f1f1" - }, - "_from": "mz@1", - "_resolved": "https://registry.npmjs.org/mz/-/mz-1.0.0.tgz" -} diff --git a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/zlib.js b/node_modules/express-session/node_modules/uid-safe/node_modules/mz/zlib.js deleted file mode 100644 index 5cf3222..0000000 --- a/node_modules/express-session/node_modules/uid-safe/node_modules/mz/zlib.js +++ /dev/null @@ -1,13 +0,0 @@ - -require('./_promisify_all')( - require('zlib'), - exports, [ - 'deflate', - 'deflateRaw', - 'gzip', - 'gunzip', - 'inflate', - 'inflateRaw', - 'unzip', - ] -) diff --git a/node_modules/express-session/node_modules/uid-safe/package.json b/node_modules/express-session/node_modules/uid-safe/package.json deleted file mode 100644 index 8151c4c..0000000 --- a/node_modules/express-session/node_modules/uid-safe/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "uid-safe", - "description": "URL and cookie safe UIDs", - "version": "1.0.1", - "author": { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/crypto-utils/uid-safe" - }, - "dependencies": { - "mz": "1", - "base64-url": "1" - }, - "devDependencies": { - "bluebird": "2", - "mocha": "1" - }, - "scripts": { - "test": "mocha --reporter spec --bail" - }, - "readme": "\n# UID Safe\n\nCreate cryptographically secure UIDs safe for both cookie and URL usage.\nThis is in contrast to modules such as [rand-token](https://github.com/sehrope/node-rand-token)\nand [uid2](https://github.com/coreh/uid2) whose UIDs are actually skewed\ndue to the use of `%` and unnecessarily truncate the UID.\nUse this if you could still use UIDs with `-` and `_` in them.\n\n## API\n\n```js\nvar uid = require('uid-safe')\n```\n\n### uid(byteLength, [cb])\n\nAsynchronously create a UID with a specific byte length.\nBecause `base64` encoding is used underneath, this is not the string length!\nFor example, to create a UID of length 24, you want a byte length of 18!\n\nIf `cb` is not defined, a promise is returned.\nHowever, to use promises, you must either install [bluebird](https://github.com/petkaantonov/bluebird)\nor use a version of node.js that has native promises,\notherwise your process will crash and die.\n\n```js\nuid(18).then(function (string) {\n // do something with the string\n})\n\nuid(18, function (err, string) {\n if (err) throw err\n // do something with the string\n})\n```\n\n### uid.sync(byteLength)\n\nA synchronous version of above.\n\n```js\nvar string = uid.sync(18)\n```\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/crypto-utils/uid-safe/issues" - }, - "homepage": "https://github.com/crypto-utils/uid-safe", - "_id": "uid-safe@1.0.1", - "dist": { - "shasum": "5bd148460a2e84f54f193fd20352c8c3d7de6ac8" - }, - "_from": "uid-safe@1.0.1", - "_resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-1.0.1.tgz" -} diff --git a/node_modules/express-session/node_modules/uid-safe/test.js b/node_modules/express-session/node_modules/uid-safe/test.js deleted file mode 100644 index 3665fb9..0000000 --- a/node_modules/express-session/node_modules/uid-safe/test.js +++ /dev/null @@ -1,46 +0,0 @@ - -var assert = require('assert') - -var uid = require('./') - -describe('uid-url', function () { - describe('uid()', function () { - it('should return a uid of the correct length', function () { - return uid(18).then(function (val) { - assert.equal(24, Buffer.byteLength(val)) - }) - }) - - it('should not contain +, /, or =', function () { - return uid(100000).then(function (val) { - assert(!~val.indexOf('+')) - assert(!~val.indexOf('/')) - assert(!~val.indexOf('=')) - }) - }) - - it('should support callbacks', function (done) { - uid(1000000, function (err, val) { - if (err) return done(err) - assert(!~val.indexOf('+')) - assert(!~val.indexOf('/')) - assert(!~val.indexOf('=')) - done() - }) - }) - }) - - describe('uid.sync()', function () { - it('should return a uid of the correct length', function () { - var val = uid.sync(18) - assert.equal(24, Buffer.byteLength(val)) - }) - - it('should not contain +, /, or =', function () { - var val = uid.sync(100000) - assert(!~val.indexOf('+')) - assert(!~val.indexOf('/')) - assert(!~val.indexOf('=')) - }) - }) -}) diff --git a/node_modules/express-session/node_modules/utils-merge/.travis.yml b/node_modules/express-session/node_modules/utils-merge/.travis.yml deleted file mode 100644 index af92b02..0000000 --- a/node_modules/express-session/node_modules/utils-merge/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: "node_js" -node_js: - - "0.4" - - "0.6" - - "0.8" - - "0.10" diff --git a/node_modules/express-session/node_modules/utils-merge/LICENSE b/node_modules/express-session/node_modules/utils-merge/LICENSE deleted file mode 100644 index e33bd10..0000000 --- a/node_modules/express-session/node_modules/utils-merge/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -(The MIT License) - -Copyright (c) 2013 Jared Hanson - -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/node_modules/express-session/node_modules/utils-merge/README.md b/node_modules/express-session/node_modules/utils-merge/README.md deleted file mode 100644 index 2f94e9b..0000000 --- a/node_modules/express-session/node_modules/utils-merge/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# utils-merge - -Merges the properties from a source object into a destination object. - -## Install - - $ npm install utils-merge - -## Usage - -```javascript -var a = { foo: 'bar' } - , b = { bar: 'baz' }; - -merge(a, b); -// => { foo: 'bar', bar: 'baz' } -``` - -## Tests - - $ npm install - $ npm test - -[![Build Status](https://secure.travis-ci.org/jaredhanson/utils-merge.png)](http://travis-ci.org/jaredhanson/utils-merge) - -## Credits - - - [Jared Hanson](http://github.com/jaredhanson) - -## License - -[The MIT License](http://opensource.org/licenses/MIT) - -Copyright (c) 2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)> diff --git a/node_modules/express-session/node_modules/utils-merge/index.js b/node_modules/express-session/node_modules/utils-merge/index.js deleted file mode 100644 index 4265c69..0000000 --- a/node_modules/express-session/node_modules/utils-merge/index.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Merge object b with object a. - * - * var a = { foo: 'bar' } - * , b = { bar: 'baz' }; - * - * merge(a, b); - * // => { foo: 'bar', bar: 'baz' } - * - * @param {Object} a - * @param {Object} b - * @return {Object} - * @api public - */ - -exports = module.exports = function(a, b){ - if (a && b) { - for (var key in b) { - a[key] = b[key]; - } - } - return a; -}; diff --git a/node_modules/express-session/node_modules/utils-merge/package.json b/node_modules/express-session/node_modules/utils-merge/package.json deleted file mode 100644 index 77f3dd3..0000000 --- a/node_modules/express-session/node_modules/utils-merge/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "utils-merge", - "version": "1.0.0", - "description": "merge() utility function", - "keywords": [ - "util" - ], - "repository": { - "type": "git", - "url": "git://github.com/jaredhanson/utils-merge.git" - }, - "bugs": { - "url": "http://github.com/jaredhanson/utils-merge/issues" - }, - "author": { - "name": "Jared Hanson", - "email": "jaredhanson@gmail.com", - "url": "http://www.jaredhanson.net/" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/MIT" - } - ], - "main": "./index", - "dependencies": {}, - "devDependencies": { - "mocha": "1.x.x", - "chai": "1.x.x" - }, - "scripts": { - "test": "mocha --reporter spec --require test/bootstrap/node test/*.test.js" - }, - "engines": { - "node": ">= 0.4.0" - }, - "readme": "# utils-merge\n\nMerges the properties from a source object into a destination object.\n\n## Install\n\n $ npm install utils-merge\n\n## Usage\n\n```javascript\nvar a = { foo: 'bar' }\n , b = { bar: 'baz' };\n\nmerge(a, b);\n// => { foo: 'bar', bar: 'baz' }\n```\n\n## Tests\n\n $ npm install\n $ npm test\n\n[![Build Status](https://secure.travis-ci.org/jaredhanson/utils-merge.png)](http://travis-ci.org/jaredhanson/utils-merge)\n\n## Credits\n\n - [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>\n", - "readmeFilename": "README.md", - "homepage": "https://github.com/jaredhanson/utils-merge", - "_id": "utils-merge@1.0.0", - "dist": { - "shasum": "0294fb922bb9375153541c4f7096231f287c8af8" - }, - "_from": "utils-merge@1.0.0", - "_resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz" -} diff --git a/node_modules/express-session/package.json b/node_modules/express-session/package.json deleted file mode 100644 index 792e3d9..0000000 --- a/node_modules/express-session/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "express-session", - "version": "1.7.4", - "description": "Simple session middleware for Express", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "Joe Wagner", - "email": "njwjs722@gmail.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/expressjs/session" - }, - "license": "MIT", - "dependencies": { - "buffer-crc32": "0.2.3", - "cookie": "0.1.2", - "cookie-signature": "1.0.4", - "debug": "1.0.4", - "depd": "0.4.4", - "on-headers": "0.0.0", - "uid-safe": "1.0.1", - "utils-merge": "1.0.0" - }, - "devDependencies": { - "after": "0.8.1", - "cookie-parser": "1.3.2", - "istanbul": "0.3.0", - "express": "~4.6.1", - "mocha": "~1.21.0", - "should": "~4.0.4", - "supertest": "~0.13.0" - }, - "engines": { - "node": ">= 0.8.0" - }, - "scripts": { - "test": "mocha --bail --reporter spec test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec test/" - }, - "readme": "# express-session\n\n[![NPM Version](https://badge.fury.io/js/express-session.svg)](https://badge.fury.io/js/express-session)\n[![Build Status](https://travis-ci.org/expressjs/session.svg?branch=master)](https://travis-ci.org/expressjs/session)\n[![Coverage Status](https://img.shields.io/coveralls/expressjs/session.svg?branch=master)](https://coveralls.io/r/expressjs/session)\n\nTHIS REPOSITORY NEEDS A MAINTAINER.\nIf you are interested in maintaining this module, please start contributing by making PRs and solving / discussing unsolved issues.\n\n## API\n\n```js\nvar express = require('express')\nvar session = require('express-session')\n\nvar app = express()\n\napp.use(session({secret: 'keyboard cat'}))\n```\n\n\n### session(options)\n\nSetup session store with the given `options`.\n\nSession data is _not_ saved in the cookie itself, just the session ID.\n\n#### Options\n\n - `name` - cookie name (formerly known as `key`). (default: `'connect.sid'`)\n - `store` - session store instance.\n - `secret` - session cookie is signed with this secret to prevent tampering.\n - `cookie` - session cookie settings.\n - (default: `{ path: '/', httpOnly: true, secure: false, maxAge: null }`)\n - `genid` - function to call to generate a new session ID. (default: uses `uid2` library)\n - `rolling` - forces a cookie set on every response. This resets the expiration date. (default: `false`)\n - `resave` - forces session to be saved even when unmodified. (default: `true`)\n - `proxy` - trust the reverse proxy when setting secure cookies (via \"x-forwarded-proto\" header). When set to `true`, the \"x-forwarded-proto\" header will be used. When set to `false`, all headers are ignored. When left unset, will use the \"trust proxy\" setting from express. (default: `undefined`)\n - `saveUninitialized` - forces a session that is \"uninitialized\" to be saved to the store. A session is uninitialized when it is new but not modified. This is useful for implementing login sessions, reducing server storage usage, or complying with laws that require permission before setting a cookie. (default: `true`)\n - `unset` - controls result of unsetting `req.session` (through `delete`, setting to `null`, etc.). This can be \"keep\" to keep the session in the store but ignore modifications or \"destroy\" to destroy the stored session. (default: `'keep'`)\n\n#### options.genid\n\nGenerate a custom session ID for new sessions. Provide a function that returns a string that will be used as a session ID. The function is given `req` as the first argument if you want to use some value attached to `req` when generating the ID.\n\n**NOTE** be careful you generate unique IDs so your sessions do not conflict.\n\n```js\napp.use(session({\n genid: function(req) {\n return genuuid(); // use UUIDs for session IDs\n },\n secret: 'keyboard cat'\n}))\n```\n\n#### Cookie options\n\nPlease note that `secure: true` is a **recommended** option. However, it requires an https-enabled website, i.e., HTTPS is necessary for secure cookies.\nIf `secure` is set, and you access your site over HTTP, the cookie will not be set. If you have your node.js behind a proxy and are using `secure: true`, you need to set \"trust proxy\" in express:\n\n```js\nvar app = express()\napp.set('trust proxy', 1) // trust first proxy\napp.use(session({\n secret: 'keyboard cat'\n , cookie: { secure: true }\n}))\n```\n\nFor using secure cookies in production, but allowing for testing in development, the following is an example of enabling this setup based on `NODE_ENV` in express:\n\n```js\nvar app = express()\nvar sess = {\n secret: 'keyboard cat'\n cookie: {}\n}\n\nif (app.get('env') === 'production') {\n app.set('trust proxy', 1) // trust first proxy\n sess.cookie.secure = true // serve secure cookies\n}\n\napp.use(session(sess))\n```\n\nBy default `cookie.maxAge` is `null`, meaning no \"expires\" parameter is set\nso the cookie becomes a browser-session cookie. When the user closes the\nbrowser the cookie (and session) will be removed.\n\n### req.session\n\nTo store or access session data, simply use the request property `req.session`,\nwhich is (generally) serialized as JSON by the store, so nested objects\nare typically fine. For example below is a user-specific view counter:\n\n```js\napp.use(session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }}))\n\napp.use(function(req, res, next) {\n var sess = req.session\n if (sess.views) {\n sess.views++\n res.setHeader('Content-Type', 'text/html')\n res.write('

    views: ' + sess.views + '

    ')\n res.write('

    expires in: ' + (sess.cookie.maxAge / 1000) + 's

    ')\n res.end()\n } else {\n sess.views = 1\n res.end('welcome to the session demo. refresh!')\n }\n})\n```\n\n#### Session.regenerate()\n\nTo regenerate the session simply invoke the method, once complete\na new SID and `Session` instance will be initialized at `req.session`.\n\n```js\nreq.session.regenerate(function(err) {\n // will have a new session here\n})\n```\n\n#### Session.destroy()\n\nDestroys the session, removing `req.session`, will be re-generated next request.\n\n```js\nreq.session.destroy(function(err) {\n // cannot access session here\n})\n```\n\n#### Session.reload()\n\nReloads the session data.\n\n```js\nreq.session.reload(function(err) {\n // session updated\n})\n```\n\n#### Session.save()\n\n```js\nreq.session.save(function(err) {\n // session saved\n})\n```\n\n#### Session.touch()\n\nUpdates the `.maxAge` property. Typically this is\nnot necessary to call, as the session middleware does this for you.\n\n### req.session.cookie\n\nEach session has a unique cookie object accompany it. This allows\nyou to alter the session cookie per visitor. For example we can\nset `req.session.cookie.expires` to `false` to enable the cookie\nto remain for only the duration of the user-agent.\n\n#### Cookie.maxAge\n\nAlternatively `req.session.cookie.maxAge` will return the time\nremaining in milliseconds, which we may also re-assign a new value\nto adjust the `.expires` property appropriately. The following\nare essentially equivalent\n\n```js\nvar hour = 3600000\nreq.session.cookie.expires = new Date(Date.now() + hour)\nreq.session.cookie.maxAge = hour\n```\n\nFor example when `maxAge` is set to `60000` (one minute), and 30 seconds\nhas elapsed it will return `30000` until the current request has completed,\nat which time `req.session.touch()` is called to reset `req.session.maxAge`\nto its original value.\n\n```js\nreq.session.cookie.maxAge // => 30000\n```\n\n## Session Store Implementation\n\nEvery session store _must_ implement the following methods\n\n - `.get(sid, callback)`\n - `.set(sid, session, callback)`\n - `.destroy(sid, callback)`\n\nRecommended methods include, but are not limited to:\n\n - `.length(callback)`\n - `.clear(callback)`\n\nFor an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo.\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/expressjs/session/issues" - }, - "homepage": "https://github.com/expressjs/session", - "_id": "express-session@1.7.4", - "dist": { - "shasum": "8f13aa6da8b1f09ae80a4133df1e0467d40e0e2a" - }, - "_from": "express-session@", - "_resolved": "https://registry.npmjs.org/express-session/-/express-session-1.7.4.tgz" -} diff --git a/node_modules/express-session/session/cookie.js b/node_modules/express-session/session/cookie.js deleted file mode 100644 index 86591de..0000000 --- a/node_modules/express-session/session/cookie.js +++ /dev/null @@ -1,128 +0,0 @@ - -/*! - * Connect - session - Cookie - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var merge = require('utils-merge') - , cookie = require('cookie'); - -/** - * Initialize a new `Cookie` with the given `options`. - * - * @param {IncomingMessage} req - * @param {Object} options - * @api private - */ - -var Cookie = module.exports = function Cookie(options) { - this.path = '/'; - this.maxAge = null; - this.httpOnly = true; - if (options) merge(this, options); - this.originalMaxAge = undefined == this.originalMaxAge - ? this.maxAge - : this.originalMaxAge; -}; - -/*! - * Prototype. - */ - -Cookie.prototype = { - - /** - * Set expires `date`. - * - * @param {Date} date - * @api public - */ - - set expires(date) { - this._expires = date; - this.originalMaxAge = this.maxAge; - }, - - /** - * Get expires `date`. - * - * @return {Date} - * @api public - */ - - get expires() { - return this._expires; - }, - - /** - * Set expires via max-age in `ms`. - * - * @param {Number} ms - * @api public - */ - - set maxAge(ms) { - this.expires = 'number' == typeof ms - ? new Date(Date.now() + ms) - : ms; - }, - - /** - * Get expires max-age in `ms`. - * - * @return {Number} - * @api public - */ - - get maxAge() { - return this.expires instanceof Date - ? this.expires.valueOf() - Date.now() - : this.expires; - }, - - /** - * Return cookie data object. - * - * @return {Object} - * @api private - */ - - get data() { - return { - originalMaxAge: this.originalMaxAge - , expires: this._expires - , secure: this.secure - , httpOnly: this.httpOnly - , domain: this.domain - , path: this.path - } - }, - - /** - * Return a serialized cookie string. - * - * @return {String} - * @api public - */ - - serialize: function(name, val){ - return cookie.serialize(name, val, this.data); - }, - - /** - * Return JSON representation of this cookie. - * - * @return {Object} - * @api private - */ - - toJSON: function(){ - return this.data; - } -}; diff --git a/node_modules/express-session/session/memory.js b/node_modules/express-session/session/memory.js deleted file mode 100644 index 4efe99d..0000000 --- a/node_modules/express-session/session/memory.js +++ /dev/null @@ -1,151 +0,0 @@ - -/*! - * Connect - session - MemoryStore - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Store = require('./store'); - -/** - * Shim setImmediate for node.js < 0.10 - */ - -/* istanbul ignore next */ -var defer = typeof setImmediate === 'function' - ? setImmediate - : function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) } - -/** - * Initialize a new `MemoryStore`. - * - * @api public - */ - -var MemoryStore = module.exports = function MemoryStore() { - this.sessions = Object.create(null); -}; - -/** - * Inherit from `Store.prototype`. - */ - -MemoryStore.prototype.__proto__ = Store.prototype; - -/** - * Attempt to fetch session by the given `sid`. - * - * @param {String} sid - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.get = function(sid, fn){ - var self = this; - var sess = self.sessions[sid]; - - if (!sess) { - return defer(fn); - } - - // parse - sess = JSON.parse(sess); - - var expires = typeof sess.cookie.expires === 'string' - ? new Date(sess.cookie.expires) - : sess.cookie.expires; - - // destroy expired session - if (expires && expires <= Date.now()) { - return self.destroy(sid, fn); - } - - defer(fn, null, sess); -}; - -/** - * Commit the given `sess` object associated with the given `sid`. - * - * @param {String} sid - * @param {Session} sess - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.set = function(sid, sess, fn){ - this.sessions[sid] = JSON.stringify(sess); - fn && defer(fn); -}; - -/** - * Destroy the session associated with the given `sid`. - * - * @param {String} sid - * @api public - */ - -MemoryStore.prototype.destroy = function(sid, fn){ - delete this.sessions[sid]; - fn && defer(fn); -}; - -/** - * Invoke the given callback `fn` with all active sessions. - * - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.all = function(fn){ - var keys = Object.keys(this.sessions); - var now = Date.now(); - var obj = Object.create(null); - var sess; - var sid; - - for (var i = 0, len = keys.length; i < len; ++i) { - sid = keys[i]; - - // parse - sess = JSON.parse(this.sessions[sid]); - - expires = typeof sess.cookie.expires === 'string' - ? new Date(sess.cookie.expires) - : sess.cookie.expires; - - if (!expires || expires > now) { - obj[sid] = sess; - } - } - - fn && defer(fn, null, obj); -}; - -/** - * Clear all sessions. - * - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.clear = function(fn){ - this.sessions = {}; - fn && defer(fn); -}; - -/** - * Fetch number of sessions. - * - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.length = function(fn){ - var len = Object.keys(this.sessions).length; - defer(fn, null, len); -}; diff --git a/node_modules/express-session/session/session.js b/node_modules/express-session/session/session.js deleted file mode 100644 index 891f31c..0000000 --- a/node_modules/express-session/session/session.js +++ /dev/null @@ -1,116 +0,0 @@ - -/*! - * Connect - session - Session - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var merge = require('utils-merge') - -/** - * Create a new `Session` with the given request and `data`. - * - * @param {IncomingRequest} req - * @param {Object} data - * @api private - */ - -var Session = module.exports = function Session(req, data) { - Object.defineProperty(this, 'req', { value: req }); - Object.defineProperty(this, 'id', { value: req.sessionID }); - if ('object' == typeof data) merge(this, data); -}; - -/** - * Update reset `.cookie.maxAge` to prevent - * the cookie from expiring when the - * session is still active. - * - * @return {Session} for chaining - * @api public - */ - -Session.prototype.touch = function(){ - return this.resetMaxAge(); -}; - -/** - * Reset `.maxAge` to `.originalMaxAge`. - * - * @return {Session} for chaining - * @api public - */ - -Session.prototype.resetMaxAge = function(){ - this.cookie.maxAge = this.cookie.originalMaxAge; - return this; -}; - -/** - * Save the session data with optional callback `fn(err)`. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.save = function(fn){ - this.req.sessionStore.set(this.id, this, fn || function(){}); - return this; -}; - -/** - * Re-loads the session data _without_ altering - * the maxAge properties. Invokes the callback `fn(err)`, - * after which time if no exception has occurred the - * `req.session` property will be a new `Session` object, - * although representing the same session. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.reload = function(fn){ - var req = this.req - , store = this.req.sessionStore; - store.get(this.id, function(err, sess){ - if (err) return fn(err); - if (!sess) return fn(new Error('failed to load session')); - store.createSession(req, sess); - fn(); - }); - return this; -}; - -/** - * Destroy `this` session. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.destroy = function(fn){ - delete this.req.session; - this.req.sessionStore.destroy(this.id, fn); - return this; -}; - -/** - * Regenerate this request's session. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.regenerate = function(fn){ - this.req.sessionStore.regenerate(this.req, fn); - return this; -}; diff --git a/node_modules/express-session/session/store.js b/node_modules/express-session/session/store.js deleted file mode 100644 index 54294cb..0000000 --- a/node_modules/express-session/session/store.js +++ /dev/null @@ -1,84 +0,0 @@ - -/*! - * Connect - session - Store - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter - , Session = require('./session') - , Cookie = require('./cookie'); - -/** - * Initialize abstract `Store`. - * - * @api private - */ - -var Store = module.exports = function Store(options){}; - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Store.prototype.__proto__ = EventEmitter.prototype; - -/** - * Re-generate the given requests's session. - * - * @param {IncomingRequest} req - * @return {Function} fn - * @api public - */ - -Store.prototype.regenerate = function(req, fn){ - var self = this; - this.destroy(req.sessionID, function(err){ - self.generate(req); - fn(err); - }); -}; - -/** - * Load a `Session` instance via the given `sid` - * and invoke the callback `fn(err, sess)`. - * - * @param {String} sid - * @param {Function} fn - * @api public - */ - -Store.prototype.load = function(sid, fn){ - var self = this; - this.get(sid, function(err, sess){ - if (err) return fn(err); - if (!sess) return fn(); - var req = { sessionID: sid, sessionStore: self }; - sess = self.createSession(req, sess); - fn(null, sess); - }); -}; - -/** - * Create session from JSON `sess` data. - * - * @param {IncomingRequest} req - * @param {Object} sess - * @return {Session} - * @api private - */ - -Store.prototype.createSession = function(req, sess){ - var expires = sess.cookie.expires - , orig = sess.cookie.originalMaxAge; - sess.cookie = new Cookie(sess.cookie); - if ('string' == typeof expires) sess.cookie.expires = new Date(expires); - sess.cookie.originalMaxAge = orig; - req.session = new Session(req, sess); - return req.session; -}; diff --git a/package.json b/package.json index 11bba22..4dba98b 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,5 @@ "express": "3.5.1", "jade": "*", "mongodb": "*", - "monk": "*" } } diff --git a/routes/index.js b/routes/index.js index b6c928e..73ce5af 100644 --- a/routes/index.js +++ b/routes/index.js @@ -1,4 +1,3 @@ -var helpers = require('utils'); var undersc = require('underscore'); var fs = require('fs'); From e24b6473e9d218e3a8827d3c112b02b565b586d2 Mon Sep 17 00:00:00 2001 From: Russell Mays Date: Wed, 13 May 2015 17:41:57 +0000 Subject: [PATCH 10/44] major refactoring --- app.js | 36 ++-------- models/index.js | 9 +-- models/recipe.js | 35 ++++++++- models/utils.js | 134 ----------------------------------- public/javascripts/dev.js | 48 ------------- public/javascripts/linker.js | 7 -- public/javascripts/tabler.js | 73 ------------------- routes/index.js | 119 +++++-------------------------- 8 files changed, 62 insertions(+), 399 deletions(-) delete mode 100644 models/utils.js delete mode 100644 public/javascripts/dev.js delete mode 100644 public/javascripts/linker.js delete mode 100644 public/javascripts/tabler.js diff --git a/app.js b/app.js index 160da92..97e4824 100644 --- a/app.js +++ b/app.js @@ -1,13 +1,6 @@ -var db = require('./mongoose'); - var express = require('express'); -var routes = require('./routes'); -var http = require('http'); -var path = require('path'); - - -// instantiates the application var app = express(); +var path = require('path'); app.set('port', process.env.PORT || 3000); app.set('views', path.join(__dirname, 'views')); @@ -19,32 +12,17 @@ app.use(express.methodOverride()); app.use(app.router); app.use(express.static(__dirname + '/public')); -// development only if ('development' == app.get('env')) { app.use(express.errorHandler()); } +// mongoose connection +var mongoose = require('./mongoose'); +// load routes +require('./routes')(app); - -// DROP RECIPE REFERENCES - -app.get('/', routes.index(Recipe)); -//app.get('/', routes.index) - -//app.post('/versioner', routes.versioner(Recipe)); - - -//app.get('/dev', routes.dev(Recipe)); - - -//app.post('/hierarchy', routes.hierarchy(Recipe)); -//app.post('/tabler', routes.tabler(Recipe)); -//app.post('/save', routes.save); -//app.post('/commit', routes.commit(Recipe)); - -//app.post('/download', routes.downloadRecipe(Recipe)); - +var http = require('http'); http.createServer(app).listen(app.get('port'), function(){ console.log('Express server listening on port ' + app.get('port')); -}); \ No newline at end of file +}); diff --git a/models/index.js b/models/index.js index e7238d8..f1ed39c 100644 --- a/models/index.js +++ b/models/index.js @@ -1,5 +1,6 @@ -// models -Recipe = require('./recipe') +// load models +Recipe = require('./recipe'); -// exports -exports.recipeModel = Recipe.recipeModel; \ No newline at end of file +// export models and functions +exports.recipeModel = Recipe.recipeModel; +exports.getRecipeName = Recipe.getRecipeName; \ No newline at end of file diff --git a/models/recipe.js b/models/recipe.js index c6a7b48..8867f04 100644 --- a/models/recipe.js +++ b/models/recipe.js @@ -1,8 +1,39 @@ var mongoose = require('mongoose'); +// split name and version +// much more modular var recipeSchema = mongoose.Schema({ - identifier: String, + identifier: String, children: [] }, {collection: 'recipes'}); -exports.recipeModel = mongoose.model('Recipe', recipeSchema); \ No newline at end of file +exports.recipeModel = mongoose.model('Recipe' recipeSchema); + +function getRecipeName(rec) { + return rec['identifier'].split('-')[0]; +} +exports.getRecipeName = getRecipeName; + +function getRecipeNames(recipes) { + // accepts array of recipes + var recNames = []; + for (var i = 0; i < recipes.length; i++) { + var recName = getRecipeName(recipes[i]); + if (recNames.indexOf(recName) < 0) { + recNames.push(recName); + } + } + return recNames; +} +exports.getRecipeNames = getRecipeNames; + +function getPrettyVersions(recipes, recipeName) { + var versions = []; + for (var i = 0; i < recipes.length; i++) { + if (recipes[i]['identifier'].split('-')[0] == recipeName) { + var identifierVersion = recipes[i]['identifier'].split('-')[1].split('_').join('.'); + versions.push(identifierVersion); + } + } + return versions; +} diff --git a/models/utils.js b/models/utils.js deleted file mode 100644 index 35afc75..0000000 --- a/models/utils.js +++ /dev/null @@ -1,134 +0,0 @@ -var undersc = require('underscore'); - -exports.getDocNames = function(docs) { - var docNames = []; - for (var i = 0; i < docs.length; i++) { - var identifierName = docs[i]['recipeIdentifier'].split('-')[0]; - if (docNames.indexOf(identifierName) < 0) { - docNames.push(identifierName); - } - } - return docNames; -} - -exports.getStringVersions = function(docs, rn) { - var versions = []; - for (var i = 0; i < docs.length; i++) { - if (docs[i]['recipeIdentifier'].split('-')[0] == rn) { - var identifierVersion = docs[i]['recipeIdentifier'].split('-')[1].split('_').join('.'); - versions.push(identifierVersion); - } - } - return versions; -} - -getChildrenList = function(docs, identifier) { - for (var i = 0; i < docs.length; i++) { - if (docs[i]['recipeIdentifier'] == identifier) { - return docs[i]['recipeChildren']; - } - } -} - -exports.getChildrenList = function(docs, identifier) { - for (var i = 0; i < docs.length; i++) { - if (docs[i]['recipeIdentifier'] == identifier) { - return docs[i]['recipeChildren']; - } - } -} - -getIdentifierList = function(docs, identifier) { - var childList = getChildrenList(docs, identifier); - if (childList) { - return [identifier].concat(childList.map(function(childID) {return getIdentifierList(docs, childID);})); - } - return [identifier]; -} - -exports.getFlatHierarchy = function(docs, identifier) { - return undersc.flatten(getIdentifierList(docs, identifier)); -} - -getOptionsDict = function(docs, identifier) { - for (var i = 0; i < docs.length; i++) { - if (identifier == docs[i]['recipeIdentifier']) { - return docs[i]['recipeOptions']; - } - } -} - -buildIDTree = function(docs, arr) { - for (var i = 0; i < arr.length; i++) { - if (arr[i] instanceof Array) { - buildIDTree(docs, arr[i]); - } else { - var idName = arr[i].split('-')[0]; - var idVersion = arr[i].split('-')[1].split('_').join('.'); - var idOptions = getOptionsDict(docs, arr[i]); - arr[i] = {"tablename": idName, "tableversion": idVersion, "tableoptions": idOptions}; - } - } -} - -exports.getIdentifierTree = function(docs, identifier) { - var idList = getIdentifierList(docs, identifier); - buildIDTree(docs, idList); - // unflatten here - return idList; -} - -buildTrain = function(docs, topLevel, candidates, pathArray) { - if (pathArray[pathArray.length - 1] == topLevel) { - return pathArray; - } - - for (var i = 0; i < candidates.length; i++) { - for (var j = 0; j < docs.length; j++) { - if (docs[j]['recipeIdentifier'] == candidates[i] && docs[j]['recipeChildren'].indexOf(pathArray[pathArray.length-1]) > -1) { - pathArray.push(candidates[i]); - return buildTrain(docs, topLevel, candidates, pathArray); - } - } - } -} - -exports.getDescendents = function(docs, topID, terminalID) { - var idList = undersc.flatten(getIdentifierList(docs, topID)); - var descendentTrain = buildTrain(docs, topID, idList, [terminalID]); - return descendentTrain; -} - -exports.buildTreeRecipes = function(docs, editedArray) { - treeRecipes = []; - for (var i = 1; i < editedArray.length; i++) { - var newRec = {}; - - newRec['recipeIdentifier'] = getLastVersion(docs, editedArray[i]); - newRec['recipeOptions'] = getOptionsDict(docs, editedArray[i]); - - - - var oldChildren = getChildrenList(docs, editedArray[i]); - oldChildren[oldChildren.indexOf(editedArray[i-1])] = getLastVersion(docs, editedArray[i-1]); - newRec['recipeChildren'] = oldChildren; - treeRecipes.push(newRec); - } - return treeRecipes; -} - -getLastVersion = function(docs, recipeIDX) { - var recName = recipeIDX.split('-')[0] - var maj = recipeIDX.split('-')[1].split('_')[0]; - var minor = recipeIDX.split('-')[1].split('_')[1]; - var patchMax = 0; - - for (var i = 0; i < docs.length; i++) { - if (recName == docs[i]['recipeIdentifier'].split('-')[0] && docs[i]['recipeIdentifier'].split('-')[1].split('_')[0] == maj && docs[i]['recipeIdentifier'].split('-')[1].split('_')[1] == minor && parseInt(docs[i]['recipeIdentifier'].split('-')[1].split('_')[2]) > patchMax) { - patchMax = parseInt(docs[i]['recipeIdentifier'].split('-')[1].split('_')[2]); - } - } - var nextPatch = patchMax+1; - return recName+'-'+maj+'_'+minor+'_'+nextPatch; -} -exports.getLastVersion = getLastVersion; diff --git a/public/javascripts/dev.js b/public/javascripts/dev.js deleted file mode 100644 index c9d1d9f..0000000 --- a/public/javascripts/dev.js +++ /dev/null @@ -1,48 +0,0 @@ -$(document).ready(function() { - $('#createChild').hide(); - $('#saver').hide(); - $('#committer').hide(); - $('#loader').click(function() { - window.recipeName = $('select.recn').val(); - window.recipeVersion = $('select.recv').val(); - $('#recipeHierarchy').empty(); - $.post('/hierarchy', {'recipename': recipeName, 'recipevers': recipeVersion}, function(data) { - var hs = ''; - var makeHierarchy = function(hierarchArray) { - if (hierarchArray instanceof Array) { - hs = hs + '
      '; - for (var i = 0; i < hierarchArray.length; i++) { - makeHierarchy(hierarchArray[i]); - } - hs = hs + '
  • '; - } else { - if (hs.substring(hs.length-9) == '') { - hs = hs + ''; - } - hs = hs + '
  • '; - } - } - - makeHierarchy(data); - $('#recipeHierarchy').append(hs+'

    '); - $('.sideLink').first().css('background-color', 'yellow'); - $('#createChild').show(); - $('#saver').show(); - $('#committer').show(); - }); - $.getScript('javascripts/tabler.js'); - $.getScript('javascripts/linker.js'); - }); - - $('#createChild').click(function() { - var newName = prompt("Please enter the new recipe name!"); - - var selected = $('.sideLink').filter(function() { - return $(this).css('background-color') == 'rgb(255, 255, 0)'; - }); - - $.post('/save', {'newname': newName, 'parentname': selected.html(), 'parentvers': selected.data('vers')}, function(data) { - alert(data); - }); - }); -}); diff --git a/public/javascripts/linker.js b/public/javascripts/linker.js deleted file mode 100644 index 49b5f99..0000000 --- a/public/javascripts/linker.js +++ /dev/null @@ -1,7 +0,0 @@ -$('.sideLink').click(function() { - window.recipeName = $(this).html(); - window.recipeVersion = $(this).data('vers'); - $('.sideLink').not($(this)).css('background-color', 'white'); - $(this).css('background-color', 'yellow'); - $.getScript('javascripts/tabler.js'); -}); diff --git a/public/javascripts/tabler.js b/public/javascripts/tabler.js deleted file mode 100644 index bc317dd..0000000 --- a/public/javascripts/tabler.js +++ /dev/null @@ -1,73 +0,0 @@ -$('#recTableHeader').empty(); -$('#recipeForm').empty(); -$('#recipeButtons').empty(); - - -$.post('/tabler', {'recipename': recipeName, 'recipevers': recipeVersion}, function(data) { - var tableName = data['recipeIdentifier'].split('-')[0]; - var tableVersion = data['recipeIdentifier'].split('-')[1].split('_').join('.'); - - $('#recTableHeader').append('

    '+tableName+'

    '); - - var newTableVersion = tableVersion.split('.'); - newTableVersion[2] = 'X'; - var recTable = ''; - - - - $.each(Object.keys(data['recipeOptions']), function(i, val) { - recTable = recTable + ''; - }); - recTable = recTable + '
    Version'+tableVersion+''+newTableVersion.join('.')+'
    '+val+''+data['recipeOptions'][val]+'


    '; - - - $('#recipeForm').append(recTable); - $('#recipeForm').append(''); - - $('#committer').click(function() { - var recName = $('#recTableHeader').children().html(); - var recVersion = 'UNDEFINED'; - var recOptions = {}; - - var optionLabels = []; - $('.'+recName+'-tableLabels').each(function(index) { - optionLabels.push($(this).html()); - }); - - var edited = false; - var optionValues = []; - $('.'+recName+'-tableVals').each(function(index) { - if (index == 0) { - recVersion = $(this).html(); - } else { - if ($(this).val() != '') { - edited = true; - optionValues.push($(this).val()); - } else { - optionValues.push($(this).attr('placeholder')); - } - } - }); - - for (var i = 0; i < optionValues.length; i++) { - recOptions[optionLabels[i]] = optionValues[i]; - } - - var topLevel = ''; - $('.sideLink').each(function(index) { - if (index == 0) { - topLevel = $(this).html()+'-'+$(this).data('vers').split('.').join('_'); - } - }); - - if (edited) { - var newIdentifier = recName + '-' + recVersion.split('.').join('_'); - var newRecipe = {'recipeIdentifier': newIdentifier, 'recipeOptions': recOptions}; - $.post('/commit', {'newRecipe': newRecipe, 'derivedIdentifier': data['recipeIdentifier'],'topLevel': topLevel}, function(data) { - location.reload(); - }); - } else { - alert('Please edit recipe before updating!'); - } - }); -}); diff --git a/routes/index.js b/routes/index.js index 73ce5af..57f0758 100644 --- a/routes/index.js +++ b/routes/index.js @@ -1,14 +1,21 @@ -var undersc = require('underscore'); -var fs = require('fs'); +var models = require('../models'); + +exports = function(app) { + app.get('/', function(req, res) { + // fix this find declaration + var recNames = models.recipe.getRecipeNames(models.recipe.recipeModel.find()); + res.render('index', {'title': 'Cellpack', 'recNames': recNames}); + }); + + app.post('/version', function(req, res) { + models.recipe.recipe + }); + require('./dev')(app); +} + + +// refactor everything down -exports.index = function(recipeModel) { - return function(req, res) { - recipeModel.find(function (e, recipes) { - var recNames = helpers.getDocNames(recipes); - res.render('index', {'title': 'Cellpack', 'recNames': recNames}); - }); - }; -}; exports.versioner = function(recipeModel) { return function(req, res) { @@ -28,95 +35,3 @@ exports.dev = function(recipeModel) { }; }; -exports.hierarchy = function(recipeModel) { - return function(req, res) { - recipeModel.find({}, function(e, recipes) { - var reqID = req.body['recipename']+'-'+req.body['recipevers'].split('.').join('_'); - var identifierTree = helpers.getIdentifierTree(recipes, reqID); - req.session.recTree = identifierTree; - console.log(req.session); - res.send(identifierTree); - }); - }; -}; - -exports.tabler = function(recipeModel) { - return function(req, res) { - var newID = req.body['recipename']+'-'+req.body['recipevers'].split('.').join('_'); - recipeModel.findOne({'recipeIdentifier': newID}, function(e, rec) { - res.send(rec); - }); - }; -}; - -exports.save = function(req, res) { - console.log(req.body); - console.log(req.session); - res.send('Tester Works'); -} - -// UNIFY COMMIT AND CREATE -/* -exports.createRecipe = function(recipeModel) { - return function(req, res) { - console.log(req.body); - if (req.body['newname'] != '') { - var newRecipe = {'recipeIdentifier': req.body['newname']+'-0_0_0'}; - newRecipe['recipeOptions'] = {'testOption': 'defaultVal', 'testOption2': 'defaultVal'}; - newRecipe['recipeChildren'] = []; - recipeModel.find({}, function(e, recipes) { - }); - var createdRecipe = new recipeModel(newRecipe); - createdRecipe.save(); - } - res.redirect('/'); - }; -}; -*/ - -// UNIFY COMMIT AND CREATE -exports.commit = function(recipeModel) { - return function(req, res) { - recipeModel.find({}, function(e, recipes) { - var nextVersion = helpers.getLastVersion(recipes, req.body['newRecipe']['recipeIdentifier']); - var newRecipes = [{'recipeIdentifier': nextVersion, 'recipeOptions': req.body['newRecipe']['recipeOptions']}]; - newRecipes[0]['recipeChildren'] = helpers.getChildrenList(recipes, req.body['derivedIdentifier']); - var treeEdits = helpers.getDescendents(recipes, req.body['topLevel'], req.body['derivedIdentifier']); - var treeRecipes = helpers.buildTreeRecipes(recipes, treeEdits); - newRecipes = newRecipes.concat(treeRecipes); - recipeModel.create(newRecipes); - res.send('Finished'); - }); - }; -}; - - - -exports.downloadRecipe = function(recipeModel) { - return function(req, res) { - var requestID = req.body['recname']+'-'+req.body['recversion'].split('.').join('_'); - recipeModel.find({}, function(e, recipes) { - var dList = helpers.getFlatHierarchy(recipes, requestID); - res.download('./tmp/'+requestID+'-pack.json', requestID+'-pack.json', function(err) { - if (err) { - var recipePack = {}; - for (var i = 0; i < dList.length; i++) { - for (var j = 0; j < recipes.length; j++) { - if (dList[i] == recipes[j]['recipeIdentifier']){ - recipePack[dList[i]] = recipes[j]; - } - } - } - fs.writeFile('./tmp/'+requestID+'-pack.json', JSON.stringify(recipePack, null, 4), function(err) { - res.download('./tmp/'+requestID+'-pack.json', requestID+'-pack.json', function(err) { - if (err) { - console.log(err); - res.redirect('/'); - } - }); - }); - } - }); - }); - }; -}; From 6080a7659602f66dff9983c2d4f2554c213bf563 Mon Sep 17 00:00:00 2001 From: Russell Mays Date: Thu, 14 May 2015 02:01:36 +0000 Subject: [PATCH 11/44] index kinda works --- models/index.js | 3 +- models/recipe.js | 26 ++++------ .../javascripts/{versioner.js => version.js} | 6 +-- routes/dev/index.js | 10 ++++ routes/index.js | 48 ++++++++----------- test-db.json | 5 ++ views/index.jade | 6 +-- 7 files changed, 52 insertions(+), 52 deletions(-) rename public/javascripts/{versioner.js => version.js} (70%) create mode 100644 routes/dev/index.js create mode 100644 test-db.json diff --git a/models/index.js b/models/index.js index f1ed39c..f9b192a 100644 --- a/models/index.js +++ b/models/index.js @@ -3,4 +3,5 @@ Recipe = require('./recipe'); // export models and functions exports.recipeModel = Recipe.recipeModel; -exports.getRecipeName = Recipe.getRecipeName; \ No newline at end of file +exports.getRecipeNames = Recipe.getRecipeNames; +exports.getRecipeVersions = Recipe.getRecipeVersions; \ No newline at end of file diff --git a/models/recipe.js b/models/recipe.js index 8867f04..7e899d8 100644 --- a/models/recipe.js +++ b/models/recipe.js @@ -3,37 +3,29 @@ var mongoose = require('mongoose'); // split name and version // much more modular var recipeSchema = mongoose.Schema({ - identifier: String, - children: [] + name: String, + version: Number, + children: [], + current: Boolean }, {collection: 'recipes'}); -exports.recipeModel = mongoose.model('Recipe' recipeSchema); - -function getRecipeName(rec) { - return rec['identifier'].split('-')[0]; -} -exports.getRecipeName = getRecipeName; +exports.recipeModel = mongoose.model('Recipe', recipeSchema); function getRecipeNames(recipes) { // accepts array of recipes var recNames = []; for (var i = 0; i < recipes.length; i++) { - var recName = getRecipeName(recipes[i]); - if (recNames.indexOf(recName) < 0) { - recNames.push(recName); - } + recNames.push(recipes[i].name); } return recNames; } exports.getRecipeNames = getRecipeNames; -function getPrettyVersions(recipes, recipeName) { +function getRecipeVersions(recipes, recipeName) { var versions = []; for (var i = 0; i < recipes.length; i++) { - if (recipes[i]['identifier'].split('-')[0] == recipeName) { - var identifierVersion = recipes[i]['identifier'].split('-')[1].split('_').join('.'); - versions.push(identifierVersion); - } + versions.push(recipes[i].version); } return versions; } +exports.getRecipeVersions = getRecipeVersions; diff --git a/public/javascripts/versioner.js b/public/javascripts/version.js similarity index 70% rename from public/javascripts/versioner.js rename to public/javascripts/version.js index 481e10d..b97af76 100644 --- a/public/javascripts/versioner.js +++ b/public/javascripts/version.js @@ -1,8 +1,8 @@ $(document).ready(function() { - var recn = $('select.recn'); - var recv = $('select.recv'); + var recn = $('select.nameselect'); + var recv = $('select.versionselect'); recn.change(function() { - $.post('/versioner', {'recipename': recn.val()}, function(data) { + $.post('/version', {'recipename': recn.val()}, function(data) { recv.empty().append(function() { var output = ''; $.each(data, function(versIndex) { diff --git a/routes/dev/index.js b/routes/dev/index.js new file mode 100644 index 0000000..f3e15b3 --- /dev/null +++ b/routes/dev/index.js @@ -0,0 +1,10 @@ +var models = require('../../models'); + +module.exports = function(app) { + // change this completely + // depends entirely on create interface + app.get('/dev', function(req, res) { + var recNames = models.recipe.getRecipeNames(models.recipe.recipeModel.find()); + res.render('dev', {'title': 'Create Recipe'}); + }); +} \ No newline at end of file diff --git a/routes/index.js b/routes/index.js index 57f0758..18125e7 100644 --- a/routes/index.js +++ b/routes/index.js @@ -1,37 +1,29 @@ var models = require('../models'); -exports = function(app) { +module.exports = function(app) { app.get('/', function(req, res) { - // fix this find declaration - var recNames = models.recipe.getRecipeNames(models.recipe.recipeModel.find()); - res.render('index', {'title': 'Cellpack', 'recNames': recNames}); + // adjust query to get names directly + models.recipeModel.find({'current': true}, function(err, recipes) { + //console.log(recipes); + var recNames = models.getRecipeNames(recipes); + res.render('index', {'title': 'Cellpack', 'recNames': recNames}); + }); }); + app.post('/version', function(req, res) { - models.recipe.recipe + var recName = req.body['recipename']; + // adjust query to get versions directly + models.recipeModel.find({'name': recName}, function(err, recipes) { + var recVersions = models.getRecipeVersions(recipes, recName); + res.send(recVersions); + }) }); - require('./dev')(app); -} - - -// refactor everything down + /* + app.post('/download', function (req, res) { + }); + */ -exports.versioner = function(recipeModel) { - return function(req, res) { - recipeModel.find(function(e, recipes) { - var possibleVersions = helpers.getStringVersions(recipes, req.body['recipename']); - res.send(possibleVersions); - }); - }; -}; - -exports.dev = function(recipeModel) { - return function(req, res) { - recipeModel.find(function(e, recipes) { - var recNames = helpers.getDocNames(recipes); - res.render('dev', {'title': 'Modify Recipe', 'recNames': recNames}); - }); - }; -}; - + //require('./dev')(app); +} diff --git a/test-db.json b/test-db.json new file mode 100644 index 0000000..cda11d6 --- /dev/null +++ b/test-db.json @@ -0,0 +1,5 @@ +[ + {name: "recipename1", version: 0, children: [], current: true}, + {name: "recipename2", version: 0, children: [], current: true}, + {name: "recipename3", version: 0, children: [], current: true} +] diff --git a/views/index.jade b/views/index.jade index ab5beff..b95baec 100644 --- a/views/index.jade +++ b/views/index.jade @@ -2,14 +2,14 @@ extends layout block subhead script(src="javascripts/jquery-2.1.1.js") - script(src="javascripts/versioner.js") + script(src="javascripts/version.js") block content div(id="versioncontain", style="height:75px", align="middle") h2 Download autoPACK Recipe   form(method='post', action='/download') - select(name='recname', class='recn') + select(class='nameselect') each rn, index in recNames option(value=rn)= rn - select(name='recversion', class='recv') + select(class='versionselect') button(type="submit") Download From 3cc283cc4406dae764acf273be735f56afa86f7b Mon Sep 17 00:00:00 2001 From: Russell Mays Date: Mon, 25 May 2015 22:22:52 +0000 Subject: [PATCH 12/44] changed everything --- node_modules/underscore/LICENSE | 23 - node_modules/underscore/README.md | 22 - node_modules/underscore/package.json | 54 - node_modules/underscore/underscore-min.js | 6 - node_modules/underscore/underscore.js | 1343 --------------------- public/javascripts/create.js | 11 + routes/create/index.js | 7 + routes/dev/index.js | 10 - routes/index.js | 8 +- views/create.jade | 19 + views/dev.jade | 30 - views/index.jade | 5 +- views/layout.jade | 40 +- 13 files changed, 59 insertions(+), 1519 deletions(-) delete mode 100644 node_modules/underscore/LICENSE delete mode 100644 node_modules/underscore/README.md delete mode 100644 node_modules/underscore/package.json delete mode 100644 node_modules/underscore/underscore-min.js delete mode 100644 node_modules/underscore/underscore.js create mode 100644 public/javascripts/create.js create mode 100644 routes/create/index.js delete mode 100644 routes/dev/index.js create mode 100644 views/create.jade delete mode 100644 views/dev.jade diff --git a/node_modules/underscore/LICENSE b/node_modules/underscore/LICENSE deleted file mode 100644 index 0d6b873..0000000 --- a/node_modules/underscore/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative -Reporters & Editors - -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/node_modules/underscore/README.md b/node_modules/underscore/README.md deleted file mode 100644 index c2ba259..0000000 --- a/node_modules/underscore/README.md +++ /dev/null @@ -1,22 +0,0 @@ - __ - /\ \ __ - __ __ ___ \_\ \ __ _ __ ____ ___ ___ _ __ __ /\_\ ____ - /\ \/\ \ /' _ `\ /'_ \ /'__`\/\ __\/ ,__\ / ___\ / __`\/\ __\/'__`\ \/\ \ /',__\ - \ \ \_\ \/\ \/\ \/\ \ \ \/\ __/\ \ \//\__, `\/\ \__//\ \ \ \ \ \//\ __/ __ \ \ \/\__, `\ - \ \____/\ \_\ \_\ \___,_\ \____\\ \_\\/\____/\ \____\ \____/\ \_\\ \____\/\_\ _\ \ \/\____/ - \/___/ \/_/\/_/\/__,_ /\/____/ \/_/ \/___/ \/____/\/___/ \/_/ \/____/\/_//\ \_\ \/___/ - \ \____/ - \/___/ - -Underscore.js is a utility-belt library for JavaScript that provides -support for the usual functional suspects (each, map, reduce, filter...) -without extending any core JavaScript objects. - -For Docs, License, Tests, and pre-packed downloads, see: -http://underscorejs.org - -Underscore is an open-sourced component of DocumentCloud: -https://github.com/documentcloud - -Many thanks to our contributors: -https://github.com/jashkenas/underscore/contributors diff --git a/node_modules/underscore/package.json b/node_modules/underscore/package.json deleted file mode 100644 index c431978..0000000 --- a/node_modules/underscore/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "underscore", - "description": "JavaScript's functional programming helper library.", - "homepage": "http://underscorejs.org", - "keywords": [ - "util", - "functional", - "server", - "client", - "browser" - ], - "author": { - "name": "Jeremy Ashkenas", - "email": "jeremy@documentcloud.org" - }, - "repository": { - "type": "git", - "url": "git://github.com/jashkenas/underscore.git" - }, - "main": "underscore.js", - "version": "1.6.0", - "devDependencies": { - "docco": "0.6.x", - "phantomjs": "1.9.0-1", - "uglify-js": "2.4.x" - }, - "scripts": { - "test": "phantomjs test/vendor/runner.js test/index.html?noglobals=true", - "build": "uglifyjs underscore.js -c \"evaluate=false\" --comments \"/ .*/\" -m --source-map underscore-min.map -o underscore-min.js", - "doc": "docco underscore.js" - }, - "licenses": [ - { - "type": "MIT", - "url": "https://raw.github.com/jashkenas/underscore/master/LICENSE" - } - ], - "files": [ - "underscore.js", - "underscore-min.js", - "LICENSE" - ], - "readme": " __\n /\\ \\ __\n __ __ ___ \\_\\ \\ __ _ __ ____ ___ ___ _ __ __ /\\_\\ ____\n /\\ \\/\\ \\ /' _ `\\ /'_ \\ /'__`\\/\\ __\\/ ,__\\ / ___\\ / __`\\/\\ __\\/'__`\\ \\/\\ \\ /',__\\\n \\ \\ \\_\\ \\/\\ \\/\\ \\/\\ \\ \\ \\/\\ __/\\ \\ \\//\\__, `\\/\\ \\__//\\ \\ \\ \\ \\ \\//\\ __/ __ \\ \\ \\/\\__, `\\\n \\ \\____/\\ \\_\\ \\_\\ \\___,_\\ \\____\\\\ \\_\\\\/\\____/\\ \\____\\ \\____/\\ \\_\\\\ \\____\\/\\_\\ _\\ \\ \\/\\____/\n \\/___/ \\/_/\\/_/\\/__,_ /\\/____/ \\/_/ \\/___/ \\/____/\\/___/ \\/_/ \\/____/\\/_//\\ \\_\\ \\/___/\n \\ \\____/\n \\/___/\n\nUnderscore.js is a utility-belt library for JavaScript that provides\nsupport for the usual functional suspects (each, map, reduce, filter...)\nwithout extending any core JavaScript objects.\n\nFor Docs, License, Tests, and pre-packed downloads, see:\nhttp://underscorejs.org\n\nUnderscore is an open-sourced component of DocumentCloud:\nhttps://github.com/documentcloud\n\nMany thanks to our contributors:\nhttps://github.com/jashkenas/underscore/contributors\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/jashkenas/underscore/issues" - }, - "_id": "underscore@1.6.0", - "dist": { - "shasum": "d2894fe059a85ed418692c6cacaf2efaea1e599f" - }, - "_from": "underscore@", - "_resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz" -} diff --git a/node_modules/underscore/underscore-min.js b/node_modules/underscore/underscore-min.js deleted file mode 100644 index 3434d6c..0000000 --- a/node_modules/underscore/underscore-min.js +++ /dev/null @@ -1,6 +0,0 @@ -// Underscore.js 1.6.0 -// http://underscorejs.org -// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -// Underscore may be freely distributed under the MIT license. -(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){return n instanceof j?n:this instanceof j?void(this._wrapped=n):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.6.0";var A=j.each=j.forEach=function(n,t,e){if(null==n)return n;if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return;return n};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var O="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(O);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(O);return r},j.find=j.detect=function(n,t,r){var e;return k(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var k=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:k(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,j.property(t))},j.where=function(n,t){return j.filter(n,j.matches(t))},j.findWhere=function(n,t){return j.find(n,j.matches(t))},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);var e=-1/0,u=-1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;o>u&&(e=n,u=o)}),e},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);var e=1/0,u=1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;u>o&&(e=n,u=o)}),e},j.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){return null==t||r?(n.length!==+n.length&&(n=j.values(n)),n[j.random(n.length-1)]):j.shuffle(n).slice(0,Math.max(0,t))};var E=function(n){return null==n?j.identity:j.isFunction(n)?n:j.property(n)};j.sortBy=function(n,t,r){return t=E(t),j.pluck(j.map(n,function(n,e,u){return{value:n,index:e,criteria:t.call(r,n,e,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={};return r=E(r),A(t,function(i,a){var o=r.call(e,i,a,t);n(u,o,i)}),u}};j.groupBy=F(function(n,t,r){j.has(n,t)?n[t].push(r):n[t]=[r]}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=E(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])t?[]:o.call(n,0,t)},j.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},j.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},j.compact=function(n){return j.filter(n,j.identity)};var M=function(n,t,r){return t&&j.every(n,j.isArray)?c.apply(r,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?a.apply(r,n):M(n,t,r):r.push(n)}),r)};j.flatten=function(n,t){return M(n,t,[])},j.without=function(n){return j.difference(n,o.call(arguments,1))},j.partition=function(n,t){var r=[],e=[];return A(n,function(n){(t(n)?r:e).push(n)}),[r,e]},j.uniq=j.unique=function(n,t,r,e){j.isFunction(t)&&(e=r,r=t,t=!1);var u=r?j.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:j.contains(a,r))||(a.push(r),i.push(n[e]))}),i},j.union=function(){return j.uniq(j.flatten(arguments,!0))},j.intersection=function(n){var t=o.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.contains(t,n)})})},j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);return t},j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var R=function(){};j.bind=function(n,t){var r,e;if(_&&n.bind===_)return _.apply(n,o.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));R.prototype=n.prototype;var u=new R;R.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},j.partial=function(n){var t=o.call(arguments,1);return function(){for(var r=0,e=t.slice(),u=0,i=e.length;i>u;u++)e[u]===j&&(e[u]=arguments[r++]);for(;r=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u),e=u=null):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){var e,u,i,a,o,c=function(){var l=j.now()-a;t>l?e=setTimeout(c,t-l):(e=null,r||(o=n.apply(i,u),i=u=null))};return function(){i=this,u=arguments,a=j.now();var l=r&&!e;return e||(e=setTimeout(c,t)),l&&(o=n.apply(i,u),i=u=null),o}},j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return j.partial(t,n)},j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=function(n){if(!j.isObject(n))return[];if(w)return w(n);var t=[];for(var r in n)j.has(n,r)&&t.push(r);return t},j.values=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},j.pairs=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},j.invert=function(n){for(var t={},r=j.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(o)&&o instanceof o)&&"constructor"in n&&"constructor"in t)return!1;r.push(n),e.push(t);var c=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(var s in n)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(s in t)if(j.has(t,s)&&!c--)break;f=!c}}return r.pop(),e.pop(),f};j.isEqual=function(n,t){return S(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return n===void 0},j.has=function(n,t){return f.call(n,t)},j.noConflict=function(){return n._=t,this},j.identity=function(n){return n},j.constant=function(n){return function(){return n}},j.property=function(n){return function(t){return t[n]}},j.matches=function(n){return function(t){if(t===n)return!0;for(var r in n)if(n[r]!==t[r])return!1;return!0}},j.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},j.now=Date.now||function(){return(new Date).getTime()};var T={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};T.unescape=j.invert(T.escape);var I={escape:new RegExp("["+j.keys(T.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(T.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(I[n],function(t){return T[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var r=n[t];return j.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(j,n))}})};var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);var u=new RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(D,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var z=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return j})}).call(this); -//# sourceMappingURL=underscore-min.map \ No newline at end of file diff --git a/node_modules/underscore/underscore.js b/node_modules/underscore/underscore.js deleted file mode 100644 index 9a4cabe..0000000 --- a/node_modules/underscore/underscore.js +++ /dev/null @@ -1,1343 +0,0 @@ -// Underscore.js 1.6.0 -// http://underscorejs.org -// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -// Underscore may be freely distributed under the MIT license. - -(function() { - - // Baseline setup - // -------------- - - // Establish the root object, `window` in the browser, or `exports` on the server. - var root = this; - - // Save the previous value of the `_` variable. - var previousUnderscore = root._; - - // Establish the object that gets returned to break out of a loop iteration. - var breaker = {}; - - // Save bytes in the minified (but not gzipped) version: - var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; - - // Create quick reference variables for speed access to core prototypes. - var - push = ArrayProto.push, - slice = ArrayProto.slice, - concat = ArrayProto.concat, - toString = ObjProto.toString, - hasOwnProperty = ObjProto.hasOwnProperty; - - // All **ECMAScript 5** native function implementations that we hope to use - // are declared here. - var - nativeForEach = ArrayProto.forEach, - nativeMap = ArrayProto.map, - nativeReduce = ArrayProto.reduce, - nativeReduceRight = ArrayProto.reduceRight, - nativeFilter = ArrayProto.filter, - nativeEvery = ArrayProto.every, - nativeSome = ArrayProto.some, - nativeIndexOf = ArrayProto.indexOf, - nativeLastIndexOf = ArrayProto.lastIndexOf, - nativeIsArray = Array.isArray, - nativeKeys = Object.keys, - nativeBind = FuncProto.bind; - - // Create a safe reference to the Underscore object for use below. - var _ = function(obj) { - if (obj instanceof _) return obj; - if (!(this instanceof _)) return new _(obj); - this._wrapped = obj; - }; - - // Export the Underscore object for **Node.js**, with - // backwards-compatibility for the old `require()` API. If we're in - // the browser, add `_` as a global object via a string identifier, - // for Closure Compiler "advanced" mode. - if (typeof exports !== 'undefined') { - if (typeof module !== 'undefined' && module.exports) { - exports = module.exports = _; - } - exports._ = _; - } else { - root._ = _; - } - - // Current version. - _.VERSION = '1.6.0'; - - // Collection Functions - // -------------------- - - // The cornerstone, an `each` implementation, aka `forEach`. - // Handles objects with the built-in `forEach`, arrays, and raw objects. - // Delegates to **ECMAScript 5**'s native `forEach` if available. - var each = _.each = _.forEach = function(obj, iterator, context) { - if (obj == null) return obj; - if (nativeForEach && obj.forEach === nativeForEach) { - obj.forEach(iterator, context); - } else if (obj.length === +obj.length) { - for (var i = 0, length = obj.length; i < length; i++) { - if (iterator.call(context, obj[i], i, obj) === breaker) return; - } - } else { - var keys = _.keys(obj); - for (var i = 0, length = keys.length; i < length; i++) { - if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker) return; - } - } - return obj; - }; - - // Return the results of applying the iterator to each element. - // Delegates to **ECMAScript 5**'s native `map` if available. - _.map = _.collect = function(obj, iterator, context) { - var results = []; - if (obj == null) return results; - if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); - each(obj, function(value, index, list) { - results.push(iterator.call(context, value, index, list)); - }); - return results; - }; - - var reduceError = 'Reduce of empty array with no initial value'; - - // **Reduce** builds up a single result from a list of values, aka `inject`, - // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available. - _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) { - var initial = arguments.length > 2; - if (obj == null) obj = []; - if (nativeReduce && obj.reduce === nativeReduce) { - if (context) iterator = _.bind(iterator, context); - return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator); - } - each(obj, function(value, index, list) { - if (!initial) { - memo = value; - initial = true; - } else { - memo = iterator.call(context, memo, value, index, list); - } - }); - if (!initial) throw new TypeError(reduceError); - return memo; - }; - - // The right-associative version of reduce, also known as `foldr`. - // Delegates to **ECMAScript 5**'s native `reduceRight` if available. - _.reduceRight = _.foldr = function(obj, iterator, memo, context) { - var initial = arguments.length > 2; - if (obj == null) obj = []; - if (nativeReduceRight && obj.reduceRight === nativeReduceRight) { - if (context) iterator = _.bind(iterator, context); - return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator); - } - var length = obj.length; - if (length !== +length) { - var keys = _.keys(obj); - length = keys.length; - } - each(obj, function(value, index, list) { - index = keys ? keys[--length] : --length; - if (!initial) { - memo = obj[index]; - initial = true; - } else { - memo = iterator.call(context, memo, obj[index], index, list); - } - }); - if (!initial) throw new TypeError(reduceError); - return memo; - }; - - // Return the first value which passes a truth test. Aliased as `detect`. - _.find = _.detect = function(obj, predicate, context) { - var result; - any(obj, function(value, index, list) { - if (predicate.call(context, value, index, list)) { - result = value; - return true; - } - }); - return result; - }; - - // Return all the elements that pass a truth test. - // Delegates to **ECMAScript 5**'s native `filter` if available. - // Aliased as `select`. - _.filter = _.select = function(obj, predicate, context) { - var results = []; - if (obj == null) return results; - if (nativeFilter && obj.filter === nativeFilter) return obj.filter(predicate, context); - each(obj, function(value, index, list) { - if (predicate.call(context, value, index, list)) results.push(value); - }); - return results; - }; - - // Return all the elements for which a truth test fails. - _.reject = function(obj, predicate, context) { - return _.filter(obj, function(value, index, list) { - return !predicate.call(context, value, index, list); - }, context); - }; - - // Determine whether all of the elements match a truth test. - // Delegates to **ECMAScript 5**'s native `every` if available. - // Aliased as `all`. - _.every = _.all = function(obj, predicate, context) { - predicate || (predicate = _.identity); - var result = true; - if (obj == null) return result; - if (nativeEvery && obj.every === nativeEvery) return obj.every(predicate, context); - each(obj, function(value, index, list) { - if (!(result = result && predicate.call(context, value, index, list))) return breaker; - }); - return !!result; - }; - - // Determine if at least one element in the object matches a truth test. - // Delegates to **ECMAScript 5**'s native `some` if available. - // Aliased as `any`. - var any = _.some = _.any = function(obj, predicate, context) { - predicate || (predicate = _.identity); - var result = false; - if (obj == null) return result; - if (nativeSome && obj.some === nativeSome) return obj.some(predicate, context); - each(obj, function(value, index, list) { - if (result || (result = predicate.call(context, value, index, list))) return breaker; - }); - return !!result; - }; - - // Determine if the array or object contains a given value (using `===`). - // Aliased as `include`. - _.contains = _.include = function(obj, target) { - if (obj == null) return false; - if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; - return any(obj, function(value) { - return value === target; - }); - }; - - // Invoke a method (with arguments) on every item in a collection. - _.invoke = function(obj, method) { - var args = slice.call(arguments, 2); - var isFunc = _.isFunction(method); - return _.map(obj, function(value) { - return (isFunc ? method : value[method]).apply(value, args); - }); - }; - - // Convenience version of a common use case of `map`: fetching a property. - _.pluck = function(obj, key) { - return _.map(obj, _.property(key)); - }; - - // Convenience version of a common use case of `filter`: selecting only objects - // containing specific `key:value` pairs. - _.where = function(obj, attrs) { - return _.filter(obj, _.matches(attrs)); - }; - - // Convenience version of a common use case of `find`: getting the first object - // containing specific `key:value` pairs. - _.findWhere = function(obj, attrs) { - return _.find(obj, _.matches(attrs)); - }; - - // Return the maximum element or (element-based computation). - // Can't optimize arrays of integers longer than 65,535 elements. - // See [WebKit Bug 80797](https://bugs.webkit.org/show_bug.cgi?id=80797) - _.max = function(obj, iterator, context) { - if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) { - return Math.max.apply(Math, obj); - } - var result = -Infinity, lastComputed = -Infinity; - each(obj, function(value, index, list) { - var computed = iterator ? iterator.call(context, value, index, list) : value; - if (computed > lastComputed) { - result = value; - lastComputed = computed; - } - }); - return result; - }; - - // Return the minimum element (or element-based computation). - _.min = function(obj, iterator, context) { - if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) { - return Math.min.apply(Math, obj); - } - var result = Infinity, lastComputed = Infinity; - each(obj, function(value, index, list) { - var computed = iterator ? iterator.call(context, value, index, list) : value; - if (computed < lastComputed) { - result = value; - lastComputed = computed; - } - }); - return result; - }; - - // Shuffle an array, using the modern version of the - // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle). - _.shuffle = function(obj) { - var rand; - var index = 0; - var shuffled = []; - each(obj, function(value) { - rand = _.random(index++); - shuffled[index - 1] = shuffled[rand]; - shuffled[rand] = value; - }); - return shuffled; - }; - - // Sample **n** random values from a collection. - // If **n** is not specified, returns a single random element. - // The internal `guard` argument allows it to work with `map`. - _.sample = function(obj, n, guard) { - if (n == null || guard) { - if (obj.length !== +obj.length) obj = _.values(obj); - return obj[_.random(obj.length - 1)]; - } - return _.shuffle(obj).slice(0, Math.max(0, n)); - }; - - // An internal function to generate lookup iterators. - var lookupIterator = function(value) { - if (value == null) return _.identity; - if (_.isFunction(value)) return value; - return _.property(value); - }; - - // Sort the object's values by a criterion produced by an iterator. - _.sortBy = function(obj, iterator, context) { - iterator = lookupIterator(iterator); - return _.pluck(_.map(obj, function(value, index, list) { - return { - value: value, - index: index, - criteria: iterator.call(context, value, index, list) - }; - }).sort(function(left, right) { - var a = left.criteria; - var b = right.criteria; - if (a !== b) { - if (a > b || a === void 0) return 1; - if (a < b || b === void 0) return -1; - } - return left.index - right.index; - }), 'value'); - }; - - // An internal function used for aggregate "group by" operations. - var group = function(behavior) { - return function(obj, iterator, context) { - var result = {}; - iterator = lookupIterator(iterator); - each(obj, function(value, index) { - var key = iterator.call(context, value, index, obj); - behavior(result, key, value); - }); - return result; - }; - }; - - // Groups the object's values by a criterion. Pass either a string attribute - // to group by, or a function that returns the criterion. - _.groupBy = group(function(result, key, value) { - _.has(result, key) ? result[key].push(value) : result[key] = [value]; - }); - - // Indexes the object's values by a criterion, similar to `groupBy`, but for - // when you know that your index values will be unique. - _.indexBy = group(function(result, key, value) { - result[key] = value; - }); - - // Counts instances of an object that group by a certain criterion. Pass - // either a string attribute to count by, or a function that returns the - // criterion. - _.countBy = group(function(result, key) { - _.has(result, key) ? result[key]++ : result[key] = 1; - }); - - // Use a comparator function to figure out the smallest index at which - // an object should be inserted so as to maintain order. Uses binary search. - _.sortedIndex = function(array, obj, iterator, context) { - iterator = lookupIterator(iterator); - var value = iterator.call(context, obj); - var low = 0, high = array.length; - while (low < high) { - var mid = (low + high) >>> 1; - iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid; - } - return low; - }; - - // Safely create a real, live array from anything iterable. - _.toArray = function(obj) { - if (!obj) return []; - if (_.isArray(obj)) return slice.call(obj); - if (obj.length === +obj.length) return _.map(obj, _.identity); - return _.values(obj); - }; - - // Return the number of elements in an object. - _.size = function(obj) { - if (obj == null) return 0; - return (obj.length === +obj.length) ? obj.length : _.keys(obj).length; - }; - - // Array Functions - // --------------- - - // Get the first element of an array. Passing **n** will return the first N - // values in the array. Aliased as `head` and `take`. The **guard** check - // allows it to work with `_.map`. - _.first = _.head = _.take = function(array, n, guard) { - if (array == null) return void 0; - if ((n == null) || guard) return array[0]; - if (n < 0) return []; - return slice.call(array, 0, n); - }; - - // Returns everything but the last entry of the array. Especially useful on - // the arguments object. Passing **n** will return all the values in - // the array, excluding the last N. The **guard** check allows it to work with - // `_.map`. - _.initial = function(array, n, guard) { - return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n)); - }; - - // Get the last element of an array. Passing **n** will return the last N - // values in the array. The **guard** check allows it to work with `_.map`. - _.last = function(array, n, guard) { - if (array == null) return void 0; - if ((n == null) || guard) return array[array.length - 1]; - return slice.call(array, Math.max(array.length - n, 0)); - }; - - // Returns everything but the first entry of the array. Aliased as `tail` and `drop`. - // Especially useful on the arguments object. Passing an **n** will return - // the rest N values in the array. The **guard** - // check allows it to work with `_.map`. - _.rest = _.tail = _.drop = function(array, n, guard) { - return slice.call(array, (n == null) || guard ? 1 : n); - }; - - // Trim out all falsy values from an array. - _.compact = function(array) { - return _.filter(array, _.identity); - }; - - // Internal implementation of a recursive `flatten` function. - var flatten = function(input, shallow, output) { - if (shallow && _.every(input, _.isArray)) { - return concat.apply(output, input); - } - each(input, function(value) { - if (_.isArray(value) || _.isArguments(value)) { - shallow ? push.apply(output, value) : flatten(value, shallow, output); - } else { - output.push(value); - } - }); - return output; - }; - - // Flatten out an array, either recursively (by default), or just one level. - _.flatten = function(array, shallow) { - return flatten(array, shallow, []); - }; - - // Return a version of the array that does not contain the specified value(s). - _.without = function(array) { - return _.difference(array, slice.call(arguments, 1)); - }; - - // Split an array into two arrays: one whose elements all satisfy the given - // predicate, and one whose elements all do not satisfy the predicate. - _.partition = function(array, predicate) { - var pass = [], fail = []; - each(array, function(elem) { - (predicate(elem) ? pass : fail).push(elem); - }); - return [pass, fail]; - }; - - // Produce a duplicate-free version of the array. If the array has already - // been sorted, you have the option of using a faster algorithm. - // Aliased as `unique`. - _.uniq = _.unique = function(array, isSorted, iterator, context) { - if (_.isFunction(isSorted)) { - context = iterator; - iterator = isSorted; - isSorted = false; - } - var initial = iterator ? _.map(array, iterator, context) : array; - var results = []; - var seen = []; - each(initial, function(value, index) { - if (isSorted ? (!index || seen[seen.length - 1] !== value) : !_.contains(seen, value)) { - seen.push(value); - results.push(array[index]); - } - }); - return results; - }; - - // Produce an array that contains the union: each distinct element from all of - // the passed-in arrays. - _.union = function() { - return _.uniq(_.flatten(arguments, true)); - }; - - // Produce an array that contains every item shared between all the - // passed-in arrays. - _.intersection = function(array) { - var rest = slice.call(arguments, 1); - return _.filter(_.uniq(array), function(item) { - return _.every(rest, function(other) { - return _.contains(other, item); - }); - }); - }; - - // Take the difference between one array and a number of other arrays. - // Only the elements present in just the first array will remain. - _.difference = function(array) { - var rest = concat.apply(ArrayProto, slice.call(arguments, 1)); - return _.filter(array, function(value){ return !_.contains(rest, value); }); - }; - - // Zip together multiple lists into a single array -- elements that share - // an index go together. - _.zip = function() { - var length = _.max(_.pluck(arguments, 'length').concat(0)); - var results = new Array(length); - for (var i = 0; i < length; i++) { - results[i] = _.pluck(arguments, '' + i); - } - return results; - }; - - // Converts lists into objects. Pass either a single array of `[key, value]` - // pairs, or two parallel arrays of the same length -- one of keys, and one of - // the corresponding values. - _.object = function(list, values) { - if (list == null) return {}; - var result = {}; - for (var i = 0, length = list.length; i < length; i++) { - if (values) { - result[list[i]] = values[i]; - } else { - result[list[i][0]] = list[i][1]; - } - } - return result; - }; - - // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**), - // we need this function. Return the position of the first occurrence of an - // item in an array, or -1 if the item is not included in the array. - // Delegates to **ECMAScript 5**'s native `indexOf` if available. - // If the array is large and already in sort order, pass `true` - // for **isSorted** to use binary search. - _.indexOf = function(array, item, isSorted) { - if (array == null) return -1; - var i = 0, length = array.length; - if (isSorted) { - if (typeof isSorted == 'number') { - i = (isSorted < 0 ? Math.max(0, length + isSorted) : isSorted); - } else { - i = _.sortedIndex(array, item); - return array[i] === item ? i : -1; - } - } - if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted); - for (; i < length; i++) if (array[i] === item) return i; - return -1; - }; - - // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available. - _.lastIndexOf = function(array, item, from) { - if (array == null) return -1; - var hasIndex = from != null; - if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) { - return hasIndex ? array.lastIndexOf(item, from) : array.lastIndexOf(item); - } - var i = (hasIndex ? from : array.length); - while (i--) if (array[i] === item) return i; - return -1; - }; - - // Generate an integer Array containing an arithmetic progression. A port of - // the native Python `range()` function. See - // [the Python documentation](http://docs.python.org/library/functions.html#range). - _.range = function(start, stop, step) { - if (arguments.length <= 1) { - stop = start || 0; - start = 0; - } - step = arguments[2] || 1; - - var length = Math.max(Math.ceil((stop - start) / step), 0); - var idx = 0; - var range = new Array(length); - - while(idx < length) { - range[idx++] = start; - start += step; - } - - return range; - }; - - // Function (ahem) Functions - // ------------------ - - // Reusable constructor function for prototype setting. - var ctor = function(){}; - - // Create a function bound to a given object (assigning `this`, and arguments, - // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if - // available. - _.bind = function(func, context) { - var args, bound; - if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); - if (!_.isFunction(func)) throw new TypeError; - args = slice.call(arguments, 2); - return bound = function() { - if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments))); - ctor.prototype = func.prototype; - var self = new ctor; - ctor.prototype = null; - var result = func.apply(self, args.concat(slice.call(arguments))); - if (Object(result) === result) return result; - return self; - }; - }; - - // Partially apply a function by creating a version that has had some of its - // arguments pre-filled, without changing its dynamic `this` context. _ acts - // as a placeholder, allowing any combination of arguments to be pre-filled. - _.partial = function(func) { - var boundArgs = slice.call(arguments, 1); - return function() { - var position = 0; - var args = boundArgs.slice(); - for (var i = 0, length = args.length; i < length; i++) { - if (args[i] === _) args[i] = arguments[position++]; - } - while (position < arguments.length) args.push(arguments[position++]); - return func.apply(this, args); - }; - }; - - // Bind a number of an object's methods to that object. Remaining arguments - // are the method names to be bound. Useful for ensuring that all callbacks - // defined on an object belong to it. - _.bindAll = function(obj) { - var funcs = slice.call(arguments, 1); - if (funcs.length === 0) throw new Error('bindAll must be passed function names'); - each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); }); - return obj; - }; - - // Memoize an expensive function by storing its results. - _.memoize = function(func, hasher) { - var memo = {}; - hasher || (hasher = _.identity); - return function() { - var key = hasher.apply(this, arguments); - return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments)); - }; - }; - - // Delays a function for the given number of milliseconds, and then calls - // it with the arguments supplied. - _.delay = function(func, wait) { - var args = slice.call(arguments, 2); - return setTimeout(function(){ return func.apply(null, args); }, wait); - }; - - // Defers a function, scheduling it to run after the current call stack has - // cleared. - _.defer = function(func) { - return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1))); - }; - - // Returns a function, that, when invoked, will only be triggered at most once - // during a given window of time. Normally, the throttled function will run - // as much as it can, without ever going more than once per `wait` duration; - // but if you'd like to disable the execution on the leading edge, pass - // `{leading: false}`. To disable execution on the trailing edge, ditto. - _.throttle = function(func, wait, options) { - var context, args, result; - var timeout = null; - var previous = 0; - options || (options = {}); - var later = function() { - previous = options.leading === false ? 0 : _.now(); - timeout = null; - result = func.apply(context, args); - context = args = null; - }; - return function() { - var now = _.now(); - if (!previous && options.leading === false) previous = now; - var remaining = wait - (now - previous); - context = this; - args = arguments; - if (remaining <= 0) { - clearTimeout(timeout); - timeout = null; - previous = now; - result = func.apply(context, args); - context = args = null; - } else if (!timeout && options.trailing !== false) { - timeout = setTimeout(later, remaining); - } - return result; - }; - }; - - // Returns a function, that, as long as it continues to be invoked, will not - // be triggered. The function will be called after it stops being called for - // N milliseconds. If `immediate` is passed, trigger the function on the - // leading edge, instead of the trailing. - _.debounce = function(func, wait, immediate) { - var timeout, args, context, timestamp, result; - - var later = function() { - var last = _.now() - timestamp; - if (last < wait) { - timeout = setTimeout(later, wait - last); - } else { - timeout = null; - if (!immediate) { - result = func.apply(context, args); - context = args = null; - } - } - }; - - return function() { - context = this; - args = arguments; - timestamp = _.now(); - var callNow = immediate && !timeout; - if (!timeout) { - timeout = setTimeout(later, wait); - } - if (callNow) { - result = func.apply(context, args); - context = args = null; - } - - return result; - }; - }; - - // Returns a function that will be executed at most one time, no matter how - // often you call it. Useful for lazy initialization. - _.once = function(func) { - var ran = false, memo; - return function() { - if (ran) return memo; - ran = true; - memo = func.apply(this, arguments); - func = null; - return memo; - }; - }; - - // Returns the first function passed as an argument to the second, - // allowing you to adjust arguments, run code before and after, and - // conditionally execute the original function. - _.wrap = function(func, wrapper) { - return _.partial(wrapper, func); - }; - - // Returns a function that is the composition of a list of functions, each - // consuming the return value of the function that follows. - _.compose = function() { - var funcs = arguments; - return function() { - var args = arguments; - for (var i = funcs.length - 1; i >= 0; i--) { - args = [funcs[i].apply(this, args)]; - } - return args[0]; - }; - }; - - // Returns a function that will only be executed after being called N times. - _.after = function(times, func) { - return function() { - if (--times < 1) { - return func.apply(this, arguments); - } - }; - }; - - // Object Functions - // ---------------- - - // Retrieve the names of an object's properties. - // Delegates to **ECMAScript 5**'s native `Object.keys` - _.keys = function(obj) { - if (!_.isObject(obj)) return []; - if (nativeKeys) return nativeKeys(obj); - var keys = []; - for (var key in obj) if (_.has(obj, key)) keys.push(key); - return keys; - }; - - // Retrieve the values of an object's properties. - _.values = function(obj) { - var keys = _.keys(obj); - var length = keys.length; - var values = new Array(length); - for (var i = 0; i < length; i++) { - values[i] = obj[keys[i]]; - } - return values; - }; - - // Convert an object into a list of `[key, value]` pairs. - _.pairs = function(obj) { - var keys = _.keys(obj); - var length = keys.length; - var pairs = new Array(length); - for (var i = 0; i < length; i++) { - pairs[i] = [keys[i], obj[keys[i]]]; - } - return pairs; - }; - - // Invert the keys and values of an object. The values must be serializable. - _.invert = function(obj) { - var result = {}; - var keys = _.keys(obj); - for (var i = 0, length = keys.length; i < length; i++) { - result[obj[keys[i]]] = keys[i]; - } - return result; - }; - - // Return a sorted list of the function names available on the object. - // Aliased as `methods` - _.functions = _.methods = function(obj) { - var names = []; - for (var key in obj) { - if (_.isFunction(obj[key])) names.push(key); - } - return names.sort(); - }; - - // Extend a given object with all the properties in passed-in object(s). - _.extend = function(obj) { - each(slice.call(arguments, 1), function(source) { - if (source) { - for (var prop in source) { - obj[prop] = source[prop]; - } - } - }); - return obj; - }; - - // Return a copy of the object only containing the whitelisted properties. - _.pick = function(obj) { - var copy = {}; - var keys = concat.apply(ArrayProto, slice.call(arguments, 1)); - each(keys, function(key) { - if (key in obj) copy[key] = obj[key]; - }); - return copy; - }; - - // Return a copy of the object without the blacklisted properties. - _.omit = function(obj) { - var copy = {}; - var keys = concat.apply(ArrayProto, slice.call(arguments, 1)); - for (var key in obj) { - if (!_.contains(keys, key)) copy[key] = obj[key]; - } - return copy; - }; - - // Fill in a given object with default properties. - _.defaults = function(obj) { - each(slice.call(arguments, 1), function(source) { - if (source) { - for (var prop in source) { - if (obj[prop] === void 0) obj[prop] = source[prop]; - } - } - }); - return obj; - }; - - // Create a (shallow-cloned) duplicate of an object. - _.clone = function(obj) { - if (!_.isObject(obj)) return obj; - return _.isArray(obj) ? obj.slice() : _.extend({}, obj); - }; - - // Invokes interceptor with the obj, and then returns obj. - // The primary purpose of this method is to "tap into" a method chain, in - // order to perform operations on intermediate results within the chain. - _.tap = function(obj, interceptor) { - interceptor(obj); - return obj; - }; - - // Internal recursive comparison function for `isEqual`. - var eq = function(a, b, aStack, bStack) { - // Identical objects are equal. `0 === -0`, but they aren't identical. - // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). - if (a === b) return a !== 0 || 1 / a == 1 / b; - // A strict comparison is necessary because `null == undefined`. - if (a == null || b == null) return a === b; - // Unwrap any wrapped objects. - if (a instanceof _) a = a._wrapped; - if (b instanceof _) b = b._wrapped; - // Compare `[[Class]]` names. - var className = toString.call(a); - if (className != toString.call(b)) return false; - switch (className) { - // Strings, numbers, dates, and booleans are compared by value. - case '[object String]': - // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is - // equivalent to `new String("5")`. - return a == String(b); - case '[object Number]': - // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for - // other numeric values. - return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b); - case '[object Date]': - case '[object Boolean]': - // Coerce dates and booleans to numeric primitive values. Dates are compared by their - // millisecond representations. Note that invalid dates with millisecond representations - // of `NaN` are not equivalent. - return +a == +b; - // RegExps are compared by their source patterns and flags. - case '[object RegExp]': - return a.source == b.source && - a.global == b.global && - a.multiline == b.multiline && - a.ignoreCase == b.ignoreCase; - } - if (typeof a != 'object' || typeof b != 'object') return false; - // Assume equality for cyclic structures. The algorithm for detecting cyclic - // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. - var length = aStack.length; - while (length--) { - // Linear search. Performance is inversely proportional to the number of - // unique nested structures. - if (aStack[length] == a) return bStack[length] == b; - } - // Objects with different constructors are not equivalent, but `Object`s - // from different frames are. - var aCtor = a.constructor, bCtor = b.constructor; - if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) && - _.isFunction(bCtor) && (bCtor instanceof bCtor)) - && ('constructor' in a && 'constructor' in b)) { - return false; - } - // Add the first object to the stack of traversed objects. - aStack.push(a); - bStack.push(b); - var size = 0, result = true; - // Recursively compare objects and arrays. - if (className == '[object Array]') { - // Compare array lengths to determine if a deep comparison is necessary. - size = a.length; - result = size == b.length; - if (result) { - // Deep compare the contents, ignoring non-numeric properties. - while (size--) { - if (!(result = eq(a[size], b[size], aStack, bStack))) break; - } - } - } else { - // Deep compare objects. - for (var key in a) { - if (_.has(a, key)) { - // Count the expected number of properties. - size++; - // Deep compare each member. - if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break; - } - } - // Ensure that both objects contain the same number of properties. - if (result) { - for (key in b) { - if (_.has(b, key) && !(size--)) break; - } - result = !size; - } - } - // Remove the first object from the stack of traversed objects. - aStack.pop(); - bStack.pop(); - return result; - }; - - // Perform a deep comparison to check if two objects are equal. - _.isEqual = function(a, b) { - return eq(a, b, [], []); - }; - - // Is a given array, string, or object empty? - // An "empty" object has no enumerable own-properties. - _.isEmpty = function(obj) { - if (obj == null) return true; - if (_.isArray(obj) || _.isString(obj)) return obj.length === 0; - for (var key in obj) if (_.has(obj, key)) return false; - return true; - }; - - // Is a given value a DOM element? - _.isElement = function(obj) { - return !!(obj && obj.nodeType === 1); - }; - - // Is a given value an array? - // Delegates to ECMA5's native Array.isArray - _.isArray = nativeIsArray || function(obj) { - return toString.call(obj) == '[object Array]'; - }; - - // Is a given variable an object? - _.isObject = function(obj) { - return obj === Object(obj); - }; - - // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp. - each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) { - _['is' + name] = function(obj) { - return toString.call(obj) == '[object ' + name + ']'; - }; - }); - - // Define a fallback version of the method in browsers (ahem, IE), where - // there isn't any inspectable "Arguments" type. - if (!_.isArguments(arguments)) { - _.isArguments = function(obj) { - return !!(obj && _.has(obj, 'callee')); - }; - } - - // Optimize `isFunction` if appropriate. - if (typeof (/./) !== 'function') { - _.isFunction = function(obj) { - return typeof obj === 'function'; - }; - } - - // Is a given object a finite number? - _.isFinite = function(obj) { - return isFinite(obj) && !isNaN(parseFloat(obj)); - }; - - // Is the given value `NaN`? (NaN is the only number which does not equal itself). - _.isNaN = function(obj) { - return _.isNumber(obj) && obj != +obj; - }; - - // Is a given value a boolean? - _.isBoolean = function(obj) { - return obj === true || obj === false || toString.call(obj) == '[object Boolean]'; - }; - - // Is a given value equal to null? - _.isNull = function(obj) { - return obj === null; - }; - - // Is a given variable undefined? - _.isUndefined = function(obj) { - return obj === void 0; - }; - - // Shortcut function for checking if an object has a given property directly - // on itself (in other words, not on a prototype). - _.has = function(obj, key) { - return hasOwnProperty.call(obj, key); - }; - - // Utility Functions - // ----------------- - - // Run Underscore.js in *noConflict* mode, returning the `_` variable to its - // previous owner. Returns a reference to the Underscore object. - _.noConflict = function() { - root._ = previousUnderscore; - return this; - }; - - // Keep the identity function around for default iterators. - _.identity = function(value) { - return value; - }; - - _.constant = function(value) { - return function () { - return value; - }; - }; - - _.property = function(key) { - return function(obj) { - return obj[key]; - }; - }; - - // Returns a predicate for checking whether an object has a given set of `key:value` pairs. - _.matches = function(attrs) { - return function(obj) { - if (obj === attrs) return true; //avoid comparing an object to itself. - for (var key in attrs) { - if (attrs[key] !== obj[key]) - return false; - } - return true; - } - }; - - // Run a function **n** times. - _.times = function(n, iterator, context) { - var accum = Array(Math.max(0, n)); - for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i); - return accum; - }; - - // Return a random integer between min and max (inclusive). - _.random = function(min, max) { - if (max == null) { - max = min; - min = 0; - } - return min + Math.floor(Math.random() * (max - min + 1)); - }; - - // A (possibly faster) way to get the current timestamp as an integer. - _.now = Date.now || function() { return new Date().getTime(); }; - - // List of HTML entities for escaping. - var entityMap = { - escape: { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - } - }; - entityMap.unescape = _.invert(entityMap.escape); - - // Regexes containing the keys and values listed immediately above. - var entityRegexes = { - escape: new RegExp('[' + _.keys(entityMap.escape).join('') + ']', 'g'), - unescape: new RegExp('(' + _.keys(entityMap.unescape).join('|') + ')', 'g') - }; - - // Functions for escaping and unescaping strings to/from HTML interpolation. - _.each(['escape', 'unescape'], function(method) { - _[method] = function(string) { - if (string == null) return ''; - return ('' + string).replace(entityRegexes[method], function(match) { - return entityMap[method][match]; - }); - }; - }); - - // If the value of the named `property` is a function then invoke it with the - // `object` as context; otherwise, return it. - _.result = function(object, property) { - if (object == null) return void 0; - var value = object[property]; - return _.isFunction(value) ? value.call(object) : value; - }; - - // Add your own custom functions to the Underscore object. - _.mixin = function(obj) { - each(_.functions(obj), function(name) { - var func = _[name] = obj[name]; - _.prototype[name] = function() { - var args = [this._wrapped]; - push.apply(args, arguments); - return result.call(this, func.apply(_, args)); - }; - }); - }; - - // Generate a unique integer id (unique within the entire client session). - // Useful for temporary DOM ids. - var idCounter = 0; - _.uniqueId = function(prefix) { - var id = ++idCounter + ''; - return prefix ? prefix + id : id; - }; - - // By default, Underscore uses ERB-style template delimiters, change the - // following template settings to use alternative delimiters. - _.templateSettings = { - evaluate : /<%([\s\S]+?)%>/g, - interpolate : /<%=([\s\S]+?)%>/g, - escape : /<%-([\s\S]+?)%>/g - }; - - // When customizing `templateSettings`, if you don't want to define an - // interpolation, evaluation or escaping regex, we need one that is - // guaranteed not to match. - var noMatch = /(.)^/; - - // Certain characters need to be escaped so that they can be put into a - // string literal. - var escapes = { - "'": "'", - '\\': '\\', - '\r': 'r', - '\n': 'n', - '\t': 't', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g; - - // JavaScript micro-templating, similar to John Resig's implementation. - // Underscore templating handles arbitrary delimiters, preserves whitespace, - // and correctly escapes quotes within interpolated code. - _.template = function(text, data, settings) { - var render; - settings = _.defaults({}, settings, _.templateSettings); - - // Combine delimiters into one regular expression via alternation. - var matcher = new RegExp([ - (settings.escape || noMatch).source, - (settings.interpolate || noMatch).source, - (settings.evaluate || noMatch).source - ].join('|') + '|$', 'g'); - - // Compile the template source, escaping string literals appropriately. - var index = 0; - var source = "__p+='"; - text.replace(matcher, function(match, escape, interpolate, evaluate, offset) { - source += text.slice(index, offset) - .replace(escaper, function(match) { return '\\' + escapes[match]; }); - - if (escape) { - source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; - } - if (interpolate) { - source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; - } - if (evaluate) { - source += "';\n" + evaluate + "\n__p+='"; - } - index = offset + match.length; - return match; - }); - source += "';\n"; - - // If a variable is not specified, place data values in local scope. - if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; - - source = "var __t,__p='',__j=Array.prototype.join," + - "print=function(){__p+=__j.call(arguments,'');};\n" + - source + "return __p;\n"; - - try { - render = new Function(settings.variable || 'obj', '_', source); - } catch (e) { - e.source = source; - throw e; - } - - if (data) return render(data, _); - var template = function(data) { - return render.call(this, data, _); - }; - - // Provide the compiled function source as a convenience for precompilation. - template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}'; - - return template; - }; - - // Add a "chain" function, which will delegate to the wrapper. - _.chain = function(obj) { - return _(obj).chain(); - }; - - // OOP - // --------------- - // If Underscore is called as a function, it returns a wrapped object that - // can be used OO-style. This wrapper holds altered versions of all the - // underscore functions. Wrapped objects may be chained. - - // Helper function to continue chaining intermediate results. - var result = function(obj) { - return this._chain ? _(obj).chain() : obj; - }; - - // Add all of the Underscore functions to the wrapper object. - _.mixin(_); - - // Add all mutator Array functions to the wrapper. - each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { - var method = ArrayProto[name]; - _.prototype[name] = function() { - var obj = this._wrapped; - method.apply(obj, arguments); - if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0]; - return result.call(this, obj); - }; - }); - - // Add all accessor Array functions to the wrapper. - each(['concat', 'join', 'slice'], function(name) { - var method = ArrayProto[name]; - _.prototype[name] = function() { - return result.call(this, method.apply(this._wrapped, arguments)); - }; - }); - - _.extend(_.prototype, { - - // Start chaining a wrapped Underscore object. - chain: function() { - this._chain = true; - return this; - }, - - // Extracts the result from a wrapped and chained object. - value: function() { - return this._wrapped; - } - - }); - - // AMD registration happens at the end for compatibility with AMD loaders - // that may not enforce next-turn semantics on modules. Even though general - // practice for AMD registration is to be anonymous, underscore registers - // as a named module because, like jQuery, it is a base library that is - // popular enough to be bundled in a third party lib, but not be part of - // an AMD load request. Those cases could generate an error when an - // anonymous define() is called outside of a loader request. - if (typeof define === 'function' && define.amd) { - define('underscore', [], function() { - return _; - }); - } -}).call(this); diff --git a/public/javascripts/create.js b/public/javascripts/create.js new file mode 100644 index 0000000..0e63805 --- /dev/null +++ b/public/javascripts/create.js @@ -0,0 +1,11 @@ +var recTree = []; + +alert("hey"); + +console.log(recTree); + +/* +$(document).ready(function() { + +}) +*/ \ No newline at end of file diff --git a/routes/create/index.js b/routes/create/index.js new file mode 100644 index 0000000..8cf16d4 --- /dev/null +++ b/routes/create/index.js @@ -0,0 +1,7 @@ +var models = require('../../models'); + +module.exports = function(app) { + app.get('/create', function(req, res) { + res.render('create', {'title': 'Recipe Development'}); + }); +} \ No newline at end of file diff --git a/routes/dev/index.js b/routes/dev/index.js deleted file mode 100644 index f3e15b3..0000000 --- a/routes/dev/index.js +++ /dev/null @@ -1,10 +0,0 @@ -var models = require('../../models'); - -module.exports = function(app) { - // change this completely - // depends entirely on create interface - app.get('/dev', function(req, res) { - var recNames = models.recipe.getRecipeNames(models.recipe.recipeModel.find()); - res.render('dev', {'title': 'Create Recipe'}); - }); -} \ No newline at end of file diff --git a/routes/index.js b/routes/index.js index 18125e7..189a935 100644 --- a/routes/index.js +++ b/routes/index.js @@ -20,10 +20,12 @@ module.exports = function(app) { }) }); - /* + app.post('/download', function (req, res) { + console.log(req.body); + //res.attachment({ some: 'json' }); + res.redirect('/'); }); - */ - //require('./dev')(app); + require('./create')(app); } diff --git a/views/create.jade b/views/create.jade new file mode 100644 index 0000000..1e3216b --- /dev/null +++ b/views/create.jade @@ -0,0 +1,19 @@ +extends layout + +block subhead + script(src="javascripts/create.js") + +block content + div(align="middle") + div + h2 Create New Recipe + div(id="createinterface" style="height:150px") + div(id="recipetree", style="float:left;width:39%;height:100%;overflow:scroll") + + div(id="edittable", style="float:right;width:60%;height:100%") + div(id="recipetable", align="middle;overflow:scroll") + div(id="tablecontrol") + button(id="individualsave", type="button") Save Individual Recipe + br + div(id="submitButton", align="middle") + button(id="committer", type="button") Save Complete Recipe diff --git a/views/dev.jade b/views/dev.jade deleted file mode 100644 index 4e67f7b..0000000 --- a/views/dev.jade +++ /dev/null @@ -1,30 +0,0 @@ -extends layout - -block subhead - script(src="javascripts/jquery-2.1.1.js") - script(src="javascripts/versioner.js") - script(src="javascripts/dev.js") - -block content - div(id="interface", align="middle") - h2 Create new version of recipe   - select(name='recname', class='recn') - each rn, index in recNames - option(value=rn)= rn - select(name='recversion', class="recv") - button(id="loader", type="button") Load - br - br - div(id="editInterface" style="height:150px") - div(id="recipeTree", style="float:left;width:39%;height:100%") - div(id="recipeHierarchy", style="overflow:scroll") - div(id="hierarchyControl", align="middle") - button(id="createChild", type="button") Add Child - div(id="tableInterface", style="width:60%;float:right;height:100%") - div(id="recTableHeader", align="middle") - div(id="recipeTable", align="middle", style="overflow:scroll") - form(id="recipeForm") - br - br - div(id="submitButton", align="middle") - button(id="committer", type="button") Commit All Changes diff --git a/views/index.jade b/views/index.jade index b95baec..c3912e8 100644 --- a/views/index.jade +++ b/views/index.jade @@ -1,15 +1,14 @@ extends layout block subhead - script(src="javascripts/jquery-2.1.1.js") script(src="javascripts/version.js") block content div(id="versioncontain", style="height:75px", align="middle") h2 Download autoPACK Recipe   form(method='post', action='/download') - select(class='nameselect') + select(name='recname', class='nameselect') each rn, index in recNames option(value=rn)= rn - select(class='versionselect') + select(name='recversion', class='versionselect') button(type="submit") Download diff --git a/views/layout.jade b/views/layout.jade index aa8e748..648467e 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -1,28 +1,18 @@ doctype html html - head - title= title - link(rel='stylesheet', href='/stylesheets/style.css') - block subhead + head + title= title + link(rel='stylesheet', href='stylesheets/style.css') + script(src="javascripts/jquery-2.1.1.js") + block subhead + body + div(id="sitecontainer", style="width:900px, height:1000px") + div(id="banner", style="height:125px", align="right") + img(src="images/autopack.png") - body - div(id="container", style="width:900px, height:1000px") - - div(id="banner", style="height:125px", align="right") - img(src="images/autopack.png") - - div(id="menu", style="height:50px", align="middle") - h2 Interface   - select - option Beginner - option Intermediate - option Advanced - option Debug - - div(id="links", style="height:50px") - div(style="float:left", align="center") - a(href="/") Recipe Download - div(style="float:right", align="center") - a(href="/dev") Recipe Development - - block content + div(id="tabs", style="height:50px") + div(style="float:left", align="center") + a(href="/") Download Recipe + div(style="float:right", align="center") + a(href="/create") Create Recipe + block content From 9e0c1734f707cf859b561fa91608e3376845ea27 Mon Sep 17 00:00:00 2001 From: Russell Mays Date: Mon, 25 May 2015 23:49:43 +0000 Subject: [PATCH 13/44] finally clientside --- public/javascripts/create.js | 19 ++++++++++--------- public/javascripts/jquery-2.1.1.js | 4 ---- views/create.jade | 6 ++++-- views/index.jade | 2 +- views/layout.jade | 4 ++-- 5 files changed, 17 insertions(+), 18 deletions(-) delete mode 100644 public/javascripts/jquery-2.1.1.js diff --git a/public/javascripts/create.js b/public/javascripts/create.js index 0e63805..90a7f34 100644 --- a/public/javascripts/create.js +++ b/public/javascripts/create.js @@ -1,11 +1,12 @@ -var recTree = []; +var TreeView = Backbone.View.extend({ + el: 'recipetree', + initialize: function() { + this.render(); + }, + render: function() { + this.$el.html("Hello World!"); + } +}); -alert("hey"); +var treeView = new TreeView(); -console.log(recTree); - -/* -$(document).ready(function() { - -}) -*/ \ No newline at end of file diff --git a/public/javascripts/jquery-2.1.1.js b/public/javascripts/jquery-2.1.1.js deleted file mode 100644 index e5ace11..0000000 --- a/public/javascripts/jquery-2.1.1.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ -!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="
    ",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b) -},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*\s*$/g,ib={option:[1,""],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("